Feat: import Expression from calculus and docstring in random
This commit is contained in:
		
							
								
								
									
										39
									
								
								mapytex/calculus/core/random/str_gene.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								mapytex/calculus/core/random/str_gene.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,39 @@ | ||||
| #! /usr/bin/env python | ||||
| # -*- coding: utf-8 -*- | ||||
| # vim:fenc=utf-8 | ||||
| # | ||||
| # Copyright © 2017 lafrite <lafrite@Poivre> | ||||
| # | ||||
| # Distributed under terms of the MIT license. | ||||
|  | ||||
| """ | ||||
| Function to create random strings | ||||
|  | ||||
| :example: | ||||
|  | ||||
| >>> form = "{a} / {b} + {c} / {k*b}" | ||||
| >>> conditions = [ | ||||
| ...    "abs({b}) != 1", | ||||
| ...    "{d} > 1", | ||||
| ...    "{b} != {d}", | ||||
| ...    "gcd({a},{b}) == 1", | ||||
| ...    "gcd({c},{k*b}) == 1", | ||||
| ...    ] | ||||
| >>> #random_str(form, conditions) | ||||
|  | ||||
| >>> form = "{a:int}x + {b:fraction}" | ||||
| >>> conditions = [ | ||||
| ...    "{b.denom} > 2", | ||||
| ...    ] | ||||
| >>> #random_str(form, conditions) | ||||
|  | ||||
| """ | ||||
| import random | ||||
|  | ||||
| __all__ = [] | ||||
|  | ||||
|  | ||||
| # ----------------------------- | ||||
| # Reglages pour 'vim' | ||||
| # vim:set autoindent expandtab tabstop=4 shiftwidth=4: | ||||
| # cursor: 16 del | ||||
		Reference in New Issue
	
	Block a user