from django.utils.duration import _get_duration_components

from datetime import timedelta


def duration_string_from_delta(delta):
    seconds = delta.total_seconds()
    split = str(seconds/3600).split('.')
    print split

    hours = int(split[0])
    minutes = int(float('.'+split[1])*60)

    string = '{}:{:02d}'.format(hours, minutes)
    return string


def parse_duration(duration):
    hours = None
    minutes = None

    if duration.isdigit():
        hours = int(duration)
    elif ':' in duration:
        duration_split = duration.split(':')
        hours = int(duration_split[0])
        minutes = int(duration_split[1])
    elif '.' in duration:
        duration_split = duration.split('.')
        hours = int(duration_split[0])
        minutes = int(60 * float('.' + duration_split[1]))

    if hours is None:
        hours = 0
    if minutes is None:
        minutes = 0

    if hours or minutes:
        return timedelta(hours=hours, minutes=minutes)
    else:
        raise ValueError('Could not parse duration.')


def duration_string(duration):
    days, hours, minutes, seconds, microseconds = _get_duration_components(duration)  # noqa: E501
    hours += days * 24

    string = '{}:{:02d}'.format(hours, minutes)

    return string

from django.utils.duration import _get_duration_components

from datetime import timedelta


def duration_string_from_delta(delta):
    seconds = delta.total_seconds()
    split = str(seconds/3600).split('.')

    hours = int(split[0])
    minutes = int(float('.'+split[1])*60)

    string = '{}:{:02d}'.format(hours, minutes)
    return string


def parse_duration(duration):
    hours = None
    minutes = None

    if duration.isdigit():
        hours = int(duration)
    elif ':' in duration:
        duration_split = duration.split(':')
        hours = int(duration_split[0])
        minutes = int(duration_split[1])
    elif '.' in duration:
        duration_split = duration.split('.')
        hours = int(duration_split[0])
        minutes = int(60 * float('.' + duration_split[1]))

    if hours is None:
        hours = 0
    if minutes is None:
        minutes = 0

    if hours or minutes:
        return timedelta(hours=hours, minutes=minutes)
    else:
        raise ValueError('Could not parse duration.')


def duration_string(duration):
    days, hours, minutes, seconds, microseconds = _get_duration_components(duration)  # noqa: E501
    hours += days * 24

    string = '{}:{:02d}'.format(hours, minutes)

    return string

Remove debugging print statement, opps
Remove debugging print statement, opps

  from django.utils.duration import _get_duration_components
  
  from datetime import timedelta
  
  
  def duration_string_from_delta(delta):
      seconds = delta.total_seconds()
      split = str(seconds/3600).split('.')
-     print split
  
      hours = int(split[0])
      minutes = int(float('.'+split[1])*60)
  
      string = '{}:{:02d}'.format(hours, minutes)
      return string
  
  
  def parse_duration(duration):
      hours = None
      minutes = None
  
      if duration.isdigit():
          hours = int(duration)
      elif ':' in duration:
          duration_split = duration.split(':')
          hours = int(duration_split[0])
          minutes = int(duration_split[1])
      elif '.' in duration:
          duration_split = duration.split('.')
          hours = int(duration_split[0])
          minutes = int(60 * float('.' + duration_split[1]))
  
      if hours is None:
          hours = 0
      if minutes is None:
          minutes = 0
  
      if hours or minutes:
          return timedelta(hours=hours, minutes=minutes)
      else:
          raise ValueError('Could not parse duration.')
  
  
  def duration_string(duration):
      days, hours, minutes, seconds, microseconds = _get_duration_components(duration)  # noqa: E501
      hours += days * 24
  
      string = '{}:{:02d}'.format(hours, minutes)
  
      return string
  
Remove debugging print statement, opps
## Code Before:
from django.utils.duration import _get_duration_components

from datetime import timedelta


def duration_string_from_delta(delta):
    seconds = delta.total_seconds()
    split = str(seconds/3600).split('.')
    print split

    hours = int(split[0])
    minutes = int(float('.'+split[1])*60)

    string = '{}:{:02d}'.format(hours, minutes)
    return string


def parse_duration(duration):
    hours = None
    minutes = None

    if duration.isdigit():
        hours = int(duration)
    elif ':' in duration:
        duration_split = duration.split(':')
        hours = int(duration_split[0])
        minutes = int(duration_split[1])
    elif '.' in duration:
        duration_split = duration.split('.')
        hours = int(duration_split[0])
        minutes = int(60 * float('.' + duration_split[1]))

    if hours is None:
        hours = 0
    if minutes is None:
        minutes = 0

    if hours or minutes:
        return timedelta(hours=hours, minutes=minutes)
    else:
        raise ValueError('Could not parse duration.')


def duration_string(duration):
    days, hours, minutes, seconds, microseconds = _get_duration_components(duration)  # noqa: E501
    hours += days * 24

    string = '{}:{:02d}'.format(hours, minutes)

    return string

## Instruction:
Remove debugging print statement, opps
## Code After:
from django.utils.duration import _get_duration_components

from datetime import timedelta


def duration_string_from_delta(delta):
    seconds = delta.total_seconds()
    split = str(seconds/3600).split('.')

    hours = int(split[0])
    minutes = int(float('.'+split[1])*60)

    string = '{}:{:02d}'.format(hours, minutes)
    return string


def parse_duration(duration):
    hours = None
    minutes = None

    if duration.isdigit():
        hours = int(duration)
    elif ':' in duration:
        duration_split = duration.split(':')
        hours = int(duration_split[0])
        minutes = int(duration_split[1])
    elif '.' in duration:
        duration_split = duration.split('.')
        hours = int(duration_split[0])
        minutes = int(60 * float('.' + duration_split[1]))

    if hours is None:
        hours = 0
    if minutes is None:
        minutes = 0

    if hours or minutes:
        return timedelta(hours=hours, minutes=minutes)
    else:
        raise ValueError('Could not parse duration.')


def duration_string(duration):
    days, hours, minutes, seconds, microseconds = _get_duration_components(duration)  # noqa: E501
    hours += days * 24

    string = '{}:{:02d}'.format(hours, minutes)

    return string
