text
stringlengths
0
828
thisData,
flags=re.M | re.S # re.S
)
yamlContent = {}
for match in matchObject:
if match.group(""value"")[0] == '""' and match.group(""value"")[-1] == '""':
v = match.group(""value"")[1:-1]
elif match.group(""value"")[0] == ""'"" and match.group(""value"")[-1] == ""'"":
v = match.group(""value"")[1:-1]
else:
v = match.group(""value"")
yamlContent[match.group(""key"")] = v
if ""table"" not in yamlContent:
self.log.warning(
'A table value is need in the yaml content to indicate which database table to add the content to: %(filepath)s' % locals())
return None
# NOTE THERE MAY BE MORE THAN ONE DATABASE TABLE
dbTablesTmp = yamlContent[""table""].split("","")
del yamlContent[""table""]
dbTables = []
dbTables[:] = [d.strip() for d in dbTablesTmp]
# UNSHORTEN URL
try:
r = requests.head(yamlContent[""url""], allow_redirects=True)
yamlContent[""url""] = r.url
except:
pass
yamlContent[""original_yaml_path""] = filepath
if ""url"" in yamlContent:
uniqueKeyList = [""url""]
else:
uniqueKeyList = []
for t in dbTables:
convert_dictionary_to_mysql_table(
dbConn=self.dbConn,
log=self.log,
dictionary=yamlContent,
dbTableName=t,
uniqueKeyList=uniqueKeyList,
dateModified=True,
returnInsertOnly=False,
replace=True
)
if deleteFile:
os.remove(filepath)
self.log.debug(
'completed the ``add_yaml_file_content_to_database`` method')
return None"
3837,"def data_type(self, data_type):
""""""Sets the data_type of this Option.
:param data_type: The data_type of this Option.
:type: str
""""""
allowed_values = [""string"", ""number"", ""date"", ""color""]
if data_type is not None and data_type not in allowed_values:
raise ValueError(
""Invalid value for `data_type` ({0}), must be one of {1}""
.format(data_type, allowed_values)
)
self._data_type = data_type"
3838,"def create_option(cls, option, **kwargs):
""""""Create Option
Create a new Option
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.create_option(option, async=True)
>>> result = thread.get()
:param async bool
:param Option option: Attributes of option to create (required)
:return: Option
If the method is called asynchronously,
returns the request thread.
""""""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
return cls._create_option_with_http_info(option, **kwargs)
else:
(data) = cls._create_option_with_http_info(option, **kwargs)
return data"
3839,"def delete_option_by_id(cls, option_id, **kwargs):
""""""Delete Option
Delete an instance of Option by its ID.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.delete_option_by_id(option_id, async=True)
>>> result = thread.get()