Skip to content

Instantly share code, notes, and snippets.

View mastro35's full-sized avatar
👾

Davide Mastromatteo mastro35

👾
View GitHub Profile
def _full_path(self, partial, useFallBack=False):
if partial.startswith("/"):
partial = partial[1:]
# Find out the real path. If has been requesetd for a fallback path,
# use it
path = primaryPath = os.path.join(
self.fallbackPath if useFallBack else self.root, partial)
# If the pah does not exists and we haven't been asked for the fallback path
def getattr(self, path, fh=None):
full_path = self._full_path(path)
st = os.lstat(full_path)
return dict((key, getattr(st, key)) for key in ('st_atime', 'st_ctime',
'st_gid', 'st_mode', 'st_mtime', 'st_nlink', 'st_size', 'st_uid', 'st_blocks'))
def readdir(self, path, fh):
dirents = ['.', '..']
full_path = self._full_path(path)
# print("listing " + full_path)
if os.path.isdir(full_path):
dirents.extend(os.listdir(full_path))
if self.fallbackPath not in full_path:
full_path = self._full_path(path, useFallBack=True)
# print("listing_ext " + full_path)
if os.path.isdir(full_path):
@mastro35
mastro35 / devaraj.py
Created November 22, 2017 17:51
example for devaraj
import pickle
class A:
def __init__(self):
pass
class C:
def __init__(self):
print("deva")
pass
"""
Engine class of the RPN Calculator
"""
import math
class rpn_engine:
def __init__(self):
""" Constructor """
self.stack = []
"""
Engine class of the RPN Calculator
"""
import math
class rpn_engine:
def __init__(self):
""" Constructor """
self.stack = []
"""
Engine class of the RPN Calculator
"""
import math
class rpn_engine:
def __init__(self):
""" Constructor """
self.stack = []
"""
Engine class of the RPN Calculator
"""
import math
class rpn_engine:
def __init__(self):
""" Constructor """
self.stack = []
"""
Engine class of the RPN Calculator
"""
import math
from inspect import signature
class rpn_engine:
def __init__(self):
""" Constructor """
#!/usr/bin/env python
from __future__ import with_statement
import os
import sys
import errno
from fuse import FUSE, FuseOSError, Operations