<commit_before>import datetime
import time
import json
from datetime import datetime
import sys
import os
import shutil
import urllib
import glob
import lib.dbSpectro as dbSpectro
import lib.cds as cds  # mes modules

print "Robot extrait les fichiers spectres traite"

if len(sys.argv) < 3:
    print "nombre d'argument incorrect"
    print "utiliser: "
    print "   python get-spc-obs.py obsId Id dstPath"
    print "   python get-spc-obs.py objectId Id dstPath"
    print "   python get-spc-obs.py objectId Id orderNo No dstPath"
    exit(1)

db = dbSpectro.init_connection()

if len(sys.argv)>5 and sys.argv[3] == 'orderNo':
	orderNo=sys.argv[4]
	destPath = sys.argv[5]
else:
	orderNo= '*'
	destPath = sys.argv[3]

if sys.argv[1] == 'obsId':
    fileList = dbSpectro.getFilesSpcPerObsId(db, int(sys.argv[2]),orderNo)
elif sys.argv[1] == 'objectId':
    fileList = dbSpectro.getFilesSpcPerObjId(db, int(sys.argv[2]),orderNo)
else:
    print "argument " + sys.argv[1] + " incorrect utiliser ObsId ou objectId"
    db.close()
    exit(1)

json_text = open("../config/config.json").read()
config = json.loads(json_text)

PathBaseSpectro = config['path']['archive'] + '/archive'


print "dossier source", PathBaseSpectro
print "dossier destination", destPath<commit_msg>correction bug pour demande par ObjectId<commit_after>import datetime
import time
import json
from datetime import datetime
import sys
import os
import shutil
import urllib
import glob
import lib.dbSpectro as dbSpectro
import lib.cds as cds  # mes modules

print "Robot extrait les fichiers spectres traite"

if len(sys.argv) < 3:
    print "nombre d'argument incorrect"
    print "utiliser: "
    print "   python get-spc-obs.py obsId Id dstPath"
    print "   python get-spc-obs.py objectId Id dstPath"
    print "   python get-spc-obs.py objectId Id orderNo No dstPath"
    exit(1)

db = dbSpectro.init_connection()
print "len(sys.argv)=" , len(sys.argv)
if len(sys.argv)>5 and sys.argv[3] == 'orderNo':
	orderNo=sys.argv[4]
	destPath = sys.argv[5]
else:
	orderNo= '%'
	destPath = sys.argv[3]


print "sys.argv[1]=",sys.argv[1]
print "orderNo=",orderNo

if sys.argv[1] == 'obsId':
    print "obsId=",int(sys.argv[2])
    fileList = dbSpectro.getFilesSpcPerObsId(db, int(sys.argv[2]),orderNo)
elif sys.argv[1] == 'objectId':
    print "objectId=",int(sys.argv[2])
    fileList = dbSpectro.getFilesSpcPerObjId(db, int(sys.argv[2]),orderNo)
else:
    print "argument " + sys.argv[1] + " incorrect utiliser ObsId ou objectId"
    db.close()
    exit(1)

json_text = open("../config/config.json").read()
config = json.loads(json_text)

PathBaseSpectro = config['path']['archive'] + '/archive'


print "dossier source", PathBaseSpectro
print "dossier destination", destPath
{'fraction_non_alphanumeric': 0.13065693430656936, 'fraction_numerical': 0.010948905109489052, 'mean_word_length': 4.363992172211351, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5973285', 'n_tokens_mistral': 1009, 'n_tokens_neox': 983, 'n_words': 253}