Beispiel #1
0
 def __init__(self, read_as_id=None, upper_nDoConc=None):
   self.set_read_as_id(read_as_id)
   self.numpy_histjogos = None
   slider               = ConcursoHTML()
   self.last_nDoConc    = slider.get_n_last_concurso()
   self.total_concursos = slider.get_total_concursos()
   self.set_upper_nDoConc(upper_nDoConc)
Beispiel #2
0
 def test_get_contrajogos_as_dezenas_down_from(self):
   slider = ConcursoHTML()
   last_concurso = slider.get_last_concurso()
   jogos_dezenas_list = get_contrajogos_as_dezenas_down_from(last_concurso, last_concurso.nDoConc - 1)
   for i, jogo_as_dezenas in enumerate(jogos_dezenas_list):
     nDoConc = i+1
     concurso = slider.get_concurso_by_nDoConc(nDoConc)
     concurso_numpy_dezenas = numpy.array(concurso.get_dezenas())
     self.assertEqual(jogo_as_dezenas.all(), concurso_numpy_dezenas.all(), ' jogo_as_dezenas & concurso_numpy_dezenas SHOULD BE EQUAL')
Beispiel #3
0
 def test_equality_of_both_blob_and_db(self):
   slider = ConcursoHTML()
   concursos_db = slider.get_all_concursos()
   pickled = ConcursosHistoryPickledStorage(read_as_id=READ_CONCHIST_AS_TIMEONWARDS_ORDERED_INTS)
   pickled.read_or_create_not_returning_list()
   # repeat it, so that a blob will be read from
   pickled = ConcursosHistoryPickledStorage(read_as_id=READ_CONCHIST_AS_TIMEONWARDS_ORDERED_INTS)
   concursos_blob = pickled.read_or_create()
   for i, concurso in enumerate(concursos_db):
     # get_dezenas() as a numpy array
     dezenas_db = numpy.array(concurso.get_dezenas())
     dezenas_blob = concursos_blob[i]
     self.assertEqual(dezenas_blob.all(), dezenas_db.all())  
Beispiel #4
0
def read_concursos_history(do_ordered_dozens=False):
  all_histjogos_as_dezenas = []
  slider = ConcursoHTML()
  # print 'Please wait. Reading database :: read_all_past_concursos() '
  concursos = slider.get_all_concursos()
  for concurso in concursos:
    if do_ordered_dozens:
      dezenas = concurso.get_dezenas()
    else:
      dezenas = concurso.get_dezenas_in_orig_order()
    # print i, # dezenas
    if concurso.nDoConc % 250 == 0:
      pass
      # print concurso.nDoConc, 'done'
    all_histjogos_as_dezenas.append(dezenas)
  return all_histjogos_as_dezenas
def get_coincides_histogram_against_a_lookup_depth(jogo, up_to_nDoConc=None, LOOKUP_DEPTH=1000):
  slider = ConcursoHTML()
  concurso     = slider.get_last_concurso()
  last_nDoConc = concurso.nDoConc
  if up_to_nDoConc == None:
    # Default
    up_to_nDoConc = last_nDoConc
  elif up_to_nDoConc < 0 or up_to_nDoConc <= last_nDoConc:
    # Default
    up_to_nDoConc = last_nDoConc
  # slider.get_concurso_by_nDoConc(up_to_nDoConc)
  pickled = ConcursosHistoryPickledStorage(upper_nDoConc=up_to_nDoConc) # read_as_id=None,
  previous_games_as_dezenas = pickled.read_or_create()
  if len(previous_games_as_dezenas) < LOOKUP_DEPTH:
    return None
  previous_games_as_dezenas = previous_games_as_dezenas[:LOOKUP_DEPTH]
  coincides_histogram = jogos_functions.get_coincides_histogram(jogo, previous_games_as_dezenas)
  return coincides_histogram