<commit_before>from data.logic.dsl import *
from spec.mamba import *

with description('solutions'):
  with before.each:
    self.dimensions = DimensionFactory()
    self.model = Model(self.dimensions)

  with it('defines dimensions'):
    (Andy, Bob, Cathy) = name = self.dimensions(name=['Andy', 'Bob', 'Cathy'])
    (CEO, Project_Manager, Analyst) = occupation = self.dimensions(
        occupation=['CEO', 'Project Manager', 'analyst'])
    (_10, _11, _12) = age = self.dimensions(age=[10, 11, 12])
    expect(self.dimensions.dimensions()).to(have_len(3))

  with description('with setup'):
    with before.each:
      (self.Andy, self.Bob, self.Cathy) = self.name = self.dimensions(
          name=['Andy', 'Bob', 'Cathy'])
      (self.CEO, self.Project_Manager, self.Analyst) = self.occupation = (
        self.dimensions(occupation=['CEO', 'Project Manager', 'analyst']))
      (self._10, self._11, self._12) = self.age = self.dimensions(
          age=[10, 11, 12])

    with it('accumulates constraints'):
      self.model(self.Andy == self.Analyst)
      expect(self.model.constraints).to(have_len(1))

    with it('supports diverse constraints'):
      self.model(self.Andy.occupation == self.Analyst)
      self.model((11 == self.Bob.age) ^ (11 == self.Analyst.age))
      expect(str(self.model)).to(look_like("""
        assign:
          name["Andy"].occupation["analyst"] in {0,1}
          name["Bob"].age[11] in {0,1}
          occupation["analyst"].age[11] in {0,1}
          
        subject to:
          (name["Andy"].occupation["analyst"] == True)
          ((name["Bob"].age[11] + occupation["analyst"].age[11]) == 1)
      """))<commit_msg>Update dsl_spec with new support.<commit_after>from data.logic.dsl import *
from spec.mamba import *

with description('solutions'):
  with before.each:
    self.dimensions = DimensionFactory()
    self.model = Model(self.dimensions)

  with it('defines dimensions'):
    (Andy, Bob, Cathy) = name = self.dimensions(name=['Andy', 'Bob', 'Cathy'])
    (CEO, Project_Manager, Analyst) = occupation = self.dimensions(
        occupation=['CEO', 'Project Manager', 'analyst'])
    (_10, _11, _12) = age = self.dimensions(age=[10, 11, 12])
    expect(self.dimensions.dimensions()).to(have_len(3))

  with description('with setup'):
    with before.each:
      (self.Andy, self.Bob, self.Cathy) = self.name = self.dimensions(
          name=['Andy', 'Bob', 'Cathy'])
      (self.CEO, self.Project_Manager, self.Analyst) = self.occupation = (
        self.dimensions(occupation=['CEO', 'Project Manager', 'analyst']))
      (self._10, self._11, self._12) = self.age = self.dimensions(
          age=[10, 11, 12])

    with it('accumulates constraints'):
      self.model(self.Andy == self.Analyst)
      expect(self.model.constraints).to(have_len(1))

    with it('supports diverse constraints'):
      self.model(self.Andy.occupation == self.Analyst)
      self.model((11 == self.Bob.age) ^ (11 == self.Analyst.age))
      self.model(self.CEO.age + 2 == self.Andy.age)
      expect(str(self.model)).to(look_like("""
        assign:
          name["Andy"].occupation["analyst"] in {0,1}
          name["Bob"].age[11] in {0,1}
          occupation["analyst"].age[11] in {0,1}
          occupation["CEO"].age[10] in {0,1}
          occupation["CEO"].age[11] in {0,1}
          occupation["CEO"].age[12] in {0,1}
          name["Andy"].age[10] in {0,1}
          name["Andy"].age[11] in {0,1}
          name["Andy"].age[12] in {0,1}
          
        subject to:
          (name["Andy"].occupation["analyst"] == True)
          ((name["Bob"].age[11] + occupation["analyst"].age[11]) == 1)
          (((10*occupation["CEO"].age[10] + 11*occupation["CEO"].age[11] + 
          12*occupation["CEO"].age[12]) + 2) == (10*name["Andy"].age[10] + 
          11*name["Andy"].age[11] + 12*name["Andy"].age[12]))
      """))
{'fraction_non_alphanumeric': 0.19126389247867667, 'fraction_numerical': 0.036185060739209095, 'mean_word_length': 3.0865892291446673, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2732527', 'n_tokens_mistral': 1421, 'n_tokens_neox': 1327, 'n_words': 240}