Skip to content

Commit

Permalink
Merge pull request #2307 from pupil-labs/pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
[pre-commit.ci] pre-commit autoupdate
  • Loading branch information
papr committed Feb 7, 2023
2 parents 81c83a8 + c07ac8e commit a4e4306
Show file tree
Hide file tree
Showing 68 changed files with 30 additions and 148 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ repos:
- id: check-toml

- repo: https://github.com/psf/black
rev: 22.12.0
rev: 23.1.0
hooks:
- id: black
2 changes: 0 additions & 2 deletions deployment/deploy_capture/finalize_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from version import get_tag_commit, pupil_version, write_version_file

if platform.system() == "Darwin":

print("starting version stript:")
write_version_file("dist/Pupil Capture.app/Contents/MacOS")
print("created version file in dist folder")
Expand All @@ -35,7 +34,6 @@
write_version_file(os.path.join("dist", "Pupil Capture"))

elif platform.system() == "Linux":

distribtution_dir = "dist"
pupil_capture_dir = os.path.join(distribtution_dir, "pupil_capture")

Expand Down
2 changes: 0 additions & 2 deletions deployment/deploy_player/finalize_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
</plist>"""

if platform.system() == "Darwin":

print("starting version stript:")
write_version_file("dist/Pupil Player.app/Contents/MacOS")
print("created version file in app dir")
Expand All @@ -69,7 +68,6 @@
write_version_file(os.path.join("dist", "Pupil Player"))

elif platform.system() == "Linux":

distribtution_dir = "dist"
pupil_player_dir = os.path.join(distribtution_dir, "pupil_player")

Expand Down
2 changes: 0 additions & 2 deletions deployment/deploy_service/finalize_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from version import get_tag_commit, pupil_version, write_version_file

if platform.system() == "Darwin":

print("starting version stript:")
write_version_file("dist/Pupil Service.app/Contents/MacOS")
print("created version file in dist folder")
Expand All @@ -35,7 +34,6 @@
write_version_file(os.path.join("dist", "Pupil Service"))

elif platform.system() == "Linux":

distribtution_dir = "dist"
pupil_service_dir = os.path.join(distribtution_dir, "pupil_service")

Expand Down
1 change: 0 additions & 1 deletion pupil_src/launchables/eye.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,6 @@ def window_should_update():
# Event loop
window_should_close = False
while not window_should_close:

if notify_sub.new_data:
t, notification = notify_sub.recv()
subject = notification["subject"]
Expand Down
1 change: 0 additions & 1 deletion pupil_src/launchables/marker_detectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


def circle_detector(ipc_push_url, pair_url, source_path, batch_size=20):

# ipc setup
import zmq
import zmq_tools
Expand Down
3 changes: 0 additions & 3 deletions pupil_src/launchables/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,6 @@ def handle_notifications(n):
)

while not glfw.window_should_close(main_window) and not process_was_interrupted:

# fetch newest notifications
new_notifications = []
while notify_sub.new_data:
Expand Down Expand Up @@ -728,7 +727,6 @@ def handle_notifications(n):
glfw.poll_events()
# render visual feedback from loaded plugins
if gl_utils.is_window_visible(main_window):

gl_utils.glViewport(0, 0, *g_pool.camera_render_size)
g_pool.capture.gl_display()
for p in g_pool.plugins:
Expand Down Expand Up @@ -940,7 +938,6 @@ def display_multiline_string(string, font_size, top_y, split_chr="\n"):
return bottom_y

while not glfw.window_should_close(window) and not process_was_interrupted:

fb_size = glfw.get_framebuffer_size(window)
content_scale = gl_utils.get_content_scale(window)
gl_utils.adjust_gl_view(*fb_size)
Expand Down
1 change: 0 additions & 1 deletion pupil_src/launchables/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def stop_eye_process(eye_id):
ipc_pub.notify(n)

try:

# helpers/utils
from file_methods import Persistent_Dict
from methods import delta_t, get_system_info
Expand Down
2 changes: 0 additions & 2 deletions pupil_src/launchables/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,6 @@ def window_should_update():

# Event loop
while not glfw.window_should_close(main_window) and not process_was_interrupted:

# fetch newest notifications
new_notifications = []
while notify_sub.new_data:
Expand Down Expand Up @@ -780,7 +779,6 @@ def window_should_update():
# render visual feedback from loaded plugins
glfw.poll_events()
if window_should_update() and gl_utils.is_window_visible(main_window):

gl_utils.glViewport(0, 0, *camera_render_size)
for p in g_pool.plugins:
p.gl_display()
Expand Down
4 changes: 0 additions & 4 deletions pupil_src/shared_modules/av_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,6 @@ def __init__(self, start_time, audio_parts, audio_export_stream, fill_gaps=True)
self.fill_gaps = fill_gaps

def iterate_audio_packets(self):

last_audio_pts = float("-inf")

if self.fill_gaps:
Expand Down Expand Up @@ -448,7 +447,6 @@ def _iterate_audio_frames_ignoring_gaps(self):
raise ValueError(f"Unknown audio frame type: {audio_frame}")

def _iterate_audio_frames_filling_gaps(self):

# Prologue: Yield silence frames between start_time and the first audio frame (if any)

audio_part_end_ts = [part.timestamps[-1] for part in self.audio_parts]
Expand Down Expand Up @@ -512,7 +510,6 @@ def _iterate_audio_frames_and_audio_gaps(audio_parts):
last_part_last_frame = None

for part_idx, audio_part in enumerate(audio_parts):

frames = container_decode(audio_part.container, audio=0)
frames = iter_catch(frames, av.AVError)
for frame, timestamp in zip(frames, audio_part.timestamps):
Expand All @@ -539,7 +536,6 @@ def _iterate_audio_frames_and_audio_gaps(audio_parts):

@staticmethod
def _generate_silence_audio_frames(stream, start_ts, max_duration: float = None):

frame_sample_sizes = _AudioPacketIterator._generate_raw_frame_sample_size(
stream, start_ts, max_duration
)
Expand Down
1 change: 0 additions & 1 deletion pupil_src/shared_modules/batch_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@ def cleanup(self):


def main():

import argparse
from textwrap import dedent
from file_methods import Persistent_Dict
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def default_calibration_choreography_plugin(app: str):


def patch_loaded_plugins_with_choreography_plugin(loaded_plugins, app: str):

default_choreo_class = default_calibration_choreography_plugin(app=app)
default_choreo_name = default_choreo_class.__name__

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ def parse_pretty_class_name(cls) -> str:
raise NotImplementedError(f'{cls} must implement a "label" class property')

@staticmethod
def registered_choreographies_by_label() -> T.Mapping[
str, "CalibrationChoreographyPlugin"
]:
def registered_choreographies_by_label() -> (
T.Mapping[str, "CalibrationChoreographyPlugin"]
):
return dict(CalibrationChoreographyPlugin.__registered_choreography_plugins)

@classmethod
Expand Down Expand Up @@ -360,7 +360,6 @@ def _update_gazer_description_ui_text(self):
ui_text.text = self.selected_gazer_class._gazer_description_text()

def init_ui(self):

desc_text = ui.Info_Text(self._choreography_description_text())

self.__ui_selector_choreography = ui.Selector(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@


class MarkerWindowController(observable.Observable):

_CLICKS_NEEDED_TO_CLOSE = 5

# frames of marker shown before starting to sample
Expand Down Expand Up @@ -251,7 +250,6 @@ def update_state(self):
raise UnhandledMarkerWindowStateError(self.__state)

def draw_window(self):

if self.__window.window_size == (0, 0):
# On Windows we get a window_size of (0, 0) when either minimizing the
# Window or when tabbing out (rendered only in the background). We get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@


class _BaseHMDChoreographyPlugin(CalibrationChoreographyPlugin):

### Public

@classmethod
Expand Down Expand Up @@ -93,7 +92,6 @@ def _prepare_perform_start_from_notification(self, note_dict):


class HMD3DChoreographyPlugin(_BaseHMDChoreographyPlugin):

### Public

label = "HMD 3D Calibration"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ def reset(self, detection_point: T.Optional[T.Tuple[float, float]]):
self.__was_detected_on_last_update = False

def update(self, gray_img) -> T.Optional[dict]:

# No starting point was selected yet
if self.__previous_detected_points is None:
return None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ def _choreography_description_text(cls) -> str:
return "Calibrate gaze parameters using a screen based animation."

def _init_custom_menu_ui_elements(self) -> list:

self.__ui_selector_monitor_name = ui.Selector(
"selected_monitor_name",
self,
Expand Down Expand Up @@ -306,7 +305,6 @@ def _on_window_did_close(self):
self._signal_should_stop(mode=self.current_mode)

def __detect_reference_circle_marker(self, gray_img):

# Detect all circular markers
circle_markers = self.__circle_tracker.update(gray_img)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ def _choreography_description_text(cls) -> str:
return "Calibrate using a single marker. Gaze at the center of the marker and move your head (e.g. in a slow spiral movement). This calibration method enables you to quickly sample a wide range of gaze angles and cover a large range of your FOV."

def _init_custom_menu_ui_elements(self) -> list:

self.__ui_selector_marker_mode = ui.Selector(
"marker_mode",
self,
Expand Down
1 change: 0 additions & 1 deletion pupil_src/shared_modules/camera_intrinsics_estimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ def recent_events(self, events):
self.undist_img = self.g_pool.capture.intrinsics.undistort(frame.img)

def gl_display(self):

for grid_points in self.img_points:
# we dont need that extra encapsulation that opencv likes so much
calib_bounds = cv2.convexHull(grid_points)[:, 0]
Expand Down
1 change: 0 additions & 1 deletion pupil_src/shared_modules/circle_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,6 @@ def getEllipsePts(e, num_pts=10):


def marker_3d_pose(marker, cam_model, marker_diameter=7.6):

target_circle = [[0, 0], [marker_diameter, marker_diameter], 0]
target_pts = getEllipsePts(target_circle)
target_pts3D = np.zeros(
Expand Down
1 change: 0 additions & 1 deletion pupil_src/shared_modules/csv_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def csv_export(
export_dir: str,
export_name: str,
) -> str:

export_path = os.path.abspath(os.path.join(export_dir, export_name))

with open(export_path, "w", encoding="utf-8", newline="") as csv_file:
Expand Down
2 changes: 0 additions & 2 deletions pupil_src/shared_modules/file_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,6 @@ def unpacking_ext_hook(self, code, data):


def _recursive_deep_copy(item):

if isinstance(item, collections.abc.Mapping):
_item_dict = {k: _recursive_deep_copy(v) for k, v in item.items()}
if isinstance(item, types.MappingProxyType):
Expand Down Expand Up @@ -444,7 +443,6 @@ def bench_save():


def bench_load():

import time

start = time.time()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def new_window_position(
default_position: T.Tuple[int, int],
previous_position: T.Optional[T.Tuple[int, int]],
) -> T.Tuple[int, int]:

if previous_position is None:
return default_position

Expand Down
4 changes: 0 additions & 4 deletions pupil_src/shared_modules/gprof2dot.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,6 @@ def _integrate_call(self, call, outevent, inevent):

def _integrate_cycle(self, cycle, outevent, inevent):
if outevent not in cycle:

# Compute the outevent for the whole cycle
total = inevent.null()
for member in cycle.functions:
Expand Down Expand Up @@ -886,7 +885,6 @@ def __init__(self, stream):
self.stream = stream

def parse(self):

obj = json.load(self.stream)

assert obj["version"] == 0
Expand Down Expand Up @@ -1288,7 +1286,6 @@ def parse_function_entry(self, lines):
self.functions[function.index] = function

def parse_cycle_entry(self, lines):

# read cycle header line
line = lines[0]
mo = self._cg_cycle_header_re.match(line)
Expand Down Expand Up @@ -1553,7 +1550,6 @@ def parse_function_entry(self, lines):
self.functions[function.index] = function

def parse_cycle_entry(self, lines):

# Process the parents that were not there in gprof format.
parents = []
while True:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@


class Head_Pose_Tracker_Base(Plugin, Observable):

icon_chr = chr(0xEC07)
icon_font = "pupil_icons"

Expand Down
2 changes: 0 additions & 2 deletions pupil_src/shared_modules/hololens_relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ def deinit_ui(self):
self.remove_menu()

def update_menu(self):

del self.menu.elements[:]

def set_iface(use_primary_interface):
Expand Down Expand Up @@ -337,7 +336,6 @@ def thread_loop(self, context, pipe):
and remote_socket is not None
and topic.startswith("notify.calibration.")
):

if payload["subject"] == "calibration.successful":
# event calibration successful
remote_socket.sendto(b"ECS", self.calib_result_receiver)
Expand Down
1 change: 0 additions & 1 deletion pupil_src/shared_modules/log_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def __init__(self, g_pool):
self.should_redraw = True

def init_ui(self):

self.glfont = fontstash.Context()
self.glfont.add_font("opensans", get_opensans_font_path())
self.glfont.set_size(32)
Expand Down
3 changes: 0 additions & 3 deletions pupil_src/shared_modules/math_helper/intersections.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,13 @@ def normalise(p1, p2):
b0 = diff.dot(d1)

if np.abs(a01) < 1.0:

# Lines are not parallel.
det = 1.0 - a01 * a01
b1 = -diff.dot(d2)
s0 = (a01 * b1 - b0) / det
s1 = (a01 * b0 - b1) / det

else:

# Lines are parallel, select any pair of closest points.
s0 = -b0
s1 = 0
Expand All @@ -70,7 +68,6 @@ def nearest_intersection(line0, line1):


def nearest_linepoint_to_point(ref_point, line):

p1 = line[0]
p2 = line[1]

Expand Down
1 change: 0 additions & 1 deletion pupil_src/shared_modules/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def project_distort_pts(
rvec=np.array([0, 0, 0], dtype=np.float32),
tvec=np.array([0, 0, 0], dtype=np.float32),
):

# projectPoints is the inverse of function implemented above --> should map the intermediate result to the original input
pts2d, _ = cv2.projectPoints(pts_xyz, rvec, tvec, camera_matrix, dist_coefs)
return pts2d.reshape(-1, 2)
Expand Down
Loading

0 comments on commit a4e4306

Please sign in to comment.