Skip to content
This repository was archived by the owner on Sep 3, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ before_install:
- pip install solutionbox/image_classification/
- pip install -U tensorflow==1.0.0
- pip install -U protobuf==3.1.0 #v3.2.0 has the "python: double free or corruption" bug.
- pip install flake8

before_script:
- flake8 . --select=F401

script:
- python ./tests/main.py

script: python ./tests/main.py

3 changes: 3 additions & 0 deletions datalab/bigquery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
from ._utils import TableName, DatasetName
from ._view import View

__all__ = ['CSVOptions', 'Dataset', 'Datasets', 'Dialect', 'FederatedTable', 'Query', 'QueryJob',
'QueryResultsTable', 'QueryStats', 'Sampling', 'Schema', 'Table', 'TableMetadata',
'UDF', 'TableName', 'DatasetName', 'View']

def wait_any(jobs, timeout=None):
""" Return when at least one of the specified jobs has completed or timeout expires.
Expand Down
1 change: 1 addition & 0 deletions datalab/bigquery/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@

from . import _bigquery

__all__ = ['_bigquery']
1 change: 1 addition & 0 deletions datalab/context/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
from ._context import Context
from ._project import Project, Projects

__all__ = ['Context', 'Project', 'Projects']
2 changes: 2 additions & 0 deletions datalab/context/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@
from __future__ import absolute_import

from . import _projects

__all__ = ['_projects']
1 change: 1 addition & 0 deletions datalab/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@
from ._sql_statement import SqlStatement
from ._utils import tokenize

__all__ = ['Csv', 'SqlModule', 'SqlStatement', 'tokenize']
2 changes: 2 additions & 0 deletions datalab/data/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@


from . import _sql

__all__ = ['_sql']
4 changes: 2 additions & 2 deletions datalab/kernel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

try:
import IPython as _IPython
import IPython.core.magic as _magic
import IPython.core.magic as _magic # noqa
import IPython.core.interactiveshell as _shell
from IPython import get_ipython
from IPython import get_ipython # noqa
except ImportError:
raise Exception('This package requires an IPython notebook installation')

Expand Down
1 change: 1 addition & 0 deletions datalab/notebook/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
def _jupyter_nbextension_paths():
return [dict(section="notebook", src="static", dest="gcpdatalab")]

__all__ = ['_']
2 changes: 2 additions & 0 deletions datalab/stackdriver/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@
from __future__ import absolute_import

from . import _monitoring

__all__ = ['_monitoring']
3 changes: 3 additions & 0 deletions datalab/stackdriver/monitoring/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@
from ._query import Query
from ._query_metadata import QueryMetadata
from ._resource import ResourceDescriptors

__all__ = ['Aligner', 'Reducer', 'Groups', 'MetricDescriptors', 'Query', 'QueryMetadata',
'ResourceDescriptors']
2 changes: 2 additions & 0 deletions datalab/storage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@

from ._bucket import Bucket, Buckets
from ._item import Item, Items

__all__ = ['Bucket', 'Buckets', 'Item', 'Items']
1 change: 1 addition & 0 deletions datalab/storage/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@

from . import _storage

__all__ = ['_storage']
5 changes: 5 additions & 0 deletions datalab/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@
from ._dataflow_job import DataflowJob
from ._utils import print_exception_with_last_stack, get_item, compare_datetimes, \
pick_unused_port, is_http_running_on, gcs_copy_file

__all__ = ['async', 'async_function', 'async_method', 'GCPJob', 'Http', 'RequestException',
'Iterator', 'Job', 'JobError', 'JSONEncoder', 'LRUCache', 'LambdaJob', 'DataflowJob',
'print_exception_with_last_stack', 'get_item', 'compare_datetimes', 'pick_unused_port',
'is_http_running_on', 'gcs_copy_file']
2 changes: 2 additions & 0 deletions datalab/utils/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
# or implied. See the License for the specific language governing permissions and limitations under
# the License.

# flake8: noqa

from __future__ import absolute_import
from __future__ import unicode_literals

Expand Down
2 changes: 2 additions & 0 deletions google/datalab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@

from google.datalab._context import Context
from google.datalab._job import Job, JobError

__all__ = ['Context', 'Job', 'JobError']
3 changes: 3 additions & 0 deletions google/datalab/bigquery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@
from ._utils import TableName, DatasetName
from ._view import View

__all__ = ['CSVOptions', 'Dataset', 'Datasets', 'ExternalDataSource', 'Query', 'QueryOutput',
'QueryResultsTable', 'QueryStats', 'Sampling', 'Schema', 'SchemaField', 'Table',
'TableMetadata', 'UDF', 'TableName', 'DatasetName', 'View']
1 change: 0 additions & 1 deletion google/datalab/bigquery/_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from ._query_output import QueryOutput
from . import _api
from . import _query_job
from . import _sampling
from . import _udf
from . import _utils
from . import _external_data_source
Expand Down
2 changes: 0 additions & 2 deletions google/datalab/bigquery/_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
from . import _parser
from . import _schema
from . import _utils
from ._query_output import QueryOutput
from ._sampling import Sampling


class TableMetadata(object):
Expand Down
3 changes: 0 additions & 3 deletions google/datalab/bigquery/_udf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@
"""Google Cloud Platform library - BigQuery UDF Functionality."""
from __future__ import absolute_import
from __future__ import unicode_literals
from builtins import str
from builtins import object

import json


class UDF(object):
"""Represents a BigQuery UDF declaration.
Expand Down
1 change: 0 additions & 1 deletion google/datalab/bigquery/_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

from . import _query
from . import _table
from ._query_output import QueryOutput

# Query import is at end to avoid issues with circular dependencies.

Expand Down
1 change: 1 addition & 0 deletions google/datalab/bigquery/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@

from . import _bigquery

__all__ = ['_bigquery']
1 change: 0 additions & 1 deletion google/datalab/bigquery/commands/_bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from builtins import zip
from builtins import str
from past.builtins import basestring

Expand Down
2 changes: 2 additions & 0 deletions google/datalab/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@
from __future__ import absolute_import

from . import _datalab

__all__ = ['_datalab']
2 changes: 2 additions & 0 deletions google/datalab/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
from __future__ import unicode_literals

from ._csv_file import CsvFile

__all__ = ['CsvFile']
4 changes: 2 additions & 2 deletions google/datalab/kernel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

try:
import IPython as _IPython
import IPython.core.magic as _magic
import IPython.core.magic as _magic # noqa
import IPython.core.interactiveshell as _shell
from IPython import get_ipython
from IPython import get_ipython # noqa
except ImportError:
raise Exception('This package requires an IPython notebook installation')

Expand Down
2 changes: 2 additions & 0 deletions google/datalab/ml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
# or implied. See the License for the specific language governing permissions and limitations under
# the License.

# flake8: noqa

"""CloudML Helper Library."""

from __future__ import absolute_import
Expand Down
1 change: 0 additions & 1 deletion google/datalab/ml/_feature_slice_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import json
import pandas as pd
from types import ModuleType

import google.datalab as datalab
import google.datalab.bigquery as bq
Expand Down
1 change: 0 additions & 1 deletion google/datalab/ml/_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import datetime
import fnmatch
import glob
import matplotlib.pyplot as plt
import os
import pandas as pd
Expand Down
1 change: 0 additions & 1 deletion google/datalab/ml/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


from apache_beam.io import gcsio
import datetime
import glob
from googleapiclient import discovery
import logging
Expand Down
1 change: 1 addition & 0 deletions google/datalab/notebook/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
def _jupyter_nbextension_paths():
return [dict(section="notebook", src="static", dest="gcpdatalab")]

__all__ = ['_']
2 changes: 2 additions & 0 deletions google/datalab/stackdriver/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@
from __future__ import absolute_import

from . import _monitoring

__all__ = ['_monitoring']
3 changes: 3 additions & 0 deletions google/datalab/stackdriver/monitoring/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@
from ._query import Query
from ._query_metadata import QueryMetadata
from ._resource import ResourceDescriptors

__all__ = ['Aligner', 'Reducer', 'Groups', 'MetricDescriptors', 'Query', 'QueryMetadata',
'ResourceDescriptors']
2 changes: 2 additions & 0 deletions google/datalab/storage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@

from ._bucket import Bucket, Buckets
from ._object import Object, Objects

__all__ = ['Bucket', 'Buckets', 'Object', 'Objects']
1 change: 1 addition & 0 deletions google/datalab/storage/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@

from . import _storage

__all__ = ['_storage']
5 changes: 5 additions & 0 deletions google/datalab/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@
from ._dataflow_job import DataflowJob
from ._utils import print_exception_with_last_stack, get_item, compare_datetimes, \
pick_unused_port, is_http_running_on, gcs_copy_file

__all__ = ['async', 'async_function', 'async_method', 'Http', 'RequestException', 'Iterator',
'JSONEncoder', 'LRUCache', 'LambdaJob', 'DataflowJob',
'print_exception_with_last_stack', 'get_item', 'compare_datetimes', 'pick_unused_port',
'is_http_running_on', 'gcs_copy_file']
2 changes: 2 additions & 0 deletions google/datalab/utils/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
# or implied. See the License for the specific language governing permissions and limitations under
# the License.

# flake8: noqa

from __future__ import absolute_import
from __future__ import unicode_literals

Expand Down
1 change: 0 additions & 1 deletion google/datalab/utils/commands/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
except ImportError:
pass
import sys
import types
import yaml

import google.datalab.data
Expand Down
5 changes: 0 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,8 @@
# To publish to PyPi use: python setup.py bdist_wheel upload -r pypi

import datetime
import sys
from setuptools import setup

if sys.version_info[0] == 2:
import platform
import pip

minor = datetime.datetime.now().strftime("%y%m%d%H%M")
version = '1.0.' + minor

Expand Down
17 changes: 16 additions & 1 deletion solutionbox/image_classification/mltoolbox/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
__import__('pkg_resources').declare_namespace(__name__)
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================

__import__('pkg_resources').declare_namespace(__name__)
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@
The trained model can also be deployed online with google.datalab.ml.ModelVersions.deploy() call.
"""

from ._api import preprocess,preprocess_async,train,train_async,predict,batch_predict,batch_predict_async
from ._api import preprocess, preprocess_async, train, train_async, predict, batch_predict, \
batch_predict_async

__all__ = ['preprocess', 'preprocess_async', 'train', 'train_async', 'predict', 'batch_predict',
'batch_predict_async']
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,13 @@

import apache_beam as beam
import base64
import collections
import datetime
import logging
import os
import urllib

from . import _model
from . import _predictor
from . import _preprocess
from . import _trainer
from . import _util


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,7 @@
"""

import apache_beam as beam
import collections
import csv
import datetime
import json
import logging
import os
import tensorflow as tf
import yaml


from . import _model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
"""

from enum import Enum
import json
import logging
import os
import tensorflow as tf
from tensorflow.contrib import layers
from tensorflow.python.ops import control_flow_ops
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
import collections
import json
import os
import tensorflow as tf

from . import _model
from . import _util


Expand Down Expand Up @@ -108,8 +106,6 @@ class PredictBatchDoFn(beam.DoFn):
"""A DoFn that does batch prediction."""

def __init__(self, model_dir):
import os

self._model_dir = model_dir
self._session = None
self._tf_inputs = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
from apache_beam.io import fileio
from apache_beam.io import tfrecordio
from apache_beam.metrics import Metrics
from apache_beam.utils.pipeline_options import PipelineOptions
import cStringIO
import csv
import logging
import os
from PIL import Image
Expand Down
Loading