
    !}g                         d Z dZdZdZdZddlZddlmZ dd	lm	Z	m
Z
mZmZmZmZ dd
lmZ  ej        e          Z G d de          Z G d de          Z G d de          ZdS )a  
This class holds configuration objects, which can be thought of
as settings.py but dynamic and changing for whatever parent object
holds them. For example, pass in a config object to an Article
object, Source object, or even network methods, and it just works.
	newspaperzLucas Ou-YangMITzCopyright 2014, Lucas Ou-Yang    N   Parser)	StopWordsStopWordsArabicStopWordsChineseStopWordsKoreanStopWordsHindiStopWordsJapanese)__version__c                   n    e Zd Zd Zd Zd Zd Z eeeed          Ze	d             Z
e	d             ZdS )	Configurationc                 ~   d| _         d| _        d| _        d| _        d| _        d| _        d| _        d| _        d	| _        d
| _	        d
| _
        d| _        d| _        d
| _        d| _        d
| _        d| _        t"          | _        dt&          z  | _        i | _        d| _        i | _        d| _        d| _        d| _        dS )z
        Modify any of these Article / Source properties
        TODO: Have a separate ArticleConfig and SourceConfig extend this!
        i,        i #   
   i     i N  Tgqq?Fenznewspaper/%sr   N)MIN_WORD_COUNTMIN_SENT_COUNT	MAX_TITLEMAX_TEXTMAX_KEYWORDSMAX_AUTHORSMAX_SUMMARYMAX_SUMMARY_SENTMAX_FILE_MEMOmemoize_articlesfetch_imagesimage_dimension_rationfollow_meta_refreshuse_meta_languagekeep_article_htmlhttp_success_only	_languager   stopwords_classr   browser_user_agentheadersrequest_timeoutproxiesnumber_threadsverbosethread_timeout_secondsselfs    W/var/www/py-google-trends/myenv/lib/python3.11/site-packages/newspaper/configuration.py__init__zConfiguration.__init__   s    
 " ! # !% !&.# $)  "& "' "&   )"0;">  &'###    c                     | j         S N)r(   r1   s    r3   get_languagezConfiguration.get_languageQ   s
    ~r5   c                      t          d          )Nzwtf are you doing?)	Exceptionr1   s    r3   del_languagezConfiguration.del_languageT   s    ,---r5   c                     |rt          |          dk    rt          d          d| _        || _        |                     |          | _        dS )zLanguage setting must be set in this method b/c non-occidental
        (western) languages require a separate stopwords class.
           zoYour input language must be a 2 char language code,                 for example: english-->en 
 and german-->deFN)lenr:   r%   r(   get_stopwords_classr)   )r2   languages     r3   set_languagezConfiguration.set_languageW   sb      	?3x==A-- > ? ? ? "' "#77AAr5   zlanguage propc                     | dk    rt           S | dk    rt          S | dk    rt          S | dk    s| dk    rt          S | dk    rt          S t
          S )Nkohizharfaja)r   r   r
   r	   r   r   )r@   s    r3   r?   z!Configuration.get_stopwords_classi   si    t""!!## T!1!1""$$r5   c                      t           S r7   r    r5   r3   
get_parserzConfiguration.get_parsery   s    r5   N)__name__
__module____qualname__r4   r8   r;   rA   propertyr@   staticmethodr?   rK   rJ   r5   r3   r   r      s        2( 2( 2(r  . . .B B B xl$o7 7H   \   \  r5   r   c                       e Zd ZdS )ArticleConfigurationNrL   rM   rN   rJ   r5   r3   rR   rR   ~           Dr5   rR   c                       e Zd ZdS )SourceConfigurationNrS   rJ   r5   r3   rV   rV      rT   r5   rV   )__doc__	__title__
__author____license____copyright__loggingparsersr   textr   r	   r
   r   r   r   versionr   	getLoggerrL   logobjectr   rR   rV   rJ   r5   r3   <module>rc      sU    	
/       G G G G G G G G G G G G G G G G            g!!d d d d dF d d dN	 	 	 	 	= 	 	 		 	 	 	 	- 	 	 	 	 	r5   