<commit_before>#!/usr/bin/env python
# 
# Flies Python Client
#
# Copyright (c) 2010 <NAME> <<EMAIL>>
# Copyright (c) 2010 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA  02111-1307  USA

import getopt, sys
import json
import os.path
from flieslib import Flies 
from flieslib import InvalidOptionException
from parseconfig import FliesConfig

def usage():
    print ''' 
    Client for talking to a Flies Server
    basic command:
    flies list        List all available projects
    Use 'flies help' for the full list of commands'''

def help_message():
    print '''
    Usage:
    flies list                                  list all available projects
    flies projectinfo --project=project_id      Retrieve a project
    flies iterationinfo|info --project=project_id --iteration=iteration_id 
                                                      Retrieve a iteration
    flies create project project_id --name=project_name --description=project_desc
                                                      Create a project
    flies create iteration iteration_id --project=project_id --name=itertation_name
                                                      Create a iteration of a project   
    flies publican pull                         Pull the content of publican file
    flies publican push                         Push the content of publican to Flies Server'''
          
def list_projects(server):
    flies = Flies(server)
    res, content = flies.get_projects()
    print 'Status: '+res['status']
    if res.get('status') == '200':
        projects = json.loads(content)
        for project in projects:
           print "*"*40
           print project
    else:
        print "No project exists on the server"
        
def project_info(server, project_id):<commit_msg>Modify the error message<commit_after>#!/usr/bin/env python
# 
# Flies Python Client
#
# Copyright (c) 2010 <NAME> <<EMAIL>>
# Copyright (c) 2010 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA  02111-1307  USA

import getopt, sys
import json
import os.path
from flieslib import Flies 
from flieslib import InvalidOptionException
from parseconfig import FliesConfig

def usage():
    print ''' 
    Client for talking to a Flies Server
    basic command:
    flies list        List all available projects
    Use 'flies help' for the full list of commands'''

def help_message():
    print '''
    Usage:
    flies list                                  list all available projects
    flies projectinfo --project=project_id      Retrieve a project
    flies iterationinfo|info --project=project_id --iteration=iteration_id 
                                                      Retrieve a iteration
    flies create project project_id --name=project_name --description=project_desc
                                                      Create a project
    flies create iteration iteration_id --project=project_id --name=itertation_name
                                                      Create a iteration of a project   
    flies publican pull                         Pull the content of publican file
    flies publican push                         Push the content of publican to Flies Server'''
          
def list_projects(server):
    flies = Flies(server)
    res, content = flies.get_projects()
    print 'Status: '+res['status']
    if res.get('status') == '200':
        projects = json.loads(content)
        for project in projects:
           print "*"*40
           print project
    else:
        print 'Flies REST service not available at %s' % server
        
def project_info(server, project_id):
{'fraction_non_alphanumeric': 0.06130268199233716, 'fraction_numerical': 0.011292599314377899, 'mean_word_length': 2.34006734006734, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6353895', 'n_tokens_mistral': 1227, 'n_tokens_neox': 1161, 'n_words': 556}