easycoder 250611.2__py2.py3-none-any.whl → 250611.4__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.

Potentially problematic release.


This version of easycoder might be problematic. Click here for more details.

easycoder/__init__.py CHANGED
@@ -9,4 +9,4 @@ from .ec_program import *
9
9
  from .ec_timestamp import *
10
10
  from .ec_value import *
11
11
 
12
- __version__ = "250611.2"
12
+ __version__ = "250611.4"
easycoder/ec_compiler.py CHANGED
@@ -14,7 +14,6 @@ class Compiler:
14
14
  self.symbols = self.program.symbols
15
15
  self.code = self.program.code
16
16
  self.program.compiler = self
17
- self.addCommand = self.program.add
18
17
  self.compileConstant = self.value.compileConstant
19
18
  self.debugCompile = False
20
19
 
@@ -77,6 +76,10 @@ class Compiler:
77
76
  def getCommandAt(self, pc):
78
77
  return self.program.code[pc]
79
78
 
79
+ # Add a command to the code list
80
+ def add(self, command):
81
+ self.code.append(command)
82
+
80
83
  def isSymbol(self):
81
84
  token=self.getToken()
82
85
  try:
@@ -148,7 +151,7 @@ class Compiler:
148
151
  command['import'] = None
149
152
  command['locked'] = False
150
153
  command['extra'] = extra
151
- self.addCommand(command)
154
+ self.add(command)
152
155
  return True
153
156
 
154
157
  # Compile the current token
easycoder/ec_core.py CHANGED
@@ -126,7 +126,7 @@ class Core(Handler):
126
126
  command['with'] = self.nextValue()
127
127
  else:
128
128
  command['with'] = None
129
- self.addCommand(command)
129
+ self.add(command)
130
130
  return True
131
131
 
132
132
  def r_assert(self, command):
@@ -143,7 +143,7 @@ class Core(Handler):
143
143
  cmd['keyword'] = 'end'
144
144
  cmd['debug'] = True
145
145
  cmd['lino'] = command['lino']
146
- self.addCommand(cmd)
146
+ self.add(cmd)
147
147
  return self.nextPC()
148
148
  else:
149
149
  return self.compileFromHere(['end'])
@@ -441,7 +441,7 @@ class Core(Handler):
441
441
  timeout['type'] = 'int'
442
442
  timeout['content'] = 5
443
443
  command['timeout'] = timeout
444
- self.addCommand(command)
444
+ self.add(command)
445
445
  if self.peek() == 'or':
446
446
  self.nextToken()
447
447
  self.nextToken()
@@ -453,7 +453,7 @@ class Core(Handler):
453
453
  cmd['goto'] = 0
454
454
  cmd['debug'] = False
455
455
  skip = self.getPC()
456
- self.addCommand(cmd)
456
+ self.add(cmd)
457
457
  # Process the 'or'
458
458
  self.getCommandAt(get)['or'] = self.getPC()
459
459
  self.compileOne()
@@ -535,7 +535,7 @@ class Core(Handler):
535
535
  # if <condition> <action> [else <action>]
536
536
  def k_if(self, command):
537
537
  command['condition'] = self.nextCondition()
538
- self.addCommand(command)
538
+ self.add(command)
539
539
  self.nextToken()
540
540
  pcElse = self.getPC()
541
541
  cmd = {}
@@ -544,7 +544,7 @@ class Core(Handler):
544
544
  cmd['keyword'] = 'gotoPC'
545
545
  cmd['goto'] = 0
546
546
  cmd['debug'] = False
547
- self.addCommand(cmd)
547
+ self.add(cmd)
548
548
  # Get the 'then' code
549
549
  self.compileOne()
550
550
  if self.peek() == 'else':
@@ -557,7 +557,7 @@ class Core(Handler):
557
557
  cmd['keyword'] = 'gotoPC'
558
558
  cmd['goto'] = 0
559
559
  cmd['debug'] = False
560
- self.addCommand(cmd)
560
+ self.add(cmd)
561
561
  # Fixup the link to the 'else' branch
562
562
  self.getCommandAt(pcElse)['goto'] = self.getPC()
563
563
  # Process the 'else' branch
@@ -603,7 +603,7 @@ class Core(Handler):
603
603
  variable['keyword'] = keyword
604
604
  variable['import'] = None
605
605
  variable['used'] = False
606
- self.addCommand(variable)
606
+ self.add(variable)
607
607
  if self.peek() != 'and':
608
608
  break
609
609
  self.nextToken()
@@ -888,7 +888,7 @@ class Core(Handler):
888
888
  cmd['keyword'] = 'gotoPC'
889
889
  cmd['goto'] = 0
890
890
  cmd['debug'] = False
891
- self.addCommand(cmd)
891
+ self.add(cmd)
892
892
  # Add the action and a 'stop'
893
893
  self.compileOne()
894
894
  cmd = {}
@@ -896,7 +896,7 @@ class Core(Handler):
896
896
  cmd['lino'] = command['lino']
897
897
  cmd['keyword'] = 'stop'
898
898
  cmd['debug'] = False
899
- self.addCommand(cmd)
899
+ self.add(cmd)
900
900
  # Fixup the link
901
901
  command['goto'] = self.getPC()
902
902
  return True
@@ -990,7 +990,7 @@ class Core(Handler):
990
990
  command['result'] = None
991
991
  command['or'] = None
992
992
  post = self.getPC()
993
- self.addCommand(command)
993
+ self.add(command)
994
994
  if self.peek() == 'or':
995
995
  self.nextToken()
996
996
  self.nextToken()
@@ -1002,7 +1002,7 @@ class Core(Handler):
1002
1002
  cmd['goto'] = 0
1003
1003
  cmd['debug'] = False
1004
1004
  skip = self.getPC()
1005
- self.addCommand(cmd)
1005
+ self.add(cmd)
1006
1006
  # Process the 'or'
1007
1007
  self.getCommandAt(post)['or'] = self.getPC()
1008
1008
  self.compileOne()
@@ -1262,20 +1262,42 @@ class Core(Handler):
1262
1262
  # Save a value to a file
1263
1263
  def k_save(self, command):
1264
1264
  command['content'] = self.nextValue()
1265
- if self.nextIs('to'):
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
1265
+ self.skip('to')
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
+ else:
1273
+ command['file'] = self.getValue()
1274
+ else:
1273
1275
  command['file'] = self.getValue()
1274
- self.add(command)
1276
+ command['or'] = None
1277
+ save = self.getPC()
1278
+ self.add(command)
1279
+ if self.peek() == 'or':
1280
+ self.nextToken()
1281
+ self.nextToken()
1282
+ # Add a 'goto' to skip the 'or'
1283
+ cmd = {}
1284
+ cmd['lino'] = command['lino']
1285
+ cmd['domain'] = 'core'
1286
+ cmd['keyword'] = 'gotoPC'
1287
+ cmd['goto'] = 0
1288
+ cmd['debug'] = False
1289
+ skip = self.getPC()
1290
+ self.add(cmd)
1291
+ # Process the 'or'
1292
+ self.getCommandAt(save)['or'] = self.getPC()
1293
+ self.compileOne()
1294
+ # Fixup the skip
1295
+ self.getCommandAt(skip)['goto'] = self.getPC()
1275
1296
  return True
1276
1297
  return False
1277
1298
 
1278
1299
  def r_save(self, command):
1300
+ errorReason = None
1279
1301
  content = self.getRuntimeValue(command['content'])
1280
1302
  if 'ssh' in command:
1281
1303
  ssh = self.getVariable(command['ssh'])
@@ -1284,14 +1306,21 @@ class Core(Handler):
1284
1306
  try:
1285
1307
  with sftp.open(path, 'w') as remote_file: remote_file.write(content.encode())
1286
1308
  except:
1287
- RuntimeError(self.program, 'Unable to write to {path}')
1309
+ errorReason = 'Unable to write to {path}'
1288
1310
  else:
1289
1311
  filename = self.getRuntimeValue(command['file'])
1290
1312
  if filename.endswith('.json'): content = json.dumps(content)
1291
1313
  try:
1292
1314
  with open(filename, 'w') as f: f.write(content)
1293
1315
  except:
1294
- RuntimeError(self.program, f'Unable to write to {filename}')
1316
+ errorReason = f'Unable to write to {filename}'
1317
+
1318
+ if errorReason:
1319
+ if command['or'] != None:
1320
+ print(f'Exception "{errorReason}": Running the "or" clause')
1321
+ return command['or']
1322
+ else:
1323
+ RuntimeError(self.program, f'Error: {errorReason}')
1295
1324
  return self.nextPC()
1296
1325
 
1297
1326
  # Send a message to a module
@@ -1765,7 +1794,7 @@ class Core(Handler):
1765
1794
  # token = self.getToken()
1766
1795
  command['condition'] = code
1767
1796
  test = self.getPC()
1768
- self.addCommand(command)
1797
+ self.add(command)
1769
1798
  # Set up a goto for when the test fails
1770
1799
  fail = self.getPC()
1771
1800
  cmd = {}
@@ -1774,7 +1803,7 @@ class Core(Handler):
1774
1803
  cmd['keyword'] = 'gotoPC'
1775
1804
  cmd['goto'] = 0
1776
1805
  cmd['debug'] = False
1777
- self.addCommand(cmd)
1806
+ self.add(cmd)
1778
1807
  # Do the body of the while
1779
1808
  self.nextToken()
1780
1809
  if self.compileOne() == False:
@@ -1786,7 +1815,7 @@ class Core(Handler):
1786
1815
  cmd['keyword'] = 'gotoPC'
1787
1816
  cmd['goto'] = test
1788
1817
  cmd['debug'] = False
1789
- self.addCommand(cmd)
1818
+ self.add(cmd)
1790
1819
  # Fixup the 'goto' on completion
1791
1820
  self.getCommandAt(fail)['goto'] = self.getPC()
1792
1821
  return True
easycoder/ec_handler.py CHANGED
@@ -23,14 +23,13 @@ class Handler:
23
23
  self.rewindTo = compiler.rewindTo
24
24
  self.warning = compiler.warning
25
25
  self.getPC = compiler.getPC
26
- self.addCommand = compiler.addCommand
26
+ self.add = compiler.add
27
27
  self.getCommandAt = compiler.getCommandAt
28
28
  self.compileOne = compiler.compileOne
29
29
  self.compileFromHere = compiler.compileFromHere
30
30
  self.compileConstant = compiler.compileConstant
31
31
 
32
32
  self.code = self.program.code
33
- self.add = self.program.add
34
33
  self.evaluate = self.program.evaluate
35
34
  self.getVariable = self.program.getSymbolRecord
36
35
  self.getRuntimeValue = self.program.getRuntimeValue
easycoder/ec_program.py CHANGED
@@ -116,10 +116,6 @@ class Program:
116
116
  def getDomains(self):
117
117
  return self.domains
118
118
 
119
- # Add a command to the code list
120
- def add(self, command):
121
- self.code.append(command)
122
-
123
119
  def getSymbolRecord(self, name):
124
120
  try:
125
121
  target = self.code[self.symbols[name]]
easycoder/ec_pyside.py CHANGED
@@ -603,7 +603,7 @@ class Graphics(Handler):
603
603
  cmd['keyword'] = 'gotoPC'
604
604
  cmd['goto'] = 0
605
605
  cmd['debug'] = False
606
- self.addCommand(cmd)
606
+ self.add(cmd)
607
607
  # This is the click handler
608
608
  self.compileOne()
609
609
  cmd = {}
@@ -611,7 +611,7 @@ class Graphics(Handler):
611
611
  cmd['lino'] = command['lino']
612
612
  cmd['keyword'] = 'stop'
613
613
  cmd['debug'] = False
614
- self.addCommand(cmd)
614
+ self.add(cmd)
615
615
  # Fixup the goto
616
616
  self.getCommandAt(pcNext)['goto'] = self.getPC()
617
617
 
@@ -634,7 +634,7 @@ class Graphics(Handler):
634
634
  elif token == 'tick':
635
635
  command['tick'] = True
636
636
  command['runOnTick'] = self.getPC() + 2
637
- self.addCommand(command)
637
+ self.add(command)
638
638
  self.nextToken()
639
639
  # Step over the on tick action
640
640
  pcNext = self.getPC()
@@ -644,7 +644,7 @@ class Graphics(Handler):
644
644
  cmd['keyword'] = 'gotoPC'
645
645
  cmd['goto'] = 0
646
646
  cmd['debug'] = False
647
- self.addCommand(cmd)
647
+ self.add(cmd)
648
648
  # This is the on tick handler
649
649
  self.compileOne()
650
650
  cmd = {}
@@ -652,7 +652,7 @@ class Graphics(Handler):
652
652
  cmd['lino'] = command['lino']
653
653
  cmd['keyword'] = 'stop'
654
654
  cmd['debug'] = False
655
- self.addCommand(cmd)
655
+ self.add(cmd)
656
656
  # Fixup the goto
657
657
  self.getCommandAt(pcNext)['goto'] = self.getPC()
658
658
  return True
@@ -692,12 +692,12 @@ class Graphics(Handler):
692
692
  if record['keyword'] == 'combobox':
693
693
  command['variant'] = 'current'
694
694
  command['name'] = record['name']
695
- self.addCommand(command)
695
+ self.add(command)
696
696
  return True
697
697
  elif record['keyword'] == 'listbox':
698
698
  command['variant'] = 'current'
699
699
  command['name'] = record['name']
700
- self.addCommand(command)
700
+ self.add(command)
701
701
  return True
702
702
  return False
703
703
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: easycoder
3
- Version: 250611.2
3
+ Version: 250611.4
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>
@@ -0,0 +1,16 @@
1
+ easycoder/README.md,sha256=BVXmYphcTJ6q6RN_9L6HtQukgCnOjSLVIsTM3lk-9aM,587
2
+ easycoder/__init__.py,sha256=AdVT4OQBBuFVstOgPo4xAUEyODopzqjXcBnad6K7lY0,262
3
+ easycoder/ec_classes.py,sha256=L6-6yWHDHw8yF9TGL4WWc4p1aUyXzYz6Gom7jJ43h8o,1823
4
+ easycoder/ec_compiler.py,sha256=6X9Sy5hr9-Ek36XqWrHJ8Ct1fE5sw2hBLKKFMh2RfRs,5130
5
+ easycoder/ec_condition.py,sha256=YXvSBQKEzKGCcgUGo3Qp8iHolXmm2BpEm0NimSDszIM,785
6
+ easycoder/ec_core.py,sha256=_1Gw58EhqPxtdGv5h4ftSd96pcOmorPszBlja-CSMnc,96944
7
+ easycoder/ec_handler.py,sha256=ohf3xUuWw_Qb5SZnulGtDhvCb11kvWtYfgbQTiOXpIY,2261
8
+ easycoder/ec_program.py,sha256=IDpfq9oghFJMJyRD9uab31VOP5MOF4M7kcUVfDn7d4I,9992
9
+ easycoder/ec_pyside.py,sha256=X84j4WC0n0p9PaoJI1W4dqDzAHTFD5izX2aLoPCQ8kE,39855
10
+ easycoder/ec_timestamp.py,sha256=myQnnF-mT31_1dpQKv2VEAu4BCcbypvMdzq7_DUi1xc,277
11
+ easycoder/ec_value.py,sha256=zgDJTJhIg3yOvmnnKIfccIizmIhGbtvL_ghLTL1T5fg,2516
12
+ easycoder-250611.4.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
13
+ easycoder-250611.4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
14
+ easycoder-250611.4.dist-info/WHEEL,sha256=ssQ84EZ5gH1pCOujd3iW7HClo_O_aDaClUbX4B8bjKY,100
15
+ easycoder-250611.4.dist-info/METADATA,sha256=7Xtjc4wp4f_B7Du9x1lzBEjPQ8vYK_bnHjBCp8mVoWg,6853
16
+ easycoder-250611.4.dist-info/RECORD,,
@@ -1,16 +0,0 @@
1
- easycoder/README.md,sha256=BVXmYphcTJ6q6RN_9L6HtQukgCnOjSLVIsTM3lk-9aM,587
2
- easycoder/__init__.py,sha256=4LuZ3eLpqNRCvbWyMEl1ibd1UvM-TFYu6F3L8mwRhB0,262
3
- easycoder/ec_classes.py,sha256=L6-6yWHDHw8yF9TGL4WWc4p1aUyXzYz6Gom7jJ43h8o,1823
4
- easycoder/ec_compiler.py,sha256=zKZXXUrQyHbwZ1gJARnwfdAPHWTARa5SN9Y31iuty8o,5086
5
- easycoder/ec_condition.py,sha256=YXvSBQKEzKGCcgUGo3Qp8iHolXmm2BpEm0NimSDszIM,785
6
- easycoder/ec_core.py,sha256=h0yGdqGMKxvF5BGIyVlPHd-FMjrj9kvLAlLIzXsA3L8,96119
7
- easycoder/ec_handler.py,sha256=zPDZ_hqdgNnkCd8B5HmSLkqsGgf4aDmqcUBOPHgo47U,2305
8
- easycoder/ec_program.py,sha256=FmC9Oz4IpkmNq6D2TgMzVa3ha2TDv7jA15uwX_HFJVs,10080
9
- easycoder/ec_pyside.py,sha256=I1y8QZgMHLWWxWbKLm_JzHJo6bwASak7tdnuAcuh66c,39904
10
- easycoder/ec_timestamp.py,sha256=myQnnF-mT31_1dpQKv2VEAu4BCcbypvMdzq7_DUi1xc,277
11
- easycoder/ec_value.py,sha256=zgDJTJhIg3yOvmnnKIfccIizmIhGbtvL_ghLTL1T5fg,2516
12
- easycoder-250611.2.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
13
- easycoder-250611.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
14
- easycoder-250611.2.dist-info/WHEEL,sha256=ssQ84EZ5gH1pCOujd3iW7HClo_O_aDaClUbX4B8bjKY,100
15
- easycoder-250611.2.dist-info/METADATA,sha256=asPMUR7Gdmzn2izrkp9Af_k8PgExYdS4lq4AG2RT-f4,6853
16
- easycoder-250611.2.dist-info/RECORD,,