text:
"""
This module contains common functions to communicate with the Central Engine.

The most important class is `TscCommonLib`, which is exposed both in Twister tests and libraries.

The exception classes are used to gracefully crash the Twister tests.
"""
from __future__ import print_function

import os
import copy
import time
import ast
import inspect
import binascii
import platform
import marshal
import rpyc
from rpyc import BgServingThread
# This will work, because TWISTER_PATH is appended to sys.path.
try:
    from ce_libs import PROXY_ADDR, USER, EP, SUT
except Exception:
    raise Exception('CommonLib must run from Twister!\n')

TWISTER_PATH = os.getenv('TWISTER_PATH')
if not TWISTER_PATH:
    raise Exception('$TWISTER_PATH environment variable is not set!\n')

__all__ = ['TscCommonLib', 'ExceptionTestFail', 'ExceptionTestAbort', 'ExceptionTestTimeout', 'ExceptionTestSkip']

#

class TwisterException(Warning):
    """
    Base custom exception.
    """
    def __init__(self, value=''):
        self.value = value
    def __str__(self):
        return str(self.value)

class ExceptionTestFail(TwisterException):
    """
    Custom exception, caught by the EP.
    """
    pass

class ExceptionTestAbort(TwisterException):
    """
    Custom exception, caught by the EP.
    """
    pass

class ExceptionTestTimeout(TwisterException):
    """
    Custom exception, caught by the EP.
    """
    pass

class ExceptionTestSkip(TwisterException):
    """
    Custom exception, caught by the EP.
    """
    pass

#

class TscCommonLib(object):
    """
    Base library for Twister tests and libraries.

    All functions are exposed automatically.
    """

    platform_sys = platform.system().lower()
    """ Current platform. (ex: Windows, Linux) """

    __ce_proxy = None
    """ Pointer to Central Engine via RPyc. """

    proxy_path = PROXY_ADDR
    """ The Central Engine RPyc address. """

    userName = USER
    """ The username running this test, or libary. """

    epName = EP
    """ The EP running this test, or libary. """

    global_vars = {}
    """ All global variables, shared between tests and libaries. """

    interact_data = None
    _SUITE_ID = 0
    _FILE_ID = 0

    def __init__(self):
        """
        Some initialization code.
        """
        self._reload_libs()

    def _reload_libs(self):
        """ Internal function. Reload libraries. """
        from common import iniparser
        ce_path = '{}/.twister_cache/{}/ce_libs/ce_libs.py'.format(TWISTER_PATH, self.epName)
        cfg = iniparser.ConfigObj(ce_path)
        for n, v in cfg.iteritems():
            setattr(self, '_' + n, v)
        del cfg

    @property
    def sutName(self):
        """ Returns current SUT name. """
        self._reload_libs()
        name = self.ce_proxy.get_suite_variable(self.epName, self._SUITE_ID, 'sut')
        return name

    @property
    def SUT(self):
        """ Returns current SUT name; same as sutName. """
        self._reload_libs()
        name = self.ce_proxy.get_suite_variable(self.epName, self._SUITE_ID, 'sut')
        return name

    @property
    def SUITE_ID(self):
        """ Returns current suite ID. """
        self._reload_libs()
        return self._SUITE_ID

    @property
    def FILE_ID(self):
        """ Returns current file ID. """
        self._reload_libs()
        return self._FILE_ID

    @property
    def SUITE_NAME(self):
        """ Returns current suite name. """
        self._reload_libs()
        name = self.ce_proxy.get_suite_variable(self.epName, self._SUITE_ID, 'name')
        return name

    @property
    def FILE_NAME(self):
        """ Returns current file name. """
        self._reload_libs()
        name = self.ce_proxy.get_file_variable(self.epName, self._FILE_ID, 'file')
        if name:
            name = os.path.split(name)[1]
        return name

    @classmethod
    def _ce_proxy(cls):
        """
        Dinamically connect to the Central Engine.
        This is a class method.
        """
        stack = inspect.stack()
        # The upper stack is either the EP, or the library that derives this
        stack_fpath = stack[1][1]
        stack_fname = os.path.split(stack_fpath)[1]
        proxy = None

        # If the upper stack is not ExecutionProcess, the library is derived
        if stack_fname != 'ExecutionProcess.py':
            # The EP stack is always the last
            ep_code = stack[-1][0]
            # It's impossible to access the globals from the EP any other way
            p = ep_code.f_globals.get('ceProxy')
            if p:
                return p.root
        del stack, stack_fpath

        # Try to reuse the old connection
        try:
            cls.__ce_proxy.echo('ping')
            return cls.__ce_proxy
        except Exception:
            pass

        # RPyc config
        config = {
            'allow_pickle': True,
            'allow_getattr': True,
            'allow_setattr': True,
            'allow_delattr': True,
            'allow_all_attrs': True,
            }

        ce_ip, ce_port = cls.proxy_path.split(':')

        # If the old connection is broken, connect to the RPyc server
        try:
            # Transform XML-RPC port into RPyc Port; RPyc port = XML-RPC port + 10 !
            ce_port = int(ce_port) + 10
            proxy = rpyc.connect(ce_ip, ce_port, config=config)
            proxy.root.hello('lib::{}'.format(cls.epName))
        except Exception:
            print('*ERROR* Cannot connect to CE path `{}`! Exiting!'.format(cls.proxy_path))
            raise Exception('Cannot connect to CE')

        # Authenticate on RPyc server
        try:
            proxy.root.login(cls.userName, 'EP')
        except Exception:
            print('*ERROR* Cannot authenticate on CE path `{}`! Exiting!'.format(cls.proxy_path))
            raise Exception('Cannot authenticate on CE')

        # Launch bg server
        try:
            BgServingThread(proxy)
            cls.__ce_proxy = proxy.root
            return cls.__ce_proxy
        except Exception:
            print('*ERROR* Cannot launch Bg serving thread! Exiting!')
            raise Exception('Cannot launch Bg thread')

    @property
    def ce_proxy(self):
        """
        Pointer to the Central Engine RPyc connection.
        """
        return self._ce_proxy()

    @staticmethod
    def test_fail(reason=''):
        """
        Gracefully crash test with status `Fail`.
        """
        raise ExceptionTestFail(reason)

    @staticmethod
    def test_abort(reason=''):
        """
        Gracefully crash test with status `Abort`.
        """
        raise ExceptionTestAbort(reason)

    @staticmethod
    def test_timeout(reason=''):
        """
        Gracefully crash test with status `Timeout`.
        """
        raise ExceptionTestTimeout(reason)

    @staticmethod
    def test_skip(reason=''):
        """
        Gracefully crash test with status `Skip`.
        """
        raise ExceptionTestSkip(reason)

    def set_details(self, details):
        """
        Set additional information for a test.
        Ex: a return value, a parameter to be inserted in the database, etc
        """
        flag = True
        if isinstance(details, dict):
            for key in details:
                if not self.ce_proxy.set_custom_file_variable(self.epName, self.FILE_ID, key, details[key]):
                    print('*ERROR* Unable to set variable: `{}`. It may be used for internal use only.'.format(key))
                    flag = False
        else:
            print('*ERROR* Usage: set_details({"key1":"value1","key2":"value2"...})')
            flag = False
        return flag

    def interact(self, type, msg, timeout=0, options={}):
        """
        This function should be called only from a test!
        It gives to user the opportunity to interact with tests.
        Params:
        type: type of the interaction: confirmation window, input window, continue/cancel window
        msg: the message that will be printed in the window
        return: True/False or a string
        """
        self.interact_data = None
        print('\n>> Waiting for user interaction >>')
        id = binascii.hexlify(os.urandom(4))
        self.ce_proxy.interact(id, self.epName, type, msg, timeout, options)
        time.sleep(1)
        counter = 0.0
        while self.interact_data == None:
            time.sleep(0.5)
            if timeout > 0:
                counter += 0.5
                if counter > timeout:
                    break
        counter = 0.0
        reason = 'User action'
        self.ce_proxy.remove_interact(id, self.epName, type, msg, timeout, options, reason)
        if type == 'decide' and self.interact_data in [None, 'false']:
            # abort test!
            if self.interact_data == None:
                reason = 'Decide timeout expired!'
            else:
                reason = 'Test aborted by user!'
            self.ce_proxy.set_file_status(self.epName, self._FILE_ID, 5, timeout)
            #self.ce_proxy.set_ep_status(self.epName, 2)
            print('\n>> Test aborted by user! >>')
            raise ExceptionTestAbort(reason)

        if self.interact_data == None:
            reason = 'Timeout expired'
            print('Interaction timeout expired!')
            if type == 'msg':
                self.interact_data = True
            elif type == 'options' and options:
                self.interact_data = options['default']

        print('\n>> Interaction response: {} >>'.format(self.interact_data))
        self.ce_proxy.set_ep_status(self.epName, 2)
        return self.interact_data

    def log_msg(self, log_type, log_message):
        """
        Send a message in a specific log, on Central Engine.
        """
        if not log_message:
            log_message = ''
        else:
            log_message = str(log_message)
        self.ce_proxy.log_message(log_type, log_message)

    @classmethod
    def get_global(cls, var):
        """
        Function to get variables saved from Test files.
        The same data must be used, both in Testcase and derived Libraries.
        """
        if var in cls.global_vars:
            return cls.global_vars[var]
        # Else...
        ce = cls._ce_proxy()
        return ce.get_global_variable(var)

    @classmethod
    def set_global(cls, var, value):
        """
        Function to keep variables sent from Test files.
        The same data must be used, both in Testcase and derived Libraries.
        """
        try:
            marshal.dumps(value)
            ce = cls._ce_proxy()
            return ce.set_global_variable(var, value)
        except Exception:
            cls.global_vars[var] = value
            return True

    def get_config(self, cfg_path, var_path=''):
        """
        Get data from a config, using the full path to the config file and
        the full path to a config variable in that file.
        """
        return self.ce_proxy.get_config(cfg_path, var_path)

    def set_binding(self, config_name, component, sut):
        """
        Method to set a config->SUT binding
        """
        return self.ce_proxy.set_binding(config_name, component, sut)

    def del_binding(self, config_name, component):
        """
        Method that deletes a binding from the list of config->SUT bindings
        """
        return self.ce_proxy.del_binding(config_name, component)

    def get_binding(self, cfg_root):
        """
        Function to get a config -> SUT binding.
        """
        bindings = self.ce_proxy.get_user_variable('bindings') or {}
        return bindings.get(cfg_root)

    def get_bind_id(self, component_name, test_config='default_binding'):
        """
        Function to get a config -> SUT binding ID.
        Shortcut function.
        """
        bindings = self.ce_proxy.get_user_variable('bindings') or {}
        # Fix cfg root maybe ?
        if not test_config:
            test_config = 'default_binding'
        config_data = bindings.get(test_config, {})
        # If the component cannot be found in the requested config, search in default config
        if test_config != 'default_binding' and (component_name not in config_data):
            config_data = bindings.get('default_binding', {})
        return config_data.get(component_name, False)

    def get_bind_name(self, component_name, test_config='default_binding'):
        """
        Function to get a cfg -> SUT binding name.
        Shortcut function.
        """
        sid = self.get_bind_id(component_name, test_config)
        if not sid:
            return False
        sut = self.get_sut(sid)
        if not sut:
            sut = {}
        return sut.get('path', False)

    def get_iter_value(self, iter_name, cfg_name=None):
        """
        Find iteration value, for a specific iterator name.
        `iter_name` is the name of the iterator to search.
        Returns The iterator value.
        """
        iterNr = self.ce_proxy.get_file_variable(self.epName, self._FILE_ID, 'iterationNr')

        found = []
        if cfg_name is not None:
            # if the test configuration name is valid, find it in iterNr
            cfg_iters = [cfg_item.strip() for cfg_item in iterNr.strip().\
            split(',') if cfg_name in cfg_item.split('#')[0]]
            # now we have a list with iterators declared in cfg_name file
            # search the specified one
            found = [iter_val.split('=')[-1] for iter_val in cfg_iters \
            if '#{}='.format(iter_name) in iter_val]
        else:
            # no test configuration name provided, search for all iterators
            # that match iter_name
            found = [i.split('=')[-1] for i in iterNr.split(',') \
            if '#{}='.format(iter_name) in i]

        if not found:
            return ''
        return found[0]

    def get_iter_comp(self, iter_name, cfg_name=None):
        """
        Find component name that is parent of specific iterator name.
        `iter_name` is the name of the iterator to search.
        Returns the component name
        """
        iterNr = self.ce_proxy.get_file_variable(self.epName, self._FILE_ID, 'iterationNr')

        found = []
        if cfg_name is not None:
            # if the test configuration name is valid, find it in iterNr
            cfg_iters = [cfg_item.strip() for cfg_item in iterNr.strip().\
            split(',') if cfg_name in cfg_item.split('#')[0]]
            # now we have a list with iterators declared in cfg_name file
            # search the specified one
            found = [iter_val.split('#')[1] for iter_val in cfg_iters \
            if '#{}='.format(iter_name) in iter_val]
        else:
            # no test configuration name provided, search for all iterators
            # that match iter_name
            found = [i.split('#')[1] for i in iterNr.split(',') \
            if '#{}='.format(iter_name) in i]

        if not found:
            return ''
        return found[0]

    def count_project_files(self):
        """
        Returns the number of files inside the current project.
        """
        data = self.ce_proxy.get_ep_variable(self.epName, 'suites')
        SuitesManager = copy.deepcopy(data)
        files = SuitesManager.get_files(recursive=True)
        return len(files)

    def current_file_index(self):
        """
        Returns the index of this file in the project.
        If the file ID is not found, the count will fail.
        """
        data = self.ce_proxy.get_ep_variable(self.epName, 'suites')
        SuitesManager = copy.deepcopy(data)
        files = SuitesManager.get_files(recursive=True)
        try:
            return files.index(self.FILE_ID)
        except Exception:
            return -1

    def count_suite_files(self):
        """
        Returns the number of files inside a suite ID.
        If the suite ID is not found, the count will fail.
        """
        data = self.ce_proxy.get_suite_variable(self.epName, self.SUITE_ID, 'children')
        SuitesManager = copy.deepcopy(data)
        files = SuitesManager.keys() # First level of files, depth=1
        return len(files)

    def current_fsuite_index(self):
        """
        Returns the index of this file, inside this suite.
        If the suite ID and file ID are not found, the count will fail.
        """
        data = self.ce_proxy.get_suite_variable(self.epName, self.SUITE_ID, 'children')
        SuitesManager = copy.deepcopy(data)
        files = SuitesManager.keys() # First level of files, depth=1
        try:
            return files.index(self.FILE_ID)
        except Exception:
            return -1

    def py_exec(self, code_string):
        """
        Expose Python functions and class instances in TCL.
        """
        if not isinstance(code_string, str):
            print('py_exec: Error, the code must be a string `{}`!'.format(code_string))
            return False

        try:
            ret = eval(code_string, self.global_vars, self.global_vars)
        except Exception, e:
            print('py_exec: Error execution code `{}`! Exception `{}`!'.format(code_string, e))
            ret = False

        return ret

    def _encode_unicode(self, input):
        """
        Encode data to UTF-8.
        """
        if isinstance(input, dict):
            return {self._encode_unicode(key): self._encode_unicode(value) for key, value in input.iteritems()}
        elif isinstance(input, list):
            return [self._encode_unicode(elem) for elem in input]
        elif isinstance(input, unicode):
            return input.encode('utf-8')
        else:
            return input

    def get_tb(self, query, dtype=unicode):
        """
        Get TB content.
        """
        try:
            data = self.ce_proxy.get_tb(query)
            if dtype == str:
                return self._encode_unicode(data)
            else:
                return data
        except Exception as e:
            print('Error on get Resource! `{}`!'.format(e))
            return None

    def get_resource(self, query, dtype=unicode):
        """
        Get TB content. Alias function for `get_tb`.
        """
        return self.get_tb(query, dtype)

    def create_new_tb(self, name, parent='/', props={}):
        """
        Update a TB.
        """
        try:
            return self.ce_proxy.create_new_tb(name, parent, props)
        except Exception as e:
            print('Error on create Resource! `{}`!'.format(e))
            return None

    def create_component_tb(self, name, parent='/', props={}):
        """
        Update a TB.
        """
        try:
            return self.ce_proxy.create_component_tb(name, parent, props)
        except Exception as e:
            print('Error on create Resource! `{}`!'.format(e))
            return None

    def update_meta_tb(self, name, parent='/', props={}):
        """
        Update a TB.
        """
        try:
            return self.ce_proxy.update_meta_tb(name, parent, props)
        except Exception as e:
            print('Error on update Resource! `{}`!'.format(e))
            return None

    def set_tb(self, name, parent='/', props={}):
        """
        Update a TB. High level function.
        """
        if isinstance(props, str) or isinstance(props, unicode):
            try:
                props = ast.literal_eval(props)
            except Exception:
                pass
        try:
            return self.ce_proxy.set_tb(name, parent, props)
        except Exception as e:
            print('Error on set Resource! `{}`!'.format(e))
            return None

    def set_resource(self, name, parent='/', props={}):
        """
        Update a TB. Alias function for `set_tb`.
        """
        return self.set_tb(name, parent, props)

    def rename_tb(self, res_query, new_name):
        """
        Rename a TB.
        """
        try:
            return self.ce_proxy.rename_tb(res_query, new_name)
        except Exception as e:
            print('Error on rename Resource! `{}`!'.format(e))
            return None

    def rename_resource(self, res_query, new_name):
        """
        Rename a TB. Alias function for `rename_tb`.
        """
        return self.rename_tb(res_query, new_name)

    def delete_tb(self, query):
        """
        Delete a TB.
        """
        try:
            return self.ce_proxy.delete_tb(query)
        except Exception as e:
            print('Error on delete Resource! `{}`!'.format(e))
            return None

    def delete_resource(self, query):
        """
        Delete a TB. Alias function for `delete_tb`.
        """
        return self.delete_tb(query)

    def get_sut(self, query, follow_links=False, dtype=unicode):
        """
        Get SUT content.
        query : id/path of sut
        """
        try:
            data = self.ce_proxy.get_sut(query, follow_links)
            if dtype == str:
                return self._encode_unicode(data)
            else:
                return data
        except Exception as e:
            print('Error on get SUT! `{}`!'.format(e))
            return None

    def get_info_sut(self, query):
        """
        Get SUT info.
        """
        try:
            return self.ce_proxy.get_info_sut(query)
        except Exception as e:
            print('Error on get info SUT! `{}`!'.format(e))
            return None

    def create_new_sut(self, name, parent='/', props={}):
        """
        Update a SUT.
        """
        try:
            return self.ce_proxy.create_new_sut(name, parent, props)
        except Exception as e:
            print('Error on create SUT! `{}`!'.format(e))
            return None

    def create_component_sut(self, name, parent='/', props={}):
        """
        Update a SUT.
        """
        try:
            return self.ce_proxy.create_component_sut(name, parent, props)
        except Exception as e:
            print('Error on create SUT! `{}`!'.format(e))
            return None

    def update_meta_sut(self, name, parent='/', props={}):
        """
        Update a SUT.
        """
        try:
            return self.ce_proxy.update_meta_sut(name, parent, props)
        except Exception as e:
            print('Error on update SUT! `{}`!'.format(e))
            return None

    def set_sut(self, name, parent='/', props={}):
        """
        Update a SUT.
        """
        try:
            return self.ce_proxy.set_sut(name, parent, props)
        except Exception as e:
            print('Error on set SUT! `{}`!'.format(e))
            return None

    def rename_sut(self, res_query, new_name):
        """
        Rename a SUT.
        """
        try:
            return self.ce_proxy.rename_sut(res_query, new_name)
        except Exception as e:
            print('Error on rename SUT! `{}`!'.format(e))
            return None

    def delete_sut(self, query):
        """
        Delete a SUT.
        """
        try:
            return self.ce_proxy.delete_sut(query)
        except Exception as e:
            print('Error on delete SUT! `{}`!'.format(e))
            return None

    def delete_component_sut(self, query):
        """
        Delete a SUT component.
        """
        try:
            return self.ce_proxy.delete_component_sut(query)
        except Exception as e:
            print('Error on delete SUT component! `{}`!'.format(e))
            return None

    def reserve_tb(self, query):
        """
        Reserve a resource. You can then edit the resource.
        """
        try:
            return self.ce_proxy.reserve_tb(query)
        except Exception as e:
            print('Error on reserve resource! `{}`!'.format(e))
            return None

    def save_reserved_tb(self, query):
        """
        Save changes. Don't release.
        """
        try:
            return self.ce_proxy.save_reserved_tb(query)
        except Exception as e:
            print('Error on save resource! `{}`!'.format(e))
            return None

    def save_release_reserved_tb(self, query):
        """
        Save changes. Release the resource.
        """
        try:
            return self.ce_proxy.save_release_reserved_tb(query)
        except Exception as e:
            print('Error on save & release resource! `{}`!'.format(e))
            return None

    def discard_release_reserved_tb(self, query):
        """
        Drop changes. Release the resource.
        """
        try:
            return self.ce_proxy.discard_release_reserved_tb(query)
        except Exception as e:
            print('Error on discard & release resource! `{}`!'.format(e))
            return None

    def reserve_sut(self, query):
        """
        Reserve a SUT. You can then edit the SUT.
        """
        try:
            return self.ce_proxy.reserve_sut(query)
        except Exception as e:
            print('Error on reserve SUT! `{}`!'.format(e))
            return None

    def save_reserved_sut(self, query):
        """
        Save changes. Don't release.
        """
        try:
            return self.ce_proxy.save_reserved_sut(query)
        except Exception as e:
            print('Error on save SUT! `{}`!'.format(e))
            return None

    def save_release_reserved_sut(self, query):
        """
        Save changes. Release the SUT.
        """
        try:
            return self.ce_proxy.save_release_reserved_sut(query)
        except Exception as e:
            print('Error on save & release SUT! `{}`!'.format(e))
            return None

    def discard_release_reserved_sut(self, query):
        """
        Drop changes. Release the SUT.
        """
        try:
            return self.ce_proxy.discard_release_reserved_sut(query)
        except Exception as e:
            print('Error on discard & release SUT! `{}`!'.format(e))
            return None

    def is_tb_reserved(self, query):
        """
        Yes or No.
        """
        try:
            result = self.ce_proxy.is_tb_reserved(query)
            if not result or result == 'false':
                return False
            else:
                return True
        except Exception as e:
            print('Error on discard & release SUT! `{}`!'.format(e))
            return None

    def get_tb_user(self, query):
        """
        User name.
        """
        try:
            result = self.ce_proxy.is_tb_reserved(query)
            if not result or result == 'false':
                return False
            else:
                return result
        except Exception as e:
            print('Error on discard & release SUT! `{}`!'.format(e))
            return None

    def is_sut_reserved(self, query):
        """
        Yes or No.
        """
        try:
            result = self.ce_proxy.is_sut_reserved(query)
            if not result or result == 'false':
                return False
            else:
                return True
        except Exception as e:
            print('Error on discard & release SUT! `{}`!'.format(e))
            return None

    def get_sut_user(self, query):
        """
        User name.
        """
        try:
            result = self.ce_proxy.is_sut_reserved(query)
            if not result or result == 'false':
                return False
            else:
                return result
        except Exception as e:
            print('Error on discard & release SUT! `{}`!'.format(e))
            return None

# Eof()


text:
import * as cassmask from '../../../index';

var now = cassmask.now;
var toTimeStamp = cassmask.toTimeStamp;

var ItemPreSchema = new cassmask.Schema({
	part: {
		type: cassmask.TEXT,
		default: 'Item'
	},
	created: {
		type: cassmask.TIMESTAMP,
		default: toTimeStamp(now())
	},
	name: {
		type: cassmask.TEXT,
		validate: (name, next) => {
			if(name.length > 5)	next();
			else next('Name is not long enough!');
		},
		required: true
	},
	info: {
		type: cassmask.TEXT,
		required: 'Info is a must!!'
	},
	keys: ['part', 'name']
});

ItemPreSchema.validate('info', function(info, next) {
	if(info.length > 5) next();
	else next('Info is not long enough!');
});

export default cassmask.model('ItemPre', ItemPreSchema);;

redpajama_set_name: RedPajamaGithub


text:
package org.uiautomation.ios.command.configuration;

import org.json.JSONException;
import org.json.JSONObject;
import org.uiautomation.ios.servlet.CommandConfiguration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;

public class CommandConfigurationStore implements CommandConfiguration {

  private final JSONObject config = new JSONObject();
  private static final Logger log = Logger.getLogger(CommandConfiguration.class.getName());

  @Override
  public void set(String key, Object value) {
    try {
      config.put(key, value);
    } catch (JSONException e) {
      log.log(Level.SEVERE,"format error",e);
    }

  }

  @Override
  public Object get(String key) {
    Object res = config.opt(key);
    return res;
  }

  @Override
  public Map<String, Object> getAll() {
    Map<String, Object> res = new HashMap<String, Object>();
    Iterator<String> iter = config.keys();
    while (iter.hasNext()) {
      String key = iter.next();
      Object value = config.opt(key);
      res.put(key, value);
    }
    return res;
  }

  @Override
  public Object opt(String key, Object defaultValue) {
    Object res = get(key);
    if (res == null) {
      res = defaultValue;
    }
    return res;
  }

}


text:
CKEDITOR.plugins.setLang( 'devtools', 'sq', {
	title: 'Të dhënat e elementit',
	dialogName: 'Emri i dritares së dialogut',
	tabName: 'Emri i fletës',
	elementId: 'ID e elementit',
	elementType: 'Lloji i elementit'
} );


text:
root = File.expand_path(File.join(__FILE__, '../../..'))

require "#{root}/config/puma/environment"

bind "tcp://0.0.0.0:8000"
stdout_redirect "#{root}/log/puma.out", "#{root}/log/puma.err", true
threads 4, 8

rackup "#{root}/config.ru"
daemonize false


text:
from setuptools import setup, find_packages

setup(
	name='data_analysis',
	version='0.0.1',
	url='www.github.com/tprinkki/data_analysis',
	license='BSD',
	author='Ty Prinkki',
	packages=find_packages(),
	install_requires=['PyQt5',
					  'pandas',
					  'SQLAlchemy',
					  'nltk',
					  'numpy',
					  'jupyter',
					  'python-twitter'],
	entry_points={},
	extras_require={'dev': ['flake8',]},
	)


text:
package com.siemens.ct.exi.core.grammars.grammar;

/**
 *
 * @author Daniel.Peintner.EXT@siemens.com
 * @author Richard.Kuntschke@siemens.com
 *
 */

/*
 * first rule is different (namespace declaration, xsi:type and xsi:nil)
 */
public interface SchemaInformedFirstStartTagGrammar extends
		SchemaInformedStartTagGrammar {

	// /*
	// * returns type-name or null if anonymous type
	// */
	// public QName getTypeName();
	//
	// public void setTypeName(QName typeName);

	/*
	 * sets whether type is castable
	 */
	public void setTypeCastable(boolean hasNamedSubtypes);

	public boolean isTypeCastable();

	/*
	 * sets whether element is nillable
	 */
	public void setNillable(boolean nillable);

	public boolean isNillable();

	public void setTypeEmpty(SchemaInformedFirstStartTagGrammar typeEmpty);

	public SchemaInformedFirstStartTagGrammar getTypeEmpty();

}


text:
package org.drools.compiler.compiler;

import java.io.InputStream;
import java.util.List;
import java.util.Map;

import org.kie.api.Service;
import org.kie.internal.builder.KnowledgeBuilderResult;

public interface PMMLCompiler extends Service {

    public String compile( InputStream stream, ClassLoader classLoader );

    public List<KnowledgeBuilderResult> getResults();

    public void clearResults();
}


text:
#include "cairoint.h"

#include "cairo-clip-inline.h"
#include "cairo-error-private.h"
#include "cairo-pattern-private.h"
#include "cairo-surface-wrapper-private.h"

/* A collection of routines to facilitate surface wrapping */

static void
_copy_transformed_pattern (cairo_pattern_t *pattern,
			   const cairo_pattern_t *original,
			   const cairo_matrix_t  *ctm_inverse)
{
    _cairo_pattern_init_static_copy (pattern, original);

    if (! _cairo_matrix_is_identity (ctm_inverse))
	_cairo_pattern_transform (pattern, ctm_inverse);
}

cairo_status_t
_cairo_surface_wrapper_acquire_source_image (cairo_surface_wrapper_t *wrapper,
					     cairo_image_surface_t  **image_out,
					     void                   **image_extra)
{
    if (unlikely (wrapper->target->status))
	return wrapper->target->status;

    return _cairo_surface_acquire_source_image (wrapper->target,
						image_out, image_extra);
}

void
_cairo_surface_wrapper_release_source_image (cairo_surface_wrapper_t *wrapper,
					     cairo_image_surface_t  *image,
					     void                   *image_extra)
{
    _cairo_surface_release_source_image (wrapper->target, image, image_extra);
}

static void
_cairo_surface_wrapper_get_transform (cairo_surface_wrapper_t *wrapper,
				      cairo_matrix_t *m)
{
    cairo_matrix_init_identity (m);

    if (! _cairo_matrix_is_identity (&wrapper->transform))
	cairo_matrix_multiply (m, &wrapper->transform, m);

    if (! _cairo_matrix_is_identity (&wrapper->target->device_transform))
	cairo_matrix_multiply (m, &wrapper->target->device_transform, m);
}

static void
_cairo_surface_wrapper_get_inverse_transform (cairo_surface_wrapper_t *wrapper,
					      cairo_matrix_t *m)
{
    cairo_matrix_init_identity (m);

    if (! _cairo_matrix_is_identity (&wrapper->target->device_transform_inverse))
	cairo_matrix_multiply (m, &wrapper->target->device_transform_inverse, m);

    if (! _cairo_matrix_is_identity (&wrapper->transform)) {
	cairo_matrix_t inv;
	cairo_status_t status;

	inv = wrapper->transform;
	status = cairo_matrix_invert (&inv);
	assert (status == CAIRO_STATUS_SUCCESS);
	cairo_matrix_multiply (m, &inv, m);
    }
}

static cairo_clip_t *
_cairo_surface_wrapper_get_clip (cairo_surface_wrapper_t *wrapper,
				 const cairo_clip_t *clip)
{
    cairo_clip_t *copy;
    cairo_matrix_t m;

    copy = _cairo_clip_copy (clip);
    if (wrapper->has_extents) {
	copy = _cairo_clip_intersect_rectangle (copy, &wrapper->extents);
    }
    _cairo_surface_wrapper_get_transform (wrapper, &m);
    copy = _cairo_clip_transform (copy, &m);
    if (wrapper->clip)
	copy = _cairo_clip_intersect_clip (copy, wrapper->clip);

    return copy;
}

cairo_status_t
_cairo_surface_wrapper_paint (cairo_surface_wrapper_t *wrapper,
			      cairo_operator_t	 op,
			      const cairo_pattern_t *source,
			      const cairo_clip_t    *clip)
{
    cairo_status_t status;
    cairo_clip_t *dev_clip;
    cairo_pattern_union_t source_copy;

    if (unlikely (wrapper->target->status))
	return wrapper->target->status;

    dev_clip = _cairo_surface_wrapper_get_clip (wrapper, clip);
    if (_cairo_clip_is_all_clipped (dev_clip))
	return CAIRO_INT_STATUS_NOTHING_TO_DO;

    if (wrapper->needs_transform) {
	cairo_matrix_t m;

	_cairo_surface_wrapper_get_transform (wrapper, &m);

	status = cairo_matrix_invert (&m);
	assert (status == CAIRO_STATUS_SUCCESS);

	_copy_transformed_pattern (&source_copy.base, source, &m);
	source = &source_copy.base;
    }

    status = _cairo_surface_paint (wrapper->target, op, source, dev_clip);

    _cairo_clip_destroy (dev_clip);
    return status;
}

cairo_status_t
_cairo_surface_wrapper_mask (cairo_surface_wrapper_t *wrapper,
			     cairo_operator_t	 op,
			     const cairo_pattern_t *source,
			     const cairo_pattern_t *mask,
			     const cairo_clip_t	    *clip)
{
    cairo_status_t status;
    cairo_clip_t *dev_clip;
    cairo_pattern_union_t source_copy;
    cairo_pattern_union_t mask_copy;

    if (unlikely (wrapper->target->status))
	return wrapper->target->status;

    dev_clip = _cairo_surface_wrapper_get_clip (wrapper, clip);
    if (_cairo_clip_is_all_clipped (dev_clip))
	return CAIRO_INT_STATUS_NOTHING_TO_DO;

    if (wrapper->needs_transform) {
	cairo_matrix_t m;

	_cairo_surface_wrapper_get_transform (wrapper, &m);

	status = cairo_matrix_invert (&m);
	assert (status == CAIRO_STATUS_SUCCESS);

	_copy_transformed_pattern (&source_copy.base, source, &m);
	source = &source_copy.base;

	_copy_transformed_pattern (&mask_copy.base, mask, &m);
	mask = &mask_copy.base;
    }

    status = _cairo_surface_mask (wrapper->target, op, source, mask, dev_clip);

    _cairo_clip_destroy (dev_clip);
    return status;
}

cairo_status_t
_cairo_surface_wrapper_stroke (cairo_surface_wrapper_t *wrapper,
			       cairo_operator_t		 op,
			       const cairo_pattern_t	*source,
			       const cairo_path_fixed_t	*path,
			       const cairo_stroke_style_t	*stroke_style,
			       const cairo_matrix_t		*ctm,
			       const cairo_matrix_t		*ctm_inverse,
			       double			 tolerance,
			       cairo_antialias_t	 antialias,
			       const cairo_clip_t		*clip)
{
    cairo_status_t status;
    cairo_path_fixed_t path_copy, *dev_path = (cairo_path_fixed_t *) path;
    cairo_clip_t *dev_clip;
    cairo_matrix_t dev_ctm = *ctm;
    cairo_matrix_t dev_ctm_inverse = *ctm_inverse;
    cairo_pattern_union_t source_copy;

    if (unlikely (wrapper->target->status))
	return wrapper->target->status;

    dev_clip = _cairo_surface_wrapper_get_clip (wrapper, clip);
    if (_cairo_clip_is_all_clipped (dev_clip))
	return CAIRO_INT_STATUS_NOTHING_TO_DO;

    if (wrapper->needs_transform) {
	cairo_matrix_t m;

	_cairo_surface_wrapper_get_transform (wrapper, &m);

	status = _cairo_path_fixed_init_copy (&path_copy, dev_path);
	if (unlikely (status))
	    goto FINISH;

	_cairo_path_fixed_transform (&path_copy, &m);
	dev_path = &path_copy;

	cairo_matrix_multiply (&dev_ctm, &dev_ctm, &m);

	status = cairo_matrix_invert (&m);
	assert (status == CAIRO_STATUS_SUCCESS);

	cairo_matrix_multiply (&dev_ctm_inverse, &m, &dev_ctm_inverse);

	_copy_transformed_pattern (&source_copy.base, source, &m);
	source = &source_copy.base;
    }

    status = _cairo_surface_stroke (wrapper->target, op, source,
				    dev_path, stroke_style,
				    &dev_ctm, &dev_ctm_inverse,
				    tolerance, antialias,
				    dev_clip);

 FINISH:
    if (dev_path != path)
	_cairo_path_fixed_fini (dev_path);
    _cairo_clip_destroy (dev_clip);
    return status;
}

cairo_status_t
_cairo_surface_wrapper_fill_stroke (cairo_surface_wrapper_t *wrapper,
				    cairo_operator_t	     fill_op,
				    const cairo_pattern_t   *fill_source,
				    cairo_fill_rule_t	     fill_rule,
				    double		     fill_tolerance,
				    cairo_antialias_t	     fill_antialias,
				    const cairo_path_fixed_t*path,
				    cairo_operator_t	     stroke_op,
				    const cairo_pattern_t   *stroke_source,
				    const cairo_stroke_style_t    *stroke_style,
				    const cairo_matrix_t	    *stroke_ctm,
				    const cairo_matrix_t	    *stroke_ctm_inverse,
				    double		     stroke_tolerance,
				    cairo_antialias_t	     stroke_antialias,
				    const cairo_clip_t	    *clip)
{
    cairo_status_t status;
    cairo_path_fixed_t path_copy, *dev_path = (cairo_path_fixed_t *)path;
    cairo_matrix_t dev_ctm = *stroke_ctm;
    cairo_matrix_t dev_ctm_inverse = *stroke_ctm_inverse;
    cairo_clip_t *dev_clip;
    cairo_pattern_union_t stroke_source_copy;
    cairo_pattern_union_t fill_source_copy;

    if (unlikely (wrapper->target->status))
	return wrapper->target->status;

    dev_clip = _cairo_surface_wrapper_get_clip (wrapper, clip);
    if (_cairo_clip_is_all_clipped (dev_clip))
	return CAIRO_INT_STATUS_NOTHING_TO_DO;

    if (wrapper->needs_transform) {
	cairo_matrix_t m;

	_cairo_surface_wrapper_get_transform (wrapper, &m);

	status = _cairo_path_fixed_init_copy (&path_copy, dev_path);
	if (unlikely (status))
	    goto FINISH;

	_cairo_path_fixed_transform (&path_copy, &m);
	dev_path = &path_copy;

	cairo_matrix_multiply (&dev_ctm, &dev_ctm, &m);

	status = cairo_matrix_invert (&m);
	assert (status == CAIRO_STATUS_SUCCESS);

	cairo_matrix_multiply (&dev_ctm_inverse, &m, &dev_ctm_inverse);

	_copy_transformed_pattern (&stroke_source_copy.base, stroke_source, &m);
	stroke_source = &stroke_source_copy.base;

	_copy_transformed_pattern (&fill_source_copy.base, fill_source, &m);
	fill_source = &fill_source_copy.base;
    }

    status = _cairo_surface_fill_stroke (wrapper->target,
					 fill_op, fill_source, fill_rule,
					 fill_tolerance, fill_antialias,
					 dev_path,
					 stroke_op, stroke_source,
					 stroke_style,
					 &dev_ctm, &dev_ctm_inverse,
					 stroke_tolerance, stroke_antialias,
					 dev_clip);

  FINISH:
    if (dev_path != path)
	_cairo_path_fixed_fini (dev_path);
    _cairo_clip_destroy (dev_clip);
    return status;
}

cairo_status_t
_cairo_surface_wrapper_fill (cairo_surface_wrapper_t	*wrapper,
			     cairo_operator_t	 op,
			     const cairo_pattern_t *source,
			     const cairo_path_fixed_t	*path,
			     cairo_fill_rule_t	 fill_rule,
			     double		 tolerance,
			     cairo_antialias_t	 antialias,
			     const cairo_clip_t	*clip)
{
    cairo_status_t status;
    cairo_path_fixed_t path_copy, *dev_path = (cairo_path_fixed_t *) path;
    cairo_pattern_union_t source_copy;
    cairo_clip_t *dev_clip;

    if (unlikely (wrapper->target->status))
	return wrapper->target->status;

    dev_clip = _cairo_surface_wrapper_get_clip (wrapper, clip);
    if (_cairo_clip_is_all_clipped (dev_clip))
	return CAIRO_INT_STATUS_NOTHING_TO_DO;

    if (wrapper->needs_transform) {
	cairo_matrix_t m;

	_cairo_surface_wrapper_get_transform (wrapper, &m);

	status = _cairo_path_fixed_init_copy (&path_copy, dev_path);
	if (unlikely (status))
	    goto FINISH;

	_cairo_path_fixed_transform (&path_copy, &m);
	dev_path = &path_copy;

	status = cairo_matrix_invert (&m);
	assert (status == CAIRO_STATUS_SUCCESS);

	_copy_transformed_pattern (&source_copy.base, source, &m);
	source = &source_copy.base;
    }

    status = _cairo_surface_fill (wrapper->target, op, source,
				  dev_path, fill_rule,
				  tolerance, antialias,
				  dev_clip);

 FINISH:
    if (dev_path != path)
	_cairo_path_fixed_fini (dev_path);
    _cairo_clip_destroy (dev_clip);
    return status;
}

cairo_status_t
_cairo_surface_wrapper_show_text_glyphs (cairo_surface_wrapper_t *wrapper,
					 cairo_operator_t	     op,
					 const cairo_pattern_t	    *source,
					 const char		    *utf8,
					 int			     utf8_len,
					 const cairo_glyph_t	    *glyphs,
					 int			     num_glyphs,
					 const cairo_text_cluster_t *clusters,
					 int			     num_clusters,
					 cairo_text_cluster_flags_t  cluster_flags,
					 cairo_scaled_font_t	    *scaled_font,
					 const cairo_clip_t	    *clip)
{
    cairo_status_t status;
    cairo_clip_t *dev_clip;
    cairo_glyph_t stack_glyphs [CAIRO_STACK_ARRAY_LENGTH(cairo_glyph_t)];
    cairo_glyph_t *dev_glyphs = stack_glyphs;
    cairo_scaled_font_t *dev_scaled_font = scaled_font;
    cairo_pattern_union_t source_copy;
    cairo_font_options_t options;

    if (unlikely (wrapper->target->status))
	return wrapper->target->status;

    dev_clip = _cairo_surface_wrapper_get_clip (wrapper, clip);
    if (_cairo_clip_is_all_clipped (dev_clip))
	return CAIRO_INT_STATUS_NOTHING_TO_DO;

    cairo_surface_get_font_options (wrapper->target, &options);
    cairo_font_options_merge (&options, &scaled_font->options);

    if (wrapper->needs_transform) {
	cairo_matrix_t m;
	int i;

	_cairo_surface_wrapper_get_transform (wrapper, &m);

	if (! _cairo_matrix_is_translation (&m)) {
	    cairo_matrix_t ctm;

	    _cairo_matrix_multiply (&ctm,
				    &m,
				    &scaled_font->ctm);
	    dev_scaled_font = cairo_scaled_font_create (scaled_font->font_face,
							&scaled_font->font_matrix,
							&ctm, &options);
	}

	if (num_glyphs > ARRAY_LENGTH (stack_glyphs)) {
	    dev_glyphs = _cairo_malloc_ab (num_glyphs, sizeof (cairo_glyph_t));
	    if (unlikely (dev_glyphs == NULL)) {
		status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
		goto FINISH;
	    }
	}

	for (i = 0; i < num_glyphs; i++) {
	    dev_glyphs[i] = glyphs[i];
	    cairo_matrix_transform_point (&m,
					  &dev_glyphs[i].x,
					  &dev_glyphs[i].y);
	}

	status = cairo_matrix_invert (&m);
	assert (status == CAIRO_STATUS_SUCCESS);

	_copy_transformed_pattern (&source_copy.base, source, &m);
	source = &source_copy.base;
    } else {
	if (! cairo_font_options_equal (&options, &scaled_font->options)) {
	    dev_scaled_font = cairo_scaled_font_create (scaled_font->font_face,
							&scaled_font->font_matrix,
							&scaled_font->ctm,
							&options);
	}

	/* show_text_glyphs is special because _cairo_surface_show_text_glyphs is allowed
	 * to modify the glyph array that's passed in.  We must always
	 * copy the array before handing it to the backend.
	 */
	if (num_glyphs > ARRAY_LENGTH (stack_glyphs)) {
	    dev_glyphs = _cairo_malloc_ab (num_glyphs, sizeof (cairo_glyph_t));
	    if (unlikely (dev_glyphs == NULL)) {
		status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
		goto FINISH;
	    }
	}

	memcpy (dev_glyphs, glyphs, sizeof (cairo_glyph_t) * num_glyphs);
    }

    status = _cairo_surface_show_text_glyphs (wrapper->target, op, source,
					      utf8, utf8_len,
					      dev_glyphs, num_glyphs,
					      clusters, num_clusters,
					      cluster_flags,
					      dev_scaled_font,
					      dev_clip);
 FINISH:
    _cairo_clip_destroy (dev_clip);
    if (dev_glyphs != stack_glyphs)
	free (dev_glyphs);
    if (dev_scaled_font != scaled_font)
	cairo_scaled_font_destroy (dev_scaled_font);
    return status;
}

cairo_status_t
_cairo_surface_wrapper_tag (cairo_surface_wrapper_t     *wrapper,
			    cairo_bool_t                 begin,
			    const char                  *tag_name,
			    const char                  *attributes,
			    const cairo_pattern_t	*source,
			    const cairo_stroke_style_t	*stroke_style,
			    const cairo_matrix_t	*ctm,
			    const cairo_matrix_t	*ctm_inverse,
			    const cairo_clip_t		*clip)
{
    cairo_status_t status;
    cairo_clip_t *dev_clip;
    cairo_matrix_t dev_ctm = *ctm;
    cairo_matrix_t dev_ctm_inverse = *ctm_inverse;
    cairo_pattern_union_t source_copy;

    if (unlikely (wrapper->target->status))
	return wrapper->target->status;

    dev_clip = _cairo_surface_wrapper_get_clip (wrapper, clip);
    if (wrapper->needs_transform) {
	cairo_matrix_t m;

	_cairo_surface_wrapper_get_transform (wrapper, &m);

	cairo_matrix_multiply (&dev_ctm, &dev_ctm, &m);

	status = cairo_matrix_invert (&m);
	assert (status == CAIRO_STATUS_SUCCESS);

	cairo_matrix_multiply (&dev_ctm_inverse, &m, &dev_ctm_inverse);

	_copy_transformed_pattern (&source_copy.base, source, &m);
	source = &source_copy.base;
    }

    status = _cairo_surface_tag (wrapper->target,
				 begin, tag_name, attributes,
				 source, stroke_style,
				 &dev_ctm, &dev_ctm_inverse,
				 dev_clip);

    _cairo_clip_destroy (dev_clip);
    return status;
}

cairo_surface_t *
_cairo_surface_wrapper_create_similar (cairo_surface_wrapper_t *wrapper,
				       cairo_content_t	content,
				       int		width,
				       int		height)
{
    return _cairo_surface_create_scratch (wrapper->target,
					  content, width, height, NULL);
}

cairo_bool_t
_cairo_surface_wrapper_get_extents (cairo_surface_wrapper_t *wrapper,
				    cairo_rectangle_int_t   *extents)
{
    if (wrapper->has_extents) {
	if (_cairo_surface_get_extents (wrapper->target, extents))
	    _cairo_rectangle_intersect (extents, &wrapper->extents);
	else
	    *extents = wrapper->extents;

	return TRUE;
    } else {
	return _cairo_surface_get_extents (wrapper->target, extents);
    }
}

static cairo_bool_t
_cairo_surface_wrapper_needs_device_transform (cairo_surface_wrapper_t *wrapper)
{
    return
	(wrapper->has_extents && (wrapper->extents.x | wrapper->extents.y)) ||
	! _cairo_matrix_is_identity (&wrapper->transform) ||
	! _cairo_matrix_is_identity (&wrapper->target->device_transform);
}

void
_cairo_surface_wrapper_intersect_extents (cairo_surface_wrapper_t *wrapper,
					  const cairo_rectangle_int_t *extents)
{
    if (! wrapper->has_extents) {
	wrapper->extents = *extents;
	wrapper->has_extents = TRUE;
    } else
	_cairo_rectangle_intersect (&wrapper->extents, extents);

    wrapper->needs_transform =
	_cairo_surface_wrapper_needs_device_transform (wrapper);
}

void
_cairo_surface_wrapper_set_inverse_transform (cairo_surface_wrapper_t *wrapper,
					      const cairo_matrix_t *transform)
{
    cairo_status_t status;

    if (transform == NULL || _cairo_matrix_is_identity (transform)) {
	cairo_matrix_init_identity (&wrapper->transform);

	wrapper->needs_transform =
	    _cairo_surface_wrapper_needs_device_transform (wrapper);
    } else {
	wrapper->transform = *transform;
	status = cairo_matrix_invert (&wrapper->transform);
	/* should always be invertible unless given pathological input */
	assert (status == CAIRO_STATUS_SUCCESS);

	wrapper->needs_transform = TRUE;
    }
}

void
_cairo_surface_wrapper_set_clip (cairo_surface_wrapper_t *wrapper,
				 const cairo_clip_t *clip)
{
    wrapper->clip = clip;
}

void
_cairo_surface_wrapper_get_font_options (cairo_surface_wrapper_t    *wrapper,
					 cairo_font_options_t	    *options)
{
    cairo_surface_get_font_options (wrapper->target, options);
}

cairo_surface_t *
_cairo_surface_wrapper_snapshot (cairo_surface_wrapper_t *wrapper)
{
    if (wrapper->target->backend->snapshot)
	return wrapper->target->backend->snapshot (wrapper->target);

    return NULL;
}

cairo_bool_t
_cairo_surface_wrapper_has_show_text_glyphs (cairo_surface_wrapper_t *wrapper)
{
    return cairo_surface_has_show_text_glyphs (wrapper->target);
}

void
_cairo_surface_wrapper_init (cairo_surface_wrapper_t *wrapper,
			     cairo_surface_t *target)
{
    wrapper->target = cairo_surface_reference (target);
    cairo_matrix_init_identity (&wrapper->transform);
    wrapper->has_extents = FALSE;
    wrapper->extents.x = wrapper->extents.y = 0;
    wrapper->clip = NULL;

    wrapper->needs_transform = FALSE;
    if (target) {
	wrapper->needs_transform =
	    ! _cairo_matrix_is_identity (&target->device_transform);
    }
}

void
_cairo_surface_wrapper_fini (cairo_surface_wrapper_t *wrapper)
{
    cairo_surface_destroy (wrapper->target);
}

cairo_bool_t
_cairo_surface_wrapper_get_target_extents (cairo_surface_wrapper_t *wrapper,
					   cairo_bool_t surface_is_unbounded,
					   cairo_rectangle_int_t *extents)
{
    cairo_rectangle_int_t clip;
    cairo_bool_t has_clip = FALSE;

    if (!surface_is_unbounded)
	has_clip = _cairo_surface_get_extents (wrapper->target, &clip);

    if (wrapper->clip) {
	if (has_clip) {
	    if (! _cairo_rectangle_intersect (&clip,
					      _cairo_clip_get_extents (wrapper->clip)))
		return FALSE;
	} else {
	    has_clip = TRUE;
	    clip = *_cairo_clip_get_extents (wrapper->clip);
	}
    }

    if (has_clip && wrapper->needs_transform) {
	cairo_matrix_t m;
	double x1, y1, x2, y2;

	_cairo_surface_wrapper_get_inverse_transform (wrapper, &m);

	x1 = clip.x;
	y1 = clip.y;
	x2 = clip.x + clip.width;
	y2 = clip.y + clip.height;

	_cairo_matrix_transform_bounding_box (&m, &x1, &y1, &x2, &y2, NULL);

	clip.x = floor (x1);
	clip.y = floor (y1);
	clip.width  = ceil (x2) - clip.x;
	clip.height = ceil (y2) - clip.y;
    }

    if (has_clip) {
	if (wrapper->has_extents) {
	    *extents = wrapper->extents;
	    return _cairo_rectangle_intersect (extents, &clip);
	} else {
	    *extents = clip;
	    return TRUE;
	}
    } else if (wrapper->has_extents) {
	*extents = wrapper->extents;
	return TRUE;
    } else {
	_cairo_unbounded_rectangle_init (extents);
	return TRUE;
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.garyhu.citypickerdemo">

    <uses-permission android:name="android.permission.INTERNET"/>

    <uses-permission android:name="android.permission.CAMERA" />

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />

    <uses-permission android:name="android.permission.READ_SMS" />

    <application
        android:name=".app.MyApp"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".activity.MainActivity"
            android:launchMode="singleTop">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".activity.SecondActivity"
            android:launchMode="singleTop"/>
        <activity android:name=".activity.ThirdActivity"
            android:launchMode="singleTop"/>
        <activity android:name=".activity.PickCityActivity"
            android:launchMode="singleTop"/>
        <activity android:name=".activity.PickContactActivity"
            android:launchMode="singleTop"/>
        <activity android:name=".activity.HomeActivity"
            android:launchMode="singleTop"/>
        <activity android:name=".activity.RefreshActivity"
            android:launchMode="singleTop"/>
        <activity android:name=".activity.CollpasedActivity"
            android:launchMode="singleTop"/>
        <activity android:name=".activity.GalleryActivity"
            android:launchMode="singleTop"/>
        <activity android:name=".activity.FaceBookAnimActivity"
            android:launchMode="singleTop"/>
        <activity android:name=".activity.FlycoActivity"
            android:launchMode="singleTop"/>
        <activity android:name=".activity.StatusActivity"
            android:launchMode="singleTop"/>
        <activity android:name=".activity.PhotoViewActivity"
            android:launchMode="singleTop"/>
        <activity android:name=".activity.PermissionActivity"
            android:launchMode="singleTop"/>
        <activity android:name=".activity.DragActivity"
            android:launchMode="singleTop"/>
        <activity android:name=".widget.drager.DragPhotoActivity"
            android:theme="@style/translucent"/>
    </application>

</manifest>


text:
package org.apache.poi.ss.formula;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.apache.poi.ss.formula.eval.BlankEval;
import org.apache.poi.ss.formula.eval.ErrorEval;
import org.apache.poi.ss.formula.eval.ValueEval;

/**
 * Instances of this class keep track of multiple dependent cell evaluations due
 * to recursive calls to {@link WorkbookEvaluator#evaluate(EvaluationCell)}}
 * The main purpose of this class is to detect an attempt to evaluate a cell
 * that is already being evaluated. In other words, it detects circular
 * references in spreadsheet formulas.
 *
 * @author Josh Micich
 */
final class EvaluationTracker {
	// TODO - consider deleting this class and letting CellEvaluationFrame take care of itself
	private final List<CellEvaluationFrame> _evaluationFrames;
	private final Set<FormulaCellCacheEntry> _currentlyEvaluatingCells;
	private final EvaluationCache _cache;

	public EvaluationTracker(EvaluationCache cache) {
		_cache = cache;
		_evaluationFrames = new ArrayList<CellEvaluationFrame>();
		_currentlyEvaluatingCells = new HashSet<FormulaCellCacheEntry>();
	}

	/**
	 * Notifies this evaluation tracker that evaluation of the specified cell is
	 * about to start.

	 *
	 * In the case of a true return code, the caller should
	 * continue evaluation of the specified cell, and also be sure to call
	 * <tt>endEvaluate()</tt> when complete.

	 *
	 * In the case of a null return code, the caller should
	 * return an evaluation result of
	 * <tt>ErrorEval.CIRCULAR_REF_ERROR<tt>, and not call <tt>endEvaluate()</tt>.
	 *

	 * @return false if the specified cell is already being evaluated
	 */
	public boolean startEvaluate(FormulaCellCacheEntry cce) {
		if (cce == null) {
			throw new IllegalArgumentException("cellLoc must not be null");
		}
		if (_currentlyEvaluatingCells.contains(cce)) {
			return false;
		}
		_currentlyEvaluatingCells.add(cce);
		_evaluationFrames.add(new CellEvaluationFrame(cce));
		return true;
	}

	public void updateCacheResult(ValueEval result) {

		int nFrames = _evaluationFrames.size();
		if (nFrames < 1) {
			throw new IllegalStateException("Call to endEvaluate without matching call to startEvaluate");
		}
		CellEvaluationFrame frame = _evaluationFrames.get(nFrames-1);
		if (result == ErrorEval.CIRCULAR_REF_ERROR && nFrames > 1) {
			// Don't cache a circular ref error result if this cell is not the top evaluated cell.
			// A true circular ref error will propagate all the way around the loop.  However, it's
			// possible to have parts of the formula tree (/ parts of the loop) to evaluate to
			// CIRCULAR_REF_ERROR, and that value not get used in the final cell result (see the
			// unit tests for a simple example). Thus, the only CIRCULAR_REF_ERROR result that can
			// safely be cached is that of the top evaluated cell.
			return;
		}

		frame.updateFormulaResult(result);
	}

	/**
	 * Notifies this evaluation tracker that the evaluation of the specified cell is complete.

	 *
	 * Every successful call to <tt>startEvaluate</tt> must be followed by a call to <tt>endEvaluate</tt> (recommended in a finally block) to enable
	 * proper tracking of which cells are being evaluated at any point in time.

	 *
	 * Assuming a well behaved client, parameters to this method would not be
	 * required. However, they have been included to assert correct behaviour,
	 * and form more meaningful error messages.
	 */
	public void endEvaluate(CellCacheEntry cce) {

		int nFrames = _evaluationFrames.size();
		if (nFrames < 1) {
			throw new IllegalStateException("Call to endEvaluate without matching call to startEvaluate");
		}

		nFrames--;
		CellEvaluationFrame frame = _evaluationFrames.get(nFrames);
		if (cce != frame.getCCE()) {
			throw new IllegalStateException("Wrong cell specified. ");
		}
		// else - no problems so pop current frame
		_evaluationFrames.remove(nFrames);
		_currentlyEvaluatingCells.remove(cce);
	}

	public void acceptFormulaDependency(CellCacheEntry cce) {
		// Tell the currently evaluating cell frame that it has a dependency on the specified
		int prevFrameIndex = _evaluationFrames.size()-1;
		if (prevFrameIndex < 0) {
			// Top level frame, there is no 'cell' above this frame that is using the current cell
		} else {
			CellEvaluationFrame consumingFrame = _evaluationFrames.get(prevFrameIndex);
			consumingFrame.addSensitiveInputCell(cce);
		}
	}

	public void acceptPlainValueDependency(int bookIndex, int sheetIndex,
			int rowIndex, int columnIndex, ValueEval value) {
		// Tell the currently evaluating cell frame that it has a dependency on the specified
		int prevFrameIndex = _evaluationFrames.size() - 1;
		if (prevFrameIndex < 0) {
			// Top level frame, there is no 'cell' above this frame that is using the current cell
		} else {
			CellEvaluationFrame consumingFrame = _evaluationFrames.get(prevFrameIndex);
			if (value == BlankEval.instance) {
				consumingFrame.addUsedBlankCell(bookIndex, sheetIndex, rowIndex, columnIndex);
			} else {
				PlainValueCellCacheEntry cce = _cache.getPlainValueEntry(bookIndex, sheetIndex,
						rowIndex, columnIndex, value);
				consumingFrame.addSensitiveInputCell(cce);
			}
		}
	}
}


text:
from auth_helper import *
from campaignmanagement_example_helper import *

# You must provide credentials in auth_helper.py.

def main(authorization_data):

    try:
        # Before you can track conversions or target audiences using a remarketing list
        # you need to create a UET tag, and then add the UET tag tracking code to every page of your website.
        # For more information, please see Universal Event Tracking at https://go.microsoft.com/fwlink/?linkid=829965.

        # First you should call the GetUetTagsByIds operation to check whether a tag has already been created.
        # You can leave the TagIds element null or empty to request all UET tags available for the customer.

        output_status_message("-----\nGetUetTagsByIds:")
        uet_tags=campaign_service.GetUetTagsByIds(
            TagIds=None
        ).UetTags

        # If you do not already have a UET tag that can be used, or if you need another UET tag,
        # call the AddUetTags service operation to create a new UET tag. If the call is successful,
        # the tracking script that you should add to your website is included in a corresponding
        # UetTag within the response message.

        if (uet_tags is None or len(uet_tags) < 1):
            uet_tags=campaign_service.factory.create('ArrayOfUetTag')
            uet_tag=set_elements_to_none(campaign_service.factory.create('UetTag'))
            uet_tag.Description = "My First Uet Tag"
            uet_tag.Name = "New Uet Tag"
            output_status_message("-----\nAddUetTags:")
            uet_tags=campaign_service.AddUetTags(
                UetTags=uet_tags
            ).UetTags

        if (uet_tags is None or len(uet_tags) < 1):
            output_status_message(
                "You do not have any UET tags registered for CustomerId {0}.".format(authorization_data.customer_id)
            )
            sys.exit(0)

        output_status_message("List of all UET Tags:")
        output_array_of_uettag(uet_tags)

        # After you retreive the tracking script from the AddUetTags or GetUetTagsByIds operation,
        # the next step is to add the UET tag tracking code to your website.

        # We will use the same UET tag for the remainder of this example.
        tag_id = uet_tags['UetTag'][0].Id

        # Add remarketing lists that depend on the UET Tag Id retreived above.
        add_audiences=campaign_service.factory.create('ArrayOfAudience')
        custom_events_list=set_elements_to_none(campaign_service.factory.create('RemarketingList'))
        custom_events_list.Description="New list with CustomEventsRule"
        custom_events_list.MembershipDuration=30
        custom_events_list.Name="Remarketing List with CustomEventsRule " + strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())
        custom_events_list.ParentId=authorization_data.account_id
        # The rule definition is translated to the following logical expression:
        # (Category Equals video) and (Action Equals play) and (Label Equals trailer)
        # and (Value Equals 5)
        custom_events_rule=set_elements_to_none(campaign_service.factory.create('CustomEventsRule'))
        # The type of user interaction you want to track.
        custom_events_rule.Action="play"
        custom_events_rule.ActionOperator='Equals'
        # The category of event you want to track.
        custom_events_rule.Category="video"
        custom_events_rule.CategoryOperator='Equals'
        # The name of the element that caused the action.
        custom_events_rule.Label="trailer"
        custom_events_rule.LabelOperator='Equals'
        # A numerical value associated with that event.
        # Could be length of the video played etc.
        custom_events_rule.Value=5.00
        custom_events_rule.ValueOperator='Equals'
        custom_events_list.Rule=custom_events_rule
        custom_events_list.Scope='Account'
        custom_events_list.TagId=tag_id
        add_audiences.Audience.append(custom_events_list)

        page_visitors_list=set_elements_to_none(campaign_service.factory.create('RemarketingList'))
        page_visitors_list.Description="New list with PageVisitorsRule"
        page_visitors_list.MembershipDuration=30
        page_visitors_list.Name="Remarketing List with PageVisitorsRule " + strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())
        page_visitors_list.ParentId=authorization_data.account_id
        # The rule definition is translated to the following logical expression:
        # ((Url Contains X) and (ReferrerUrl DoesNotContain Z)) or ((Url DoesNotBeginWith Y))
        # or ((ReferrerUrl Equals Z))
        page_visitors_rule=set_elements_to_none(campaign_service.factory.create('PageVisitorsRule'))
        page_visitors_rule_item_groups=campaign_service.factory.create('ArrayOfRuleItemGroup')
        page_visitors_rule_item_group_a=set_elements_to_none(campaign_service.factory.create('RuleItemGroup'))
        page_visitors_rule_items_a=campaign_service.factory.create('ArrayOfRuleItem')
        page_visitors_rule_item_a=set_elements_to_none(campaign_service.factory.create('StringRuleItem'))
        page_visitors_rule_item_a.Operand="Url"
        page_visitors_rule_item_a.Operator='Contains'
        page_visitors_rule_item_a.Value="X"
        page_visitors_rule_items_a.RuleItem.append(page_visitors_rule_item_a)
        page_visitors_rule_item_aa=set_elements_to_none(campaign_service.factory.create('StringRuleItem'))
        page_visitors_rule_item_aa.Operand="ReferrerUrl"
        page_visitors_rule_item_aa.Operator='DoesNotContain'
        page_visitors_rule_item_aa.Value="Z"
        page_visitors_rule_items_a.RuleItem.append(page_visitors_rule_item_aa)
        page_visitors_rule_item_group_a.Items=page_visitors_rule_items_a
        page_visitors_rule_item_groups.RuleItemGroup.append(page_visitors_rule_item_group_a)
        page_visitors_rule_item_group_b=set_elements_to_none(campaign_service.factory.create('RuleItemGroup'))
        page_visitors_rule_items_b=campaign_service.factory.create('ArrayOfRuleItem')
        page_visitors_rule_item_b=set_elements_to_none(campaign_service.factory.create('StringRuleItem'))
        page_visitors_rule_item_b.Operand="Url"
        page_visitors_rule_item_b.Operator='DoesNotBeginWith'
        page_visitors_rule_item_b.Value="Y"
        page_visitors_rule_items_b.RuleItem.append(page_visitors_rule_item_b)
        page_visitors_rule_item_group_b.Items=page_visitors_rule_items_b
        page_visitors_rule_item_groups.RuleItemGroup.append(page_visitors_rule_item_group_b)
        page_visitors_rule_item_group_c=set_elements_to_none(campaign_service.factory.create('RuleItemGroup'))
        page_visitors_rule_items_c=campaign_service.factory.create('ArrayOfRuleItem')
        page_visitors_rule_item_c=set_elements_to_none(campaign_service.factory.create('StringRuleItem'))
        page_visitors_rule_item_c.Operand="ReferrerUrl"
        page_visitors_rule_item_c.Operator='Equals'
        page_visitors_rule_item_c.Value="Z"
        page_visitors_rule_items_c.RuleItem.append(page_visitors_rule_item_c)
        page_visitors_rule_item_group_c.Items=page_visitors_rule_items_c
        page_visitors_rule_item_groups.RuleItemGroup.append(page_visitors_rule_item_group_c)
        page_visitors_rule.RuleItemGroups=page_visitors_rule_item_groups
        page_visitors_list.Rule=page_visitors_rule
        page_visitors_list.Scope='Account'
        page_visitors_list.TagId=tag_id
        add_audiences.Audience.append(page_visitors_list)

        page_visitors_who_did_not_visit_another_page_list=set_elements_to_none(campaign_service.factory.create('RemarketingList'))
        page_visitors_who_did_not_visit_another_page_list.Description="New list with PageVisitorsWhoDidNotVisitAnotherPageRule"
        page_visitors_who_did_not_visit_another_page_list.MembershipDuration=30
        page_visitors_who_did_not_visit_another_page_list.Name="Remarketing List with PageVisitorsWhoDidNotVisitAnotherPageRule " + strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())
        page_visitors_who_did_not_visit_another_page_list.ParentId=authorization_data.account_id
        # The rule definition is translated to the following logical expression:
        # (((Url Contains X) and (ReferrerUrl DoesNotContain Z)) or ((Url DoesNotBeginWith Y))
        # or ((ReferrerUrl Equals Z)))
        # and not (((Url BeginsWith A) and (ReferrerUrl BeginsWith B)) or ((Url Contains C)))
        page_visitors_who_did_not_visit_another_page_rule=set_elements_to_none(campaign_service.factory.create('PageVisitorsWhoDidNotVisitAnotherPageRule'))
        page_visitors_who_did_not_visit_another_page_exclude_rule_item_groups=campaign_service.factory.create('ArrayOfRuleItemGroup')
        page_visitors_who_did_not_visit_another_page_exclude_rule_item_group_a=set_elements_to_none(campaign_service.factory.create('RuleItemGroup'))
        page_visitors_who_did_not_visit_another_page_exclude_rule_items_a=campaign_service.factory.create('ArrayOfRuleItem')
        page_visitors_who_did_not_visit_another_page_exclude_rule_item_a=set_elements_to_none(campaign_service.factory.create('StringRuleItem'))
        page_visitors_who_did_not_visit_another_page_exclude_rule_item_a.Operand="Url"
        page_visitors_who_did_not_visit_another_page_exclude_rule_item_a.Operator='BeginsWith'
        page_visitors_who_did_not_visit_another_page_exclude_rule_item_a.Value="A"
        page_visitors_who_did_not_visit_another_page_exclude_rule_items_a.RuleItem.append(page_visitors_who_did_not_visit_another_page_exclude_rule_item_a)
        page_visitors_who_did_not_visit_another_page_exclude_rule_item_aa=set_elements_to_none(campaign_service.factory.create('StringRuleItem'))
        page_visitors_who_did_not_visit_another_page_exclude_rule_item_aa.Operand="ReferrerUrl"
        page_visitors_who_did_not_visit_another_page_exclude_rule_item_aa.Operator='BeginsWith'
        page_visitors_who_did_not_visit_another_page_exclude_rule_item_aa.Value="B"
        page_visitors_who_did_not_visit_another_page_exclude_rule_items_a.RuleItem.append(page_visitors_who_did_not_visit_another_page_exclude_rule_item_aa)
        page_visitors_who_did_not_visit_another_page_exclude_rule_item_group_a.Items=page_visitors_who_did_not_visit_another_page_exclude_rule_items_a
        page_visitors_who_did_not_visit_another_page_exclude_rule_item_groups.RuleItemGroup.append(page_visitors_who_did_not_visit_another_page_exclude_rule_item_group_a)
        page_visitors_who_did_not_visit_another_page_exclude_rule_item_group_b=set_elements_to_none(campaign_service.factory.create('RuleItemGroup'))
        page_visitors_who_did_not_visit_another_page_exclude_rule_items_b=campaign_service.factory.create('ArrayOfRuleItem')
        page_visitors_who_did_not_visit_another_page_exclude_rule_item_b=set_elements_to_none(campaign_service.factory.create('StringRuleItem'))
        page_visitors_who_did_not_visit_another_page_exclude_rule_item_b.Operand="Url"
        page_visitors_who_did_not_visit_another_page_exclude_rule_item_b.Operator='Contains'
        page_visitors_who_did_not_visit_another_page_exclude_rule_item_b.Value="C"
        page_visitors_who_did_not_visit_another_page_exclude_rule_items_b.RuleItem.append(page_visitors_who_did_not_visit_another_page_exclude_rule_item_b)
        page_visitors_who_did_not_visit_another_page_exclude_rule_item_group_b.Items=page_visitors_who_did_not_visit_another_page_exclude_rule_items_b
        page_visitors_who_did_not_visit_another_page_exclude_rule_item_groups.RuleItemGroup.append(page_visitors_who_did_not_visit_another_page_exclude_rule_item_group_b)
        page_visitors_who_did_not_visit_another_page_rule.ExcludeRuleItemGroups=page_visitors_who_did_not_visit_another_page_exclude_rule_item_groups
        page_visitors_who_did_not_visit_another_page_include_rule_item_groups=campaign_service.factory.create('ArrayOfRuleItemGroup')
        page_visitors_who_did_not_visit_another_page_include_rule_item_group_a=set_elements_to_none(campaign_service.factory.create('RuleItemGroup'))
        page_visitors_who_did_not_visit_another_page_include_rule_items_a=campaign_service.factory.create('ArrayOfRuleItem')
        page_visitors_who_did_not_visit_another_page_include_rule_item_a=set_elements_to_none(campaign_service.factory.create('StringRuleItem'))
        page_visitors_who_did_not_visit_another_page_include_rule_item_a.Operand="Url"
        page_visitors_who_did_not_visit_another_page_include_rule_item_a.Operator='Contains'
        page_visitors_who_did_not_visit_another_page_include_rule_item_a.Value="X"
        page_visitors_who_did_not_visit_another_page_include_rule_items_a.RuleItem.append(page_visitors_who_did_not_visit_another_page_include_rule_item_a)
        page_visitors_who_did_not_visit_another_page_include_rule_item_aa=set_elements_to_none(campaign_service.factory.create('StringRuleItem'))
        page_visitors_who_did_not_visit_another_page_include_rule_item_aa.Operand="ReferrerUrl"
        page_visitors_who_did_not_visit_another_page_include_rule_item_aa.Operator='DoesNotContain'
        page_visitors_who_did_not_visit_another_page_include_rule_item_aa.Value="Z"
        page_visitors_who_did_not_visit_another_page_include_rule_items_a.RuleItem.append(page_visitors_who_did_not_visit_another_page_include_rule_item_aa)
        page_visitors_who_did_not_visit_another_page_include_rule_item_group_a.Items=page_visitors_who_did_not_visit_another_page_include_rule_items_a
        page_visitors_who_did_not_visit_another_page_include_rule_item_groups.RuleItemGroup.append(page_visitors_who_did_not_visit_another_page_include_rule_item_group_a)
        page_visitors_who_did_not_visit_another_page_include_rule_item_group_b=set_elements_to_none(campaign_service.factory.create('RuleItemGroup'))
        page_visitors_who_did_not_visit_another_page_include_rule_items_b=campaign_service.factory.create('ArrayOfRuleItem')
        page_visitors_who_did_not_visit_another_page_include_rule_item_b=set_elements_to_none(campaign_service.factory.create('StringRuleItem'))
        page_visitors_who_did_not_visit_another_page_include_rule_item_b.Operand="Url"
        page_visitors_who_did_not_visit_another_page_include_rule_item_b.Operator='DoesNotBeginWith'
        page_visitors_who_did_not_visit_another_page_include_rule_item_b.Value="Y"
        page_visitors_who_did_not_visit_another_page_include_rule_items_b.RuleItem.append(page_visitors_who_did_not_visit_another_page_include_rule_item_b)
        page_visitors_who_did_not_visit_another_page_include_rule_item_group_b.Items=page_visitors_who_did_not_visit_another_page_include_rule_items_b
        page_visitors_who_did_not_visit_another_page_include_rule_item_groups.RuleItemGroup.append(page_visitors_who_did_not_visit_another_page_include_rule_item_group_b)
        page_visitors_who_did_not_visit_another_page_include_rule_item_group_c=set_elements_to_none(campaign_service.factory.create('RuleItemGroup'))
        page_visitors_who_did_not_visit_another_page_include_rule_items_c=campaign_service.factory.create('ArrayOfRuleItem')
        page_visitors_who_did_not_visit_another_page_include_rule_item_c=set_elements_to_none(campaign_service.factory.create('StringRuleItem'))
        page_visitors_who_did_not_visit_another_page_include_rule_item_c.Operand="ReferrerUrl"
        page_visitors_who_did_not_visit_another_page_include_rule_item_c.Operator='Equals'
        page_visitors_who_did_not_visit_another_page_include_rule_item_c.Value="Z"
        page_visitors_who_did_not_visit_another_page_include_rule_items_c.RuleItem.append(page_visitors_who_did_not_visit_another_page_include_rule_item_c)
        page_visitors_who_did_not_visit_another_page_include_rule_item_group_c.Items=page_visitors_who_did_not_visit_another_page_include_rule_items_c
        page_visitors_who_did_not_visit_another_page_include_rule_item_groups.RuleItemGroup.append(page_visitors_who_did_not_visit_another_page_include_rule_item_group_c)
        page_visitors_who_did_not_visit_another_page_rule.IncludeRuleItemGroups=page_visitors_who_did_not_visit_another_page_include_rule_item_groups
        page_visitors_who_did_not_visit_another_page_list.Rule=page_visitors_who_did_not_visit_another_page_rule
        page_visitors_who_did_not_visit_another_page_list.Scope='Account'
        page_visitors_who_did_not_visit_another_page_list.TagId=tag_id
        add_audiences.Audience.append(page_visitors_who_did_not_visit_another_page_list)

        page_visitors_who_visited_another_page_list=set_elements_to_none(campaign_service.factory.create('RemarketingList'))
        page_visitors_who_visited_another_page_list.Description="New list with PageVisitorsWhoVisitedAnotherPageRule"
        page_visitors_who_visited_another_page_list.MembershipDuration=30
        page_visitors_who_visited_another_page_list.Name="Remarketing List with PageVisitorsWhoVisitedAnotherPageRule " + strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())
        page_visitors_who_visited_another_page_list.ParentId=authorization_data.account_id
        # The rule definition is translated to the following logical expression:
        # (((Url Contains X) and (ReferrerUrl NotEquals Z)) or ((Url DoesNotBeginWith Y)) or
        # ((ReferrerUrl Equals Z)))
        # and (((Url BeginsWith A) and (ReferrerUrl BeginsWith B)) or ((Url Contains C)))
        page_visitors_who_visited_another_page_rule=set_elements_to_none(campaign_service.factory.create('PageVisitorsWhoVisitedAnotherPageRule'))
        page_visitors_who_visited_another_page_another_rule_item_groups=campaign_service.factory.create('ArrayOfRuleItemGroup')
        page_visitors_who_visited_another_page_another_rule_item_group_a=set_elements_to_none(campaign_service.factory.create('RuleItemGroup'))
        page_visitors_who_visited_another_page_another_rule_items_a=campaign_service.factory.create('ArrayOfRuleItem')
        page_visitors_who_visited_another_page_another_rule_item_a=set_elements_to_none(campaign_service.factory.create('StringRuleItem'))
        page_visitors_who_visited_another_page_another_rule_item_a.Operand="Url"
        page_visitors_who_visited_another_page_another_rule_item_a.Operator='BeginsWith'
        page_visitors_who_visited_another_page_another_rule_item_a.Value="A"
        page_visitors_who_visited_another_page_another_rule_items_a.RuleItem.append(page_visitors_who_visited_another_page_another_rule_item_a)
        page_visitors_who_visited_another_page_another_rule_item_aa=set_elements_to_none(campaign_service.factory.create('StringRuleItem'))
        page_visitors_who_visited_another_page_another_rule_item_aa.Operand="ReferrerUrl"
        page_visitors_who_visited_another_page_another_rule_item_aa.Operator='BeginsWith'
        page_visitors_who_visited_another_page_another_rule_item_aa.Value="B"
        page_visitors_who_visited_another_page_another_rule_items_a.RuleItem.append(page_visitors_who_visited_another_page_another_rule_item_aa)
        page_visitors_who_visited_another_page_another_rule_item_group_a.Items=page_visitors_who_visited_another_page_another_rule_items_a
        page_visitors_who_visited_another_page_another_rule_item_groups.RuleItemGroup.append(page_visitors_who_visited_another_page_another_rule_item_group_a)
        page_visitors_who_visited_another_page_another_rule_item_group_b=set_elements_to_none(campaign_service.factory.create('RuleItemGroup'))
        page_visitors_who_visited_another_page_another_rule_items_b=campaign_service.factory.create('ArrayOfRuleItem')
        page_visitors_who_visited_another_page_another_rule_item_b=set_elements_to_none(campaign_service.factory.create('StringRuleItem'))
        page_visitors_who_visited_another_page_another_rule_item_b.Operand="Url"
        page_visitors_who_visited_another_page_another_rule_item_b.Operator='Contains'
        page_visitors_who_visited_another_page_another_rule_item_b.Value="C"
        page_visitors_who_visited_another_page_another_rule_items_b.RuleItem.append(page_visitors_who_visited_another_page_another_rule_item_b)
        page_visitors_who_visited_another_page_another_rule_item_group_b.Items=page_visitors_who_visited_another_page_another_rule_items_b
        page_visitors_who_visited_another_page_another_rule_item_groups.RuleItemGroup.append(page_visitors_who_visited_another_page_another_rule_item_group_b)
        page_visitors_who_visited_another_page_rule.AnotherRuleItemGroups=page_visitors_who_visited_another_page_another_rule_item_groups
        page_visitors_who_visited_another_page_rule_item_groups=campaign_service.factory.create('ArrayOfRuleItemGroup')
        page_visitors_who_visited_another_page_rule_item_group_a=set_elements_to_none(campaign_service.factory.create('RuleItemGroup'))
        page_visitors_who_visited_another_page_rule_items_a=campaign_service.factory.create('ArrayOfRuleItem')
        page_visitors_who_visited_another_page_rule_item_a=set_elements_to_none(campaign_service.factory.create('StringRuleItem'))
        page_visitors_who_visited_another_page_rule_item_a.Operand="Url"
        page_visitors_who_visited_another_page_rule_item_a.Operator='Contains'
        page_visitors_who_visited_another_page_rule_item_a.Value="X"
        page_visitors_who_visited_another_page_rule_items_a.RuleItem.append(page_visitors_who_visited_another_page_rule_item_a)
        page_visitors_who_visited_another_page_rule_item_aa=set_elements_to_none(campaign_service.factory.create('StringRuleItem'))
        page_visitors_who_visited_another_page_rule_item_aa.Operand="ReferrerUrl"
        page_visitors_who_visited_another_page_rule_item_aa.Operator='DoesNotContain'
        page_visitors_who_visited_another_page_rule_item_aa.Value="Z"
        page_visitors_who_visited_another_page_rule_items_a.RuleItem.append(page_visitors_who_visited_another_page_rule_item_aa)
        page_visitors_who_visited_another_page_rule_item_group_a.Items=page_visitors_who_visited_another_page_rule_items_a
        page_visitors_who_visited_another_page_rule_item_groups.RuleItemGroup.append(page_visitors_who_visited_another_page_rule_item_group_a)
        page_visitors_who_visited_another_page_rule_item_group_b=set_elements_to_none(campaign_service.factory.create('RuleItemGroup'))
        page_visitors_who_visited_another_page_rule_items_b=campaign_service.factory.create('ArrayOfRuleItem')
        page_visitors_who_visited_another_page_rule_item_b=set_elements_to_none(campaign_service.factory.create('StringRuleItem'))
        page_visitors_who_visited_another_page_rule_item_b.Operand="Url"
        page_visitors_who_visited_another_page_rule_item_b.Operator='DoesNotBeginWith'
        page_visitors_who_visited_another_page_rule_item_b.Value="Y"
        page_visitors_who_visited_another_page_rule_items_b.RuleItem.append(page_visitors_who_visited_another_page_rule_item_b)
        page_visitors_who_visited_another_page_rule_item_group_b.Items=page_visitors_who_visited_another_page_rule_items_b
        page_visitors_who_visited_another_page_rule_item_groups.RuleItemGroup.append(page_visitors_who_visited_another_page_rule_item_group_b)
        page_visitors_who_visited_another_page_rule_item_group_c=set_elements_to_none(campaign_service.factory.create('RuleItemGroup'))
        page_visitors_who_visited_another_page_rule_items_c=campaign_service.factory.create('ArrayOfRuleItem')
        page_visitors_who_visited_another_page_rule_item_c=set_elements_to_none(campaign_service.factory.create('StringRuleItem'))
        page_visitors_who_visited_another_page_rule_item_c.Operand="ReferrerUrl"
        page_visitors_who_visited_another_page_rule_item_c.Operator='Equals'
        page_visitors_who_visited_another_page_rule_item_c.Value="Z"
        page_visitors_who_visited_another_page_rule_items_c.RuleItem.append(page_visitors_who_visited_another_page_rule_item_c)
        page_visitors_who_visited_another_page_rule_item_group_c.Items=page_visitors_who_visited_another_page_rule_items_c
        page_visitors_who_visited_another_page_rule_item_groups.RuleItemGroup.append(page_visitors_who_visited_another_page_rule_item_group_c)
        page_visitors_who_visited_another_page_rule.RuleItemGroups=page_visitors_who_visited_another_page_rule_item_groups
        page_visitors_who_visited_another_page_list.Rule=page_visitors_who_visited_another_page_rule
        page_visitors_who_visited_another_page_list.Scope='Account'
        page_visitors_who_visited_another_page_list.TagId=tag_id
        add_audiences.Audience.append(page_visitors_who_visited_another_page_list)

        # RemarketingList extends the Audience base class.
        # We manage remarketing lists with Audience operations.

        output_status_message("-----\nAddAudiences:")
        add_audiences_response=campaign_service.AddAudiences(
            Audiences=add_audiences
        )
        audience_ids={
            'long': add_audiences_response.AudienceIds['long'] if add_audiences_response.AudienceIds['long'] else None
        }
        output_status_message("AudienceIds:")
        output_array_of_long(audience_ids)
        output_status_message("PartialErrors:")
        output_array_of_batcherror(add_audiences_response.PartialErrors)

        # Add an ad group in a campaign. The ad group will later be associated with remarketing lists.

        campaigns=campaign_service.factory.create('ArrayOfCampaign')
        campaign=set_elements_to_none(campaign_service.factory.create('Campaign'))
        campaign.BudgetType='DailyBudgetStandard'
        campaign.DailyBudget=50
        languages=campaign_service.factory.create('ns3:ArrayOfstring')
        languages.string.append('All')
        campaign.Languages=languages
        campaign.Name="Women's Shoes " + strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())
        campaign.TimeZone='PacificTimeUSCanadaTijuana'
        campaigns.Campaign.append(campaign)

        output_status_message("-----\nAddCampaigns:")
        add_campaigns_response=campaign_service.AddCampaigns(
            AccountId=authorization_data.account_id,
            Campaigns=campaigns
        )
        campaign_ids={
            'long': add_campaigns_response.CampaignIds['long'] if add_campaigns_response.CampaignIds['long'] else None
        }
        output_status_message("CampaignIds:")
        output_array_of_long(campaign_ids)
        output_status_message("PartialErrors:")
        output_array_of_batcherror(add_campaigns_response.PartialErrors)

        ad_groups=campaign_service.factory.create('ArrayOfAdGroup')
        ad_group=set_elements_to_none(campaign_service.factory.create('AdGroup'))
        ad_group.Name="Women's Red Shoe Sale"
        end_date=campaign_service.factory.create('Date')
        end_date.Day=31
        end_date.Month=12
        current_time=gmtime()
        end_date.Year=current_time.tm_year + 1
        ad_group.EndDate=end_date
        cpc_bid=campaign_service.factory.create('Bid')
        cpc_bid.Amount=0.09
        ad_group.CpcBid=cpc_bid
        # Applicable for all remarketing lists that are associated with this ad group. TargetAndBid indicates
        # that you want to show ads only to people included in the remarketing list, with the option to change
        # the bid amount. Ads in this ad group will only show to people included in the remarketing list.
        ad_group_settings=campaign_service.factory.create('ArrayOfSetting')
        ad_group_target_setting=campaign_service.factory.create('TargetSetting')
        ad_group_audience_target_setting_detail=campaign_service.factory.create('TargetSettingDetail')
        ad_group_audience_target_setting_detail.CriterionTypeGroup='Audience'
        ad_group_audience_target_setting_detail.TargetAndBid=True
        ad_group_target_setting.Details.TargetSettingDetail.append(ad_group_audience_target_setting_detail)
        ad_group_settings.Setting.append(ad_group_target_setting)
        ad_group.Settings=ad_group_settings
        ad_groups.AdGroup.append(ad_group)

        output_status_message("-----\nAddAdGroups:")
        add_ad_groups_response=campaign_service.AddAdGroups(
            CampaignId=campaign_ids['long'][0],
            AdGroups=ad_groups,
            ReturnInheritedBidStrategyTypes=False
        )
        ad_group_ids={
            'long': add_ad_groups_response.AdGroupIds['long'] if add_ad_groups_response.AdGroupIds['long'] else None
        }
        output_status_message("AdGroupIds:")
        output_array_of_long(ad_group_ids)
        output_status_message("PartialErrors:")
        output_array_of_batcherror(add_ad_groups_response.PartialErrors)

        # Associate all of the remarketing lists created above with the new ad group.

        ad_group_remarketing_list_associations=campaign_service.factory.create('ArrayOfAdGroupCriterion')

        for audience_id in audience_ids['long']:
            if audience_id is not None:
                biddable_ad_group_criterion=set_elements_to_none(campaign_service.factory.create('BiddableAdGroupCriterion'))
                biddable_ad_group_criterion.AdGroupId=ad_group_ids['long'][0]
                biddable_ad_group_criterion.Status='Active'
                audience_criterion=set_elements_to_none(campaign_service.factory.create('AudienceCriterion'))
                audience_criterion.AudienceId=audience_id
                audience_criterion.AudienceType='RemarketingList'
                biddable_ad_group_criterion.Criterion=audience_criterion
                bid_multiplier=set_elements_to_none(campaign_service.factory.create('BidMultiplier'))
                bid_multiplier.Multiplier=20.00
                biddable_ad_group_criterion.CriterionBid=bid_multiplier
                ad_group_remarketing_list_associations.AdGroupCriterion.append(biddable_ad_group_criterion)

        output_status_message("-----\nAddAdGroupCriterions:")
        add_ad_group_criterions_response = campaign_service.AddAdGroupCriterions(
            AdGroupCriterions=ad_group_remarketing_list_associations,
            CriterionType='Audience'
        )
        ad_group_criterion_ids={
            'long': add_ad_group_criterions_response.AdGroupCriterionIds['long'] if add_ad_group_criterions_response.AdGroupCriterionIds['long'] else None
        }
        output_status_message("AdGroupCriterionIds:")
        output_array_of_long(ad_group_criterion_ids)
        output_status_message("NestedPartialErrors:")
        output_array_of_batcherror(add_ad_group_criterions_response.NestedPartialErrors)

        # Delete the campaign and everything it contains e.g., ad groups and ads.

        output_status_message("-----\nDeleteCampaigns:")
        campaign_service.DeleteCampaigns(
            AccountId=authorization_data.account_id,
            CampaignIds=campaign_ids
        )
        output_status_message("Deleted Campaign Id {0}".format(campaign_ids['long'][0]))

    except WebFault as ex:
        output_webfault_errors(ex)
    except Exception as ex:
        output_status_message(ex)

# Main execution
if __name__ == '__main__':

    print("Loading the web service client proxies...")

    authorization_data=AuthorizationData(
        account_id=None,
        customer_id=None,
        developer_token=DEVELOPER_TOKEN,
        authentication=None,
    )

    campaign_service=ServiceClient(
        service='CampaignManagementService',
        version=13,
        authorization_data=authorization_data,
        environment=ENVIRONMENT,
    )

    authenticate(authorization_data)

    main(authorization_data)


text:
/* help.js
 *
 * Atomic OS WASH command
 *
 * Simple help utility
 *
 * @author Scott Elcomb <psema4@gmail.com (http://www.psema4.com)
 * @version 2.0.0
 */

window.system = window.system || {};
system.bin = system.bin || {};

/* Dummy constructor
 *
 * Access programmatically via system.bin.help.!!methodName!!
 * @constructor
 */

system.bin.help = {
    /* @method help
     * @returns {string} Returns a simple string synopsis for this command
     *
     * Simple synopsis on this command, used by the help command
     */

    help: function() {
        return "Simple help utility\n\n  Usage: help [command name]";
    },

    /* @method exec
     * @param {Array} args A list of arguments the command was called with
     * Executes command with args. The calling HxProcess is available as **this** and it's first 3 file descriptors are stdin, stdout, and stderr respectively.
     * For example, to echo text to stdout: **this.fd[1].write('foobar');**
     */

    exec: function(args) {
        // 'this' is the calling process

        var stdin  = (this.fd && this.fd.length > 0) ? this.fd[0] : false;
        var stdout = (this.fd && this.fd.length > 1) ? this.fd[1] : false;
        var stderr = (this.fd && this.fd.length > 2) ? this.fd[2] : false;

        try {
            var cmd = args instanceof Array ? args[0] : 'help';

            if (system.bin[cmd]) {
                var message = 'Help not available for command "' + cmd + '"';

                if (system.bin[cmd].help) message = system.bin[cmd].help();
                if (stdout) stdout.write(message);
            }

        } catch(e) {
            if (stderr) {
                stderr.write('command exception: ' + e);

            } else {
                console.log('command exception:');
                console.dir(e);
            }
        }
    }
};


text:
alphatwirl.summary.Reader
=========================

.. currentmodule:: alphatwirl.summary

.. autoclass:: Reader

   .. automethod:: __init__

   .. rubric:: Methods

   .. autosummary::

      ~Reader.__init__
      ~Reader.begin
      ~Reader.collect
      ~Reader.end
      ~Reader.event
      ~Reader.merge
      ~Reader.results


text:
namespace blink {

// http://fetch.spec.whatwg.org/#terminology-headers
class CORE_EXPORT FetchHeaderList final
    : public GarbageCollected<FetchHeaderList> {
 public:
  struct ByteCaseInsensitiveCompare {
    bool operator()(const String& lhs, const String& rhs) const {
      return CodeUnitCompareIgnoringASCIICaseLessThan(lhs, rhs);
    }
  };

  typedef std::pair<String, String> Header;
  FetchHeaderList* Clone() const;

  FetchHeaderList();
  ~FetchHeaderList();

  void Append(const String&, const String&);
  void Set(const String&, const String&);
  // FIXME: Implement parse()
  String ExtractMIMEType() const;

  size_t size() const;
  void Remove(const String&);
  bool Get(const String&, String&) const;
  String GetAsRawString(int status_code, String status_message) const;
  bool Has(const String&) const;
  void ClearList();

  Vector<Header> SortAndCombine() const;

  const std::multimap<String, String, ByteCaseInsensitiveCompare>& List()
      const {
    return header_list_;
  }

  static bool IsValidHeaderName(const String&);
  static bool IsValidHeaderValue(const String&);

  void Trace(Visitor* visitor) const {}

 private:
  // While using STL data structures in Blink is not very common or
  // encouraged, we do need a multimap here. The closest WTF structure
  // comparable to what we need would be a
  //   HashMap<String, Vector<String>>
  // but it is not a "flat" data structure like std::multimap is. The
  // size() of the HashMap is the number of distinct header names, not
  // the total number of headers and values on the list.
  // This would cause FetchHeaderList::size() to have to manually
  // iterate through all keys and vectors in the HashMap. Similarly,
  // list() would require callers to manually iterate through the
  // HashMap's keys and value vector.
  std::multimap<String, String, ByteCaseInsensitiveCompare> header_list_;
};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_CORE_FETCH_FETCH_HEADER_LIST_H_


text:
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use App\Realtime\Events as SocketClient;
use App\User;
use JWTAuth;

class PostNotify extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'notify:post {token}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Notify a new post for all friends related User';

    protected $token;

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
        $this->socketClient = new SocketClient();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
      $user = JWTAuth::toUser($this->argument('token'));
      $friendsUserIds = $user->friends()->where('online_status',1)->lists('requester_id');
      $relatedToId = $user->id;
      $clientCode = 41;
      $message = $user->name." escreveu um novo post.";
      $this->socketClient->notifyNewPost($friendsUserIds,$clientCode,$relatedToId,$message);

    }
}


text:
var mimeTypes = require('./mimeTypes').ext2type

function hasData(options, response, data){
    if (options.type === 'csv' || options.type === 'tsv') {
        if (options.method !== "serverStatus") {
            response.writeHead(400, {'Content-Type': mimeTypes['.txt']});
            response.end("This output data type is not supported for this method.");
            return;
        }

        var type = mimeTypes['.'+options.type];
        //    disposition = "attachment;filename=ServerStatus."+options.type;
        response.writeHead(200, {'Content-Type': type});
        //                   'Content-disposition': disposition});

        var sep = options.type === 'csv' ? ',' : '\t';
        response.write(['Project', 'Job', 'Done', 'Total steps',
            'Basic statistics', 'Idle times', 'Throughput', 'Full statistics'
            ].join(sep)+"\n");
        data.forEach(function(it){
            response.write([it.project, it.name, it.done, it.totalSteps,
                it.basicStatistics, it.idleTimes, it.throughput,
                it.fullStatistics].join(sep)+"\n");
        });
        response.end();
    } else if (options.type === 'jsonp') {
        response.writeHead(200, {'Content-Type': mimeTypes['.js']});
        response.end([options.callback, "(", JSON.stringify(data), ")"].join(""));
    } else {
        response.writeHead(200, {'Content-Type': mimeTypes['.json']});
        response.end(JSON.stringify(data));
    }
}

function onError(response, err) {
    console.log(err);
    response.writeHead(500, "Error getting data from database.")
}

// All methods must be in format function(callback(data), callback(error)). */
function handleRequest(options, response, methods){
    if ("method" in options){
        if (options.method in methods) {
            methods[options.method](options,
                                    hasData.bind({}, options, response),
                                    onError.bind({}, response)  );
        } else {
            response.writeHead(404, {"Content-type": mimeTypes[".txt"]});
            response.end("Unknown method: " + options.method);
        }
    } else {
        response.writeHead(400, {"Content-type": mimeTypes[".txt"]});
        response.end("Missing `method` parameter.");
    }
}

exports.handle = handleRequest;


text:
using Modeles;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ViewModels
{
    public abstract class PronosticVM<TDonnee> : PronosticVM
    {
        private bool afficherResultatOfficiel;
        public TDonnee Officiel { get; protected set; }
        public TDonnee Pronostic { get; protected set; }
        public TDonnee Current
        {
            get
            {
                return afficherResultatOfficiel ? Officiel : Pronostic;
            }
        }
        public bool AfficherResultatOfficiel
        {
            get
            {
                return afficherResultatOfficiel;
            }
            set
            {
                if (afficherResultatOfficiel != value)
                {
                    afficherResultatOfficiel = value;
                    RaisePropertyChanged("AfficherResultatOfficiel");
                    RaisePropertyChanged("Current");
                }
            }
        }
        public PronosticVM(Utilisateur utilisateur) : base(utilisateur) { }
    }
}