@@ -322,48 +322,6 @@ def flatten_result(source):
322
322
result [i ] += piece
323
323
return result , result_args
324
324
325
- #def reverse_normalized(pattern, *args, **kwargs):
326
- # for res, params in pattern:
327
- # if args:
328
- # if len(args) != len(params):
329
- # continue
330
- # candidate = res % dict(zip(params, args))
331
- # else:
332
- # if set(kwargs.keys()) != set(params):
333
- # continue
334
- # candidate = res % kwargs
335
- #
336
- # if re.search(u'^%s' % pattern, candidate, re.UNICODE):
337
- # return candidate
338
- #
339
- # raise Exception()
340
- #
341
- #def reverse(pattern, *args, **kwargs):
342
- # n_pattern = normalize(pattern)
343
- # return reverse_normalized(n_pattern, *args, **kwargs)
344
-
345
- #def reverse_normal(n_pattern, pattern, *args, **kwargs):
346
- # if isinstance(pattern, basestring):
347
- # pattern = re.compile(pattern.encode('utf-8'), re.UNICODE)
348
- #
349
- # for res, params in n_pattern:
350
- # if args:
351
- # if len(args) != len(params):
352
- # continue
353
- # candidate = res % dict(zip(params, args))
354
- # else:
355
- # if set(kwargs.keys()) != set(params):
356
- # continue
357
- # candidate = res % kwargs
358
- #
359
- # if pattern.search(candidate):
360
- # return candidate
361
- #
362
- # return None
363
- #
364
- #def reverse(pattern, *args, **kwargs):
365
- # return reverse_normal(normalize(pattern), pattern, *args, **kwargs)
366
-
367
325
def reverse_normal (n_pattern , pattern , * args , ** kwargs ):
368
326
if isinstance (pattern , basestring ):
369
327
pattern = re .compile (pattern , re .UNICODE )
@@ -384,22 +342,3 @@ def reverse_normal(n_pattern, pattern, *args, **kwargs):
384
342
385
343
def reverse (pattern , * args , ** kwargs ):
386
344
return reverse_normal (normalize (pattern ), pattern , * args , ** kwargs )
387
-
388
- #def reverse(pattern, *args, **kwargs):
389
- # if not pattern.startswith('^'):
390
- # pattern = r'^%s' % pattern
391
- # for res, params in normalize(pattern):
392
- # if args:
393
- # if len(args) != len(params):
394
- # continue
395
- # candidate = res % dict(zip(params, args))
396
- # else:
397
- # if set(kwargs.keys()) != set(params):
398
- # continue
399
- # candidate = res % kwargs
400
- #
401
- # if re.search(pattern, candidate, re.UNICODE):
402
- # return candidate
403
- #
404
- # #raise Exception()
405
- # return None
0 commit comments