Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Compare against literal types, not types module classes
Browse files Browse the repository at this point in the history
  • Loading branch information
gholms authored and garnaat committed Mar 27, 2012
1 parent 39dd094 commit e97fbbf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
15 changes: 7 additions & 8 deletions boto/emr/connection.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
""" """
Represents a connection to the EMR service Represents a connection to the EMR service
""" """
import types


import boto import boto
import boto.utils import boto.utils
Expand Down Expand Up @@ -135,7 +134,7 @@ def add_jobflow_steps(self, jobflow_id, steps):
:type steps: list(boto.emr.Step) :type steps: list(boto.emr.Step)
:param steps: A list of steps to add to the job :param steps: A list of steps to add to the job
""" """
if type(steps) != types.ListType: if type(steps) != list:
steps = [steps] steps = [steps]
params = {} params = {}
params['JobFlowId'] = jobflow_id params['JobFlowId'] = jobflow_id
Expand All @@ -158,7 +157,7 @@ def add_instance_groups(self, jobflow_id, instance_groups):
:type instance_groups: list(boto.emr.InstanceGroup) :type instance_groups: list(boto.emr.InstanceGroup)
:param instance_groups: A list of instance groups to add to the job :param instance_groups: A list of instance groups to add to the job
""" """
if type(instance_groups) != types.ListType: if type(instance_groups) != list:
instance_groups = [instance_groups] instance_groups = [instance_groups]
params = {} params = {}
params['JobFlowId'] = jobflow_id params['JobFlowId'] = jobflow_id
Expand All @@ -179,9 +178,9 @@ def modify_instance_groups(self, instance_group_ids, new_sizes):
:type new_sizes: list(int) :type new_sizes: list(int)
:param new_sizes: A list of the new sizes for each instance group :param new_sizes: A list of the new sizes for each instance group
""" """
if type(instance_group_ids) != types.ListType: if type(instance_group_ids) != list:
instance_group_ids = [instance_group_ids] instance_group_ids = [instance_group_ids]
if type(new_sizes) != types.ListType: if type(new_sizes) != list:
new_sizes = [new_sizes] new_sizes = [new_sizes]


instance_groups = zip(instance_group_ids, new_sizes) instance_groups = zip(instance_group_ids, new_sizes)
Expand Down Expand Up @@ -399,7 +398,7 @@ def _build_step_args(self, step):
return step_params return step_params


def _build_bootstrap_action_list(self, bootstrap_actions): def _build_bootstrap_action_list(self, bootstrap_actions):
if type(bootstrap_actions) != types.ListType: if type(bootstrap_actions) != list:
bootstrap_actions = [bootstrap_actions] bootstrap_actions = [bootstrap_actions]


params = {} params = {}
Expand All @@ -409,7 +408,7 @@ def _build_bootstrap_action_list(self, bootstrap_actions):
return params return params


def _build_step_list(self, steps): def _build_step_list(self, steps):
if type(steps) != types.ListType: if type(steps) != list:
steps = [steps] steps = [steps]


params = {} params = {}
Expand Down Expand Up @@ -475,7 +474,7 @@ def _build_instance_group_list_args(self, instance_groups):
a comparable dict for use in making a RunJobFlow or AddInstanceGroups a comparable dict for use in making a RunJobFlow or AddInstanceGroups
request. request.
""" """
if type(instance_groups) != types.ListType: if type(instance_groups) != list:
instance_groups = [instance_groups] instance_groups = [instance_groups]


params = {} params = {}
Expand Down
2 changes: 1 addition & 1 deletion boto/sdb/db/manager/sdbmanager.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ def _build_filter_part(self, cls, filters, order_by=None, select=None):
property = cls.find_property(name) property = cls.find_property(name)
if name == order_by: if name == order_by:
order_by_filtered = True order_by_filtered = True
if types.TypeType(value) == types.ListType: if types.TypeType(value) == list:
filter_parts_sub = [] filter_parts_sub = []
for val in value: for val in value:
val = self.encode_value(property, val) val = self.encode_value(property, val)
Expand Down
2 changes: 1 addition & 1 deletion boto/sdb/db/manager/xmlmanager.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def _build_query(self, cls, filters, limit, order_by):
for property in properties: for property in properties:
if property.name == name: if property.name == name:
found = True found = True
if types.TypeType(value) == types.ListType: if types.TypeType(value) == list:
filter_parts = [] filter_parts = []
for val in value: for val in value:
val = self.encode_value(property, val) val = self.encode_value(property, val)
Expand Down

0 comments on commit e97fbbf

Please sign in to comment.