Skip to content

Commit

Permalink
Prune some useless imports from Cython code
Browse files Browse the repository at this point in the history
  • Loading branch information
jlaine committed Oct 30, 2023
1 parent fcb87ff commit c9e0ed6
Show file tree
Hide file tree
Showing 15 changed files with 6 additions and 26 deletions.
1 change: 0 additions & 1 deletion av/audio/codeccontext.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ cimport libav as lib
from av.audio.format cimport AudioFormat, get_audio_format
from av.audio.frame cimport AudioFrame, alloc_audio_frame
from av.audio.layout cimport AudioLayout, get_audio_layout
from av.error cimport err_check
from av.frame cimport Frame
from av.packet cimport Packet

Expand Down
2 changes: 0 additions & 2 deletions av/audio/fifo.pyx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from av.audio.format cimport get_audio_format
from av.audio.frame cimport alloc_audio_frame
from av.audio.layout cimport get_audio_layout
from av.error cimport err_check


Expand Down
1 change: 0 additions & 1 deletion av/audio/frame.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ cdef class AudioFrame(Frame):
# Audio filters need AVFrame.channels to match number of channels from layout.
self.ptr.channels = self.layout.nb_channels

cdef size_t buffer_size
if self.layout.channels and nb_samples:

# Cleanup the old buffer.
Expand Down
2 changes: 0 additions & 2 deletions av/audio/plane.pyx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
cimport libav as lib

from av.audio.frame cimport AudioFrame


Expand Down
2 changes: 1 addition & 1 deletion av/codec/codec.pyx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from av.audio.format cimport get_audio_format
from av.descriptor cimport wrap_avclass
from av.enum cimport define_enum
from av.utils cimport avrational_to_fraction, flag_in_bitfield
from av.utils cimport avrational_to_fraction
from av.video.format cimport get_video_format


Expand Down
2 changes: 1 addition & 1 deletion av/codec/context.pyx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import warnings

from libc.errno cimport EAGAIN
from libc.stdint cimport int64_t, uint8_t
from libc.stdint cimport uint8_t
from libc.string cimport memcpy
cimport libav as lib

Expand Down
5 changes: 0 additions & 5 deletions av/container/core.pyx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from cython.operator cimport dereference
from libc.stdint cimport int64_t
from libc.stdlib cimport free, malloc

import os
import time
Expand All @@ -20,9 +19,6 @@ from av.dictionary import Dictionary
from av.logging import Capture as LogCapture


ctypedef int64_t (*seek_func_t)(void *opaque, int64_t offset, int whence) noexcept nogil


cdef object _cinit_sentinel = object()


Expand Down Expand Up @@ -207,7 +203,6 @@ cdef class Container:

cdef bytes name_obj = os.fsencode(self.name)
cdef char *name = name_obj
cdef seek_func_t seek_func = NULL

cdef lib.AVOutputFormat *ofmt
if self.writeable:
Expand Down
1 change: 0 additions & 1 deletion av/container/output.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from fractions import Fraction
import logging
import os

Expand Down
2 changes: 0 additions & 2 deletions av/enum.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ integers for names and values respectively.
"""

from collections import OrderedDict
import copyreg
import sys


cdef sentinel = object()
Expand Down
6 changes: 2 additions & 4 deletions av/filter/context.pyx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
from libc.string cimport memcpy

from av.audio.frame cimport AudioFrame, alloc_audio_frame
from av.audio.frame cimport alloc_audio_frame
from av.dictionary cimport _Dictionary
from av.dictionary import Dictionary
from av.error cimport err_check
from av.filter.pad cimport alloc_filter_pads
from av.frame cimport Frame
from av.utils cimport avrational_to_fraction
from av.video.frame cimport VideoFrame, alloc_video_frame
from av.video.frame cimport alloc_video_frame


cdef object _cinit_sentinel = object()
Expand Down
2 changes: 0 additions & 2 deletions av/frame.pyx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from av.utils cimport avrational_to_fraction, to_avrational

from fractions import Fraction

from av.sidedata.sidedata import SideDataContainer


Expand Down
2 changes: 1 addition & 1 deletion av/logging.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ API Reference

from __future__ import absolute_import

from libc.stdio cimport fprintf, printf, stderr
from libc.stdio cimport fprintf, stderr
from libc.stdlib cimport free, malloc
cimport libav as lib

Expand Down
1 change: 0 additions & 1 deletion av/stream.pxd
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from libc.stdint cimport int64_t
cimport libav as lib

from av.codec.context cimport CodecContext
Expand Down
1 change: 0 additions & 1 deletion av/subtitles/codeccontext.pyx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
cimport libav as lib

from av.error cimport err_check
from av.frame cimport Frame
from av.packet cimport Packet
from av.subtitles.subtitle cimport SubtitleProxy, SubtitleSet

Expand Down
2 changes: 1 addition & 1 deletion av/video/frame.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ from libc.stdint cimport uint8_t
from av.enum cimport define_enum
from av.error cimport err_check
from av.utils cimport check_ndarray, check_ndarray_shape
from av.video.format cimport VideoFormat, get_pix_fmt, get_video_format
from av.video.format cimport get_pix_fmt, get_video_format
from av.video.plane cimport VideoPlane


Expand Down

0 comments on commit c9e0ed6

Please sign in to comment.