easycoder 250102.1__py2.py3-none-any.whl → 250103.2__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
@@ -10,4 +10,4 @@ from .ec_program import *
10
10
  from .ec_timestamp import *
11
11
  from .ec_value import *
12
12
 
13
- __version__ = "250102.1"
13
+ __version__ = "250103.2"
easycoder/ec_core.py CHANGED
@@ -646,6 +646,28 @@ class Core(Handler):
646
646
  self.putSymbolValue(symbolRecord, value)
647
647
  return self.nextPC()
648
648
 
649
+ # Load a variable from a file
650
+ def k_load(self, command):
651
+ if self.nextIsSymbol():
652
+ command['target'] = self.getToken()
653
+ if self.nextIs('from'):
654
+ command['file'] = self.nextValue()
655
+ self.add(command)
656
+ return True
657
+ return False
658
+
659
+ def r_load(self, command):
660
+ target = self.getVariable(command['target'])
661
+ file = self.getRuntimeValue(command['file'])
662
+ f = open(file, 'r')
663
+ content = f.read()
664
+ f.close()
665
+ value = {}
666
+ value['type'] = 'text'
667
+ value['content'] = content
668
+ self.putSymbolValue(target, value)
669
+ return self.nextPC()
670
+
649
671
  # Arithmetic multiply
650
672
  # multiply {variable} by {value}[ giving {variable}]}
651
673
  def k_multiply(self, command):
@@ -1021,6 +1043,23 @@ class Core(Handler):
1021
1043
  self.program.name = self.nextToken()
1022
1044
  return True
1023
1045
 
1046
+ # Save a value to a file
1047
+ def k_save(self, command):
1048
+ command['content'] = self.nextValue()
1049
+ if self.nextIs('to'):
1050
+ command['file'] = self.nextValue()
1051
+ self.add(command)
1052
+ return True
1053
+ return False
1054
+
1055
+ def r_save(self, command):
1056
+ content = self.getRuntimeValue(command['content'])
1057
+ file = self.getRuntimeValue(command['file'])
1058
+ f = open(file, 'w')
1059
+ f.write(content)
1060
+ f.close()
1061
+ return self.nextPC()
1062
+
1024
1063
  # Set a value
1025
1064
  # set {variable}
1026
1065
  # set the elements of {variable} to {value}
@@ -2021,19 +2060,12 @@ class Core(Handler):
2021
2060
  value['content'] = json.dumps(item)
2022
2061
  return value
2023
2062
 
2063
+ # This is used by the expression evaluator to get the value of a symbol
2024
2064
  def v_symbol(self, symbolRecord):
2025
2065
  result = {}
2026
2066
  if symbolRecord['keyword'] == 'variable':
2027
2067
  symbolValue = self.getSymbolValue(symbolRecord)
2028
2068
  return symbolValue
2029
- # if symbolValue == None:
2030
- # return None
2031
- # result['type'] = symbolValue['type']
2032
- # content = symbolValue['content']
2033
- # if content == None:
2034
- # return ''
2035
- # result['content'] = content
2036
- # return result
2037
2069
  else:
2038
2070
  return None
2039
2071
 
@@ -2211,20 +2243,59 @@ class Core(Handler):
2211
2243
  return True if condition.negate else False
2212
2244
  return False
2213
2245
 
2214
- def c_numeric(self, condition):
2215
- comparison = type(self.getRuntimeValue(condition.value1)) is int
2246
+ def c_empty(self, condition):
2247
+ value = self.getRuntimeValue(condition.value1)
2248
+ if value == None:
2249
+ comparison = True
2250
+ else:
2251
+ comparison = len(value) == 0
2216
2252
  return not comparison if condition.negate else comparison
2217
2253
 
2218
- def c_string(self, condition):
2219
- comparison = type(self.getRuntimeValue(condition.value1)) is str
2220
- return not comparison if condition.negate else comparison
2254
+ def c_ends(self, condition):
2255
+ value1 = self.getRuntimeValue(condition.value1)
2256
+ value2 = self.getRuntimeValue(condition.value2)
2257
+ return value1.endswith(value2)
2258
+
2259
+ def c_even(self, condition):
2260
+ return self.getRuntimeValue(condition.value1) % 2 == 0
2261
+
2262
+ def c_exists(self, condition):
2263
+ path = self.getRuntimeValue(condition.path)
2264
+ return os.path.exists(path)
2265
+
2266
+ def c_greater(self, condition):
2267
+ comparison = self.program.compare(condition.value1, condition.value2)
2268
+ return comparison <= 0 if condition.negate else comparison > 0
2269
+
2270
+ def c_hasProperty(self, condition):
2271
+ value = self.getRuntimeValue(condition.value1)
2272
+ prop = self.getRuntimeValue(condition.property)
2273
+ try:
2274
+ value[prop]
2275
+ hasProp = True
2276
+ except:
2277
+ hasProp = False
2278
+ return hasProp
2279
+
2280
+ def c_includes(self, condition):
2281
+ value1 = self.getRuntimeValue(condition.value1)
2282
+ value2 = self.getRuntimeValue(condition.value2)
2283
+ return value2 in value1
2284
+
2285
+ def c_is(self, condition):
2286
+ comparison = self.program.compare(condition.value1, condition.value2)
2287
+ return comparison != 0 if condition.negate else comparison == 0
2288
+
2289
+ def c_less(self, condition):
2290
+ comparison = self.program.compare(condition.value1, condition.value2)
2291
+ return comparison >= 0 if condition.negate else comparison < 0
2221
2292
 
2222
2293
  def c_list(self, condition):
2223
2294
  comparison = type(self.getRuntimeValue(condition.value1)) is list
2224
2295
  return not comparison if condition.negate else comparison
2225
2296
 
2226
- def c_object(self, condition):
2227
- comparison = type(self.getRuntimeValue(condition.value1)) is dict
2297
+ def c_numeric(self, condition):
2298
+ comparison = type(self.getRuntimeValue(condition.value1)) is int
2228
2299
  return not comparison if condition.negate else comparison
2229
2300
 
2230
2301
  def c_none(self, condition):
@@ -2234,58 +2305,19 @@ class Core(Handler):
2234
2305
  def c_not(self, condition):
2235
2306
  return not self.getRuntimeValue(condition.value1)
2236
2307
 
2237
- def c_even(self, condition):
2238
- return self.getRuntimeValue(condition.value1) % 2 == 0
2308
+ def c_object(self, condition):
2309
+ comparison = type(self.getRuntimeValue(condition.value1)) is dict
2310
+ return not comparison if condition.negate else comparison
2239
2311
 
2240
2312
  def c_odd(self, condition):
2241
2313
  return self.getRuntimeValue(condition.value1) % 2 == 1
2242
2314
 
2243
- def c_is(self, condition):
2244
- comparison = self.program.compare(condition.value1, condition.value2)
2245
- return comparison != 0 if condition.negate else comparison == 0
2246
-
2247
- def c_greater(self, condition):
2248
- comparison = self.program.compare(condition.value1, condition.value2)
2249
- return comparison <= 0 if condition.negate else comparison > 0
2250
-
2251
- def c_less(self, condition):
2252
- comparison = self.program.compare(condition.value1, condition.value2)
2253
- return comparison >= 0 if condition.negate else comparison < 0
2254
-
2255
2315
  def c_starts(self, condition):
2256
2316
  value1 = self.getRuntimeValue(condition.value1)
2257
2317
  value2 = self.getRuntimeValue(condition.value2)
2258
2318
  return value1.startswith(value2)
2259
2319
 
2260
- def c_ends(self, condition):
2261
- value1 = self.getRuntimeValue(condition.value1)
2262
- value2 = self.getRuntimeValue(condition.value2)
2263
- return value1.endswith(value2)
2264
-
2265
- def c_includes(self, condition):
2266
- value1 = self.getRuntimeValue(condition.value1)
2267
- value2 = self.getRuntimeValue(condition.value2)
2268
- return value2 in value1
2269
-
2270
- def c_empty(self, condition):
2271
- value = self.getRuntimeValue(condition.value1)
2272
- if value == None:
2273
- comparison = True
2274
- else:
2275
- comparison = len(value) == 0
2320
+ def c_string(self, condition):
2321
+ comparison = type(self.getRuntimeValue(condition.value1)) is str
2276
2322
  return not comparison if condition.negate else comparison
2277
-
2278
- def c_exists(self, condition):
2279
- path = self.getRuntimeValue(condition.path)
2280
- return os.path.exists(path)
2281
-
2282
- def c_hasProperty(self, condition):
2283
- value = self.getRuntimeValue(condition.value1)
2284
- prop = self.getRuntimeValue(condition.property)
2285
- try:
2286
- value[prop]
2287
- hasProp = True
2288
- except:
2289
- hasProp = False
2290
- return hasProp
2291
2323
  # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: easycoder
3
- Version: 250102.1
3
+ Version: 250103.2
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
1
  easycoder/README.md,sha256=PYqOc_SkIGiFbyCNs90y7JqoqWe4aO1xYIW-6bOnFKU,573
2
- easycoder/__init__.py,sha256=W4OVpn0u8D0l1986sfIOeYbyIh-u4cA3pN00Dd3iPTE,283
2
+ easycoder/__init__.py,sha256=JT7KWbiZJzKjiWqUFbTt4PaWE-WxWQcMEBvq4al6KL0,283
3
3
  easycoder/ec.py,sha256=Nj5PRl8GsKjfGJKq0FOM1a7FeK3cN68CoIFg8lswQEg,221
4
4
  easycoder/ec_classes.py,sha256=xnWBNak8oKydkFoxHLlq9wo3lIsB3aMnTDrqbtCfoWo,1512
5
5
  easycoder/ec_compiler.py,sha256=2r6Nk7px9UMYqIpYc6dAbYOAFu-CoWPy-iqlsed49Lo,4690
6
6
  easycoder/ec_condition.py,sha256=WSbONo4zs2sX1icOVpscZDFSCAEFmTsquoc2RGcLx_k,763
7
- easycoder/ec_core.py,sha256=YGEEfnzPi8NQX-F7zWM-aic4FzDcAbuKalFQp0YIzKY,78939
7
+ easycoder/ec_core.py,sha256=rglL7s3f1Ewzc0wjUPZxoY8__DJscxjZU7-Pd6OCIZQ,79904
8
8
  easycoder/ec_graphics.py,sha256=o70BdQ-Y3uIo5nheQYwJUmM3gYVerKD9_5arQ8JTP-Y,15556
9
9
  easycoder/ec_handler.py,sha256=IJvxcrJJSR53d6DS_8H5qPHKhp9y5-GV4WXAjhZxu_o,2250
10
10
  easycoder/ec_program.py,sha256=TUKQo56vURtx_UO7avIJZhz0EeOe2lNxQQz8EOOnCZ4,8685
@@ -12,8 +12,8 @@ easycoder/ec_renderer.py,sha256=ejVFemHGuFBwGA__6VfZQZeZMnw4Ilvf_y9I34k04LM,7981
12
12
  easycoder/ec_screenspec.py,sha256=TeXgccfYoE--r7Rf9t9drV1V3fU-p-iBnZwtjHzIh8M,2524
13
13
  easycoder/ec_timestamp.py,sha256=_3QFJPzIWZ9Rzk3SQOQJ-gwmvB07pg78k23SPntoZtY,288
14
14
  easycoder/ec_value.py,sha256=XIBtGhcCgh1abrzAn-Wy4l_xH_3cTWakMVIiSlBAZjM,2386
15
- easycoder-250102.1.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
16
- easycoder-250102.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
17
- easycoder-250102.1.dist-info/WHEEL,sha256=ssQ84EZ5gH1pCOujd3iW7HClo_O_aDaClUbX4B8bjKY,100
18
- easycoder-250102.1.dist-info/METADATA,sha256=Sq25qn0s0MFnqadz35dmOedro1p235uwVXPxHO-hXJE,5178
19
- easycoder-250102.1.dist-info/RECORD,,
15
+ easycoder-250103.2.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
16
+ easycoder-250103.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
17
+ easycoder-250103.2.dist-info/WHEEL,sha256=ssQ84EZ5gH1pCOujd3iW7HClo_O_aDaClUbX4B8bjKY,100
18
+ easycoder-250103.2.dist-info/METADATA,sha256=UyIqZzD6XVImMRxZloXqyE_bUKKJRGCMztjXaaIPBTc,5178
19
+ easycoder-250103.2.dist-info/RECORD,,