From 72a353c64a1d7c8995394d7ac2fc0ae49425b053 Mon Sep 17 00:00:00 2001 From: Dustin Lo Date: Tue, 8 Oct 2019 12:36:49 -0700 Subject: [PATCH] future library ported to python3 (#2) --- crawl_cals.py | 7 +++++-- crawl_orbits.py | 5 ++++- create_cal_ds.py | 3 ++- create_orbit_ds.py | 3 ++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/crawl_cals.py b/crawl_cals.py index d0d1379..ce40125 100755 --- a/crawl_cals.py +++ b/crawl_cals.py @@ -3,12 +3,15 @@ Crawl calibration files, create and ingest calibration datasets. """ +from future import standard_library +standard_library.install_aliases() +from builtins import str import os, sys, re, json, logging, traceback, requests, argparse, backoff, shutil from datetime import datetime from requests.packages.urllib3.exceptions import (InsecureRequestWarning, InsecurePlatformWarning) try: from html.parser import HTMLParser -except: from HTMLParser import HTMLParser +except: from html.parser import HTMLParser from osaka.main import get, rmall @@ -194,7 +197,7 @@ def create_active_cal_ds(active_ids, dataset_version, root_ds_dir="."): ds_id = id root_ds_dir = os.path.abspath(root_ds_dir) ds_dir = os.path.join(root_ds_dir, ds_id) - if not os.path.isdir(ds_dir): os.makedirs(ds_dir, 0755) + if not os.path.isdir(ds_dir): os.makedirs(ds_dir, 0o755) # dump dataset and met JSON ds_file = os.path.join(ds_dir, "%s.dataset.json" % ds_id) diff --git a/crawl_orbits.py b/crawl_orbits.py index bdac054..5b344a0 100755 --- a/crawl_orbits.py +++ b/crawl_orbits.py @@ -3,13 +3,16 @@ Crawl orbits and submit orbit dataset generation jobs. """ +from future import standard_library +standard_library.install_aliases() +from builtins import str import os, sys, re, json, logging, traceback, requests, argparse, backoff from datetime import datetime from pprint import pformat from requests.packages.urllib3.exceptions import (InsecureRequestWarning, InsecurePlatformWarning) try: from html.parser import HTMLParser -except: from HTMLParser import HTMLParser +except: from html.parser import HTMLParser from hysds_commons.job_utils import submit_mozart_job from hysds.celery import app diff --git a/create_cal_ds.py b/create_cal_ds.py index 22a4bfe..24f17ff 100755 --- a/create_cal_ds.py +++ b/create_cal_ds.py @@ -3,6 +3,7 @@ Create a HySDS dataset from a Sentinel1 calibration tar file. """ +from builtins import str import os, sys, time, re, json, requests, shutil, logging, traceback, argparse, backoff from requests.packages.urllib3.exceptions import (InsecureRequestWarning, InsecurePlatformWarning) @@ -82,7 +83,7 @@ def create_dataset(ds, met, cal_tar_file, root_ds_dir="."): id = met['data_product_name'] root_ds_dir = os.path.abspath(root_ds_dir) ds_dir = os.path.join(root_ds_dir, id) - if not os.path.isdir(ds_dir): os.makedirs(ds_dir, 0755) + if not os.path.isdir(ds_dir): os.makedirs(ds_dir, 0o755) # dump dataset and met JSON ds_file = os.path.join(ds_dir, "%s.dataset.json" % id) diff --git a/create_orbit_ds.py b/create_orbit_ds.py index a57f918..eedd598 100755 --- a/create_orbit_ds.py +++ b/create_orbit_ds.py @@ -3,6 +3,7 @@ Create a HySDS dataset from a Sentinel1 precise or restituted orbit. """ +from builtins import str import os, sys, time, re, json, requests, shutil, logging, traceback, argparse from datetime import datetime, timedelta @@ -45,7 +46,7 @@ def create_dataset(ds, met, orbit_file, root_ds_dir="."): id = met['data_product_name'] root_ds_dir = os.path.abspath(root_ds_dir) ds_dir = os.path.join(root_ds_dir, id) - if not os.path.isdir(ds_dir): os.makedirs(ds_dir, 0755) + if not os.path.isdir(ds_dir): os.makedirs(ds_dir, 0o755) # dump dataset and met JSON ds_file = os.path.join(ds_dir, "%s.dataset.json" % id)