text
stringlengths
0
828
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
""dataset_uri"",
help=""Dtool dataset URI""
)
parser.add_argument(
""-q"",
""--quiet"",
action=""store_true"",
help=""Only return the http URI""
)
args = parser.parse_args()
access_uri = publish(args.dataset_uri)
if args.quiet:
print(access_uri)
else:
print(""Dataset accessible at: {}"".format(access_uri))"
4995,"def execute(self):
""""""
Load the cluster and build a GC3Pie configuration snippet.
""""""
creator = make_creator(self.params.config,
storage_path=self.params.storage)
cluster_name = self.params.cluster
try:
cluster = creator.load_cluster(cluster_name)
except (ClusterNotFound, ConfigurationError) as ex:
log.error(""Listing nodes from cluster %s: %s\n"" %
(cluster_name, ex))
return
from elasticluster.gc3pie_config import create_gc3pie_config_snippet
if self.params.append:
path = os.path.expanduser(self.params.append)
try:
fd = open(path, 'a')
fd.write(create_gc3pie_config_snippet(cluster))
fd.close()
except IOError as ex:
log.error(""Unable to write configuration to file %s: %s"",
path, ex)
else:
print(create_gc3pie_config_snippet(cluster))"
4996,"def write_xml(self, outfile, encoding=""UTF-8""):
""""""Write the Media RSS Feed's XML representation to the given file.""""""
# we add the media namespace if we see any media items
if any([key for item in self.items for key in vars(item) if
key.startswith('media_') and getattr(item, key)]):
self.rss_attrs[""xmlns:media""] = ""http://search.yahoo.com/mrss/""
self.generator = _generator_name
super(MediaRSS2, self).write_xml(outfile, encoding)"
4997,"def _add_attribute(self, name, value, allowed_values=None):
""""""Add an attribute to the MediaContent element.""""""
if value and value != 'none':
if isinstance(value, (int, bool)):
value = str(value)
if allowed_values and value not in allowed_values:
raise TypeError(
""Attribute '"" + name + ""' must be one of "" + str(
allowed_values) + "" but is '"" + str(value) + ""'"")
self.element_attrs[name] = value"
4998,"def check_complicance(self):
""""""Check compliance with Media RSS Specification, Version 1.5.1.
see http://www.rssboard.org/media-rss
Raises AttributeError on error.
""""""
# check Media RSS requirement: one of the following elements is
# required: media_group | media_content | media_player | media_peerLink
# | media_location. We do the check only if any media_... element is
# set to allow non media feeds
if(any([ma for ma in vars(self)
if ma.startswith('media_') and getattr(self, ma)])
and not self.media_group
and not self.media_content
and not self.media_player
and not self.media_peerLink
and not self.media_location
):
raise AttributeError(
""Using media elements requires the specification of at least ""
""one of the following elements: 'media_group', ""
""'media_content', 'media_player', 'media_peerLink' or ""
""'media_location'."")
# check Media RSS requirement: if media:player is missing all
# media_content elements need to have url attributes.
if not self.media_player:
if self.media_content:
# check if all media_content elements have a URL set
if isinstance(self.media_content, list):
if not all([False for mc in self.media_content if
'url' not in mc.element_attrs]):
raise AttributeError(
""MediaRSSItems require a media_player attribute ""