Saravanan666/pypi-org huggingface dataset:
Package: megrok.menu
This package allows you to register browser menus and menu items for
browser views in Grok.A menu is easily registered by creating a subclass ofmegrok.menu.Menu:import megrok.menu.Menu

class Tabs(megrok.menu.Menu):
    grok.name('tabs')
    grok.title('Tabs')
    grok.description('')A view can then placed on a menu with themenuitemdirective:class Edit(grok.View):
    grok.title('Edit')
    grok.description("Change this object's data.")
    megrok.menu.menuitem('tabs')

    ...Thetitleanddescriptiondirectives used here specifie the
menu item’s label and description.  Themenuitemdirective takes
at least one argument, the menu that the item is registered to be for.
This can either be an identifier string or the menu class
itself. Other optional parameters includeicon,filter,orderandextra.For more use cases and examples, take a look to tests/test_functional.pyChangelog0.4.1 (2016-02-16)Update tests.0.4 (2010-03-06)Cleaned the tests module. Now, we only use the ZTK packages to test.The dependencies have been cleared. We no longer depend on zope.app
packages.Updated the security grokking in the menu items grokker. We don’t
need the protect_getattr, as the view security grokker already does
it for us.Fixed the dependencies in the package requires. All dependencies are
now clearly declared.Added a LICENSE.txt file for the ZPL 2.1.0.3 (2009-11-02)Added the support of the grokcore.viewlet ‘order’ directive to
reorder the menu items and sub menus. This permits to have a
baseclass defining the basic menu and to keep the ordering
possibility in the sublasses. We probably should do that for the
different arguments of the menuitem directive. That would allow more
genericity and reusability. Note : this change is 100% backward
compatible. Simply added tests to show the behavior. [trollfot]Get rid of the grok dependency. Now depends only on grokcore.* packagesUpdated the build process0.2 (2009-03-02)Compatible with grok1.0a1Add the SubMenuItem base class and it’s grokker SubMenuItemGrokkerAdd theextraparameter to the menuitem directiveTests for added functionalityRemove version.cfg0.1 (2008-07-12)Initial release.
Package: megrok.nozodb
The main purpose of this package is to provide support for
enabling Grok applications to be run as aster served WSGI
applications without using the zodb.Using megrok.nozodbTo setup a grok environment which works without the zodb you
have to replace the paster-application-factory which typically is
located in the debug.ini and in the deploy.ini: To be concrete
replace grokcore.startup#… with megrok.nozodb#nozodb[app:grok]
use = egg:megrok.nozodb#nozodbThe next you have to do is setting up global utility which
acts as an ApplicationRoot which is a  starting point for your application.
megrok.nozodb has an ungrokked default one.  You can subclass from it or
provide your own stuff which acts as ApplicationRoot.:>>> from megrok.nozodb import ApplicationRoot

>>> class MyApplicationRoot(ApplicationRoot):
...     pass

>>> myapp = MyApplicationRoot()
>>> from zope.site.interfaces import IRootFolder
>>> IRootFolder.providedBy(myapp)
True

>>> from grok.interfaces import IApplication
>>> IApplication.providedBy(myapp)
True

>>> from zope.location import ILocation
>>> ILocation.providedBy(myapp)
True

>>> from zope.interface.verify import verifyObject
>>> from zope.component.interfaces import ISite
>>> verifyObject(ISite, myapp)
TrueAPI DocumentationWe have to create a simple site definition file, which is also quite
plain:>>> import os, tempfile
 >>> temp_dir = tempfile.mkdtemp()

 >>> sitezcml = os.path.join(temp_dir, 'site.zcml')
 >>> open(sitezcml, 'w').write('<configure />')

 >>> zope_conf = os.path.join(temp_dir, 'zope.conf')
 >>> open(zope_conf, 'wb').write('''
 ... site-definition %s
 ...
 ... <zodb>
 ... </zodb>
 ...
 ... <eventlog>
 ...   <logfile>
 ...     path STDOUT
 ...   </logfile>
 ... </eventlog>
 ... ''' %sitezcml)


 >>> from megrok.nozodb import nozodb_factory
 >>> app_factory = nozodb_factory({'zope_conf': zope_conf})

Clean up the temp_dir

  >>> import shutil
  >>> shutil.rmtree(temp_dir)Changelog0.1 (2010-11-04)Initial release
Package: megrok.pagelet
MEGROK PAGELET==============This package try to bring the functionality of z3c.template andz3c.pagelet to grok.z3c.template gives us a alternative for the zpt:metal layout based system in grok.The z3c.pagelet has the advantage that it´s possible to register layouts withhelp ofthe zope-component-architecuture this allows us to change or modify layoutswithout touching the *master* macro.This means you have megrok.pagelet.Layout component which holdsthe layout. Instead of using grok.View you have to takemegrok.pagelet.Pagelet for normal BrowserViews.If you need more information about z3c.template please look here [1].The Layout----------The first thing we have to do is set up a layout for our pagelet.class MyLayout(megrok.pagelet.Layout):grok.context()grok.layer()megrok.pagelet.template('my_layout_template.pt')This configures the template ('my_layout_template.pt') as a layout for the givencontext and layer. Of course it´s possible to specify differentlayouts for different layers or contexts.In the content of my_layout_template.pt is something like this:<html><body><div class="layout" tal:content="structure view/render">here comes the content</div></body></html>The Pagelt (View)-----------------Ok instead of using the common grok.View for our BrowserViews we use nowmegrok.pagelet.Paglet. This component has one difference to a normalgrok.View. This difference is in the __call__ method of the megrok.pagelet.Pagelet.This means that the  __call__ method of a  Pagelet does not only return the renderd"template" of the Pagelet. The __call__ first search for the layout in given contextand layer and  then it renders the "template" in this layout.class View(megrok.pagelet.Pagelet)grok.context()grok.layer()grok.name()def render(self)return "..."Now if you point your browser on .../view you sould see the renderd view in thegiven layout.[1] http://pypi.python.org/pypi/z3c.template/1.1.0trunk (2009-03-24)==================- xxx0.1 (2009-03-24)------------------Initial release as egg.
Package: megrok.rendersource
Grok source renderersFirst take on making the zope.app.render classes available from Grok templates.RestructuredText: template files with ‘.rst’ extensionrenders a complete HTML page, including embedded stylesheet (default)
or with a configurable external stylesheetInstallationAdd ‘megrok.rendersource’ to the ‘install_requires’ list in your packages ‘setup.py’.
Run buildout again.
Template reloading is available in developer mode only:
add ‘devmode on’ to the ‘zope.conf = ‘ line in your buildout.cfgConfigurationTo configure the stylesheet used with your template, add a method ‘namespace’
to your view class:class Overview(grok.View):

    def namespace(self):
        # compute the stylesheet path to the file inside the 'static' folder,
        # eg. 'grok.css'
        stylesheet=self.static['grok.css']()
        # enable absolut URL handling, disable embedding
        return {'settings_overrides': {'stylesheet': stylesheet,
                                       'stylesheet_path': None,
                                       'embed_stylesheet': 0,
                                       'input_encoding': 'utf-8',
                                       'output_encoding': 'utf-8',
                                       }}Other docutils related options can be added to the ‘settings_overrides’
dictionary. CF grok_overview.txt for more info on the namespace method.Changes0.5.1 (2010-03-10)added the long description…0.5 (2010-03-10)upgrade to grok version 1.1rc1changed the project namespace from d2m.rendersource to megrok.rendersource
Package: megrok.resourceviewlet
megrok.resourceviewletis a package meant to include resources
using layer, context and view discriminations.SetupLet’s import and init the necessary work environment:>>> import grokcore.component as grok
>>> from grokcore import view, viewlet
>>> from zope.app.wsgi.testlayer import Browser

>>> browser = Browser()
>>> browser.handleErrors = FalseLibraryWe first declare a resource. We’ll include it in our page:>>> from fanstatic import Resource, Library
>>> myLibrary = Library('test_library', 'ftests/resources')
>>> Thing = Resource(myLibrary, 'thing.js')This step is done by an entry point. For the testing, we do it by hand:>>> from zope.fanstatic.zcml import create_factory
>>> from zope.component import getGlobalSiteManager
>>> from zope.publisher.interfaces.browser import IBrowserRequest
>>> from zope.interface import Interface

>>> resource_factory = create_factory(myLibrary)
>>> getGlobalSiteManager().registerAdapter(
...      resource_factory, (IBrowserRequest,), Interface, myLibrary.name)ComponentsTo demonstrate our resource viewlet, we first need a page to
render. This page contains a content provider named ‘resources’:>>> from zope.interface import Interface

>>> class Index(view.View):
...   view.require("zope.Public")
...   view.context(Interface)
...
...   template = view.PageTemplate("""<html><head>
...     <tal:resources replace='provider:resources' />
...   </head></html>""")

>>> grok.testing.grok_component('index', Index)
TrueManagerWe now register a content provider named ‘resources’. It will be a
ResourcesManager. An ResourcesManager is a component
dedicated in rendering ResourceViewlets:>>> from megrok.resourceviewlet import ResourcesManager

>>> class Resources(ResourcesManager):
...   viewlet.context(Interface)

>>> grok.testing.grok_component('resources', Resources)
TrueViewletNow, we register a ResourceViewlet, including our resource. The
declaration is very straightforward:>>> from megrok.resourceviewlet import ResourceViewlet

>>> class SomeViewlet(ResourceViewlet):
...   viewlet.context(Interface)
...   resources = [Thing]

>>> grok.testing.grok_component('viewlet', SomeViewlet)
TrueBy default, a ResourceViewlet is registered for an instance of
ResourcesManager. Most of the time, a page contains only one of
these content providers. If it’s not the case, make sure to provide
your ownviewletmanagerdirective value.RenderingRendering our page should render the ResourcesManager and
therefore, include our resource:>>> browser.open('http://localhost/@@index')
>>> print browser.contents
<html><head>
  <script type="text/javascript"
   src="http://localhost/fanstatic/test_library/thing.js"></script>
</head></html>It works ! Enjoy.Changelog0.2 (2011-01-18)megrok.resourceviewletnow works and depends onfanstatic.Dependencies has been greatly reduced.0.1 (2009-12-24)Initial release
Package: megrok.strictrequire
megrok.strictrequireWhat is megrok.strictrequire?Strictrequire implements additional grokkers for the various view components
in Grok. These grokkers determine whether thegrok.requiredirective has
been explicitly set on the view component (or on its baseclass).It will raise an error (and thus prevent the startup of the application) if
there’s a view component without an explicit use of thegrok.requiredirective, providing a minimal safety net for finding unprotected views in
your application.Making use of megrok.strictrequireTo enable megrok.strictrequire simply list it as a requirement in your
projects’ssetup.py. Grok based applications that were bootstrapped with
a recent version of thegrokprojectcommand will automatically include
the megrok.strictrequire’sconfigure.zcmlmaking the additional grokkers
effective.CaveatIf your applications triggers the registration of “third-party” views that do
not themselves specifically use thegrok.requiredirective, your
application will not start.If you decide you still want to make use of the third-aprty views you should
make sure the inclusion of theconfigure.zcmlof megrok.strictrequire
comesafterthe inclusion of the third-party package by tweaking your
applications’sconfigure.zcml. For example:<configure xmlns="http://namespaces.zope.org/zope"
           xmlns:grok="http://namespaces.zope.org/grok">
  <include package="grok" />

  <!-- include this package before mgrok.strictrequire is included -->
  <include package="package_with_unprotected_views" />

  <!-- includeDependencies will include megrok.strictrequire -->
  <includeDependencies package="." />
  <grok:grok package="." />
</configure>Changelog of megrok.strictrequire4.0 (2024-01-25)Drop support for Python 2.7, 3.4, 3.5, 3.6.Drop support forgrok < 5, thus dropping support for JSON, REST and
XMLRPC.Add support for Python 3.7, 3.8, 3.9, 3.10, 3.11, 3.12.3.0.0 (2018-01-17)Python 3 compatibility.0.7 (2018-01-10)Dependencies update in preparation of Python2/3 migration.0.6 (2013-10-16)Add grokker for grok.Page components.0.5 (2011-07-19)Reflect recent changes in grok 1.8.0.4 (2011-07-11)Use the groktoolkit versions.Don’t check the requirement directive for ViewletManager, as these are
not exposed as views.0.3 (2010-05-18)Test-requirements have been fixed. They formally include zope.app.testing for
the moment.0.2 (2009-06-22)Check ViewletManager and Viewlet components too.0.1 (2009-06-18)Initial release.
Package: megrok.tinymce
megrok.tinymce: tinymce packaged for GrokThis is a Grok extension that packagesTinyMCE, a Javascript HTML
WYSIWYG editor control.Simply includemegrok.tinymceas a dependency in your project’ssetup.pyto make it available in your project.To construct URLs to TinyMCE javascript libraries, use something like this:<script type="text/javascript"
  tal:attributes="src context/@@/TinyMCE/tiny_mce.js"></script>Alternatively you can also declare that your template or Python code
needs the widget somewhere in the code path that’s executed during the
display of the page. In a page template this looks like this:<tal:block replace="resource_library:TinyMCE"/>In Python code you can do the following:from megrok.tinymce import TinyMCE

def mywidgetcode():
   ...
   TinyMCE.need()
   ...Changes3.1.0.1.1 (2008-08-07, TinyMCE release date: 2008-06-18)Turn off zip-safe-ness insetup.py. This makes this package actually
get registered properly usingz3c.autoinclude.3.1.0.1 (2008-08-07, TinyMCE release date: 2008-06-18)Package version 3.1.0.1 of TinyMCE.
Package: megrok.yui
megrok.yui: YUI packaged for GrokThis is a Grok extension that packages YUI (the Yahoo User Interface
Library) for Grok. Simply includemegrok.yuias a dependency in
your project’ssetup.pyto make it available.To construct URLs to YUI javascript libraries, use something like this:<script type="text/javascript"
  tal:attributes="src context/@@/YUI/menu/menu.js"></script>To construct URLs to YUI css libraries, use something like this:<link rel="stylesheet" type="text/css"
   tal:attributes="href context/@@/YUI/reset/reset.css" />Changes2.5.2.1 (2008-08-08, YUI release date: 2008-05-28)The egg shouldn’t be zip-safe.2.5.2 (2008-08-07, YUI release date: 2008-05-28)Package version 2.5.2 of YUI.
Package: megrok.z3cform.composed
megrok.z3cform.composedis a package dedicated to define and
register composed forms. Composed forms are forms built from a
collection of sub forms.megrok.z3cform.composedis based onz3c.formandmegrok.z3cform.base.Getting startedWe import the needed dependencies:>>> import grokcore.view as grok
>>> import megrok.z3cform.composed
>>> from megrok.z3cform.composed import ComposedForm, SubFormWe import the components utilities:>>> from zope.component import getMultiAdapter
>>> from zope.publisher.browser import TestRequestDefining a composed formContextA form needs a context. Let’s create a simple model for test purposes:>>> class MyContent(object):
...    passDeclaration>>> class Form(ComposedForm):
...   grok.context(MyContent)Registration>>> grok_component('composed', Form)
TrueQuery>>> content = MyContent()
>>> request = TestRequest()>>> composed = getMultiAdapter((content, request), name="form")
>>> composed
<megrok.z3cform.composed.tests.Form object at ...>>>> composed.subforms
[]>>> composed.updateForm()
>>> composed.subforms
[]Defining sub formsDeclaration>>> class SubFormOne(SubForm):
...     grok.context(MyContent)
...     megrok.z3cform.composed.order(2)
...     megrok.z3cform.composed.view(Form)>>> class SubFormTwo(SubForm):
...     grok.context(MyContent)
...     megrok.z3cform.composed.order(1)
...     megrok.z3cform.composed.view(Form)Registration>>> grok_component('one', SubFormOne)
True>>> grok_component('one', SubFormTwo)
TrueQuery>>> composed.subforms
[]>>> composed.updateForm()
>>> composed.subforms
[<megrok.z3cform.composed.tests.SubFormTwo object at ...>, <megrok.z3cform.composed.tests.SubFormOne object at ...>]>>> for sub in composed.subforms:
...   print sub.prefix, sub.parentForm
subformtwo <megrok.z3cform.composed.tests.Form object at ...>
subformone <megrok.z3cform.composed.tests.Form object at ...>Changelog0.1 (2009-10-27)Initial release
Package: megrok.z3cform.crud
CrudThis module gives you an abstract base class to make CRUD forms with.
These forms give you by default a tabular view of the objects, where
attributes of the object can be edited in-place.  Please refer to theICrudForminterface for more details.>>> from megrok.z3cform.crud import crudForm registrationModelsWe set up some models to serve as a form context:>>> import grokcore.component as grok
>>> from zope import interface, schema

>>> class IPerson(interface.Interface):
...    name = schema.TextLine(title=u"Name")
...    age = schema.Int(title=u"Age")

>>> class Person(grok.Context):
...    grok.implements(IPerson)
...    name = schema.fieldproperty.FieldProperty(IPerson['name'])
...    age = schema.fieldproperty.FieldProperty(IPerson['age'])
...
...    def __init__(self, name, age):
...        self.name = name
...        self.age = age

>>> class IPersonContainer(interface.Interface):
...    pass

>>> class PersonContainer(dict):
...    grok.implements(IPersonContainer)For this test, we take the the name of our persons as keys in our
storage:>>> storage = PersonContainer()
>>> storage['Peter'] = Person(u'Peter', 16)
>>> storage['Martha'] = Person(u'Martha', 32)We declare the Form with the help of megrok.z3cform.base. It’s very similar to a grok.View:>>> import megrok.z3cform.base as z3cform

>>> class TestForm(crud.CrudForm):
...    grok.context(IPersonContainer)
...
...    update_schema = IPerson
...
...    def get_items(self):
...        return sorted(storage.items(), key=lambda x: x[1].name)
...
...    def add(self, data):
...        person = Person(**data)
...        storage[str(person.name)] = person
...        return person
...
...    def remove(self, (id, item)):
...        del storage[id]Grokking and queryingWe let Grok register the component:>>> grok.testing.grok_component('form', TestForm)
TrueNow, we can query it normally:>>> from zope.publisher.browser import TestRequest
>>> request = TestRequest()

>>> from zope.component import getMultiAdapter
>>> myform = getMultiAdapter((storage, request), name="testform")

>>> myform
<TestForm object at ...>
>>> print myform()
<form action="http://127.0.0.1" method="post"
        enctype="multipart/form-data" class="form-testform">
...Changelog0.1Initial release
Package: megrok.z3cform.ui
This package is a wrapper/helper around megrok.z3cform.base and
z3c.formui. This means if you use megrok.z3cform.base and you want
benefit form the already existent default forms form z3c.formui,
just add megrok.z3cform.ui to your install_requires in your setup.py
and you are fine.In general megrok.z3cform.ui does nothing more then installing
z3c.formui. And it marks the default with the IDivFormLayer interface
from z3c.formui. So you will get your form in a nice div-based
layout.Changelog0.5 (2009-10-26)Adding a nice version number.0.2 (2009-10-26)Added a Readme.0.1 (2009-10-26)Initial release
Package: megspikes
MEG-SPIKESThis repository contains functions for detecting, analyzing and evaluating epileptic spikes in MEG recording.InstallationOptionallycreate a fresh virtual environment:condacreate-nmegspikespippython=3.7The easiest way to install the package is using pip:pipinstallmegspikesTo install the latest version of the package, you should clone the repository and install all dependencies:gitclonehttps://github.com/MEG-SPIKES/megspikes.gitcdmegspikes/
pipinstall.ExamplesExamples of how to use this package are prepared in theJupyter Notebooks.0_simulation.ipynb: simulation used to test this package and in other examples.1_manual_pipeline.ipynb: localization of the irritative area for already detected (simulated) spikes.2_aspire_alphacsc_pipepline.ipynb: full spikes detection pipeline and visualization of each step.DocumentationASPIRE AlphaCSC pipelineFull detection pipeline is presented on the figure below. The image was created usingScikit-learnPipelinemodule.To reproduce this picture see2_aspire_alphacsc_pipepline.ipynb.As is it depicted on the figure, ASPIRE-AlphaCSC pipeline includes the following main steps:ICA decompositionICA components localizationICA components selectionICA peaks localizationICA peaks cleaningAlphaCSC decompositionAlphaCSC atoms localizationAlphaCSC events selectionAlphaCSC atoms mergingAlphaCSC atoms goodness evaluationAlphaCSC atoms selectionClusters localization and the irritative area predictionIrritative zone prediction pipeline is presented on the figure below. The image was created usingScikit-learnPipelinemodule.To reproduce this picture see2_aspire_alphacsc_pipepline.ipynband1_manual_pipeline.ipynb.Parametersaspire_alphacsc_default_params.ymlincludes all default parameters that were used to run spike detection using combination of ASPIRE[2]and AlphaCSC[1].clusters_default_params.ymldescribes all the parameters that were used for the irritative area prediction based on the detected events and their clustering.DependenciesAnalysisalphacscmnenibabelnumpyscikit-learnscipyData storingpyyamlpandasopenpyxlxarraynetCDF4Visualizationmatplotlibnilearnpanelparamnotebookhvplotpyqt5pyvistapyvistaqtTestingpytestContributingAll contributors are expected to follow thecode of conduct.References[1]La Tour, T. D., Moreau, T., Jas, M., & Gramfort, A. (2018). Multivariate Convolutional Sparse Coding for Electromagnetic Brain Signals. ArXiv:1805.09654 [Cs, Eess, Stat].http://arxiv.org/abs/1805.09654[2]Ossadtchi, A., Baillet, S., Mosher, J. C., Thyerlei, D., Sutherling, W., & Leahy, R. M. (2004). Automated interictal spike detection and source localization in magnetoencephalography using independent components analysis and spatio-temporal clustering. Clinical Neurophysiology, 115(3), 508–522.https://doi.org/10.1016/j.clinph.2003.10.036