From a9c8a91fc65b064b334ea9581b483b77cd2d423c Mon Sep 17 00:00:00 2001 From: anquetil Date: Thu, 28 Dec 2023 13:08:17 +0100 Subject: [PATCH 01/31] refactor #visitDotoptDottedName: --- .../MSEPythonToFamixImporterVisitor.class.st | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st index a8b1835..cba605d 100644 --- a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st +++ b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st @@ -4,7 +4,8 @@ Class { #instVars : [ 'model', 'sender', - 'layer' + 'layer', + 'rootFilePath' ], #category : #'MoosePy-Visitors' } @@ -399,7 +400,7 @@ MSEPythonToFamixImporterVisitor >> getReceiverFromSmaccInvocationNode: anInvocat MSEPythonToFamixImporterVisitor >> importFromName: anImportFromNode [ | result | - result := self visitDotoptDottedName: anImportFromNode name. + result := self visitDotOptDottedName: anImportFromNode. ^ result ] @@ -417,7 +418,7 @@ MSEPythonToFamixImporterVisitor >> importNames: anImportNode [ | result | result := anImportNode names collect: [ :name | - self visitDotoptDottedName: name ]. + self visitDotOptDottedName: name ]. ^ result ] @@ -601,19 +602,19 @@ MSEPythonToFamixImporterVisitor >> visitClassdef: aClassDef [ ] { #category : #visiting } -MSEPythonToFamixImporterVisitor >> visitDotoptDottedName: anDotoptDottedNode [ +MSEPythonToFamixImporterVisitor >> visitDotOptDottedName: aDotOptDottedNode [ - (anDotoptDottedNode isKindOf: PyDottedNameNode) ifTrue: [ - ^ '.' join: (anDotoptDottedNode names collect: [ :name | - (name isKindOf: PyDottedNameNode) ifTrue: [ - self visitDottedName: name ]. - name value ]). - ]. + (aDotOptDottedNode isKindOf: PyDottedNameNode) ifFalse: [ ^ aDotOptDottedNode value ]. + ^'.' join: (aDotOptDottedNode names collect: [ :name | + (name isKindOf: PyDottedNameNode) + ifTrue: [ self visitDottedName: name ]. + name value + ]) - ^ anDotoptDottedNode value + ] { #category : #visiting } From 8793d6db3df478f02251789c2a5e9cca5b63fca5 Mon Sep 17 00:00:00 2001 From: anquetil Date: Thu, 28 Dec 2023 13:08:49 +0100 Subject: [PATCH 02/31] refactor visit of InterpolatedString --- src/MoosePy/MSEPythonToFamixImporterVisitor.class.st | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st index cba605d..25af7b3 100644 --- a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st +++ b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st @@ -666,6 +666,12 @@ MSEPythonToFamixImporterVisitor >> visitImport: anImport [ ] +{ #category : #visiting } +MSEPythonToFamixImporterVisitor >> visitInterpolatedString: anInterpolatedString [ + + ^(anInterpolatedString topParent completeSource copyFrom: anInterpolatedString startPosition to: anInterpolatedString stopPosition) asString +] + { #category : #visiting } MSEPythonToFamixImporterVisitor >> visitPower: anInvocation [ @@ -691,5 +697,5 @@ MSEPythonToFamixImporterVisitor >> visitString: aStringNode [ { #category : #visiting } MSEPythonToFamixImporterVisitor >> visitStrings: aStringsNode [ - ^ aStringsNode strings collect:[:each| self visitString: each] + ^ aStringsNode strings collect: [:each| self acceptNode: each] ] From 316a7381a56e5eac6ad5ddf6e6b74a2f2269fbcc Mon Sep 17 00:00:00 2001 From: anquetil Date: Thu, 28 Dec 2023 13:09:31 +0100 Subject: [PATCH 03/31] correct bug in #parameterNamed:inMethod:inClass: --- src/MoosePy/MSEPythonToFamixImporterVisitor.class.st | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st index 25af7b3..b7d1117 100644 --- a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st +++ b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st @@ -540,8 +540,11 @@ MSEPythonToFamixImporterVisitor >> parameterNamed: pName inMethod: fName inClass ^ (self model allWithType: FamixPythonParameter) detect: [ :e | - (e name = pName and: [ e parentBehaviouralEntity name = fName and: [ e parentBehaviouralEntity parentType name = cName ]]) - ] + ((e name = pName) and: + [ (e parentBehaviouralEntity name = fName) and: + [ (e parentBehaviouralEntity isMethod) and: + [e parentBehaviouralEntity parentType name = cName] ] ] ) + ] ifNone: [ nil ] ] From b1fd406be94acbae85c52206472d195a2ce61e1d Mon Sep 17 00:00:00 2001 From: anquetil Date: Thu, 28 Dec 2023 13:10:02 +0100 Subject: [PATCH 04/31] refactor #moduleNameStringOf: From e35ccb8b92fba0dc073d6d9c04fb57e75a0d18ec Mon Sep 17 00:00:00 2001 From: anquetil Date: Thu, 28 Dec 2023 13:10:47 +0100 Subject: [PATCH 05/31] refactor #moduleNameStringOf: --- src/MoosePy/MSEPythonToFamixImporterVisitor.class.st | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st index b7d1117..ac0210e 100644 --- a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st +++ b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st @@ -511,12 +511,11 @@ MSEPythonToFamixImporterVisitor >> moduleNameFromFonction: aFunctionNode [ MSEPythonToFamixImporterVisitor >> moduleNameStringOf: aModuleNode [ "should push that to the PyInputFileNode" - ^(aModuleNode isString - ifTrue: [ aModuleNode ] - ifFalse: [ - aModuleNode filename - ifNil: [ 'Main Module' ] - ifNotNil: [ :s | s basenameWithoutExtension ] ] )value + aModuleNode isString ifTrue: [ ^aModuleNode ]. + + aModuleNode filename ifNil: [ ^'Main Module' ]. + + ^aModuleNode filename basenameWithoutExtension ] { #category : #'private - testing' } From 18ba3e45a7412c79e1224d77f25da6b20435c5e9 Mon Sep 17 00:00:00 2001 From: anquetil Date: Thu, 28 Dec 2023 13:12:21 +0100 Subject: [PATCH 06/31] refactor #createModule: into #createModule:named: --- src/MoosePy/MSEPythonToFamixImporterVisitor.class.st | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st index ac0210e..5c57cd9 100644 --- a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st +++ b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st @@ -150,11 +150,11 @@ MSEPythonToFamixImporterVisitor >> createMethod: aMethodNode [ ] { #category : #'private-entity-creation' } -MSEPythonToFamixImporterVisitor >> createModule: aModuleNode [ +MSEPythonToFamixImporterVisitor >> createModule: aModuleNode named: aName [ | module | module := model newModule. - module name: (self moduleNameStringOf: aModuleNode). + module name: aName. ^ self setSourceAnchor: module from: aModuleNode ] @@ -224,8 +224,9 @@ MSEPythonToFamixImporterVisitor >> ensureMethod: aMethodNode [ { #category : #'private-entity-creation' } MSEPythonToFamixImporterVisitor >> ensureModule: aModuleNode [ - ^ (self moduleNamed: (self moduleNameStringOf: aModuleNode)) ifNil: [ - self createModule: aModuleNode ] + | moduleName | + moduleName := self moduleNameStringOf: aModuleNode. + ^ (self moduleNamed: moduleName) ifNil: [ self createModule: aModuleNode named: moduleName ] ] { #category : #'private-entity-creation' } From 6ab2c0a51345d922c2a8304adcca726b15bf68e9 Mon Sep 17 00:00:00 2001 From: anquetil Date: Thu, 28 Dec 2023 13:14:11 +0100 Subject: [PATCH 07/31] making module names relative to a root path (not tested) --- .../MSEPythonToFamixImporterVisitor.class.st | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st index 5c57cd9..99e1026 100644 --- a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st +++ b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st @@ -504,8 +504,12 @@ MSEPythonToFamixImporterVisitor >> model [ { #category : #'private-entity-creation' } MSEPythonToFamixImporterVisitor >> moduleNameFromFonction: aFunctionNode [ - ^((aFunctionNode parent attributes array sixth value - fullName) removePrefix: '/') removeSuffix: '.py'. + | parentFileName | + parentFileName := (self parentFileForNode: aFunctionNode) attributes at: #filename. + + rootFilePath ifNil: [ ^(parentFileName fullName removePrefix: '/') removeSuffix: '.py']. + + ^(parentFileName relativeTo: rootFilePath asPath) pathString removeSuffix: '.py' ] { #category : #'private-entity-creation' } @@ -554,6 +558,26 @@ MSEPythonToFamixImporterVisitor >> parameters [ ^ self model allWithType: FamixPythonParameter ] +{ #category : #'private-entity-creation' } +MSEPythonToFamixImporterVisitor >> parentFileForNode: aPyNode [ + + aPyNode ifNil: [ ^nil ]. + (aPyNode parent isKindOf: PyFileInputNode) ifTrue: [ ^aPyNode parent ]. + ^self parentFileForNode: aPyNode parent +] + +{ #category : #accessing } +MSEPythonToFamixImporterVisitor >> rootFilePath [ + + ^ rootFilePath +] + +{ #category : #accessing } +MSEPythonToFamixImporterVisitor >> rootFilePath: anObject [ + + rootFilePath := anObject +] + { #category : #'accessing - methods' } MSEPythonToFamixImporterVisitor >> sender [ From 8180ec0fd5c9c287286199a0e1318cb29a742550 Mon Sep 17 00:00:00 2001 From: anquetil Date: Thu, 28 Dec 2023 13:14:29 +0100 Subject: [PATCH 08/31] A Python project importer --- src/MoosePy/MSEPythonProjectImporter.class.st | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/MoosePy/MSEPythonProjectImporter.class.st diff --git a/src/MoosePy/MSEPythonProjectImporter.class.st b/src/MoosePy/MSEPythonProjectImporter.class.st new file mode 100644 index 0000000..552182d --- /dev/null +++ b/src/MoosePy/MSEPythonProjectImporter.class.st @@ -0,0 +1,55 @@ +Class { + #name : #MSEPythonProjectImporter, + #superclass : #Object, + #instVars : [ + 'visitor' + ], + #category : #'MoosePy-Importer' +} + +{ #category : #api } +MSEPythonProjectImporter class >> import: aFileName [ + + ^self new + import: aFileName +] + +{ #category : #api } +MSEPythonProjectImporter >> import: aFileName [ + visitor := MSEPythonToFamixImporterVisitor new. + visitor rootFilePath: aFileName. + + self importFileReference: aFileName asFileReference. + + ^visitor model +] + +{ #category : #api } +MSEPythonProjectImporter >> importFileReference: aFileReference [ + + aFileReference isDirectory + ifTrue: [ + aFileReference children do: [ :child | self importFileReference: child ]. + ^self + ]. + + (self isPythonExtension: aFileReference extension) + ifFalse: [ ^self ]. + + self importPythonFile: aFileReference. +] + +{ #category : #api } +MSEPythonProjectImporter >> importPythonFile: aFileReference [ + + 'importing: ' trace. + aFileReference fullName traceCr. + + (PythonParser parseFileWithErrors: aFileReference) acceptVisitor: visitor +] + +{ #category : #testing } +MSEPythonProjectImporter >> isPythonExtension: aString [ + + ^aString = 'py' +] From f4c471189b3a513e0a3b049fd8a6d7d3f7e5a742 Mon Sep 17 00:00:00 2001 From: anquetil Date: Thu, 28 Dec 2023 13:19:52 +0100 Subject: [PATCH 09/31] minor change + class comment --- src/MoosePy/MSEPythonProjectImporter.class.st | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/MoosePy/MSEPythonProjectImporter.class.st b/src/MoosePy/MSEPythonProjectImporter.class.st index 552182d..e59ef09 100644 --- a/src/MoosePy/MSEPythonProjectImporter.class.st +++ b/src/MoosePy/MSEPythonProjectImporter.class.st @@ -1,3 +1,13 @@ +" +An importer for Python projects + +API: +```St +MSEPythonProjectImporter import: 'python/project/root/directory' +``` + +will return a `FamixPythonModel` +" Class { #name : #MSEPythonProjectImporter, #superclass : #Object, @@ -16,10 +26,15 @@ MSEPythonProjectImporter class >> import: aFileName [ { #category : #api } MSEPythonProjectImporter >> import: aFileName [ + + | fileReference | visitor := MSEPythonToFamixImporterVisitor new. visitor rootFilePath: aFileName. - self importFileReference: aFileName asFileReference. + fileReference := aFileName asFileReference. + visitor model name: fileReference basename. + + self importFileReference: fileReference. ^visitor model ] From 338df433c78c47993067e9724c6701929c346acd Mon Sep 17 00:00:00 2001 From: anquetil Date: Thu, 28 Dec 2023 18:42:36 +0100 Subject: [PATCH 10/31] corrected(?) a bug in #createFunction: --- src/MoosePy/MSEPythonToFamixImporterVisitor.class.st | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st index 99e1026..edda932 100644 --- a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st +++ b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st @@ -62,16 +62,14 @@ MSEPythonToFamixImporterVisitor >> createClass: aClass [ { #category : #'private-entity-creation' } MSEPythonToFamixImporterVisitor >> createFunction: aFunctionNode [ - | function signature thisModule thisModuleName | + | function signature thisModule | signature := aFunctionNode parameters ifNotNil: [ aFunctionNode parameters signatureString ]. function := self basicCreateFunction: aFunctionNode fname value withSignature: signature. - thisModuleName := (self moduleNameFromFonction: aFunctionNode) - asSymbol. - thisModule := self ensureModule: thisModuleName. + thisModule := self ensureModule: (self moduleFromFonction: aFunctionNode). function functionOwner: thisModule. @@ -502,6 +500,12 @@ MSEPythonToFamixImporterVisitor >> model [ ] { #category : #'private-entity-creation' } +MSEPythonToFamixImporterVisitor >> moduleFromFonction: aFunctionNode [ + + ^(self parentFileForNode: aFunctionNode) +] + +{ #category : #TOREMOVE } MSEPythonToFamixImporterVisitor >> moduleNameFromFonction: aFunctionNode [ | parentFileName | From 62ddfcad0d4436aece8f01e63f570049465a56f6 Mon Sep 17 00:00:00 2001 From: anquetil Date: Thu, 28 Dec 2023 18:42:52 +0100 Subject: [PATCH 11/31] Non stub on created entities --- src/MoosePy/MSEPythonToFamixImporterVisitor.class.st | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st index edda932..453029e 100644 --- a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st +++ b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st @@ -53,7 +53,6 @@ MSEPythonToFamixImporterVisitor >> createClass: aClass [ name := aClass cname value. class := model newClass. class name: aClass cname value. - class stub: true. ^ self setSourceAnchor: class from: aClass @@ -595,6 +594,9 @@ MSEPythonToFamixImporterVisitor >> setSourceAnchor: aFamixEntity from: aSmaccNod startPos: aSmaccNode startPosition; endPos: aSmaccNode stopPosition; yourself). + + aFamixEntity stub: false. + ^ aFamixEntity ] From c7f647e7eb4a97382b67df596ab7558a4467aafb Mon Sep 17 00:00:00 2001 From: anquetil Date: Thu, 28 Dec 2023 19:37:00 +0100 Subject: [PATCH 12/31] Removing packages too specific (CNN-Famix, DL-Python) --- .../BaselineOfDLPython.class.st | 27 - src/BaselineOfDLPython/package.st | 1 - .../CNNFamixActivation.class.st | 63 -- .../CNNFamixComment.class.st | 16 - .../CNNFamixContainerEntity.class.st | 22 - .../CNNFamixConvolution.class.st | 115 ---- src/CNN-Famix-Entities/CNNFamixDense.class.st | 64 -- .../CNNFamixEntity.class.st | 29 - .../CNNFamixFlatten.class.st | 64 -- .../CNNFamixIndexedFileAnchor.class.st | 16 - src/CNN-Famix-Entities/CNNFamixLayer.class.st | 247 -------- src/CNN-Famix-Entities/CNNFamixModel.class.st | 20 - .../CNNFamixNamedEntity.class.st | 24 - .../CNNFamixPooling.class.st | 63 -- .../CNNFamixProgram.class.st | 62 -- .../CNNFamixRegularization.class.st | 63 -- .../CNNFamixSourceAnchor.class.st | 24 - .../CNNFamixSourceLanguage.class.st | 16 - .../CNNFamixSourceTextAnchor.class.st | 16 - .../CNNFamixSourcedEntity.class.st | 24 - .../CNNFamixTEntityCreator.trait.st | 108 ---- .../CNNFamixUnknownSourceLanguage.class.st | 16 - .../FamixPythonInvocation.extension.st | 169 ------ src/CNN-Famix-Entities/package.st | 1 - .../CNNFamixConvolution.extension.st | 65 --- src/DL-Python/CNNFamixGenerator.class.st | 110 ---- src/DL-Python/CNNFamixLayer.extension.st | 13 - src/DL-Python/CNNPythonDetector.class.st | 360 ------------ .../CNNPythonDetectorFromFileTest.class.st | 48 -- src/DL-Python/CNNPythonDetectorTest.class.st | 546 ------------------ src/DL-Python/CNNPythonImporter.class.st | 333 ----------- src/DL-Python/CNNPythonImporterTest.class.st | 222 ------- src/DL-Python/package.st | 1 - 33 files changed, 2968 deletions(-) delete mode 100644 src/BaselineOfDLPython/BaselineOfDLPython.class.st delete mode 100644 src/BaselineOfDLPython/package.st delete mode 100644 src/CNN-Famix-Entities/CNNFamixActivation.class.st delete mode 100644 src/CNN-Famix-Entities/CNNFamixComment.class.st delete mode 100644 src/CNN-Famix-Entities/CNNFamixContainerEntity.class.st delete mode 100644 src/CNN-Famix-Entities/CNNFamixConvolution.class.st delete mode 100644 src/CNN-Famix-Entities/CNNFamixDense.class.st delete mode 100644 src/CNN-Famix-Entities/CNNFamixEntity.class.st delete mode 100644 src/CNN-Famix-Entities/CNNFamixFlatten.class.st delete mode 100644 src/CNN-Famix-Entities/CNNFamixIndexedFileAnchor.class.st delete mode 100644 src/CNN-Famix-Entities/CNNFamixLayer.class.st delete mode 100644 src/CNN-Famix-Entities/CNNFamixModel.class.st delete mode 100644 src/CNN-Famix-Entities/CNNFamixNamedEntity.class.st delete mode 100644 src/CNN-Famix-Entities/CNNFamixPooling.class.st delete mode 100644 src/CNN-Famix-Entities/CNNFamixProgram.class.st delete mode 100644 src/CNN-Famix-Entities/CNNFamixRegularization.class.st delete mode 100644 src/CNN-Famix-Entities/CNNFamixSourceAnchor.class.st delete mode 100644 src/CNN-Famix-Entities/CNNFamixSourceLanguage.class.st delete mode 100644 src/CNN-Famix-Entities/CNNFamixSourceTextAnchor.class.st delete mode 100644 src/CNN-Famix-Entities/CNNFamixSourcedEntity.class.st delete mode 100644 src/CNN-Famix-Entities/CNNFamixTEntityCreator.trait.st delete mode 100644 src/CNN-Famix-Entities/CNNFamixUnknownSourceLanguage.class.st delete mode 100644 src/CNN-Famix-Entities/FamixPythonInvocation.extension.st delete mode 100644 src/CNN-Famix-Entities/package.st delete mode 100644 src/DL-Python/CNNFamixConvolution.extension.st delete mode 100644 src/DL-Python/CNNFamixGenerator.class.st delete mode 100644 src/DL-Python/CNNFamixLayer.extension.st delete mode 100644 src/DL-Python/CNNPythonDetector.class.st delete mode 100644 src/DL-Python/CNNPythonDetectorFromFileTest.class.st delete mode 100644 src/DL-Python/CNNPythonDetectorTest.class.st delete mode 100644 src/DL-Python/CNNPythonImporter.class.st delete mode 100644 src/DL-Python/CNNPythonImporterTest.class.st delete mode 100644 src/DL-Python/package.st diff --git a/src/BaselineOfDLPython/BaselineOfDLPython.class.st b/src/BaselineOfDLPython/BaselineOfDLPython.class.st deleted file mode 100644 index 1b4fda9..0000000 --- a/src/BaselineOfDLPython/BaselineOfDLPython.class.st +++ /dev/null @@ -1,27 +0,0 @@ -Class { - #name : #BaselineOfDLPython, - #superclass : #BaselineOf, - #category : #BaselineOfDLPython -} - -{ #category : #baselines } -BaselineOfDLPython >> baseline: spec [ - - - spec baseline: 'PythonParser' with: [ - spec - repository: 'github://j-brant/SmaCC'; - loads: #( 'SmaCC_Python' 'SmaCC_Python_Tests' ) ]. - - spec - baseline: 'FamixPythonImporter' - with: [ spec repository: 'github://aurpur/famixPythonImporter' ]. - - spec - package: 'MoosePy'; - package: 'CNN-Famix-Entities'; - package: 'DL-Python' with: [ - spec requires: - #( 'CNN-Famix-Entities' 'PythonParser' 'FamixPythonImporter' - 'MoosePy' ) ] -] diff --git a/src/BaselineOfDLPython/package.st b/src/BaselineOfDLPython/package.st deleted file mode 100644 index e1b7269..0000000 --- a/src/BaselineOfDLPython/package.st +++ /dev/null @@ -1 +0,0 @@ -Package { #name : #BaselineOfDLPython } diff --git a/src/CNN-Famix-Entities/CNNFamixActivation.class.st b/src/CNN-Famix-Entities/CNNFamixActivation.class.st deleted file mode 100644 index 4596011..0000000 --- a/src/CNN-Famix-Entities/CNNFamixActivation.class.st +++ /dev/null @@ -1,63 +0,0 @@ -Class { - #name : #CNNFamixActivation, - #superclass : #CNNFamixEntity, - #instVars : [ - '#layer => FMOne type: #CNNFamixLayer opposite: #activations' - ], - #category : #'CNN-Famix-Entities-Entities' -} - -{ #category : #meta } -CNNFamixActivation class >> annotation [ - - - - - ^ self -] - -{ #category : #accessing } -CNNFamixActivation >> invocation [ - "Relation named: #invocation type: #FamixPythonInvocation opposite: #activation" - - - - ^ self attributeAt: #invocation ifAbsent: [ nil ] -] - -{ #category : #accessing } -CNNFamixActivation >> invocation: anObject [ - - - (self attributeAt: #invocation ifAbsentPut: [nil]) == anObject ifTrue: [ ^ anObject ]. - anObject ifNil: [ | otherSide | - otherSide := self invocation. - self attributeAt: #invocation put: anObject. - otherSide activation: nil ] - ifNotNil: [ - self attributeAt: #invocation put: anObject. - anObject activation: self ] -] - -{ #category : #accessing } -CNNFamixActivation >> layer [ - "Relation named: #layer type: #CNNFamixLayer opposite: #activations" - - - - ^ layer -] - -{ #category : #accessing } -CNNFamixActivation >> layer: anObject [ - - - layer := anObject -] - -{ #category : #navigation } -CNNFamixActivation >> layerGroup [ - - - ^ MooseSpecializedGroup with: self layer -] diff --git a/src/CNN-Famix-Entities/CNNFamixComment.class.st b/src/CNN-Famix-Entities/CNNFamixComment.class.st deleted file mode 100644 index ce80d20..0000000 --- a/src/CNN-Famix-Entities/CNNFamixComment.class.st +++ /dev/null @@ -1,16 +0,0 @@ -Class { - #name : #CNNFamixComment, - #superclass : #CNNFamixSourcedEntity, - #traits : 'FamixTComment', - #classTraits : 'FamixTComment classTrait', - #category : #'CNN-Famix-Entities-Entities' -} - -{ #category : #meta } -CNNFamixComment class >> annotation [ - - - - - ^ self -] diff --git a/src/CNN-Famix-Entities/CNNFamixContainerEntity.class.st b/src/CNN-Famix-Entities/CNNFamixContainerEntity.class.st deleted file mode 100644 index ffd349d..0000000 --- a/src/CNN-Famix-Entities/CNNFamixContainerEntity.class.st +++ /dev/null @@ -1,22 +0,0 @@ -Class { - #name : #CNNFamixContainerEntity, - #superclass : #CNNFamixEntity, - #category : #'CNN-Famix-Entities-Entities' -} - -{ #category : #meta } -CNNFamixContainerEntity class >> annotation [ - - - - - - ^ self -] - -{ #category : #testing } -CNNFamixContainerEntity class >> isAbstract [ - - - ^ self == CNNFamixContainerEntity -] diff --git a/src/CNN-Famix-Entities/CNNFamixConvolution.class.st b/src/CNN-Famix-Entities/CNNFamixConvolution.class.st deleted file mode 100644 index 64a7e82..0000000 --- a/src/CNN-Famix-Entities/CNNFamixConvolution.class.st +++ /dev/null @@ -1,115 +0,0 @@ -Class { - #name : #CNNFamixConvolution, - #superclass : #CNNFamixEntity, - #instVars : [ - '#filters => FMProperty', - '#kernelSize => FMProperty', - '#layer => FMOne type: #CNNFamixLayer opposite: #convolution', - '#useBias => FMProperty', - '#homogeneous', - '#itsHomogeneous', - '#isStartOfBlock' - ], - #category : #'CNN-Famix-Entities-Entities' -} - -{ #category : #meta } -CNNFamixConvolution class >> annotation [ - - - - - ^ self -] - -{ #category : #accessing } -CNNFamixConvolution >> filters [ - - - - > 32'> - ^ filters ifNil: [ filters := true ] -] - -{ #category : #accessing } -CNNFamixConvolution >> filters: anObject [ - - filters := anObject -] - -{ #category : #accessing } -CNNFamixConvolution >> invocation [ - "Relation named: #invocation type: #FamixPythonInvocation opposite: #convolution" - - - - ^ self attributeAt: #invocation ifAbsent: [ nil ] -] - -{ #category : #accessing } -CNNFamixConvolution >> invocation: anObject [ - - - (self attributeAt: #invocation ifAbsentPut: [nil]) == anObject ifTrue: [ ^ anObject ]. - anObject ifNil: [ | otherSide | - otherSide := self invocation. - self attributeAt: #invocation put: anObject. - otherSide convolution: nil ] - ifNotNil: [ - self attributeAt: #invocation put: anObject. - anObject convolution: self ] -] - -{ #category : #accessing } -CNNFamixConvolution >> kernelSize [ - - - - > 3'> - ^ kernelSize -] - -{ #category : #accessing } -CNNFamixConvolution >> kernelSize: anObject [ - - kernelSize := anObject -] - -{ #category : #accessing } -CNNFamixConvolution >> layer [ - "Relation named: #layer type: #CNNFamixLayer opposite: #convolution" - - - - - ^ layer -] - -{ #category : #accessing } -CNNFamixConvolution >> layer: anObject [ - - - layer := anObject -] - -{ #category : #navigation } -CNNFamixConvolution >> layerGroup [ - - - ^ MooseSpecializedGroup with: self layer -] - -{ #category : #accessing } -CNNFamixConvolution >> useBias [ - - - - > [true|false]'> - ^ useBias -] - -{ #category : #accessing } -CNNFamixConvolution >> useBias: anObject [ - - useBias := anObject -] diff --git a/src/CNN-Famix-Entities/CNNFamixDense.class.st b/src/CNN-Famix-Entities/CNNFamixDense.class.st deleted file mode 100644 index 4b99a93..0000000 --- a/src/CNN-Famix-Entities/CNNFamixDense.class.st +++ /dev/null @@ -1,64 +0,0 @@ -Class { - #name : #CNNFamixDense, - #superclass : #CNNFamixEntity, - #instVars : [ - '#layer => FMOne type: #CNNFamixLayer opposite: #dense' - ], - #category : #'CNN-Famix-Entities-Entities' -} - -{ #category : #meta } -CNNFamixDense class >> annotation [ - - - - - ^ self -] - -{ #category : #accessing } -CNNFamixDense >> invocation [ - "Relation named: #invocation type: #FamixPythonInvocation opposite: #dense" - - - - ^ self attributeAt: #invocation ifAbsent: [ nil ] -] - -{ #category : #accessing } -CNNFamixDense >> invocation: anObject [ - - - (self attributeAt: #invocation ifAbsentPut: [nil]) == anObject ifTrue: [ ^ anObject ]. - anObject ifNil: [ | otherSide | - otherSide := self invocation. - self attributeAt: #invocation put: anObject. - otherSide dense: nil ] - ifNotNil: [ - self attributeAt: #invocation put: anObject. - anObject dense: self ] -] - -{ #category : #accessing } -CNNFamixDense >> layer [ - "Relation named: #layer type: #CNNFamixLayer opposite: #dense" - - - - - ^ layer -] - -{ #category : #accessing } -CNNFamixDense >> layer: anObject [ - - - layer := anObject -] - -{ #category : #navigation } -CNNFamixDense >> layerGroup [ - - - ^ MooseSpecializedGroup with: self layer -] diff --git a/src/CNN-Famix-Entities/CNNFamixEntity.class.st b/src/CNN-Famix-Entities/CNNFamixEntity.class.st deleted file mode 100644 index f50bd8b..0000000 --- a/src/CNN-Famix-Entities/CNNFamixEntity.class.st +++ /dev/null @@ -1,29 +0,0 @@ -Class { - #name : #CNNFamixEntity, - #superclass : #MooseEntity, - #category : #'CNN-Famix-Entities-Entities' -} - -{ #category : #meta } -CNNFamixEntity class >> annotation [ - - - - - - ^ self -] - -{ #category : #testing } -CNNFamixEntity class >> isAbstract [ - - - ^ self == CNNFamixEntity -] - -{ #category : #meta } -CNNFamixEntity class >> metamodel [ - - - ^ CNNFamixModel metamodel -] diff --git a/src/CNN-Famix-Entities/CNNFamixFlatten.class.st b/src/CNN-Famix-Entities/CNNFamixFlatten.class.st deleted file mode 100644 index c864e69..0000000 --- a/src/CNN-Famix-Entities/CNNFamixFlatten.class.st +++ /dev/null @@ -1,64 +0,0 @@ -Class { - #name : #CNNFamixFlatten, - #superclass : #CNNFamixEntity, - #instVars : [ - '#layer => FMOne type: #CNNFamixLayer opposite: #flatten' - ], - #category : #'CNN-Famix-Entities-Entities' -} - -{ #category : #meta } -CNNFamixFlatten class >> annotation [ - - - - - ^ self -] - -{ #category : #accessing } -CNNFamixFlatten >> invocation [ - "Relation named: #invocation type: #FamixPythonInvocation opposite: #flatten" - - - - ^ self attributeAt: #invocation ifAbsent: [ nil ] -] - -{ #category : #accessing } -CNNFamixFlatten >> invocation: anObject [ - - - (self attributeAt: #invocation ifAbsentPut: [nil]) == anObject ifTrue: [ ^ anObject ]. - anObject ifNil: [ | otherSide | - otherSide := self invocation. - self attributeAt: #invocation put: anObject. - otherSide flatten: nil ] - ifNotNil: [ - self attributeAt: #invocation put: anObject. - anObject flatten: self ] -] - -{ #category : #accessing } -CNNFamixFlatten >> layer [ - "Relation named: #layer type: #CNNFamixLayer opposite: #flatten" - - - - - ^ layer -] - -{ #category : #accessing } -CNNFamixFlatten >> layer: anObject [ - - - layer := anObject -] - -{ #category : #navigation } -CNNFamixFlatten >> layerGroup [ - - - ^ MooseSpecializedGroup with: self layer -] diff --git a/src/CNN-Famix-Entities/CNNFamixIndexedFileAnchor.class.st b/src/CNN-Famix-Entities/CNNFamixIndexedFileAnchor.class.st deleted file mode 100644 index 0a7f667..0000000 --- a/src/CNN-Famix-Entities/CNNFamixIndexedFileAnchor.class.st +++ /dev/null @@ -1,16 +0,0 @@ -Class { - #name : #CNNFamixIndexedFileAnchor, - #superclass : #CNNFamixSourceAnchor, - #traits : 'FamixTIndexedFileNavigation', - #classTraits : 'FamixTIndexedFileNavigation classTrait', - #category : #'CNN-Famix-Entities-Entities' -} - -{ #category : #meta } -CNNFamixIndexedFileAnchor class >> annotation [ - - - - - ^ self -] diff --git a/src/CNN-Famix-Entities/CNNFamixLayer.class.st b/src/CNN-Famix-Entities/CNNFamixLayer.class.st deleted file mode 100644 index ae14445..0000000 --- a/src/CNN-Famix-Entities/CNNFamixLayer.class.st +++ /dev/null @@ -1,247 +0,0 @@ -Class { - #name : #CNNFamixLayer, - #superclass : #CNNFamixEntity, - #traits : 'FamixTSourceEntity', - #classTraits : 'FamixTSourceEntity classTrait', - #instVars : [ - '#name => FMProperty', - '#convolution => FMOne type: #CNNFamixConvolution opposite: #layer', - '#dense => FMOne type: #CNNFamixDense opposite: #layer', - '#flatten => FMOne type: #CNNFamixFlatten opposite: #layer', - '#activations => FMMany type: #CNNFamixActivation opposite: #layer', - '#poolings => FMMany type: #CNNFamixPooling opposite: #layer', - '#regularizations => FMMany type: #CNNFamixRegularization opposite: #layer', - '#program => FMOne type: #CNNFamixProgram opposite: #layers' - ], - #category : #'CNN-Famix-Entities-Entities' -} - -{ #category : #meta } -CNNFamixLayer class >> annotation [ - - - - - ^ self -] - -{ #category : #accessing } -CNNFamixLayer >> activations [ - "Relation named: #activations type: #CNNFamixActivation opposite: #layer" - - - - ^ activations -] - -{ #category : #accessing } -CNNFamixLayer >> activations: anObject [ - - - activations value: anObject -] - -{ #category : #navigation } -CNNFamixLayer >> activationsGroup [ - - - ^ MooseSpecializedGroup withAll: self activations asSet -] - -{ #category : #adding } -CNNFamixLayer >> addActivation: anObject [ - - ^ self activations add: anObject -] - -{ #category : #adding } -CNNFamixLayer >> addInvocation: anObject [ - - ^ self invocations add: anObject -] - -{ #category : #adding } -CNNFamixLayer >> addPooling: anObject [ - - ^ self poolings add: anObject -] - -{ #category : #adding } -CNNFamixLayer >> addRegularization: anObject [ - - ^ self regularizations add: anObject -] - -{ #category : #accessing } -CNNFamixLayer >> convolution [ - "Relation named: #convolution type: #CNNFamixConvolution opposite: #layer" - - - ^ convolution -] - -{ #category : #accessing } -CNNFamixLayer >> convolution: anObject [ - - - convolution := anObject -] - -{ #category : #navigation } -CNNFamixLayer >> convolutionGroup [ - - - ^ MooseSpecializedGroup with: self convolution -] - -{ #category : #accessing } -CNNFamixLayer >> dense [ - "Relation named: #dense type: #CNNFamixDense opposite: #layer" - - - ^ dense -] - -{ #category : #accessing } -CNNFamixLayer >> dense: anObject [ - - - dense := anObject -] - -{ #category : #navigation } -CNNFamixLayer >> denseGroup [ - - - ^ MooseSpecializedGroup with: self dense -] - -{ #category : #accessing } -CNNFamixLayer >> flatten [ - "Relation named: #flatten type: #CNNFamixFlatten opposite: #layer" - - - ^ flatten -] - -{ #category : #accessing } -CNNFamixLayer >> flatten: anObject [ - - - flatten := anObject -] - -{ #category : #navigation } -CNNFamixLayer >> flattenGroup [ - - - ^ MooseSpecializedGroup with: self flatten -] - -{ #category : #accessing } -CNNFamixLayer >> invocations [ - "Relation named: #invocations type: #FamixPythonInvocation opposite: #layer" - - - - - ^ self attributeAt: #invocations ifAbsentPut: [ FMMultivalueLink on: self opposite: #layer: ] -] - -{ #category : #accessing } -CNNFamixLayer >> invocations: anObject [ - - - self invocations value: anObject -] - -{ #category : #navigation } -CNNFamixLayer >> invocationsGroup [ - - - ^ MooseSpecializedGroup withAll: self invocations asSet -] - -{ #category : #accessing } -CNNFamixLayer >> name [ - - - - > L1'> - ^ name -] - -{ #category : #accessing } -CNNFamixLayer >> name: anObject [ - - name := anObject -] - -{ #category : #accessing } -CNNFamixLayer >> poolings [ - "Relation named: #poolings type: #CNNFamixPooling opposite: #layer" - - - - ^ poolings -] - -{ #category : #accessing } -CNNFamixLayer >> poolings: anObject [ - - - poolings value: anObject -] - -{ #category : #navigation } -CNNFamixLayer >> poolingsGroup [ - - - ^ MooseSpecializedGroup withAll: self poolings asSet -] - -{ #category : #accessing } -CNNFamixLayer >> program [ - "Relation named: #program type: #CNNFamixProgram opposite: #layers" - - - - ^ program -] - -{ #category : #accessing } -CNNFamixLayer >> program: anObject [ - - - program := anObject -] - -{ #category : #navigation } -CNNFamixLayer >> programGroup [ - - - ^ MooseSpecializedGroup with: self program -] - -{ #category : #accessing } -CNNFamixLayer >> regularizations [ - "Relation named: #regularizations type: #CNNFamixRegularization opposite: #layer" - - - - ^ regularizations -] - -{ #category : #accessing } -CNNFamixLayer >> regularizations: anObject [ - - - regularizations value: anObject -] - -{ #category : #navigation } -CNNFamixLayer >> regularizationsGroup [ - - - ^ MooseSpecializedGroup withAll: self regularizations asSet -] diff --git a/src/CNN-Famix-Entities/CNNFamixModel.class.st b/src/CNN-Famix-Entities/CNNFamixModel.class.st deleted file mode 100644 index c7c9fab..0000000 --- a/src/CNN-Famix-Entities/CNNFamixModel.class.st +++ /dev/null @@ -1,20 +0,0 @@ -Class { - #name : #CNNFamixModel, - #superclass : #MooseModel, - #traits : 'CNNFamixTEntityCreator + FamixPythonTEntityCreator', - #classTraits : 'CNNFamixTEntityCreator classTrait + FamixPythonTEntityCreator classTrait', - #category : #'CNN-Famix-Entities-Model' -} - -{ #category : #accessing } -CNNFamixModel class >> allSubmetamodelsPackagesNames [ - - ^ #(#'Moose-Query' #'Famix-Traits' #'Famix-Python-Entities') -] - -{ #category : #meta } -CNNFamixModel class >> annotation [ - - - -] diff --git a/src/CNN-Famix-Entities/CNNFamixNamedEntity.class.st b/src/CNN-Famix-Entities/CNNFamixNamedEntity.class.st deleted file mode 100644 index 574b1ba..0000000 --- a/src/CNN-Famix-Entities/CNNFamixNamedEntity.class.st +++ /dev/null @@ -1,24 +0,0 @@ -Class { - #name : #CNNFamixNamedEntity, - #superclass : #CNNFamixEntity, - #traits : 'FamixTNamedEntity', - #classTraits : 'FamixTNamedEntity classTrait', - #category : #'CNN-Famix-Entities-Entities' -} - -{ #category : #meta } -CNNFamixNamedEntity class >> annotation [ - - - - - - ^ self -] - -{ #category : #testing } -CNNFamixNamedEntity class >> isAbstract [ - - - ^ self == CNNFamixNamedEntity -] diff --git a/src/CNN-Famix-Entities/CNNFamixPooling.class.st b/src/CNN-Famix-Entities/CNNFamixPooling.class.st deleted file mode 100644 index 496cedd..0000000 --- a/src/CNN-Famix-Entities/CNNFamixPooling.class.st +++ /dev/null @@ -1,63 +0,0 @@ -Class { - #name : #CNNFamixPooling, - #superclass : #CNNFamixEntity, - #instVars : [ - '#layer => FMOne type: #CNNFamixLayer opposite: #poolings' - ], - #category : #'CNN-Famix-Entities-Entities' -} - -{ #category : #meta } -CNNFamixPooling class >> annotation [ - - - - - ^ self -] - -{ #category : #accessing } -CNNFamixPooling >> invocation [ - "Relation named: #invocation type: #FamixPythonInvocation opposite: #pooling" - - - - ^ self attributeAt: #invocation ifAbsent: [ nil ] -] - -{ #category : #accessing } -CNNFamixPooling >> invocation: anObject [ - - - (self attributeAt: #invocation ifAbsentPut: [nil]) == anObject ifTrue: [ ^ anObject ]. - anObject ifNil: [ | otherSide | - otherSide := self invocation. - self attributeAt: #invocation put: anObject. - otherSide pooling: nil ] - ifNotNil: [ - self attributeAt: #invocation put: anObject. - anObject pooling: self ] -] - -{ #category : #accessing } -CNNFamixPooling >> layer [ - "Relation named: #layer type: #CNNFamixLayer opposite: #poolings" - - - - ^ layer -] - -{ #category : #accessing } -CNNFamixPooling >> layer: anObject [ - - - layer := anObject -] - -{ #category : #navigation } -CNNFamixPooling >> layerGroup [ - - - ^ MooseSpecializedGroup with: self layer -] diff --git a/src/CNN-Famix-Entities/CNNFamixProgram.class.st b/src/CNN-Famix-Entities/CNNFamixProgram.class.st deleted file mode 100644 index 19d162d..0000000 --- a/src/CNN-Famix-Entities/CNNFamixProgram.class.st +++ /dev/null @@ -1,62 +0,0 @@ -Class { - #name : #CNNFamixProgram, - #superclass : #CNNFamixNamedEntity, - #instVars : [ - '#type => FMProperty', - '#layers => FMMany type: #CNNFamixLayer opposite: #program' - ], - #category : #'CNN-Famix-Entities-Entities' -} - -{ #category : #meta } -CNNFamixProgram class >> annotation [ - - - - - ^ self -] - -{ #category : #adding } -CNNFamixProgram >> addLayer: anObject [ - - ^ self layers add: anObject -] - -{ #category : #accessing } -CNNFamixProgram >> layers [ - "Relation named: #layers type: #CNNFamixLayer opposite: #program" - - - - ^ layers -] - -{ #category : #accessing } -CNNFamixProgram >> layers: anObject [ - - - layers value: anObject -] - -{ #category : #navigation } -CNNFamixProgram >> layersGroup [ - - - ^ MooseSpecializedGroup withAll: self layers asSet -] - -{ #category : #accessing } -CNNFamixProgram >> type [ - - - - - ^ type -] - -{ #category : #accessing } -CNNFamixProgram >> type: anObject [ - - type := anObject -] diff --git a/src/CNN-Famix-Entities/CNNFamixRegularization.class.st b/src/CNN-Famix-Entities/CNNFamixRegularization.class.st deleted file mode 100644 index 1e87a51..0000000 --- a/src/CNN-Famix-Entities/CNNFamixRegularization.class.st +++ /dev/null @@ -1,63 +0,0 @@ -Class { - #name : #CNNFamixRegularization, - #superclass : #CNNFamixEntity, - #instVars : [ - '#layer => FMOne type: #CNNFamixLayer opposite: #regularizations' - ], - #category : #'CNN-Famix-Entities-Entities' -} - -{ #category : #meta } -CNNFamixRegularization class >> annotation [ - - - - - ^ self -] - -{ #category : #accessing } -CNNFamixRegularization >> invocation [ - "Relation named: #invocation type: #FamixPythonInvocation opposite: #regularization" - - - - ^ self attributeAt: #invocation ifAbsent: [ nil ] -] - -{ #category : #accessing } -CNNFamixRegularization >> invocation: anObject [ - - - (self attributeAt: #invocation ifAbsentPut: [nil]) == anObject ifTrue: [ ^ anObject ]. - anObject ifNil: [ | otherSide | - otherSide := self invocation. - self attributeAt: #invocation put: anObject. - otherSide regularization: nil ] - ifNotNil: [ - self attributeAt: #invocation put: anObject. - anObject regularization: self ] -] - -{ #category : #accessing } -CNNFamixRegularization >> layer [ - "Relation named: #layer type: #CNNFamixLayer opposite: #regularizations" - - - - ^ layer -] - -{ #category : #accessing } -CNNFamixRegularization >> layer: anObject [ - - - layer := anObject -] - -{ #category : #navigation } -CNNFamixRegularization >> layerGroup [ - - - ^ MooseSpecializedGroup with: self layer -] diff --git a/src/CNN-Famix-Entities/CNNFamixSourceAnchor.class.st b/src/CNN-Famix-Entities/CNNFamixSourceAnchor.class.st deleted file mode 100644 index 0fefffd..0000000 --- a/src/CNN-Famix-Entities/CNNFamixSourceAnchor.class.st +++ /dev/null @@ -1,24 +0,0 @@ -Class { - #name : #CNNFamixSourceAnchor, - #superclass : #CNNFamixEntity, - #traits : 'FamixTSourceAnchor', - #classTraits : 'FamixTSourceAnchor classTrait', - #category : #'CNN-Famix-Entities-Entities' -} - -{ #category : #meta } -CNNFamixSourceAnchor class >> annotation [ - - - - - - ^ self -] - -{ #category : #testing } -CNNFamixSourceAnchor class >> isAbstract [ - - - ^ self == CNNFamixSourceAnchor -] diff --git a/src/CNN-Famix-Entities/CNNFamixSourceLanguage.class.st b/src/CNN-Famix-Entities/CNNFamixSourceLanguage.class.st deleted file mode 100644 index 000f902..0000000 --- a/src/CNN-Famix-Entities/CNNFamixSourceLanguage.class.st +++ /dev/null @@ -1,16 +0,0 @@ -Class { - #name : #CNNFamixSourceLanguage, - #superclass : #CNNFamixEntity, - #traits : 'FamixTSourceLanguage', - #classTraits : 'FamixTSourceLanguage classTrait', - #category : #'CNN-Famix-Entities-Entities' -} - -{ #category : #meta } -CNNFamixSourceLanguage class >> annotation [ - - - - - ^ self -] diff --git a/src/CNN-Famix-Entities/CNNFamixSourceTextAnchor.class.st b/src/CNN-Famix-Entities/CNNFamixSourceTextAnchor.class.st deleted file mode 100644 index 2e57f72..0000000 --- a/src/CNN-Famix-Entities/CNNFamixSourceTextAnchor.class.st +++ /dev/null @@ -1,16 +0,0 @@ -Class { - #name : #CNNFamixSourceTextAnchor, - #superclass : #CNNFamixSourceAnchor, - #traits : 'FamixTHasImmediateSource', - #classTraits : 'FamixTHasImmediateSource classTrait', - #category : #'CNN-Famix-Entities-Entities' -} - -{ #category : #meta } -CNNFamixSourceTextAnchor class >> annotation [ - - - - - ^ self -] diff --git a/src/CNN-Famix-Entities/CNNFamixSourcedEntity.class.st b/src/CNN-Famix-Entities/CNNFamixSourcedEntity.class.st deleted file mode 100644 index cd2aff6..0000000 --- a/src/CNN-Famix-Entities/CNNFamixSourcedEntity.class.st +++ /dev/null @@ -1,24 +0,0 @@ -Class { - #name : #CNNFamixSourcedEntity, - #superclass : #CNNFamixEntity, - #traits : 'FamixTSourceEntity', - #classTraits : 'FamixTSourceEntity classTrait', - #category : #'CNN-Famix-Entities-Entities' -} - -{ #category : #meta } -CNNFamixSourcedEntity class >> annotation [ - - - - - - ^ self -] - -{ #category : #testing } -CNNFamixSourcedEntity class >> isAbstract [ - - - ^ self == CNNFamixSourcedEntity -] diff --git a/src/CNN-Famix-Entities/CNNFamixTEntityCreator.trait.st b/src/CNN-Famix-Entities/CNNFamixTEntityCreator.trait.st deleted file mode 100644 index 802dcd3..0000000 --- a/src/CNN-Famix-Entities/CNNFamixTEntityCreator.trait.st +++ /dev/null @@ -1,108 +0,0 @@ -" -This trait is used by Famix models. -It provides an API for creating entities and adding them to the model. -" -Trait { - #name : #CNNFamixTEntityCreator, - #category : #'CNN-Famix-Entities-Model' -} - -{ #category : #meta } -CNNFamixTEntityCreator classSide >> annotation [ - - - - - ^ self -] - -{ #category : #'entity creation' } -CNNFamixTEntityCreator >> newActivation [ - - - ^ self add: CNNFamixActivation new -] - -{ #category : #'entity creation' } -CNNFamixTEntityCreator >> newComment [ - - - ^ self add: CNNFamixComment new -] - -{ #category : #'entity creation' } -CNNFamixTEntityCreator >> newConvolution [ - - - ^ self add: CNNFamixConvolution new -] - -{ #category : #'entity creation' } -CNNFamixTEntityCreator >> newDense [ - - - ^ self add: CNNFamixDense new -] - -{ #category : #'entity creation' } -CNNFamixTEntityCreator >> newFlatten [ - - - ^ self add: CNNFamixFlatten new -] - -{ #category : #'entity creation' } -CNNFamixTEntityCreator >> newIndexedFileAnchor [ - - - ^ self add: CNNFamixIndexedFileAnchor new -] - -{ #category : #'entity creation' } -CNNFamixTEntityCreator >> newLayer [ - - - ^ self add: CNNFamixLayer new -] - -{ #category : #'entity creation' } -CNNFamixTEntityCreator >> newPooling [ - - - ^ self add: CNNFamixPooling new -] - -{ #category : #'entity creation' } -CNNFamixTEntityCreator >> newProgram [ - - - ^ self add: CNNFamixProgram new -] - -{ #category : #'entity creation' } -CNNFamixTEntityCreator >> newRegularization [ - - - ^ self add: CNNFamixRegularization new -] - -{ #category : #'entity creation' } -CNNFamixTEntityCreator >> newSourceLanguage [ - - - ^ self add: CNNFamixSourceLanguage new -] - -{ #category : #'entity creation' } -CNNFamixTEntityCreator >> newSourceTextAnchor [ - - - ^ self add: CNNFamixSourceTextAnchor new -] - -{ #category : #'entity creation' } -CNNFamixTEntityCreator >> newUnknownSourceLanguage [ - - - ^ self add: CNNFamixUnknownSourceLanguage new -] diff --git a/src/CNN-Famix-Entities/CNNFamixUnknownSourceLanguage.class.st b/src/CNN-Famix-Entities/CNNFamixUnknownSourceLanguage.class.st deleted file mode 100644 index b506db5..0000000 --- a/src/CNN-Famix-Entities/CNNFamixUnknownSourceLanguage.class.st +++ /dev/null @@ -1,16 +0,0 @@ -Class { - #name : #CNNFamixUnknownSourceLanguage, - #superclass : #CNNFamixSourceLanguage, - #traits : 'FamixTUnknownSourceLanguage', - #classTraits : 'FamixTUnknownSourceLanguage classTrait', - #category : #'CNN-Famix-Entities-Entities' -} - -{ #category : #meta } -CNNFamixUnknownSourceLanguage class >> annotation [ - - - - - ^ self -] diff --git a/src/CNN-Famix-Entities/FamixPythonInvocation.extension.st b/src/CNN-Famix-Entities/FamixPythonInvocation.extension.st deleted file mode 100644 index bf78194..0000000 --- a/src/CNN-Famix-Entities/FamixPythonInvocation.extension.st +++ /dev/null @@ -1,169 +0,0 @@ -Extension { #name : #FamixPythonInvocation } - -{ #category : #'*CNN-Famix-Entities-accessing' } -FamixPythonInvocation >> activation [ - "Relation named: #activation type: #CNNFamixActivation opposite: #invocation" - - - - - - ^ self attributeAt: #activation ifAbsent: [ nil ] -] - -{ #category : #'*CNN-Famix-Entities-accessing' } -FamixPythonInvocation >> activation: anObject [ - - - (self attributeAt: #activation ifAbsentPut: [nil]) == anObject ifTrue: [ ^ anObject ]. - anObject ifNil: [ | otherSide | - otherSide := self activation. - self attributeAt: #activation put: anObject. - otherSide invocation: nil ] - ifNotNil: [ - self attributeAt: #activation put: anObject. - anObject invocation: self ] -] - -{ #category : #'*CNN-Famix-Entities-accessing' } -FamixPythonInvocation >> convolution [ - "Relation named: #convolution type: #CNNFamixConvolution opposite: #invocation" - - - - - - ^ self attributeAt: #convolution ifAbsent: [ nil ] -] - -{ #category : #'*CNN-Famix-Entities-accessing' } -FamixPythonInvocation >> convolution: anObject [ - - - (self attributeAt: #convolution ifAbsentPut: [nil]) == anObject ifTrue: [ ^ anObject ]. - anObject ifNil: [ | otherSide | - otherSide := self convolution. - self attributeAt: #convolution put: anObject. - otherSide invocation: nil ] - ifNotNil: [ - self attributeAt: #convolution put: anObject. - anObject invocation: self ] -] - -{ #category : #'*CNN-Famix-Entities-accessing' } -FamixPythonInvocation >> dense [ - "Relation named: #dense type: #CNNFamixDense opposite: #invocation" - - - - - - ^ self attributeAt: #dense ifAbsent: [ nil ] -] - -{ #category : #'*CNN-Famix-Entities-accessing' } -FamixPythonInvocation >> dense: anObject [ - - - (self attributeAt: #dense ifAbsentPut: [nil]) == anObject ifTrue: [ ^ anObject ]. - anObject ifNil: [ | otherSide | - otherSide := self dense. - self attributeAt: #dense put: anObject. - otherSide invocation: nil ] - ifNotNil: [ - self attributeAt: #dense put: anObject. - anObject invocation: self ] -] - -{ #category : #'*CNN-Famix-Entities-accessing' } -FamixPythonInvocation >> flatten [ - "Relation named: #flatten type: #CNNFamixFlatten opposite: #invocation" - - - - - - ^ self attributeAt: #flatten ifAbsent: [ nil ] -] - -{ #category : #'*CNN-Famix-Entities-accessing' } -FamixPythonInvocation >> flatten: anObject [ - - - (self attributeAt: #flatten ifAbsentPut: [nil]) == anObject ifTrue: [ ^ anObject ]. - anObject ifNil: [ | otherSide | - otherSide := self flatten. - self attributeAt: #flatten put: anObject. - otherSide invocation: nil ] - ifNotNil: [ - self attributeAt: #flatten put: anObject. - anObject invocation: self ] -] - -{ #category : #'*CNN-Famix-Entities-accessing' } -FamixPythonInvocation >> layer [ - "Relation named: #layer type: #CNNFamixLayer opposite: #invocations" - - - - - - ^ self attributeAt: #layer ifAbsent: [ nil ] -] - -{ #category : #'*CNN-Famix-Entities-accessing' } -FamixPythonInvocation >> layer: anObject [ - - - self attributeAt: #layer put: (FMMultivalueLink on: self update: #invocations from: self layer to: anObject). -] - -{ #category : #'*CNN-Famix-Entities-accessing' } -FamixPythonInvocation >> pooling [ - "Relation named: #pooling type: #CNNFamixPooling opposite: #invocation" - - - - - - ^ self attributeAt: #pooling ifAbsent: [ nil ] -] - -{ #category : #'*CNN-Famix-Entities-accessing' } -FamixPythonInvocation >> pooling: anObject [ - - - (self attributeAt: #pooling ifAbsentPut: [nil]) == anObject ifTrue: [ ^ anObject ]. - anObject ifNil: [ | otherSide | - otherSide := self pooling. - self attributeAt: #pooling put: anObject. - otherSide invocation: nil ] - ifNotNil: [ - self attributeAt: #pooling put: anObject. - anObject invocation: self ] -] - -{ #category : #'*CNN-Famix-Entities-accessing' } -FamixPythonInvocation >> regularization [ - "Relation named: #regularization type: #CNNFamixRegularization opposite: #invocation" - - - - - - ^ self attributeAt: #regularization ifAbsent: [ nil ] -] - -{ #category : #'*CNN-Famix-Entities-accessing' } -FamixPythonInvocation >> regularization: anObject [ - - - (self attributeAt: #regularization ifAbsentPut: [nil]) == anObject ifTrue: [ ^ anObject ]. - anObject ifNil: [ | otherSide | - otherSide := self regularization. - self attributeAt: #regularization put: anObject. - otherSide invocation: nil ] - ifNotNil: [ - self attributeAt: #regularization put: anObject. - anObject invocation: self ] -] diff --git a/src/CNN-Famix-Entities/package.st b/src/CNN-Famix-Entities/package.st deleted file mode 100644 index 73c4f2b..0000000 --- a/src/CNN-Famix-Entities/package.st +++ /dev/null @@ -1 +0,0 @@ -Package { #name : #'CNN-Famix-Entities' } diff --git a/src/DL-Python/CNNFamixConvolution.extension.st b/src/DL-Python/CNNFamixConvolution.extension.st deleted file mode 100644 index f47f36e..0000000 --- a/src/DL-Python/CNNFamixConvolution.extension.st +++ /dev/null @@ -1,65 +0,0 @@ -Extension { #name : #CNNFamixConvolution } - -{ #category : #'*DL-Python' } -CNNFamixConvolution >> addHomogeneous: anObject [ - - homogeneous add: anObject -] - -{ #category : #'*DL-Python' } -CNNFamixConvolution >> homogeneous [ - - ^ homogeneous -] - -{ #category : #'*DL-Python' } -CNNFamixConvolution >> homogeneous: anObject [ - - homogeneous := anObject -] - -{ #category : #'*DL-Python' } -CNNFamixConvolution >> initialize [ - - super initialize. - - homogeneous := OrderedCollection new. - -isStartOfBlock := false -] - -{ #category : #'*DL-Python' } -CNNFamixConvolution >> isHomogeneous [ - - ^ homogeneous isNotEmpty -] - -{ #category : #'*DL-Python' } -CNNFamixConvolution >> isHomogeneousTo: aConvolution [ - - ^(self filters = aConvolution filters ) & (self kernelSize = aConvolution kernelSize ) -] - -{ #category : #'*DL-Python' } -CNNFamixConvolution >> isStartOfBlock [ - - ^ isStartOfBlock -] - -{ #category : #'*DL-Python' } -CNNFamixConvolution >> isStartOfBlock: aBoolean [ - - isStartOfBlock := aBoolean -] - -{ #category : #'*DL-Python' } -CNNFamixConvolution >> itsHomogeneous [ - - ^itsHomogeneous -] - -{ #category : #'*DL-Python' } -CNNFamixConvolution >> itsHomogeneous: anObject [ - - itsHomogeneous := anObject -] diff --git a/src/DL-Python/CNNFamixGenerator.class.st b/src/DL-Python/CNNFamixGenerator.class.st deleted file mode 100644 index 886b1a1..0000000 --- a/src/DL-Python/CNNFamixGenerator.class.st +++ /dev/null @@ -1,110 +0,0 @@ -Class { - #name : #CNNFamixGenerator, - #superclass : #FamixBasicInfrastructureGenerator, - #instVars : [ - 'layer', - 'pooling', - 'convolution', - 'activation', - 'regularization', - 'indexedFileAnchor', - 'dense', - 'invocation', - 'flatten', - 'program', - 'containerEntity' - ], - #category : #'DL-Python-Generators' -} - -{ #category : #accessing } -CNNFamixGenerator class >> packageName [ - - ^ #'CNN-Famix-Entities' -] - -{ #category : #accessing } -CNNFamixGenerator class >> prefix [ - - ^ #'CNNFamix' -] - -{ #category : #accessing } -CNNFamixGenerator class >> submetamodels [ - - ^ { FamixPythonGenerator } -] - -{ #category : #definition } -CNNFamixGenerator >> defineClasses [ - - super defineClasses. - - activation := builder newClassNamed: #Activation. - containerEntity := builder newAbstractClassNamed: #ContainerEntity. - convolution := builder newClassNamed: #Convolution. - dense := builder newClassNamed: #Dense. - flatten := builder newClassNamed: #Flatten. - indexedFileAnchor := builder newClassNamed: #IndexedFileAnchor. - invocation := self remoteEntity: #Invocation withPrefix: #FamixPython. - layer := builder newClassNamed: #Layer. - program := builder newClassNamed: #Program. - pooling := builder newClassNamed: #Pooling. - regularization := builder newClassNamed: #Regularization -] - -{ #category : #definition } -CNNFamixGenerator >> defineHierarchy [ - - super defineHierarchy. - - indexedFileAnchor --|> sourceAnchor. - indexedFileAnchor --|> #TIndexedFileNavigation. - - layer --|> #TSourceEntity. - - program --|> namedEntity -] - -{ #category : #definition } -CNNFamixGenerator >> defineProperties [ - - super defineProperties. - (program property: #type type: #String) comment: - 'Sequential or Fonctional model'. - - (layer property: #name type: #String) comment: 'layer name >> L1'. - - (convolution property: #useBias type: #Boolean) comment: - 'layer convolution useBias >> [true|false]'. - - (convolution property: #filters type: #String defaultValue:true ) comment: - 'layer convolution filters >> 32'. - - (convolution property: #kernelSize type: #String) comment: - 'layer convolution kernelSize >> 3' -] - -{ #category : #definition } -CNNFamixGenerator >> defineRelations [ - - super defineRelations. - - activation - invocation. - convolution - invocation. - dense - invocation. - flatten - invocation. - pooling - invocation. - regularization - invocation. - - - layer <>- convolution. - layer <>- dense. - layer <>- flatten. - layer <>-* activation. - layer <>-* invocation. - layer <>-* pooling. - layer <>-* regularization. - - program <>-* layer -] diff --git a/src/DL-Python/CNNFamixLayer.extension.st b/src/DL-Python/CNNFamixLayer.extension.st deleted file mode 100644 index 10eefe4..0000000 --- a/src/DL-Python/CNNFamixLayer.extension.st +++ /dev/null @@ -1,13 +0,0 @@ -Extension { #name : #CNNFamixLayer } - -{ #category : #'*DL-Python' } -CNNFamixLayer >> hasConvolution [ - - ^ convolution isNotNil -] - -{ #category : #'*DL-Python' } -CNNFamixLayer >> hasDownSampling [ - -^ poolings isNotEmpty -] diff --git a/src/DL-Python/CNNPythonDetector.class.st b/src/DL-Python/CNNPythonDetector.class.st deleted file mode 100644 index 89ba748..0000000 --- a/src/DL-Python/CNNPythonDetector.class.st +++ /dev/null @@ -1,360 +0,0 @@ -Class { - #name : #CNNPythonDetector, - #superclass : #Object, - #instVars : [ - 'visitor', - 'allLayers', - 'importerCNN' - ], - #category : #'DL-Python-Detectors' -} - -{ #category : #inspecting } -CNNPythonDetector >> batchNormsInLayer: aLayer [ - - ^ aLayer regularizations select: [ :regularization | - self isBatchNorm: regularization ] -] - -{ #category : #'private - accessing' } -CNNPythonDetector >> convolutions: aModel [ - - | results | - results := OrderedCollection new. - - aModel layers do: [ :layer | - ( layer hasConvolution) ifTrue: [ - results add: layer convolution ] ]. - - ^ results -] - -{ #category : #inspecting } -CNNPythonDetector >> doesLayerContainBatchNorm: aLayer [ - - ^ (self batchNormsInLayer: aLayer) isNotEmpty -] - -{ #category : #inspecting } -CNNPythonDetector >> doesLayerContainConvolution: aLayer [ - - ^ aLayer convolution isNotNil -] - -{ #category : #inspecting } -CNNPythonDetector >> doesLayerContainDropout: aLayer [ - - ^ (self dropoutsInLayer: aLayer ) isNotEmpty -] - -{ #category : #inspecting } -CNNPythonDetector >> doesLayerContainPooling: aLayer [ - - ^ ( aLayer poolings) isNotEmpty -] - -{ #category : #inspecting } -CNNPythonDetector >> dropoutsInLayer: aLayer [ - - ^ (aLayer regularizations select: [ :regularization | - self isDropout: regularization ]) -] - -{ #category : #inspecting } -CNNPythonDetector >> hasBiasWithBatchNormalization: aModel [ - - - ^ (self layersWithBiasWithBatchNormalization: aModel layers) - isNotEmpty. - -] - -{ #category : #inspecting } -CNNPythonDetector >> hasHeterogeneousBlocks: aModel [ - - ^ (self homogeneousBlocks: aModel) size < 2 -] - -{ #category : #inspecting } -CNNPythonDetector >> hasLargeKernelConvolution: aModel [ - - ^ (self layersWithLargeKernelConvolution: aModel layers) - isNotEmpty -] - -{ #category : #inspecting } -CNNPythonDetector >> hasLosingLocalCorrelation: aModel [ - - | localsWindowSize | - localsWindowSize := aModel layers collect: [ :layer | - - layer hasConvolution ifTrue:[ - - layer convolution kernelSize asInteger] - - ]. - - - ^ self isDescending: localsWindowSize -] - -{ #category : #inspecting } -CNNPythonDetector >> hasNoNexpandingFeatureMap: aModel [ - - | nbFeaturesMap | - nbFeaturesMap := aModel layers collect: [ :layer | - layer hasConvolution ifTrue: [ - layer convolution filters asInteger ]]. - - - ^ (self isAscending: nbFeaturesMap) not -] - -{ #category : #inspecting } -CNNPythonDetector >> hasNonDominatingDownSampling: aModel [ - - ^ (self layersWithNonDominatingDownSampling: aModel layers) isNotEmpty -] - -{ #category : #inspecting } -CNNPythonDetector >> hasNonRepresentativeStatisticsEstimation: aModel [ - - ^ (self layersWithNonRepresentativeStatisticsEstimation: aModel layers) - isNotEmpty -] - -{ #category : #inspecting } -CNNPythonDetector >> hasTooMuchDownSampling: aModel [ - - | layersNumber downSamplingNumber | - layersNumber := aModel layers size. - - - downSamplingNumber := aModel layers count: #hasDownSampling. - - - ^ layersNumber / 3 < downSamplingNumber -] - -{ #category : #inspecting } -CNNPythonDetector >> hasUselessDropout: aModel [ - - - ^ (self layersWithUselessDropout: aModel layers) - isNotEmpty. - - - -] - -{ #category : #'private - accessing' } -CNNPythonDetector >> homogeneousBlocks: aModel [ - -"homogeneous block is not a design smell. It help to build design smell Heterogeneous blocks" - | convolutions next | - convolutions := self convolutions: aModel. - - convolutions doWithIndex: [ :convolution :i | - next := true. - - convolutions doWithIndex: [ :nextConvolution :j | - i < j & (convolution isHomogeneousTo: nextConvolution) & next - ifTrue: [ - convolution addHomogeneous: nextConvolution. - nextConvolution itsHomogeneous: convolution. - - convolution itsHomogeneous ifNil: [ - convolution isStartOfBlock: true ] ] - ifFalse: [ i < j ifTrue: [ next := false ] ] ] ]. - - ^ convolutions select: #isStartOfBlock -] - -{ #category : #initialization } -CNNPythonDetector >> initialize [ - - super initialize. - importerCNN := CNNPythonImporter new -] - -{ #category : #'private - accessing' } -CNNPythonDetector >> invocations: aModel [ - - ^ (aModel allWithType: FamixPythonInvocation )asOrderedCollection -] - -{ #category : #helper } -CNNPythonDetector >> isAscending: aCollection [ - - | counter len next res | - counter := 2. - len := aCollection size. - res := true. - - (self isSame: aCollection) ifTrue: [ ^ res not ]. - - aCollection do: [ :current | - counter < len ifTrue: [ - next := aCollection at: counter. - current > next ifTrue: [ ^ res not ]. - counter := counter + 1 ] ]. - - ^ res -] - -{ #category : #helper } -CNNPythonDetector >> isAveragePooling: aPooling [ - - ^ importerCNN isAveragePooling: aPooling invocation -] - -{ #category : #helper } -CNNPythonDetector >> isBatchNorm: aRegularization [ - - ^ importerCNN isBatchnorm: aRegularization invocation -] - -{ #category : #helper } -CNNPythonDetector >> isConvolution: aConvolution [ - -^ importerCNN isConvolution: aConvolution invocation -] - -{ #category : #helper } -CNNPythonDetector >> isDescending: aCollection [ - - (self isSame: aCollection) or: [ - (self isAscending: aCollection) ifTrue: [ ^ false ] ]. - - ^ true -] - -{ #category : #helper } -CNNPythonDetector >> isDropout: aRegularization [ - - ^ importerCNN isDropout: aRegularization invocation -] - -{ #category : #helper } -CNNPythonDetector >> isSame: aCollection [ - - - - - ^ aCollection allSatisfy: [ :each | aCollection first = each ] -] - -{ #category : #inspecting } -CNNPythonDetector >> layerWithBiasWithBatchNormalization: aLayer [ - - | position results convs batchNorms | - convs := OrderedCollection new. - batchNorms := OrderedCollection new. - position := 1. - results := OrderedCollection new. - - - batchNorms := aLayer regularizations select: [ :regularization | - self isBatchNorm: regularization ]. - - - ( aLayer hasConvolution) ifTrue: [ - aLayer convolution useBias & batchNorms isNotEmpty ifTrue: [ - results := batchNorms ] ]. - - ^ results -] - -{ #category : #'private - accessing' } -CNNPythonDetector >> layerWithLargeKernelConvolution: aLayer [ - - ( aLayer hasConvolution) ifTrue: [ - aLayer convolution kernelSize asInteger > 3 ifTrue: [ ^ aLayer ] ]. - ^ nil -] - -{ #category : #inspecting } -CNNPythonDetector >> layerWithNonDominatingDownSampling: aLayer [ - - ^aLayer poolings select: [ :pooling | self isAveragePooling: pooling ]. - -] - -{ #category : #inspecting } -CNNPythonDetector >> layerWithNonRepresentativeStatisticsEstimation: aLayer [ - - | results | - results := OrderedCollection new. - - (self doesLayerContainDropout: aLayer) - & (self doesLayerContainBatchNorm: aLayer) ifTrue: [ - - (self batchNormsInLayer: aLayer) do: [ :batchNorm | - - (self dropoutsInLayer: aLayer) do: [ :dropout | - - batchNorm invocation sourceAnchor startPos - > dropout invocation sourceAnchor startPos ifTrue: [ - results add: batchNorm ] ] ] ]. - - ^ results -] - -{ #category : #inspecting } -CNNPythonDetector >> layerWithUselessDropout: aLayer [ - - - | results | - results := OrderedCollection new. - - (self doesLayerContainDropout: aLayer) - & (self doesLayerContainPooling: aLayer) ifTrue: [ - (self dropoutsInLayer: aLayer) do: [ :dropout | - aLayer poolings do: [ :pooling | - dropout invocation sourceAnchor startPos - < pooling invocation sourceAnchor startPos ifTrue: [ - results add: dropout ] ] ] ]. - - ^ results -] - -{ #category : #inspecting } -CNNPythonDetector >> layersWithBiasWithBatchNormalization: layers [ - - ^ layers select: [ :layer | - (self layerWithBiasWithBatchNormalization: layer) isNotEmpty ] -] - -{ #category : #'private - accessing' } -CNNPythonDetector >> layersWithLargeKernelConvolution: layers [ - - ^ layers select: [ :layer | - (self layerWithLargeKernelConvolution: layer) isNotNil ] -] - -{ #category : #inspecting } -CNNPythonDetector >> layersWithNonDominatingDownSampling: layers [ - - ^ layers select: [ :layer | - (self layerWithNonDominatingDownSampling: layer) isNotEmpty ] -] - -{ #category : #inspecting } -CNNPythonDetector >> layersWithNonRepresentativeStatisticsEstimation: layers [ - - ^ layers select: [ :layer | - (self layerWithNonRepresentativeStatisticsEstimation: layer) isNotEmpty ] -] - -{ #category : #inspecting } -CNNPythonDetector >> layersWithUselessDropout: layers [ - - ^layers select: [ :layer | - (self layerWithUselessDropout: layer) isNotEmpty ] -] - -{ #category : #accessing } -CNNPythonDetector >> visitor [ - - ^ visitor -] diff --git a/src/DL-Python/CNNPythonDetectorFromFileTest.class.st b/src/DL-Python/CNNPythonDetectorFromFileTest.class.st deleted file mode 100644 index 3c9021b..0000000 --- a/src/DL-Python/CNNPythonDetectorFromFileTest.class.st +++ /dev/null @@ -1,48 +0,0 @@ -Class { - #name : #CNNPythonDetectorFromFileTest, - #superclass : #TestCase, - #instVars : [ - 'model', - 'designSmellDetector' - ], - #category : #'DL-Python-Tests' -} - -{ #category : #tests } -CNNPythonDetectorFromFileTest >> createCNNModel: aFamixModel [ - - | cnnImporter | - cnnImporter := CNNPythonImporter new. - ^ cnnImporter createCNNModel: aFamixModel -] - -{ #category : #tests } -CNNPythonDetectorFromFileTest >> createFamixModelFromFile: aPath [ - - | pyFamixVisior | - pyFamixVisior := MSEPythonToFamixImporterVisitor new. - (PythonParser parseWithErrors: (pyFamixVisior getFileContent: aPath)) - acceptVisitor: pyFamixVisior. - ^ pyFamixVisior model -] - -{ #category : #tests } -CNNPythonDetectorFromFileTest >> setUp [ - - designSmellDetector := CNNPythonDetector new -] - -{ #category : #tests } -CNNPythonDetectorFromFileTest >> testParseThenModelingFromFile [ - - | famixModel cnnModel | - famixModel := self createFamixModelFromFile: - '/Users/aurelikama/Documents/Projet/These/parserPythonToJson/sample_design_smell/layers_formation/gh_non_dominating_dow_sampling.py'. - - cnnModel := self createCNNModel: famixModel. - - self - assert: - (designSmellDetector hasBiasWithBatchNormalization: cnnModel) - equals: true -] diff --git a/src/DL-Python/CNNPythonDetectorTest.class.st b/src/DL-Python/CNNPythonDetectorTest.class.st deleted file mode 100644 index 4422c54..0000000 --- a/src/DL-Python/CNNPythonDetectorTest.class.st +++ /dev/null @@ -1,546 +0,0 @@ -Class { - #name : #CNNPythonDetectorTest, - #superclass : #TestCase, - #instVars : [ - 'model', - 'designSmellDetector' - ], - #category : #'DL-Python-Tests' -} - -{ #category : #accessing } -CNNPythonDetectorTest >> createCNNModel: aFamixModel [ - - | cnnImporter | - cnnImporter := CNNPythonImporter new. - ^ cnnImporter createCNNModel: aFamixModel -] - -{ #category : #accessing } -CNNPythonDetectorTest >> createFamixModel: aPythonCode [ - - | pyFamixVisior | - pyFamixVisior := MSEPythonToFamixImporterVisitor new. - (PythonParser parseWithErrors: aPythonCode) acceptVisitor: - pyFamixVisior. - ^ pyFamixVisior model. -] - -{ #category : #tests } -CNNPythonDetectorTest >> setUp [ - - - - designSmellDetector := CNNPythonDetector new -] - -{ #category : #tests } -CNNPythonDetectorTest >> testHasBiasWithBatchNormalization [ - - | famixModel cnnModel | - famixModel := self createFamixModel: ' -model.add(Conv2D(32, (5, 5), input_shape=input_shape, padding=''same'', use_bias=''false'')) -model.add(BatchNormalization()) -model.add(Activation(''relu'')) - -model.add(Conv2D(32, (3, 3))) #<-- Design Smell: use_bias default value is true -model.add(BatchNormalization()) #<-- Design Smell: use BatchNorn when use_bias=true -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2))) -model.add(Dropout(0.2)) - -model.add(Conv2D(64, (3, 3), padding=''same'')) -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2))) -model.add(Dropout(0.2)) -'. - - cnnModel := self createCNNModel: famixModel. - - self - assert: - (designSmellDetector hasBiasWithBatchNormalization: cnnModel) - equals: true -] - -{ #category : #tests } -CNNPythonDetectorTest >> testHasHeterogeneousBlocks [ - - | famixModel cnnModel | - famixModel := self createFamixModel: ' -model.add(Conv2D(32, (5, 5))) -model.add(Activation(''relu'')) - -#<-- Design smell : only one block homogeneous. should favor blocks have 2, 3, or even 4 homogeneous blocks - -model.add(Conv2D(32, (3, 3))) #<-- Start block homogeneous 1 -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2))) - -model.add(Conv2D(32, (3, 3))) #<-- block homogeneous 1 -model.add(MaxPooling2D(pool_size=(2, 2))) - -model.add(Conv2D(32, (3, 3))) #<-- block homogeneous 1 -model.add(MaxPooling2D(pool_size=(2, 2))) - -'. - - cnnModel := self createCNNModel: famixModel. - - self - assert: (designSmellDetector hasHeterogeneousBlocks: cnnModel) - equals: true -] - -{ #category : #tests } -CNNPythonDetectorTest >> testHasLargeKernelConvolution [ - - | famixModel cnnModelLayers cnnModel | - famixModel := self createFamixModel: ' -model.add(Conv2D(32, (5, 5))) #<-- Design Smell: large kernel_size (5x5). Ccan be replaced by two 3 × 3, or four 2 × 2 kernels. -model.add(Activation(''relu'')) - -model.add(Conv2D(32, (3, 3))) -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2))) - -model.add(Conv2D(32, (3, 3))) -model.add(MaxPooling2D(pool_size=(2, 2))) - -model.add(Conv2D(32, (3, 3))) -model.add(MaxPooling2D(pool_size=(2, 2))) -'. - - cnnModel := self createCNNModel: famixModel. - - cnnModelLayers := cnnModel layers. - - - self - assert: (designSmellDetector hasLargeKernelConvolution: cnnModel) - equals: true. -] - -{ #category : #tests } -CNNPythonDetectorTest >> testHasLosingLocalCorrelation [ - - | famixModel cnnModel | - famixModel := self createFamixModel: ' -model.add(Conv2D(256, (7, 7), input_shape=X.shape[1:], padding=''same'')) -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2), strides=2)) -model.add(Dropout(0.2)) - -model.add(Conv2D(222, (3, 3), padding=''same'')) -model.add(Dropout(0.2)) -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2), strides=2)) - -model.add(Conv2D(256, (3, 3), padding=''same'')) -model.add(Dropout(0.25)) -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2), strides=2)) - -model.add(Conv2D(256, (3, 3), padding=''same'')) -'. - - - - cnnModel := self createCNNModel: famixModel. - - - self - assert: (designSmellDetector hasLosingLocalCorrelation: cnnModel) - equals: true -] - -{ #category : #tests } -CNNPythonDetectorTest >> testHasNoNexpandingFeatureMap [ - - | famixModel cnnModel | - famixModel := self createFamixModel: ' -model.add(Conv2D(256, (3, 3), input_shape=X.shape[1:], padding=''same'')) -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2), strides=2)) -model.add(Dropout(0.2)) - -model.add(Conv2D(222, (3, 3), padding=''same'')) -model.add(Dropout(0.2)) -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2), strides=2)) - -model.add(Conv2D(256, (3, 3), padding=''same'')) -model.add(Dropout(0.25)) -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2), strides=2)) - -model.add(Conv2D(256, (3, 3), padding=''same'')) -'. - - cnnModel := self createCNNModel: famixModel. - - - self - assert: (designSmellDetector hasNoNexpandingFeatureMap: cnnModel) - equals: true - -] - -{ #category : #tests } -CNNPythonDetectorTest >> testHasNonDominatingDownSampling [ - - | famixModel cnnModel | - famixModel := self createFamixModel: ' -conv9 = Convolution2D(nb_classes, 1, padding=''valid'') -relu9 = Activation(''relu'') - -gap = AveragePooling2D(pool_size=(7,7)) #<-- Design Smell -flt = Flatten() -sftm = Activation(''softmax'') -'. - - cnnModel := self createCNNModel: famixModel. - - - self - assert: (designSmellDetector hasNonDominatingDownSampling: cnnModel) - equals: true -] - -{ #category : #tests } -CNNPythonDetectorTest >> testHasNonRepresentativeStatisticsEstimation [ - - | famixModel cnnModel | - famixModel := self createFamixModel: ' -model.add(Conv2D(32, (5, 5))) -model.add(Dropout(0.2)) -model.add(Activation(''relu'')) -model.add(BatchNormalization()) - -model.add(Conv2D(32, (3, 3))) -model.add(MaxPooling2D(pool_size=(2, 2))) -model.add(Dropout(0.2)) -model.add(BatchNormalization()) -model.add(Activation(''relu'')) - -'. - - - cnnModel := self createCNNModel: famixModel. - - - self - assert: (designSmellDetector hasNonRepresentativeStatisticsEstimation: cnnModel) - equals: true -] - -{ #category : #tests } -CNNPythonDetectorTest >> testHasTooMuchDownSampling [ - - | famixModel cnnModel | - famixModel := self createFamixModel: ' -model.add(Conv2D(256, (3, 3), input_shape=X.shape[1:], padding=''same'')) -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2), strides=2)) -model.add(Dropout(0.2)) - -model.add(Conv2D(222, (3, 3), padding=''same'')) -model.add(Dropout(0.2)) -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2), strides=2)) - -model.add(Conv2D(256, (3, 3), padding=''same'')) -model.add(Dropout(0.25)) -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2), strides=2)) - -model.add(Conv2D(256, (3, 3), padding=''same'')) -model.add(MaxPooling2D(pool_size=(2, 2), strides=2)) - -'. - - cnnModel := self createCNNModel: famixModel. - - - - self - assert: (designSmellDetector hasTooMuchDownSampling: cnnModel) - equals: true -] - -{ #category : #tests } -CNNPythonDetectorTest >> testHasUselessDropout [ - - | famixModel cnnModel | - famixModel := self createFamixModel: ' -model.add(Conv2D(256, (3, 3), input_shape=X.shape[1:], padding=''same'')) -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2), strides=2)) -model.add(Dropout(0.2)) - -model.add(Conv2D(222, (3, 3), padding=''same'')) -model.add(Dropout(0.2)) #<-- Design Smell: Dropout used before down-sampling -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2), strides=2)) - -model.add(Conv2D(256, (3, 3), padding=''same'')) -model.add(Dropout(0.25)) #<-- Design Smell: Dropout used before down-sampling -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2), strides=2)) - -model.add(Conv2D(256, (3, 3), padding=''same'')) -model.add(MaxPooling2D(pool_size=(2, 2), strides=2)) -'. - - cnnModel := self createCNNModel: famixModel. - - - self - assert: (designSmellDetector hasUselessDropout: cnnModel) - equals: true -] - -{ #category : #tests } -CNNPythonDetectorTest >> testHomogeneousBlocks [ - - | famixModel cnnModel | - famixModel := self createFamixModel: ' -model.add(Conv2D(32, (5, 5))) -model.add(Activation(''relu'')) - -model.add(Conv2D(32, (3, 3))) #<-- Start block homogeneous 1 -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2))) - -model.add(Conv2D(32, (3, 3))) -model.add(MaxPooling2D(pool_size=(2, 2))) - -model.add(Conv2D(32, (3, 3))) -model.add(MaxPooling2D(pool_size=(2, 2))) - - -model.add(Conv2D(32, (5, 5))) -model.add(Activation(''relu'')) - -model.add(Conv2D(32, (3, 3))) #<-- Start block homogeneous 2 -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2))) - -model.add(Conv2D(32, (3, 3))) -model.add(MaxPooling2D(pool_size=(2, 2))) - -model.add(Conv2D(32, (3, 3))) -model.add(MaxPooling2D(pool_size=(2, 2))) - -'. - - cnnModel := self createCNNModel: famixModel. - - - self - assert: (designSmellDetector homogeneousBlocks: cnnModel) size - equals: 2 -] - -{ #category : #tests } -CNNPythonDetectorTest >> testLayersWithBiasWithBatchNormalization [ - - | famixModel cnnModelLayers | - famixModel := self createFamixModel: ' -model.add(Conv2D(32, (5, 5), input_shape=input_shape, padding=''same'', use_bias=''false'')) -model.add(BatchNormalization()) -model.add(Activation(''relu'')) - -model.add(Conv2D(32, (3, 3))) #<-- Design Smell: use_bias default value is true -model.add(BatchNormalization()) #<-- Design Smell: use BatchNorm when use_bias=true -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2))) -model.add(Dropout(0.2)) - -model.add(Conv2D(64, (3, 3), padding=''same'')) -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2))) -model.add(Dropout(0.2)) -'. - -cnnModelLayers := (self createCNNModel: famixModel) layers. - - - self - assert: (designSmellDetector layersWithBiasWithBatchNormalization: - cnnModelLayers ) size - equals: 1. - self - assert: (designSmellDetector layersWithBiasWithBatchNormalization: - cnnModelLayers ) first name - equals: 'L2' -] - -{ #category : #tests } -CNNPythonDetectorTest >> testLayersWithLargeKernelConvolution [ - - | famixModel cnnModelLayers | - famixModel := self createFamixModel: ' -model.add(Conv2D(32, (5, 5))) #<-- Design Smell: large kernel_size (5x5). Ccan be replaced by two 3 × 3, or four 2 × 2 kernels. -model.add(Activation(''relu'')) - -model.add(Conv2D(32, (3, 3))) -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2))) - -model.add(Conv2D(32, (3, 3))) -model.add(MaxPooling2D(pool_size=(2, 2))) - -model.add(Conv2D(32, (3, 3))) -model.add(MaxPooling2D(pool_size=(2, 2))) -'. - - cnnModelLayers := (self createCNNModel: famixModel) layers. - - - self - assert: - (designSmellDetector layersWithLargeKernelConvolution: - cnnModelLayers) size - equals: 1. - - self - assert: - (designSmellDetector layersWithLargeKernelConvolution: - cnnModelLayers) first name - equals: 'L1' -] - -{ #category : #tests } -CNNPythonDetectorTest >> testLayersWithNonDominatingDownSampling [ - - | famixModel cnnModelLayers | - famixModel := self createFamixModel: ' -conv8 = Convolution2D(nb_classes, 1, padding=''valid'') -relu8 = Activation(''relu'') - -gap = AveragePooling2D(pool_size=(7,7)) #<-- Design Smell 1 - - -conv9 = Convolution2D(nb_classes, 1) -relu9 = Activation(''relu'') -gap = AveragePooling2D(pool_size=(7,7)) #<-- Design Smell 2 - -flt = Flatten() -sftm = Activation(''softmax'') -'. - - cnnModelLayers := (self createCNNModel: famixModel) layers. - - - self - assert: (designSmellDetector layersWithNonDominatingDownSampling: - cnnModelLayers ) size - equals: 2. - - self - assert: (designSmellDetector layersWithNonDominatingDownSampling: - cnnModelLayers ) first name - equals: 'L1' -] - -{ #category : #tests } -CNNPythonDetectorTest >> testLayersWithNonRepresentativeStatisticsEstimation [ - - | famixModel cnnModelLayers | - famixModel := self createFamixModel: ' -model.add(Conv2D(32, (5, 5))) -model.add(Dropout(0.2)) -model.add(Activation(''relu'')) -model.add(BatchNormalization()) #<-- Design Smell:BatchNorm used after dropout - -model.add(Conv2D(32, (3, 3))) -model.add(MaxPooling2D(pool_size=(2, 2))) -model.add(Dropout(0.2)) -model.add(BatchNormalization()) #<-- Design Smell:BatchNorm used after dropout -model.add(Activation(''relu'')) - -'. - - cnnModelLayers := (self createCNNModel: famixModel) layers. - - - self - assert: - (designSmellDetector - layersWithNonRepresentativeStatisticsEstimation: cnnModelLayers) - size - equals: 2. - - self - assert: - (designSmellDetector - layersWithNonRepresentativeStatisticsEstimation: cnnModelLayers) - first name - equals: 'L1'. - - self - assert: - (designSmellDetector - layersWithNonRepresentativeStatisticsEstimation: cnnModelLayers) - first sourceAnchor startPos - equals: 12 -] - -{ #category : #tests } -CNNPythonDetectorTest >> testLayersWithUselessDropout [ - - | cnnModelLayers famixModel | - famixModel := self createFamixModel: ' -model.add(Conv2D(256, (3, 3), input_shape=X.shape[1:], padding=''same'')) -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2), strides=2)) -model.add(Dropout(0.2)) - -model.add(Conv2D(222, (3, 3), padding=''same'')) -model.add(Dropout(0.2)) #<-- Design Smell: Dropout used before down-sampling -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2), strides=2)) - -model.add(Conv2D(256, (3, 3), padding=''same'')) -model.add(Dropout(0.25)) #<-- Design Smell: Dropout used before down-sampling -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2), strides=2)) - -model.add(Conv2D(256, (3, 3), padding=''same'')) -model.add(MaxPooling2D(pool_size=(2, 2), strides=2)) - -model.add(Conv2D(256, (3, 3), padding=''same'')) - -model.add(Flatten()) - - -'. - - - cnnModelLayers := (self createCNNModel: famixModel) layers. - - - self - assert: - (designSmellDetector layersWithUselessDropout: cnnModelLayers) size - equals: 2. - - self - assert: - (designSmellDetector layersWithUselessDropout: cnnModelLayers) - second name - equals: 'L3'. - - self - assert: - (designSmellDetector layersWithUselessDropout: cnnModelLayers) - first sourceAnchor startPos - equals: 192. - - self - assert: - (designSmellDetector layersWithUselessDropout: cnnModelLayers) - first sourceAnchor endPos - equals: 390. -] diff --git a/src/DL-Python/CNNPythonImporter.class.st b/src/DL-Python/CNNPythonImporter.class.st deleted file mode 100644 index 8d01a7e..0000000 --- a/src/DL-Python/CNNPythonImporter.class.st +++ /dev/null @@ -1,333 +0,0 @@ -Class { - #name : #CNNPythonImporter, - #superclass : #MSEPythonToFamixImporterVisitor, - #instVars : [ - 'invocations', - 'homogenous', - 'allLayers', - 'visitor', - 'famixModel', - 'program', - 'layerNum' - ], - #category : #'DL-Python-Importers' -} - -{ #category : #helper } -CNNPythonImporter >> addSourceAnchor: aLayer [ - - | sortedLayerInvocations | - sortedLayerInvocations := self sortedBySourceAnchor: - aLayer invocations. - - - aLayer sourceAnchor: (CNNFamixIndexedFileAnchor new - startPos: sortedLayerInvocations first sourceAnchor startPos; - endPos: sortedLayerInvocations last sourceAnchor endPos; - yourself). - -] - -{ #category : #model } -CNNPythonImporter >> createCNNModel: aFamixModel [ - - program name: (self moduleName: aFamixModel). - - self createLayers: (self invocations: aFamixModel) -] - -{ #category : #'entity creation' } -CNNPythonImporter >> createLayer: invocation [ - - | aLayer conv args ks | - aLayer := model newLayer. - - (self isConvolution: invocation) - ifTrue: [ - conv := model newConvolution. - args := self getArguments: invocation. - aLayer convolution: (conv invocation: invocation). - conv useBias: (self getInvocationArgumentUseBias: invocation). - - args ifNotNil: [ - conv filters: (self getArgumentValue: args first). - - ks := self getArgumentValue: args second. - - ks isString - ifFalse: [ conv kernelSize: ks first ] - ifTrue: [ conv kernelSize: ks ] ] ] - ifFalse: [ - (self isDense: invocation) - ifTrue: [ aLayer dense: (model newDense invocation: invocation) ] - ifFalse: [ - (self isFlatten: invocation) - ifTrue: [ - aLayer flatten: (model newFlatten invocation: invocation) ] - ifFalse: [ ^ nil ] ] ]. - aLayer name: 'L' , layerNum asString. - layerNum := layerNum + 1. - aLayer addInvocation: invocation. - ^ aLayer -] - -{ #category : #'entity creation' } -CNNPythonImporter >> createLayers: invocationCollection [ - - | currentLayer type | - currentLayer := nil. - type := 'functional'. - - - invocationCollection do: [ :invoc | - (self isNewLayer: invoc) - ifTrue: [ - currentLayer := self createLayer: invoc. - program addLayer: currentLayer ] - ifFalse: [ - self extractSpecificFunctionFrom: invoc to: currentLayer ]. - - (self isSequential: invoc) ifTrue: [ type := 'Sequential' ]. - program type: type ]. - - - self layers do: [ :aLayer | self addSourceAnchor: aLayer ] -] - -{ #category : #'entity creation' } -CNNPythonImporter >> extractSpecificFunctionFrom: anInvocation to: aCurrentLayer [ - - aCurrentLayer ifNotNil: [ - (self isActivation: anInvocation) - ifTrue: [ - aCurrentLayer addActivation: - (model newActivation invocation: anInvocation). - aCurrentLayer addInvocation: anInvocation ] - ifFalse: [ - (self isPooling: anInvocation) - ifTrue: [ - aCurrentLayer addPooling: - (model newPooling invocation: anInvocation). - aCurrentLayer addInvocation: anInvocation ] - ifFalse: [ - (self isRegularization: anInvocation) ifTrue: [ - aCurrentLayer addRegularization: - (model newRegularization invocation: anInvocation). - aCurrentLayer addInvocation: anInvocation ] ] ] ] -] - -{ #category : #helper } -CNNPythonImporter >> getArgument: arguments byLabel: aLabel [ - - ^ arguments - detect: [ :argument | (self getArgumentLabel: argument) = aLabel ] - ifFound: [ :argument | argument ] - ifNone: [ nil ] -] - -{ #category : #'entity creation' } -CNNPythonImporter >> getArgumentBooleanValue: anInvocation byLabel: aLabel withDefaultValue: aDefaultValue [ - - - - (self getArgument: (self getArguments: anInvocation) byLabel: aLabel) - ifNotNil: [ :arg | - ^ self stringToBoolean: (self getArgumentValue: arg) ]. - ^ aDefaultValue -] - -{ #category : #helper } -CNNPythonImporter >> getArgumentLabel: anArgument [ - - ^anArgument at: 'label' ifAbsent: [ '' ] -] - -{ #category : #helper } -CNNPythonImporter >> getArgumentValue: anArgument [ - - ^ anArgument at: 'value' ifAbsent: [ '' ] -] - -{ #category : #helper } -CNNPythonImporter >> getArguments: anInvocation [ - - ^ anInvocation cacheAt: 'args' ifAbsent: [ nil ] -] - -{ #category : #helper } -CNNPythonImporter >> getCandidateName: anInvocation [ - - ^ anInvocation cacheAt: 'canditate' ifAbsent: [ nil ] -] - -{ #category : #'entity creation' } -CNNPythonImporter >> getInvocationArgumentUseBias: anInvocation [ - - - ^ self - getArgumentBooleanValue: anInvocation - byLabel: 'use_bias' - withDefaultValue: true. -] - -{ #category : #initialization } -CNNPythonImporter >> initialize [ - - super initialize. - - model := CNNFamixModel new name: 'default cnn model'. - program := model newProgram. - layerNum := 1 -] - -{ #category : #'accessing - classes' } -CNNPythonImporter >> invocations: aModel [ - - ^ self sortedBySourceAnchor:(aModel allWithType: FamixPythonInvocation) asOrderedCollection -] - -{ #category : #checking } -CNNPythonImporter >> isActivation: anInvocation [ - - ^ ('*activation' match: (self getCandidateName: anInvocation)) or: [ - ('*relu' match: (self getCandidateName: anInvocation)) or: [ - ('*sigmoid' match: (self getCandidateName: anInvocation)) or: [ - ('*tanh' match: (self getCandidateName: anInvocation)) or: [ - ('*leakyrelU' match: (self getCandidateName: anInvocation)) - or: [ - ('*exponential' match: (self getCandidateName: anInvocation)) - or: [ - ('*elu' match: (self getCandidateName: anInvocation)) - or: [ - '*soft*' match: (self getCandidateName: anInvocation) ] ] ] ] ] ] ] -] - -{ #category : #checking } -CNNPythonImporter >> isAveragePooling: anInvocation [ - - ^ ('*avgpool*' match: (self getCandidateName: anInvocation)) or:[('*averagepool*' match: (self getCandidateName: anInvocation))] -] - -{ #category : #checking } -CNNPythonImporter >> isBatchnorm: anInvocation [ - - ^ ('*batchnorm*' match: (self getCandidateName: anInvocation)) or:[ - ('*batch_norm*' match: (self getCandidateName: anInvocation))] -] - -{ #category : #checking } -CNNPythonImporter >> isConvolution: anInvocation [ - - ^ '*conv*' match: (self getCandidateName: anInvocation) -] - -{ #category : #checking } -CNNPythonImporter >> isDense: anInvocation [ - - ^ ('*dense' match: (self getCandidateName: anInvocation)) or: [ - '*linear' match: (self getCandidateName: anInvocation) ] -] - -{ #category : #checking } -CNNPythonImporter >> isDropout: anInvocation [ - - ^ '*dropout' match: (self getCandidateName: anInvocation) -] - -{ #category : #checking } -CNNPythonImporter >> isFlatten: anInvocation [ - - ^ '*flatten' match: (self getCandidateName: anInvocation) -] - -{ #category : #checking } -CNNPythonImporter >> isGlobalPooling: anInvocation [ - - ^ '*global*pool*' match: (self getCandidateName: anInvocation) -] - -{ #category : #checking } -CNNPythonImporter >> isMaxPooling: anInvocation [ - - ^ '*maxpool*' match: (self getCandidateName: anInvocation) -] - -{ #category : #checking } -CNNPythonImporter >> isNewLayer: anInvocation [ - - ^ (self isConvolution: anInvocation) - or: [ (self isDense: anInvocation) - or: [self isFlatten: anInvocation]] -] - -{ #category : #checking } -CNNPythonImporter >> isOptimizer: anInvocation [ - - ^ ('*ada' match: (self getCandidateName: anInvocation)) or: [ - ('*sgd' match: (self getCandidateName: anInvocation)) or: [ - ('*adam*' match: (self getCandidateName: anInvocation)) or: [ - ('*prop' match: (self getCandidateName: anInvocation)) or: [ - ('*lbfgs' match: (self getCandidateName: anInvocation)) or: [ - '*ftrl' match: (self getCandidateName: anInvocation) ] ] ] ] ] -] - -{ #category : #checking } -CNNPythonImporter >> isPooling: anInvocation [ - - ^ '*pool*' match: (self getCandidateName: anInvocation) -] - -{ #category : #checking } -CNNPythonImporter >> isRegularization: anInvocation [ - - ^ (self isDropout: anInvocation) | (self isBatchnorm: anInvocation) -] - -{ #category : #checking } -CNNPythonImporter >> isSequential: anInvocation [ - - ^ '*sequential*' match: (self getCandidateName: anInvocation) -] - -{ #category : #'accessing - classes' } -CNNPythonImporter >> layers [ - - ^ ( model allWithType: CNNFamixLayer) asOrderedCollection -] - -{ #category : #'accessing - classes' } -CNNPythonImporter >> model [ - - ^ model -] - -{ #category : #'accessing - classes' } -CNNPythonImporter >> moduleName: aModel [ - - ^ - (aModel allWithType: FamixPythonModule) first name -] - -{ #category : #'accessing - classes' } -CNNPythonImporter >> program [ - - ^ program -] - -{ #category : #helper } -CNNPythonImporter >> sortedBySourceAnchor: aCollection [ - - ^ aCollection - sorted: [ :a :b | - a sourceAnchor startPos < b sourceAnchor startPos ] -] - -{ #category : #'entity creation' } -CNNPythonImporter >> stringToBoolean: aString [ - - aString asLowercase = 'true' - ifTrue: [ ^true ] . - aString asLowercase = 'false' - ifTrue: [ ^false ] . - -] diff --git a/src/DL-Python/CNNPythonImporterTest.class.st b/src/DL-Python/CNNPythonImporterTest.class.st deleted file mode 100644 index bcb25cc..0000000 --- a/src/DL-Python/CNNPythonImporterTest.class.st +++ /dev/null @@ -1,222 +0,0 @@ -Class { - #name : #CNNPythonImporterTest, - #superclass : #TestCase, - #instVars : [ - 'model', - 'detector', - 'cnnImporter' - ], - #category : #'DL-Python-Tests' -} - -{ #category : #running } -CNNPythonImporterTest >> createFamixModel: pythonCode [ - - | pyFamixVisior | - pyFamixVisior := MSEPythonToFamixImporterVisitor new. - (PythonParser parseWithErrors: pythonCode) acceptVisitor: pyFamixVisior. - ^pyFamixVisior model. - -] - -{ #category : #running } -CNNPythonImporterTest >> setUp [ - - cnnImporter := CNNPythonImporter new -] - -{ #category : #tests } -CNNPythonImporterTest >> testLayerHasActivation [ - - | famixModel cnnModel layers | - famixModel := self createFamixModel: ' -model.add(Conv2D(32, (5, 5))) -model.add(Activation(''relu'')) -'. - - cnnModel := cnnImporter createCNNModel: famixModel. - - layers := cnnModel layers. - - self assert: layers first activations size equals: 1. - - self - assert: layers first activations first class - equals: CNNFamixActivation. - - self - assert: layers first activations first invocation class - equals: FamixPythonInvocation -] - -{ #category : #tests } -CNNPythonImporterTest >> testLayerHasBatchNormRegularization [ - - | famixModel cnnModel layers | - famixModel := self createFamixModel: ' -conv6 = Convolution2D(192, 3, strides=(2,2), padding=''valid'') -bn2 = BatchNormalization() -relu6 = Activation(''relu'') -'. - - cnnModel := cnnImporter createCNNModel: famixModel. - - layers := cnnModel layers. - - self assert: layers first regularizations size equals: 1. - - self - assert: (cnnImporter isBatchnorm: - layers first regularizations first invocation) - equals: true -] - -{ #category : #tests } -CNNPythonImporterTest >> testLayerHasConvolution [ - - | famixModel cnnModel layers | - famixModel := self createFamixModel: ' -model.add(Conv2D(32, (5, 5))) -model.add(Activation(''relu'')) -'. - - cnnModel := cnnImporter createCNNModel: famixModel. - - layers := cnnModel layers. - self - assert: layers first convolution class - equals: CNNFamixConvolution. - self - assert: layers first convolution invocation class - equals: FamixPythonInvocation -] - -{ #category : #tests } -CNNPythonImporterTest >> testLayerHasDropoutRegularization [ - - | famixModel cnnModel layers | - famixModel := self createFamixModel: ' -model.add(Conv2D(32, (3, 3))) -model.add(Activation(''relu'')) -model.add(Dropout(0.2)) -'. - - cnnModel := cnnImporter createCNNModel: famixModel. - - layers := cnnModel layers. - - self assert: layers first regularizations size equals: 1. - - self - assert: - (cnnImporter isDropout: - layers first regularizations first invocation) - equals: true -] - -{ #category : #tests } -CNNPythonImporterTest >> testLayerHasPooling [ - - | famixModel cnnModel layers | - famixModel := self createFamixModel: ' -model.add(Conv2D(32, (3, 3))) -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2))) -'. - - cnnModel := cnnImporter createCNNModel: famixModel. - - layers := cnnModel layers. - - self assert: layers first poolings size equals: 1. - - self - assert: layers first poolings first class - equals: CNNFamixPooling. - self - assert: layers first poolings first invocation class - equals: FamixPythonInvocation -] - -{ #category : #tests } -CNNPythonImporterTest >> testLayerHasRegularization [ - - | famixModel cnnModel layers | - famixModel := self createFamixModel: ' -model.add(Conv2D(32, (3, 3))) -model.add(Activation(''relu'')) -model.add(Dropout(0.2)) -'. - - cnnModel := cnnImporter createCNNModel: famixModel. - - layers := cnnModel layers. - - self assert: layers first regularizations size equals: 1. - - self - assert: layers first regularizations first class - equals: CNNFamixRegularization. - self - assert: layers first regularizations first invocation class - equals: FamixPythonInvocation -] - -{ #category : #tests } -CNNPythonImporterTest >> testLayers [ - - | famixModel cnnModel | - famixModel := self createFamixModel: ' -model.add(Conv2D(32, (5, 5))) -model.add(Activation(''relu'')) - -model.add(Conv2D(32, (3, 3))) -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2))) - -model.add(Conv2D(32, (3, 3))) -model.add(MaxPooling2D(pool_size=(2, 2))) - -model.add(Conv2D(32, (3, 3))) -model.add(MaxPooling2D(pool_size=(2, 2))) -'. - - cnnModel := cnnImporter createCNNModel: famixModel. - - self assert: (cnnModel layers) size equals: 4. - - self - assert: (cnnModel layers) first name - equals: 'L1' -] - -{ #category : #tests } -CNNPythonImporterTest >> testProgram [ - - | famixModel cnnModel | - famixModel := self createFamixModel: ' -model = Sequential() - -model.add(Conv2D(32, (5, 5))) -model.add(Activation(''relu'')) - -model.add(Conv2D(32, (3, 3))) -model.add(Activation(''relu'')) -model.add(MaxPooling2D(pool_size=(2, 2))) - -model.add(Conv2D(32, (3, 3))) -model.add(MaxPooling2D(pool_size=(2, 2))) - -model.add(Conv2D(32, (3, 3))) -model.add(MaxPooling2D(pool_size=(2, 2))) -'. - - cnnModel := cnnImporter createCNNModel: famixModel. - - - self assert: cnnModel program class equals: CNNFamixProgram. - - self assert: cnnModel program name equals: 'Main Module'. - - self assert: cnnModel program type equals: 'Sequential' -] diff --git a/src/DL-Python/package.st b/src/DL-Python/package.st deleted file mode 100644 index 1f3460f..0000000 --- a/src/DL-Python/package.st +++ /dev/null @@ -1 +0,0 @@ -Package { #name : #'DL-Python' } From 40bc85d2c001519b73a2e7d47be133c6977b79b7 Mon Sep 17 00:00:00 2001 From: anquetil Date: Thu, 28 Dec 2023 19:37:39 +0100 Subject: [PATCH 13/31] Adjusted baselineOf --- .../BaselineOfMoosePy.class.st | 45 +++++++++++++------ 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/src/BaselineOfMoosePy/BaselineOfMoosePy.class.st b/src/BaselineOfMoosePy/BaselineOfMoosePy.class.st index 8fd75ee..64d6fe2 100644 --- a/src/BaselineOfMoosePy/BaselineOfMoosePy.class.st +++ b/src/BaselineOfMoosePy/BaselineOfMoosePy.class.st @@ -4,27 +4,46 @@ Class { #category : #BaselineOfMoosePy } -{ #category : #accessing } +{ #category : #baselines } BaselineOfMoosePy >> baseline: spec [ - spec baseline: 'PythonParser' with: [ + + spec for: #common do: [ + spec description: 'MoosePy'. + self dependencies: spec. + self packages: spec. + self groups: spec + ] +] + +{ #category : #baselines } +BaselineOfMoosePy >> dependencies: spec [ + + spec baseline: 'SmaCC-Python' with: [ spec repository: 'github://j-brant/SmaCC'; loads: #( 'SmaCC_Python' 'SmaCC_Python_Tests' ) ]. spec - baseline: 'FamixPythonImporter' - with: [ spec repository: 'github://aurpur/famixPythonImporter' ]. + baseline: 'Famix' + with: [ spec repository: 'github://moosetechnology/Famix:development/src' ] +] + +{ #category : #baselines } +BaselineOfMoosePy >> groups: spec [ + + ^ spec + group: 'Core' with: #( 'Famix-Python-Entities' 'MoosePy' ) ; + group: 'Generator' with: #( 'Core' 'Famix-Python-Generator' ) +] + +{ #category : #baselines } +BaselineOfMoosePy >> packages: spec [ spec - package: 'MoosePy' - with: [ spec requires: #( 'PythonParser' 'FamixPythonImporter' ) ]. - - spec - package: 'CNN-Famix-Entities'; - package: 'DL-Python' with: [ - spec requires: - #( 'CNN-Famix-Entities' 'PythonParser' 'FamixPythonImporter' - 'MoosePy' ) ] + + package: 'Famix-Python-Entities' with: [ spec requires: #( Famix ) ] ; + package: 'Famix-Python-Generator' with: [ spec requires: #( Famix ) ] ; + package: 'MoosePy' with: [ spec requires: #( 'Famix-Python-Entities' 'SmaCC_Python') ] ] From 8fddd74fcd5c7fdf1f071b89005590bdd23ac11c Mon Sep 17 00:00:00 2001 From: anquetil Date: Thu, 28 Dec 2023 19:40:10 +0100 Subject: [PATCH 14/31] Adding Famix-Python packages (Entities, Generator) --- .../FamixPythonAccess.class.st | 16 ++ .../FamixPythonAttribute.class.st | 16 ++ .../FamixPythonClass.class.st | 16 ++ .../FamixPythonComment.class.st | 16 ++ .../FamixPythonContainerEntity.class.st | 24 ++ .../FamixPythonEntity.class.st | 141 +++++++++++ .../FamixPythonFunction.class.st | 16 ++ .../FamixPythonImplicitVariable.class.st | 16 ++ .../FamixPythonImport.class.st | 76 ++++++ .../FamixPythonIndexedFileAnchor.class.st | 16 ++ .../FamixPythonInheritance.class.st | 16 ++ .../FamixPythonInvocation.class.st | 16 ++ .../FamixPythonLocalVariable.class.st | 16 ++ .../FamixPythonMethod.class.st | 16 ++ .../FamixPythonModel.class.st | 25 ++ .../FamixPythonModule.class.st | 37 +++ .../FamixPythonNamedEntity.class.st | 24 ++ .../FamixPythonPackage.class.st | 16 ++ .../FamixPythonParameter.class.st | 16 ++ .../FamixPythonPrimitiveType.class.st | 16 ++ .../FamixPythonReference.class.st | 16 ++ .../FamixPythonSourceAnchor.class.st | 24 ++ .../FamixPythonSourceLanguage.class.st | 16 ++ .../FamixPythonSourceTextAnchor.class.st | 16 ++ .../FamixPythonSourcedEntity.class.st | 24 ++ .../FamixPythonTEntityCreator.trait.st | 234 ++++++++++++++++++ .../FamixPythonType.class.st | 16 ++ .../FamixPythonUnknownSourceLanguage.class.st | 16 ++ src/Famix-Python-Entities/package.st | 1 + .../FamixPythonGenerator.class.st | 162 ++++++++++++ src/Famix-Python-Generator/package.st | 1 + 31 files changed, 1077 insertions(+) create mode 100644 src/Famix-Python-Entities/FamixPythonAccess.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonAttribute.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonClass.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonComment.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonContainerEntity.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonEntity.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonFunction.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonImplicitVariable.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonImport.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonIndexedFileAnchor.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonInheritance.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonInvocation.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonLocalVariable.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonMethod.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonModel.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonModule.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonNamedEntity.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonPackage.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonParameter.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonPrimitiveType.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonReference.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonSourceAnchor.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonSourceLanguage.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonSourceTextAnchor.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonSourcedEntity.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonTEntityCreator.trait.st create mode 100644 src/Famix-Python-Entities/FamixPythonType.class.st create mode 100644 src/Famix-Python-Entities/FamixPythonUnknownSourceLanguage.class.st create mode 100644 src/Famix-Python-Entities/package.st create mode 100644 src/Famix-Python-Generator/FamixPythonGenerator.class.st create mode 100644 src/Famix-Python-Generator/package.st diff --git a/src/Famix-Python-Entities/FamixPythonAccess.class.st b/src/Famix-Python-Entities/FamixPythonAccess.class.st new file mode 100644 index 0000000..16b137b --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonAccess.class.st @@ -0,0 +1,16 @@ +Class { + #name : #FamixPythonAccess, + #superclass : #FamixPythonEntity, + #traits : 'FamixTAccess', + #classTraits : 'FamixTAccess classTrait', + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonAccess class >> annotation [ + + + + + ^ self +] diff --git a/src/Famix-Python-Entities/FamixPythonAttribute.class.st b/src/Famix-Python-Entities/FamixPythonAttribute.class.st new file mode 100644 index 0000000..cb67c64 --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonAttribute.class.st @@ -0,0 +1,16 @@ +Class { + #name : #FamixPythonAttribute, + #superclass : #FamixPythonNamedEntity, + #traits : 'FamixTAttribute + FamixTInvocationsReceiver + FamixTWithComments', + #classTraits : 'FamixTAttribute classTrait + FamixTInvocationsReceiver classTrait + FamixTWithComments classTrait', + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonAttribute class >> annotation [ + + + + + ^ self +] diff --git a/src/Famix-Python-Entities/FamixPythonClass.class.st b/src/Famix-Python-Entities/FamixPythonClass.class.st new file mode 100644 index 0000000..fc1a9e6 --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonClass.class.st @@ -0,0 +1,16 @@ +Class { + #name : #FamixPythonClass, + #superclass : #FamixPythonType, + #traits : 'FamixTClass + FamixTImportable + FamixTWithImports', + #classTraits : 'FamixTClass classTrait + FamixTImportable classTrait + FamixTWithImports classTrait', + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonClass class >> annotation [ + + + + + ^ self +] diff --git a/src/Famix-Python-Entities/FamixPythonComment.class.st b/src/Famix-Python-Entities/FamixPythonComment.class.st new file mode 100644 index 0000000..cab0230 --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonComment.class.st @@ -0,0 +1,16 @@ +Class { + #name : #FamixPythonComment, + #superclass : #FamixPythonSourcedEntity, + #traits : 'FamixTComment', + #classTraits : 'FamixTComment classTrait', + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonComment class >> annotation [ + + + + + ^ self +] diff --git a/src/Famix-Python-Entities/FamixPythonContainerEntity.class.st b/src/Famix-Python-Entities/FamixPythonContainerEntity.class.st new file mode 100644 index 0000000..802ce50 --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonContainerEntity.class.st @@ -0,0 +1,24 @@ +Class { + #name : #FamixPythonContainerEntity, + #superclass : #FamixPythonNamedEntity, + #traits : 'FamixTWithClasses', + #classTraits : 'FamixTWithClasses classTrait', + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonContainerEntity class >> annotation [ + + + + + + ^ self +] + +{ #category : #testing } +FamixPythonContainerEntity class >> isAbstract [ + + + ^ self == FamixPythonContainerEntity +] diff --git a/src/Famix-Python-Entities/FamixPythonEntity.class.st b/src/Famix-Python-Entities/FamixPythonEntity.class.st new file mode 100644 index 0000000..8af1d81 --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonEntity.class.st @@ -0,0 +1,141 @@ +Class { + #name : #FamixPythonEntity, + #superclass : #MooseEntity, + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonEntity class >> annotation [ + + + + + + ^ self +] + +{ #category : #testing } +FamixPythonEntity class >> isAbstract [ + + + ^ self == FamixPythonEntity +] + +{ #category : #meta } +FamixPythonEntity class >> metamodel [ + + + ^ FamixPythonModel metamodel +] + +{ #category : #testing } +FamixPythonEntity >> isAccess [ + + + ^ false +] + +{ #category : #testing } +FamixPythonEntity >> isAssociation [ + + + ^ false +] + +{ #category : #testing } +FamixPythonEntity >> isAttribute [ + + + ^ false +] + +{ #category : #testing } +FamixPythonEntity >> isBehavioural [ + + + ^ false +] + +{ #category : #testing } +FamixPythonEntity >> isClass [ + + + ^ false +] + +{ #category : #testing } +FamixPythonEntity >> isFunction [ + + + ^ false +] + +{ #category : #testing } +FamixPythonEntity >> isImplicitVariable [ + + + ^ false +] + +{ #category : #testing } +FamixPythonEntity >> isInheritance [ + + + ^ false +] + +{ #category : #testing } +FamixPythonEntity >> isInvocation [ + + + ^ false +] + +{ #category : #testing } +FamixPythonEntity >> isLocalVariable [ + + + ^ false +] + +{ #category : #testing } +FamixPythonEntity >> isMethod [ + + + ^ false +] + +{ #category : #testing } +FamixPythonEntity >> isPackage [ + + + ^ false +] + +{ #category : #testing } +FamixPythonEntity >> isPrimitiveType [ + + + ^ false +] + +{ #category : #testing } +FamixPythonEntity >> isReference [ + + + ^ false +] + +{ #category : #testing } +FamixPythonEntity >> isStructuralEntity [ + + + ^ false +] + +{ #category : #testing } +FamixPythonEntity >> isType [ + + + ^ false +] diff --git a/src/Famix-Python-Entities/FamixPythonFunction.class.st b/src/Famix-Python-Entities/FamixPythonFunction.class.st new file mode 100644 index 0000000..c3d691b --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonFunction.class.st @@ -0,0 +1,16 @@ +Class { + #name : #FamixPythonFunction, + #superclass : #FamixPythonContainerEntity, + #traits : 'FamixTFunction + FamixTImportable + FamixTInvocable + FamixTWithComments + FamixTWithImplicitVariables + FamixTWithInvocations', + #classTraits : 'FamixTFunction classTrait + FamixTImportable classTrait + FamixTInvocable classTrait + FamixTWithComments classTrait + FamixTWithImplicitVariables classTrait + FamixTWithInvocations classTrait', + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonFunction class >> annotation [ + + + + + ^ self +] diff --git a/src/Famix-Python-Entities/FamixPythonImplicitVariable.class.st b/src/Famix-Python-Entities/FamixPythonImplicitVariable.class.st new file mode 100644 index 0000000..54790b6 --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonImplicitVariable.class.st @@ -0,0 +1,16 @@ +Class { + #name : #FamixPythonImplicitVariable, + #superclass : #FamixPythonNamedEntity, + #traits : 'FamixTImplicitVariable + FamixTInvocationsReceiver', + #classTraits : 'FamixTImplicitVariable classTrait + FamixTInvocationsReceiver classTrait', + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonImplicitVariable class >> annotation [ + + + + + ^ self +] diff --git a/src/Famix-Python-Entities/FamixPythonImport.class.st b/src/Famix-Python-Entities/FamixPythonImport.class.st new file mode 100644 index 0000000..1fce4f1 --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonImport.class.st @@ -0,0 +1,76 @@ +Class { + #name : #FamixPythonImport, + #superclass : #FamixPythonEntity, + #traits : 'FamixTImport', + #classTraits : 'FamixTImport classTrait', + #instVars : [ + '#asName => FMProperty', + '#entityName => FMProperty', + '#fromName => FMProperty', + '#manualImportingEntity' + ], + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonImport class >> annotation [ + + + + + ^ self +] + +{ #category : #accessing } +FamixPythonImport >> asName [ + + + + + ^ asName +] + +{ #category : #accessing } +FamixPythonImport >> asName: anObject [ + + asName := anObject +] + +{ #category : #accessing } +FamixPythonImport >> entityName [ + + + + + ^ entityName +] + +{ #category : #accessing } +FamixPythonImport >> entityName: anObject [ + + entityName := anObject +] + +{ #category : #accessing } +FamixPythonImport >> fromName [ + + + + + ^ fromName +] + +{ #category : #accessing } +FamixPythonImport >> fromName: anObject [ + + fromName := anObject +] + +{ #category : #accessing } +FamixPythonImport >> manualImportingEntity: anObject [ + + manualImportingEntity := anObject +] diff --git a/src/Famix-Python-Entities/FamixPythonIndexedFileAnchor.class.st b/src/Famix-Python-Entities/FamixPythonIndexedFileAnchor.class.st new file mode 100644 index 0000000..c0afb2b --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonIndexedFileAnchor.class.st @@ -0,0 +1,16 @@ +Class { + #name : #FamixPythonIndexedFileAnchor, + #superclass : #FamixPythonSourceAnchor, + #traits : 'FamixTIndexedFileNavigation', + #classTraits : 'FamixTIndexedFileNavigation classTrait', + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonIndexedFileAnchor class >> annotation [ + + + + + ^ self +] diff --git a/src/Famix-Python-Entities/FamixPythonInheritance.class.st b/src/Famix-Python-Entities/FamixPythonInheritance.class.st new file mode 100644 index 0000000..fcbd560 --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonInheritance.class.st @@ -0,0 +1,16 @@ +Class { + #name : #FamixPythonInheritance, + #superclass : #FamixPythonEntity, + #traits : 'FamixTInheritance', + #classTraits : 'FamixTInheritance classTrait', + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonInheritance class >> annotation [ + + + + + ^ self +] diff --git a/src/Famix-Python-Entities/FamixPythonInvocation.class.st b/src/Famix-Python-Entities/FamixPythonInvocation.class.st new file mode 100644 index 0000000..62c9eaa --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonInvocation.class.st @@ -0,0 +1,16 @@ +Class { + #name : #FamixPythonInvocation, + #superclass : #FamixPythonEntity, + #traits : 'FamixTInvocation', + #classTraits : 'FamixTInvocation classTrait', + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonInvocation class >> annotation [ + + + + + ^ self +] diff --git a/src/Famix-Python-Entities/FamixPythonLocalVariable.class.st b/src/Famix-Python-Entities/FamixPythonLocalVariable.class.st new file mode 100644 index 0000000..b53d051 --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonLocalVariable.class.st @@ -0,0 +1,16 @@ +Class { + #name : #FamixPythonLocalVariable, + #superclass : #FamixPythonNamedEntity, + #traits : 'FamixTCanBeFinal + FamixTInvocationsReceiver + FamixTLocalVariable + FamixTWithComments', + #classTraits : 'FamixTCanBeFinal classTrait + FamixTInvocationsReceiver classTrait + FamixTLocalVariable classTrait + FamixTWithComments classTrait', + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonLocalVariable class >> annotation [ + + + + + ^ self +] diff --git a/src/Famix-Python-Entities/FamixPythonMethod.class.st b/src/Famix-Python-Entities/FamixPythonMethod.class.st new file mode 100644 index 0000000..f2c091e --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonMethod.class.st @@ -0,0 +1,16 @@ +Class { + #name : #FamixPythonMethod, + #superclass : #FamixPythonContainerEntity, + #traits : 'FamixTImportable + FamixTInvocable + FamixTMethod + FamixTWithComments + FamixTWithInvocations', + #classTraits : 'FamixTImportable classTrait + FamixTInvocable classTrait + FamixTMethod classTrait + FamixTWithComments classTrait + FamixTWithInvocations classTrait', + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonMethod class >> annotation [ + + + + + ^ self +] diff --git a/src/Famix-Python-Entities/FamixPythonModel.class.st b/src/Famix-Python-Entities/FamixPythonModel.class.st new file mode 100644 index 0000000..0753864 --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonModel.class.st @@ -0,0 +1,25 @@ +Class { + #name : #FamixPythonModel, + #superclass : #MooseModel, + #traits : 'FamixPythonTEntityCreator', + #classTraits : 'FamixPythonTEntityCreator classTrait', + #category : #'Famix-Python-Entities-Model' +} + +{ #category : #accessing } +FamixPythonModel class >> allSubmetamodelsPackagesNames [ + + ^ #(#'Moose-Query' #'Famix-Traits') +] + +{ #category : #meta } +FamixPythonModel class >> annotation [ + + + +] + +{ #category : #visiting } +FamixPythonModel >> accept: aVisitor [ + ^aVisitor visitFamixPythonModel: self +] diff --git a/src/Famix-Python-Entities/FamixPythonModule.class.st b/src/Famix-Python-Entities/FamixPythonModule.class.st new file mode 100644 index 0000000..c1bb125 --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonModule.class.st @@ -0,0 +1,37 @@ +Class { + #name : #FamixPythonModule, + #superclass : #FamixPythonContainerEntity, + #traits : 'FamixTImportable + FamixTPackageable + FamixTWithComments + FamixTWithFunctions + FamixTWithInvocations', + #classTraits : 'FamixTImportable classTrait + FamixTPackageable classTrait + FamixTWithComments classTrait + FamixTWithFunctions classTrait + FamixTWithInvocations classTrait', + #instVars : [ + '#manualImports' + ], + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonModule class >> annotation [ + + + + + ^ self +] + +{ #category : #testing } +FamixPythonModule >> initialize [ + super initialize. + manualImports := OrderedCollection new. +] + +{ #category : #testing } +FamixPythonModule >> manualAddImport: anFamixImport [ + + manualImports add: anFamixImport +] + +{ #category : #testing } +FamixPythonModule >> manualIncomingImports [ + + ^ manualImports +] diff --git a/src/Famix-Python-Entities/FamixPythonNamedEntity.class.st b/src/Famix-Python-Entities/FamixPythonNamedEntity.class.st new file mode 100644 index 0000000..712d0d6 --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonNamedEntity.class.st @@ -0,0 +1,24 @@ +Class { + #name : #FamixPythonNamedEntity, + #superclass : #FamixPythonSourcedEntity, + #traits : 'FamixTInvocationsReceiver + FamixTNamedEntity + FamixTWithAnnotationInstances + TEntityMetaLevelDependency', + #classTraits : 'FamixTInvocationsReceiver classTrait + FamixTNamedEntity classTrait + FamixTWithAnnotationInstances classTrait + TEntityMetaLevelDependency classTrait', + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonNamedEntity class >> annotation [ + + + + + + ^ self +] + +{ #category : #testing } +FamixPythonNamedEntity class >> isAbstract [ + + + ^ self == FamixPythonNamedEntity +] diff --git a/src/Famix-Python-Entities/FamixPythonPackage.class.st b/src/Famix-Python-Entities/FamixPythonPackage.class.st new file mode 100644 index 0000000..35f9c87 --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonPackage.class.st @@ -0,0 +1,16 @@ +Class { + #name : #FamixPythonPackage, + #superclass : #FamixPythonContainerEntity, + #traits : 'FamixTImportable + FamixTPackage + FamixTPackageable + FamixTWithComments', + #classTraits : 'FamixTImportable classTrait + FamixTPackage classTrait + FamixTPackageable classTrait + FamixTWithComments classTrait', + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonPackage class >> annotation [ + + + + + ^ self +] diff --git a/src/Famix-Python-Entities/FamixPythonParameter.class.st b/src/Famix-Python-Entities/FamixPythonParameter.class.st new file mode 100644 index 0000000..72e094e --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonParameter.class.st @@ -0,0 +1,16 @@ +Class { + #name : #FamixPythonParameter, + #superclass : #FamixPythonNamedEntity, + #traits : 'FamixTParameter + FamixTWithComments', + #classTraits : 'FamixTParameter classTrait + FamixTWithComments classTrait', + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonParameter class >> annotation [ + + + + + ^ self +] diff --git a/src/Famix-Python-Entities/FamixPythonPrimitiveType.class.st b/src/Famix-Python-Entities/FamixPythonPrimitiveType.class.st new file mode 100644 index 0000000..ad1163d --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonPrimitiveType.class.st @@ -0,0 +1,16 @@ +Class { + #name : #FamixPythonPrimitiveType, + #superclass : #FamixPythonType, + #traits : 'FamixTPrimitiveType', + #classTraits : 'FamixTPrimitiveType classTrait', + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonPrimitiveType class >> annotation [ + + + + + ^ self +] diff --git a/src/Famix-Python-Entities/FamixPythonReference.class.st b/src/Famix-Python-Entities/FamixPythonReference.class.st new file mode 100644 index 0000000..c5ebd5d --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonReference.class.st @@ -0,0 +1,16 @@ +Class { + #name : #FamixPythonReference, + #superclass : #FamixPythonEntity, + #traits : 'FamixTReference', + #classTraits : 'FamixTReference classTrait', + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonReference class >> annotation [ + + + + + ^ self +] diff --git a/src/Famix-Python-Entities/FamixPythonSourceAnchor.class.st b/src/Famix-Python-Entities/FamixPythonSourceAnchor.class.st new file mode 100644 index 0000000..658deca --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonSourceAnchor.class.st @@ -0,0 +1,24 @@ +Class { + #name : #FamixPythonSourceAnchor, + #superclass : #FamixPythonEntity, + #traits : 'FamixTSourceAnchor', + #classTraits : 'FamixTSourceAnchor classTrait', + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonSourceAnchor class >> annotation [ + + + + + + ^ self +] + +{ #category : #testing } +FamixPythonSourceAnchor class >> isAbstract [ + + + ^ self == FamixPythonSourceAnchor +] diff --git a/src/Famix-Python-Entities/FamixPythonSourceLanguage.class.st b/src/Famix-Python-Entities/FamixPythonSourceLanguage.class.st new file mode 100644 index 0000000..d93d382 --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonSourceLanguage.class.st @@ -0,0 +1,16 @@ +Class { + #name : #FamixPythonSourceLanguage, + #superclass : #FamixPythonEntity, + #traits : 'FamixTSourceLanguage', + #classTraits : 'FamixTSourceLanguage classTrait', + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonSourceLanguage class >> annotation [ + + + + + ^ self +] diff --git a/src/Famix-Python-Entities/FamixPythonSourceTextAnchor.class.st b/src/Famix-Python-Entities/FamixPythonSourceTextAnchor.class.st new file mode 100644 index 0000000..8100fbf --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonSourceTextAnchor.class.st @@ -0,0 +1,16 @@ +Class { + #name : #FamixPythonSourceTextAnchor, + #superclass : #FamixPythonSourceAnchor, + #traits : 'FamixTHasImmediateSource', + #classTraits : 'FamixTHasImmediateSource classTrait', + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonSourceTextAnchor class >> annotation [ + + + + + ^ self +] diff --git a/src/Famix-Python-Entities/FamixPythonSourcedEntity.class.st b/src/Famix-Python-Entities/FamixPythonSourcedEntity.class.st new file mode 100644 index 0000000..feb60ff --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonSourcedEntity.class.st @@ -0,0 +1,24 @@ +Class { + #name : #FamixPythonSourcedEntity, + #superclass : #FamixPythonEntity, + #traits : 'FamixTSourceEntity', + #classTraits : 'FamixTSourceEntity classTrait', + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonSourcedEntity class >> annotation [ + + + + + + ^ self +] + +{ #category : #testing } +FamixPythonSourcedEntity class >> isAbstract [ + + + ^ self == FamixPythonSourcedEntity +] diff --git a/src/Famix-Python-Entities/FamixPythonTEntityCreator.trait.st b/src/Famix-Python-Entities/FamixPythonTEntityCreator.trait.st new file mode 100644 index 0000000..68cc62f --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonTEntityCreator.trait.st @@ -0,0 +1,234 @@ +" +This trait is used by Famix models. +It provides an API for creating entities and adding them to the model. +" +Trait { + #name : #FamixPythonTEntityCreator, + #category : #'Famix-Python-Entities-Model' +} + +{ #category : #meta } +FamixPythonTEntityCreator classSide >> annotation [ + + + + + ^ self +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newAccess [ + + + ^ self add: FamixPythonAccess new +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newAttribute [ + + + ^ self add: FamixPythonAttribute new +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newAttributeNamed: aName [ + + + ^ self add: (FamixPythonAttribute named: aName) +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newClass [ + + + ^ self add: FamixPythonClass new +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newClassNamed: aName [ + + + ^ self add: (FamixPythonClass named: aName) +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newComment [ + + + ^ self add: FamixPythonComment new +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newFunction [ + + + ^ self add: FamixPythonFunction new +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newFunctionNamed: aName [ + + + ^ self add: (FamixPythonFunction named: aName) +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newImplicitVariable [ + + + ^ self add: FamixPythonImplicitVariable new +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newImplicitVariableNamed: aName [ + + + ^ self add: (FamixPythonImplicitVariable named: aName) +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newImport [ + + + ^ self add: FamixPythonImport new +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newIndexedFileAnchor [ + + + ^ self add: FamixPythonIndexedFileAnchor new +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newInheritance [ + + + ^ self add: FamixPythonInheritance new +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newInvocation [ + + + ^ self add: FamixPythonInvocation new +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newLocalVariable [ + + + ^ self add: FamixPythonLocalVariable new +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newLocalVariableNamed: aName [ + + + ^ self add: (FamixPythonLocalVariable named: aName) +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newMethod [ + + + ^ self add: FamixPythonMethod new +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newMethodNamed: aName [ + + + ^ self add: (FamixPythonMethod named: aName) +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newModule [ + + + ^ self add: FamixPythonModule new +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newPackage [ + + + ^ self add: FamixPythonPackage new +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newPackageNamed: aName [ + + + ^ self add: (FamixPythonPackage named: aName) +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newParameter [ + + + ^ self add: FamixPythonParameter new +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newParameterNamed: aName [ + + + ^ self add: (FamixPythonParameter named: aName) +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newPrimitiveType [ + + + ^ self add: FamixPythonPrimitiveType new +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newPrimitiveTypeNamed: aName [ + + + ^ self add: (FamixPythonPrimitiveType named: aName) +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newReference [ + + + ^ self add: FamixPythonReference new +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newSourceLanguage [ + + + ^ self add: FamixPythonSourceLanguage new +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newSourceTextAnchor [ + + + ^ self add: FamixPythonSourceTextAnchor new +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newType [ + + + ^ self add: FamixPythonType new +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newTypeNamed: aName [ + + + ^ self add: (FamixPythonType named: aName) +] + +{ #category : #'entity creation' } +FamixPythonTEntityCreator >> newUnknownSourceLanguage [ + + + ^ self add: FamixPythonUnknownSourceLanguage new +] diff --git a/src/Famix-Python-Entities/FamixPythonType.class.st b/src/Famix-Python-Entities/FamixPythonType.class.st new file mode 100644 index 0000000..d98af04 --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonType.class.st @@ -0,0 +1,16 @@ +Class { + #name : #FamixPythonType, + #superclass : #FamixPythonContainerEntity, + #traits : 'FamixTType + FamixTWithMethods', + #classTraits : 'FamixTType classTrait + FamixTWithMethods classTrait', + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonType class >> annotation [ + + + + + ^ self +] diff --git a/src/Famix-Python-Entities/FamixPythonUnknownSourceLanguage.class.st b/src/Famix-Python-Entities/FamixPythonUnknownSourceLanguage.class.st new file mode 100644 index 0000000..2a6544b --- /dev/null +++ b/src/Famix-Python-Entities/FamixPythonUnknownSourceLanguage.class.st @@ -0,0 +1,16 @@ +Class { + #name : #FamixPythonUnknownSourceLanguage, + #superclass : #FamixPythonSourceLanguage, + #traits : 'FamixTUnknownSourceLanguage', + #classTraits : 'FamixTUnknownSourceLanguage classTrait', + #category : #'Famix-Python-Entities-Entities' +} + +{ #category : #meta } +FamixPythonUnknownSourceLanguage class >> annotation [ + + + + + ^ self +] diff --git a/src/Famix-Python-Entities/package.st b/src/Famix-Python-Entities/package.st new file mode 100644 index 0000000..a001e91 --- /dev/null +++ b/src/Famix-Python-Entities/package.st @@ -0,0 +1 @@ +Package { #name : #'Famix-Python-Entities' } diff --git a/src/Famix-Python-Generator/FamixPythonGenerator.class.st b/src/Famix-Python-Generator/FamixPythonGenerator.class.st new file mode 100644 index 0000000..f5cccc8 --- /dev/null +++ b/src/Famix-Python-Generator/FamixPythonGenerator.class.st @@ -0,0 +1,162 @@ +Class { + #name : #FamixPythonGenerator, + #superclass : #FamixBasicInfrastructureGenerator, + #instVars : [ + 'package', + 'containerEntity', + 'class', + 'type', + 'attribute', + 'method', + 'parameter', + 'primitiveType', + 'reference', + 'invocation', + 'localVariable', + 'access', + 'implicitVariable', + 'import', + 'inheritance', + 'function', + 'module', + 'indexedFileAnchor' + ], + #category : #'Famix-Python-Generator' +} + +{ #category : #accessing } +FamixPythonGenerator class >> packageName [ + + ^ #'Famix-Python-Entities' +] + +{ #category : #accessing } +FamixPythonGenerator class >> prefix [ + + ^ #FamixPython +] + +{ #category : #definition } +FamixPythonGenerator >> defineClasses [ + + super defineClasses. + access := builder newClassNamed: #Access. + attribute := builder newClassNamed: #Attribute. + class := builder newClassNamed: #Class. + containerEntity := builder newAbstractClassNamed: #ContainerEntity. + function := builder newClassNamed: #Function. + implicitVariable := builder newClassNamed: #ImplicitVariable. + import := builder newClassNamed: #Import. + indexedFileAnchor := builder newClassNamed: #IndexedFileAnchor. + inheritance := builder newClassNamed: #Inheritance. + invocation := builder newClassNamed: #Invocation. + localVariable := builder newClassNamed: #LocalVariable. + method := builder newClassNamed: #Method. + module := builder newClassNamed: #Module. + package := builder newClassNamed: #Package. + parameter := builder newClassNamed: #Parameter. + primitiveType := builder newClassNamed: #PrimitiveType. + reference := builder newClassNamed: #Reference. + type := builder newClassNamed: #Type +] + +{ #category : #definition } +FamixPythonGenerator >> defineHierarchy [ + + super defineHierarchy. + access --|> #TAccess. + + attribute --|> namedEntity. + attribute --|> #TAttribute. + attribute --|> #TInvocationsReceiver. + attribute --|> #TWithComments. + + class --|> type. + class --|> #TClass. + class --|> #TWithImports. + class --|> #TImportable. + + containerEntity --|> namedEntity. + containerEntity --|> #TWithClasses. + + function --|> containerEntity. + function --|> #TFunction. + function --|> #TWithComments. + function --|> #TInvocable. + function --|> #TImportable. + function --|> #TWithImplicitVariables. + function --|> #TWithInvocations. + function --|> #TInvocable. + + implicitVariable --|> namedEntity. + implicitVariable --|> #TImplicitVariable. + implicitVariable --|> #TInvocationsReceiver. + + import --|> #TImport. + + indexedFileAnchor --|> sourceAnchor. + indexedFileAnchor --|> #TIndexedFileNavigation. + + inheritance --|> #TInheritance. + + invocation --|> #TInvocation. + + localVariable --|> namedEntity. + localVariable --|> #TLocalVariable. + localVariable --|> #TCanBeFinal. + localVariable --|> #TInvocationsReceiver. + localVariable --|> #TWithComments. + + method --|> containerEntity. + method --|> #TMethod. + method --|> #TWithComments. + method --|> #TImportable. + method --|> #TWithInvocations. + method --|> #TInvocable. + + module --|> containerEntity. + module --|> #TPackageable. + module --|> #TWithComments. + module --|> #TImportable. + module --|> #TWithFunctions. + module --|> #TWithInvocations. + + namedEntity --|> #TInvocationsReceiver. + namedEntity --|> #TWithAnnotationInstances. + namedEntity --|> #TEntityMetaLevelDependency. + namedEntity --|> sourcedEntity. + + package --|> containerEntity. + package --|> #TPackage. + package --|> #TPackageable. + package --|> #TWithComments. + package --|> #TImportable. + + parameter --|> namedEntity. + parameter --|> #TParameter. + parameter --|> #TWithComments. + + primitiveType --|> type. + primitiveType --|> #TPrimitiveType. + + reference --|> #TReference. + + type --|> containerEntity. + type --|> #TType. + type --|> #TWithMethods +] + +{ #category : #definition } +FamixPythonGenerator >> defineProperties [ + + super defineProperties. + (import property: #fromName type: #String) comment: 'from a import b + fromName is a'. + + (import property: #entityName type: #String) comment: + 'from a import b + entityName is b'. + + (import property: #asName type: #String) comment: 'import b as c + asName is c'. +] diff --git a/src/Famix-Python-Generator/package.st b/src/Famix-Python-Generator/package.st new file mode 100644 index 0000000..832401e --- /dev/null +++ b/src/Famix-Python-Generator/package.st @@ -0,0 +1 @@ +Package { #name : #'Famix-Python-Generator' } From 345a406a61cf517e607d97b301c87f3d3c8af223 Mon Sep 17 00:00:00 2001 From: anquetil Date: Thu, 28 Dec 2023 19:47:52 +0100 Subject: [PATCH 15/31] correcting baseline --- src/BaselineOfMoosePy/BaselineOfMoosePy.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BaselineOfMoosePy/BaselineOfMoosePy.class.st b/src/BaselineOfMoosePy/BaselineOfMoosePy.class.st index 64d6fe2..00b836c 100644 --- a/src/BaselineOfMoosePy/BaselineOfMoosePy.class.st +++ b/src/BaselineOfMoosePy/BaselineOfMoosePy.class.st @@ -45,5 +45,5 @@ BaselineOfMoosePy >> packages: spec [ package: 'Famix-Python-Entities' with: [ spec requires: #( Famix ) ] ; package: 'Famix-Python-Generator' with: [ spec requires: #( Famix ) ] ; - package: 'MoosePy' with: [ spec requires: #( 'Famix-Python-Entities' 'SmaCC_Python') ] + package: 'MoosePy' with: [ spec requires: #( 'Famix-Python-Entities' 'SmaCC-Python') ] ] From 84bf453a5f75490b3d8d45df8aa97d437afa5e55 Mon Sep 17 00:00:00 2001 From: anquetil Date: Thu, 28 Dec 2023 19:55:35 +0100 Subject: [PATCH 16/31] correcting baseline --- src/BaselineOfMoosePy/BaselineOfMoosePy.class.st | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/BaselineOfMoosePy/BaselineOfMoosePy.class.st b/src/BaselineOfMoosePy/BaselineOfMoosePy.class.st index 00b836c..f5001da 100644 --- a/src/BaselineOfMoosePy/BaselineOfMoosePy.class.st +++ b/src/BaselineOfMoosePy/BaselineOfMoosePy.class.st @@ -20,9 +20,9 @@ BaselineOfMoosePy >> baseline: spec [ { #category : #baselines } BaselineOfMoosePy >> dependencies: spec [ - spec baseline: 'SmaCC-Python' with: [ + spec baseline: 'PythonParser' with: [ spec - repository: 'github://j-brant/SmaCC'; + repository: 'github://j-brant/SmaCC:master/src'; loads: #( 'SmaCC_Python' 'SmaCC_Python_Tests' ) ]. spec @@ -45,5 +45,5 @@ BaselineOfMoosePy >> packages: spec [ package: 'Famix-Python-Entities' with: [ spec requires: #( Famix ) ] ; package: 'Famix-Python-Generator' with: [ spec requires: #( Famix ) ] ; - package: 'MoosePy' with: [ spec requires: #( 'Famix-Python-Entities' 'SmaCC-Python') ] + package: 'MoosePy' with: [ spec requires: #( 'Famix-Python-Entities' 'PythonParser') ] ] From 57f4cd5bd9220803c8ca73f4cb2c8e44f0332891 Mon Sep 17 00:00:00 2001 From: anquetil Date: Thu, 28 Dec 2023 20:09:17 +0100 Subject: [PATCH 17/31] Removing LittleInterp and its tests --- src/MoosePy/LittleInterp.class.st | 108 ---------------------- src/MoosePy/ToyingWithParserTest.class.st | 102 -------------------- 2 files changed, 210 deletions(-) delete mode 100644 src/MoosePy/LittleInterp.class.st delete mode 100644 src/MoosePy/ToyingWithParserTest.class.st diff --git a/src/MoosePy/LittleInterp.class.st b/src/MoosePy/LittleInterp.class.st deleted file mode 100644 index 5159033..0000000 --- a/src/MoosePy/LittleInterp.class.st +++ /dev/null @@ -1,108 +0,0 @@ -Class { - #name : #LittleInterp, - #superclass : #Object, - #instVars : [ - 'functions', - 'function', - 'environment' - ], - #category : #'MoosePy-Interpreters' -} - -{ #category : #initialization } -LittleInterp >> initialize [ - - super initialize. - "we should use a chained dictionary to represent scope." - environment := Dictionary new -] - -{ #category : #'as yet unclassified' } -LittleInterp >> interpretFunction: aPyFuncdefNode withBindings: aCollection [ - - aPyFuncdefNode parameters isNil - ifTrue: [ ^ aPyFuncdefNode statements collect: [ :each | each acceptVisitor: self ] ]. - - aPyFuncdefNode parameters args with: aCollection do: - [ :s :v | - "this is horrible we should invoke recursively to get the value" - - environment at: s nameToken value - put: "(v acceptVisitor: self)" (Number readFrom: v arguments first test atom value numberToken value) ]. - - ^ aPyFuncdefNode statements collect: [ :each | each acceptVisitor: self ] -] - -{ #category : #'as yet unclassified' } -LittleInterp >> interpretFunctionCall: aPyPowerNode [ - "we have one one function so this is that one :)" - - ^ self interpretFunction: function withBindings: aPyPowerNode trailers -] - -{ #category : #visiting } -LittleInterp >> visit: aNode [ - ^ aNode acceptVisitor: self -] - -{ #category : #visiting } -LittleInterp >> visitFileInput: aPyFileInputNode [ - ^ (aPyFileInputNode children collect: [ :each | each acceptVisitor: self ]) last -] - -{ #category : #visiting } -LittleInterp >> visitFuncdef: aPyExprStmtNode [ - - ^ aPyExprStmtNode assigns - ifNotEmpty: [ - environment - at: aPyExprStmtNode testlist atom nameToken value - put: (aPyExprStmtNode tos first acceptVisitor: self) ] - ifEmpty: [ aPyExprStmtNode testlist acceptVisitor: self ] -] - -{ #category : #generated } -LittleInterp >> visitNumber: aNode [ - - ^ Number readFrom: aNode numberToken value -] - -{ #category : #visiting } -LittleInterp >> visitPlusExpr: aPyPlusExprNode [ - | one two | - one := aPyPlusExprNode one acceptVisitor: self. - two := aPyPlusExprNode two acceptVisitor: self. - ^ one + two -] - -{ #category : #visiting } -LittleInterp >> visitPower: aPyPowerNode [ - - ^ aPyPowerNode trailers - ifEmpty: [ - (aPyPowerNode parent isKindOf: PyReturnNode) - ifTrue: [ - aPyPowerNode atom acceptVisitor: self ] - ifFalse: [ - "this is a number or constant" - aPyPowerNode atom acceptVisitor: self ] - ] - ifNotEmpty: [ - "this is call probably wrong" - self interpretFunctionCall: aPyPowerNode ] -] - -{ #category : #visiting } -LittleInterp >> visitReturn: aPyReturnNode [ - ^ aPyReturnNode testlist acceptVisitor: self -] - -{ #category : #visiting } -LittleInterp >> visitSimpleStmt: aPySimpleStmtNode [ - ^ (aPySimpleStmtNode children collect: [ :each | each acceptVisitor: self ]) last -] - -{ #category : #visiting } -LittleInterp >> visitSymbol: aPySymbolNode [ - ^ environment at: (aPySymbolNode nameToken value ) -] diff --git a/src/MoosePy/ToyingWithParserTest.class.st b/src/MoosePy/ToyingWithParserTest.class.st deleted file mode 100644 index 686d9ed..0000000 --- a/src/MoosePy/ToyingWithParserTest.class.st +++ /dev/null @@ -1,102 +0,0 @@ -Class { - #name : #ToyingWithParserTest, - #superclass : #TestCase, - #category : #'MoosePy-Tests' -} - -{ #category : #tests } -ToyingWithParserTest >> testInterpretIdentity [ - | tree intr val | - tree := PythonParser parse: - 'def identity(a): - return a - -identity(1)'. - - intr := LittleInterp new. - val := intr visit: tree. - self assert: val first equals: 1 - - -] - -{ #category : #tests } -ToyingWithParserTest >> testInterpretNumbers [ - | tree val intr | - tree := PythonParser parse: '1'. - intr := LittleInterp new. - val := intr visit: tree. - self assert: val equals: 1 - - -] - -{ #category : #tests } -ToyingWithParserTest >> testInterpretSumOfNumbers [ - | tree val intr | - tree := PythonParser parse: '1 + 2'. - intr := LittleInterp new. - val := intr visit: tree. - self assert: val equals: 3 - - -] - -{ #category : #tests } -ToyingWithParserTest >> testParseAssignment [ - | tree intr val | - tree := PythonParser parse: 'a = 1 -a'. - - intr := LittleInterp new. - val := intr visit: tree. - self assert: val equals: 1 - - -] - -{ #category : #tests } -ToyingWithParserTest >> testParseAssignment2 [ - | tree intr val | - tree := PythonParser parse: 'a = 1 -b = 2 -a + b'. - - intr := LittleInterp new. - val := intr visit: tree. - self assert: val equals: 3 - - -] - -{ #category : #tests } -ToyingWithParserTest >> testParseFuncConstant [ - | tree intr val | - tree := PythonParser parse: 'def one(): - return 1 - -one()'. - - intr := LittleInterp new. - val := intr visit: tree. - self assert: val first equals: 1 - - -] - -{ #category : #tests } -ToyingWithParserTest >> testParseIf [ - | tree intr val | - tree := PythonParser parse: - 'def maxi(a, b): # [integer], [integer] - if a > b: # [bool] - return a # [integer] - return b - -maxi(1,2)'. - - intr := LittleInterp new. - val := intr visit: tree - - -] From 3bd8598986ae329beaf9bf797cd5ff932573156b Mon Sep 17 00:00:00 2001 From: anquetil Date: Fri, 29 Dec 2023 11:13:26 +0100 Subject: [PATCH 18/31] reclassify method --- src/MoosePy/MSEPythonImporterTest.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MoosePy/MSEPythonImporterTest.class.st b/src/MoosePy/MSEPythonImporterTest.class.st index 587bfa8..1b52449 100644 --- a/src/MoosePy/MSEPythonImporterTest.class.st +++ b/src/MoosePy/MSEPythonImporterTest.class.st @@ -38,7 +38,7 @@ MSEPythonImporterTest >> moduleName2 [ ] -{ #category : #'tests - module' } +{ #category : #running } MSEPythonImporterTest >> parseCode: aString [ ^ (PythonParser parseWithErrors: aString) From a63da7a13483665e613299b3b741c9e77994855d Mon Sep 17 00:00:00 2001 From: anquetil Date: Fri, 29 Dec 2023 11:15:01 +0100 Subject: [PATCH 19/31] Removed extra 'Import' in all tests' names --- src/MoosePy/MSEPythonImporterTest.class.st | 147 +++++++++++---------- 1 file changed, 74 insertions(+), 73 deletions(-) diff --git a/src/MoosePy/MSEPythonImporterTest.class.st b/src/MoosePy/MSEPythonImporterTest.class.st index 1b52449..0b5b492 100644 --- a/src/MoosePy/MSEPythonImporterTest.class.st +++ b/src/MoosePy/MSEPythonImporterTest.class.st @@ -117,6 +117,31 @@ MSEPythonImporterTest >> testFileIsOk [ ] +{ #category : #'tests - module' } +MSEPythonImporterTest >> testImport [ + + importer accept: (self parseCode: ' +import pygame +import random +'). + + self assert: (importer importNamed: 'pygame') isNotNil. + self assert: (importer importNamed: 'random') isNotNil +] + +{ #category : #'tests - module' } +MSEPythonImporterTest >> testImportClassFromModule [ + + importer accept: (self parseCode: ' +from keras.layers import Input +'). + + self assert: (importer importNamed: 'Input') isNotNil. + self + assert: (importer importNamed: 'Input') fromName + equals: 'keras.layers' +] + { #category : #'tests - classes' } MSEPythonImporterTest >> testImportClassKnowsItsMethods [ @@ -131,15 +156,16 @@ MSEPythonImporterTest >> testImportClassKnowsItsMethods [ { #category : #'tests - classes' } MSEPythonImporterTest >> testImportFamixClass [ - | firstClass secondClass | + | ballClass wallClass | importer accept: pyDoc. - firstClass := importer classNamed: 'Ball'. - self assert: firstClass class equals: FamixPythonClass. - self assert: firstClass name equals: 'Ball'. - self assert: firstClass isStub. + ballClass := importer classNamed: 'Ball'. + self assert: ballClass class equals: FamixPythonClass. + self assert: ballClass name equals: 'Ball'. + self deny: ballClass isStub. - secondClass := importer classNamed: 'Wall'. - self assert: secondClass name equals: 'Wall'. + wallClass := importer classNamed: 'Wall'. + self assert: wallClass name equals: 'Wall'. + self deny: wallClass isStub. ] { #category : #'tests - classes' } @@ -236,66 +262,55 @@ MSEPythonImporterTest >> testImportFamixParameter [ self assert: param name equals: 'word'. ] -{ #category : #tests } -MSEPythonImporterTest >> testImportFunctions [ - - importer accept: pyDoc2. - self assert: importer functions size equals: 4. - - self assert: (importer functionNamed: 'tryToPlaceWord') isNotNil. - self assert: (importer functionNamed: 'printGrid') isNotNil -] - { #category : #'tests - module' } -MSEPythonImporterTest >> testImportImport [ +MSEPythonImporterTest >> testImportFunction [ importer accept: (self parseCode: ' -import pygame -import random +import matplotlib.pyplot '). - self assert: (importer importNamed: 'pygame') isNotNil. - self assert: (importer importNamed: 'random') isNotNil + self assert: (importer importNamed: 'matplotlib.pyplot') isNotNil ] { #category : #'tests - module' } -MSEPythonImporterTest >> testImportImportClassFromModule [ +MSEPythonImporterTest >> testImportFunctionFromModule [ importer accept: (self parseCode: ' -from keras.layers import Input +from random import randint '). - self assert: (importer importNamed: 'Input') isNotNil. + self assert: (importer importNamed: 'randint') isNotNil. self - assert: (importer importNamed: 'Input') fromName - equals: 'keras.layers' + assert: (importer importNamed: 'randint') fromName + equals: 'random' ] -{ #category : #'tests - module' } -MSEPythonImporterTest >> testImportImportFunction [ +{ #category : #tests } +MSEPythonImporterTest >> testImportFunctions [ - importer accept: (self parseCode: ' -import matplotlib.pyplot -'). + importer accept: pyDoc2. + self assert: importer functions size equals: 4. - self assert: (importer importNamed: 'matplotlib.pyplot') isNotNil + self assert: (importer functionNamed: 'tryToPlaceWord') isNotNil. + self assert: (importer functionNamed: 'printGrid') isNotNil ] -{ #category : #'tests - module' } -MSEPythonImporterTest >> testImportImportFunctionFromModule [ +{ #category : #tests } +MSEPythonImporterTest >> testImportMethods [ - importer accept: (self parseCode: ' -from random import randint -'). + importer accept: pyDoc. + self assert: importer methods size equals: 5. + self assert: + (importer methodNamed: 'update' inClass: 'Ball') isNotNil. + self assert: + (importer methodNamed: '__init__' inClass: 'Wall') isNotNil. + self assert: + (importer methodNamed: '__init__' inClass: 'Player') isNotNil - self assert: (importer importNamed: 'randint') isNotNil. - self - assert: (importer importNamed: 'randint') fromName - equals: 'random' ] { #category : #'tests - module' } -MSEPythonImporterTest >> testImportImportModuleWithAlias [ +MSEPythonImporterTest >> testImportModuleWithAlias [ importer accept: (self parseCode: ' import math as m @@ -314,7 +329,7 @@ import matplotlib.pyplot as plt ] { #category : #'tests - module' } -MSEPythonImporterTest >> testImportImportMultiClassesFromModule [ +MSEPythonImporterTest >> testImportMultiClassesFromModule [ importer accept: (self parseCode: ' from keras.layers import Flatten, Activation, AveragePooling2D, BatchNormalization @@ -328,7 +343,7 @@ from keras.layers import Flatten, Activation, AveragePooling2D, BatchNormalizati ] { #category : #'tests - module' } -MSEPythonImporterTest >> testImportImportMultiFunctionsFromModule [ +MSEPythonImporterTest >> testImportMultiFunctionsFromModule [ importer accept: (self parseCode: ' from maths import add, subtract @@ -342,7 +357,7 @@ from maths import add, subtract ] { #category : #'tests - module' } -MSEPythonImporterTest >> testImportInvocation [ +MSEPythonImporterTest >> testInvocation [ | invocations invocation | importer accept: (self parseCode: ' @@ -360,7 +375,7 @@ grid[row].append(".") ] { #category : #'tests - module' } -MSEPythonImporterTest >> testImportInvocationInLoop [ +MSEPythonImporterTest >> testInvocationInLoop [ importer accept: (self parseCode: ' append(".") @@ -370,7 +385,7 @@ append(".") ] { #category : #'tests - module' } -MSEPythonImporterTest >> testImportInvocationInNestedLoop [ +MSEPythonImporterTest >> testInvocationInNestedLoop [ importer accept: (self parseCode: ' for row in array: @@ -383,7 +398,7 @@ for row in array: ] { #category : #'tests - module' } -MSEPythonImporterTest >> testImportInvocationWithArrayReceiver [ +MSEPythonImporterTest >> testInvocationWithArrayReceiver [ importer accept: (self parseCode: ' for row in array: @@ -394,7 +409,7 @@ for row in array: ] { #category : #'tests - module' } -MSEPythonImporterTest >> testImportInvocationWithNumericalArguments [ +MSEPythonImporterTest >> testInvocationWithNumericalArguments [ importer accept: (self parseCode: ' test(4, 25) @@ -410,7 +425,7 @@ test(4, 25) ] { #category : #'tests - module' } -MSEPythonImporterTest >> testImportInvocationWithReceiver [ +MSEPythonImporterTest >> testInvocationWithReceiver [ importer accept: (self parseCode: ' grid.append(test) @@ -420,7 +435,7 @@ grid.append(test) ] { #category : #'tests - module' } -MSEPythonImporterTest >> testImportInvocationWithStringReceiver [ +MSEPythonImporterTest >> testInvocationWithStringReceiver [ importer accept: (self parseCode: ' "CNN_Model_Rebuilt/logs/{}".format(NAME) @@ -430,7 +445,7 @@ MSEPythonImporterTest >> testImportInvocationWithStringReceiver [ ] { #category : #'tests - module' } -MSEPythonImporterTest >> testImportInvocationWithVariableArguments [ +MSEPythonImporterTest >> testInvocationWithVariableArguments [ | invocation | importer accept: (self parseCode: ' @@ -456,7 +471,7 @@ test(x, 25) ] { #category : #'tests - module' } -MSEPythonImporterTest >> testImportIsModel [ +MSEPythonImporterTest >> testIsModel [ importer accept: pyDoc. importer model entityNamed: 'pygame'. @@ -465,7 +480,7 @@ MSEPythonImporterTest >> testImportIsModel [ ] { #category : #'tests - module' } -MSEPythonImporterTest >> testImportKnowsItsModule [ +MSEPythonImporterTest >> testKnowsItsModule [ | import module | importer accept: pyDoc. @@ -475,22 +490,14 @@ MSEPythonImporterTest >> testImportKnowsItsModule [ ] -{ #category : #tests } -MSEPythonImporterTest >> testImportMethods [ - +{ #category : #'tests - classes' } +MSEPythonImporterTest >> testMethodIsInModel [ importer accept: pyDoc. - self assert: importer methods size equals: 5. - self assert: - (importer methodNamed: 'update' inClass: 'Ball') isNotNil. - self assert: - (importer methodNamed: '__init__' inClass: 'Wall') isNotNil. - self assert: - (importer methodNamed: '__init__' inClass: 'Player') isNotNil - + self assert: importer model numberOfMethods equals: 5. ] { #category : #'tests - module' } -MSEPythonImporterTest >> testImportModule [ +MSEPythonImporterTest >> testModule [ | module | importer accept: pyDoc. @@ -500,12 +507,6 @@ MSEPythonImporterTest >> testImportModule [ ] -{ #category : #'tests - classes' } -MSEPythonImporterTest >> testMethodIsInModel [ - importer accept: pyDoc. - self assert: importer model numberOfMethods equals: 5. -] - { #category : #'tests - module' } MSEPythonImporterTest >> testModuleIsModel [ From 046540062deafed86d774caefd51b874a2e57d4d Mon Sep 17 00:00:00 2001 From: anquetil Date: Fri, 29 Dec 2023 11:15:47 +0100 Subject: [PATCH 20/31] introduced a visitSmaCCToken: method for conveniency --- .../MSEPythonToFamixImporterVisitor.class.st | 23 ++++++++++++++++++- src/MoosePy/SmaCCToken.extension.st | 6 +++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 src/MoosePy/SmaCCToken.extension.st diff --git a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st index 453029e..e074c07 100644 --- a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st +++ b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st @@ -10,6 +10,14 @@ Class { #category : #'MoosePy-Visitors' } +{ #category : #visiting } +MSEPythonToFamixImporterVisitor >> SmaCCToken: aSmaCCToken [ + "introducing this additional visit method regularity of treatment + see also extension method to SmaCCToken" + + ^aSmaCCToken value +] + { #category : #'private-entity-creation' } MSEPythonToFamixImporterVisitor >> basicCreateFunction: aSelector withSignature: aSignature [ @@ -653,7 +661,7 @@ MSEPythonToFamixImporterVisitor >> visitDotOptDottedName: aDotOptDottedNode [ { #category : #visiting } MSEPythonToFamixImporterVisitor >> visitDottedName: anDottedNameNode [ - ^ anDottedNameNode value + ^$. join: (anDottedNameNode names collect: [:name | self acceptNode: name]) ] { #category : #visiting } @@ -705,6 +713,11 @@ MSEPythonToFamixImporterVisitor >> visitInterpolatedString: anInterpolatedString ^(anInterpolatedString topParent completeSource copyFrom: anInterpolatedString startPosition to: anInterpolatedString stopPosition) asString ] +{ #category : #visiting } +MSEPythonToFamixImporterVisitor >> visitName: aName [ + ^self acceptNode: aName name +] + { #category : #visiting } MSEPythonToFamixImporterVisitor >> visitPower: anInvocation [ @@ -721,6 +734,14 @@ MSEPythonToFamixImporterVisitor >> visitSimpleStmt: anSimpleStmtNode [ ^ super visitSimpleStmt: anSimpleStmtNode ] +{ #category : #visiting } +MSEPythonToFamixImporterVisitor >> visitSmaCCToken: aSmaCCToken [ + "introducing this additional visit method regularity of treatment + see also extension method to SmaCCToken" + + ^aSmaCCToken value +] + { #category : #visiting } MSEPythonToFamixImporterVisitor >> visitString: aStringNode [ diff --git a/src/MoosePy/SmaCCToken.extension.st b/src/MoosePy/SmaCCToken.extension.st new file mode 100644 index 0000000..598f725 --- /dev/null +++ b/src/MoosePy/SmaCCToken.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #SmaCCToken } + +{ #category : #'*MoosePy' } +SmaCCToken >> acceptVisitor: aSmaCCNodeVisitor [ + ^aSmaCCNodeVisitor visitSmaCCToken: self +] From cd5557796b06f4fb8790cee6a9c43d559221f871 Mon Sep 17 00:00:00 2001 From: anquetil Date: Fri, 29 Dec 2023 11:16:13 +0100 Subject: [PATCH 21/31] refactored treatment of imports --- .../FamixPythonImport.class.st | 13 ++++ .../MSEPythonToFamixImporterVisitor.class.st | 61 ++++++++----------- 2 files changed, 39 insertions(+), 35 deletions(-) diff --git a/src/Famix-Python-Entities/FamixPythonImport.class.st b/src/Famix-Python-Entities/FamixPythonImport.class.st index 1fce4f1..515b429 100644 --- a/src/Famix-Python-Entities/FamixPythonImport.class.st +++ b/src/Famix-Python-Entities/FamixPythonImport.class.st @@ -37,6 +37,19 @@ FamixPythonImport >> asName: anObject [ asName := anObject ] +{ #category : #printing } +FamixPythonImport >> displayStringOn: aStream [ + + aStream + nextPutAll: 'a ' ; + nextPutAll: self class name ; + nextPutAll: '('. + self fromName displayStringOn: aStream. + aStream nextPutAll: ' -> '. + self entityName displayStringOn: aStream. + aStream nextPutAll: ')' +] + { #category : #accessing } FamixPythonImport >> entityName [ diff --git a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st index e074c07..1071a74 100644 --- a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st +++ b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st @@ -89,27 +89,23 @@ MSEPythonToFamixImporterVisitor >> createFunction: aFunctionNode [ ] -{ #category : #visiting } -MSEPythonToFamixImporterVisitor >> createImport: anImport ofName: aName [ +{ #category : #'private-entity-creation' } +MSEPythonToFamixImporterVisitor >> createImport: anImport ofName: aName from: fromName alias: alias [ | import module | - (self ensureImport: anImport hasName: aName) ifTrue: [ "this will not work when we have - import pygame.foo - an import node should provide fullname which would return pygame.foo" - import := FamixPythonImport new. - import entityName: aName. - anImport renames ifNotEmpty: [ - import asName: (anImport renames at: 1) value asString ]. + import := model newImport + entityName: aName ; + asName: alias ; + fromName: fromName ; + yourself. - anImport from ifNotNil: [ - import fromName: (self importFromName: anImport from) ]. + self setSourceAnchor: import from: anImport. - import mooseModel: model. - module := self ensureModule: anImport parent parent. - import manualImportingEntity: module. - module manualAddImport: import ]. + module := self ensureModule: anImport parent parent. + import manualImportingEntity: module. + module manualAddImport: import. - ^ self setSourceAnchor: import from: anImport + ^import ] { #category : #'private-entity-creation' } @@ -198,23 +194,16 @@ MSEPythonToFamixImporterVisitor >> ensureFunction: aFunctionNode [ ] { #category : #'private-entity-creation' } -MSEPythonToFamixImporterVisitor >> ensureImport: aImportNode [ - - | importNames | - importNames := self importNames: aImportNode. +MSEPythonToFamixImporterVisitor >> ensureImport: anImportNode of: importedNames from: aName aliases: aliasNames [ - importNames do: [ :importName | - (self importNamed: importName) ifNil: [ - self createImport: aImportNode ofName: importName ] ] -] - -{ #category : #'private-entity-creation' } -MSEPythonToFamixImporterVisitor >> ensureImport: aImportNode hasName: name [ - - | importNames | - importNames := self importNames: aImportNode. - - ^ importNames includes: name + importedNames withIndexDo: [ :importName :i | + (self importNamed: importName) ifNil: [ | alias | + aliasNames + ifEmpty: [ alias := nil ] + ifNotEmpty: [ alias := aliasNames at: i ]. + self createImport: anImportNode ofName: importName from: aName alias: alias + ] + ] ] { #category : #'private-entity-creation' } @@ -701,10 +690,12 @@ MSEPythonToFamixImporterVisitor >> visitIf: anIfiNode [ { #category : #visiting } MSEPythonToFamixImporterVisitor >> visitImport: anImport [ - self ensureImport: anImport. - ^ super visitImport: anImport - + ^self + ensureImport: anImport + of: (anImport names collect: [ :name | self acceptNode: name ]) + from: (self acceptNode: anImport from) + aliases: (anImport renames collect: [ :alias | self acceptNode: alias ]) ] { #category : #visiting } From 621f2545d78bb7fef39412beed4a3dc31c9d7676 Mon Sep 17 00:00:00 2001 From: anquetil Date: Fri, 29 Dec 2023 11:17:14 +0100 Subject: [PATCH 22/31] new import test --- src/MoosePy/MSEPythonImporterTest.class.st | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/MoosePy/MSEPythonImporterTest.class.st b/src/MoosePy/MSEPythonImporterTest.class.st index 0b5b492..0252017 100644 --- a/src/MoosePy/MSEPythonImporterTest.class.st +++ b/src/MoosePy/MSEPythonImporterTest.class.st @@ -328,6 +328,24 @@ import matplotlib.pyplot as plt equals: 'plt' ] +{ #category : #'tests - module' } +MSEPythonImporterTest >> testImportModulesWithAliases [ + + importer accept: (self parseCode: ' +import math as m, matplotlib.pyplot as plt +'). + + self assert: (importer importNamed: 'math') isNotNil. + self + assert: (importer importNamed: 'math') asName + equals: 'm'. + + self assert: (importer importNamed: 'matplotlib.pyplot') isNotNil. + self + assert: (importer importNamed: 'matplotlib.pyplot') asName + equals: 'plt' +] + { #category : #'tests - module' } MSEPythonImporterTest >> testImportMultiClassesFromModule [ From 3ab2794ebf30a9df4caa4a78c5d462ebd91a9e64 Mon Sep 17 00:00:00 2001 From: anquetil Date: Fri, 29 Dec 2023 11:23:29 +0100 Subject: [PATCH 23/31] removed smoke test --- src/MoosePy/MSEPythonImporterTest.class.st | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/MoosePy/MSEPythonImporterTest.class.st b/src/MoosePy/MSEPythonImporterTest.class.st index 0252017..f8121b6 100644 --- a/src/MoosePy/MSEPythonImporterTest.class.st +++ b/src/MoosePy/MSEPythonImporterTest.class.st @@ -525,14 +525,6 @@ MSEPythonImporterTest >> testModule [ ] -{ #category : #'tests - module' } -MSEPythonImporterTest >> testModuleIsModel [ - - importer accept: pyDoc. - importer model entityNamed: 'Main Module'. - -] - { #category : #'tests - module' } MSEPythonImporterTest >> testModuleKnowsItsImport [ From 235a949c8469ccf94fb8fc1c4c3ffc6fb10b9550 Mon Sep 17 00:00:00 2001 From: anquetil Date: Fri, 29 Dec 2023 11:23:42 +0100 Subject: [PATCH 24/31] refactored 2 tests --- src/MoosePy/MSEPythonImporterTest.class.st | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/MoosePy/MSEPythonImporterTest.class.st b/src/MoosePy/MSEPythonImporterTest.class.st index f8121b6..110fb1c 100644 --- a/src/MoosePy/MSEPythonImporterTest.class.st +++ b/src/MoosePy/MSEPythonImporterTest.class.st @@ -520,6 +520,8 @@ MSEPythonImporterTest >> testModule [ | module | importer accept: pyDoc. module := importer moduleNamed: self moduleName. + + self assert: module isNotNil. self assert: module class equals: FamixPythonModule. self assert: module name equals: self moduleName. @@ -556,6 +558,6 @@ MSEPythonImporterTest >> testTwoSiblingImportsHaveTheSameModule [ module := importer moduleNamed: self moduleName. self assert: import manualImportingEntity equals: module. self assert: import2 manualImportingEntity equals: module. - self assert: import manualImportingEntity == import2 manualImportingEntity + self assert: import manualImportingEntity equals: import2 manualImportingEntity ] From 2224310ff09b0c9b8d14638da94340f526037877 Mon Sep 17 00:00:00 2001 From: anquetil Date: Fri, 29 Dec 2023 11:25:20 +0100 Subject: [PATCH 25/31] removed MSEPythonSmaccToyingVisitor --- .../MSEPythonSmaccToyingVisitor.class.st | 53 ------------------- 1 file changed, 53 deletions(-) delete mode 100644 src/MoosePy/MSEPythonSmaccToyingVisitor.class.st diff --git a/src/MoosePy/MSEPythonSmaccToyingVisitor.class.st b/src/MoosePy/MSEPythonSmaccToyingVisitor.class.st deleted file mode 100644 index 423c3d9..0000000 --- a/src/MoosePy/MSEPythonSmaccToyingVisitor.class.st +++ /dev/null @@ -1,53 +0,0 @@ -Class { - #name : #MSEPythonSmaccToyingVisitor, - #superclass : #PyRootNodeVisitor, - #instVars : [ - 'classes', - 'functions' - ], - #category : #'MoosePy-Visitors' -} - -{ #category : #accessing } -MSEPythonSmaccToyingVisitor >> classes [ - ^ classes -] - -{ #category : #accessing } -MSEPythonSmaccToyingVisitor >> ensureClass: aClass [ - - ^ classes at: aClass cname value ifAbsentPut: [ aClass ] -] - -{ #category : #accessing } -MSEPythonSmaccToyingVisitor >> ensureFunction: aFunction [ - - ^ functions at: aFunction parent cname value, '.' , aFunction fname value ifAbsentPut: [ aFunction ] -] - -{ #category : #accessing } -MSEPythonSmaccToyingVisitor >> functions [ - ^ functions -] - -{ #category : #initialization } -MSEPythonSmaccToyingVisitor >> initialize [ - - super initialize. - classes := Dictionary new. - functions := Dictionary new. -] - -{ #category : #generated } -MSEPythonSmaccToyingVisitor >> visitClassdef: aClassDef [ - - self ensureClass: aClassDef. - super visitClassdef: aClassDef -] - -{ #category : #generated } -MSEPythonSmaccToyingVisitor >> visitFuncdef: aFuncdef [ - - self ensureFunction: aFuncdef. - super visitClassdef: aFuncdef -] From 6a6804e9e0aa83afa44658d4d36f521adcd03713 Mon Sep 17 00:00:00 2001 From: anquetil Date: Fri, 29 Dec 2023 11:27:57 +0100 Subject: [PATCH 26/31] removed 'layer' from Invocations: not standard Python --- .../MSEPythonToFamixImporterVisitor.class.st | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st index 1071a74..ffb8abe 100644 --- a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st +++ b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st @@ -117,12 +117,7 @@ MSEPythonToFamixImporterVisitor >> createInvocation: anInvocationNode [ invocDict := self extractInvocationInformation: anInvocationNode. - - self updateLayer:(invocDict at: 'canditate'). - - invocation sender: sender top. - invocation cacheAt: 'layer' put: layer. invocation cacheAt: 'canditate' put: (invocDict at: 'canditate'). invocation cacheAt: 'args' put: (invocDict at: 'args'). invocation cacheAt: 'receiver' put: (invocDict at: 'receiver'). @@ -608,16 +603,6 @@ MSEPythonToFamixImporterVisitor >> signatureFromInvocation: anInvocationNode [ ^ signature copyWithoutAll: '"' ] -{ #category : #'private-entity-creation' } -MSEPythonToFamixImporterVisitor >> updateLayer: anInvocationCandiateName [ - - anInvocationCandiateName ifNotNil: [ - ((anInvocationCandiateName beginsWith: 'Conv') - | (anInvocationCandiateName beginsWith: 'Flatten') - | (anInvocationCandiateName beginsWith: 'Dense') )ifTrue: [ - layer := layer + 1 ]] -] - { #category : #visiting } MSEPythonToFamixImporterVisitor >> visitArgument: anArgumentNode [ From b1024305c35f7c325e9d33da7b0720d2127e6bec Mon Sep 17 00:00:00 2001 From: anquetil Date: Fri, 29 Dec 2023 11:28:12 +0100 Subject: [PATCH 27/31] removed method no longer used --- src/MoosePy/MSEPythonToFamixImporterVisitor.class.st | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st index ffb8abe..1432948 100644 --- a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st +++ b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st @@ -403,16 +403,6 @@ MSEPythonToFamixImporterVisitor >> importNamed: aString [ ifNone: [ nil ] ] -{ #category : #'private-entity-creation' } -MSEPythonToFamixImporterVisitor >> importNames: anImportNode [ - - | result | - result := anImportNode names collect: [ :name | - self visitDotOptDottedName: name ]. - - ^ result -] - { #category : #'accessing - methods' } MSEPythonToFamixImporterVisitor >> imports [ From 8926dd1cb7a48597ce67b4989eb357660621f8ee Mon Sep 17 00:00:00 2001 From: anquetil Date: Fri, 29 Dec 2023 11:29:03 +0100 Subject: [PATCH 28/31] removed method no longer used --- .../MSEPythonToFamixImporterVisitor.class.st | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st index 1432948..ec1ff2c 100644 --- a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st +++ b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st @@ -606,22 +606,6 @@ MSEPythonToFamixImporterVisitor >> visitClassdef: aClassDef [ ^ super visitClassdef: aClassDef ] -{ #category : #visiting } -MSEPythonToFamixImporterVisitor >> visitDotOptDottedName: aDotOptDottedNode [ - - - (aDotOptDottedNode isKindOf: PyDottedNameNode) ifFalse: [ ^ aDotOptDottedNode value ]. - - ^'.' join: (aDotOptDottedNode names collect: [ :name | - (name isKindOf: PyDottedNameNode) - ifTrue: [ self visitDottedName: name ]. - name value - ]) - - - -] - { #category : #visiting } MSEPythonToFamixImporterVisitor >> visitDottedName: anDottedNameNode [ From 8df9c05d6df088ae1928e523add2343205738f8c Mon Sep 17 00:00:00 2001 From: anquetil Date: Fri, 29 Dec 2023 11:50:10 +0100 Subject: [PATCH 29/31] removed methods that only called super --- .../MSEPythonToFamixImporterVisitor.class.st | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st index ec1ff2c..df6d5aa 100644 --- a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st +++ b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st @@ -593,12 +593,6 @@ MSEPythonToFamixImporterVisitor >> signatureFromInvocation: anInvocationNode [ ^ signature copyWithoutAll: '"' ] -{ #category : #visiting } -MSEPythonToFamixImporterVisitor >> visitArgument: anArgumentNode [ - - ^ super visitArgument: anArgumentNode -] - { #category : #visiting } MSEPythonToFamixImporterVisitor >> visitClassdef: aClassDef [ @@ -621,12 +615,6 @@ MSEPythonToFamixImporterVisitor >> visitFileInput: aFileInput [ ^ super visitFileInput: aFileInput ] -{ #category : #visiting } -MSEPythonToFamixImporterVisitor >> visitFor: anIForNode [ - - ^ super visitFor: anIForNode -] - { #category : #visiting } MSEPythonToFamixImporterVisitor >> visitFuncdef: aFuncdef [ "the parser does not make a difference between function and method, but a method is defined in a class and its first parameter is self." @@ -641,12 +629,6 @@ MSEPythonToFamixImporterVisitor >> visitFuncdef: aFuncdef [ ^ result ] -{ #category : #visiting } -MSEPythonToFamixImporterVisitor >> visitIf: anIfiNode [ - - ^ super visitIf: anIfiNode -] - { #category : #visiting } MSEPythonToFamixImporterVisitor >> visitImport: anImport [ @@ -677,13 +659,6 @@ MSEPythonToFamixImporterVisitor >> visitPower: anInvocation [ ^ super visitPower: anInvocation ] -{ #category : #visiting } -MSEPythonToFamixImporterVisitor >> visitSimpleStmt: anSimpleStmtNode [ - - - ^ super visitSimpleStmt: anSimpleStmtNode -] - { #category : #visiting } MSEPythonToFamixImporterVisitor >> visitSmaCCToken: aSmaCCToken [ "introducing this additional visit method regularity of treatment From b81d8acd40b18bbd422e2a6c2aeec7e59abbd6df Mon Sep 17 00:00:00 2001 From: anquetil Date: Fri, 29 Dec 2023 11:50:28 +0100 Subject: [PATCH 30/31] reindenting code --- src/MoosePy/MSEPythonToFamixImporterVisitor.class.st | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st index df6d5aa..ac781c9 100644 --- a/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st +++ b/src/MoosePy/MSEPythonToFamixImporterVisitor.class.st @@ -642,7 +642,10 @@ MSEPythonToFamixImporterVisitor >> visitImport: anImport [ { #category : #visiting } MSEPythonToFamixImporterVisitor >> visitInterpolatedString: anInterpolatedString [ - ^(anInterpolatedString topParent completeSource copyFrom: anInterpolatedString startPosition to: anInterpolatedString stopPosition) asString + ^(anInterpolatedString topParent completeSource + copyFrom: anInterpolatedString startPosition + to: anInterpolatedString stopPosition) + asString ] { #category : #visiting } From fa0f13ac25c41bcba3b6e52c96e9a314012ad0d6 Mon Sep 17 00:00:00 2001 From: anquetil Date: Fri, 29 Dec 2023 11:51:01 +0100 Subject: [PATCH 31/31] skipped Invocatin tests (invocations not imported) --- src/MoosePy/MSEPythonImporterTest.class.st | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/MoosePy/MSEPythonImporterTest.class.st b/src/MoosePy/MSEPythonImporterTest.class.st index 110fb1c..0e7ac46 100644 --- a/src/MoosePy/MSEPythonImporterTest.class.st +++ b/src/MoosePy/MSEPythonImporterTest.class.st @@ -378,6 +378,9 @@ from maths import add, subtract MSEPythonImporterTest >> testInvocation [ | invocations invocation | + + self skip: 'Invocations not treated in importer'. + importer accept: (self parseCode: ' grid[row].append(".") '). @@ -395,6 +398,8 @@ grid[row].append(".") { #category : #'tests - module' } MSEPythonImporterTest >> testInvocationInLoop [ + self skip: 'Invocations not treated in importer'. + importer accept: (self parseCode: ' append(".") '). @@ -405,6 +410,8 @@ append(".") { #category : #'tests - module' } MSEPythonImporterTest >> testInvocationInNestedLoop [ + self skip: 'Invocations not treated in importer'. + importer accept: (self parseCode: ' for row in array: test() @@ -418,6 +425,8 @@ for row in array: { #category : #'tests - module' } MSEPythonImporterTest >> testInvocationWithArrayReceiver [ + self skip: 'Invocations not treated in importer'. + importer accept: (self parseCode: ' for row in array: grid[row].append(".") @@ -429,6 +438,8 @@ for row in array: { #category : #'tests - module' } MSEPythonImporterTest >> testInvocationWithNumericalArguments [ + self skip: 'Invocations not treated in importer'. + importer accept: (self parseCode: ' test(4, 25) '). @@ -445,6 +456,8 @@ test(4, 25) { #category : #'tests - module' } MSEPythonImporterTest >> testInvocationWithReceiver [ + self skip: 'Invocations not treated in importer'. + importer accept: (self parseCode: ' grid.append(test) '). @@ -455,6 +468,8 @@ grid.append(test) { #category : #'tests - module' } MSEPythonImporterTest >> testInvocationWithStringReceiver [ + self skip: 'Invocations not treated in importer'. + importer accept: (self parseCode: ' "CNN_Model_Rebuilt/logs/{}".format(NAME) '). @@ -466,6 +481,9 @@ MSEPythonImporterTest >> testInvocationWithStringReceiver [ MSEPythonImporterTest >> testInvocationWithVariableArguments [ | invocation | + + self skip: 'Invocations not treated in importer'. + importer accept: (self parseCode: ' test(x, 25) ').