<commit_before># -*- coding: utf-8 -*-

"""

ZUGBRUECKE
Calling routines in Windows DLLs from Python scripts running on unixlike systems
https://github.com/pleiszenburg/zugbruecke

	src/zugbruecke/core/session.py: Classes for managing zugbruecke sessions

	Required to run on platform / side: [UNIX]

	Copyright (C) 2017 <NAME> <<EMAIL>>

<LICENSE_BLOCK>
The contents of this file are subject to the GNU Lesser General Public License
Version 2.1 ("LGPL" or "License"). You may not use this file except in
compliance with the License. You may obtain a copy of the License at
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
https://github.com/pleiszenburg/zugbruecke/blob/master/LICENSE

Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the
specific language governing rights and limitations under the License.
</LICENSE_BLOCK>

"""


# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# IMPORT
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

import atexit
import os
import signal
import time

from .config import get_module_config
from .dll_client import dll_client_class
from .interpreter import interpreter_session_class
from .lib import (
	get_free_port,
	get_location_of_file
	)
from .log import log_class
from .rpc import (
	mp_client_class
	)
from .wineenv import (
	create_wine_prefix,
	setup_wine_python,
	set_wine_env
	)


# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# ZUGBRUECKE SESSION CLASS
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

class session_client_class():


	def __init__(self, parameter = {}, force = False):

		self.__init_stage_1__(parameter, force)


	def ctypes_FormatError(code = None):

		# If in stage 1, fire up stage 2
		if self.stage == 1:
			self.__init_stage_2__()

		# Ask the server
		return self.client.ctypes_FormatError(code)


	def ctypes_get_last_error():

		# If in stage 1, fire up stage 2
		if self.stage == 1:
			self.__init_stage_2__()

		# Ask the server
		return self.client.ctypes_get_last_error()


	def ctypes_GetLastError():

		# If in stage 1, fire up stage 2
		if self.stage == 1:
			self.__init_stage_2__()

		# Ask the server
		return self.client.ctypes_GetLastError()


	def ctypes_set_last_error(value):

		# If in stage 1, fire up stage 2
		if self.stage == 1:
			self.__init_stage_2__()

		# Ask the server
		return self.client.ctypes_set_last_error(value)


	def ctypes_WinError(code = None, descr = None):

		# If in stage 1, fire up stage 2
		if self.stage == 1:
			self.__init_stage_2__()

		# Ask the server
		return self.client.ctypes_WinError(code, descr)


	def load_library(self, dll_name, dll_type, dll_param = {}):

		# If in stage 1, fire up stage 2
		if self.stage == 1:
			self.__init_stage_2__()

		# Check whether dll has already been touched
		if dll_name in self.dll_dict.keys():

			# Return reference on existing dll object
			return self.dll_dict[dll_name]

		# Is DLL type known?
		if dll_type not in ['cdll', 'windll', 'oledll']:

			# Raise error if unknown<commit_msg>fixed missing references to class, self<commit_after># -*- coding: utf-8 -*-

"""

ZUGBRUECKE
Calling routines in Windows DLLs from Python scripts running on unixlike systems
https://github.com/pleiszenburg/zugbruecke

	src/zugbruecke/core/session.py: Classes for managing zugbruecke sessions

	Required to run on platform / side: [UNIX]

	Copyright (C) 2017 <NAME> <<EMAIL>>

<LICENSE_BLOCK>
The contents of this file are subject to the GNU Lesser General Public License
Version 2.1 ("LGPL" or "License"). You may not use this file except in
compliance with the License. You may obtain a copy of the License at
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
https://github.com/pleiszenburg/zugbruecke/blob/master/LICENSE

Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the
specific language governing rights and limitations under the License.
</LICENSE_BLOCK>

"""


# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# IMPORT
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

import atexit
import os
import signal
import time

from .config import get_module_config
from .dll_client import dll_client_class
from .interpreter import interpreter_session_class
from .lib import (
	get_free_port,
	get_location_of_file
	)
from .log import log_class
from .rpc import (
	mp_client_class
	)
from .wineenv import (
	create_wine_prefix,
	setup_wine_python,
	set_wine_env
	)


# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# ZUGBRUECKE SESSION CLASS
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

class session_client_class():


	def __init__(self, parameter = {}, force = False):

		self.__init_stage_1__(parameter, force)


	def ctypes_FormatError(self, code = None):

		# If in stage 1, fire up stage 2
		if self.stage == 1:
			self.__init_stage_2__()

		# Ask the server
		return self.client.ctypes_FormatError(code)


	def ctypes_get_last_error(self):

		# If in stage 1, fire up stage 2
		if self.stage == 1:
			self.__init_stage_2__()

		# Ask the server
		return self.client.ctypes_get_last_error()


	def ctypes_GetLastError(self):

		# If in stage 1, fire up stage 2
		if self.stage == 1:
			self.__init_stage_2__()

		# Ask the server
		return self.client.ctypes_GetLastError()


	def ctypes_set_last_error(self, value):

		# If in stage 1, fire up stage 2
		if self.stage == 1:
			self.__init_stage_2__()

		# Ask the server
		return self.client.ctypes_set_last_error(value)


	def ctypes_WinError(self, code = None, descr = None):

		# If in stage 1, fire up stage 2
		if self.stage == 1:
			self.__init_stage_2__()

		# Ask the server
		return self.client.ctypes_WinError(code, descr)


	def load_library(self, dll_name, dll_type, dll_param = {}):

		# If in stage 1, fire up stage 2
		if self.stage == 1:
			self.__init_stage_2__()

		# Check whether dll has already been touched
		if dll_name in self.dll_dict.keys():

			# Return reference on existing dll object
			return self.dll_dict[dll_name]

		# Is DLL type known?
		if dll_type not in ['cdll', 'windll', 'oledll']:

			# Raise error if unknown
{'fraction_non_alphanumeric': 0.20018034265103696, 'fraction_numerical': 0.01021941689209498, 'mean_word_length': 4.654205607476635, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, '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': '3208571', 'n_tokens_mistral': 2387, 'n_tokens_neox': 2054, 'n_words': 641}