Skip to content

Commit dd3ad94

Browse files
committed
fix typeshed error
1 parent 11e45ba commit dd3ad94

File tree

2 files changed

+97
-3
lines changed

2 files changed

+97
-3
lines changed

cwltool/provenance.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,13 +1018,13 @@ def _initialize_bagit(self): # type: () -> None
10181018
def open_log_file_for_activity(self, uuid_uri): # type: (Text) -> IO
10191019
self.self_check()
10201020
# Ensure valid UUID for safe filenames
1021-
activity_uuid = uuid.UUID(uuid_uri.replace("urn:uuid:", ""))
1021+
activity_uuid = uuid.UUID(uuid_uri)
10221022
if activity_uuid.urn == self.engine_uuid:
10231023
# It's the engine aka cwltool!
10241024
name = "engine"
10251025
else:
10261026
name = "activity"
1027-
p = os.path.join(LOGS, "%s.%s.txt" % (name, activity_uuid))
1027+
p = os.path.join(LOGS, "{}.{}.txt".format(name, activity_uuid))
10281028
_logger.debug("[provenance] Opening log file for %s: %s" % (name, p))
10291029
self.add_annotation(activity_uuid.urn, [p], CWLPROV["log"].uri)
10301030
return self.write_bag_file(p)
@@ -1363,8 +1363,8 @@ def _write_bag_info(self):
13631363

13641364
def generate_snapshot(self, prov_dep):
13651365
# type: (MutableMapping[Text, Any]) -> None
1366-
self.self_check()
13671366
"""Copy all of the CWL files to the snapshot/ directory."""
1367+
self.self_check()
13681368
for key, value in prov_dep.items():
13691369
if key == "location" and value.split("/")[-1]:
13701370
filename = value.split("/")[-1]

typeshed/2and3/uuid.pyi

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Stubs for uuid
2+
3+
import sys
4+
from typing import Tuple, Optional, Any, Union
5+
6+
# Because UUID has properties called int and bytes we need to rename these temporarily.
7+
_Int = int
8+
_Bytes = bytes
9+
_FieldsType = Tuple[int, int, int, int, int, int]
10+
if sys.version_info >= (3,):
11+
_Text = str
12+
else:
13+
_Text = Union[str, unicode]
14+
15+
class UUID:
16+
def __init__(self, hex: Optional[_Text] = ...,
17+
bytes: Optional[_Bytes] = ...,
18+
bytes_le: Optional[_Bytes] = ...,
19+
fields: Optional[_FieldsType] = ...,
20+
int: Optional[_Int] = ...,
21+
version: Optional[_Int] = ...) -> None: ...
22+
@property
23+
def bytes(self) -> _Bytes: ...
24+
@property
25+
def bytes_le(self) -> _Bytes: ...
26+
@property
27+
def clock_seq(self) -> _Int: ...
28+
@property
29+
def clock_seq_hi_variant(self) -> _Int: ...
30+
@property
31+
def clock_seq_low(self) -> _Int: ...
32+
@property
33+
def fields(self) -> _FieldsType: ...
34+
@property
35+
def hex(self) -> str: ...
36+
@property
37+
def int(self) -> _Int: ...
38+
@property
39+
def node(self) -> _Int: ...
40+
@property
41+
def time(self) -> _Int: ...
42+
@property
43+
def time_hi_version(self) -> _Int: ...
44+
@property
45+
def time_low(self) -> _Int: ...
46+
@property
47+
def time_mid(self) -> _Int: ...
48+
@property
49+
def urn(self) -> str: ...
50+
@property
51+
def variant(self) -> str: ...
52+
@property
53+
def version(self) -> Optional[_Int]: ...
54+
55+
def __int__(self) -> _Int: ...
56+
57+
if sys.version_info >= (3,):
58+
def __eq__(self, other: Any) -> bool: ...
59+
def __lt__(self, other: Any) -> bool: ...
60+
def __le__(self, other: Any) -> bool: ...
61+
def __gt__(self, other: Any) -> bool: ...
62+
def __ge__(self, other: Any) -> bool: ...
63+
else:
64+
def get_bytes(self) -> _Bytes: ...
65+
def get_bytes_le(self) -> _Bytes: ...
66+
def get_clock_seq(self) -> _Int: ...
67+
def get_clock_seq_hi_variant(self) -> _Int: ...
68+
def get_clock_seq_low(self) -> _Int: ...
69+
def get_fields(self) -> _FieldsType: ...
70+
def get_hex(self) -> str: ...
71+
def get_node(self) -> _Int: ...
72+
def get_time(self) -> _Int: ...
73+
def get_time_hi_version(self) -> _Int: ...
74+
def get_time_low(self) -> _Int: ...
75+
def get_time_mid(self) -> _Int: ...
76+
def get_urn(self) -> str: ...
77+
def get_variant(self) -> str: ...
78+
def get_version(self) -> Optional[_Int]: ...
79+
def __cmp__(self, other: Any) -> _Int: ...
80+
81+
def getnode() -> int: ...
82+
def uuid1(node: Optional[_Int] = ..., clock_seq: Optional[_Int] = ...) -> UUID: ...
83+
def uuid3(namespace: UUID, name: str) -> UUID: ...
84+
def uuid4() -> UUID: ...
85+
def uuid5(namespace: UUID, name: str) -> UUID: ...
86+
87+
NAMESPACE_DNS = ... # type: UUID
88+
NAMESPACE_URL = ... # type: UUID
89+
NAMESPACE_OID = ... # type: UUID
90+
NAMESPACE_X500 = ... # type: UUID
91+
RESERVED_NCS = ... # type: str
92+
RFC_4122 = ... # type: str
93+
RESERVED_MICROSOFT = ... # type: str
94+
RESERVED_FUTURE = ... # type: str

0 commit comments

Comments
 (0)