@@ -313,12 +313,14 @@ def _get_detailed_quotas(self, parsed_args):
313313 # NOTE(slaweq): there is no detailed quotas info for some resources
314314 # and it shouldn't be displayed here
315315 if isinstance (values , dict ):
316- result .append ({
317- 'resource' : resource ,
318- 'in_use' : values .get ('in_use' ),
319- 'reserved' : values .get ('reserved' ),
320- 'limit' : values .get ('limit' ),
321- })
316+ result .append (
317+ {
318+ 'resource' : resource ,
319+ 'in_use' : values .get ('in_use' ),
320+ 'reserved' : values .get ('reserved' ),
321+ 'limit' : values .get ('limit' ),
322+ }
323+ )
322324
323325 columns = (
324326 'resource' ,
@@ -375,8 +377,9 @@ def take_action(self, parsed_args):
375377 data = compute_client .quotas .get (p )
376378 except Exception as ex :
377379 if (
378- type (ex ).__name__ == 'NotFound' or
379- ex .http_status >= 400 and ex .http_status <= 499
380+ type (ex ).__name__ == 'NotFound'
381+ or ex .http_status >= 400
382+ and ex .http_status <= 499
380383 ):
381384 # Project not found, move on to next one
382385 LOG .warning ("Project %s not found: %s" % (p , ex ))
@@ -537,7 +540,7 @@ def take_action(self, parsed_args):
537540 'Security Groups' ,
538541 'Security Group Rules' ,
539542 'Subnets' ,
540- 'Subnet Pools'
543+ 'Subnet Pools' ,
541544 )
542545
543546 return (
@@ -554,10 +557,13 @@ class SetQuota(common.NetDetectionMixin, command.Command):
554557 def _build_options_list (self ):
555558 help_fmt = _ ('New value for the %s quota' )
556559 # Compute and volume quota options are always the same
557- rets = [(k , v , help_fmt % v ) for k , v in itertools .chain (
558- COMPUTE_QUOTAS .items (),
559- VOLUME_QUOTAS .items (),
560- )]
560+ rets = [
561+ (k , v , help_fmt % v )
562+ for k , v in itertools .chain (
563+ COMPUTE_QUOTAS .items (),
564+ VOLUME_QUOTAS .items (),
565+ )
566+ ]
561567 # For docs build, we want to produce helps for both neutron and
562568 # nova-network options. They overlap, so we have to figure out which
563569 # need to be tagged as specific to one network type or the other.
@@ -574,10 +580,12 @@ def _build_options_list(self):
574580 rets .append ((k , v , _help ))
575581 elif self .is_neutron :
576582 rets .extend (
577- [(k , v , help_fmt % v ) for k , v in NETWORK_QUOTAS .items ()])
583+ [(k , v , help_fmt % v ) for k , v in NETWORK_QUOTAS .items ()]
584+ )
578585 elif self .is_nova_network :
579586 rets .extend (
580- [(k , v , help_fmt % v ) for k , v in NOVA_NETWORK_QUOTAS .items ()])
587+ [(k , v , help_fmt % v ) for k , v in NOVA_NETWORK_QUOTAS .items ()]
588+ )
581589 return rets
582590
583591 def get_parser (self , prog_name ):
@@ -656,8 +664,7 @@ def take_action(self, parsed_args):
656664 for k , v in VOLUME_QUOTAS .items ():
657665 value = getattr (parsed_args , k , None )
658666 if value is not None :
659- if (parsed_args .volume_type and
660- k in IMPACT_VOLUME_TYPE_QUOTAS ):
667+ if parsed_args .volume_type and k in IMPACT_VOLUME_TYPE_QUOTAS :
661668 k = k + '_%s' % parsed_args .volume_type
662669 volume_kwargs [k ] = value
663670
@@ -682,35 +689,34 @@ def take_action(self, parsed_args):
682689 if compute_kwargs :
683690 compute_client .quota_classes .update (
684691 parsed_args .project ,
685- ** compute_kwargs )
692+ ** compute_kwargs ,
693+ )
686694 if volume_kwargs :
687695 volume_client .quota_classes .update (
688696 parsed_args .project ,
689- ** volume_kwargs )
697+ ** volume_kwargs ,
698+ )
690699 if network_kwargs :
691- sys .stderr .write ("Network quotas are ignored since quota class"
692- " is not supported." )
700+ sys .stderr .write (
701+ "Network quotas are ignored since quota classes are not "
702+ "supported."
703+ )
693704 else :
694705 project = utils .find_resource (
695706 identity_client .projects ,
696707 parsed_args .project ,
697708 ).id
709+
698710 if compute_kwargs :
699- compute_client .quotas .update (
700- project ,
701- ** compute_kwargs )
711+ compute_client .quotas .update (project , ** compute_kwargs )
702712 if volume_kwargs :
703- volume_client .quotas .update (
704- project ,
705- ** volume_kwargs )
713+ volume_client .quotas .update (project , ** volume_kwargs )
706714 if (
707- network_kwargs and
708- self .app .client_manager .is_network_endpoint_enabled ()
715+ network_kwargs
716+ and self .app .client_manager .is_network_endpoint_enabled ()
709717 ):
710718 network_client = self .app .client_manager .network
711- network_client .update_quota (
712- project ,
713- ** network_kwargs )
719+ network_client .update_quota (project , ** network_kwargs )
714720
715721
716722class ShowQuota (command .Lister ):
@@ -877,13 +883,9 @@ def take_action(self, parsed_args):
877883 del info ['location' ]
878884
879885 if not parsed_args .usage :
880- result = [
881- {'resource' : k , 'limit' : v } for k , v in info .items ()
882- ]
886+ result = [{'resource' : k , 'limit' : v } for k , v in info .items ()]
883887 else :
884- result = [
885- {'resource' : k , ** v } for k , v in info .items ()
886- ]
888+ result = [{'resource' : k , ** v } for k , v in info .items ()]
887889
888890 columns = (
889891 'resource' ,
0 commit comments