Changeset 352 for trunk/aeres/scripts


Ignore:
Timestamp:
02/19/14 16:16:49 (10 years ago)
Author:
pinsard
Message:

fix thanks to coding rules; typo

Location:
trunk/aeres/scripts
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/aeres/scripts/aeresrh.py

    r325 r352  
    11#!/usr/bin/env python 
    2 # -*- coding: iso-8859-1 -*- 
     2# -*- coding: utf-8 -*- 
    33 
    44""" 
     
    1515.. option:: --ifile <file> 
    1616 
    17       file to read 
     17   file to read 
    1818 
    1919.. only:: man 
    2020 
    21     Figure is visible on PDF and HTML documents only. 
    22  
    23     .. only:: html or latex 
    24  
    25        .. graphviz:: 
    26  
    27           digraph aeresrh { 
    28                  rh [shape=diamond, 
    29                      fontname=Courier, 
    30                      label='{ifile}' 
    31  
    32                  aeresrh [shape=box, 
    33                      fontname=Courier, 
    34                      color=blue, 
    35                      URL="http://forge.ipsl.jussieu.fr/pulsation/browser/trunk/aeres/scripts/aeresrh.py", 
    36                      label="${PROJECT}/aeres/scripts/aeresrh.py"]; 
    37              } 
     21   Figure is visible on PDF and HTML documents only. 
     22 
     23   .. only:: html or latex 
     24 
     25      .. graphviz:: 
     26 
     27         digraph aeresrh { 
     28                rh [shape=diamond, 
     29                    fontname=Courier, 
     30                    label='{ifile}' 
     31 
     32                aeresrh [shape=box, 
     33                    fontname=Courier, 
     34                    color=blue, 
     35                    URL="http://forge.ipsl.jussieu.fr/pulsation/browser/trunk/aeres/scripts/aeresrh.py", 
     36                    label="${PROJECT}/aeres/scripts/aeresrh.py"]; 
     37            } 
    3838 
    3939SEE ALSO 
     
    5050======== 
    5151 
    52 :: 
    53  
    54  aeresrh.py --ifile ${PROJECT}/data/aeresrh.xls 
    55  
    56  aeresrh.py --ifile ${HOME}/Downloads/personnel_francoise.xls 
     52.. code-block:: bash 
     53 
     54   aeresrh.py --ifile ${PROJECT}/data/aeresrh.xls 
     55 
     56   aeresrh.py --ifile ${HOME}/Downloads/personnel_francoise.xls 
    5757 
    5858TODO 
     
    6666 
    6767comment j'ai la liste des gens partis au 30 juin 2012 avec 
    68 publication (retraite, decès, mutation) 
     68publication (retraite, décÚs, mutation) 
    6969 
    7070test with real file (encoding, francais, etc) 
     
    8383- fplod 20120426 
    8484 
    85   * big process in dictionnary using itertools 
     85  * big process in dictionary using itertools 
    8686 
    8787- fplod 20120410 
    8888 
    8989  * real titles 
    90   * start dictionnary 
     90  * start dictionary 
    9191 
    9292- fplod 20120409 
     
    101101- fplod 20120405 
    102102 
    103   * gestion des temps (arrivée, départ) (to be cont.) 
     103  * gestion des temps (arrivée, départ) (to be cont.) 
    104104  * creation draft 
    105105    thanks to http://www.portailsig.org/content/python-lire-et-ecrire-des-fichiers-microsoft-excel-application-quantum-gis 
     
    181181        print('sheets name %s' % ( wb.sheet_names())) 
    182182 
    183     # lecture des données dans la première feuille 
     183    # lecture des données dans la premiÚre feuille 
    184184    sh = wb.sheet_by_index(0) 
    185185 
     
    221221    # detect firstname column 
    222222    for colnum in range(sh.ncols): 
    223         if sh.col_values(colnum)[titlerow] == u'Prénom': 
     223        if sh.col_values(colnum)[titlerow] == u'Prénom': 
    224224            colfirstname = colnum 
    225225    if is_verbose == True: 
  • trunk/aeres/scripts/build_firstname_id.py

    r325 r352  
    11#!/usr/bin/env python 
    2 # -*- coding: iso-8859-1 -*- 
     2# -*- coding: utf-8 -*- 
    33 
    44""" 
     
    1111=========== 
    1212 
    13 generation de la partie "prénom" de l'id : 
    14  - suppress blanks 
    15  - suppress punctation 
    16  - replace diacritals by their non-diacriticals equivalent (ie ï become i) 
     13génération de la partie "prénom" de l'id : 
     14 
     15- suppress blanks 
     16- suppress punctation 
     17- replace diacriticals by their non-diacriticals equivalent (ie ï become i) 
    1718 
    1819SEE ALSO 
     
    2829cf. doctest 
    2930 
    30 :: 
     31.. code-block:: bash 
    3132 
    32     python -v build_firstname_id 
     33   python -v build_firstname_id 
    3334 
    3435TODO 
     
    7576    >>> firstname 
    7677    [u' Ginette', u'Gin ette ', u"G\'in ette "] 
    77     >>> firstname.append(u"Gïnette") 
     78    >>> firstname.append(u"Gïnette") 
    7879    >>> firstname 
    7980    [u' Ginette', u'Gin ette ', u"G'in ette ", u'G\xefnette'] 
     
    134135        import sys 
    135136        sys.exit(1) 
    136     
     137 
  • trunk/aeres/scripts/build_surname_id.py

    r349 r352  
    11#!/usr/bin/env python 
    2 # -*- coding: iso-8859-1 -*- 
     2# -*- coding: utf-8 -*- 
    33 
    44""" 
     
    1414 - suppress blanks 
    1515 - suppress punctation 
    16  - replace diacritals by their non-diacriticals equivalent (ie ï become i) 
     16 - replace diacriticals by their non-diacriticals equivalent (ie ï become i) 
    1717 - uppercase every characters 
    1818 
     
    2727cf. doctest 
    2828 
    29 :: 
     29.. code-block:: bash 
    3030 
    31     python -v build_surname_id 
     31   python -v build_surname_id 
    3232 
    3333TODO 
  • trunk/aeres/scripts/define_loceanaffectation.py

    r322 r352  
    11#!/usr/bin/env python 
    2 # -*- coding: iso-8859-1 -*- 
     2# -*- coding: utf-8 -*- 
    33 
    44 
     
    1919======== 
    2020 
    21 :: 
     21.. code-block:: bash 
    2222 
    23  define_loceanaffectation.py 
    24  
     23   define_loceanaffectation.py 
    2524 
    2625TODO 
     
    5958    automation of no diacritical and no punctation transformation 
    6059 
    61     dictionnary instead of list 
     60    dictionary instead of list 
    6261    """ 
    6362    affectation_bibtool = [] 
    6463    affectation_title = [] 
    65      
     64 
    6665    affectation_bibtool.append("mnhn") 
    6766    affectation_title.append("mnhn") 
     
    8180if __name__ == '__main__': 
    8281    title, bibtool = define_loceanaffectation() 
    83     print(' title : %s , bibtool : %s' % (title,bibtool))  
     82    print(' title : %s , bibtool : %s' % (title,bibtool)) 
  • trunk/aeres/scripts/ldap_biblio.py

    r325 r352  
    11#! /usr/bin/env python 
    2 # -*- coding: iso-8859-15 -*- 
     2# -*- coding: utf-8 -*- 
    33 
    44""" 
     
    1111======== 
    1212 
    13 :: 
    14   
    15   ldap_biblio.py 
     13.. code-block:: bash 
     14 
     15   ldap_biblio.py 
    1616 
    1717DESCRIPTION 
     
    5050======== 
    5151 
    52 :: 
    53  
    54  ldap_biblio.py 
     52.. code-block:: bash 
     53 
     54   ldap_biblio.py 
    5555 
    5656TIPS 
    5757==== 
    5858 
    59 To install ldap for python on mac lion:: 
    60  
    61  sudo pip install --upgrade python-ldap==2.3.13 
    62  
    63 see troubles with newer release in  
     59To install ldap for python on mac lion: 
     60 
     61.. code-block:: bash 
     62 
     63   sudo pip install --upgrade python-ldap==2.3.13 
     64 
     65see troubles with newer release in 
    6466http://stackoverflow.com/questions/6475118/python-ldap-os-x-10-6-and-python-2-6 
    6567 
     
    7375documentation 
    7476 
    75 pas de diactrique dans ldap 
     77pas de diacritique dans ldap 
    7678 
    7779EVOLUTIONS 
     
    9092  * reprise 
    9193 
    92     voici tous les champs:: 
    93  
    94     ["cn: ['Adel Ammar (S. Thiria)']",  
    95      "objectClass: ['inetLocalMailRecipient', 'person', 'organizationalPerson', 'inetOrgPerson', 'loceanPersonne', 'posixAccount', 'top']",  
    96      "uidNumber: ['36310']",  
    97      "street: ['LOCEAN']",  
    98      "uid: ['aalod']",  
    99      "title: ['http://www.locean-ipsl.upmc.fr/photo.jpg']",  
    100      "mailLocalAddress: ['aalod@locean-ipsl.upmc.fr']",  
    101      "postalCode: ['75252 PARIS Cedex 05']",  
    102      "mail: ['aalod@locean-ipsl.upmc.fr', 'aalod@lodyc.jussieu.fr', 'Ammar.Adel@locean-ipsl.upmc.fr', 'Ammar.Adel@lodyc.jussieu.fr', 'Ammar@lodyc.jussieu.fr', 'Ammar@locean-ipsl.upmc.fr', 'Adel.Ammar@locean-ipsl.upmc.fr', 'Adel.Ammar@lodyc.jussieu.fr']",  
    103       "postalAddress: ['4 place Jussieu']",  
    104       "description: ['S. Thiria']",  
    105       "loginShell: ['/bin/tcsh']",  
    106       "gidNumber: ['1664']",  
    107       "employeeNumber: ['44']",  
    108       "mailForwardingAddress: ['Adel.Ammar@locean-ipsl.upmc.fr']",  
    109       "loceanAnnuaire: ['44']",  
    110       "displayName: ['Adel.Ammar']",  
    111       "roomNumber: ['Bureau XXX, Tour 45']",  
    112       "loceanPhotoUrl: ['http://www.locean-ipsl.upmc.fr/photo.jpg']",  
    113       "carLicense: ['Thiria']",  
    114       "mailHost: ['locean-ipsl.upmc.fr']",  
    115       "gecos: ['Adel Ammar (S. Thiria)']",  
    116       "sn: ['Ammar']",  
    117       "homeDirectory: ['/usr/home/aalod']",  
    118       "givenName: ['Adel']",  
    119       "uid: ['abelod']", "objectClass: ['posixAccount', 'person', 'organizationalPerson', 'inetOrgPerson', 'loceanPersonne', 'top', 'inetLocalMailRecipient']", "uidNumber: ['36337']", "street: ['LOCEAN']",  
    120      
     94    voici tous les champs: 
     95 
     96    .. parsed-literal:: 
     97 
     98       ["cn: ['Adel Ammar (S. Thiria)']", 
     99       "objectClass: ['inetLocalMailRecipient', 'person', 'organizationalPerson', 'inetOrgPerson', 'loceanPersonne', 'posixAccount', 'top']", 
     100       "uidNumber: ['36310']", 
     101       "street: ['LOCEAN']", 
     102       "uid: ['aalod']", 
     103       "title: ['http://www.locean-ipsl.upmc.fr/photo.jpg']", 
     104       "mailLocalAddress: ['aalod@locean-ipsl.upmc.fr']", 
     105       "postalCode: ['75252 PARIS Cedex 05']", 
     106       "mail: ['aalod@locean-ipsl.upmc.fr', 'aalod@lodyc.jussieu.fr', 'Ammar.Adel@locean-ipsl.upmc.fr', 'Ammar.Adel@lodyc.jussieu.fr', 'Ammar@lodyc.jussieu.fr', 'Ammar@locean-ipsl.upmc.fr', 'Adel.Ammar@locean-ipsl.upmc.fr', 'Adel.Ammar@lodyc.jussieu.fr']", 
     107        "postalAddress: ['4 place Jussieu']", 
     108        "description: ['S. Thiria']", 
     109        "loginShell: ['/bin/tcsh']", 
     110        "gidNumber: ['1664']", 
     111        "employeeNumber: ['44']", 
     112        "mailForwardingAddress: ['Adel.Ammar@locean-ipsl.upmc.fr']", 
     113        "loceanAnnuaire: ['44']", 
     114        "displayName: ['Adel.Ammar']", 
     115        "roomNumber: ['Bureau XXX, Tour 45']", 
     116        "loceanPhotoUrl: ['http://www.locean-ipsl.upmc.fr/photo.jpg']", 
     117        "carLicense: ['Thiria']", 
     118        "mailHost: ['locean-ipsl.upmc.fr']", 
     119        "gecos: ['Adel Ammar (S. Thiria)']", 
     120        "sn: ['Ammar']", 
     121        "homeDirectory: ['/usr/home/aalod']", 
     122        "givenName: ['Adel']", 
     123        "uid: ['abelod']", "objectClass: ['posixAccount', 'person', 'organizationalPerson', 'inetOrgPerson', 'loceanPersonne', 'top', 'inetLocalMailRecipient']", "uidNumber: ['36337']", "street: ['LOCEAN']", 
     124 
    121125- fplod 20110617T080312Z cratos.locean-ipsl.upmc.fr (Linux) 
    122126 
     
    125129- fplod 20110616T144623Z cratos.locean-ipsl.upmc.fr (Linux) 
    126130 
    127   * creation  
     131  * creation 
    128132    cf. http://www.ibm.com/developerworks/aix/library/au-ldap_crud/ 
    129133    cf. http://www.packtpub.com/article/python-ldap-applications-ldap-opearations 
     
    160164def readldap(ildap, baseDN, searchScope, searchFilter, is_verbose): 
    161165    """ 
    162     read LPAP  
    163  
    164     return people dictionnary sn: uid: givenName:  mailForwardingAddress: uidNumber 
     166    read LPAP 
     167 
     168    return people dictionary sn: uid: givenName:  mailForwardingAddress: uidNumber 
    165169    """ 
    166170 
    167171    retrieveAttributes = ['uid', 'sn', 'givenName', 'mailForwardingAddress', 'uidNumber'] 
    168172    keys_for_all = [] 
    169     values_for_all = []  
     173    values_for_all = [] 
    170174    ldap_result_id = ildap.search_s(baseDN, searchScope, searchFilter, retrieveAttributes) 
    171175    for ldap_result_one in ldap_result_id: 
     
    180184 
    181185            if is_verbose == True: 
    182                 # pour voir la derniere personne ajoutée 
     186                # pour voir la derniere personne ajoutée 
    183187                print values_for_all[-1] 
    184188 
    185     # populate dictonnary 
     189    # populate dictonary 
    186190    people = dict(itertools.izip(keys_for_all, values_for_all)) 
    187191 
     
    213217    #++if ldap.__version__ == '2.3.13' 
    214218    #++l = ldap.initialize(ldap_host) 
    215     #++else  
     219    #++else 
    216220    l = ldap.open(ldap_host) 
    217221 
    218222    l.protocol_version = ldap.VERSION3 
    219      
     223 
    220224    baseDN = 'ou=utilisateurs ,dc=locean-ipsl,dc=upmc,dc=fr' 
    221225    searchScope = ldap.SCOPE_SUBTREE 
Note: See TracChangeset for help on using the changeset viewer.