

def as_int(value):
    try:
        return int(value)
    except ValueError:
        return None



def as_int(value):
    try:
        return int(value)
    except ValueError:
        return None


def urljoin(*parts):
    url = parts[0]
    for p in parts[1:]:
        if url[-1] != '/':
            url += '/'
        url += p
    return url

Add url join which serves our needs
Add url join which serves our needs

Existing functions in common libraries add extra slashes.

  
  
  def as_int(value):
      try:
          return int(value)
      except ValueError:
          return None
  
+ 
+ def urljoin(*parts):
+     url = parts[0]
+     for p in parts[1:]:
+         if url[-1] != '/':
+             url += '/'
+         url += p
+     return url
+ 
Add url join which serves our needs
## Code Before:


def as_int(value):
    try:
        return int(value)
    except ValueError:
        return None

## Instruction:
Add url join which serves our needs
## Code After:


def as_int(value):
    try:
        return int(value)
    except ValueError:
        return None


def urljoin(*parts):
    url = parts[0]
    for p in parts[1:]:
        if url[-1] != '/':
            url += '/'
        url += p
    return url
