easycoder 250317.3__py2.py3-none-any.whl → 250403.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 +1 -1
- easycoder/__init__.sync-conflict-20250331-210244-M3XB3VD.py +12 -0
- easycoder/ec_core.py +68 -46
- easycoder/ec_core.sync-conflict-20250331-210238-M3XB3VD.py +2564 -0
- easycoder/ec_graphics.py +38 -1
- easycoder/ec_program.py +0 -3
- {easycoder-250317.3.dist-info → easycoder-250403.1.dist-info}/METADATA +3 -2
- easycoder-250403.1.dist-info/RECORD +19 -0
- {easycoder-250317.3.dist-info → easycoder-250403.1.dist-info}/WHEEL +1 -1
- easycoder-250317.3.dist-info/RECORD +0 -17
- {easycoder-250317.3.dist-info → easycoder-250403.1.dist-info}/entry_points.txt +0 -0
- {easycoder-250317.3.dist-info → easycoder-250403.1.dist-info/licenses}/LICENSE +0 -0
easycoder/__init__.py
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'''EasyCoder for Python'''
|
|
2
|
+
|
|
3
|
+
from .ec_classes import *
|
|
4
|
+
from .ec_compiler import *
|
|
5
|
+
from .ec_condition import *
|
|
6
|
+
from .ec_core import *
|
|
7
|
+
from .ec_handler import *
|
|
8
|
+
from .ec_program import *
|
|
9
|
+
from .ec_timestamp import *
|
|
10
|
+
from .ec_value import *
|
|
11
|
+
|
|
12
|
+
__version__ = "250302.1"
|
easycoder/ec_core.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import json, math, hashlib, threading, os, subprocess, sys, requests, time, numbers, base64, binascii
|
|
1
|
+
import json, math, hashlib, threading, os, subprocess, sys, requests, time, numbers, base64, binascii, random
|
|
2
2
|
from psutil import Process
|
|
3
3
|
from datetime import datetime, timezone
|
|
4
4
|
from random import randrange
|
|
@@ -144,7 +144,7 @@ class Core(Handler):
|
|
|
144
144
|
else:
|
|
145
145
|
return self.compileFromHere(['end'])
|
|
146
146
|
|
|
147
|
-
# Clear (set
|
|
147
|
+
# Clear (set false)
|
|
148
148
|
# clear {variable}
|
|
149
149
|
def k_clear(self, command):
|
|
150
150
|
if self.nextIsSymbol():
|
|
@@ -405,36 +405,40 @@ class Core(Handler):
|
|
|
405
405
|
else:
|
|
406
406
|
FatalError(self.compiler, f'Variable "{symbolRecord["name"]}" does not hold a value')
|
|
407
407
|
if self.nextIs('from'):
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
408
|
+
if self.nextIs('url'):
|
|
409
|
+
url = self.nextValue()
|
|
410
|
+
if url != None:
|
|
411
|
+
command['url'] = url
|
|
412
|
+
command['or'] = None
|
|
413
|
+
get = self.getPC()
|
|
414
|
+
if self.peek() == 'timeout':
|
|
415
|
+
self.nextToken()
|
|
416
|
+
command['timeout'] = self.nextValue()
|
|
417
|
+
else:
|
|
418
|
+
timeout = {}
|
|
419
|
+
timeout['type'] = 'int'
|
|
420
|
+
timeout['content'] = 5
|
|
421
|
+
command['timeout'] = timeout
|
|
422
|
+
self.addCommand(command)
|
|
423
|
+
if self.peek() == 'or':
|
|
424
|
+
self.nextToken()
|
|
425
|
+
self.nextToken()
|
|
426
|
+
# Add a 'goto' to skip the 'or'
|
|
427
|
+
cmd = {}
|
|
428
|
+
cmd['lino'] = command['lino']
|
|
429
|
+
cmd['domain'] = 'core'
|
|
430
|
+
cmd['keyword'] = 'gotoPC'
|
|
431
|
+
cmd['goto'] = 0
|
|
432
|
+
cmd['debug'] = False
|
|
433
|
+
skip = self.getPC()
|
|
434
|
+
self.addCommand(cmd)
|
|
435
|
+
# Process the 'or'
|
|
436
|
+
self.getCommandAt(get)['or'] = self.getPC()
|
|
437
|
+
self.compileOne()
|
|
438
|
+
# Fixup the skip
|
|
439
|
+
self.getCommandAt(skip)['goto'] = self.getPC()
|
|
440
|
+
return True
|
|
441
|
+
return False
|
|
438
442
|
|
|
439
443
|
def r_get(self, command):
|
|
440
444
|
global errorCode, errorReason
|
|
@@ -1414,6 +1418,33 @@ class Core(Handler):
|
|
|
1414
1418
|
|
|
1415
1419
|
return self.nextPC()
|
|
1416
1420
|
|
|
1421
|
+
# Shuffle a list
|
|
1422
|
+
def k_shuffle(self, command):
|
|
1423
|
+
if self.nextIsSymbol():
|
|
1424
|
+
symbolRecord = self.getSymbolRecord()
|
|
1425
|
+
if symbolRecord['valueHolder']:
|
|
1426
|
+
command['target'] = self.getToken()
|
|
1427
|
+
self.add(command)
|
|
1428
|
+
return True
|
|
1429
|
+
self.warning(f'Core.negate: Variable "{symbolRecord["name"]}" does not hold a value')
|
|
1430
|
+
return False
|
|
1431
|
+
|
|
1432
|
+
def r_shuffle(self, command):
|
|
1433
|
+
symbolRecord = self.getVariable(command['target'])
|
|
1434
|
+
if not symbolRecord['valueHolder']:
|
|
1435
|
+
RuntimeError(self.program, f'{symbolRecord["name"]} does not hold a value')
|
|
1436
|
+
return None
|
|
1437
|
+
value = self.getSymbolValue(symbolRecord)
|
|
1438
|
+
if value == None:
|
|
1439
|
+
RuntimeError(self.program, f'{symbolRecord["name"]} has not been initialised')
|
|
1440
|
+
content = value['content']
|
|
1441
|
+
if isinstance(content, list):
|
|
1442
|
+
random.shuffle(content)
|
|
1443
|
+
value['content'] = content
|
|
1444
|
+
self.putSymbolValue(symbolRecord, value)
|
|
1445
|
+
return self.nextPC()
|
|
1446
|
+
RuntimeError(self.program, f'{symbolRecord["name"]} is not a list')
|
|
1447
|
+
|
|
1417
1448
|
# Declare a stack variable
|
|
1418
1449
|
def k_stack(self, command):
|
|
1419
1450
|
return self.compileVariable(command)
|
|
@@ -2389,17 +2420,11 @@ class Core(Handler):
|
|
|
2389
2420
|
|
|
2390
2421
|
if self.getToken() == 'file':
|
|
2391
2422
|
path = self.nextValue()
|
|
2392
|
-
if self.
|
|
2423
|
+
if self.peek() == 'exists':
|
|
2393
2424
|
condition.type = 'exists'
|
|
2394
2425
|
condition.path = path
|
|
2426
|
+
self.nextToken()
|
|
2395
2427
|
return condition
|
|
2396
|
-
if self.nextIs('does'):
|
|
2397
|
-
if self.nextIs('not'):
|
|
2398
|
-
if self.nextIs('exist'):
|
|
2399
|
-
condition.type = 'exists'
|
|
2400
|
-
condition.path = path
|
|
2401
|
-
condition.negate = not condition.negate
|
|
2402
|
-
return condition
|
|
2403
2428
|
return None
|
|
2404
2429
|
|
|
2405
2430
|
value = self.getValue()
|
|
@@ -2493,13 +2518,10 @@ class Core(Handler):
|
|
|
2493
2518
|
|
|
2494
2519
|
def c_empty(self, condition):
|
|
2495
2520
|
value = self.getRuntimeValue(condition.value1)
|
|
2496
|
-
if
|
|
2497
|
-
comparison =
|
|
2521
|
+
if value == None:
|
|
2522
|
+
comparison = True
|
|
2498
2523
|
else:
|
|
2499
|
-
|
|
2500
|
-
comparison = True
|
|
2501
|
-
else:
|
|
2502
|
-
comparison = len(value) == 0
|
|
2524
|
+
comparison = len(value) == 0
|
|
2503
2525
|
return not comparison if condition.negate else comparison
|
|
2504
2526
|
|
|
2505
2527
|
def c_ends(self, condition):
|