Search is not available for this dataset
text
stringlengths
75
104k
def videos(self, **kwargs): """ Get the videos (trailers, teasers, clips, etc...) for a specific movie id. Args: append_to_response: (optional) Comma separated, any movie method. Returns: A dict representation of the JSON returned from the API. "...
def translations(self, **kwargs): """ Get the translations for a specific movie id. Args: append_to_response: (optional) Comma separated, any movie method. Returns: A dict representation of the JSON returned from the API. """ path = self._get_id_...
def similar_movies(self, **kwargs): """ Get the similar movies for a specific movie id. Args: page: (optional) Minimum value of 1. Expected value is an integer. language: (optional) ISO 639-1 code. append_to_response: (optional) Comma separated, any movie me...
def reviews(self, **kwargs): """ Get the reviews for a particular movie id. Args: page: (optional) Minimum value of 1. Expected value is an integer. language: (optional) ISO 639-1 code. append_to_response: (optional) Comma separated, any movie method. ...
def changes(self, **kwargs): """ Get the changes for a specific movie id. Changes are grouped by key, and ordered by date in descending order. By default, only the last 24 hours of changes are returned. The maximum number of days that can be returned in a single request is 14. ...
def upcoming(self, **kwargs): """ Get the list of upcoming movies. This list refreshes every day. The maximum number of items this list will include is 100. Args: page: (optional) Minimum value of 1. Expected value is an integer. language: (optional) ISO 639-1 c...
def now_playing(self, **kwargs): """ Get the list of movies playing in theatres. This list refreshes every day. The maximum number of items this list will include is 100. Args: page: (optional) Minimum value of 1. Expected value is an integer. language: (optiona...
def popular(self, **kwargs): """ Get the list of popular movies on The Movie Database. This list refreshes every day. Args: page: (optional) Minimum value of 1. Expected value is an integer. language: (optional) ISO 639-1 code. Returns: A di...
def top_rated(self, **kwargs): """ Get the list of top rated movies. By default, this list will only include movies that have 10 or more votes. This list refreshes every day. Args: page: (optional) Minimum value of 1. Expected value is an integer. langua...
def account_states(self, **kwargs): """ This method lets users get the status of whether or not the movie has been rated or added to their favourite or watch lists. A valid session id is required. Args: session_id: see Authentication. Returns: A ...
def rating(self, **kwargs): """ This method lets users rate a movie. A valid session id or guest session id is required. Args: session_id: see Authentication. guest_session_id: see Authentication. value: Rating value. Returns: A d...
def movie_credits(self, **kwargs): """ Get the movie credits for a specific person id. Args: language: (optional) ISO 639-1 code. append_to_response: (optional) Comma separated, any person method. Returns: A dict respresentation of the JSON returned ...
def tv_credits(self, **kwargs): """ Get the TV credits for a specific person id. Args: language: (optional) ISO 639-1 code. append_to_response: (optional) Comma separated, any person method. Returns: A dict respresentation of the JSON returned from t...
def combined_credits(self, **kwargs): """ Get the combined (movie and TV) credits for a specific person id. To get the expanded details for each TV record, call the /credit method with the provided credit_id. This will provide details about which episode and/or season the cred...
def info(self, **kwargs): """ Get the detailed information about a particular credit record. This is currently only supported with the new credit model found in TV. These ids can be found from any TV credit response as well as the tv_credits and combined_credits methods for pe...
def tv(self, **kwargs): """ Discover TV shows by different types of data like average rating, number of votes, genres, the network they aired on and air dates. Args: page: (optional) Minimum 1, maximum 1000. language: (optional) ISO 639-1 code. sort_...
def info(self, **kwargs): """ Get the system wide configuration info. Returns: A dict respresentation of the JSON returned from the API. """ path = self._get_path('info') response = self._GET(path, kwargs) self._set_attrs_to_values(response) ...
def list(self, **kwargs): """ Get the list of supported certifications for movies. Returns: A dict respresentation of the JSON returned from the API. """ path = self._get_path('movie_list') response = self._GET(path, kwargs) self._set_attrs_to_values...
def info(self, **kwargs): """ Get the basic information for an account. Call this method first, before calling other Account methods. Returns: A dict respresentation of the JSON returned from the API. """ path = self._get_path('info') kwargs.update({...
def watchlist_movies(self, **kwargs): """ Get the list of movies on an account watchlist. Args: page: (optional) Minimum 1, maximum 1000. sort_by: (optional) 'created_at.asc' | 'created_at.desc' language: (optional) ISO 639-1 code. Returns: ...
def token_new(self, **kwargs): """ Generate a valid request token for user based authentication. A request token is required to ask the user for permission to access their account. After obtaining the request_token, either: (1) Direct your user to: https...
def token_validate_with_login(self, **kwargs): """ Authenticate a user with a TMDb username and password. The user must have a verified email address and be registered on TMDb. Args: request_token: The token you generated for the user to approve. username: The u...
def session_new(self, **kwargs): """ Generate a session id for user based authentication. A session id is required in order to use any of the write methods. Args: request_token: The token you generated for the user to approve. The token needs to b...
def guest_session_new(self, **kwargs): """ Generate a guest session id. Returns: A dict respresentation of the JSON returned from the API. """ path = self._get_path('guest_session_new') response = self._GET(path, kwargs) self._set_attrs_to_values(res...
def rated_movies(self, **kwargs): """ Get a list of rated moview for a specific guest session id. Args: page: (optional) Minimum 1, maximum 1000. sort_by: (optional) 'created_at.asc' | 'created_at.desc' language: (optional) ISO 639-1 code. Returns: ...
def item_status(self, **kwargs): """ Check to see if a movie id is already added to a list. Args: movie_id: The id of the movie. Returns: A dict respresentation of the JSON returned from the API. """ path = self._get_id_path('item_status') ...
def create_list(self, **kwargs): """ Create a new list. A valid session id is required. Args: name: Name of the list. description: Description of the list. language: (optional) ISO 639-1 code. Returns: A dict respresentation of t...
def remove_item(self, **kwargs): """ Delete movies from a list that the user created. A valid session id is required. Args: media_id: A movie id. Returns: A dict respresentation of the JSON returned from the API. """ path = self._get_id_...
def clear_list(self, **kwargs): """ Clears all of the items within a list. This is an irreversible action and should be treated with caution. A valid session id is required. Args: confirm: True (do it) | False (don't do it) Returns: A dict respr...
def content_ratings(self, **kwargs): """ Get the content ratings for a TV Series. Args: language: (optional) ISO 639 code. append_to_response: (optional) Comma separated, any collection method. Returns: A dict resprese...
def similar(self, **kwargs): """ Get the similar TV series for a specific TV series id. Args: page: (optional) Minimum value of 1. Expected value is an integer. language: (optional) ISO 639-1 code. append_to_response: (optional) Comma separated, any TV metho...
def on_the_air(self, **kwargs): """ Get the list of TV shows that are currently on the air. This query looks for any TV show that has an episode with an air date in the next 7 days. Args: page: (optional) Minimum 1, maximum 1000. language: (optional) ISO ...
def airing_today(self, **kwargs): """ Get the list of TV shows that air today. Without a specified timezone, this query defaults to EST (Eastern Time UTC-05:00). Args: page: (optional) Minimum 1, maximum 1000. language: (optional) ISO 639 code. timezo...
def info(self, **kwargs): """ Get the primary information about a TV season by its season number. Args: language: (optional) ISO 639 code. append_to_response: (optional) Comma separated, any TV series method. Returns: ...
def credits(self, **kwargs): """ Get the cast & crew credits for a TV season by season number. Returns: A dict respresentation of the JSON returned from the API. """ path = self._get_series_id_season_number_path('credits') response = self._GET(path, kwargs) ...
def external_ids(self, **kwargs): """ Get the external ids that we have stored for a TV season by season number. Args: language: (optional) ISO 639 code. Returns: A dict respresentation of the JSON returned from the API. """ path = self._...
def images(self, **kwargs): """ Get the images (posters) that we have stored for a TV season by season number. Args: language: (optional) ISO 639 code. include_image_language: (optional) Comma separated, a valid ISO 69-1. ...
def videos(self, **kwargs): """ Get the videos that have been added to a TV season (trailers, teasers, etc...). Args: language: (optional) ISO 639 code. Returns: A dict respresentation of the JSON returned from the API. """ path = self._g...
def info(self, **kwargs): """ Get the primary information about a TV episode by combination of a season and episode number. Args: language: (optional) ISO 639 code. append_to_response: (optional) Comma separated, any TV series meth...
def credits(self, **kwargs): """ Get the TV episode credits by combination of season and episode number. Returns: A dict respresentation of the JSON returned from the API. """ path = self._get_series_id_season_number_episode_number_path('credits') response =...
def external_ids(self, **kwargs): """ Get the external ids for a TV episode by combination of a season and episode number. Args: language: (optional) ISO 639 code. Returns: A dict respresentation of the JSON returned from the API. """ pat...
def images(self, **kwargs): """ Get the images (episode stills) for a TV episode by combination of a season and episode number. Since episode stills don't have a language, this call will always return all images. Returns: A dict respresentation of the JSON returned f...
def videos(self, **kwargs): """ Get the videos that have been added to a TV episode (teasers, clips, etc...). Args: language: (optional) ISO 639 code. Returns: A dict respresentation of the JSON returned from the API. """ path = self._get...
def _set_attrs_to_values(self, response={}): """ Set attributes to dictionary values. - e.g. >>> import tmdbsimple as tmdb >>> movie = tmdb.Movies(103332) >>> response = movie.info() >>> movie.title # instead of response['title'] """ if isinstanc...
def movie(self, **kwargs): """ Search for movies by title. Args: query: CGI escpaed string. page: (optional) Minimum value of 1. Expected value is an integer. language: (optional) ISO 639-1 code. include_adult: (optional) Toggle the inclusion of a...
def collection(self, **kwargs): """ Search for collections by name. Args: query: CGI escpaed string. page: (optional) Minimum value of 1. Expected value is an integer. language: (optional) ISO 639-1 code. Returns: A dict respresentation o...
def tv(self, **kwargs): """ Search for TV shows by title. Args: query: CGI escpaed string. page: (optional) Minimum value of 1. Expected value is an integer. language: (optional) ISO 639-1 code. first_air_date_year: (optional) Filter the results t...
def person(self, **kwargs): """ Search for people by name. Args: query: CGI escpaed string. page: (optional) Minimum value of 1. Expected value is an integer. include_adult: (optional) Toggle the inclusion of adult titles. Expected...
def company(self, **kwargs): """ Search for companies by name. Args: query: CGI escpaed string. page: (optional) Minimum value of 1. Expected value is an integer. Returns: A dict respresentation of the JSON returned from the API. """ ...
def keyword(self, **kwargs): """ Search for keywords by name. Args: query: CGI escpaed string. page: (optional) Minimum value of 1. Expected value is an integer. Returns: A dict respresentation of the JSON returned from the API. """ p...
def multi(self, **kwargs): """ Search the movie, tv show and person collections with a single query. Args: query: CGI escpaed string. page: (optional) Minimum value of 1. Expected value is an integer. language: (optional) ISO 639-1 code. include_a...
def normalize(s): '''Normalize and tokenize text. This is lifted from NIST mteval-v11a.pl.''' # Added to bypass NIST-style pre-processing of hyp and ref files -- wade if (nonorm): return s.split() try: s.split() except: s = " ".join(s) # language-independent part: for...
def cook_refs(refs, n=4): '''Takes a list of reference sentences for a single segment and returns an object that encapsulates everything that BLEU needs to know about them.''' refs = [normalize(ref) for ref in refs] maxcounts = {} for ref in refs: counts = count_ngrams(ref, n) ...
def cook_ref_set(ref, n=4): '''Takes a reference sentences for a single segment and returns an object that encapsulates everything that BLEU needs to know about them. Also provides a set cause bleualign wants it''' ref = normalize(ref) counts = count_ngrams(ref, n) return (len(ref), counts, fro...
def erfcc(x): """Complementary error function.""" z = abs(x) t = 1 / (1 + 0.5 * z) r = t * math.exp(-z * z - 1.26551223 + t * (1.00002368 + t * (.37409196 + t * (.09678418 + t * (-.18628806 + t...
def align_probability(i, j, source_sentences, target_sentences, alignment, params): """Returns the probability of the two sentences C{source_sentences[i]}, C{target_sentences[j]} being aligned with a specific C{alignment}. @param i: The offset of the source sentence. @param j: The offset of the target ...
def align_blocks(source_sentences, target_sentences, params = LanguageIndependent): """Creates the sentence alignment of two blocks of texts (usually paragraphs). @param source_sentences: The list of source sentence lengths. @param target_sentences: The list of target sentence lengths. @param params: t...
def align_texts(source_blocks, target_blocks, params = LanguageIndependent): """Creates the sentence alignment of two texts. Texts can consist of several blocks. Block boundaries cannot be crossed by sentence alignment links. Each block consists of a list that contains the lengths (in characters) of...
def split_at(it, split_value): """Splits an iterator C{it} at values of C{split_value}. Each instance of C{split_value} is swallowed. The iterator produces subiterators which need to be consumed fully before the next subiterator can be used. """ def _chunk_iterator(first): v = first ...
def parse_token_stream(stream, soft_delimiter, hard_delimiter): """Parses a stream of tokens and splits it into sentences (using C{soft_delimiter} tokens) and blocks (using C{hard_delimiter} tokens) for use with the L{align_texts} function. """ return [ [sum(len(token) for token in sentence_it)...
def get_descriptors_from_module(mdl, submodule=False): r"""[DEPRECATED] Get descriptors from module. Parameters: mdl(module): module to search Returns: [Descriptor] """ warnings.warn("use get_descriptors_in_module", DeprecationWarning) __all__ = getattr(mdl, "__all__", None) ...
def get_descriptors_in_module(mdl, submodule=True): r"""Get descriptors in module. Parameters: mdl(module): module to search submodule(bool): search recursively Returns: Iterator[Descriptor] """ __all__ = getattr(mdl, "__all__", None) if __all__ is None: __all_...
def register_json(self, obj): """Register Descriptors from json descriptor objects. Parameters: obj(list or dict): descriptors to register """ if not isinstance(obj, list): obj = [obj] self.register(Descriptor.from_json(j) for j in obj)
def register(self, desc, version=None, ignore_3D=False): r"""Register descriptors. Descriptor-like: * Descriptor instance: self * Descriptor class: use Descriptor.preset() method * module: use Descriptor-likes in module * Iterable: use Descriptor-likes in...
def echo(self, s, file=sys.stdout, end="\n"): """Output message. Parameters: s(str): message to output file(file-like): output to end(str): end mark of message Return: None """ p = getattr(self, "_progress_bar", None) if ...
def map(self, mols, nproc=None, nmols=None, quiet=False, ipynb=False, id=-1): r"""Calculate descriptors over mols. Parameters: mols(Iterable[rdkit.Mol]): moleculars nproc(int): number of process to use. default: multiprocessing.cpu_count() nmols(int): number of all...
def pandas(self, mols, nproc=None, nmols=None, quiet=False, ipynb=False, id=-1): r"""Calculate descriptors over mols. Returns: pandas.DataFrame """ from .pandas_module import MordredDataFrame, Series if isinstance(mols, Series): index = mols.index ...
def is_descriptor_class(desc, include_abstract=False): r"""Check calculatable descriptor class or not. Returns: bool """ return ( isinstance(desc, type) and issubclass(desc, Descriptor) and (True if include_abstract else not inspect.isabstract(desc)) )
def to_json(self): """Convert to json serializable dictionary. Returns: dict: dictionary of descriptor """ d, ps = self._to_json() if len(ps) == 0: return {"name": d} else: return {"name": d, "args": ps}
def coord(self): """Get 3D coordinate. Returns: numpy.array[3, N]: coordinate matrix """ if not self.require_3D: self.fail(AttributeError("use 3D coordinate in 2D descriptor")) return self._context.get_coord(self)
def rethrow_zerodiv(self): """[contextmanager] treat zero div as known exception.""" with np.errstate(divide="raise", invalid="raise"): try: yield except (FloatingPointError, ZeroDivisionError) as e: self.fail(ZeroDivisionError(*e.args))
def atomic_sa(self, i): r"""Calculate atomic surface area. :type i: int :param i: atom index :rtype: float """ sa = 4.0 * np.pi * self.rads2[i] neighbors = self.neighbors.get(i) if neighbors is None: return sa XYZi = self.xyzs[i, n...
def surface_area(self): r"""Calculate all atomic surface area. :rtype: [float] """ return [self.atomic_sa(i) for i in range(len(self.rads))]
def from_mol(cls, mol, conformer=-1, solvent_radius=1.4, level=4): r"""Construct SurfaceArea from rdkit Mol type. :type mol: rdkit.Chem.Mol :param mol: input molecule :type conformer: int :param conformer: conformer id :type solvent_radius: float :param solvent...
def _Descriptor_from_json(self, obj): """Create Descriptor instance from json dict. Parameters: obj(dict): descriptor dict Returns: Descriptor: descriptor """ descs = getattr(self, "_all_descriptors", None) if descs is None: from mordred import descriptors des...
def fill_missing(self, value=np.nan): r"""Replace missing value to "value". Parameters: value: value that missing value is replaced Returns: Result """ return self.__class__( self.mol, [(value if is_missing(v) else v) for v in se...
def drop_missing(self): r"""Delete missing value. Returns: Result """ newvalues = [] newdescs = [] for d, v in self.items(): if not is_missing(v): newvalues.append(v) newdescs.append(d) return self.__class...
def items(self): r"""Get items. Returns: Iterable[(Descriptor, value)] """ return ((k, v) for k, v in zip(self.keys(), self.values()))
def asdict(self, rawkey=False): r"""Convert Result to dict. Parameters: rawkey(bool): * True: dict key is Descriptor instance * False: dict key is str Returns: dict """ if rawkey: return dict(self.items()) ...
def name(self): r"""Access descriptor value by descriptor name or instance. >>> from mordred import Calculator, descriptors >>> from rdkit import Chem >>> result = Calculator(descriptors)(Chem.MolFromSmiles("C1CCCCC1")) >>> result.name["C2SP3"] 6 """ if ...
def log_calls(func): '''Decorator to log function calls.''' def wrapper(*args, **kargs): callStr = "%s(%s)" % (func.__name__, ", ".join([repr(p) for p in args] + ["%s=%s" % (k, repr(v)) for (k, v) in list(kargs.items())])) debug(">> %s", callStr) ret = func(*args, **kargs) debug("<< %s: %s", callStr...
def synchronized(func): '''Decorator to synchronize function.''' func.__lock__ = threading.Lock() def synced_func(*args, **kargs): with func.__lock__: return func(*args, **kargs) return synced_func
def progress(msg, *args): '''Show current progress message to stderr. This function will remember the previous message so that next time, it will clear the previous message before showing next one. ''' # Don't show any progress if the output is directed to a file. if not (sys.stdout.isatty() and sys.s...
def message(msg, *args): '''Program message output.''' clear_progress() text = (msg % args) sys.stdout.write(text + '\n')
def fail(message, exc_info=None, status=1, stacktrace=False): '''Utility function to handle runtime failures gracefully. Show concise information if possible, then terminate program. ''' text = message if exc_info: text += str(exc_info) error(text) if stacktrace: error(traceback.format_exc()) ...
def tempfile_get(target): '''Get a temp filename for atomic download.''' fn = '%s-%s.tmp' % (target, ''.join(random.Random().sample("0123456789abcdefghijklmnopqrstuvwxyz", 15))) TEMP_FILES.add(fn) return fn
def tempfile_set(tempfile, target): '''Atomically rename and clean tempfile''' if target: os.rename(tempfile, target) else: os.unlink(tempfile) if target in TEMP_FILES: TEMP_FILES.remove(tempfile)
def clean_tempfiles(): '''Clean up temp files''' for fn in TEMP_FILES: if os.path.exists(fn): os.unlink(fn)
def get_loggers(self): '''Return a list of the logger methods: (debug, info, warn, error)''' return self.log.debug, self.log.info, self.log.warn, self.log.error
def get_fixed_path(self): '''Get the fixed part of the path without wildcard''' pi = self.path.split(PATH_SEP) fi = [] for p in pi: if '*' in p or '?' in p: break fi.append(p) return PATH_SEP.join(fi)
def get_legal_params(self, method): '''Given a API name, list all legal parameters using boto3 service model.''' if method not in self.client.meta.method_to_api_mapping: # Injected methods. Ignore. return [] api = self.client.meta.method_to_api_mapping[method] shape = self.client.meta.servic...
def merge_opt_params(self, method, kargs): '''Combine existing parameters with extra options supplied from command line options. Carefully merge special type of parameter if needed. ''' for key in self.legal_params[method]: if not hasattr(self.opt, key) or getattr(self.opt, key) is None: ...
def add_options(parser): '''Add the whole list of API parameters into optparse.''' for param, param_type, param_doc in BotoClient.EXTRA_CLIENT_PARAMS: parser.add_option('--API-' + param, help=param_doc, type=param_type, dest=param)
def join(self): '''Override original join() with a timeout and handle keyboard interrupt.''' self.all_tasks_done.acquire() try: while self.unfinished_tasks: self.all_tasks_done.wait(1000) # Child thread has exceptions, fail main thread too. if self.exc_info: fail('[T...
def terminate(self, exc_info=None): '''Terminate all threads by deleting the queue and forcing the child threads to quit. ''' if exc_info: self.exc_info = exc_info try: while self.get_nowait(): self.task_done() except Queue.Empty: pass
def add_task(self, func_name, *args, **kargs): '''Utility function to add a single task into task queue''' self.tasks.put((func_name, 0, args, kargs))
def join(self): '''Utility function to wait all tasks to complete''' self.tasks.join() # Force each thread to break loop. for worker in self.workers: self.tasks.put(None) # Wait for all thread to terminate. for worker in self.workers: worker.join() worker.s3 = None
def processed(self): '''Increase the processed task counter and show progress message''' self.processed_tasks += 1 qsize = self.tasks.qsize() if qsize > 0: progress('[%d task(s) completed, %d remaining, %d thread(s)]', self.processed_tasks, qsize, len(self.workers)) else: progress('[%d t...
def s3_keys_from_env(): '''Retrieve S3 access keys from the environment, or None if not present.''' env = os.environ if S3_ACCESS_KEY_NAME in env and S3_SECRET_KEY_NAME in env: keys = (env[S3_ACCESS_KEY_NAME], env[S3_SECRET_KEY_NAME]) debug("read S3 keys from environment") return keys ...
def s3_keys_from_cmdline(opt): '''Retrieve S3 access keys from the command line, or None if not present.''' if opt.access_key != None and opt.secret_key != None: keys = (opt.access_key, opt.secret_key) debug("read S3 keys from commandline") return keys else: return None