def get_freq_code(freqstr):
 if isinstance(freqstr, DateOffset):
  freqstr = (freqstr.rule_code, freqstr.n)
 if isinstance(freqstr, tuple):
  if (is_integer(freqstr[0]) and is_integer(freqstr[1])):
   return freqstr
  else:
   try:
    code = _period_str_to_code(freqstr[0])
    stride = freqstr[1]
   except:
    if is_integer(freqstr[1]):
     raise
    code = _period_str_to_code(freqstr[1])
    stride = freqstr[0]
   return (code, stride)
 if is_integer(freqstr):
  return (freqstr, 1)
 (base, stride) = _base_and_stride(freqstr)
 code = _period_str_to_code(base)
 return (code, stride)

def get_freq_code ( freqstr ) : if isinstance ( freqstr , DateOffset ) : freqstr = ( freqstr . rule_code , freqstr . n ) if isinstance ( freqstr , tuple ) : if ( is_integer ( freqstr [ 0 ] ) and is_integer ( freqstr [ 1 ] ) ) : return freqstr else : try : code = _period_str_to_code ( freqstr [ 0 ] ) stride = freqstr [ 1 ] except : if is_integer ( freqstr [ 1 ] ) : raise code = _period_str_to_code ( freqstr [ 1 ] ) stride = freqstr [ 0 ] return ( code , stride ) if is_integer ( freqstr ) : return ( freqstr , 1 ) ( base , stride ) = _base_and_stride ( freqstr ) code = _period_str_to_code ( base ) return ( code , stride )
return freq str or tuple to freq code and stride parameters freqstr : str or tuple returns return : tuple of base frequency code and stride example .