MCPcopy Index your code
hub / github.com/gitless-vcs/gitless / validate

Function validate

gitless/cli/helpers.py:214–232  ·  view source on GitHub ↗

fps: files check_fn: lambda(file) -> boolean msg: string-format of pre-defined constant string.

(fps, check_fn, msg)

Source from the content-addressed store, hash-verified

212 err = []
213
214 def validate(fps, check_fn, msg):
215 ''' fps: files
216 check_fn: lambda(file) -> boolean
217 msg: string-format of pre-defined constant string.
218 '''
219 ret = True
220 if not fps:
221 return ret
222 for fp in fps:
223 try:
224 f = curr_b.status_file(fp)
225 except KeyError:
226 err.append('File {0} doesn\'t exist'.format(fp))
227 ret = False # set error flag, but keep assessing other files
228 else: # executed after "try", exception will be ignored here
229 if not check_fn(f):
230 err.append(msg(fp)) # dynamic string formatting
231 ret = False
232 return ret
233
234 only_valid = validate(
235 only, lambda f: f.type == core.GL_STATUS_UNTRACKED or (

Callers 1

_oei_validateFunction · 0.85

Calls 2

msgFunction · 0.85
status_fileMethod · 0.80

Tested by

no test coverage detected