parameters: (year, week_of_year, day_of_week, week_starts_Mon)
docstring: Calculate the Julian day based on the year, week of the year, and day of
      the week, with week_start_day representing whether the week of the year
      assumes the week starts on Sunday or Monday (6 or 0).
docstring_summary: Calculate the Julian day based on the year, week of the year, and day of
      the week, with week_start_day representing whether the week of the year
      assumes the week starts on Sunday or Monday (6 or 0).
docstring_tokens: Calculate the Julian day based on the year week of the year and day of the week with week_start_day representing whether the week of the year assumes the week starts on Sunday or Monday ( 6 or 0 ) .
function: def _calc_julian_from_U_or_W(year, week_of_year, day_of_week, week_starts_Mon):
      """Calculate the Julian day based on the year, week of the year, and day of
      the week, with week_start_day representing whether the week of the year
      assumes the week starts on Sunday or Monday (6 or 0)."""
      first_weekday = datetime_date(year, 1, 1).weekday()
      # If we are dealing with the %U directive (week starts on Sunday), it's
      # easier to just shift the view to Sunday being the first day of the
      # week.
      if not week_starts_Mon:
          first_weekday = (first_weekday + 1) % 7
          day_of_week = (day_of_week + 1) % 7
      # Need to watch out for a week 0 (when the first day of the year is not
      # the same as that specified by %U or %W).
      week_0_length = (7 - first_weekday) % 7
      if week_of_year == 0:
          return 1 + day_of_week - first_weekday
      else:
          days_to_week = week_0_length + (7 * (week_of_year - 1))
          return 1 + days_to_week + day_of_week
function_tokens: def _calc_julian_from_U_or_W ( year , week_of_year , day_of_week , week_starts_Mon ) : first_weekday = datetime_date ( year , 1 , 1 ) . weekday ( ) # If we are dealing with the %U directive (week starts on Sunday), it's # easier to just shift the view to Sunday being the first day of the # week. if not week_starts_Mon : first_weekday = ( first_weekday + 1 ) % 7 day_of_week = ( day_of_week + 1 ) % 7 # Need to watch out for a week 0 (when the first day of the year is not # the same as that specified by %U or %W). week_0_length = ( 7 - first_weekday ) % 7 if week_of_year == 0 : return 1 + day_of_week - first_weekday else : days_to_week = week_0_length + ( 7 * ( week_of_year - 1 ) ) return 1 + days_to_week + day_of_week