Skip to content

Commit

Permalink
Code review: 237890043: Code clean up.
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Dec 31, 2015
1 parent ccaf5d6 commit 539daa4
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 182 deletions.
2 changes: 1 addition & 1 deletion config/dpkg/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ python-plaso (1.2.1-1) unstable; urgency=low

* Auto-generated

-- Log2Timeline <[email protected]> Sat, 02 May 2015 10:45:35 +0200
-- Log2Timeline <[email protected]> Sun, 03 May 2015 13:33:28 +0200
2 changes: 1 addition & 1 deletion plaso/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
__version__ = '1.2.1'

VERSION_DEV = True
VERSION_DATE = '20150502'
VERSION_DATE = '20150503'


def GetVersion():
Expand Down
4 changes: 2 additions & 2 deletions plaso/hashers/test_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def _AssertFileEntryStringDigestMatch(self, hasher, file_entry, digest):
hasher.Update(data)
data = file_object.read(self._DEFAULT_READ_SIZE)
file_object.close()
self.assertEquals(hasher.GetStringDigest(), digest)
self.assertEqual(hasher.GetStringDigest(), digest)

def _AssertTestPathStringDigestMatch(self, hasher, path_segments, digest):
"""Check if a hasher returns a given result when it hashes a test file.
Expand Down Expand Up @@ -91,7 +91,7 @@ def _AssertFileEntryBinaryDigestMatch(self, hasher, file_entry, digest):
hasher.Update(data)
data = file_object.read(self._DEFAULT_READ_SIZE)
file_object.close()
self.assertEquals(hasher.GetBinaryDigest(), digest)
self.assertEqual(hasher.GetBinaryDigest(), digest)

def _AssertTestPathBinaryDigestMatch(self, hasher, path_segments, digest):
"""Check if a hasher returns a given result when it hashes a test file.
Expand Down
17 changes: 1 addition & 16 deletions utils/common.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
#!/bin/bash
# A small script that contains common functions for code review checks.
#
# Copyright 2012 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# 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.
# Script that contains common functions for code review checks.

EXIT_FAILURE=1;
EXIT_SUCCESS=0;
Expand Down
17 changes: 1 addition & 16 deletions utils/compile_proto.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
#!/bin/bash
# A small helper script to compile protobufs.
#
# Copyright 2012 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# 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.
# Script to compile protobufs.

compile()
{
Expand Down
17 changes: 1 addition & 16 deletions utils/create_authors.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2012 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# 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.
"""This file simply creates the AUTHOR file based on parser content."""

import os
Expand Down Expand Up @@ -66,7 +51,7 @@ def ProcessFile(file_path):
author = ProcessFile(os.path.join(path, filematch))
if not author:
continue
if type(author) in (list, tuple):
if isinstance(author, (list, tuple)):
for author_name in author:
if author_name not in authors:
authors.append(author)
Expand Down
14 changes: 0 additions & 14 deletions utils/download_patch_set.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2013 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# 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.
"""This file contains a simple utility to fetch content of code reviews."""
import os
import json
Expand Down
15 changes: 0 additions & 15 deletions utils/prep_dist.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
#!/bin/bash
# Script that prepares the codebase for building a binary distribution
#
# Copyright 2012 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# 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.

EXIT_FAILURE=1;
EXIT_SUCCESS=0;
Expand Down
39 changes: 2 additions & 37 deletions utils/review.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
#!/bin/bash
# A small script that submits a code for code review.
#
# Copyright 2012 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# 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.
# Script that submits a code for code review.

EXIT_SUCCESS=0;
EXIT_MISSING_ARGS=2;
Expand Down Expand Up @@ -98,26 +83,6 @@ then
fi
fi

MISSING_TESTS="";
FILES=`git status -s | grep -v "^?" | awk '{if ($1 != 'D') { print $2;}}' | grep "\.py$" | grep -v "_test.py$"`
for CHANGED_FILE in ${FILES};
do
TEST_FILE=`echo ${CHANGED_FILE} | sed -e 's/\.py//g'`
if ! test -f "${TEST_FILE}_test.py";
then
MISSING_TESTS="${MISSING_TESTS} + ${CHANGED_FILE}"
fi
done

if test -z "${MISSING_TESTS}";
then
MISSING_TEST_FILES=".";
else
MISSING_TEST_FILES="These files are missing unit tests:
${MISSING_TESTS}
";
fi

echo -n "Short description of code review request: ";
read DESCRIPTION
TEMP_FILE=`mktemp .tmp_plaso_code_review.XXXXXX`;
Expand All @@ -142,7 +107,7 @@ fi
python utils/upload.py \
--oauth2 ${BROWSER_PARAM} -y ${CACHE_PARAM} \
-r ${REVIEWER} --cc [email protected] \
-m "${MISSING_TEST_FILES}" -t "${DESCRIPTION}" \
-m "${DESCRIPTION}" -t "${DESCRIPTION}" \
--send_mail | tee ${TEMP_FILE};

CL=`cat ${TEMP_FILE} | grep codereview.appspot.com | awk -F '/' '/created/ {print $NF}'`;
Expand Down
17 changes: 1 addition & 16 deletions utils/run_linter.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
#!/bin/bash
# A small script that runs the linter on all files.
#
# Copyright 2012 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# 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.
# Script that runs the linter on all files.

EXIT_FAILURE=1;
EXIT_SUCCESS=0;
Expand Down
17 changes: 1 addition & 16 deletions utils/submit.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
#!/bin/bash
# A small script that submits a code for code review.
#
# Copyright 2012 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# 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.
# Script that submits a code for code review.

EXIT_FAILURE=1;
EXIT_MISSING_ARGS=2;
Expand Down
17 changes: 1 addition & 16 deletions utils/update.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
#!/bin/bash
# A small script that updates a change list for code review.
#
# Copyright 2012 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# 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.
# Script that updates a change list for code review.

EXIT_FAILURE=1;
EXIT_MISSING_ARGS=2;
Expand Down
17 changes: 1 addition & 16 deletions utils/update_version.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
#!/bin/bash
# A small helper script to update the version information.
#
# Copyright 2015 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# 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.
# Script to update the version information.

VERSION=`grep -e "^__version__ = '" plaso/__init__.py | sed "s/^__version__ = '\([^']*\)'/\1/"`;
DATE_VERSION=`date +"%Y%m%d"`;
Expand Down

0 comments on commit 539daa4

Please sign in to comment.