<?xml version="1.0"?>
<ZopeData>
  <record id="1" aka="AAAAAAAAAAE=">
    <pickle>
      <tuple>
        <tuple>
          <string>Products.PythonScripts.PythonScript</string>
          <string>PythonScript</string>
        </tuple>
        <none/>
      </tuple>
    </pickle>
    <pickle>
      <dictionary>
        <item>
            <key> <string>Python_magic</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>Script_magic</string> </key>
            <value> <int>3</int> </value>
        </item>
        <item>
            <key> <string>__ac_local_roles__</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>_bind_names</string> </key>
            <value>
              <object>
                <klass>
                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
                </klass>
                <tuple/>
                <state>
                  <dictionary>
                    <item>
                        <key> <string>_asgns</string> </key>
                        <value>
                          <dictionary>
                            <item>
                                <key> <string>name_container</string> </key>
                                <value> <string>container</string> </value>
                            </item>
                            <item>
                                <key> <string>name_context</string> </key>
                                <value> <string>context</string> </value>
                            </item>
                            <item>
                                <key> <string>name_m_self</string> </key>
                                <value> <string>script</string> </value>
                            </item>
                            <item>
                                <key> <string>name_subpath</string> </key>
                                <value> <string>traverse_subpath</string> </value>
                            </item>
                          </dictionary>
                        </value>
                    </item>
                  </dictionary>
                </state>
              </object>
            </value>
        </item>
        <item>
            <key> <string>_body</string> </key>
            <value> <string encoding="cdata"><![CDATA[

# In all cases, return list structure containing tuple of information\n
# 1 tuple == 1 group\n
# tuple is of the form :\n
# [ relative position, title, tooltip, delimiter_type]\n
# with delimiter type in 0,1,2\n
\n
if isinstance(axis_start,DateTime):\n
  # testing delimiter_type to apply (day, week, month, year)\n
  # from smallest type to biggest\n
  type_list = [ [\'year\',   365],\n
                [\'6months\',182],\n
                [\'3months\', 91],\n
                [\'month\',   30],\n
                [\'1/2month\',15],\n
                [\'week\',     7],\n
                [\'3days\',    3],\n
                [\'day\',      1],\n
                [\'6hours\',0.25]\n
]\n
  # default good_type is last one (if nothing else matches)\n
  good_type = type_list[-1]\n
  for date_type in type_list:\n
    # iterating each delimiter_type and testing if it matches the delimitation\n
    # number definition\n
    if float(axis_stop - axis_start) / date_type[1] >= delimiter_min_number:\n
      good_type = date_type\n
      break\n
\n
\n
  delimiter = 0\n
  delimiter_list = []\n
  delimiter_list.append([int(axis_start),\'\',axis_start.Day() + \' \' + str(DateTime(axis_start)), 0])\n
\n
\n
  #### Hour ###\n
  if good_type[0] == \'hour\':\n
    pass\n
\n
\n
  ## 6 Hours ##\n
  if good_type[0] == \'6hours\':\n
    # recovering first valid date\n
    if axis_start.hour() > 18:\n
      #need to use the next day\n
      current_date = DateTime((axis_start + 1).Date())\n
    elif axis_start.hour() == 0:\n
      current_date = DateTime(axis_start.Date())\n
    else:\n
      if axis_start.hour() > 12:\n
        hours = 18\n
      elif axis_start.hour() > 6:\n
        hours = 12\n
      else:\n
        hours = 6\n
      current_date = DateTime(\'%s/%s/%s %s:0:0\' % (str(axis_start.year()),\n
                                                  str(axis_start.month()),\n
                                                  str(axis_start.day()),\n
                                                  hours))\n
    while current_date < axis_stop:\n
      if current_date.hour() == 0 :\n
        delimiter = 2\n
      elif current_date.hour() == 12:\n
        delimiter = 1\n
      else:\n
        delimiter = 0\n
      delimiter_list.append([int(current_date),\n
                              \'%s. %s %s:00\' % (current_date.Day()[:1],\n
                                                str(current_date.day()),\n
                                                str(current_date.hour())),\n
                              current_date.Day() + \' \' + str(current_date),\n
                              delimiter])\n
      if current_date.hour() == 18:\n
        #need to use the next day\n
        current_date = DateTime((current_date + 1).Date())\n
      else:\n
        hours = current_date.hour() + 6\n
        current_date = DateTime(\'%s/%s/%s %s:0:0\' % (str(current_date.year()),\n
                                                    str(current_date.month()),\n
                                                    str(current_date.day()),\n
                                                    hours))\n
\n
\n
  ##### DAY ####\n
  if good_type[0] == \'day\':\n
    # recovering first date displayed, without time:\n
    current_date = DateTime(axis_start.Date()) + 1\n
    # first date is used to get list of compliant dates\n
    while current_date < axis_stop:\n
      if current_date.day() == 1:\n
        delimiter = 2\n
      elif current_date.day() == 15:\n
        delimiter = 1\n
      else:\n
        delimiter = 0\n
      delimiter_list.append([int(current_date),\n
                              \'%s/%s\' % (str(current_date.month()),\n
                                            str(current_date.day())),\n
                              current_date.Day() + \' \' + str(current_date),\n
                              delimiter\n
])\n
      # go to next date\n
      current_date = current_date + 1\n
\n
\n
\n
\n
  ##### 3 DAYs ####\n
  if good_type[0] == \'3days\':\n
    # recovering first date displayed, without time:\n
    current_date = DateTime(axis_start.Date()) + 1\n
    # first date is used to get list of compliant dates\n
    while current_date < axis_stop:\n
      if current_date.day() == 1:\n
        delimiter = 2\n
      elif current_date.day() == 15:\n
        delimiter = 1\n
      else:\n
        delimiter = 0\n
      delimiter_list.append([int(current_date),\n
                              \'%s/%s\' % (str(current_date.month()),\n
                                            str(current_date.day())),\n
                              current_date.Day() + \' \' + str(current_date),\n
                              delimiter\n
])\n
      # go to next date\n
      current_date = current_date + 3\n
\n
\n
\n
  #### WEEK ####\n
  if good_type[0] == \'week\':\n
    current_date = DateTime(axis_start.Date()) + 1\n
    #DateTime(str(axis_start.year()) + \'/\' + str(axis_start.month()) + \'/\' + str(axis_start.day() + 1))\n
    # current date is any day in the week, moving to the first next Monday\n
    while current_date.Day() != \'Monday\':\n
      current_date = current_date + 1\n
    # getting list of weeks\n
    while current_date < axis_stop:\n
      delimiter_list.append([int(current_date),\n
                              str(current_date.month()) + \'/\' + str(current_date.day()),\n
                              current_date.Day() + \' \' + str(current_date),\n
                              delimiter\n
])\n
      current_date = current_date + 7\n
\n
\n
\n
  #### 1/2MONTH ####\n
  if good_type[0] == \'1/2month\':\n
    # getting first valid date\n
    if axis_start.month() == 12 and axis_start.day() > 15:\n
      # need to go to the next year\n
      current_date = DateTime(str(axis_start.year() + 1) + \'/1/1\' )\n
    elif axis_start.day() > 15:\n
      # need to go to next month\n
      current_date = DateTime(str(axis_start.year()) + \'/\' + str((axis_start.month() +1)) + \'/1\')\n
    else:\n
      # need to go to next part of current month\n
      current_date = DateTime(str(axis_start.year()) + \'/\' + str(axis_start.month()) + \'/15\')\n
    # getting list of months\n
    while current_date < axis_stop:\n
      if current_date.day() == 1:\n
        delimiter = 1\n
      else:\n
        delimiter = 0\n
      delimiter_list.append([int(current_date),\n
                            str(current_date.month()) + \'/\' + str(current_date.day()),\n
                            current_date.Day() + \' \' + str(current_date),\n
                            delimiter\n
])\n
      if current_date.month() == 12 and current_date.day() == 15:\n
        # need to go to the next year\n
        current_date = DateTime(str(current_date.year() + 1) + \'/1/1\' )\n
      elif current_date.day() == 15:\n
        # need to go to next month\n
        current_date = DateTime(str(current_date.year()) + \'/\' + str((current_date.month() +1)) + \'/1\')\n
      else:\n
        # need to go to next year\n
        current_date = DateTime(str(current_date.year()) + \'/\' + str((current_date.month())) + \'/15\')\n
\n
\n
  #### MONTH ####\n
  if good_type[0] == \'month\':\n
    # getting first valid date\n
    if axis_start.month() == 12:\n
      # need to go to the next year\n
      current_date = DateTime(str(axis_start.year() + 1) + \'/1/1\' )\n
    else:\n
      current_date = DateTime(str(axis_start.year()) + \'/\' + str((axis_start.month() +1)) + \'/1\')\n
    # getting list of months\n
    while current_date < axis_stop:\n
      if current_date.month() == 1:\n
        delimiter = 2\n
      elif current_date.month() == 7:\n
        delimiter = 1\n
      else:\n
        delimiter = 0\n
      delimiter_list.append([int(current_date),\n
                            str(current_date.year()) + \'/\' + str(current_date.month()),\n
                            current_date.Day() + \' \' + str(current_date),\n
                            delimiter\n
])\n
      if current_date.month() == 12:\n
        # need to go to the next year\n
        current_date = DateTime(str(current_date.year() + 1) + \'/1/1\' )\n
      else:\n
        current_date = DateTime(str(current_date.year()) + \'/\' + str((current_date.month() +1)) + \'/1\')\n
\n
\n
\n
  ## 3 MONTHS ##\n
  if good_type[0] == \'3months\':\n
    # getting first valid date\n
    if axis_start.month() > 9:\n
      # need to go to the next year\n
      current_date = DateTime(str(axis_start.year() + 1) + \'/1/1\' )\n
    elif axis_start.month() > 6:\n
      current_date = DateTime(str(axis_start.year()) + \'/10/1\')\n
    elif axis_start.month() > 3:\n
      current_date = DateTime(str(axis_start.year()) + \'/7/1\')\n
    else:\n
      current_date = DateTime(str(axis_start.year()) + \'/4/1\')\n
    while current_date < axis_stop:\n
      if current_date.month() == 1:\n
        delimiter = 1\n
      else:\n
        delimiter = 0\n
      delimiter_list.append([int(current_date),\n
                              str(current_date.year()) + \'/\' + str(current_date.month()),\n
                              current_date.Day() + \' \' + str(current_date),\n
                              delimiter\n
])\n
      if current_date.month() > 9:\n
        # need to go to the next year\n
        current_date = DateTime(str(current_date.year() + 1) + \'/1/1\' )\n
      else:\n
        current_date = DateTime(str(\'%s/%s/1\' % (str(current_date.year()),\n
                                                 str(current_date.month() + 3))))\n
\n
\n
  ## 6 MONTHS ##\n
  if good_type[0] == \'6months\':\n
    # getting first valid date\n
    if axis_start.month() > 6:\n
      # need to go to the next year\n
      current_date = DateTime(str(axis_start.year() + 1) + \'/1/1\' )\n
    else:\n
      current_date = DateTime(str(axis_start.year()) + \'/7/1\')\n
    while current_date < axis_stop:\n
      if current_date.month() == 1:\n
        delimiter = 1\n
      else:\n
        delimiter = 0\n
      delimiter_list.append([int(current_date),\n
                              str(current_date.year()) + \'/\' + str(current_date.month()),\n
                              current_date.Day() + \' \' + str(current_date),\n
                              delimiter\n
])\n
      if current_date.month() > 6:\n
        # need to go to the next year\n
        current_date = DateTime(str(current_date.year() + 1) + \'/1/1\' )\n
      else:\n
        current_date = DateTime(str(current_date.year()) + \'/7/1\')\n
\n
\n
  #### YEAR ####\n
  if good_type[0] == \'year\':\n
    # getting first valid year\n
    current_date = DateTime(str(axis_start.year() + 1) + \'/1/1\')\n
    while current_date < axis_stop:\n
      if str(current_date.year())[3:] == 0:\n
        delimiter = 2\n
      elif str(current_date.year())[3:] == 5:\n
        delimiter = 1\n
      else:\n
        delimiter = 0\n
      delimiter_list.append([int(current_date),\n
                              str(current_date.year()),\n
                              current_date.Day() + \' \' + str(current_date),\n
                              delimiter\n
])\n
      current_date = DateTime(str(current_date.year() + 1) + \'/1/1\')\n
\n
  return delimiter_list\n
\n
\n
else:\n
\n
  delimiter_list = []\n
  # secondary axis type is integer / float.\n
  # building corresponding axis.\n
  axis_range = axis_stop - axis_start\n
  step = 1.0 / 1000.0\n
  good_step = step\n
  while step * delimiter_min_number < axis_range:\n
    good_step = step\n
    step = step * 10\n
\n
\n
  # now adding  first value\n
  delimiter_list.append([axis_start,\'\',str(axis_start),0])\n
\n
  # now going to first good step\n
  modul = axis_start % good_step\n
  if modul == 0:\n
    #axis_start is already well placed.\n
    current_step = good_step + axis_start\n
  else:\n
    current_step = good_step + (axis_start - modul)\n
\n
  # good step is the last step under axis_range.\n
  if good_step >= 1:\n
    good_step = int(good_step)\n
    current_step = int(current_step)\n
\n
  # iterating and adding each value\n
  while current_step < axis_stop:\n
    delimiter_list.append([current_step,str(current_step),str(current_step),0])\n
    current_step += good_step\n
\n
  return delimiter_list\n


]]></string> </value>
        </item>
        <item>
            <key> <string>_code</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>_filepath</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>_owner</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>axis_start, axis_stop, delimiter_min_number</string> </value>
        </item>
        <item>
            <key> <string>errors</string> </key>
            <value>
              <tuple/>
            </value>
        </item>
        <item>
            <key> <string>func_code</string> </key>
            <value>
              <object>
                <klass>
                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
                </klass>
                <tuple/>
                <state>
                  <dictionary>
                    <item>
                        <key> <string>co_argcount</string> </key>
                        <value> <int>3</int> </value>
                    </item>
                    <item>
                        <key> <string>co_varnames</string> </key>
                        <value>
                          <tuple>
                            <string>axis_start</string>
                            <string>axis_stop</string>
                            <string>delimiter_min_number</string>
                            <string>isinstance</string>
                            <string>DateTime</string>
                            <string>type_list</string>
                            <string>_getitem_</string>
                            <string>good_type</string>
                            <string>_getiter_</string>
                            <string>date_type</string>
                            <string>float</string>
                            <string>delimiter</string>
                            <string>delimiter_list</string>
                            <string>_getattr_</string>
                            <string>int</string>
                            <string>str</string>
                            <string>current_date</string>
                            <string>hours</string>
                            <string>axis_range</string>
                            <string>step</string>
                            <string>good_step</string>
                            <string>modul</string>
                            <string>current_step</string>
                          </tuple>
                        </value>
                    </item>
                  </dictionary>
                </state>
              </object>
            </value>
        </item>
        <item>
            <key> <string>func_defaults</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>Planning_generateAxis</string> </value>
        </item>
        <item>
            <key> <string>warnings</string> </key>
            <value>
              <tuple/>
            </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
