Skip to content

Commit

Permalink
pascal_voc.py EOF newline
Browse files Browse the repository at this point in the history
  • Loading branch information
ahundt committed May 18, 2017
1 parent 697a3f4 commit 0e0dfaf
Show file tree
Hide file tree
Showing 5 changed files with 333 additions and 1 deletion.
205 changes: 205 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
{
"version": "0.2.0",
"configurations": [

{
"name": "Python",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config.python.pythonPath}",
"program": "${file}",
"cwd": "${workspaceRoot}",
"env": null,
"envFile": "${workspaceRoot}/.env",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
]
},
{
"name": "PySpark",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"osx": {
"pythonPath": "${env.SPARK_HOME}/bin/spark-submit"
},
"windows": {
"pythonPath": "${env.SPARK_HOME}/bin/spark-submit.cmd"
},
"linux": {
"pythonPath": "${env.SPARK_HOME}/bin/spark-submit"
},
"program": "${file}",
"cwd": "${workspaceRoot}",
"env": null,
"envFile": "${workspaceRoot}/.env",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
]
},
{
"name": "Python Module",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config.python.pythonPath}",
"module": "module.name",
"cwd": "${workspaceRoot}",
"env": null,
"envFile": "${workspaceRoot}/.env",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
]
},
{
"name": "Integrated Terminal/Console",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config.python.pythonPath}",
"program": "${file}",
"cwd": null,
"console": "integratedTerminal",
"env": null,
"envFile": "${workspaceRoot}/.env",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit"
]
},
{
"name": "External Terminal/Console",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config.python.pythonPath}",
"program": "${file}",
"cwd": null,
"console": "externalTerminal",
"env": null,
"envFile": "${workspaceRoot}/.env",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit"
]
},
{
"name": "Django",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config.python.pythonPath}",
"program": "${workspaceRoot}/manage.py",
"cwd": "${workspaceRoot}",
"args": [
"runserver",
"--noreload"
],
"env": null,
"envFile": "${workspaceRoot}/.env",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput",
"DjangoDebugging"
]
},
{
"name": "Flask",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"pythonPath": "${config.python.pythonPath}",
"program": "fully qualified path fo 'flask' executable. Generally located along with python interpreter",
"cwd": "${workspaceRoot}",
"env": {
"FLASK_APP": "${workspaceRoot}/quickstart/app.py"
},
"args": [
"run",
"--no-debugger",
"--no-reload"
],
"envFile": "${workspaceRoot}/.env",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
]
},
{
"name": "Flask (old)",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"pythonPath": "${config.python.pythonPath}",
"program": "${workspaceRoot}/run.py",
"cwd": "${workspaceRoot}",
"args": [],
"env": null,
"envFile": "${workspaceRoot}/.env",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
]
},
{
"name": "Pyramid",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config.python.pythonPath}",
"cwd": "${workspaceRoot}",
"env": null,
"envFile": "${workspaceRoot}/.env",
"args": [
"${workspaceRoot}/development.ini"
],
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput",
"Pyramid"
]
},
{
"name": "Watson",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config.python.pythonPath}",
"program": "${workspaceRoot}/console.py",
"cwd": "${workspaceRoot}",
"args": [
"dev",
"runserver",
"--noreload=True"
],
"env": null,
"envFile": "${workspaceRoot}/.env",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
]
},
{
"name": "Attach (Remote Debug)",
"type": "python",
"request": "attach",
"localRoot": "${workspaceRoot}",
"remoteRoot": "${workspaceRoot}",
"port": 3000,
"secret": "my_secret",
"host": "localhost"
}
]
}
Binary file added data.npz
Binary file not shown.
2 changes: 1 addition & 1 deletion keras/datasets/pascal_voc.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,4 +775,4 @@ def pascal_voc_setup(filenames, dataset_path, pascal_root,
voc_data_subset_mode,
combined_imageset_train_txt,
combined_imageset_val_txt,
combined_annotations_path)
combined_annotations_path)
52 changes: 52 additions & 0 deletions tests/keras/utils/data_utils_test.1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import os
import tarfile
import zipfile
from six.moves.urllib.request import pathname2url
from six.moves.urllib.parse import urljoin
from keras.utils.data_utils import get_file
from keras.utils.data_utils import validate_file
from keras.utils.data_utils import _hash_file
from keras import activations
from keras import regularizers

"""Tests get_file from a url, plus extraction and validation.
"""
dirname = 'data_utils'

with open('test.txt', 'w') as text_file:
text_file.write('Float like a butterfly, sting like a bee.')

with tarfile.open('test.tar.gz', 'w:gz') as tar_file:
tar_file.add('test.txt')

with zipfile.ZipFile('test.zip', 'w') as zip_file:
zip_file.write('test.txt')

origin = urljoin('file://', pathname2url(os.path.abspath('test.tar.gz')))

path = get_file(dirname, origin, untar=True)
filepath = path + '.tar.gz'
hashval_sha256 = _hash_file(filepath)
hashval_md5 = _hash_file(filepath, algorithm='md5')
path = get_file(dirname, origin, md5_hash=hashval_md5, untar=True)
path = get_file(filepath, origin, file_hash=hashval_sha256, extract=True)
assert os.path.exists(filepath)
assert validate_file(filepath, hashval_sha256)
assert validate_file(filepath, hashval_md5)
os.remove(filepath)
os.remove('test.tar.gz')

origin = urljoin('file://', pathname2url(os.path.abspath('test.zip')))

hashval_sha256 = _hash_file('test.zip')
hashval_md5 = _hash_file('test.zip', algorithm='md5')
path = get_file(dirname, origin, md5_hash=hashval_md5, extract=True)
path = get_file(dirname, origin, file_hash=hashval_sha256, extract=True)
assert os.path.exists(path)
assert validate_file(path, hashval_sha256)
assert validate_file(path, hashval_md5)

os.remove(path)
os.remove('test.txt')
os.remove('test.zip')

75 changes: 75 additions & 0 deletions tests/keras/utils/data_utils_test.py.orig
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<<<<<<< HEAD
=======
"""Tests for functions in data_utils.py.
"""
>>>>>>> b152b5e... data_utils.py and data_utils_test.py updated based on review (#5861)
import os
import pytest
import tarfile
import zipfile
from six.moves.urllib.request import pathname2url
from six.moves.urllib.parse import urljoin
from keras.utils.data_utils import get_file
from keras.utils.data_utils import validate_file
from keras.utils.data_utils import _hash_file
from keras import activations
from keras import regularizers


def test_data_utils():
<<<<<<< HEAD
=======
"""Tests get_file from a url, plus extraction and validation.
"""
>>>>>>> b152b5e... data_utils.py and data_utils_test.py updated based on review (#5861)
dirname = 'data_utils'

with open('test.txt', 'w') as text_file:
text_file.write('Float like a butterfly, sting like a bee.')

with tarfile.open('test.tar.gz', 'w:gz') as tar_file:
tar_file.add('test.txt')

with zipfile.ZipFile('test.zip', 'w') as zip_file:
zip_file.write('test.txt')

<<<<<<< HEAD

origin = urljoin("file://", pathname2url(os.path.abspath('test.tar.gz')))
=======
origin = urljoin('file://', pathname2url(os.path.abspath('test.tar.gz')))
>>>>>>> b152b5e... data_utils.py and data_utils_test.py updated based on review (#5861)

path = get_file(dirname, origin, untar=True)
filepath = path + '.tar.gz'
hashval_sha256 = _hash_file(filepath)
hashval_md5 = _hash_file(filepath, algorithm='md5')
path = get_file(dirname, origin, md5_hash=hashval_md5, untar=True)
path = get_file(filepath, origin, file_hash=hashval_sha256, extract=True)
assert os.path.exists(filepath)
assert validate_file(filepath, hashval_sha256)
assert validate_file(filepath, hashval_md5)
os.remove(filepath)
os.remove('test.tar.gz')

<<<<<<< HEAD

origin = urljoin("file://", pathname2url(os.path.abspath('test.zip')))
=======
origin = urljoin('file://', pathname2url(os.path.abspath('test.zip')))
>>>>>>> b152b5e... data_utils.py and data_utils_test.py updated based on review (#5861)

hashval_sha256 = _hash_file('test.zip')
hashval_md5 = _hash_file('test.zip', algorithm='md5')
path = get_file(dirname, origin, md5_hash=hashval_md5, extract=True)
path = get_file(dirname, origin, file_hash=hashval_sha256, extract=True)
assert os.path.exists(path)
assert validate_file(path, hashval_sha256)
assert validate_file(path, hashval_md5)

os.remove(path)
os.remove('test.txt')
os.remove('test.zip')

if __name__ == '__main__':
pytest.main([__file__])

0 comments on commit 0e0dfaf

Please sign in to comment.