
import typing

from jsonpointer import JsonPointer as BaseJsonPointer


class JSONPointer(BaseJsonPointer):
    def __init__(self, pointer):
        super(JSONPointer, self).__init__(pointer)

    def __truediv__(self,
                    path: typing.Union['JSONPointer', str]) -> 'JSONPointer':
        parts = self.parts.copy()
        if isinstance(path, str):
            if not path.startswith('/'):
                path = f'/{path}'
            new_parts = JSONPointer(path).parts.pop(0)
            parts.append(new_parts)
        else:
            new_parts = path.parts
            parts.extend(new_parts)
        return JSONPointer.from_parts(parts)


import typing

from jsonpointer import JsonPointer as BaseJsonPointer


class JSONPointer(BaseJsonPointer):
    def __init__(self, pointer):
        super(JSONPointer, self).__init__(pointer)

    def __truediv__(self,
                    path: typing.Union['JSONPointer', str]) -> 'JSONPointer':
        parts = self.parts.copy()

        if isinstance(path, int):
            path = str(path)

        if isinstance(path, str):
            if not path.startswith('/'):
                path = f'/{path}'
            new_parts = JSONPointer(path).parts.pop(0)
            parts.append(new_parts)
        else:
            new_parts = path.parts
            parts.extend(new_parts)
        return JSONPointer.from_parts(parts)

Fix bug with JSONPointer if part passed via __truediv__ is integer
Fix bug with JSONPointer if part passed via __truediv__ is integer

  
  import typing
  
  from jsonpointer import JsonPointer as BaseJsonPointer
  
  
  class JSONPointer(BaseJsonPointer):
      def __init__(self, pointer):
          super(JSONPointer, self).__init__(pointer)
  
      def __truediv__(self,
                      path: typing.Union['JSONPointer', str]) -> 'JSONPointer':
          parts = self.parts.copy()
+ 
+         if isinstance(path, int):
+             path = str(path)
+ 
          if isinstance(path, str):
              if not path.startswith('/'):
                  path = f'/{path}'
              new_parts = JSONPointer(path).parts.pop(0)
              parts.append(new_parts)
          else:
              new_parts = path.parts
              parts.extend(new_parts)
          return JSONPointer.from_parts(parts)
  
Fix bug with JSONPointer if part passed via __truediv__ is integer
## Code Before:

import typing

from jsonpointer import JsonPointer as BaseJsonPointer


class JSONPointer(BaseJsonPointer):
    def __init__(self, pointer):
        super(JSONPointer, self).__init__(pointer)

    def __truediv__(self,
                    path: typing.Union['JSONPointer', str]) -> 'JSONPointer':
        parts = self.parts.copy()
        if isinstance(path, str):
            if not path.startswith('/'):
                path = f'/{path}'
            new_parts = JSONPointer(path).parts.pop(0)
            parts.append(new_parts)
        else:
            new_parts = path.parts
            parts.extend(new_parts)
        return JSONPointer.from_parts(parts)

## Instruction:
Fix bug with JSONPointer if part passed via __truediv__ is integer
## Code After:

import typing

from jsonpointer import JsonPointer as BaseJsonPointer


class JSONPointer(BaseJsonPointer):
    def __init__(self, pointer):
        super(JSONPointer, self).__init__(pointer)

    def __truediv__(self,
                    path: typing.Union['JSONPointer', str]) -> 'JSONPointer':
        parts = self.parts.copy()

        if isinstance(path, int):
            path = str(path)

        if isinstance(path, str):
            if not path.startswith('/'):
                path = f'/{path}'
            new_parts = JSONPointer(path).parts.pop(0)
            parts.append(new_parts)
        else:
            new_parts = path.parts
            parts.extend(new_parts)
        return JSONPointer.from_parts(parts)
