text
stringlengths 0
828
|
---|
insert_query_m(self.spectra_annotation_all, columns=cn, conn=self.conn, |
table='library_spectra_annotation', db_type=db_type) |
# self.conn.close() |
if remove_data: |
self.meta_info_all = [] |
self.spectra_all = [] |
self.spectra_annotation_all = [] |
self.compound_info_all = [] |
self._get_current_ids(source=False)" |
169,"def line(line_def, **kwargs): |
""""""Highlights a character in the line"""""" |
def replace(s): |
return ""(%s)"" % ansi.aformat(s.group()[1:], attrs=[""bold"", ]) |
return ansi.aformat( |
re.sub('@.?', replace, line_def), |
**kwargs)" |
170,"def try_and_error(*funcs): |
""""""Apply multiple validation functions |
Parameters |
---------- |
``*funcs`` |
Validation functions to test |
Returns |
------- |
function"""""" |
def validate(value): |
exc = None |
for func in funcs: |
try: |
return func(value) |
except (ValueError, TypeError) as e: |
exc = e |
raise exc |
return validate" |
171,"def validate_text(value): |
""""""Validate a text formatoption |
Parameters |
---------- |
value: see :attr:`psyplot.plotter.labelplotter.text` |
Raises |
------ |
ValueError"""""" |
possible_transform = ['axes', 'fig', 'data'] |
validate_transform = ValidateInStrings('transform', possible_transform, |
True) |
tests = [validate_float, validate_float, validate_str, |
validate_transform, dict] |
if isinstance(value, six.string_types): |
xpos, ypos = rcParams['texts.default_position'] |
return [(xpos, ypos, value, 'axes', {'ha': 'right'})] |
elif isinstance(value, tuple): |
value = [value] |
try: |
value = list(value)[:] |
except TypeError: |
raise ValueError(""Value must be string or list of tuples!"") |
for i, val in enumerate(value): |
try: |
val = tuple(val) |
except TypeError: |
raise ValueError( |
""Text must be an iterable of the form "" |
""(x, y, s[, trans, params])!"") |
if len(val) < 3: |
raise ValueError( |
""Text tuple must at least be like [x, y, s], with floats x, "" |
""y and string s!"") |
elif len(val) == 3 or isinstance(val[3], dict): |
val = list(val) |
val.insert(3, 'data') |
if len(val) == 4: |
val += [{}] |
val = tuple(val) |
if len(val) > 5: |
raise ValueError( |
""Text tuple must not be longer then length 5. It can be "" |
""like (x, y, s[, trans, params])!"") |
value[i] = (validate(x) for validate, x in zip(tests, val)) |
return value" |
172,"def validate_none(b): |
""""""Validate that None is given |
Parameters |
---------- |
b: {None, 'none'} |
None or string (the case is ignored) |
Returns |
------- |
None |
Raises |
------ |
ValueError"""""" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.