import json

def get_counts_from_item_list (items, htid):
    a = len([x for x in items if x["htid"] == htid])
    b = len(items) - a

    return a, b

def get_oclc_counts_from_json (json_data, htid = ""):
    try:
        data = json.loads(json_data)
        return get_counts_from_item_list(data["items"], htid)

    except:
        return 0, 0

def get_hathi_data_from_json ():
    return ()

import json

class HathiItems:

    def __init__ (self):
        pass

    def __len__ (self):
        return 0

def get_counts_from_item_list (items, htid):
    a = len([x for x in items if x["htid"] == htid])
    b = len(items) - a

    return a, b

def get_oclc_counts_from_json (json_data, htid = ""):
    try:
        data = json.loads(json_data)
        return get_counts_from_item_list(data["items"], htid)

    except:
        return 0, 0

def get_hathi_data_from_json ():
    return HathiItems()

Refactor empty tuple into empty object with len()
Refactor empty tuple into empty object with len()

  import json
+ 
+ class HathiItems:
+ 
+     def __init__ (self):
+         pass
+ 
+     def __len__ (self):
+         return 0
  
  def get_counts_from_item_list (items, htid):
      a = len([x for x in items if x["htid"] == htid])
      b = len(items) - a
  
      return a, b
  
  def get_oclc_counts_from_json (json_data, htid = ""):
      try:
          data = json.loads(json_data)
          return get_counts_from_item_list(data["items"], htid)
  
      except:
          return 0, 0
  
  def get_hathi_data_from_json ():
-     return ()
+     return HathiItems()
  
Refactor empty tuple into empty object with len()
## Code Before:
import json

def get_counts_from_item_list (items, htid):
    a = len([x for x in items if x["htid"] == htid])
    b = len(items) - a

    return a, b

def get_oclc_counts_from_json (json_data, htid = ""):
    try:
        data = json.loads(json_data)
        return get_counts_from_item_list(data["items"], htid)

    except:
        return 0, 0

def get_hathi_data_from_json ():
    return ()

## Instruction:
Refactor empty tuple into empty object with len()
## Code After:
import json

class HathiItems:

    def __init__ (self):
        pass

    def __len__ (self):
        return 0

def get_counts_from_item_list (items, htid):
    a = len([x for x in items if x["htid"] == htid])
    b = len(items) - a

    return a, b

def get_oclc_counts_from_json (json_data, htid = ""):
    try:
        data = json.loads(json_data)
        return get_counts_from_item_list(data["items"], htid)

    except:
        return 0, 0

def get_hathi_data_from_json ():
    return HathiItems()
