id
int64
1
6.07M
name
stringlengths
1
295
code
stringlengths
12
426k
language
stringclasses
1 value
source_file
stringlengths
5
202
start_line
int64
1
158k
end_line
int64
1
158k
repo
dict
6,501
echo_class
def echo_class(klass, write=sys.stdout.write): """ Echo calls to class methods and static functions """ for _, method in inspect.getmembers(klass, inspect.ismethod): #In python 3 only class methods are returned here, but in python2 instance methods are too. echo_instancemethod(klass, method,...
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/echo.py
130
142
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,502
echo_module
def echo_module(mod, write=sys.stdout.write): """ Echo calls to functions and methods in a module. """ for fname, fn in inspect.getmembers(mod, inspect.isfunction): setattr(mod, fname, echo(fn, write)) for _, klass in inspect.getmembers(mod, inspect.isclass): echo_class(klass, write)
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/echo.py
144
150
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,503
__init__
def __init__(self,): self.__cond = Condition(Lock()) self.__flag = False
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/event_backport.py
10
12
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,504
isSet
def isSet(self): return self.__flag
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/event_backport.py
14
15
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,505
set
def set(self): self.__cond.acquire() try: self.__flag = True self.__cond.notify_all() finally: self.__cond.release()
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/event_backport.py
19
25
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,506
clear
def clear(self): self.__cond.acquire() try: self.__flag = False finally: self.__cond.release()
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/event_backport.py
27
32
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,507
wait
def wait(self, timeout=None): self.__cond.acquire() try: if not self.__flag: self.__cond.wait(timeout) return self.__flag finally: self.__cond.release()
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/event_backport.py
34
41
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,508
synchronized
def synchronized(lock=None): """Decorator that synchronizes a method or a function with a mutex lock. Example usage: @synchronized() def operation(self, a, b): ... """ if lock is None: lock = threading.Lock() def wrapper(function): def new_function(*arg...
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/decorators.py
23
45
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,509
wrapper
def wrapper(function): def new_function(*args, **kwargs): lock.acquire() try: return function(*args, **kwargs) finally: lock.release() return new_function
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/decorators.py
35
43
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,510
new_function
def new_function(*args, **kwargs): lock.acquire() try: return function(*args, **kwargs) finally: lock.release()
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/decorators.py
36
41
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,511
propertyx
def propertyx(function): """Decorator to easily create properties in classes. Example: class Angle(object): def __init__(self, rad): self._rad = rad @property def rad(): def fget(self): return self._rad ...
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/decorators.py
48
81
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,512
probe_func
def probe_func(frame, event, arg): if event == 'return': locals = frame.f_locals func_locals.update(dict((k, locals.get(k)) for k in keys)) sys.settrace(None) return probe_func
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/decorators.py
72
77
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,513
accepts
def accepts(*types): """Decorator to ensure that the decorated function accepts the given types as arguments. Example: @accepts(int, (int,float)) @returns((int,float)) def func(arg1, arg2): return arg1 * arg2 """ def check_accepts(f): assert len(types) == f....
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/decorators.py
84
106
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,514
check_accepts
def check_accepts(f): assert len(types) == f.__code__.co_argcount def new_f(*args, **kwds): for (a, t) in zip(args, types): assert isinstance(a, t),\ "arg %r does not match %s" % (a, t) return f(*args, **kwds) new_f.__name__ = f.__nam...
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/decorators.py
94
104
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,515
new_f
def new_f(*args, **kwds): for (a, t) in zip(args, types): assert isinstance(a, t),\ "arg %r does not match %s" % (a, t) return f(*args, **kwds)
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/decorators.py
97
101
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,516
returns
def returns(rtype): """Decorator to ensure that the decorated function returns the given type as argument. Example: @accepts(int, (int,float)) @returns((int,float)) def func(arg1, arg2): return arg1 * arg2 """ def check_returns(f): def new_f(*args, **kwd...
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/decorators.py
109
130
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,517
check_returns
def check_returns(f): def new_f(*args, **kwds): result = f(*args, **kwds) assert isinstance(result, rtype),\ "return value %r does not match %s" % (result, rtype) return result new_f.__name__ = f.__name__ return new_f
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/decorators.py
120
128
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,518
new_f
def new_f(*args, **kwds): result = f(*args, **kwds) assert isinstance(result, rtype),\ "return value %r does not match %s" % (result, rtype) return result
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/decorators.py
121
125
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,519
singleton
def singleton(cls): """Decorator to ensures a class follows the singleton pattern. Example: @singleton class MyClass: ... """ instances = {} def getinstance(): if cls not in instances: instances[cls] = cls() return instances[cls] return ...
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/decorators.py
133
148
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,520
getinstance
def getinstance(): if cls not in instances: instances[cls] = cls() return instances[cls]
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/decorators.py
143
146
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,521
attrs
def attrs(**kwds): """Decorator to add attributes to a function. Example: @attrs(versionadded="2.2", author="Guido van Rossum") def mymethod(f): ... """ def decorate(f): for k in kwds: setattr(f, k, kwds[k]) return f return d...
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/decorators.py
151
167
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,522
decorate
def decorate(f): for k in kwds: setattr(f, k, kwds[k]) return f
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/decorators.py
162
165
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,523
deprecated
def deprecated(func): """This is a decorator which can be used to mark functions as deprecated. It will result in a warning being emitted when the function is used. ## Usage examples ## @deprecated def my_func(): pass @other_decorators_must_be_upper @deprecated def my_func(...
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/decorators.py
170
198
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,524
new_func
def new_func(*args, **kwargs): warnings.warn_explicit( "Call to deprecated function %(funcname)s." % { 'funcname': func.__name__, }, category=DeprecationWarning, filename=func.__code__.co_filename, lineno=func.__code__.co_firstlineno + 1 ...
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/decorators.py
187
196
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,525
__init__
def __init__(self, event_queue, watch, timeout=DEFAULT_EMITTER_TIMEOUT): EventEmitter.__init__(self, event_queue, watch, timeout) self._lock = threading.Lock() self.snapshot = DirectorySnapshot(watch.path, watch.is_recursive)
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/fsevents.py
70
73
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,526
on_thread_stop
def on_thread_stop(self): _fsevents.remove_watch(self.watch) _fsevents.stop(self)
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/fsevents.py
75
77
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,527
queue_events
def queue_events(self, timeout): with self._lock: if not self.watch.is_recursive\ and self.watch.path not in self.pathnames: return new_snapshot = DirectorySnapshot(self.watch.path, self.watch.is_recursive) ...
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/fsevents.py
79
107
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,528
run
def run(self): try: def callback(pathnames, flags, emitter=self): emitter.queue_events(emitter.timeout) # for pathname, flag in zip(pathnames, flags): # if emitter.watch.is_recursive: # and pathname != emitter.watch.path: # new_sub_snapshot = D...
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/fsevents.py
109
141
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,529
callback
def callback(pathnames, flags, emitter=self): emitter.queue_events(emitter.timeout)
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/fsevents.py
111
112
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,530
__init__
def __init__(self, timeout=DEFAULT_OBSERVER_TIMEOUT): BaseObserver.__init__(self, emitter_class=FSEventsEmitter, timeout=timeout)
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/fsevents.py
146
148
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,531
schedule
def schedule(self, event_handler, path, recursive=False): # Python 2/3 compat try: str_class = unicode except NameError: str_class = str # Fix for issue #26: Trace/BPT error when given a unicode path # string. https://github.com/gorakhargosh/watchdog/issu...
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/fsevents.py
150
172
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,532
__init__
def __init__(self, event_queue, watch, timeout=DEFAULT_EMITTER_TIMEOUT): EventEmitter.__init__(self, event_queue, watch, timeout) self._lock = threading.Lock() self._inotify = None
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify.py
114
117
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,533
on_thread_start
def on_thread_start(self): path = unicode_paths.encode(self.watch.path) self._inotify = InotifyBuffer(path, self.watch.is_recursive)
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify.py
119
121
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,534
on_thread_stop
def on_thread_stop(self): if self._inotify: self._inotify.close()
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify.py
123
125
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,535
queue_events
def queue_events(self, timeout, full_events=False): #If "full_events" is true, then the method will report unmatched move events as seperate events #This behavior is by default only called by a InotifyFullEmitter with self._lock: event = self._inotify.read_event() if even...
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify.py
127
176
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,536
_decode_path
def _decode_path(self, path): """ Decode path only if unicode string was passed to this emitter. """ if isinstance(self.watch.path, bytes): return path return unicode_paths.decode(path)
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify.py
178
182
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,537
__init__
def __init__(self, event_queue, watch, timeout=DEFAULT_EMITTER_TIMEOUT): InotifyEmitter.__init__(self, event_queue, watch, timeout)
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify.py
201
202
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,538
queue_events
def queue_events(self, timeout, events=True): InotifyEmitter.queue_events(self, timeout, full_events=events)
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify.py
204
205
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,539
__init__
def __init__(self, timeout=DEFAULT_OBSERVER_TIMEOUT, generate_full_events=False): if (generate_full_events): BaseObserver.__init__(self, emitter_class=InotifyFullEmitter, timeout=timeout) else: BaseObserver.__init__(self, emitter_class=InotifyEmitter, ...
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify.py
213
218
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,540
__init__
def __init__(self, path, recursive): self._path = path self._is_recursive = recursive
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
48
50
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,541
path
def path(self): """The path that this watch monitors.""" return self._path
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
53
55
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,542
is_recursive
def is_recursive(self): """Determines whether subdirectories are watched for the path.""" return self._is_recursive
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
58
60
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,543
key
def key(self): return self.path, self.is_recursive
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
63
64
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,544
__eq__
def __eq__(self, watch): return self.key == watch.key
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
66
67
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,545
__ne__
def __ne__(self, watch): return self.key != watch.key
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
69
70
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,546
__hash__
def __hash__(self): return hash(self.key)
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
72
73
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,547
__repr__
def __repr__(self): return "<ObservedWatch: path=%s, is_recursive=%s>" % ( self.path, self.is_recursive)
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
75
77
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,548
__init__
def __init__(self, event_queue, watch, timeout=DEFAULT_EMITTER_TIMEOUT): BaseThread.__init__(self) self._event_queue = event_queue self._watch = watch self._timeout = timeout
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
100
104
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,549
timeout
def timeout(self): """ Blocking timeout for reading events. """ return self._timeout
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
107
111
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,550
watch
def watch(self): """ The watch associated with this emitter. """ return self._watch
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
114
118
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,551
queue_event
def queue_event(self, event): """ Queues a single event. :param event: Event to be queued. :type event: An instance of :class:`watchdog.events.FileSystemEvent` or a subclass. """ self._event_queue.put((event, self.watch))
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
120
130
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,552
queue_events
def queue_events(self, timeout): """Override this method to populate the event queue with events per interval period. :param timeout: Timeout (in seconds) between successive attempts at reading events. :type timeout: ``float`` """
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
132
141
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,553
run
def run(self): try: while self.should_keep_running(): self.queue_events(self.timeout) finally: pass
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
143
148
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,554
__init__
def __init__(self, timeout=DEFAULT_OBSERVER_TIMEOUT): BaseThread.__init__(self) self._event_queue = EventQueue() self._timeout = timeout
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
162
165
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,555
timeout
def timeout(self): """Event queue block timeout.""" return self._timeout
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
168
170
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,556
event_queue
def event_queue(self): """The event queue which is populated with file system events by emitters and from which events are dispatched by a dispatcher thread.""" return self._event_queue
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
173
177
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,557
dispatch_events
def dispatch_events(self, event_queue, timeout): """Override this method to consume events from an event queue, blocking on the queue for the specified timeout before raising :class:`queue.Empty`. :param event_queue: Event queue to populate with one set of events. :type even...
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
179
194
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,558
run
def run(self): while self.should_keep_running(): try: self.dispatch_events(self.event_queue, self.timeout) except queue.Empty: continue
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
196
201
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,559
__init__
def __init__(self, emitter_class, timeout=DEFAULT_OBSERVER_TIMEOUT): EventDispatcher.__init__(self, timeout) self._emitter_class = emitter_class self._lock = threading.RLock() self._watches = set() self._handlers = dict() self._emitters = set() self._emitter_for_w...
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
207
214
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,560
_add_emitter
def _add_emitter(self, emitter): self._emitter_for_watch[emitter.watch] = emitter self._emitters.add(emitter)
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
216
218
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,561
_remove_emitter
def _remove_emitter(self, emitter): del self._emitter_for_watch[emitter.watch] self._emitters.remove(emitter) emitter.stop() try: emitter.join() except RuntimeError: pass
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
220
227
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,562
_clear_emitters
def _clear_emitters(self): for emitter in self._emitters: emitter.stop() for emitter in self._emitters: try: emitter.join() except RuntimeError: pass self._emitters.clear() self._emitter_for_watch.clear()
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
229
238
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,563
_add_handler_for_watch
def _add_handler_for_watch(self, event_handler, watch): if watch not in self._handlers: self._handlers[watch] = set() self._handlers[watch].add(event_handler)
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
240
243
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,564
_remove_handlers_for_watch
def _remove_handlers_for_watch(self, watch): del self._handlers[watch]
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
245
246
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,565
emitters
def emitters(self): """Returns event emitter created by this observer.""" return self._emitters
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
249
251
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,566
start
def start(self): for emitter in self._emitters: emitter.start() super(BaseObserver, self).start()
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
253
256
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,567
schedule
def schedule(self, event_handler, path, recursive=False): """ Schedules watching a path and calls appropriate methods specified in the given event handler in response to file system events. :param event_handler: An event handler instance that has appropriate event handling ...
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
258
295
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,568
add_handler_for_watch
def add_handler_for_watch(self, event_handler, watch): """Adds a handler for the given watch. :param event_handler: An event handler instance that has appropriate event handling methods which will be called by the observer in response to file system events. :...
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
297
313
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,569
remove_handler_for_watch
def remove_handler_for_watch(self, event_handler, watch): """Removes a handler for the given watch. :param event_handler: An event handler instance that has appropriate event handling methods which will be called by the observer in response to file system events. ...
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
315
331
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,570
unschedule
def unschedule(self, watch): """Unschedules a watch. :param watch: The watch to unschedule. :type watch: An instance of :class:`ObservedWatch` or a subclass of :class:`ObservedWatch` """ with self._lock: emitter = self._emitter_for...
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
333
346
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,571
unschedule_all
def unschedule_all(self): """Unschedules all watches and detaches all associated event handlers.""" with self._lock: self._handlers.clear() self._clear_emitters() self._watches.clear()
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
348
354
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,572
on_thread_stop
def on_thread_stop(self): self.unschedule_all()
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
356
357
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,573
dispatch_events
def dispatch_events(self, event_queue, timeout): event, watch = event_queue.get(block=True, timeout=timeout) with self._lock: # To allow unschedule/stop and safe removal of event handlers # within event handlers itself, check if the handler is still # registered afte...
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
359
369
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,574
__init__
def __init__(self, path, recursive=False): BaseThread.__init__(self) self._queue = DelayedQueue(self.delay) self._inotify = Inotify(path, recursive) self.start()
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify_buffer.py
32
36
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,575
read_event
def read_event(self): """Returns a single event or a tuple of from/to events in case of a paired move event. If this buffer has been closed, immediately return None. """ return self._queue.get()
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify_buffer.py
38
43
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,576
on_thread_stop
def on_thread_stop(self): self._inotify.close() self._queue.close()
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify_buffer.py
45
47
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,577
close
def close(self): self.stop() self.join()
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify_buffer.py
49
51
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,578
run
def run(self): """Read event from `inotify` and add them to `queue`. When reading a IN_MOVE_TO event, remove the previous added matching IN_MOVE_FROM event and add them back to the queue as a tuple. """ deleted_self = False while self.should_keep_running() and not deleted...
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify_buffer.py
53
81
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,579
matching_from_event
def matching_from_event(event): return (not isinstance(event, tuple) and event.is_moved_from and event.cookie == inotify_event.cookie)
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify_buffer.py
65
67
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,580
_errcheck_bool
def _errcheck_bool(value, func, args): if not value: raise ctypes.WinError return args
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/winapi.py
105
108
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,581
_errcheck_handle
def _errcheck_handle(value, func, args): if not value: raise ctypes.WinError if value == INVALID_HANDLE_VALUE: raise ctypes.WinError return args
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/winapi.py
111
116
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,582
_errcheck_dword
def _errcheck_dword(value, func, args): if value == 0xFFFFFFFF: raise ctypes.WinError return args
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/winapi.py
119
122
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,583
_parse_event_buffer
def _parse_event_buffer(readBuffer, nBytes): results = [] while nBytes > 0: fni = ctypes.cast(readBuffer, LPFNI)[0] ptr = ctypes.addressof(fni) + FILE_NOTIFY_INFORMATION.FileName.offset #filename = ctypes.wstring_at(ptr, fni.FileNameLength) filename = ctypes.string_at(ptr, fni.Fi...
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/winapi.py
258
271
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,584
get_directory_handle
def get_directory_handle(path): """Returns a Windows handle to the specified directory path.""" return CreateFileW(path, FILE_LIST_DIRECTORY, WATCHDOG_FILE_SHARE_FLAGS, None, OPEN_EXISTING, WATCHDOG_FILE_FLAGS, None)
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/winapi.py
274
277
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,585
close_directory_handle
def close_directory_handle(handle): try: CancelIoEx(handle, None) # force ReadDirectoryChangesW to return CloseHandle(handle) # close directory handle except WindowsError: try: CloseHandle(handle) # close directory handle except: return
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/winapi.py
280
288
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,586
read_directory_changes
def read_directory_changes(handle, recursive): """Read changes to the directory using the specified directory handle. http://timgolden.me.uk/pywin32-docs/win32file__ReadDirectoryChangesW_meth.html """ event_buffer = ctypes.create_string_buffer(BUFFER_SIZE) nbytes = ctypes.wintypes.DWORD() try: ...
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/winapi.py
291
313
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,587
__init__
def __init__(self, action, src_path): self.action = action self.src_path = src_path
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/winapi.py
317
319
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,588
is_added
def is_added(self): return self.action == FILE_ACTION_CREATED
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/winapi.py
322
323
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,589
is_removed
def is_removed(self): return self.action == FILE_ACTION_REMOVED
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/winapi.py
326
327
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,590
is_modified
def is_modified(self): return self.action == FILE_ACTION_MODIFIED
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/winapi.py
330
331
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,591
is_renamed_old
def is_renamed_old(self): return self.action == FILE_ACTION_RENAMED_OLD_NAME
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/winapi.py
334
335
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,592
is_renamed_new
def is_renamed_new(self): return self.action == FILE_ACTION_RENAMED_NEW_NAME
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/winapi.py
338
339
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,593
__repr__
def __repr__(self): return ("<WinAPINativeEvent: action=%d, src_path=%r>" % (self.action, self.src_path))
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/winapi.py
341
342
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,594
read_events
def read_events(handle, recursive): buf, nbytes = read_directory_changes(handle, recursive) events = _parse_event_buffer(buf, nbytes) return [WinAPINativeEvent(action, path) for action, path in events]
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/winapi.py
345
348
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,595
__init__
def __init__(self, event_queue, watch, timeout=DEFAULT_EMITTER_TIMEOUT): EventEmitter.__init__(self, event_queue, watch, timeout) self._lock = threading.Lock() self._handle = None
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/read_directory_changes.py
62
65
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,596
on_thread_start
def on_thread_start(self): self._handle = get_directory_handle(self.watch.path)
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/read_directory_changes.py
67
68
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,597
on_thread_stop
def on_thread_stop(self): if self._handle: close_directory_handle(self._handle)
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/read_directory_changes.py
70
72
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,598
queue_events
def queue_events(self, timeout): winapi_events = read_events(self._handle, self.watch.is_recursive) with self._lock: last_renamed_src_path = "" for winapi_event in winapi_events: src_path = os.path.join(self.watch.path, winapi_event.src_path) ...
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/read_directory_changes.py
74
122
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,599
__init__
def __init__(self, timeout=DEFAULT_OBSERVER_TIMEOUT): BaseObserver.__init__(self, emitter_class=WindowsApiEmitter, timeout=timeout)
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/read_directory_changes.py
131
133
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
6,600
is_deleted
def is_deleted(kev): """Determines whether the given kevent represents deletion.""" return kev.fflags & select.KQ_NOTE_DELETE
python
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/kqueue.py
148
150
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }