<commit_before># myapp/authentication.py
from django.contrib.auth.models import User

from rest_framework import authentication
from rest_framework import exceptions
from nduser.models import Token

from django.contrib.auth import authenticate
#from rest_framework.authtoken.models import Token
from django.http import HttpResponseForbidden

from ndwserror import NDWSError
import logging
logger=logging.getLogger("neurodata")

class PublicAuthentication(authentication.BaseAuthentication):
  def has_permission(self, request, view):
    web_path = request.path
    if not web_path: # Some very odd scenario
      raise IOError('Could not get web_path from reques')

    try:
      args = web_path.split('/')
      # Expects args in order: ''|nd|ocp , ''|nd|ocp , App , View , Token , Arguements
      if args[0] in ['','nd','ocp']:
        args = args[1:]
      if args[0] in ['','nd','ocp']:
        args = args[1:]

      if args[0] == 'catmaid':
        exp_token = args[2]
      else:
        exp_token = args[1]

      pp_tokens = Token.objects.filter(public=1)
      pub_tokens = []<commit_msg>Ab.s PAths<commit_after># myapp/authentication.py
from django.contrib.auth.models import User

from rest_framework import authentication
from rest_framework import exceptions
from nduser.models import Token

from django.contrib.auth import authenticate
#from rest_framework.authtoken.models import Token
from django.http import HttpResponseForbidden

from webservices.ndwserror import NDWSError
import logging
logger=logging.getLogger("neurodata")

class PublicAuthentication(authentication.BaseAuthentication):
  def has_permission(self, request, view):
    web_path = request.path
    if not web_path: # Some very odd scenario
      raise IOError('Could not get web_path from reques')

    try:
      args = web_path.split('/')
      # Expects args in order: ''|nd|ocp , ''|nd|ocp , App , View , Token , Arguements
      if args[0] in ['','nd','ocp']:
        args = args[1:]
      if args[0] in ['','nd','ocp']:
        args = args[1:]

      if args[0] == 'catmaid':
        exp_token = args[2]
      else:
        exp_token = args[1]

      pp_tokens = Token.objects.filter(public=1)
      pub_tokens = []
{'fraction_non_alphanumeric': 0.10854816824966079, 'fraction_numerical': 0.007236544549977386, 'mean_word_length': 3.6470588235294117, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3286619', 'n_tokens_mistral': 685, 'n_tokens_neox': 665, 'n_words': 191}