<commit_before>#/p Copyright 2014 Open Connectome Project (http://openconnecto.me)
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


import numpy as np
import json
import urllib2
from lxml import etree
from django.conf import settings

import ocpcadb
from ocptype import ZSLICES

import logging
logger=logging.getLogger("ocp")


def projdict ( proj ):

  projdict = {}
  projdict['name'] = proj.getProjectName()
  projdict['description'] = proj.getProjectDescription()
  projdict['version'] = proj.getOCPVersion()

  # These fields are internal
  #projdict['dbname'] = proj._dbname
  #projdict['host'] = proj._dbhost
  #projdict['schemaversion'] = proj.getSchemaVersion()
  #projdict['kvengine'] = proj._kvengine
  #projdict['kvserver'] = proj._kvserver

  return projdict

def datasetdict ( dataset ):

  dsdict = {}
  dsdict['scalinglevels'] = dataset.scalinglevels
  if dataset.scalingoption == ZSLICES:
    dsdict['scaling'] = 'zslices'
  else:
    dsdict['scaling'] = 'xyz'
  dsdict['resolutions'] = dataset.resolutions<commit_msg>Adding dataset name to json info query. HDF5 info query already has the dataset name.<commit_after>#/p Copyright 2014 Open Connectome Project (http://openconnecto.me)
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


import numpy as np
import json
import urllib2
from lxml import etree
from django.conf import settings

import ocpcadb
from ocptype import ZSLICES

import logging
logger=logging.getLogger("ocp")


def projdict ( proj ):

  projdict = {}
  projdict['name'] = proj.getProjectName()
  projdict['description'] = proj.getProjectDescription()
  projdict['version'] = proj.getOCPVersion()

  # These fields are internal
  #projdict['dbname'] = proj._dbname
  #projdict['host'] = proj._dbhost
  #projdict['schemaversion'] = proj.getSchemaVersion()
  #projdict['kvengine'] = proj._kvengine
  #projdict['kvserver'] = proj._kvserver

  return projdict

def datasetdict ( dataset ):

  dsdict = {}
  dsdict['name'] = dataset.getDatasetName()
  dsdict['scalinglevels'] = dataset.scalinglevels
  if dataset.scalingoption == ZSLICES:
    dsdict['scaling'] = 'zslices'
  else:
    dsdict['scaling'] = 'xyz'
  dsdict['resolutions'] = dataset.resolutions
{'fraction_non_alphanumeric': 0.10282131661442007, 'fraction_numerical': 0.0059561128526645765, 'mean_word_length': 4.627865961199294, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, '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': '7518849', 'n_tokens_mistral': 991, 'n_tokens_neox': 936, 'n_words': 319}