move circular resolvents to oop/dict.scm

parent 4e5beaaa
......@@ -1561,12 +1561,12 @@
(in (b->list x) b))
(set! (@@ (language python string) bytes) bytes)
(set! (@@ (language python string) b?)
(set! (@@ (oop dict) bytes) bytes)
(set! (@@ (oop dict) b?)
(lambda (x)
(or (is-a? x <bytevector>)
(is-a? x <py-bytes>)
(is-a? x <py-bytearray>))))
(set! (@@ (language python string) b-decode) py-decode)
(set! (@@ (oop dict) b-decode) py-decode)
(define b-enc #f)
(define-module (language python def)
#:use-module (ice-9 pretty-print)
#:use-module (oop pf-objects)
#:use-module ((oop dict) #:select (hset! mkw to-list))
#:use-module (language python exceptions)
#:use-module (ice-9 match)
#:use-module (srfi srfi-11)
......@@ -44,8 +45,6 @@
(()
(values (reverse args) kw)))))
(define hset! hash-set!)
(define (pytonize kw)
(hash-fold
(lambda (k v h)
......@@ -111,8 +110,6 @@
(define-syntax-rule (def (f . args) code ...) (define f (lam args code ...)))
(define to-list #f)
(define (no x)
(and-map
(lambda (x)
......@@ -130,8 +127,6 @@
(if (string? x)
(string->symbol x)
x))))
(define (mkw kw) (error "not implemented"))
(define-syntax m*
(syntax-rules (* ** =)
......
......@@ -47,7 +47,7 @@
(define (py-hash-remove! . l)
(apply hashx-remove! h py-assoc l))
(set! (@@ (language python def) hset!) py-hash-set!)
(set! (@@ (oop dict) hset!) py-hash-set!)
(define H (hash 1333674836 complexity))
......
......@@ -182,7 +182,7 @@
(name-object wrap-in)
(set! (@@ (oop pf-objects) hashforeach)
(set! (@@ (oop dict) hashforeach)
(lambda (f d)
(for ((k v : d)) () (f k v))))
......@@ -194,7 +194,7 @@
(string->symbol x)
x))))
(set! (@@ (language python def) mkw)
(set! (@@ (oop dict) mkw)
(lambda (kw)
(for ((k v : kw)) ((l '()))
(cons* v (mk-k k) l)
......
......@@ -3,15 +3,13 @@
#:use-module (parser stis-parser)
#:use-module (oop pf-objects)
#:use-module (oop goops)
#:use-module ((oop dict) #:select (splitm splitmm))
#:use-module (language python exceptions)
#:use-module (language python number)
#:use-module (language python dict)
#:use-module (language python list)
#:export (format fnm))
(define splitm #f)
(define splitmm #f)
(define-syntax-rule (aif it p x y) (let ((it p)) (if it x y)))
(define scm-format (@ (guile) format))
......
......@@ -4,6 +4,7 @@
#:use-module (ice-9 format)
#:use-module (oop pf-objects)
#:use-module (oop goops)
#:use-module ((oop dict) #:select (int))
#:use-module (language python hash)
#:use-module (language python tuple)
#:use-module (language python exceptions)
......@@ -1020,4 +1021,4 @@
(define py-list list)
(set! (@@ (language python def) to-list) to-list)
(set! (@@ (oop dict) to-list) to-list)
(define-module (language python module)
#:use-module (oop pf-objects)
#:use-module (oop goops)
#:use-module ((oop dict) #:select (m?))
#:use-module (ice-9 match)
#:use-module (system syntax)
#:use-module (language python exceptions)
......@@ -318,7 +319,7 @@
(else
#f)) a ...)))))
(define (m? x) #f)
(define (import-f x f . l)
(if x
......@@ -359,4 +360,4 @@
(pylist-set! modules x e)
e))))
(set! (@@ (oop pf-objects) Module) Module)
(set! (@@ (oop dict) Module) Module)
......@@ -435,7 +435,7 @@
(pf-set self 'z z))))
(set! (@@ (language python module) m?)
(set! (@@ (oop dict) m?)
(lambda (x) (isinstance x (@@ (language python module) Module))))
(define (delattr o key) (rawdel o key))
......@@ -26,10 +26,10 @@
((@ (guile) list) (pk name)))))
(module-public-interface (resolve-module 'iface))))]))
(set! (@@ (language python format2) splitm)
(set! (@@ (oop dict) splitm)
(@@ (language python module re) splitm))
(set! (@@ (language python format2) splitmm)
(set! (@@ (oop dict) splitmm)
(@@ (language python module re) splitmm))
(set! (@ (language python module os) path)
......
......@@ -70,7 +70,7 @@
s))
(_ (raise (ValueError (+ "wrong format " format-str))))))
(set! (@@ (language python string) format)
(set! (@@ (oop dict) format)
(lambda (f s)
(py-format s f)))
......@@ -416,5 +416,5 @@
(define (ascii x) (bytes x))
(define formatter (Formatter))
(set! (@@ (language python string) formatter) formatter)
(set! (@@ (oop dict) formatter) formatter)
(set! (@@ (language python compile) formatter) (ref formatter 'vformat2))
......@@ -675,4 +675,4 @@
(+ "0b" (number->string (py-index o) 2)))
(set! (@@ (language python list) int) int)
(set! (@@ (oop dict) int) int)
(define-module (language python string)
#:use-module (parser stis-parser)
#:use-module (oop goops)
#:use-module ((oop dict) #:select (formatter format bytes b? b-decode))
#:use-module (oop pf-objects)
#:use-module (language python hash)
#:use-module (ice-9 match)
......@@ -172,14 +173,14 @@
(- n it (len sub))
-1)))))
(define formatter #f)
(define-py (py-strformat format s . l)
(apply (ref formatter 'format) s l))
(define-py (py-format-map format_map s map)
(apply (ref formatter 'vformat) s '() map))
(define format (lambda (a b) a))
(define-py (py-format format s format-string)
(format s format-string))
......@@ -381,8 +382,6 @@
(let ((n (len s)))
(- n (apply pylist-index (string-reverse s) l) 1)))
(define bytes #f)
(define (geterr errors)
(set! errors (py-lower (scm-str errors)))
(cond
......@@ -627,8 +626,6 @@
(lp (+ i 1))))
s))))
(define b? #f)
(define b-decode #f)
(define-python-class string (<py> <py-string>)
(define __init__
(case-lambda
......
......@@ -2,7 +2,10 @@
#:export (procedure-property- procedure-properties- set-procedure-property!-
set-procedure-properties!- dictNs dictRNs
hash-for-each* object-method class-method
static-method))
static-method Module splitm splitmm
formatter format m? bytes b? b-decode hset!
hashforeach mkw to-list int))
(define-syntax-rule (aif it p x y) (let ((it p)) (if it x y)))
......@@ -47,3 +50,25 @@
(define (static-method f)
f)
(define (Module x . l) (reverse x))
(define splitm #f)
(define splitmm #f)
(define formatter #f)
(define format (lambda (a b) a))
(define (m? x) #f)
(define bytes #f)
(define b? #f)
(define b-decode #f)
(define hset! hash-set!)
(define (hashforeach a b) (values))
(define (mkw kw) (error "not implemented"))
(define to-list #f)
(define (int x) x)
......@@ -316,8 +316,6 @@ explicitly tell it to not update etc.
(define (resolve-method-o o pattern)
(resolve-method-g (class-of o) pattern))
(define (hashforeach a b) (values))
(define (add-default c l)
(if (pair? l)
......@@ -414,8 +412,6 @@ explicitly tell it to not update etc.
(define (get-mros supers)
(get-mro (get-cparents supers)))
(define (Module x . l) (reverse x))
(define (add-specials pylist-set! dict name goops supers meta doc)
(define (make-module)
(let ((l (module-name (current-module))))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment