o
    bt
                     @   s   d Z ddlZddlZddlmZmZmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZmZmZmZ ddlmZ dd	lmZmZ G d
d dejejZdd ZdS )z
Shiny new words service maker
    N)ListOptionalSequence)plugin)strports)MultiService)checkerscredentialsportalstrcred)usage)iwordsservicec                   @   s   e Zd ZU ejgZdde dfgZe	e
ee   ed< ejdgdZi ZdZeejD ]Zejevs6J eeej< eejd dddej d	 f q-[d
d Zdd Zdd ZdS )OptionshostnameNz*Name of this server; purely an informativeoptParametersgroup)multiUse-portz2strports description of the port to bind for the  z serverc                 O   s&   t jj| g|R i | g | d< d S )Ngroups)r   r   __init__)selfakw r   3/usr/lib/python3/dist-packages/twisted/words/tap.pyr   2   s   zOptions.__init__c                 C   s   | d  |tjj dS )z"Specify a group which should existr   N)appenddecodesysstdinencoding)r   namer   r   r   	opt_group6   s   zOptions.opt_groupc                 C   s   |  t| dS )z
        Name of a passwd-style file. (This is for
        backwards-compatibility only; you should use the --auth
        command instead.)
        N)
addCheckerr   FilePasswordDB)r   filenamer   r   r   
opt_passwd:   s   zOptions.opt_passwd)__name__
__module____qualname__r	   IUsernamePasswordsupportedInterfacessocketgethostnamer   r   r   r   str__annotations__r   CompletionscompDatainterfacePluginsplgr   
getPluginsr   IProtocolPluginr!   r   r   r"   r&   r   r   r   r   r      s:   
 	

r   c           
      C   s   |  dg }t| d }t||}t }| jD ]!}|  |d }|d ur:| j| ||}t||}|	| q| d D ]}	|
|	 q?|S )NcredCheckersr   r   r   )getr   InMemoryWordsRealmr
   Portalr   r2   
getFactoryr   setServiceParentcreateGroup)
configr6   
wordsRealmwordsPortalmsvcplgNameportfactorysvcgr   r   r   makeServiceC   s    


rF   )__doc__r,   r   typingr   r   r   twistedr   twisted.applicationr   twisted.application.servicer   twisted.credr   r	   r
   r   twisted.pythonr   twisted.wordsr   r   r   AuthOptionMixinrF   r   r   r   r   <module>   s   /