Repository: ipython/traitlets (python)

Issue:
5.0.0 fails to parse args
Hi, 
Looks like you are about to release `5.0.0` but it already gets fetched by `jupyter` :
```shell
docker run --rm -it python:3.7 bash
$ pip install jupyter
...
Collecting traitlets>=4.2
  Downloading traitlets-5.0.0-py3-none-any.whl (97 kB)
...
```
And leads to an exception in my tests, you may try to reproduce with:
```
$ python
>> from nbconvert import nbconvertapp
>> nbconvertapp.main(["nbconvert", "--output", "/tmp/qwe.txt", "simple-py36.ipynb"])
...
: error: unrecognized arguments: simple-py36.ipynb
...
```
I have fixed it by pinning to `traitlets>=4.2,<5.0.0`.

Pull request description:
handle deprecated eval syntax for Bytes on the command-line
closes ipython/ipykernel#543
closes #608

Patch:
diff --git a/traitlets/traitlets.py b/traitlets/traitlets.py
index c2e8c3a..d677bd4 100644
--- a/traitlets/traitlets.py
+++ b/traitlets/traitlets.py
@@ -2139,9 +2139,20 @@ class Bytes(TraitType):
         self.error(obj, value)
 
     def from_string(self, s):
-        if self.allow_none and s == 'None':
+        if self.allow_none and s == "None":
             return None
-        return s.encode('utf8')
+        if len(s) >= 3:
+            # handle deprecated b"string"
+            for quote in ('"', "'"):
+                if s[:2] == f"b{quote}" and s[-1] == quote:
+                    old_s = s
+                    s = s[2:-1]
+                    warn(
+                        "Supporting extra quotes around Bytes is deprecated in traitlets 5.0. "
+                        "Use %r instead of %r." % (s, old_s),
+                        FutureWarning)
+                    break
+        return s.encode("utf8")
 
 
 class CBytes(Bytes):


Test patch:
diff --git a/traitlets/tests/test_traitlets.py b/traitlets/tests/test_traitlets.py
index bcd8d51..e4f456b 100644
--- a/traitlets/tests/test_traitlets.py
+++ b/traitlets/tests/test_traitlets.py
@@ -2688,6 +2688,22 @@ def test_cunicode_from_string(s, expected):
     _from_string_test(CUnicode, s, expected)
 
 
+@pytest.mark.parametrize(
+    "s, expected",
+    [("xyz", b"xyz"), ("1", b"1"), ('b"xx"', b"xx"), ("b'abc'", b"abc"), ("None", None)],
+)
+def test_bytes_from_string(s, expected):
+    _from_string_test(Bytes, s, expected)
+
+
+@pytest.mark.parametrize(
+    "s, expected",
+    [("xyz", b"xyz"), ("1", b"1"), ('b"xx"', b"xx"), ("b'abc'", b"abc"), ("None", None)],
+)
+def test_cbytes_from_string(s, expected):
+    _from_string_test(CBytes, s, expected)
+
+
 @pytest.mark.parametrize(
     "s, expected",
     [("x", ValueError), ("1", 1), ("123", 123), ("2.0", ValueError), ("None", None)],