Repository: spyder-ide/spyder

Issue:
Fix abbreviations for seconds in profiler
<!--- **PLEASE READ:** When submitting here, please ensure you've completed the following checklist and checked the boxes to confirm. Issue reports without it may be closed. Thanks! --->

### Issue Report Checklist

* [ ] Searched the [issues page](https://github.com/spyder-ide/spyder/issues?q=is%3Aissue) for similar reports
* [ ] Read the relevant sections of the [Spyder Troubleshooting Guide](https://github.com/spyder-ide/spyder/wiki/Troubleshooting-Guide-and-FAQ) and followed its advice
* [ ] Reproduced the issue after updating with ``conda update spyder`` (or ``pip``, if not using Anaconda)
* [ ] Could not reproduce inside ``jupyter qtconsole`` (if console-related)
* [ ] Tried basic troubleshooting (if a bug/error)
    * [ ] Restarted Spyder
    * [ ] Reset preferences with ``spyder --reset``
    * [ ] Reinstalled the latest version of [Anaconda](https://www.anaconda.com/download/)
    * [ ] Tried the other applicable steps from the Troubleshooting Guide
* [ ] Completed the **Problem Description**, **Steps to Reproduce** and **Version** sections below


## Problem Description

Abbreviation for seconds should be 's' and 'us' should be 'μs'

![Screen Shot 2020-06-18 at 5 12 02 PM](https://user-images.githubusercontent.com/18587879/85076959-d5dd3700-b186-11ea-83f5-19b163cf944b.png)

### What steps reproduce the problem?

1. 
2. 
3. 

### What is the expected output? What do you see instead?



### Paste Traceback/Error Below (if applicable)
<!--- Copy from error dialog or View > Panes > Internal Console --->

```python-traceback

PASTE TRACEBACK HERE

```

## Versions
<!--- You can get this information from Help > About Spyder...
or (if Spyder won't launch) the "conda list" command
from the Anaconda Prompt/Terminal/command line. --->

* Spyder version: 
* Python version: 
* Qt version: 
* PyQt version: 
* Operating System name/version: 

### Dependencies
<!--- Please go to the menu entry Help > Dependencies,
press the Copy to clipboard button and paste below --->

```
PASTE DEPENDENCIES HERE
```



Discussion:

Resolving patch:
diff --git a/spyder/plugins/profiler/widgets/profilergui.py b/spyder/plugins/profiler/widgets/profilergui.py
--- a/spyder/plugins/profiler/widgets/profilergui.py
+++ b/spyder/plugins/profiler/widgets/profilergui.py
@@ -393,7 +393,7 @@ def gettime_s(text):
         tmp = float(res[0])
         if res[1] == 'ns':
             tmp *= 1e-9
-        elif res[1] == 'us':
+        elif res[1] == u'\u03BCs':
             tmp *= 1e-6
         elif res[1] == 'ms':
             tmp *= 1e-3
@@ -589,11 +589,11 @@ def format_measure(measure):
         if 1.e-9 < measure <= 1.e-6:
             measure = u"{0:.2f} ns".format(measure / 1.e-9)
         elif 1.e-6 < measure <= 1.e-3:
-            measure = u"{0:.2f} us".format(measure / 1.e-6)
+            measure = u"{0:.2f} \u03BCs".format(measure / 1.e-6)
         elif 1.e-3 < measure <= 1:
             measure = u"{0:.2f} ms".format(measure / 1.e-3)
         elif 1 < measure <= 60:
-            measure = u"{0:.2f} sec".format(measure)
+            measure = u"{0:.2f} s".format(measure)
         elif 60 < measure <= 3600:
             m, s = divmod(measure, 3600)
             if s > 60:


Test patch:
diff --git a/spyder/plugins/profiler/tests/test_profiler.py b/spyder/plugins/profiler/tests/test_profiler.py
--- a/spyder/plugins/profiler/tests/test_profiler.py
+++ b/spyder/plugins/profiler/tests/test_profiler.py
@@ -46,17 +46,17 @@ def test_format_measure(profiler_datatree_bot):
     fm = tree.format_measure
     assert fm(125) == '125'
     assert fm(1.25e-8) == '12.50 ns'
-    assert fm(1.25e-5) == '12.50 us'
+    assert fm(1.25e-5) == u'12.50 \u03BCs'
     assert fm(1.25e-2) == '12.50 ms'
-    assert fm(12.5) == '12.50 sec'
+    assert fm(12.5) == '12.50 s'
     assert fm(125.5) == '2.5 min'
     assert fm(12555.5) == '3h:29min'
 
     assert fm(-125) == '125'
     assert fm(-1.25e-8) == '12.50 ns'
-    assert fm(-1.25e-5) == '12.50 us'
+    assert fm(-1.25e-5) == u'12.50 \u03BCs'
     assert fm(-1.25e-2) == '12.50 ms'
-    assert fm(-12.5) == '12.50 sec'
+    assert fm(-12.5) == '12.50 s'
     assert fm(-125.5) == '2.5 min'
     assert fm(-12555.5) == '3h:29min'
 
@@ -67,13 +67,13 @@ def test_color_string(profiler_datatree_bot):
     cs = tree.color_string
 
     tree.compare_file = 'test'
-    assert cs([5.0]) == ['5.00 sec', ['', 'black']]
-    assert cs([1.251e-5, 1.251e-5]) == ['12.51 us', ['', 'black']]
-    assert cs([5.0, 4.0]) == ['5.00 sec', ['+1000.00 ms', 'red']]
-    assert cs([4.0, 5.0]) == ['4.00 sec', ['-1000.00 ms', 'green']]
+    assert cs([5.0]) == ['5.00 s', ['', 'black']]
+    assert cs([1.251e-5, 1.251e-5]) == [u'12.51 \u03BCs', ['', 'black']]
+    assert cs([5.0, 4.0]) == ['5.00 s', ['+1000.00 ms', 'red']]
+    assert cs([4.0, 5.0]) == ['4.00 s', ['-1000.00 ms', 'green']]
 
     tree.compare_file = None
-    assert cs([4.0, 5.0]) == ['4.00 sec', ['', 'black']]
+    assert cs([4.0, 5.0]) == ['4.00 s', ['', 'black']]
 
 
 def test_format_output(profiler_datatree_bot):
@@ -95,11 +95,11 @@ class Stats:
 
     tree.compare_file = 'test'
     assert list((fo('key1'))) == [['1000', ['', 'black']],
-                                  ['3.50 sec', ['-200.00 ms', 'green']],
-                                  ['1.50 sec', ['+200.00 ms', 'red']]]
+                                  ['3.50 s', ['-200.00 ms', 'green']],
+                                  ['1.50 s', ['+200.00 ms', 'red']]]
     assert list((fo('key2'))) == [['1200', ['+1', 'red']],
-                                  ['2.00 sec', ['-400.00 ms', 'green']],
-                                  ['2.00 sec', ['-400.00 ms', 'green']]]
+                                  ['2.00 s', ['-400.00 ms', 'green']],
+                                  ['2.00 s', ['-400.00 ms', 'green']]]
 
 
 if __name__ == "__main__":