edponce commented on a change in pull request #11978:
URL: https://github.com/apache/arrow/pull/11978#discussion_r781104442



##########
File path: dev/archery/archery/crossbow/core.py
##########
@@ -537,17 +537,36 @@ def _latest_prefix_id(self, prefix):
             latest = -1
         return latest
 
+    def _latest_prefix_date(self, prefix):
+        pattern = re.compile(r'[\w\/-]*{}-(\d+)-(\d+)-(\d+)'.format(prefix))
+        matches = list(filter(None, map(pattern.match, self.repo.branches)))
+        if matches:
+            latest = sorted([m.group(0) for m in matches])[-1]
+            # slice the trailing date part (YYYY-MM-DD)
+            latest = latest[-10:]
+        else:
+            latest = -1
+        return latest

Review comment:
       Stylistic suggestion:
   ```python
   # slice [-10:] corresponds to the trailing date part (YYYY-MM-DD)
   return sorted([m.group(0) for m in matches])[-1][-10:] if matches else -1
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to