Skip to content

Conversation

travislondon
Copy link
Member

No description provided.

Add more path data for INFO logs during action processing.
Remove forrmatting
Add text indicating line number and column
raise ParseException("invalid token '%s' at %s:%s" % (p.type,
p.lineno,
find_column(p.lexer.lexdata, p.lexpos)))
raise ParseException("invalid token '%s' at %s : %s" % (p.type,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about : raise ParseException("invalid token '%s' at line %s, column %s" % (p.type, p.lineno, ... ?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

s_ee = one(self._s_brg).S_EE[19]()
return '%s::%s' % (s_ee.Name, self._s_brg.Name)

compName = ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pyxtuml does not use camel case, use comp_name instead

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.


def __init__(self, metamodel, sm_act):
self._sm_act = sm_act
self._assigned = one(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self._sm_evt instead of self._assigned?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

self._sm_act = sm_act
self._assigned = one(
sm_act).SM_AH[514].SM_TAH[513].SM_TXN[530].SM_NSTXN[507].SM_SEME[504].SM_SEVT[503].SM_EVT[525]()
self._state = one(sm_act).SM_AH[514].SM_MOAH[513].SM_STATE[511]()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self._sm_state instead of self._state?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

Address review comments
def label(self):
return ''

action_owner_name = ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is _sm_state always set? If so, this would improve readability:

    action_owner_name = self._sm_state.Name
    if self._sm_evt:
        action_owner_name = self.get_event_name(self._sm_evt)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not, the TransitionPrebuilder covers the case for SM_ACT for both Transitions and States.

return ''

action_owner_name = ""
if self._assigned is not None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self._assigned was renamed in this commit, updater to new name

# return '%s::%s::%s' % (port.Name, interface.Name, self._spr_ro.Name)
return ''

interface = one(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to interface c_i?

logger.info('processing action %s' % walker.label)
walker = walker_map[metaclass.kind]['prebuilder'](
metaclass.metamodel, instance)
actionType = walker_map[metaclass.kind]['elementName']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

camleCase...

Address review comments
logger.info('processing action %s' % walker.label)
walker = walker_map[metaclass.kind]['prebuilder'](
metaclass.metamodel, instance)
actionType = walker_map[metaclass.kind]['elementName']
Copy link
Contributor

@john-tornblom john-tornblom Oct 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about moving the action_type as a property to each Prebuilder class, e.g.,



FunctionPrebuilder(ActionPrebuilder):
    element_name = 'Function'


@property

def get_event_name(self, event):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is difficult to read and understand.

Could you flatten the conditions a bit, and add comment on each case?
I tried my best to write a sugestion, but I do not have access to the metamodel at the moment.
Here is a possibly incorrect example that points towards my intentions.

def get_event_name(sm_evt):
    sm_nlevt = one(sm_evt).SM_SEVT[525].SM_NLEVT[526]()
    sm_sgevt = one(sm_evt).SM_SEVT[525].SM_SGEVT[526]()
    sm_pect = one(sm_nlevt).SM_PEVT[527]()

    # non-local polymorphic event
    if sm_pect and sm_pect.SM_ID != sm_nlevt.SM_ID:
        return sm_evt.Drv_Lbl + ": " + sm_evt.Mning

    # local polymorphic event
    if sm_pect:
        return sm_evt.Mning + "::" + sm_pect.localClassName

    # orphan, what is this?
    if sm_nlevt:
        return event.Mning + "::Orphaned"

    # case 4
    if sm_sgevt:
        return sm_evt.Drv_Lbl

    # case 5
    return sm_evt.Drv_Lbl + ": " + sm_evt.Mning

Rework action owner for state/transition.
Move element type into each prebuilder.
@john-tornblom
Copy link
Contributor

I will merge this when the final comment is addressed (or argued against). Could you provide me with a summarizing comment from the #12009 job description (which is not easily accessible by the general public), and I'll use that as a rebase commit message.

Nice job!

Reformat get_event_name
@travislondon
Copy link
Member Author

Summarizing comment:

  • Extend Action prebuilders such that all return a valid label.

  • Extend Action prebuilders to include an element_type attribute for clearly logging information.

  • Add get_event_name function allowing properly labeling for these cases:

    • Polymorphic Event Local
    • Polymorphic Event Non Local
    • Polymorphic Event orphaned
    • Signal Event
    • Local Event

@travislondon
Copy link
Member Author

The other case will work though right?

   "sm_pevt is None"

@travislondon
Copy link
Member Author

Actually I have to have it there, maybe I am not following. With it removed there is an error around SM_ID on None.

@john-tornblom
Copy link
Contributor

Okey!

'obj is None' checks if obj is actually equal to None.
Consequently, if 'obj is False' evaluates to True, then 'obj is None' evaluates to False.

Lets keep it as your original suggestion, my comment was purely cosmetic...

@john-tornblom john-tornblom merged commit b7552a4 into xtuml:master Oct 7, 2020
@john-tornblom
Copy link
Contributor

prebuild: pinpoint error messages to line, column, and type of action.

Specifically;

  • extend Action prebuilders such that all return a valid label,
  • extend Action prebuilders to include an element_type attribute for clearly logging information,
  • add get_event_name function allowing properly labeling for these cases:
    Polymorphic Event Local
    Polymorphic Event Non Local
    Polymorphic Event orphaned
    Signal Event
    Local Event

@john-tornblom
Copy link
Contributor

john-tornblom commented Oct 7, 2020 via email

@john-tornblom
Copy link
Contributor

The tests seems to fail, could you have a look at that?

See https://travis-ci.org/github/xtuml/pyxtuml/jobs/733791752 for logs.

@john-tornblom
Copy link
Contributor

Please have a look at #27, and make sure it works as expected.
In particular, should the interface name part of labels?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants