Move is_numerical() to joy.gui.utils.
This commit is contained in:
parent
177d6cd433
commit
a3f863ff18
|
|
@ -49,7 +49,8 @@ import os, sys
|
||||||
from joy.utils.stack import stack_to_string
|
from joy.utils.stack import stack_to_string
|
||||||
|
|
||||||
from .mousebindings import MouseBindingsMixin
|
from .mousebindings import MouseBindingsMixin
|
||||||
from .world import World, is_numerical
|
from .utils import is_numerical
|
||||||
|
from .world import World
|
||||||
|
|
||||||
|
|
||||||
def make_gui(dictionary):
|
def make_gui(dictionary):
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,14 @@ COMMITTER = 'Joy <auto-commit@example.com>'
|
||||||
DEFAULT_JOY_HOME = expanduser(join('~', '.joypy'))
|
DEFAULT_JOY_HOME = expanduser(join('~', '.joypy'))
|
||||||
|
|
||||||
|
|
||||||
|
def is_numerical(s):
|
||||||
|
try:
|
||||||
|
float(s)
|
||||||
|
except ValueError:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
def home_dir(path):
|
def home_dir(path):
|
||||||
'''Return the absolute path of an existing directory.'''
|
'''Return the absolute path of an existing directory.'''
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,14 +28,7 @@ from joy.joy import run
|
||||||
from joy.parser import Symbol
|
from joy.parser import Symbol
|
||||||
from joy.utils.stack import stack_to_string
|
from joy.utils.stack import stack_to_string
|
||||||
from joy.utils.types import type_check
|
from joy.utils.types import type_check
|
||||||
|
from .utils import is_numerical
|
||||||
|
|
||||||
def is_numerical(s):
|
|
||||||
try:
|
|
||||||
float(s)
|
|
||||||
except ValueError:
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
class World(object):
|
class World(object):
|
||||||
|
|
@ -121,7 +114,6 @@ class World(object):
|
||||||
|
|
||||||
class StackDisplayWorld(World):
|
class StackDisplayWorld(World):
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, repo, filename, rel_filename, dictionary=None, text_widget=None):
|
def __init__(self, repo, filename, rel_filename, dictionary=None, text_widget=None):
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
stack = self.load_stack() or ()
|
stack = self.load_stack() or ()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue