easycoder 250609.1__tar.gz → 250611.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of easycoder might be problematic. Click here for more details.
- {easycoder-250609.1 → easycoder-250611.1}/PKG-INFO +2 -1
- {easycoder-250609.1 → easycoder-250611.1}/easycoder/__init__.py +1 -1
- {easycoder-250609.1 → easycoder-250611.1}/easycoder/ec_core.py +116 -25
- {easycoder-250609.1 → easycoder-250611.1}/easycoder/ec_program.py +2 -3
- {easycoder-250609.1 → easycoder-250611.1}/pyproject.toml +1 -0
- easycoder-250609.1/easycoder/.syncthing.ec_core.py.tmp +0 -0
- easycoder-250609.1/easycoder/.syncthing.ec_program.py.tmp +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/.gitignore +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/LICENSE +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/README.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/backdrop.jpg +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/README.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/README.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/conditions/boolean.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/conditions/empty.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/conditions/ends.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/conditions/even.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/conditions/exists.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/conditions/greater.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/conditions/hasProperty.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/conditions/includes.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/conditions/is.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/conditions/less.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/conditions/list.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/conditions/none.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/conditions/not.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/conditions/numeric.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/conditions/object.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/conditions/odd.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/conditions/starts.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/conditions/string.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/add.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/append.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/assert.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/begin.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/clear.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/close.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/create.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/debug.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/decrement.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/delete.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/divide.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/exit.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/file.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/fork.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/get.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/go.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/gosub.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/if.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/import.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/increment.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/index.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/init.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/input.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/load.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/lock.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/log.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/module.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/multiply.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/negate.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/open.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/pop.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/post.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/print.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/push.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/put.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/read.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/release.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/replace.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/return.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/run.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/save.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/script.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/set.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/split.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/stack.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/stop.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/system.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/take.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/toggle.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/truncate.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/unlock.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/variable.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/wait.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/while.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/keywords/write.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/arg.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/args.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/cos.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/datime.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/decode.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/element.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/elements.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/empty.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/encode.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/error.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/files.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/float.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/from.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/hash.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/index.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/integer.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/json.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/keys.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/left.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/length.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/lowercase.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/memory.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/modification.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/modulo.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/newline.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/now.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/position.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/property.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/random.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/right.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/sin.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/stringify.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/tab.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/tan.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/timestamp.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/today.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/trim.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/type.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/uppercase.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/value.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/core/values/weekday.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/graphics/README.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/graphics/keywords/attach.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/graphics/keywords/close.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/graphics/keywords/create.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/graphics/keywords/ellipse.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/graphics/keywords/image.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/graphics/keywords/move.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/graphics/keywords/on.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/graphics/keywords/rectangle.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/graphics/keywords/render.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/graphics/keywords/run.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/graphics/keywords/set.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/graphics/keywords/text.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/graphics/values/attribute.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/doc/graphics/values/window.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/easycoder/README.md +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/easycoder/ec_classes.py +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/easycoder/ec_compiler.py +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/easycoder/ec_condition.py +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/easycoder/ec_handler.py +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/easycoder/ec_pyside.py +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/easycoder/ec_timestamp.py +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/easycoder/ec_value.py +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/images/Semoigo Dawn.jpg +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/json/graphics-demo.json +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/plugins/ec_keyboard.py +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/plugins/ec_p100.py +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/plugins/ec_pyside6.py +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/plugins/points.py +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/scripts/benchmark.ecs +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/scripts/config.ecg +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/scripts/ec_keyboard.py +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/scripts/findxr.ecs +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/scripts/fizzbuzz.ecs +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/scripts/hello.ecs +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/scripts/points.ecs +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/scripts/test.ecs +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/scripts/tests.ecs +0 -0
- {easycoder-250609.1 → easycoder-250611.1}/testrc.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: easycoder
|
|
3
|
-
Version:
|
|
3
|
+
Version: 250611.1
|
|
4
4
|
Summary: Rapid scripting in English
|
|
5
5
|
Keywords: compiler,scripting,prototyping,programming,coding,python,low code,hypertalk,computer language,learn to code
|
|
6
6
|
Author-email: Graham Trott <gtanyware@gmail.com>
|
|
@@ -8,6 +8,7 @@ Description-Content-Type: text/markdown
|
|
|
8
8
|
Classifier: License :: OSI Approved :: MIT License
|
|
9
9
|
Requires-Dist: pytz
|
|
10
10
|
Requires-Dist: requests
|
|
11
|
+
Requires-Dist: paramiko
|
|
11
12
|
Requires-Dist: pyside6
|
|
12
13
|
Project-URL: Home, https://github.com/easycoder/easycoder-py
|
|
13
14
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import json, math, hashlib, threading, os, subprocess, sys, time
|
|
1
|
+
import json, math, hashlib, threading, os, subprocess, sys, time
|
|
2
|
+
import numbers, base64, binascii, random, requests, paramiko
|
|
2
3
|
from psutil import Process
|
|
3
4
|
from datetime import datetime
|
|
4
5
|
from random import randrange
|
|
@@ -386,7 +387,7 @@ class Core(Handler):
|
|
|
386
387
|
return True
|
|
387
388
|
|
|
388
389
|
def r_exit(self, command):
|
|
389
|
-
if self.program.graphics != None:
|
|
390
|
+
if self.program.parent == None and self.program.graphics != None:
|
|
390
391
|
self.program.graphics.force_exit(None)
|
|
391
392
|
return -1
|
|
392
393
|
|
|
@@ -601,6 +602,7 @@ class Core(Handler):
|
|
|
601
602
|
variable['name'] = name
|
|
602
603
|
variable['keyword'] = keyword
|
|
603
604
|
variable['import'] = None
|
|
605
|
+
variable['used'] = False
|
|
604
606
|
self.addCommand(variable)
|
|
605
607
|
if self.peek() != 'and':
|
|
606
608
|
break
|
|
@@ -711,7 +713,7 @@ class Core(Handler):
|
|
|
711
713
|
return self.nextPC()
|
|
712
714
|
|
|
713
715
|
# 1 Load a plugin. This is done at compile time.
|
|
714
|
-
# 2 Load text from a file
|
|
716
|
+
# 2 Load text from a file or ssh
|
|
715
717
|
def k_load(self, command):
|
|
716
718
|
self.nextToken()
|
|
717
719
|
if self.tokenIs('plugin'):
|
|
@@ -725,7 +727,15 @@ class Core(Handler):
|
|
|
725
727
|
if symbolRecord['hasValue']:
|
|
726
728
|
command['target'] = symbolRecord['name']
|
|
727
729
|
if self.nextIs('from'):
|
|
728
|
-
|
|
730
|
+
if self.nextIsSymbol():
|
|
731
|
+
record = self.getSymbolRecord()
|
|
732
|
+
if record['keyword'] == 'ssh':
|
|
733
|
+
command['ssh'] = record['name']
|
|
734
|
+
command['path'] = self.nextValue()
|
|
735
|
+
self.add(command)
|
|
736
|
+
return True
|
|
737
|
+
|
|
738
|
+
command['file'] = self.getValue()
|
|
729
739
|
self.add(command)
|
|
730
740
|
return True
|
|
731
741
|
else:
|
|
@@ -734,15 +744,24 @@ class Core(Handler):
|
|
|
734
744
|
|
|
735
745
|
def r_load(self, command):
|
|
736
746
|
target = self.getVariable(command['target'])
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
747
|
+
if 'ssh' in command:
|
|
748
|
+
ssh = self.getVariable(command['ssh'])
|
|
749
|
+
path = self.getRuntimeValue(command['path'])
|
|
750
|
+
sftp = ssh['sftp']
|
|
751
|
+
try:
|
|
752
|
+
with sftp.open(path, 'r') as remote_file: content = remote_file.read().decode()
|
|
753
|
+
except:
|
|
754
|
+
RuntimeError(self.program, f'Unable to read from {path}')
|
|
755
|
+
else:
|
|
756
|
+
filename = self.getRuntimeValue(command['file'])
|
|
757
|
+
try:
|
|
758
|
+
with open(filename) as f: content = f.read()
|
|
759
|
+
except:
|
|
760
|
+
RuntimeError(self.program, f'Unable to read from {filename}')
|
|
761
|
+
try:
|
|
762
|
+
if filename.endswith('.json'): content = json.loads(content)
|
|
763
|
+
except:
|
|
764
|
+
RuntimeError(self.program, 'Bad or null JSON string')
|
|
746
765
|
value = {}
|
|
747
766
|
value['type'] = 'text'
|
|
748
767
|
value['content'] = content
|
|
@@ -1036,10 +1055,10 @@ class Core(Handler):
|
|
|
1036
1055
|
program = command['program']
|
|
1037
1056
|
code = program.code[program.pc]
|
|
1038
1057
|
lino = str(code['lino'] + 1)
|
|
1039
|
-
while len(lino) < 5: lino = f' {lino}'
|
|
1058
|
+
# while len(lino) < 5: lino = f' {lino}'
|
|
1040
1059
|
if value == None: value = '<empty>'
|
|
1041
1060
|
if 'log' in command:
|
|
1042
|
-
print(f'{datetime.now().time()}:{lino}->
|
|
1061
|
+
print(f'{datetime.now().time()}:{self.program.name}:{lino}->{value}')
|
|
1043
1062
|
else:
|
|
1044
1063
|
print(value)
|
|
1045
1064
|
return self.nextPC()
|
|
@@ -1203,9 +1222,9 @@ class Core(Handler):
|
|
|
1203
1222
|
if record['keyword'] == 'module':
|
|
1204
1223
|
name = record['name']
|
|
1205
1224
|
command['module'] = name
|
|
1206
|
-
else:
|
|
1207
|
-
else:
|
|
1208
|
-
else:
|
|
1225
|
+
else: FatalError(self.compiler, f'Symbol \'name\' is not a module')
|
|
1226
|
+
else: FatalError(self.compiler, 'Module name expected after \'as\'')
|
|
1227
|
+
else: FatalError(self.compiler, '\'as {module name}\' expected')
|
|
1209
1228
|
exports = []
|
|
1210
1229
|
if self.peek() == 'with':
|
|
1211
1230
|
self.nextToken()
|
|
@@ -1244,16 +1263,35 @@ class Core(Handler):
|
|
|
1244
1263
|
def k_save(self, command):
|
|
1245
1264
|
command['content'] = self.nextValue()
|
|
1246
1265
|
if self.nextIs('to'):
|
|
1247
|
-
|
|
1266
|
+
if self.nextIsSymbol():
|
|
1267
|
+
record = self.getSymbolRecord()
|
|
1268
|
+
if record['keyword'] == 'ssh':
|
|
1269
|
+
command['ssh'] = record['name']
|
|
1270
|
+
command['path'] = self.nextValue()
|
|
1271
|
+
self.add(command)
|
|
1272
|
+
return True
|
|
1273
|
+
command['file'] = self.getValue()
|
|
1248
1274
|
self.add(command)
|
|
1249
1275
|
return True
|
|
1250
1276
|
return False
|
|
1251
1277
|
|
|
1252
1278
|
def r_save(self, command):
|
|
1253
1279
|
content = self.getRuntimeValue(command['content'])
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1280
|
+
if 'ssh' in command:
|
|
1281
|
+
ssh = self.getVariable(command['ssh'])
|
|
1282
|
+
path = self.getRuntimeValue(command['path'])
|
|
1283
|
+
sftp = ssh['sftp']
|
|
1284
|
+
try:
|
|
1285
|
+
with sftp.open(path, 'w') as remote_file: remote_file.write(content.encode())
|
|
1286
|
+
except:
|
|
1287
|
+
RuntimeError(self.program, 'Unable to write to {path}')
|
|
1288
|
+
else:
|
|
1289
|
+
filename = self.getRuntimeValue(command['file'])
|
|
1290
|
+
if filename.endswith('.json'): content = json.dumps(content)
|
|
1291
|
+
try:
|
|
1292
|
+
with open(filename, 'w') as f: f.write(content)
|
|
1293
|
+
except:
|
|
1294
|
+
RuntimeError(self.program, f'Unable to write to {filename}')
|
|
1257
1295
|
return self.nextPC()
|
|
1258
1296
|
|
|
1259
1297
|
# Send a message to a module
|
|
@@ -1276,16 +1314,40 @@ class Core(Handler):
|
|
|
1276
1314
|
|
|
1277
1315
|
# Set a value
|
|
1278
1316
|
# set {variable}
|
|
1317
|
+
# set {ssh} host {host} user {user} password {password}
|
|
1279
1318
|
# set the elements of {variable} to {value}
|
|
1280
1319
|
# set element/property of {variable} to {value}
|
|
1281
1320
|
def k_set(self, command):
|
|
1282
1321
|
if self.nextIsSymbol():
|
|
1283
|
-
|
|
1284
|
-
|
|
1322
|
+
record = self.getSymbolRecord()
|
|
1323
|
+
command['target'] = record['name']
|
|
1324
|
+
if record['hasValue']:
|
|
1285
1325
|
command['type'] = 'set'
|
|
1286
|
-
command['target'] = target['name']
|
|
1287
1326
|
self.add(command)
|
|
1288
1327
|
return True
|
|
1328
|
+
elif record['keyword'] == 'ssh':
|
|
1329
|
+
host = None
|
|
1330
|
+
user = None
|
|
1331
|
+
password = None
|
|
1332
|
+
while True:
|
|
1333
|
+
token = self.peek()
|
|
1334
|
+
if token == 'host':
|
|
1335
|
+
self.nextToken()
|
|
1336
|
+
host = self.nextValue()
|
|
1337
|
+
elif token == 'user':
|
|
1338
|
+
self.nextToken()
|
|
1339
|
+
user = self.nextValue()
|
|
1340
|
+
elif token == 'password':
|
|
1341
|
+
self.nextToken()
|
|
1342
|
+
password = self.nextValue()
|
|
1343
|
+
else: break
|
|
1344
|
+
command['host'] = host
|
|
1345
|
+
command['user'] = user
|
|
1346
|
+
command['password'] = password
|
|
1347
|
+
command['type'] = 'ssh'
|
|
1348
|
+
self.add(command)
|
|
1349
|
+
return True
|
|
1350
|
+
|
|
1289
1351
|
return False
|
|
1290
1352
|
|
|
1291
1353
|
token = self.getToken()
|
|
@@ -1333,6 +1395,12 @@ class Core(Handler):
|
|
|
1333
1395
|
command['value'] = self.nextValue()
|
|
1334
1396
|
self.add(command)
|
|
1335
1397
|
return True
|
|
1398
|
+
|
|
1399
|
+
elif token == 'path':
|
|
1400
|
+
command['path'] = self.nextValue()
|
|
1401
|
+
self.add(command)
|
|
1402
|
+
return True
|
|
1403
|
+
|
|
1336
1404
|
return False
|
|
1337
1405
|
|
|
1338
1406
|
def r_set(self, command):
|
|
@@ -1384,6 +1452,11 @@ class Core(Handler):
|
|
|
1384
1452
|
self.encoding = self.getRuntimeValue(command['encoding'])
|
|
1385
1453
|
return self.nextPC()
|
|
1386
1454
|
|
|
1455
|
+
elif cmdType == 'path':
|
|
1456
|
+
path = self.getRuntimeValue(command['path'])
|
|
1457
|
+
os.chdir(path)
|
|
1458
|
+
return self.nextPC()
|
|
1459
|
+
|
|
1387
1460
|
elif cmdType == 'property':
|
|
1388
1461
|
value = self.getRuntimeValue(command['value'])
|
|
1389
1462
|
name = self.getRuntimeValue(command['name'])
|
|
@@ -1403,6 +1476,17 @@ class Core(Handler):
|
|
|
1403
1476
|
val['content'] = content
|
|
1404
1477
|
self.putSymbolValue(targetVariable, val)
|
|
1405
1478
|
return self.nextPC()
|
|
1479
|
+
|
|
1480
|
+
elif cmdType == 'ssh':
|
|
1481
|
+
target = self.getVariable(command['target'])
|
|
1482
|
+
host = self.getRuntimeValue(command['host'])
|
|
1483
|
+
user = self.getRuntimeValue(command['user'])
|
|
1484
|
+
password = self.getRuntimeValue(command['password'])
|
|
1485
|
+
ssh = paramiko.SSHClient()
|
|
1486
|
+
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
1487
|
+
ssh.connect(host, username=user, password=password)
|
|
1488
|
+
target['sftp'] = ssh.open_sftp()
|
|
1489
|
+
return self.nextPC()
|
|
1406
1490
|
|
|
1407
1491
|
# Shuffle a list
|
|
1408
1492
|
def k_shuffle(self, command):
|
|
@@ -1473,6 +1557,12 @@ class Core(Handler):
|
|
|
1473
1557
|
|
|
1474
1558
|
return self.nextPC()
|
|
1475
1559
|
|
|
1560
|
+
def k_ssh(self, command):
|
|
1561
|
+
return self.compileVariable(command, False)
|
|
1562
|
+
|
|
1563
|
+
def r_ssh(self, command):
|
|
1564
|
+
return self.nextPC()
|
|
1565
|
+
|
|
1476
1566
|
# Declare a stack variable
|
|
1477
1567
|
def k_stack(self, command):
|
|
1478
1568
|
return self.compileVariable(command)
|
|
@@ -1624,6 +1714,7 @@ class Core(Handler):
|
|
|
1624
1714
|
target['locked'] = False
|
|
1625
1715
|
return self.nextPC()
|
|
1626
1716
|
|
|
1717
|
+
# Use a plugin module
|
|
1627
1718
|
def k_use(self, command):
|
|
1628
1719
|
if self.nextIs('graphics'):
|
|
1629
1720
|
print('Loading graphics module')
|
|
@@ -317,9 +317,8 @@ class Program:
|
|
|
317
317
|
queue = deque()
|
|
318
318
|
if self.parent != None:
|
|
319
319
|
self.releaseParent()
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
break
|
|
320
|
+
self.running = False
|
|
321
|
+
break
|
|
323
322
|
elif self.pc == None or self.pc == 0 or self.pc >= len(self.code):
|
|
324
323
|
break
|
|
325
324
|
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|