core_navigator
"""
Copyright (C) 2020 New Entity Operations Inc.
ALL RIGHTS RESERVED
core_navigator lets you connect your interface into various parts of the underlying machine
through an 'actions' and 'data types' model
Navigator is not a system level tool, but a member-level tree navigation assistance helper
To access tree-based structures containing either 'actions' or 'data types' some methods are
provided
Usage:
'actions' are routines that are defined by a programatic extension here. This has to be a call.
'data types' are exact values of various data type that can be inserted seamlessly into
defined contextal methods.
This program helps give you an abstraction for accessing 'machine material'
Something like personal media would be considered 'machine material' according to the
IPDVC Standard
IPDVC Standard Allowed Navigation Types:
1.) Tree navigation
2.) Parser: Bookmarks Sanitizer
"""
## Imports: Standard
from re import (
search,
)
## Imports: Custom
from core_middlelayer import (
directory_core_SLUG, directory_master_SLUG,
BOOKMARK_CLEANED_URL, BOOKMARKS_SORT_ME,
SLUG_BOOKMARKS
)
## Establish Baseline Directories by branching the instance
directory_master = directory_master_SLUG
directory_core = directory_core_SLUG
#*************************************#
# START: STEP: 4 - Virtualize Node #
#*************************************#
print(
"---------- START: STEP 2 - VIRTUALIZE NODE ----------"
)
# Establish Full Directory Paths: This should be your base directory
path_CORE = directory_master+directory_core
print(path_CORE)
print(
"---------- STOP: STEP 2 - VIRTUALIZE NODE ----------\n"
)
#*************************************#
# STOP: STEP: 4 - Virtualize Node #
#*************************************#
## Establish a shadow class for the cache to read and write from
class MasterCache:
"""
Store the cache of any files in the following directory structure
"""
l1 = []
l2 = []
def clear_a():
l1.clear()
def clear_b():
l2.clear()
## Establish your position
class Position:
"""
A
"""
start_location = path_CORE
current_location = [] # This will be whereever you're navigating to
## Establish Directory Class behavior
class DirNodeAccessCount:
"""
A counter for each 'read', 'write' and 'scan' of a Node
"""
pass
class DirNodeAlter:
"""
Alter DirNodeKeyX with attributes Axn
"""
pass
class DirNodeCreator:
"""
Create a Dir in DirNodeKeyX
"""
pass
class DirNodeDeleter:
"""
Delete DirNodeKeyX from DirNodeKeyY
"""
pass
class DirNodeDepth:
"""
From the index-root, how many layers deep is the Node nested?
"""
pass
class DirNodeKey:
"""
The true node-key of the directory
"""
pass
class DirNodeMover:
"""
Move a Dir from DirNodeKeyX to DirNodeKeyY
"""
pass
class DirNodeName:
"""
The string that defines the 'DirNodeKey'
"""
pass
class DirNodeType:
"""
From the preset list of Node directory types, the node is...
CORE, MEDIA, DATA, VIRTUAL, ENTITY
"""
pass
## Establish File class Behavior
class FileAccessCount:
"""
File access counter can either be 'on' or 'off'
and can either be 'summarized' or 'not_summarized'
"""
pass
class FileAlterNode:
"""
Alter the node of the file from FileInNodeX, to FileInNodeY
"""
pass
class FileCreateStandard:
"""
Create a file of type X in DirNodeKey, with default of DirNodeKeyX
"""
pass
class FileDateAccessed:
pass
class FileDateModified:
pass
class FileGroup:
pass
class FileHashTypes:
def HTypeMD5():
pass
def HTypeSha1():
pass
def HTypeSha256():
pass
def HTypeSha512():
pass
class FileInNode:
"""
The file resides in NodeX
"""
pass
class FileMIMEType:
pass
class FileOwner:
pass
class FilePermissions:
pass
class FileSize:
pass
class FileTrueKey:
"""
The true index-key of the file
"""
pass
class FileType:
pass
class SanitizeBookmark:
"""
Search and replace Bookmarks formatted elsewhere
1. Select an input file
2. Select a cleaned output file that can be merged into your master list
"""
def DO():
FILE_TO_OPEN = \
SLUG_BOOKMARKS+BOOKMARKS_SORT_ME
FILE_TO_WRITE_TO = \
SLUG_BOOKMARKS+BOOKMARK_CLEANED_URL
with open(FILE_TO_OPEN, 'r') as f:
with open(FILE_TO_WRITE_TO, 'w') as FTW:
sort_bin = []
for line in f:
"""
This will read through the lines in input file
One by one, they're stripped into two pieces
A triple_quote is added to before and after because bookmarks can be messy
and this will effectively mute out the string for compiling
We check case 1, line_result_a first and don't do anything to check the
other conditions. If they're too met, we join the file into a sort_bin
The sort_bin gets one new file slug per round and at the
conclusion of the input reading
is sorted and then written into the output file
each entry at a time until conclusion
"""
triple_quote = '"""'
line = triple_quote+line+triple_quote
result_a = search(r'\D+', line)
# print(result_b)
#
try:
line_result_a = result_a.group()
# FTW.write(line_result_a+" \n")
except:
AttributeError
pass
try:
line_result_b = result_b.group()
# FTW.write(line_result_b+" \n")
# print("Completed Slug: "+line_result_a + line_result_b)
sort_bin.append(line_result_a+line_result_b+"\n ")
#FTW.write(line_result_a+line_result_b+"\n ")
except:
AttributeError
pass
sort_bin.sort()
for i in sort_bin:
FTW.write(i)
FTW.close()
f.close()
Return HOME