semvec/pypi-packages huggingface dataset:
cimrdf.py 2.1
Generate Python data structures from CIM RDF profiles, parse and serialize CIM-compliant information objects, according to IEC 61970-501 standard
Requires Python: >=3.6

# cimrdf.py
Generate Python data structures from CIM RDF profiles, parse and serialize CIM-compliant information objects, according to IEC 61970-501 standard.

## Installing

``` bash:
$ pip install cimrdf.py
```
or
``` bash:
$ git clone https://github.com/bressanmarcos/cimrdf.py.git
$ cd cimrdf.py
$ python setup.py install 
```

## Using
1. Create your CIM RDF artifact with your preferred utils
2. Convert it into Python data structures with:
```
cimrdfpy input-rdfs.xml output.py
```

## Creating CIM RDF instances
3a. Use the generated classes from output.py to create your instances
```
from output import *

ei = EquivalentInjection()
ei.mRID = 'EquivalentNW243'
t = Terminal()
t.sequenceNumber = 1
# This next command reciprocally associates the `t` Terminal to `ei` EquivalentInjection,
t.ConductingEquipment = ei
# but only if this association is well-defined in the RDFS document (inverseRoleName property).

t1 = Terminal(sequenceNumber=1)
t2 = Terminal()
t2.sequenceNumber = 2
s = Switch(mRID='SW12', normalOpen=True)
# All attributes with multiplicity greater than 1 are represented as lists
s.add_Terminals(t1)
# A special function `add_{attribute_name}` is generated to insert a single item into the list
s.add_Terminals(t2)

cn = ConnectivityNode()
cn.mRID = 'Node23'
# List-type attributes may also be declared in the following way:
cn.Terminals = [t1, t] 
```

4a. Create a new document instance with all objects
```
new_doc = DocumentCIMRDF()
new_doc.add_recursively(ei)
# >> All other linked objects will be automatically inserted into the document
```
The available methods for the `DocumentCIMRDF` class are:
  * ***new_doc.dump()***: Pretty-Print the document to stdout. Debug purposes only.
  * ***new_doc.pack()***: Generate the document's ElementTree (xml.etree.ElementTree) instance.
  * ***new_doc.tostring()***: Get the XML stringified version of the document.
  * ***new_doc.tofile()***: Save the XML stringified version of the document to a file.
  * ***new_doc.add_elements( ... )***: (Advanced users only) Insert one or a list of elements into the document.
  * ***new_doc.add_recursively( ... )***: (Recommended) Insert one or a list of elements into the document including its linked elements.
  
## Parsing CIM RDF instances
3b. Use proper functions to parse a file or a string.
```
new_doc = DocumentCIMRDF()
new_doc.fromstring(rdfstring)
print(new_doc.resources)
# >> [list of instances]
```
The available functions are:
  * ***new_doc.fromstring(rdfstring)***: Get list of instances from CIM RDF string.
  * ***new_doc.fromfile(filename)***: Get list of instances from CIM RDF file.

After being inserted or parsed from a string/file, the elements are stored and accessible from the `new_doc.resources` attribute.
django-improved-view 1.0
add some feature for django view and request

########################
django_improved_view
########################

1. parse request body when request method is PUT, PATCH.
2. support json request body.
3. add expcetion handle for CBV(Class Based View)
4. add permission check for CBV



***********
Install
***********

.. code:: bash

   $: pip install django_improved_view


*********
Usuage
*********

.. code:: python

    from django_improved_view import exceptions, permissions
    from django_improved_view.response import APIResponse
    from django_improved_view.views import APIView
    from django_improved_view.permissions import BasePermission


    class BasicAuthRequiredError(exceptions.APIException):
        HTTP_STATUS_CODE = 401
        ERROR_CODE = 10000


    class TokenRequired(BasePermission):
        def __call__(self):
            if not self.request.headers.get('Authorization'):
                raise BasicAuthRequiredError(user_hint='basic auth required')


    class PermissionView(APIView):
        method_perms = {'POST': [TokenRequired]}

        def post(self, request):
            return APIResponse.ok({})



*************
Test
*************


.. code:: python

   $: pytest tests
pyminer-algorithms-document-server 0.0.5
A small documentation server for PyMiner
Requires Python: >=3.8

# PyMiner Documentation Server

This is a simple documentation server, mainly for PyMiner.

# PyMiner文档服务器

这是一个简单的文档服务器，使用传统的后端渲染技术，主要采用了以下框架：

1. WSGI服务器：`waitress`
1. 后端服务器：`flask`
1. Markdown：`markdown`
1. 样式预处理器：`sass`

目前非常不完善，只是一个临时的小服务器，欢迎各位一起完善。

# 接口

目前主要考虑两个接口：

创建服务器：`server = Server(base_path)`

启动服务器：`server.run()`

打开特定页面：`server.show(path: str)`。
这将直接调用`webbrowser.open`打开一个网页。

这个特定页面的路径应该是基于服务器的根路径`base_path`的相对路径，例如：

```python
import os

from pyminer_algorithms_document_server.server import Server

if __name__ == '__main__':
    server = Server(os.path.join(os.path.dirname(__file__), 'base'))
    server.run()
    server.show('lib1/func1.md')
    from time import sleep

    sleep(10)
```

应当注意的是，服务器跑在`dameon`线程中，当主程序退出时，子线程也会随之退出。

# 致谢

感谢nwljy提供的初版代码！