<commit_before>from __future__ import unicode_literals

import re
import frappe

from frappe import _
from frappe.utils import cstr, cint, flt


class InvalidColumnName(frappe.ValidationError): pass

class DBTable:
	def __init__(self, doctype, meta=None):
		self.doctype = doctype
		self.table_name = 'tab{}'.format(doctype)
		self.meta = meta or frappe.get_meta(doctype)
		self.columns = {}
		self.current_columns = {}

		# lists for change
		self.add_column = []
		self.change_type = []
		self.change_name = []
		self.add_unique = []
		self.add_index = []
		self.drop_index = []
		self.set_default = []

		# load
		self.get_columns_from_docfields()

	def sync(self):
		if self.is_new():
			self.create()
		else:
			frappe.cache().hdel('table_columns', self.table_name)
			self.alter()

	def create(self):
		pass

	def get_column_definitions(self):
		column_list = [] + frappe.db.DEFAULT_COLUMNS
		ret = []
		for k in list(self.columns):<commit_msg>fix: Get latest meta while building table<commit_after>from __future__ import unicode_literals

import re
import frappe

from frappe import _
from frappe.utils import cstr, cint, flt


class InvalidColumnName(frappe.ValidationError): pass

class DBTable:
	def __init__(self, doctype, meta=None):
		self.doctype = doctype
		self.table_name = 'tab{}'.format(doctype)
		self.meta = meta or frappe.get_meta(doctype, False)
		self.columns = {}
		self.current_columns = {}

		# lists for change
		self.add_column = []
		self.change_type = []
		self.change_name = []
		self.add_unique = []
		self.add_index = []
		self.drop_index = []
		self.set_default = []

		# load
		self.get_columns_from_docfields()

	def sync(self):
		if self.is_new():
			self.create()
		else:
			frappe.cache().hdel('table_columns', self.table_name)
			self.alter()

	def create(self):
		pass

	def get_column_definitions(self):
		column_list = [] + frappe.db.DEFAULT_COLUMNS
		ret = []
		for k in list(self.columns):
{'fraction_non_alphanumeric': 0.12196382428940568, 'fraction_numerical': 0.0, 'mean_word_length': 4.041666666666667, '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': '3187638', 'n_tokens_mistral': 760, 'n_tokens_neox': 695, 'n_words': 144}