Advanced Search
Search Results
99 total results found
Nextcloud + PHP headaches
Resolved Solution: The error was hiding in /var/log/apache2/error.log, and the solution was to reinstall php7.3-mysql to fix the missing .so files Troubleshooting steps Remember, you can run `sudo apt install phpVER phpVER-dep` Set default php installatio...
Set up your first Network
With Deepr it is quite easy to start making your own neural network model. This chapter will show you how to make your first neural network using Deepr. The goal of this project will be to sum two floating point numbers, lets get started! First we have to ins...
Compression
Using compress_pickle, we can override pyndb's default save_pickle and load_pickle functions (which are imported from pickle). Here's how it's done: from compress_pickle import dump, load import pyndb pyndb.save_pickle = lambda obj, fn, *args: dump(obj, fn)...
What is pyntree?
Overview pyntree is a python package which allows you to easily and syntactically save your data. Not only that, it also lets you save in multiple formats, and even serialize and compress data by merely changing a few characters. History The first iteration...
A basic program with pyntree
Let's take a simple, yet practical example. Let's say you've written a web service, and need to save user data and be able to send it to clients quickly. You also need to load several config files. Doing so with pyntree is easy and syntactic: from pyntree ...
File types
pyntree currently supports a plethora of file types, all of which can be encrypted: Pickle (default) Pickled data is python data saved directly to a file as bytes. This way, you can save objects (ex: datetime) without losing any data or causing any problems ...
The File object
The File object is a helper object to ensure data consistency across nodes. Each node holds a link to the file. Although you don't have to use the File object directly, it is helpful to understand what parameters are available since they can be passed to your ...
Terminology
Node A pythonic representation of data - each key in a dictionary is represented by a Node object. Node objects representing a dictionary "contain" (Nodes are created on-demand) other Nodes representing any keys in that dictionary. Root node This is your pr...
Getting nodes
Syntax: Node.get(*children) There are two ways to retrieve a child Node: root_node.get('child') root_node.child You can also retrieve deeper nodes like so: root_node.a.b.c root_node.get('a').b.get('c') Notice that it doesn't particularly matter wheth...
Getting a value
Syntax: Node() pyntree takes a somewhat unique yet simple approach to getting the values stored in nodes thanks to python limitations. To get a node's value, simply call it: root_node() The same applies to child nodes. To get the names of all the child ...
Loading files/dictionaries
Syntax: Node(file_or_dictionary, **file_parameters) To load a file/dictionary, simply create a new Node object with the filename or dictionary as first argument, along with any optional file arguments you want to pass (See The File object). For default fil...
Setting values
Syntax: Node.set(*children, value) To change a value or create a new node, you can use one of two general methods: The set() method: your_node.set('name', 'Jimmy') Or by directly setting the attribute: your_node.name = 'Jimmy' Remember, if a node does...
Saving
Syntax: Node.save(filename=None) Simply call the save method to save your data: root_node.save() You can also call the save method on child nodes, but it will save the data in the root node to the proper file. You can also specify a different filename t...
Getting the names of the children
Syntax: Node._values To get a list of all of a Node's children, simply use the values property: Node._values This will return a list of strings, not Nodes. If you have a child Node named "_values", you will need to use the get function to retrieve it. S...
Source code, roadmap, and more
Source code pyntree's source code is available at https://github.com/jvadair/pyntree. Roadmap The roadmap is available at https://board.jvadair.com, but you will need to use the following credentials to access it: - Username: public - Password: ...
Checking for a value
Syntax: Node.has(*names) To see if a Node has a child with a given name, use the has method: Node.has(name)
Deleting a Node
Syntax: Node.delete(*children) The delete function can take either 0 or 1+ parameters: Node.delete() Node.delete(name) In the first example, the node on which the function is called will be deleted. In the latter, the child with the specified name will ...
Known limitations
Attempting to retrieve a name which is also a Node property will not work as intended (ex: _values) when doing so explicitly (Node._values), but using the get method will yield the desired result. For example, if you have a data point/key with a sub-attribut...
NameNotFound
This error means that there is no Node with the name that you provided. Here's an example: x = Node() x.get('test') # or x.test Output: <RootNode>.test does not exist The error message will always write the text <RootNode> since the method returning wil...
FileNameUnset
This error means that you tried to save a Node, but initialized it with raw data and never set a filename. To fix this, see Changing the active file, or set the filename parameter on the save function to save temporarily (see Saving). Here's an example: x = ...