talk OpenERP cryptic associations API
336896
def cast_association(k)
      if self.class.one2many_associations[k]
        if @loaded_associations[k]
          v = @loaded_associations[k].select {|i| i.changed?}
          v = @associations[k] if v.empty?
        else
          v = @associations[k]
        end
        cast_o2m_association(v)
      elsif self.class.many2many_associations[k]
        v = @associations[k]
        [[6, false, (v || []).map {|i| i.is_a?(Base) ? i.id : i}]]
      elsif self.class.many2one_associations[k]
        v = @associations[k] # TODO support for nested
        cast_m2o_association(v)
      end
    end
1120739
def convert_association(self, association: Association) -> Entity:
        
        if "header" not in association or association["header"] == False:
            # print(json.dumps(association, indent=4))
            gpi_obj = {
                'id': association["subject"]["id"],
                'label': association["subject"]["label"],  # db_object_symbol,
                'full_name': association["subject"]["fullname"],  # db_object_name,
                'synonyms': association["subject"]["synonyms"],
                'type': association["subject"]["type"], #db_object_type,
                'parents': "", # GAF does not have this field, but it's optional in GPI
                'xrefs': "", # GAF does not have this field, but it's optional in GPI
                'taxon': {
                    'id': association["subject"]["taxon"]["id"]
                }
            }
            return Entity(gpi_obj)

        return None
1173650
def augmentTextWithCONLLstr( conll_str_array, text ):
    ''' 
    '''
    j = 0
    for sentence in text.divide( layer=WORDS, by=SENTENCES ):
        sentence = __sort_analyses(sentence)
        for i in range(len(sentence)):
            estnltkToken    = sentence[i]
            maltparserToken = conll_str_array[j]
            if len( maltparserToken ) > 1:
                maltParserAnalysis = maltparserToken.split('\t')
                if estnltkToken[TEXT] == maltParserAnalysis[1]:
                    # Fetch information about the syntactic relation:
                    estnltkToken[SYNTAX_LABEL] = maltParserAnalysis[0]
                    estnltkToken[SYNTAX_HEAD]  = maltParserAnalysis[6]
                    # Fetch the name of the surface syntactic relation
                    estnltkToken[DEPREL]       = maltParserAnalysis[7]
                else:
                    raise Exception("A misalignment between Text and Maltparser's output: ",\
                        estnltkToken, maltparserToken )
            j += 1
        j += 1
773176
def respond_to_missing?(name, _include_private = false)
      str_name = name.to_s
      key?(name.to_sym) || %w[? !].any?(&str_name.method(:end_with?)) || super
    end
699243
def _update_known_atts(self, **kwargs):
        
        for k, v in kwargs.items():
            if k not in ATTR_KEYS:
                # Warn if passed in unknown kwargs
                raise SyntaxWarning('Unknown argument: {}'.format(k))
            elif not v: # Delete attributes with falsey values
                delattr(self, k)
            else:
                setattr(self, k, v)
111847
def gather_verify_arguments(self):
        
        _ctx = self.service_context
        kwargs = {
            'client_id': _ctx.client_id, 'iss': _ctx.issuer,
            'keyjar': _ctx.keyjar, 'verify': True,
            'skew': _ctx.clock_skew
        }

        for attr, param in IDT2REG.items():
            try:
                kwargs[attr] = _ctx.registration_response[param]
            except KeyError:
                pass

        try:
            kwargs['allow_missing_kid'] = self.service_context.allow[
                'missing_kid']
        except KeyError:
            pass

        return kwargs
310983
def extract_boto_args_from_env(env_vars):
    """"""
    boto_args = {}
    for i in ['aws_access_key_id', 'aws_secret_access_key',
              'aws_session_token']:
        if env_vars.get(i.upper()):
            boto_args[i] = env_vars[i.upper()]
    return boto_args
697025
def multiple?(method_name)
      return false if association(method_name).nil?

      name = association(method_name).respond_to?(:many?) ? :many? : :collection?
      association(method_name).send(name)
    end
499844
def _get_name_info(name_index, name_list):
    
    argval = name_index
    if (name_list is not None
        # PyPY seems to "optimize" out constant names,
        # so we need for that:
        and name_index < len(name_list)):
        argval = name_list[name_index]
        argrepr = argval
    else:
        argrepr = repr(argval)
    return argval, argrepr
481097
def victim_asset_associations(self, params=None):
        
        if params is None:
            params = {}
        if not self.can_update():
            self._tcex.handle_error(910, [self.type])

        return self.tc_requests.victim_asset_associations(
            self.api_type, self.api_sub_type, self.unique_id, owner=self.owner, params=params
        )
1367375
def _fake_openassociatorinstances(self, namespace, **params):
        
        self._validate_namespace(namespace)
        self._validate_open_params(**params)
        params['ObjectName'] = params['InstanceName']
        del params['InstanceName']

        result = self._fake_associators(namespace, **params)

        objects = [] if result is None else [x[2] for x in result[0][2]]

        return self._open_response(objects, namespace,
                                   'PullInstancesWithPath', **params)
1049135
def check(cls):
        
        attribs = [
            'app_version',
            'app_name',
            'config_file_path',
            'config_sep_str',
        ]
        for attrib in attribs:
            if getattr(cls, attrib) == 'not_set':
                raise IncompleteSetupError(f'elib_config setup is incomplete; missing: {attrib}')
705854
def iam(cls, account_name, api_key, **kwargs):
        
        return cls(None,
                   api_key,
                   account=account_name,
                   auto_renew=kwargs.get('auto_renew', True),
                   use_iam=True,
                   **kwargs)
504396
def _python_psk_client_callback(ssl_id, hint):
    
    if ssl_id not in _callbacks:
        return ("", "")
    else:
        res = _callbacks[ssl_id](hint)
        return res if isinstance(res, tuple) else (res, "")
740213
def get_association(id, **kwargs):
    
    results = search_associations(id=id, **kwargs)
    assoc = results['associations'][0] if len(results['associations']) > 0 else {}
    return assoc
52286
def _unknown_args(self, args):
        
        for u in args:
            self.tcex.log.warning(u'Unsupported arg found ({}).'.format(u))
371962
def ar_collection?(instance, method)
      defined?(ActiveRecord) &&
        instance.respond_to?(method) &&
        instance.send(method).is_a?(ActiveRecord::Relation)
    end