Code Monkey home page Code Monkey logo

repo_with_readme's Introduction

repo_with_readme

dummy repo

#!/usr/bin/env python
from __future__ import print_function
from irods.models import DataObject
from irods.models import DataObjectMeta
from irods.models import Resource
from irods.models import ResourceMeta
from datetime import datetime, timedelta
import time

import sys,os
sys.path.insert(0,os.environ['HOME'])
import irodsess
ses = irodsess.main()

now = datetime.utcnow()

age = int(sys.argv[1]) if sys.argv[1:] else 0

cutoff = now - timedelta(seconds = abs(age))


def convert_int():
    try:    i = int( sys.argv[1] )
    except: pass
    return locals().get('i')

def print_cheatsheet():

    print("{r:-^20} {c:-^20} {m:-^20} {n:-^20} {v:-^20}".format(r='resc name',c='create age',m='modify age', n='name', v='value'))
    for x in ses.query(ResourceMeta,Resource):
        resc_name = x[Resource.name]
        t_create =  x[ResourceMeta.create_time]
        t_modify =  x[ResourceMeta.modify_time]
        name =   x[ResourceMeta.name]
        value =  x[ResourceMeta.value]
        c_age =  now - t_create
        m_age =  now - t_modify
        print("{r:>20} {c:>20} {m:>20} {n:>20} {v:>20}".format(
            r = resc_name,
            c = c_age.total_seconds(), 
            m = m_age.total_seconds(), 
            n = name, 
            v = value))


arg = convert_int()

if arg is None:
    print_cheatsheet()
else:
    for x in ses.query(ResourceMeta,Resource).filter (  ResourceMeta.modify_time >= cutoff,
                                                        ResourceMeta.modify_time <  now,
                                                        Resource.name != "" ):
        print( x[Resource.name], "-", x[ResourceMeta.name] )

repo_with_readme's People

Contributors

d-w-moore avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.