python modifysetup什么意思_Python pyinotify.IN_MODIFY属性代码示例
本文整理汇总了Python中pyinotify.IN_MODIFY属性的典型用法代码示例。如果您正苦于以下问题:Python pyinotify.IN_MODIFY属性的具体用法?Python pyinotify.IN_MODIFY怎么用?Python pyinotify.IN_MODIFY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在模块pyinotify的用法示例。
在下文中一共展示了pyinotify.IN_MODIFY属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: linux_event_handler
点赞 5
# 需要导入模块: import pyinotify [as 别名]
# 或者: from pyinotify import IN_MODIFY [as 别名]
def linux_event_handler(logger, dir_watch_data, cond, tasks):
watch_manager = pyinotify.WatchManager()
mask = pyinotify.IN_CLOSE_WRITE | pyinotify.IN_MOVED_TO | pyinotify.IN_MODIFY | pyinotify.IN_CREATE
for dir_watch in dir_watch_data:
logger.info(_(u'Watching directory %s' % dir_watch['path']))
watch_manager.add_watch(path=dir_watch['path'], mask=mask, rec=False, auto_add=True, do_glob=True)
handler = LinuxEventHandler(logger=logger, dir_watch_data=dir_watch_data, cond=cond, tasks=tasks)
notifier = pyinotify.Notifier(watch_manager, handler)
notifier.loop()
# end of linux-specific ##################################################################################
开发者ID:abhishek-ram,项目名称:pyas2,代码行数:12,
示例2: __init__
点赞 5
# 需要导入模块: import pyinotify [as 别名]
# 或者: from pyinotify import IN_MODIFY [as 别名]
def __init__(self, file_created_captured, file_modified_captured):
self.WATCHDIR = u'/tmp'
self.file_created_captured = file_created_captured
self.file_modified_captured = file_modified_captured
self.wm = pyinotify.WatchManager() # Watch Manager
self.mask = pyinotify.IN_DELETE | pyinotify.IN_CREATE | pyinotify.IN_MODIFY # watched events
self.notifier = pyinotify.Notifier(self.wm, self)
self.wdd = self.wm.add_watch(self.WATCHDIR, self.mask, rec = True)
开发者ID:turingsec,项目名称:marsnake,代码行数:13,
示例3: start_config_watch
点赞 5
# 需要导入模块: import pyinotify [as 别名]
# 或者: from pyinotify import IN_MODIFY [as 别名]
def start_config_watch(self):
wm = pyinotify.WatchManager()
wm.add_watch('./config/mitmf.conf', pyinotify.IN_MODIFY)
notifier = pyinotify.Notifier(wm, self)
t = threading.Thread(name='ConfigWatcher', target=notifier.loop)
t.setDaemon(True)
t.start()
开发者ID:paranoidninja,项目名称:piSociEty,代码行数:10,
示例4: watch
点赞 5
# 需要导入模块: import pyinotify [as 别名]
# 或者: from pyinotify import IN_MODIFY [as 别名]
def watch(self, path, func=None, delay=None, ignore=None):
flag = pyinotify.IN_CREATE | pyinotify.IN_DELETE | pyinotify.IN_MODIFY
self.wm.add_watch(path, flag, rec=True, do_glob=True, auto_add=True)
Watcher.watch(self, path, func, delay, ignore)
开发者ID:tjwalch,项目名称:django-livereload-server,代码行数:6,
示例5: main
点赞 5
# 需要导入模块: import pyinotify [as 别名]
# 或者: from pyinotify import IN_MODIFY [as 别名]
def main(args_ns: argparse.Namespace) -> None:
tmpdir = tempfile.mkdtemp(prefix="rcrsv-gbstr") # directory for gobuster scan results
# watch manager stores the watches and provides operations on watches
wm = pyinotify.WatchManager()
version = get_gobuster_version()
handler = EventHandler(
target=args_ns.target,
tmpdir=tmpdir,
wordlist=args_ns.wordlist,
threads=args_ns.threads,
extensions=args_ns.extensions,
devnull=args.devnull,
user=args_ns.user,
password=args_ns.password,
proxy=args_ns.proxy,
version=version,
status=args_ns.status,
)
notifier = pyinotify.Notifier(wm, handler)
# watch for file appends (found dir/file) and files closing (scan complete)
mask = pyinotify.IN_MODIFY | pyinotify.IN_CLOSE_WRITE
wm.add_watch(tmpdir, mask)
handler.run_gobuster(args_ns.target) # kick off first scan against initial target
signal.signal(signal.SIGINT, handler.cleanup) # register signal handler to handle SIGINT
notifier.loop()
开发者ID:epi052,项目名称:recursive-gobuster,代码行数:36,
示例6: code_changed
点赞 5
# 需要导入模块: import pyinotify [as 别名]
# 或者: from pyinotify import IN_MODIFY [as 别名]
def code_changed(self):
notify_mask = (
pyinotify.IN_MODIFY |
pyinotify.IN_DELETE |
pyinotify.IN_ATTRIB |
pyinotify.IN_MOVED_FROM |
pyinotify.IN_MOVED_TO |
pyinotify.IN_CREATE |
pyinotify.IN_DELETE_SELF |
pyinotify.IN_MOVE_SELF
)
class EventHandler(pyinotify.ProcessEvent):
def process_default(self, event):
pass
watch_manager = pyinotify.WatchManager()
self.notifier = pyinotify.Notifier(watch_manager, EventHandler())
file_names = self.get_watch_file_names(only_new=True)
for file_name in file_names:
watch_manager.add_watch(file_name, notify_mask)
self.notifier.check_events(timeout=None)
if self.watching:
self.notifier.read_events()
self.notifier.process_events()
self.notifier.stop()
self.notifier = None
# If we are here, then one or more files must have changed
return True
return False
开发者ID:eventbrite,项目名称:pysoa,代码行数:37,
示例7: inotify_code_changed
点赞 4
# 需要导入模块: import pyinotify [as 别名]
# 或者: from pyinotify import IN_MODIFY [as 别名]
def inotify_code_changed():
"""
Checks for changed code using inotify. After being called
it blocks until a change event has been fired.
"""
class EventHandler(pyinotify.ProcessEvent):
modified_code = None
def process_default(self, event):
if event.path.endswith('.mo'):
EventHandler.modified_code = I18N_MODIFIED
else:
EventHandler.modified_code = FILE_MODIFIED
wm = pyinotify.WatchManager()
notifier = pyinotify.Notifier(wm, EventHandler())
def update_watch(sender=None, **kwargs):
if sender and getattr(sender, 'handles_files', False):
# No need to update watches when request serves files.
# (sender is supposed to be a django.core.handlers.BaseHandler subclass)
return
mask = (
pyinotify.IN_MODIFY |
pyinotify.IN_DELETE |
pyinotify.IN_ATTRIB |
pyinotify.IN_MOVED_FROM |
pyinotify.IN_MOVED_TO |
pyinotify.IN_CREATE |
pyinotify.IN_DELETE_SELF |
pyinotify.IN_MOVE_SELF
)
for path in gen_filenames(only_new=True):
wm.add_watch(path, mask)
# New modules may get imported when a request is processed.
request_finished.connect(update_watch)
# Block until an event happens.
update_watch()
notifier.check_events(timeout=None)
notifier.read_events()
notifier.process_events()
notifier.stop()
# If we are here the code must have changed.
return EventHandler.modified_code
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:49,
示例8: inotify_code_changed
点赞 4
# 需要导入模块: import pyinotify [as 别名]
# 或者: from pyinotify import IN_MODIFY [as 别名]
def inotify_code_changed():
"""
Check for changed code using inotify. After being called
it blocks until a change event has been fired.
"""
class EventHandler(pyinotify.ProcessEvent):
modified_code = None
def process_default(self, event):
if event.path.endswith('.mo'):
EventHandler.modified_code = I18N_MODIFIED
else:
EventHandler.modified_code = FILE_MODIFIED
wm = pyinotify.WatchManager()
notifier = pyinotify.Notifier(wm, EventHandler())
def update_watch(sender=None, **kwargs):
if sender and getattr(sender, 'handles_files', False):
# No need to update watches when request serves files.
# (sender is supposed to be a django.core.handlers.BaseHandler subclass)
return
mask = (
pyinotify.IN_MODIFY |
pyinotify.IN_DELETE |
pyinotify.IN_ATTRIB |
pyinotify.IN_MOVED_FROM |
pyinotify.IN_MOVED_TO |
pyinotify.IN_CREATE |
pyinotify.IN_DELETE_SELF |
pyinotify.IN_MOVE_SELF
)
for path in gen_filenames(only_new=True):
wm.add_watch(path, mask)
# New modules may get imported when a request is processed.
request_finished.connect(update_watch)
# Block until an event happens.
update_watch()
notifier.check_events(timeout=None)
notifier.read_events()
notifier.process_events()
notifier.stop()
# If we are here the code must have changed.
return EventHandler.modified_code
开发者ID:reBiocoder,项目名称:bioforum,代码行数:49,
示例9: _reloader_inotify
点赞 4
# 需要导入模块: import pyinotify [as 别名]
# 或者: from pyinotify import IN_MODIFY [as 别名]
def _reloader_inotify(extra_files=None, interval=None):
# Mutated by inotify loop when changes occur.
changed = [False]
# Setup inotify watches
from pyinotify import WatchManager, Notifier
# this API changed at one point, support both
try:
from pyinotify import EventsCodes as ec
ec.IN_ATTRIB
except (ImportError, AttributeError):
import pyinotify as ec
wm = WatchManager()
mask = ec.IN_DELETE_SELF | ec.IN_MOVE_SELF | ec.IN_MODIFY | ec.IN_ATTRIB
def signal_changed(event):
if changed[0]:
return
_log('info', ' * Detected change in %r, reloading' % event.path)
changed[:] = [True]
for fname in extra_files or ():
wm.add_watch(fname, mask, signal_changed)
# ... And now we wait...
notif = Notifier(wm)
try:
while not changed[0]:
# always reiterate through sys.modules, adding them
for fname in _iter_module_files():
wm.add_watch(fname, mask, signal_changed)
notif.process_events()
if notif.check_events(timeout=interval):
notif.read_events()
# TODO Set timeout to something small and check parent liveliness
finally:
notif.stop()
sys.exit(3)
# currently we always use the stat loop reloader for the simple reason
# that the inotify one does not respond to added files properly. Also
# it's quite buggy and the API is a mess.
开发者ID:googlearchive,项目名称:cloud-playground,代码行数:47,
注:本文中的pyinotify.IN_MODIFY属性示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。
python modifysetup什么意思_Python pyinotify.IN_MODIFY属性代码示例相关推荐
- python tkinter insert函数_Python tkinter.INSERT属性代码示例
本文整理汇总了Python中tkinter.INSERT属性的典型用法代码示例.如果您正苦于以下问题:Python tkinter.INSERT属性的具体用法?Python tkinter.INSER ...
- python socket tcp实战_Python socket.TCP_MAXSEG属性代码示例
# 需要导入模块: import socket [as 别名] # 或者: from socket import TCP_MAXSEG [as 别名] def handle_tcp_state_tos ...
- python中type(12.34)_Python typing.TYPE_CHECKING属性代码示例
本文整理汇总了Python中typing.TYPE_CHECKING属性的典型用法代码示例.如果您正苦于以下问题:Python typing.TYPE_CHECKING属性的具体用法?Python t ...
- python连接redis哨兵_Python redis.sentinel方法代码示例
本文整理汇总了Python中redis.sentinel方法的典型用法代码示例.如果您正苦于以下问题:Python redis.sentinel方法的具体用法?Python redis.sentine ...
- python程序异常实例_Python werkzeug.exceptions方法代码示例
本文整理汇总了Python中werkzeug.exceptions方法的典型用法代码示例.如果您正苦于以下问题:Python werkzeug.exceptions方法的具体用法?Python wer ...
- python列表get方法_Python json.get方法代码示例
本文整理汇总了Python中json.get方法的典型用法代码示例.如果您正苦于以下问题:Python json.get方法的具体用法?Python json.get怎么用?Python json.g ...
- python re 简单实例_Python re.search方法代码示例
本文整理汇总了Python中re.search方法的典型用法代码示例.如果您正苦于以下问题:Python re.search方法的具体用法?Python re.search怎么用?Python re. ...
- python中config命令_Python config.config方法代码示例
本文整理汇总了Python中config.config方法的典型用法代码示例.如果您正苦于以下问题:Python config.config方法的具体用法?Python config.config怎么 ...
- python中geometry用法_Python geometry.Point方法代码示例
本文整理汇总了Python中shapely.geometry.Point方法的典型用法代码示例.如果您正苦于以下问题:Python geometry.Point方法的具体用法?Python geome ...
最新文章
- VMware中国的“七年之痒”,真的会有大动荡吗?
- qq邮箱使用技巧学习1
- Oracle PL/SQL小练习
- 新疆尉犁县境内塔克拉玛干沙漠雪景美如画
- Extjs4.0 NumberField的使用
- php扩展调用php函数,是否可以在PHP字符串中扩展函数调用?
- pandas打印某一列_Pandas数据分析教程
- 分层贝叶斯模型——结构
- bzoj5406: Gift
- Java基础知识学习06-封装、继承
- MYSQL MVCC 实现机制
- 论文笔记_CV_AD_Visual Perception for Autonomous Driving
- vector容器——构造函数
- 十款最具发展前景机器人
- CPU卡电子现金qPBOC交易流程记录
- Louvain 算法的核心思路以及数据结构(最完善版)
- 蓝桥秘密冲刺计划(9.17)年号字串
- 使用高德开放平台显示指定的坐标点和线
- 信用飞疑似信息泄露致用户被骗近4万元,平台借款利率高达75%
- 页面置换算法之 LRU算法
热门文章
- 985高校副教授晒年薪,公积金顶普通人月薪,网友:不愧是在上海!
- DDR2 IP核地址总线解疑
- 谈五大策略可提高网站排名 排名自然靠前
- 徐老师家的螃蟹肥了~
- 千峰公开课徐老师讲解前端前沿技术总结
- 感人 机器人擂台_十大机器人电影,《环太平洋》仅排第7,第1名感动了很多人...
- 车站计算机的运行方式有,列车编队运行方式及控制研究
- 计算机中的公式应用,计算机办公主动化(常用公式和函数在电子表格中的应用).ppt...
- 【智慧城市】国内领先水平!智慧柳州时空云平台是怎样炼成的?
- 爬虫入门经典(十三) | 一文教你简单爬取腾讯招聘