





'''simple docstring'''







from collections import deque
from math import floor
from random import random
from time import time
class 			_lowercase						:







     def __init__( self    ) ->	Tuple:
      snake_case				=			{}







     def     UpperCamelCase			( self    ,   A__    ,   A__    ,   A__=1    ) ->	Union[str, Any]:
      if self.graph.get(A__    ):
       if self.graph[u].count([w, v]    ) == 0:
        self.graph[u].append([w, v]    )
      else:
       snake_case				=			[[w, v]]
      if not self.graph.get(A__    ):
       snake_case				=			[]







     def     UpperCamelCase			( self    ) ->	List[str]:
      return list(self.graph    )







     def     UpperCamelCase			( self    ,   A__    ,   A__    ) ->	Optional[int]:
      if self.graph.get(A__    ):
       for _ in self.graph[u]:
        if _[1] == v:
         self.graph[u].remove(A__    )







     def     UpperCamelCase			( self    ,   A__=-2    ,   A__=-1    ) ->	Union[str, Any]:
      if s == d:
       return []
      snake_case				=			[]
      snake_case				=			[]
      if s == -2:
       snake_case				=			list(self.graph    )[0]
      stack.append(A__    )
      visited.append(A__    )
      snake_case				=			s

      while True:
       # check if there is any non isolated nodes
       if len(self.graph[s]    ) != 0:
        snake_case				=			s
        for node in self.graph[s]:
         if visited.count(node[1]    ) < 1:
          if node[1] == d:
           visited.append(A__    )
           return visited
          else:
           stack.append(node[1]    )
           visited.append(node[1]    )
           snake_case				=			node[1]
           break

            # check if all the children are visited
       if s == ss:
        stack.pop()
        if len(A__    ) != 0:
         snake_case				=			stack[len(A__    ) - 1]
       else:
        snake_case				=			ss

       # check if se have reached the starting point
       if len(A__    ) == 0:
        return visited







     def     UpperCamelCase			( self    ,   A__=-1    ) ->	Tuple:
      if c == -1:
       snake_case				=			floor(random() * 1_00_00    ) + 10
      for i in range(A__    ):
       # every vertex has max 100 edges
       for _ in range(floor(random() * 1_02    ) + 1    ):
        snake_case				=			floor(random() * c    ) + 1
        if n != i:
         self.add_pair(A__    ,   A__    ,   1    )







     def     UpperCamelCase			( self    ,   A__=-2    ) ->	int:
      snake_case				=			deque()
      snake_case				=			[]
      if s == -2:
       snake_case				=			list(self.graph    )[0]
      d.append(A__    )
      visited.append(A__    )
      while d:
       snake_case				=			d.popleft()
       if len(self.graph[s]    ) != 0:
        for node in self.graph[s]:
         if visited.count(node[1]    ) < 1:
          d.append(node[1]    )
          visited.append(node[1]    )
      return visited







     def     UpperCamelCase			( self    ,   A__    ) ->	Optional[Any]:
      snake_case				=			0
      for x in self.graph:
       for y in self.graph[x]:
        if y[1] == u:
         count += 1
      return count







     def     UpperCamelCase			( self    ,   A__    ) ->	List[Any]:
      return len(self.graph[u]    )







     def     UpperCamelCase			( self    ,   A__=-2    ) ->	Any:
      snake_case				=			[]
      snake_case				=			[]
      if s == -2:
       snake_case				=			list(self.graph    )[0]
      stack.append(A__    )
      visited.append(A__    )
      snake_case				=			s
      snake_case				=			[]

      while True:
       # check if there is any non isolated nodes
       if len(self.graph[s]    ) != 0:
        snake_case				=			s
        for node in self.graph[s]:
         if visited.count(node[1]    ) < 1:
          stack.append(node[1]    )
          visited.append(node[1]    )
          snake_case				=			node[1]
          break

            # check if all the children are visited
       if s == ss:
        sorted_nodes.append(stack.pop()    )
        if len(A__    ) != 0:
         snake_case				=			stack[len(A__    ) - 1]
       else:
        snake_case				=			ss

       # check if se have reached the starting point
       if len(A__    ) == 0:
        return sorted_nodes







     def     UpperCamelCase			( self    ) ->	Optional[Any]:
      snake_case				=			[]
      snake_case				=			[]
      snake_case				=			list(self.graph    )[0]
      stack.append(A__    )
      visited.append(A__    )
      snake_case				=			-2
      snake_case				=			[]
      snake_case				=			s
      snake_case				=			False
      snake_case				=			set()

      while True:
       # check if there is any non isolated nodes
       if len(self.graph[s]    ) != 0:
        snake_case				=			s
        for node in self.graph[s]:
         if (
             visited.count(node[1]    ) > 0
             and node[1] != parent
             and indirect_parents.count(node[1]    ) > 0
             and not on_the_way_back
         ):
          snake_case				=			len(A__    ) - 1
          while len_stack >= 0:
           if stack[len_stack] == node[1]:
            anticipating_nodes.add(node[1]    )
            break
           else:
            anticipating_nodes.add(stack[len_stack]    )
            len_stack -= 1
         if visited.count(node[1]    ) < 1:
          stack.append(node[1]    )
          visited.append(node[1]    )
          snake_case				=			node[1]
          break

            # check if all the children are visited
       if s == ss:
        stack.pop()
        snake_case				=			True
        if len(A__    ) != 0:
         snake_case				=			stack[len(A__    ) - 1]
       else:
        snake_case				=			False
        indirect_parents.append(A__    )
        snake_case				=			s
        snake_case				=			ss

       # check if se have reached the starting point
       if len(A__    ) == 0:
        return list(A__    )







     def     UpperCamelCase			( self    ) ->	Any:
      snake_case				=			[]
      snake_case				=			[]
      snake_case				=			list(self.graph    )[0]
      stack.append(A__    )
      visited.append(A__    )
      snake_case				=			-2
      snake_case				=			[]
      snake_case				=			s
      snake_case				=			False
      snake_case				=			set()

      while True:
       # check if there is any non isolated nodes
       if len(self.graph[s]    ) != 0:
        snake_case				=			s
        for node in self.graph[s]:
         if (
             visited.count(node[1]    ) > 0
             and node[1] != parent
             and indirect_parents.count(node[1]    ) > 0
             and not on_the_way_back
         ):
          snake_case				=			len(A__    ) - 1
          while len_stack_minus_one >= 0:
           if stack[len_stack_minus_one] == node[1]:
            anticipating_nodes.add(node[1]    )
            break
           else:
            return True
         if visited.count(node[1]    ) < 1:
          stack.append(node[1]    )
          visited.append(node[1]    )
          snake_case				=			node[1]
          break

            # check if all the children are visited
       if s == ss:
        stack.pop()
        snake_case				=			True
        if len(A__    ) != 0:
         snake_case				=			stack[len(A__    ) - 1]
       else:
        snake_case				=			False
        indirect_parents.append(A__    )
        snake_case				=			s
        snake_case				=			ss

       # check if se have reached the starting point
       if len(A__    ) == 0:
        return False







     def     UpperCamelCase			( self    ,   A__=-2    ,   A__=-1    ) ->	Optional[int]:
      snake_case				=			time()
      self.dfs(A__    ,   A__    )
      snake_case				=			time()
      return end - begin







     def     UpperCamelCase			( self    ,   A__=-2    ) ->	List[str]:
      snake_case				=			time()
      self.bfs(A__    )
      snake_case				=			time()
      return end - begin




class 			_lowercase						:







     def __init__( self    ) ->	List[Any]:
      snake_case				=			{}







     def     UpperCamelCase			( self    ,   A__    ,   A__    ,   A__=1    ) ->	Dict:
      # check if the u exists
      if self.graph.get(A__    ):
       # if there already is a edge
       if self.graph[u].count([w, v]    ) == 0:
        self.graph[u].append([w, v]    )
      else:
       # if u does not exist
       snake_case				=			[[w, v]]
      # add the other way
      if self.graph.get(A__    ):
       # if there already is a edge
       if self.graph[v].count([w, u]    ) == 0:
        self.graph[v].append([w, u]    )
      else:
       # if u does not exist
       snake_case				=			[[w, u]]







     def     UpperCamelCase			( self    ,   A__    ,   A__    ) ->	Tuple:
      if self.graph.get(A__    ):
       for _ in self.graph[u]:
        if _[1] == v:
         self.graph[u].remove(A__    )
        # the other way round
      if self.graph.get(A__    ):
       for _ in self.graph[v]:
        if _[1] == u:
         self.graph[v].remove(A__    )







     def     UpperCamelCase			( self    ,   A__=-2    ,   A__=-1    ) ->	Optional[Any]:
      if s == d:
       return []
      snake_case				=			[]
      snake_case				=			[]
      if s == -2:
       snake_case				=			list(self.graph    )[0]
      stack.append(A__    )
      visited.append(A__    )
      snake_case				=			s

      while True:
       # check if there is any non isolated nodes
       if len(self.graph[s]    ) != 0:
        snake_case				=			s
        for node in self.graph[s]:
         if visited.count(node[1]    ) < 1:
          if node[1] == d:
           visited.append(A__    )
           return visited
          else:
           stack.append(node[1]    )
           visited.append(node[1]    )
           snake_case				=			node[1]
           break

            # check if all the children are visited
       if s == ss:
        stack.pop()
        if len(A__    ) != 0:
         snake_case				=			stack[len(A__    ) - 1]
       else:
        snake_case				=			ss

       # check if se have reached the starting point
       if len(A__    ) == 0:
        return visited







     def     UpperCamelCase			( self    ,   A__=-1    ) ->	List[str]:
      if c == -1:
       snake_case				=			floor(random() * 1_00_00    ) + 10
      for i in range(A__    ):
       # every vertex has max 100 edges
       for _ in range(floor(random() * 1_02    ) + 1    ):
        snake_case				=			floor(random() * c    ) + 1
        if n != i:
         self.add_pair(A__    ,   A__    ,   1    )







     def     UpperCamelCase			( self    ,   A__=-2    ) ->	Optional[Any]:
      snake_case				=			deque()
      snake_case				=			[]
      if s == -2:
       snake_case				=			list(self.graph    )[0]
      d.append(A__    )
      visited.append(A__    )
      while d:
       snake_case				=			d.popleft()
       if len(self.graph[s]    ) != 0:
        for node in self.graph[s]:
         if visited.count(node[1]    ) < 1:
          d.append(node[1]    )
          visited.append(node[1]    )
      return visited







     def     UpperCamelCase			( self    ,   A__    ) ->	str:
      return len(self.graph[u]    )







     def     UpperCamelCase			( self    ) ->	int:
      snake_case				=			[]
      snake_case				=			[]
      snake_case				=			list(self.graph    )[0]
      stack.append(A__    )
      visited.append(A__    )
      snake_case				=			-2
      snake_case				=			[]
      snake_case				=			s
      snake_case				=			False
      snake_case				=			set()

      while True:
       # check if there is any non isolated nodes
       if len(self.graph[s]    ) != 0:
        snake_case				=			s
        for node in self.graph[s]:
         if (
             visited.count(node[1]    ) > 0
             and node[1] != parent
             and indirect_parents.count(node[1]    ) > 0
             and not on_the_way_back
         ):
          snake_case				=			len(A__    ) - 1
          while len_stack >= 0:
           if stack[len_stack] == node[1]:
            anticipating_nodes.add(node[1]    )
            break
           else:
            anticipating_nodes.add(stack[len_stack]    )
            len_stack -= 1
         if visited.count(node[1]    ) < 1:
          stack.append(node[1]    )
          visited.append(node[1]    )
          snake_case				=			node[1]
          break

            # check if all the children are visited
       if s == ss:
        stack.pop()
        snake_case				=			True
        if len(A__    ) != 0:
         snake_case				=			stack[len(A__    ) - 1]
       else:
        snake_case				=			False
        indirect_parents.append(A__    )
        snake_case				=			s
        snake_case				=			ss

       # check if se have reached the starting point
       if len(A__    ) == 0:
        return list(A__    )







     def     UpperCamelCase			( self    ) ->	Union[str, Any]:
      snake_case				=			[]
      snake_case				=			[]
      snake_case				=			list(self.graph    )[0]
      stack.append(A__    )
      visited.append(A__    )
      snake_case				=			-2
      snake_case				=			[]
      snake_case				=			s
      snake_case				=			False
      snake_case				=			set()

      while True:
       # check if there is any non isolated nodes
       if len(self.graph[s]    ) != 0:
        snake_case				=			s
        for node in self.graph[s]:
         if (
             visited.count(node[1]    ) > 0
             and node[1] != parent
             and indirect_parents.count(node[1]    ) > 0
             and not on_the_way_back
         ):
          snake_case				=			len(A__    ) - 1
          while len_stack_minus_one >= 0:
           if stack[len_stack_minus_one] == node[1]:
            anticipating_nodes.add(node[1]    )
            break
           else:
            return True
         if visited.count(node[1]    ) < 1:
          stack.append(node[1]    )
          visited.append(node[1]    )
          snake_case				=			node[1]
          break

            # check if all the children are visited
       if s == ss:
        stack.pop()
        snake_case				=			True
        if len(A__    ) != 0:
         snake_case				=			stack[len(A__    ) - 1]
       else:
        snake_case				=			False
        indirect_parents.append(A__    )
        snake_case				=			s
        snake_case				=			ss

       # check if se have reached the starting point
       if len(A__    ) == 0:
        return False







     def     UpperCamelCase			( self    ) ->	Any:
      return list(self.graph    )







     def     UpperCamelCase			( self    ,   A__=-2    ,   A__=-1    ) ->	List[str]:
      snake_case				=			time()
      self.dfs(A__    ,   A__    )
      snake_case				=			time()
      return end - begin







     def     UpperCamelCase			( self    ,   A__=-2    ) ->	int:
      snake_case				=			time()
      self.bfs(A__    )
      snake_case				=			time()
      return end - begin








'''simple docstring'''







import inspect
import re
from hashlib import shaaaa
from typing import Dict, List

from .arrow import arrow
from .audiofolder import audiofolder
from .csv import csv
from .imagefolder import imagefolder
from .json import json
from .pandas import pandas
from .parquet import parquet
from .sql import sql  # noqa F401
from .text import text

def    __UpperCamelCase	(	a    : List[str]     ) ->str:
 snake_case				=			[]
 for line in lines:
  snake_case				=			re.sub(R'''#.*'''					,   ''''''					,   a     )  # remove comments
  if line:
   filtered_lines.append(a     )
 snake_case				=			'''\n'''.join(a     )

 # Make a hash from all this code
 snake_case				=			full_str.encode('''utf-8'''     )
 return shaaaa(a     ).hexdigest()


# get importable module names and hash for caching
_lowercase       						=			{
    'csv': (csv.__name__, _hash_python_lines(inspect.getsource(csv).splitlines())),
    'json': (json.__name__, _hash_python_lines(inspect.getsource(json).splitlines())),
    'pandas': (pandas.__name__, _hash_python_lines(inspect.getsource(pandas).splitlines())),
    'parquet': (parquet.__name__, _hash_python_lines(inspect.getsource(parquet).splitlines())),
    'arrow': (arrow.__name__, _hash_python_lines(inspect.getsource(arrow).splitlines())),
    'text': (text.__name__, _hash_python_lines(inspect.getsource(text).splitlines())),
    'imagefolder': (imagefolder.__name__, _hash_python_lines(inspect.getsource(imagefolder).splitlines())),
    'audiofolder': (audiofolder.__name__, _hash_python_lines(inspect.getsource(audiofolder).splitlines())),
}

# Used to infer the module to use based on the data files extensions
_lowercase       						=			{
    '.csv': ('csv', {}),
    '.tsv': ('csv', {'sep': '\t'}),
    '.json': ('json', {}),
    '.jsonl': ('json', {}),
    '.parquet': ('parquet', {}),
    '.arrow': ('arrow', {}),
    '.txt': ('text', {}),
}
_EXTENSION_TO_MODULE.update({ext: ('imagefolder', {}) for ext in imagefolder.ImageFolder.EXTENSIONS})
_EXTENSION_TO_MODULE.update({ext.upper(): ('imagefolder', {}) for ext in imagefolder.ImageFolder.EXTENSIONS})
_EXTENSION_TO_MODULE.update({ext: ('audiofolder', {}) for ext in audiofolder.AudioFolder.EXTENSIONS})
_EXTENSION_TO_MODULE.update({ext.upper(): ('audiofolder', {}) for ext in audiofolder.AudioFolder.EXTENSIONS})
_lowercase       						=			{'imagefolder', 'audiofolder'}

# Used to filter data files based on extensions given a module name
_lowercase       						=			{}
for _ext, (_module, _) in _EXTENSION_TO_MODULE.items():
   _MODULE_TO_EXTENSIONS.setdefault(_module, []).append(_ext)

_MODULE_TO_EXTENSIONS["imagefolder"].append('.zip')






_MODULE_TO_EXTENSIONS["audiofolder"].append('.zip')

