easycoder 250915.1__py2.py3-none-any.whl → 250926.1__py2.py3-none-any.whl

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.
easycoder/__init__.py CHANGED
@@ -12,4 +12,4 @@ from .ec_pyside import *
12
12
  from .ec_timestamp import *
13
13
  from .ec_value import *
14
14
 
15
- __version__ = "250915.1"
15
+ __version__ = "250926.1"
easycoder/ec_compiler.py CHANGED
@@ -211,7 +211,6 @@ class Compiler:
211
211
  token = self.tokens[self.index]
212
212
  keyword = token.token
213
213
  if self.debugCompile: print(self.script.lines[token.lino])
214
- # print(f'{keyword} - {line}')
215
214
  # if keyword != 'else':
216
215
  if self.compileOne() == True:
217
216
  if self.index == len(self.tokens) - 1:
easycoder/ec_core.py CHANGED
@@ -160,23 +160,25 @@ class Core(Handler):
160
160
  else:
161
161
  return self.compileFromHere(['end'])
162
162
 
163
- # Clear (set false)
164
163
  # clear {variable}
165
164
  def k_clear(self, command):
166
165
  if self.nextIsSymbol():
167
166
  target = self.getSymbolRecord()
168
- if target['hasValue']:
169
- command['target'] = target['name']
167
+ command['target'] = target['name']
168
+ if target['hasValue'] or target['keyword'] == 'ssh':
170
169
  self.add(command)
171
170
  return True
172
171
  return False
173
172
 
174
173
  def r_clear(self, command):
175
174
  target = self.getVariable(command['target'])
176
- val = {}
177
- val['type'] = 'boolean'
178
- val['content'] = False
179
- self.putSymbolValue(target, val)
175
+ if target['keyword'] == 'ssh':
176
+ target['ssh'] = None
177
+ else:
178
+ val = {}
179
+ val['type'] = 'boolean'
180
+ val['content'] = False
181
+ self.putSymbolValue(target, val)
180
182
  return self.nextPC()
181
183
 
182
184
  # Close a file
@@ -277,7 +279,7 @@ class Core(Handler):
277
279
  return self.incdec(command, '-')
278
280
 
279
281
  # Delete a file or a property
280
- # delete {filename}
282
+ # delete file {filename}
281
283
  # delete property {value} of {variable}
282
284
  # delete element {name} of {variable}
283
285
  def k_delete(self, command):
@@ -306,8 +308,8 @@ class Core(Handler):
306
308
  type = command['type']
307
309
  if type == 'file':
308
310
  filename = self.getRuntimeValue(command['filename'])
309
- if os.path.isfile(filename):
310
- os.remove(filename)
311
+ if filename != None:
312
+ if os.path.isfile(filename): os.remove(filename)
311
313
  elif type == 'property':
312
314
  key = self.getRuntimeValue(command['key'])
313
315
  symbolRecord = self.getVariable(command['var'])
@@ -1504,8 +1506,11 @@ class Core(Handler):
1504
1506
  ssh = paramiko.SSHClient()
1505
1507
  target['ssh'] = ssh
1506
1508
  ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
1507
- ssh.connect(host, username=user, password=password)
1508
- target['sftp'] = ssh.open_sftp()
1509
+ try:
1510
+ ssh.connect(host, username=user, password=password, timeout=10)
1511
+ target['sftp'] = ssh.open_sftp()
1512
+ except:
1513
+ target['error'] = f'Unable to connect to {host} (timeout)'
1509
1514
  return self.nextPC()
1510
1515
 
1511
1516
  # Shuffle a list
@@ -2109,14 +2114,24 @@ class Core(Handler):
2109
2114
  return value
2110
2115
 
2111
2116
  if token == 'error':
2112
- if self.peek() == 'code':
2117
+ token = self.peek()
2118
+ if token == 'code':
2113
2119
  self.nextToken()
2114
2120
  value['item'] = 'errorCode'
2115
2121
  return value
2116
- if self.peek() == 'reason':
2122
+ elif token == 'reason':
2117
2123
  self.nextToken()
2118
2124
  value['item'] = 'errorReason'
2119
2125
  return value
2126
+ elif token in ['in', 'of']:
2127
+ self.nextToken()
2128
+ if self.nextIsSymbol():
2129
+ record = self.getSymbolRecord()
2130
+ if record['keyword'] == 'ssh':
2131
+ value['item'] = 'sshError'
2132
+ value['name'] = record['name']
2133
+ return value
2134
+ return None
2120
2135
 
2121
2136
  if token == 'type':
2122
2137
  if self.nextIs('of'):
@@ -2280,6 +2295,10 @@ class Core(Handler):
2280
2295
  elif v['item'] == 'errorReason':
2281
2296
  value['type'] = 'text'
2282
2297
  value['content'] = errorReason
2298
+ elif v['item'] == 'sshError':
2299
+ record = self.getVariable(v['name'])
2300
+ value['type'] = 'text'
2301
+ value['content'] = record['error'] if 'error' in record else ''
2283
2302
  return value
2284
2303
 
2285
2304
  def v_files(self, v):
@@ -2511,7 +2530,7 @@ class Core(Handler):
2511
2530
  elif keyword == 'ssh':
2512
2531
  v = {}
2513
2532
  v['type'] = 'boolean'
2514
- v['content'] = True if 'ssh' in symbolRecord else False
2533
+ v['content'] = True if 'ssh' in symbolRecord and symbolRecord['ssh'] != None else False
2515
2534
  return v
2516
2535
  else:
2517
2536
  return None
@@ -2614,12 +2633,25 @@ class Core(Handler):
2614
2633
  def compileCondition(self):
2615
2634
  condition = Condition()
2616
2635
 
2617
- if self.getToken() == 'not':
2636
+ token = self.getToken()
2637
+
2638
+ if token == 'not':
2618
2639
  condition.type = 'not'
2619
2640
  condition.value = self.nextValue()
2620
2641
  return condition
2621
2642
 
2622
- if self.getToken() == 'file':
2643
+ elif token == 'error':
2644
+ self.nextToken()
2645
+ self.skip('in')
2646
+ if self.nextIsSymbol():
2647
+ record = self.getSymbolRecord()
2648
+ if record['keyword'] == 'ssh':
2649
+ condition.type = 'sshError'
2650
+ condition.target = record['name']
2651
+ return condition
2652
+ return None
2653
+
2654
+ elif token == 'file':
2623
2655
  path = self.nextValue()
2624
2656
  condition.path = path
2625
2657
  condition.type = 'exists'
@@ -2799,6 +2831,13 @@ class Core(Handler):
2799
2831
 
2800
2832
  def c_odd(self, condition):
2801
2833
  return self.getRuntimeValue(condition.value1) % 2 == 1
2834
+
2835
+ def c_sshError(self, condition):
2836
+ target = self.getVariable(condition.target)
2837
+ errormsg = target['error'] if 'error' in target else None
2838
+ condition.errormsg = errormsg
2839
+ test = errormsg != None
2840
+ return not test if condition.negate else test
2802
2841
 
2803
2842
  def c_starts(self, condition):
2804
2843
  value1 = self.getRuntimeValue(condition.value1)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: easycoder
3
- Version: 250915.1
3
+ Version: 250926.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>
@@ -1,10 +1,10 @@
1
- easycoder/__init__.py,sha256=7NHTZ5I7WslkzQzGX7LEpUibahBJDKSrzCv41TePpqs,339
1
+ easycoder/__init__.py,sha256=ZFCpWstVvFgY0Q2g_Osyg8SQRnrfRLFix_OsLL93uw8,339
2
2
  easycoder/close.png,sha256=3B9ueRNtEu9E4QNmZhdyC4VL6uqKvGmdfeFxIV9aO_Y,9847
3
3
  easycoder/ec_border.py,sha256=KpOy0Jq8jI_6DYGo4jaFvoBP_jTIoAYWrmuHhl-FXA4,2355
4
4
  easycoder/ec_classes.py,sha256=bejrby7mLHTeAQXhhz-1l8iv6LSbNSy30lW21KJKjXE,1832
5
- easycoder/ec_compiler.py,sha256=zImpvvSEfHRGe5MiIgmiu2i7rJxsB4pVLujqmHaOqTo,5392
5
+ easycoder/ec_compiler.py,sha256=LYwGNs8dcHKXI_nnu1sVFe1N36vjvylcUO_tX_bLjrk,5359
6
6
  easycoder/ec_condition.py,sha256=YXvSBQKEzKGCcgUGo3Qp8iHolXmm2BpEm0NimSDszIM,785
7
- easycoder/ec_core.py,sha256=dQrGEsErqyMDem_KMagSOoM7igOJUBax-6mA5bW3RMo,98071
7
+ easycoder/ec_core.py,sha256=VTAnhdLp3ftZ1tLPhovKX0PQ1CplmC9x17jH_DfrJsQ,99650
8
8
  easycoder/ec_handler.py,sha256=ED08ULiOlZkcs4XHxAguvdPZw_dFXuwGDFLbFuo0kLs,2317
9
9
  easycoder/ec_keyboard.py,sha256=ru-HdWolBMZJPyck2s72In9tXFeLJQSPtR1TpjmIo90,18350
10
10
  easycoder/ec_program.py,sha256=3KM9n_SAChUgUnRxhPCnA75K2FP1fgxjW8z1YUA3cL4,10140
@@ -12,8 +12,8 @@ easycoder/ec_pyside.py,sha256=bnGwnlYyN-4KI4ECpocrgVx2uGO_9aDrDZNjT4AK7ak,54148
12
12
  easycoder/ec_timestamp.py,sha256=myQnnF-mT31_1dpQKv2VEAu4BCcbypvMdzq7_DUi1xc,277
13
13
  easycoder/ec_value.py,sha256=zgDJTJhIg3yOvmnnKIfccIizmIhGbtvL_ghLTL1T5fg,2516
14
14
  easycoder/tick.png,sha256=OedASXJJTYvnza4J6Kv5m5lz6DrBfy667zX_WGgtbmM,9127
15
- easycoder-250915.1.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
16
- easycoder-250915.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
17
- easycoder-250915.1.dist-info/WHEEL,sha256=Dyt6SBfaasWElUrURkknVFAZDHSTwxg3PaTza7RSbkY,100
18
- easycoder-250915.1.dist-info/METADATA,sha256=YzBfnLU-bD4bsKv2_QvgouqMxVLV8l7BoO6Ydsa2zyU,6897
19
- easycoder-250915.1.dist-info/RECORD,,
15
+ easycoder-250926.1.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
16
+ easycoder-250926.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
17
+ easycoder-250926.1.dist-info/WHEEL,sha256=Dyt6SBfaasWElUrURkknVFAZDHSTwxg3PaTza7RSbkY,100
18
+ easycoder-250926.1.dist-info/METADATA,sha256=VgnJrloK6PLlrt9KMrNzUw71Yu5hlExoj8sLIXMGBcg,6897
19
+ easycoder-250926.1.dist-info/RECORD,,