
    >/i                         S r SSKrSSKrSSKrSSKrSSKrSSKrSSKJr  Sr	\R                  " \5      rSrS rS rS rS	 r\S
:X  a  \R$                  " \" 5       5        gg)zHBandit is a tool designed to find common security issues in Python code.    N)extension_loaderbandit_conf_generatora.  
### Bandit config file generated from:
# '{cli}'

### This config may optionally select a subset of tests to run or skip by
### filling out the 'tests' and 'skips' lists given below. If no tests are
### specified for inclusion then it is assumed all tests are desired. The skips
### set will remove specific tests from the include set. This can be controlled
### using the -t/-s CLI options. Note that the same test ID should not appear
### in both 'tests' and 'skips', this would be nonsensical and is detected by
### Bandit at runtime.

# Available tests:
{test_list}

# (optional) list included test IDs here, eg '[B101, B406]':
{test}

# (optional) list skipped test IDs here, eg '[B101, B406]':
{skip}

### (optional) plugin settings - some test plugins require configuration data
### that may be given here, per-plugin. All bandit test plugins have a built in
### set of sensible defaults and these will be used if no configuration is
### provided. It is not necessary to provide settings for every (or any) plugin
### if the defaults are acceptable.

{settings}
c                  P   / [         l        [        R                  n Sn[        R                  " S5        [         R                  U 5        [        R                  " [        R                  5      nUR                  [        R                  " U5      5        [         R                  U5        g)zInit logger.z[%(levelname)5s]: %(message)sTN)LOGhandlersloggingINFOcaptureWarningssetLevelStreamHandlersysstdoutsetFormatter	Formatter
addHandler)	log_levellog_format_stringhandlers      U/home/james-whalen/.local/lib/python3.13/site-packages/bandit/cli/config_generator.pyinit_loggerr   2   sl    CLI7D!LL##CJJ/G**+<=>NN7    c            
         Sn [         R                  " U [         R                  S9n[        R                  S:  a  SUl        SUl        UR                  SSSS	S
9  UR                  SSSSSS
9  UR                  SSSSS[        SS9  UR                  SSSSS[        SS9  UR                  5       nUR                  (       d2  UR                  (       d!  UR                  5         UR                  S5        U$ )zParse arguments.a  Bandit Config Generator

    This tool is used to generate an optional profile.  The profile may be used
    to include or skip tests and override values for plugins.

    When used to store an output profile, this tool will output a template that
    includes all plugins and their default settings.  Any settings which aren't
    being overridden can be safely removed from the profile and default values
    will be used.  Bandit will prefer settings from the profile over the built
    in values.)descriptionformatter_class)      TFz--show-defaultsshow_defaults
store_truezLshow the default settings values for each plugin but do not output a profile)destactionhelpz-oz--outoutput_filestorezoutput file to save profilez-tz--teststestsNzlist of test names to run)r   r    defaulttyper!   z-sz--skipskipszlist of test names to skip   )argparseArgumentParserRawTextHelpFormatterr   version_infosuggest_on_errorcoloradd_argumentstr
parse_argsr"   r   
print_helpexit)help_descriptionparserargss      r   r1   r1   >   s   	 $$$ 55F 7""&
-	   *   (   )   DD$6$6AKr   c                  h   0 n [         R                  R                   H~  nUR                  nUR                  n[        US5      (       d  M.  [        R                  " UR                  5      n[        US5      (       d  Ma  UR                  UR                  5      X'   M     [        R                  " U SS9$ )zGet configuration settings._takes_config
gen_configF)default_flow_style)r   MANAGERpluginsnamepluginhasattr	importlibimport_module
__module__r9   r8   yaml	safe_dump)configr>   fn_namefunction	fn_modules        r   get_config_settingsrI   |   s    F"**22++== 8_--!//0C0CDI y,//"+"6"6x7M7M"N 3 >>&U;;r   c                  :   [        5         [        5       n [        5       nU R                  (       a  [	        U5        U R
                  (       Ga  [        R                  R                  [        R                  R                  U R
                  5      5      (       a6  [        R                  SU R
                  5        [        R                  " S5         [        U R
                  S5       nU R                  (       a  U R                  R!                  S5      O/ nU R"                  (       a  U R"                  R!                  S5      O/ nU H5  n[$        R&                  R)                  U5      (       a  M)  [+        SU 35      e   U H5  n[$        R&                  R)                  U5      (       a  M)  [+        SU 35      e   Sn[$        R&                  R,                   Vs/ s H3  nUR/                  UR0                  R2                  UR4                  5      PM5     n	n[$        R&                  R6                  R9                  5        V
Vs/ s H  u  pUR/                  XS   5      PM     nn
nU	R;                  U5        U	R=                  5         [>        R/                  S	RA                  [        RB                  5      US
RA                  U	5      U(       a  S[E        U5      -   OSU(       a  S[E        U5      -   OSS9nURG                  U5        SSS5        [        RI                  SU R
                  5        ggs  snf s  snn
f ! , (       d  f       N;= f! [J         a#    [        R                  SU R
                  5         g[L         a   n[        R                  SU5         SnAgSnAff = f)z-Config generator to write configuration file.zFile %s already exists, exiting   w,zunknown ID in skips: zunknown ID in tests: z# {0} : {1}r=    
zskips: zskips:ztests: ztests:)clisettings	test_listskiptestNzSuccessfully wrote profile: %szUnable to open %s for writingz	Error: %sr   )'r   r1   rI   r   printr"   ospathexistsabspathr   errorr   r3   openr'   splitr$   r   r;   check_idRuntimeErrorr<   formatr>   _test_idr=   blacklist_by_iditemsextendsorttemplatejoinargvr0   writeinfoOSError	Exception)r6   yaml_settingsfr'   r$   rS   rT   tpltrR   kvotherscontentses                  r   mainru      s   M<D')Mm77>>"''//$*:*:;<<II79I9IJHHQK,	Id&&,15

((-15

((-!D+33<<TBB*-B4&+IJJ " "D+33<<TBB*-B4&+IJJ " $ .55=== JJqxx00!&&9=   )00@@FFH I  JJqF),H     ( #??**"ii	238SZ/h38SZ/h +  !E -V HH5t7G7GHA
% -,H  	III5t7G7GH   	&IIk1%%
 	&sb   M %BL4-7L4(.L4:L)-L4= L.B"L4?M )L44
M>M *N1	N:NN__main__)__doc__r)   r@   r   rV   r   rC   bandit.corer   	PROG_NAME	getLogger__name__r   re   r   r1   rI   ru   r3    r   r   <module>r}      so    O    	 
  (#	!>	;|<$=@ zHHTV r   