Permalink
Browse files

Move remove_non_ascii to monty. Update required monty version.

  • Loading branch information...
1 parent 1155a94 commit 607baf758be7a8b036f7ab77c685c80851e47850 @shyuep shyuep committed Feb 28, 2014
Showing with 5 additions and 25 deletions.
  1. +1 −1 pymatgen/io/cifio.py
  2. +1 −1 pymatgen/matproj/snl.py
  3. +0 −13 pymatgen/util/string_utils.py
  4. +1 −8 pymatgen/util/tests/test_string_utils.py
  5. +1 −1 requirements.txt
  6. +1 −1 setup.py
@@ -28,7 +28,7 @@
from pymatgen.core.periodic_table import Element, Specie
from monty.io import zopen
from pymatgen.util.coord_utils import in_coord_list_pbc
-from pymatgen.util.string_utils import remove_non_ascii
+from monty.string import remove_non_ascii
from pymatgen.core.lattice import Lattice
from pymatgen.core.structure import Structure
from pymatgen.core.composition import Composition
@@ -19,7 +19,7 @@
from collections import namedtuple
import json
-from pymatgen.util.string_utils import remove_non_ascii
+from monty.string import remove_non_ascii
from pymatgen.core.structure import Structure, Molecule
from pymatgen.serializers.json_coders import PMGJSONDecoder, PMGJSONEncoder
from pybtex.database.input import bibtex
@@ -221,19 +221,6 @@ def list_strings(arg):
return arg
-def remove_non_ascii(s):
- """
- Remove non-ascii characters in a file.
-
- Args:
- s: Input string
-
- Returns:
- String with all non-ascii characters removed.
- """
- return "".join(i for i in s if ord(i) < 128)
-
-
def stream_has_colours(stream):
"""
True if stream supports colours. Python cookbook, #475186
@@ -14,11 +14,9 @@
__date__ = "Aug 26, 2012"
import unittest
-import random
from pymatgen.util.string_utils import generate_latex_table, str_delimited, \
- str_aligned, formula_double_format, latexify, latexify_spacegroup, \
- remove_non_ascii
+ str_aligned, formula_double_format, latexify, latexify_spacegroup
class FuncTest(unittest.TestCase):
@@ -49,11 +47,6 @@ def test_formula_double_format(self):
self.assertEqual(formula_double_format(2.00), "2")
self.assertEqual(formula_double_format(2.10), "2.1")
- def test_remove_non_ascii(self):
- s = "".join(chr(random.randint(0, 127)) for i in xrange(10))
- s += "".join(chr(random.randint(128, 150)) for i in xrange(10))
- clean = remove_non_ascii(s)
- self.assertEqual(len(clean), 10)
if __name__ == "__main__":
#import sys;sys.argv = ['', 'Test.testName']
View
@@ -5,4 +5,4 @@ requests>=1.0
pybtex>=0.16
matplotlib>1.1
pydispatcher>=2.0
-monty>=0.2.0
+monty>=0.2.1
View
@@ -47,7 +47,7 @@ def get_spglib_ext():
version="2.9.2",
install_requires=["numpy>=1.5", "pyhull>=1.4.3", "PyCifRW>=3.3",
"requests>=1.0", "pybtex>=0.16", "pyyaml>=3.0",
- "monty>=0.2.0"],
+ "monty>=0.2.1"],
extras_require={"electronic_structure": ["scipy>=0.10"],
"plotting": ["matplotlib>=1.1"],
"ase_adaptor": ["ase>=3.3"],

0 comments on commit 607baf7

Please sign in to comment.