easycoder 250209.1__py2.py3-none-any.whl → 250211.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.

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__ = "250209.1"
12
+ __version__ = "250211.1"
easycoder/ec_core.py CHANGED
@@ -696,22 +696,21 @@ class Core(Handler):
696
696
  self.program.importPlugin(f'{source}:{clazz}')
697
697
  return True
698
698
  elif self.isSymbol():
699
- command['target'] = self.getToken()
700
- if self.nextIs('from'):
701
- command['file'] = self.nextValue()
702
- self.add(command)
703
- return True
699
+ symbolRecord = self.getSymbolRecord()
700
+ if symbolRecord['valueHolder']:
701
+ command['target'] = symbolRecord['name']
702
+ if self.nextIs('from'):
703
+ command['file'] = self.nextValue()
704
+ self.add(command)
705
+ return True
704
706
  return False
705
707
 
706
708
  def r_load(self, command):
707
709
  target = self.getVariable(command['target'])
708
710
  file = self.getRuntimeValue(command['file'])
709
- try:
710
- with open(file, 'r') as f:
711
- content = f.read()
712
- except:
713
- content=None
714
- if content != None and file.endswith('.json'): content = json.loads(content)
711
+ f = open(file, 'r')
712
+ content = f.read()
713
+ f.close()
715
714
  value = {}
716
715
  value['type'] = 'text'
717
716
  value['content'] = content
@@ -1220,9 +1219,9 @@ class Core(Handler):
1220
1219
  def r_save(self, command):
1221
1220
  content = self.getRuntimeValue(command['content'])
1222
1221
  file = self.getRuntimeValue(command['file'])
1223
- if file.endswith('.json'): content = json.dumps(content)
1224
- with open(file, 'w') as f:
1225
- f.write(content)
1222
+ f = open(file, 'w')
1223
+ f.write(content)
1224
+ f.close()
1226
1225
  return self.nextPC()
1227
1226
 
1228
1227
  # Send a message to a module
@@ -1691,6 +1690,7 @@ class Core(Handler):
1691
1690
  value['name'] = token
1692
1691
  symbolRecord = self.getSymbolRecord()
1693
1692
  keyword = symbolRecord['keyword']
1693
+
1694
1694
  if keyword == 'module':
1695
1695
  value['type'] = 'module'
1696
1696
  return value
@@ -1999,6 +1999,10 @@ class Core(Handler):
1999
1999
  base64_bytes = content.encode('ascii')
2000
2000
  message_bytes = base64.b64decode(base64_bytes)
2001
2001
  value['content'] = message_bytes.decode('ascii')
2002
+ elif self.encoding == 'hex':
2003
+ hex_bytes = content.encode('utf-8')
2004
+ message_bytes = binascii.unhexlify(hex_bytes)
2005
+ value['content'] = message_bytes.decode('utf-8')
2002
2006
  else:
2003
2007
  value = v
2004
2008
  return value
@@ -2042,6 +2046,10 @@ class Core(Handler):
2042
2046
  data_bytes = content.encode('ascii')
2043
2047
  base64_bytes = base64.b64encode(data_bytes)
2044
2048
  value['content'] = base64_bytes.decode('ascii')
2049
+ elif self.encoding == 'hex':
2050
+ data_bytes = content.encode('utf-8')
2051
+ hex_bytes = binascii.hexlify(data_bytes)
2052
+ value['content'] = hex_bytes.decode('utf-8')
2045
2053
  else:
2046
2054
  value = v
2047
2055
  return value
easycoder/ec_program.py CHANGED
@@ -149,17 +149,19 @@ class Program:
149
149
  elif valType == 'symbol':
150
150
  name = value['name']
151
151
  symbolRecord = self.getSymbolRecord(name)
152
- if symbolRecord['value'] == [None]:
153
- RuntimeWarning(self, f'Variable "{name}" has no value')
154
- return None
155
- handler = self.domainIndex[symbolRecord['domain']].valueHandler('symbol')
156
- result = handler(symbolRecord)
152
+ if symbolRecord['valueHolder']:
153
+ handler = self.domainIndex[symbolRecord['domain']].valueHandler('symbol')
154
+ result = handler(symbolRecord)
155
+ else:
156
+ # Call the given domain to handle a value
157
+ domain = self.domainIndex[value['domain']]
158
+ handler = domain.valueHandler(value['type'])
159
+ if handler: result = handler(value)
157
160
  else:
158
161
  # Call the given domain to handle a value
159
162
  domain = self.domainIndex[value['domain']]
160
163
  handler = domain.valueHandler(value['type'])
161
- if handler:
162
- result = handler(value)
164
+ if handler: result = handler(value)
163
165
 
164
166
  return result
165
167
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: easycoder
3
- Version: 250209.1
3
+ Version: 250211.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,17 +1,17 @@
1
1
  easycoder/README.md,sha256=BVXmYphcTJ6q6RN_9L6HtQukgCnOjSLVIsTM3lk-9aM,587
2
- easycoder/__init__.py,sha256=ThnKzPLXjQ6pK6rxAGX10BuDnVxM5LyWwr38WrzSGmw,262
2
+ easycoder/__init__.py,sha256=-ieVJbUXyUx77PtU92gNnd-Ac2xwhwhKwQ8ELRm19CA,262
3
3
  easycoder/ec_classes.py,sha256=xnWBNak8oKydkFoxHLlq9wo3lIsB3aMnTDrqbtCfoWo,1512
4
4
  easycoder/ec_compiler.py,sha256=dFJEA_uOhD-HeSiAdBzmmA6q3LHThUVoJpSETanmSHs,4800
5
5
  easycoder/ec_condition.py,sha256=WSbONo4zs2sX1icOVpscZDFSCAEFmTsquoc2RGcLx_k,763
6
- easycoder/ec_core.py,sha256=qx-4xxzqmpiv_Mny3PUCLHo9Dog1FVjL5RxRbQXrzAQ,87359
6
+ easycoder/ec_core.py,sha256=p5l09Vx5nN6sHsIFVOHauOW4_eL5x1LTuI-fM6TG3Y8,87681
7
7
  easycoder/ec_graphics.py,sha256=K44SbPb81KBGCe4wpl6VR4lt93AAGOZysFO2tkUuilY,13380
8
8
  easycoder/ec_gutils.py,sha256=BHDsRgXR5XTO2nYhdBbC4OQW-9xU0czyFyee0tZ595E,6096
9
9
  easycoder/ec_handler.py,sha256=IJvxcrJJSR53d6DS_8H5qPHKhp9y5-GV4WXAjhZxu_o,2250
10
- easycoder/ec_program.py,sha256=R8zMukA-pfRsOpcy9WqTw7fE_190dQfrMt2la23Yrs4,9904
10
+ easycoder/ec_program.py,sha256=BDwU7aGHiaw6WdbQvVFDhGVaHsvwQ1CWa4wb5MPmOe8,10013
11
11
  easycoder/ec_timestamp.py,sha256=_3QFJPzIWZ9Rzk3SQOQJ-gwmvB07pg78k23SPntoZtY,288
12
12
  easycoder/ec_value.py,sha256=zgDJTJhIg3yOvmnnKIfccIizmIhGbtvL_ghLTL1T5fg,2516
13
- easycoder-250209.1.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
14
- easycoder-250209.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
15
- easycoder-250209.1.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
16
- easycoder-250209.1.dist-info/METADATA,sha256=lkwTOwGfCo-S5bcD8OJOJkUt66UrVXlzYYvBklfgzVU,6162
17
- easycoder-250209.1.dist-info/RECORD,,
13
+ easycoder-250211.1.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
14
+ easycoder-250211.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
15
+ easycoder-250211.1.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
16
+ easycoder-250211.1.dist-info/METADATA,sha256=9oZyS8fstRgwsMShM9efh6Hh5AyUWSK2R4EvIRwB7rQ,6162
17
+ easycoder-250211.1.dist-info/RECORD,,