Unverified Commit d069fb9f authored by Bhargav Kathivarapu's avatar Bhargav Kathivarapu Committed by GitHub
Browse files

Replace six with python3 version (#486)

parent 4c221140
...@@ -30,7 +30,7 @@ RUN conda create -y --name python3.6 python=3.6 ...@@ -30,7 +30,7 @@ RUN conda create -y --name python3.6 python=3.6
RUN conda create -y --name python3.7 python=3.7 RUN conda create -y --name python3.7 python=3.7
SHELL [ "/bin/bash", "-c" ] SHELL [ "/bin/bash", "-c" ]
RUN echo "source /usr/local/etc/profile.d/conda.sh" >> ~/.bashrc RUN echo "source /usr/local/etc/profile.d/conda.sh" >> ~/.bashrc
RUN source /usr/local/etc/profile.d/conda.sh && conda activate python3.5 && conda install -y -c conda-forge sox && conda install -y numpy six RUN source /usr/local/etc/profile.d/conda.sh && conda activate python3.5 && conda install -y -c conda-forge sox && conda install -y numpy
RUN source /usr/local/etc/profile.d/conda.sh && conda activate python3.6 && conda install -y -c conda-forge sox && conda install -y numpy RUN source /usr/local/etc/profile.d/conda.sh && conda activate python3.6 && conda install -y -c conda-forge sox && conda install -y numpy
RUN source /usr/local/etc/profile.d/conda.sh && conda activate python3.7 && conda install -y -c conda-forge sox && conda install -y numpy RUN source /usr/local/etc/profile.d/conda.sh && conda activate python3.7 && conda install -y -c conda-forge sox && conda install -y numpy
CMD [ "/bin/bash"] CMD [ "/bin/bash"]
...@@ -70,8 +70,6 @@ build nightlies based on PyTorch nightlies by hand following the instructions in ...@@ -70,8 +70,6 @@ build nightlies based on PyTorch nightlies by hand following the instructions in
``` ```
pip install numpy pip install numpy
pip install future # only on python 2.7
pip install six # only on python 3.5
pip install torchaudio_nightly -f https://download.pytorch.org/whl/nightly/torch_nightly.html pip install torchaudio_nightly -f https://download.pytorch.org/whl/nightly/torch_nightly.html
``` ```
......
...@@ -21,7 +21,7 @@ from collections import deque ...@@ -21,7 +21,7 @@ from collections import deque
import numpy as np import numpy as np
import torch import torch
from six.moves import queue import queue
import librosa import librosa
import pyaudio import pyaudio
......
...@@ -9,9 +9,8 @@ import threading ...@@ -9,9 +9,8 @@ import threading
import zipfile import zipfile
from queue import Queue from queue import Queue
import six
import torch import torch
from six.moves import urllib import urllib
from torch.utils.data import Dataset from torch.utils.data import Dataset
from torch.utils.model_zoo import tqdm from torch.utils.model_zoo import tqdm
...@@ -41,21 +40,8 @@ def unicode_csv_reader(unicode_csv_data, **kwargs): ...@@ -41,21 +40,8 @@ def unicode_csv_reader(unicode_csv_data, **kwargs):
maxInt = int(maxInt / 10) maxInt = int(maxInt / 10)
csv.field_size_limit(maxInt) csv.field_size_limit(maxInt)
if six.PY2: for line in csv.reader(unicode_csv_data, **kwargs):
# Implementation borrowed from docs: yield line
# https://docs.python.org/3.0/library/csv.html#examples
def utf_8_encoder(unicode_csv_data):
for line in unicode_csv_data:
yield line.encode('utf-8')
# csv.py doesn't do Unicode; encode temporarily as UTF-8:
csv_reader = csv.reader(utf_8_encoder(unicode_csv_data), **kwargs)
for row in csv_reader:
# decode UTF-8 back to Unicode, cell by cell:
yield [cell.decode("utf-8") for cell in row]
else:
for line in csv.reader(unicode_csv_data, **kwargs):
yield line
def makedir_exist_ok(dirpath): def makedir_exist_ok(dirpath):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment