<commit_before>from . import kv
from os.path import dirname, normpath, splitext, isfile
import re
import sublime

_fn = re.compile(r'^(?P<fn>.+?)(?:[:](?P<line>[\d+]+)(?:[:](?P<column>[\d+]+))?)?\s*$')
_vfn_id = re.compile(r'gs\.view#(\d+)')

class V(object):
	def __init__(self, view, win=None):
		self.v = view
		self.w = win

	def temp(self):
		if self.v is None:
			return False

		return not self.perma()

	def perma(self):
		if self.v is None:
			return False

		win = self.v.window()
		if win is None:
			return False

		if self.v not in win.views():
			return False

		vs = self.v.settings()
		if vs.get('is_widget') or vs.get('9o'):
			return False

		return True

	def fn(self):
		if self.v is None:
			return ''

		return self.v.file_name() or ''

	def splitext(self):
		return splitext(self.fn())

	def ext(self):
		return splitext(self.fn())[1]

	def vfn(self):
		if self.v is None:
			return ''

		fn = self.fn()
		if fn:
			return fn

		fn = self.v.name()
		if fn:
			fn = fn.replace(' ', '_')
		else:
			fn = 'sublime.go'

		return 'gs.view#%s,%s' % (self.v.id(), fn)

	def dir(self):<commit_msg>Get the file extension from the vfn. This makes extension-based linting (gs.on-lint.go) work in on-saved views.<commit_after>from . import kv
from os.path import dirname, normpath, splitext, isfile
import re
import sublime

_fn = re.compile(r'^(?P<fn>.+?)(?:[:](?P<line>[\d+]+)(?:[:](?P<column>[\d+]+))?)?\s*$')
_vfn_id = re.compile(r'gs\.view#(\d+)')

class V(object):
	def __init__(self, view, win=None):
		self.v = view
		self.w = win

	def temp(self):
		if self.v is None:
			return False

		return not self.perma()

	def perma(self):
		if self.v is None:
			return False

		win = self.v.window()
		if win is None:
			return False

		if self.v not in win.views():
			return False

		vs = self.v.settings()
		if vs.get('is_widget') or vs.get('9o'):
			return False

		return True

	def fn(self):
		if self.v is None:
			return ''

		return self.v.file_name() or ''

	def splitext(self):
		return splitext(self.fn())

	def ext(self):
		return splitext(self.vfn())[1]

	def vfn(self):
		if self.v is None:
			return ''

		fn = self.fn()
		if fn:
			return fn

		fn = self.v.name()
		if fn:
			fn = fn.replace(' ', '_')
		else:
			fn = 'sublime.go'

		return 'gs.view#%s,%s' % (self.v.id(), fn)

	def dir(self):
{'fraction_non_alphanumeric': 0.18381403357727077, 'fraction_numerical': 0.0017219113215669393, 'mean_word_length': 3.0987654320987654, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '1618482', 'n_tokens_mistral': 1065, 'n_tokens_neox': 936, 'n_words': 250}