<commit_before>/*jshint laxcomma: true, node: true*/
'use strict'
var hapi         = require("hapi")
  , fs           = require('fs')
  , util           = require('util')
  , path         = require('path')
  , Api          = require('../lib/api')
  , http         = require('../lib/http')
  , _Resource    = require('../lib/resource')
  , Throttle     = require('../lib/throttle')
  , Cache        = require('../lib/cache')
  , urljoin      = require('../lib').urljoin
  , fields       = require('../lib/fields')
  , qs_validator = require('../lib/resource/validator/querystring')
  , joi          = require('joi')
  , Schema
  , Model
  , Endpoints
  , connection
  , server
  , port
  , v1
  ;

port       = process.env.PORT || 3000
server     = new hapi.Server()

server.connection({
	port:port,
	host:'0.0.0.0',
	labels:['main']
})


var Base = _Resource.extend({
	options:{
		pk:'guid'
		,cache: new Cache({engine:'catbox-memory'})
		,allowed:{
			upload:{
				get:true,
				post:true
			}
		}

	}

	,fields:{
	    age      : { type:'int' }
	  , fake     : new fields.ApiFIeld({readonly:true})
	  , name     : {type:'char'}
	  , fullname : {type:'char'}
	  , city     : {type:'char', attribute:'company.address.city'}
	  , date     : {type:'datetime', attribute:'registered'}
	  , location : {type:'field', readonly: true}
	  , file     : new fields.FileField({create:true, root:path.resolve(__dirname), exclude: true})
	}

	, constructor: function( opts ){
		this.parent('constructor', opts )
	}

	, dehydrate: function( obj ){
		return obj;
	}

	, dehydrate_fullname: function( obj ){
		return obj.gender + " " + obj.company.address.state;
	}

	, dehydrate_location: function( obj, bundle ){
		return [ obj.longitude, obj.latitude ];
	}
	, dehydrate_fake:function( obj, bundle ){
		return bundle.req.method + " " + obj.index
	}

	, dispatch_upload: function(req, reply ){
		return this.dispatch('upload', this.bundle( req, reply ) )
	}

	, get_objects: function(bundle, callback){
		fs.readFile( path.join(__dirname, 'data.json') , callback)
	}

	, get_object: function( bundle, callback ){
		this.get_objects(bundle,function(e, objects){
			var obj = JSON.parse( objects ).filter(function( obj ){
					return obj.guid == bundle.req.params.pk
				})[0]
				callback( null, obj )
			})<commit_msg>removing used vars<commit_after>/*jshint laxcomma: true, node: true*/
'use strict'
var hapi         = require("hapi")
  , fs           = require('fs')
  , path         = require('path')
  , Api          = require('../lib/api')
  , _Resource    = require('../lib/resource')
  , Cache        = require('../lib/cache')
  , fields       = require('../lib/fields')
  , server
  , port
  , v1
  ;

port       = process.env.PORT || 3000
server     = new hapi.Server()

server.connection({
	port:port,
	host:'0.0.0.0',
	labels:['main']
})


var Base = _Resource.extend({
	options:{
		pk:'guid'
		,cache: new Cache({engine:'catbox-memory'})
		,allowed:{
			upload:{
				get:true,
				post:true
			}
		}

	}

	,fields:{
	    age      : { type:'int' }
	  , fake     : new fields.ApiFIeld({readonly:true})
	  , name     : {type:'char'}
	  , fullname : {type:'char'}
	  , city     : {type:'char', attribute:'company.address.city'}
	  , date     : {type:'datetime', attribute:'registered'}
	  , location : {type:'field', readonly: true}
	  , file     : new fields.FileField({create:true, root:path.resolve(__dirname), exclude: true})
	}

	, constructor: function( opts ){
		this.parent('constructor', opts )
	}

	, dehydrate: function( obj ){
		return obj;
	}

	, dehydrate_fullname: function( obj ){
		return obj.gender + " " + obj.company.address.state;
	}

	, dehydrate_location: function( obj /*, bundle */ ){
		return [ obj.longitude, obj.latitude ];
	}
	, dehydrate_fake:function( obj, bundle ){
		return bundle.req.method + " " + obj.index
	}

	, dispatch_upload: function(req, reply ){
		return this.dispatch('upload', this.bundle( req, reply ) )
	}

	, get_objects: function(bundle, callback){
		fs.readFile( path.join(__dirname, 'data.json') , callback)
	}

	, get_object: function( bundle, callback ){
		this.get_objects(bundle,function(e, objects){
			var obj = JSON.parse( objects ).filter(function( obj ){
					return obj.guid == bundle.req.params.pk
				})[0]
				callback( null, obj )
			})
{'fraction_non_alphanumeric': 0.17462165308498254, 'fraction_numerical': 0.004656577415599534, 'mean_word_length': 2.8807588075880757, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '601446', 'n_tokens_mistral': 1580, 'n_tokens_neox': 1453, 'n_words': 290}