Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# externals
import os
import merlin
# declaration
class User(merlin.component, family='pyre.user'):
"""
Encapsulation of user specific information
"""
# public data
name = merlin.properties.str()
email = merlin.properties.str()
affiliation = merlin.properties.str()
uid = os.getuid()
home = os.environ['HOME']
username = os.environ['LOGNAME']
#
# externals
import merlin
# declaration
class PackageManager(merlin.component, family='merlin.components.package-manager'):
"""
The component that manages the package archive
"""
# properties
hostname = merlin.properties.str()
hostname.doc = "the name of this machine"
# interface
def find(self, uri):
"""
Locate the package using {uri} as its address
"""
executive = self.pyre_executive
# ask the executive to locate the spell factory
shelf = executive.retrieveComponentDescriptor(uri=uri, context=self)
print(shelf)
def shelves(self, name, folder):
# externals
import os
import merlin
# declaration
class User(merlin.component, family='pyre.user'):
"""
Encapsulation of user specific information
"""
# public data
name = merlin.properties.str()
email = merlin.properties.str()
affiliation = merlin.properties.str()
uid = os.getuid()
home = os.environ['HOME']
username = os.environ['LOGNAME']
#
# externals
import merlin
# declaration
class About(merlin.spell, family='merlin.spells.about'):
"""
Display information about this application
"""
# user configurable state
prefix = merlin.properties.str()
prefix.tip = "specify the portion of the namespace to display"
# class interface
@merlin.export(tip="print the copyright note")
def copyright(self, plexus, **kwds):
"""
Print the copyright note of the merlin package
"""
# make some space
plexus.info.line()
# print the copyright note
plexus.info.log(merlin.meta.header)
# all done
return
# externals
import os
import merlin
# declaration
class Initializer(merlin.spell):
"""
Create a new merlin project rooted at the given directory
"""
# public state
project = merlin.properties.str(default=None)
project.doc = 'the name of the project'
createPrefix = merlin.properties.bool(default=False)
createPrefix.aliases.add('create-prefix')
createPrefix.doc = 'create all directories leading up to the specified target'
force = merlin.properties.bool(default=False)
force.doc = 'initialize the target folder regardless of whether is it already part of a project'
# class interface
@merlin.export
def main(self, plexus, argv):
"""
Make {folder} the root of a new merlin project. The target {folder} is given as an
optional command line argument, and defaults to the current directory. Issue an error
# externals
import pickle
# the framework
import merlin
# declaration
class Curator(merlin.component, family="merlin.components.curator"):
"""
The component that manages the project persistent store
"""
# constants
projectURI = merlin.properties.str(default='/merlin/project/project.pickle')
projectURI.doc = 'the location of the persistent project state'
# interface
def loadProject(self):
"""
Retrieve the project configuration information from the archive
"""
# the fileserver
vfs = self.vfs
# get the project pickle
project = vfs[self.projectURI]
# retrieve the project instance from the file
return self.load(node=project)
# externals
import os
import merlin
# declaration
class User(merlin.component, family='pyre.user'):
"""
Encapsulation of user specific information
"""
# public data
name = merlin.properties.str()
email = merlin.properties.str()
affiliation = merlin.properties.str()
uid = os.getuid()
home = os.environ['HOME']
username = os.environ['LOGNAME']