Search is not available for this dataset
text
stringlengths
75
104k
def calculate_derivative_T(self, T, P, zs, ws, method, order=1): r'''Method to calculate a derivative of a mixture property with respect to temperature at constant pressure and composition of a given order using a specified method. Uses SciPy's derivative function, with a delta of 1E-...
def calculate_derivative_P(self, P, T, zs, ws, method, order=1): r'''Method to calculate a derivative of a mixture property with respect to pressure at constant temperature and composition of a given order using a specified method. Uses SciPy's derivative function, with a delta of 0.01...
def property_derivative_T(self, T, P, zs, ws, order=1): r'''Method to calculate a derivative of a mixture property with respect to temperature at constant pressure and composition, of a given order. Methods found valid by `select_valid_methods` are attempted until a method succeeds. If ...
def property_derivative_P(self, T, P, zs, ws, order=1): r'''Method to calculate a derivative of a mixture property with respect to pressure at constant temperature and composition, of a given order. Methods found valid by `select_valid_methods` are attempted until a method succeeds. If ...
def plot_isotherm(self, T, zs, ws, Pmin=None, Pmax=None, methods=[], pts=50, only_valid=True): # pragma: no cover r'''Method to create a plot of the property vs pressure at a specified temperature and composition according to either a specified list of methods, or the us...
def plot_isobar(self, P, zs, ws, Tmin=None, Tmax=None, methods=[], pts=50, only_valid=True): # pragma: no cover r'''Method to create a plot of the property vs temperature at a specific pressure and composition according to either a specified list of methods, or user methods...
def plot_property(self, zs, ws, Tmin=None, Tmax=None, Pmin=1E5, Pmax=1E6, methods=[], pts=15, only_valid=True): # pragma: no cover r'''Method to create a plot of the property vs temperature and pressure according to either a specified list of methods, or user methods (if ...
def refractive_index(CASRN, T=None, AvailableMethods=False, Method=None, full_info=True): r'''This function handles the retrieval of a chemical's refractive index. Lookup is based on CASRNs. Will automatically select a data source to use if no Method is provided; returns None if the dat...
def a_alpha_and_derivatives(self, T, full=True, quick=True): r'''Method to calculate `a_alpha` and its first and second derivatives for an EOS with the Van der Waals mixing rules. Uses the parent class's interface to compute pure component values. Returns `a_alpha`, `da_alpha_dT`, and `d...
def fugacities(self, xs=None, ys=None): r'''Helper method for calculating fugacity coefficients for any phases present, using either the overall mole fractions for both phases or using specified mole fractions for each phase. Requires `fugacity_coefficients` to be implemente...
def solve_T(self, P, V, quick=True): r'''Generic method to calculate `T` from a specified `P` and `V`. Provides SciPy's `newton` solver, and iterates to solve the general equation for `P`, recalculating `a_alpha` as a function of temperature using `a_alpha_and_derivatives` each iteration...
def setup_a_alpha_and_derivatives(self, i, T=None): r'''Sets `a`, `kappa`, and `Tc` for a specific component before the pure-species EOS's `a_alpha_and_derivatives` method is called. Both are called by `GCEOSMIX.a_alpha_and_derivatives` for every component.''' self.a, self.kappa, self....
def setup_a_alpha_and_derivatives(self, i, T=None): r'''Sets `a`, `m`, and `Tc` for a specific component before the pure-species EOS's `a_alpha_and_derivatives` method is called. Both are called by `GCEOSMIX.a_alpha_and_derivatives` for every component.''' self.a, self.m, self.Tc = sel...
def fugacity_coefficients(self, Z, zs): r'''Literature formula for calculating fugacity coefficients for each species in a mixture. Verified numerically. Applicable to most derivatives of the SRK equation of state as well. Called by `fugacities` on initialization, or by a solver routine...
def fugacity_coefficients(self, Z, zs): r'''Literature formula for calculating fugacity coefficients for each species in a mixture. Verified numerically. Called by `fugacities` on initialization, or by a solver routine which is performing a flash calculation. .. math:: ...
def setup_a_alpha_and_derivatives(self, i, T=None): r'''Sets `a`, `kappa0`, `kappa1`, and `Tc` for a specific component before the pure-species EOS's `a_alpha_and_derivatives` method is called. Both are called by `GCEOSMIX.a_alpha_and_derivatives` for every component.''' if not hasattr...
def cleanup_a_alpha_and_derivatives(self): r'''Removes properties set by `setup_a_alpha_and_derivatives`; run by `GCEOSMIX.a_alpha_and_derivatives` after `a_alpha` is calculated for every component''' del(self.a, self.kappa, self.kappa0, self.kappa1, self.Tc)
def setup_a_alpha_and_derivatives(self, i, T=None): r'''Sets `a`, `kappa`, `kappa0`, `kappa1`, `kappa2`, `kappa3` and `Tc` for a specific component before the pure-species EOS's `a_alpha_and_derivatives` method is called. Both are called by `GCEOSMIX.a_alpha_and_derivatives` for every ...
def cleanup_a_alpha_and_derivatives(self): r'''Removes properties set by `setup_a_alpha_and_derivatives`; run by `GCEOSMIX.a_alpha_and_derivatives` after `a_alpha` is calculated for every component''' del(self.a, self.kappa, self.kappa0, self.kappa1, self.kappa2, self.kappa3, self.Tc)
def setup_a_alpha_and_derivatives(self, i, T=None): r'''Sets `a`, `omega`, and `Tc` for a specific component before the pure-species EOS's `a_alpha_and_derivatives` method is called. Both are called by `GCEOSMIX.a_alpha_and_derivatives` for every component.''' self.a, self.Tc, self.ome...
def setup_a_alpha_and_derivatives(self, i, T=None): r'''Sets `a`, `S1`, `S2` and `Tc` for a specific component before the pure-species EOS's `a_alpha_and_derivatives` method is called. Both are called by `GCEOSMIX.a_alpha_and_derivatives` for every component.''' self.a, self.Tc, self.S...
def cleanup_a_alpha_and_derivatives(self): r'''Removes properties set by `setup_a_alpha_and_derivatives`; run by `GCEOSMIX.a_alpha_and_derivatives` after `a_alpha` is calculated for every component''' del(self.a, self.Tc, self.S1, self.S2)
def Sato_Riedel(T, M, Tb, Tc): r'''Calculate the thermal conductivity of a liquid as a function of temperature using the CSP method of Sato-Riedel [1]_, [2]_, published in Reid [3]_. Requires temperature, molecular weight, and boiling and critical temperatures. .. math:: k = \frac{1.1053}{\...
def Gharagheizi_liquid(T, M, Tb, Pc, omega): r'''Estimates the thermal conductivity of a liquid as a function of temperature using the CSP method of Gharagheizi [1]_. A convoluted method claiming high-accuracy and using only statistically significant variable following analalysis. Requires tempera...
def Nicola_original(T, M, Tc, omega, Hfus): r'''Estimates the thermal conductivity of a liquid as a function of temperature using the CSP method of Nicola [1]_. A simpler but long method claiming high-accuracy and using only statistically significant variable following analalysis. Requires tempera...
def Nicola(T, M, Tc, Pc, omega): r'''Estimates the thermal conductivity of a liquid as a function of temperature using the CSP method of [1]_. A statistically derived equation using any correlated terms. Requires temperature, molecular weight, critical temperature and pressure, and acentric factor....
def Bahadori_liquid(T, M): r'''Estimates the thermal conductivity of parafin liquid hydrocarbons. Fits their data well, and is useful as only MW is required. X is the Molecular weight, and Y the temperature. .. math:: K = a + bY + CY^2 + dY^3 a = A_1 + B_1 X + C_1 X^2 + D_1 X^3 ...
def Mersmann_Kind_thermal_conductivity_liquid(T, MW, Tc, Vc, atoms): r'''Estimates the thermal conductivity of organic liquid substances according to the method of [1]_. .. math:: \lambda^* = \frac{\lambda\cdot V_c^{2/3}\cdot T_c\cdot \text{MW}^{0.5}} {(k\cdot T_c)^{1.5}\cdot N_A^{7/6}} ...
def DIPPR9G(T, P, Tc, Pc, kl): r'''Adjustes for pressure the thermal conductivity of a liquid using an emperical formula based on [1]_, but as given in [2]_. .. math:: k = k^* \left[ 0.98 + 0.0079 P_r T_r^{1.4} + 0.63 T_r^{1.2} \left( \frac{P_r}{30 + P_r}\right)\right] Parameters -...
def Missenard(T, P, Tc, Pc, kl): r'''Adjustes for pressure the thermal conductivity of a liquid using an emperical formula based on [1]_, but as given in [2]_. .. math:: \frac{k}{k^*} = 1 + Q P_r^{0.7} Parameters ---------- T : float Temperature of fluid [K] P : float ...
def DIPPR9H(ws, ks): r'''Calculates thermal conductivity of a liquid mixture according to mixing rules in [1]_ and also in [2]_. .. math:: \lambda_m = \left( \sum_i w_i \lambda_i^{-2}\right)^{-1/2} Parameters ---------- ws : float Mass fractions of components ks : float ...
def Filippov(ws, ks): r'''Calculates thermal conductivity of a binary liquid mixture according to mixing rules in [2]_ as found in [1]_. .. math:: \lambda_m = w_1 \lambda_1 + w_2\lambda_2 - 0.72 w_1 w_2(\lambda_2-\lambda_1) Parameters ---------- ws : float Mass fraction...
def Eucken(MW, Cvm, mu): r'''Estimates the thermal conductivity of a gas as a function of temperature using the CSP method of Eucken [1]_. .. math:: \frac{\lambda M}{\eta C_v} = 1 + \frac{9/4}{C_v/R} Parameters ---------- MW : float Molecular weight of the gas [g/mol] Cvm :...
def Eucken_modified(MW, Cvm, mu): r'''Estimates the thermal conductivity of a gas as a function of temperature using the Modified CSP method of Eucken [1]_. .. math:: \frac{\lambda M}{\eta C_v} = 1.32 + \frac{1.77}{C_v/R} Parameters ---------- MW : float Molecular weight of the...
def DIPPR9B(T, MW, Cvm, mu, Tc=None, chemtype=None): r'''Calculates the thermal conductivity of a gas using one of several emperical equations developed in [1]_, [2]_, and presented in [3]_. For monoatomic gases: .. math:: k = 2.5 \frac{\eta C_v}{MW} For linear molecules: .. math:: ...
def Chung(T, MW, Tc, omega, Cvm, mu): r'''Estimates the thermal conductivity of a gas as a function of temperature using the CSP method of Chung [1]_. .. math:: \frac{\lambda M}{\eta C_v} = \frac{3.75 \Psi}{C_v/R} \Psi = 1 + \alpha \left\{[0.215+0.28288\alpha-1.061\beta+0.26665Z]/ ...
def eli_hanley(T, MW, Tc, Vc, Zc, omega, Cvm): r'''Estimates the thermal conductivity of a gas as a function of temperature using the reference fluid method of Eli and Hanley [1]_ as shown in [2]_. .. math:: \lambda = \lambda^* + \frac{\eta^*}{MW}(1.32)\left(C_v - \frac{3R}{2}\right) T...
def Gharagheizi_gas(T, MW, Tb, Pc, omega): r'''Estimates the thermal conductivity of a gas as a function of temperature using the CSP method of Gharagheizi [1]_. A convoluted method claiming high-accuracy and using only statistically significant variable following analalysis. Requires temperature,...
def Bahadori_gas(T, MW): r'''Estimates the thermal conductivity of hydrocarbons gases at low P. Fits their data well, and is useful as only MW is required. Y is the Molecular weight, and X the temperature. .. math:: K = a + bY + CY^2 + dY^3 a = A_1 + B_1 X + C_1 X^2 + D_1 X^3 ...
def stiel_thodos_dense(T, MW, Tc, Pc, Vc, Zc, Vm, kg): r'''Estimates the thermal conductivity of a gas at high pressure as a function of temperature using difference method of Stiel and Thodos [1]_ as shown in [2]_. if \rho_r < 0.5: .. math:: (\lambda-\lambda^\circ)\Gamma Z_c^5=1.22\times ...
def eli_hanley_dense(T, MW, Tc, Vc, Zc, omega, Cvm, Vm): r'''Estimates the thermal conductivity of a gas at high pressure as a function of temperature using the reference fluid method of Eli and Hanley [1]_ as shown in [2]_. .. math:: Tr = min(Tr, 2) Vr = min(Vr, 2) f = \frac{...
def chung_dense(T, MW, Tc, Vc, omega, Cvm, Vm, mu, dipole, association=0): r'''Estimates the thermal conductivity of a gas at high pressure as a function of temperature using the reference fluid method of Chung [1]_ as shown in [2]_. .. math:: \lambda = \frac{31.2 \eta^\circ \Psi}{M'}(G_2^{-1} ...
def Lindsay_Bromley(T, ys, ks, mus, Tbs, MWs): r'''Calculates thermal conductivity of a gas mixture according to mixing rules in [1]_ and also in [2]_. .. math:: k = \sum \frac{y_i k_i}{\sum y_i A_{ij}} A_{ij} = \frac{1}{4} \left\{ 1 + \left[\frac{\eta_i}{\eta_j} \left(\frac{MW_j}{...
def load_all_methods(self): r'''Method which picks out coefficients for the specified chemical from the various dictionaries and DataFrames storing it. All data is stored as attributes. This method also sets :obj:`Tmin`, :obj:`Tmax`, :obj:`all_methods` and obj:`all_methods_P` as a set of...
def calculate(self, T, method): r'''Method to calculate low-pressure liquid thermal conductivity at tempearture `T` with a given method. This method has no exception handling; see `T_dependent_property` for that. Parameters ---------- T : float Tempe...
def calculate_P(self, T, P, method): r'''Method to calculate pressure-dependent liquid thermal conductivity at temperature `T` and pressure `P` with a given method. This method has no exception handling; see `TP_dependent_property` for that. Parameters ---------- ...
def load_all_methods(self): r'''Method to initialize the object by precomputing any values which may be used repeatedly and by retrieving mixture-specific variables. All data are stored as attributes. This method also sets :obj:`Tmin`, :obj:`Tmax`, and :obj:`all_methods` as a set of met...
def calculate(self, T, P, zs, ws, method): r'''Method to calculate thermal conductivity of a liquid mixture at temperature `T`, pressure `P`, mole fractions `zs` and weight fractions `ws` with a given method. This method has no exception handling; see `mixture_property` for tha...
def load_all_methods(self): r'''Method which picks out coefficients for the specified chemical from the various dictionaries and DataFrames storing it. All data is stored as attributes. This method also sets :obj:`Tmin`, :obj:`Tmax`, :obj:`all_methods` and obj:`all_methods_P` as a set of...
def calculate(self, T, method): r'''Method to calculate low-pressure gas thermal conductivity at tempearture `T` with a given method. This method has no exception handling; see `T_dependent_property` for that. Parameters ---------- T : float Temperat...
def calculate_P(self, T, P, method): r'''Method to calculate pressure-dependent gas thermal conductivity at temperature `T` and pressure `P` with a given method. This method has no exception handling; see `TP_dependent_property` for that. Parameters ---------- T...
def load_all_methods(self): r'''Method to initialize the object by precomputing any values which may be used repeatedly and by retrieving mixture-specific variables. All data are stored as attributes. This method also sets :obj:`Tmin`, :obj:`Tmax`, and :obj:`all_methods` as a set of met...
def calculate(self, T, P, zs, ws, method): r'''Method to calculate thermal conductivity of a gas mixture at temperature `T`, pressure `P`, mole fractions `zs` and weight fractions `ws` with a given method. This method has no exception handling; see `mixture_property` for that. ...
def molecular_weight(atoms): r'''Calculates molecular weight of a molecule given a dictionary of its atoms and their counts, in the format {symbol: count}. .. math:: MW = \sum_i n_i MW_i Parameters ---------- atoms : dict dictionary of counts of individual atoms, indexed by sym...
def mass_fractions(atoms, MW=None): r'''Calculates the mass fractions of each element in a compound, given a dictionary of its atoms and their counts, in the format {symbol: count}. .. math:: w_i = \frac{n_i MW_i}{\sum_i n_i MW_i} Parameters ---------- atoms : dict diction...
def atom_fractions(atoms): r'''Calculates the atomic fractions of each element in a compound, given a dictionary of its atoms and their counts, in the format {symbol: count}. .. math:: a_i = \frac{n_i}{\sum_i n_i} Parameters ---------- atoms : dict dictionary of counts of ...
def similarity_variable(atoms, MW=None): r'''Calculates the similarity variable of an compound, as defined in [1]_. Currently only applied for certain heat capacity estimation routines. .. math:: \alpha = \frac{N}{MW} = \frac{\sum_i n_i}{\sum_i n_i MW_i} Parameters ---------- atoms : d...
def atoms_to_Hill(atoms): r'''Determine the Hill formula of a compound, given a dictionary of its atoms and their counts, in the format {symbol: count}. Parameters ---------- atoms : dict dictionary of counts of individual atoms, indexed by symbol with proper capitalization, [-] ...
def simple_formula_parser(formula): r'''Basic formula parser, primarily for obtaining element counts from formulas as formated in PubChem. Handles formulas with integer counts, but no brackets, no hydrates, no charges, no isotopes, and no group multipliers. Strips charges from the end of a fo...
def nested_formula_parser(formula, check=True): r'''Improved formula parser which handles braces and their multipliers, as well as rational element counts. Strips charges from the end of a formula first. Accepts repeated chemical units. Performs no sanity checking that elements are actually elements. ...
def charge_from_formula(formula): r'''Basic formula parser to determine the charge from a formula - given that the charge is already specified as one element of the formula. Performs no sanity checking that elements are actually elements. Parameters ---------- formula : str Formula...
def serialize_formula(formula): r'''Basic formula serializer to construct a consistently-formatted formula. This is necessary for handling user-supplied formulas, which are not always well formatted. Performs no sanity checking that elements are actually elements. Parameters ---------- ...
async def connect(self): """Establish a connection to the chat server. Returns when an error has occurred, or :func:`disconnect` has been called. """ proxy = os.environ.get('HTTP_PROXY') self._session = http_utils.Session(self._cookies, proxy=proxy) try: ...
def get_request_header(self): """Return ``request_header`` for use when constructing requests. Returns: Populated request header. """ # resource is allowed to be null if it's not available yet (the Chrome # client does this for the first getentitybyid call) i...
async def set_active(self): """Set this client as active. While a client is active, no other clients will raise notifications. Call this method whenever there is an indication the user is interacting with this client. This method may be called very frequently, and it will only m...
async def upload_image(self, image_file, filename=None, *, return_uploaded_image=False): """Upload an image that can be later attached to a chat message. Args: image_file: A file-like object containing an image. filename (str): (optional) Custom name f...
def _get_upload_session_status(res): """Parse the image upload response to obtain status. Args: res: http_utils.FetchResponse instance, the upload response Returns: dict, sessionStatus of the response Raises: hangups.NetworkError: If the upload requ...
async def _on_receive_array(self, array): """Parse channel array and call the appropriate events.""" if array[0] == 'noop': pass # This is just a keep-alive, ignore it. else: wrapper = json.loads(array[0]['p']) # Wrapper appears to be a Protocol Buffer messag...
async def _add_channel_services(self): """Add services to the channel. The services we add to the channel determine what kind of data we will receive on it. The "babel" service includes what we need for Hangouts. If this fails for some reason, hangups will never receive any eve...
async def _pb_request(self, endpoint, request_pb, response_pb): """Send a Protocol Buffer formatted chat API request. Args: endpoint (str): The chat API endpoint to use. request_pb: The request body as a Protocol Buffer message. response_pb: The response body as a Pr...
async def _base_request(self, url, content_type, response_type, data): """Send a generic authenticated POST request. Args: url (str): URL of request. content_type (str): Request content type. response_type (str): The desired response format. Valid options ...
async def add_user(self, add_user_request): """Invite users to join an existing group conversation.""" response = hangouts_pb2.AddUserResponse() await self._pb_request('conversations/adduser', add_user_request, response) return response
async def create_conversation(self, create_conversation_request): """Create a new conversation.""" response = hangouts_pb2.CreateConversationResponse() await self._pb_request('conversations/createconversation', create_conversation_request, response) return ...
async def delete_conversation(self, delete_conversation_request): """Leave a one-to-one conversation. One-to-one conversations are "sticky"; they can't actually be deleted. This API clears the event history of the specified conversation up to ``delete_upper_bound_timestamp``, hiding it ...
async def easter_egg(self, easter_egg_request): """Send an easter egg event to a conversation.""" response = hangouts_pb2.EasterEggResponse() await self._pb_request('conversations/easteregg', easter_egg_request, response) return response
async def get_conversation(self, get_conversation_request): """Return conversation info and recent events.""" response = hangouts_pb2.GetConversationResponse() await self._pb_request('conversations/getconversation', get_conversation_request, response) retur...
async def get_entity_by_id(self, get_entity_by_id_request): """Return one or more user entities. Searching by phone number only finds entities when their phone number is in your contacts (and not always even then), and can't be used to find Google Voice contacts. """ res...
async def get_group_conversation_url(self, get_group_conversation_url_request): """Get URL to allow others to join a group conversation.""" response = hangouts_pb2.GetGroupConversationUrlResponse() await self._pb_request('conversations/getgroupconversatio...
async def get_self_info(self, get_self_info_request): """Return info about the current user.""" response = hangouts_pb2.GetSelfInfoResponse() await self._pb_request('contacts/getselfinfo', get_self_info_request, response) return response
async def get_suggested_entities(self, get_suggested_entities_request): """Return suggested contacts.""" response = hangouts_pb2.GetSuggestedEntitiesResponse() await self._pb_request('contacts/getsuggestedentities', get_suggested_entities_request, response) ...
async def query_presence(self, query_presence_request): """Return presence status for a list of users.""" response = hangouts_pb2.QueryPresenceResponse() await self._pb_request('presence/querypresence', query_presence_request, response) return response
async def remove_user(self, remove_user_request): """Remove a participant from a group conversation.""" response = hangouts_pb2.RemoveUserResponse() await self._pb_request('conversations/removeuser', remove_user_request, response) return response
async def rename_conversation(self, rename_conversation_request): """Rename a conversation. Both group and one-to-one conversations may be renamed, but the official Hangouts clients have mixed support for one-to-one conversations with custom names. """ response = hangout...
async def search_entities(self, search_entities_request): """Return user entities based on a query.""" response = hangouts_pb2.SearchEntitiesResponse() await self._pb_request('contacts/searchentities', search_entities_request, response) return response
async def send_chat_message(self, send_chat_message_request): """Send a chat message to a conversation.""" response = hangouts_pb2.SendChatMessageResponse() await self._pb_request('conversations/sendchatmessage', send_chat_message_request, response) return ...
async def modify_otr_status(self, modify_otr_status_request): """Enable or disable message history in a conversation.""" response = hangouts_pb2.ModifyOTRStatusResponse() await self._pb_request('conversations/modifyotrstatus', modify_otr_status_request, response) ...
async def send_offnetwork_invitation( self, send_offnetwork_invitation_request ): """Send an email to invite a non-Google contact to Hangouts.""" response = hangouts_pb2.SendOffnetworkInvitationResponse() await self._pb_request('devices/sendoffnetworkinvitation', ...
async def set_active_client(self, set_active_client_request): """Set the active client.""" response = hangouts_pb2.SetActiveClientResponse() await self._pb_request('clients/setactiveclient', set_active_client_request, response) return response
async def set_conversation_notification_level( self, set_conversation_notification_level_request ): """Set the notification level of a conversation.""" response = hangouts_pb2.SetConversationNotificationLevelResponse() await self._pb_request( 'conversations/setconvers...
async def set_focus(self, set_focus_request): """Set focus to a conversation.""" response = hangouts_pb2.SetFocusResponse() await self._pb_request('conversations/setfocus', set_focus_request, response) return response
async def set_group_link_sharing_enabled( self, set_group_link_sharing_enabled_request ): """Set whether group link sharing is enabled for a conversation.""" response = hangouts_pb2.SetGroupLinkSharingEnabledResponse() await self._pb_request('conversations/setgrouplinksharingenab...
async def set_presence(self, set_presence_request): """Set the presence status.""" response = hangouts_pb2.SetPresenceResponse() await self._pb_request('presence/setpresence', set_presence_request, response) return response
async def set_typing(self, set_typing_request): """Set the typing status of a conversation.""" response = hangouts_pb2.SetTypingResponse() await self._pb_request('conversations/settyping', set_typing_request, response) return response
async def sync_all_new_events(self, sync_all_new_events_request): """List all events occurring at or after a timestamp.""" response = hangouts_pb2.SyncAllNewEventsResponse() await self._pb_request('conversations/syncallnewevents', sync_all_new_events_request, respo...
async def sync_recent_conversations( self, sync_recent_conversations_request ): """Return info on recent conversations and their events.""" response = hangouts_pb2.SyncRecentConversationsResponse() await self._pb_request('conversations/syncrecentconversations', ...
async def update_watermark(self, update_watermark_request): """Update the watermark (read timestamp) of a conversation.""" response = hangouts_pb2.UpdateWatermarkResponse() await self._pb_request('conversations/updatewatermark', update_watermark_request, response) ...
def from_timestamp(microsecond_timestamp): """Convert a microsecond timestamp to a UTC datetime instance.""" # Create datetime without losing precision from floating point (yes, this # is actually needed): return datetime.datetime.fromtimestamp( microsecond_timestamp // 1000000, datetime.timezon...
def from_participantid(participant_id): """Convert hangouts_pb2.ParticipantId to UserID.""" return user.UserID( chat_id=participant_id.chat_id, gaia_id=participant_id.gaia_id )
def to_participantid(user_id): """Convert UserID to hangouts_pb2.ParticipantId.""" return hangouts_pb2.ParticipantId( chat_id=user_id.chat_id, gaia_id=user_id.gaia_id )
def parse_typing_status_message(p): """Return TypingStatusMessage from hangouts_pb2.SetTypingNotification. The same status may be sent multiple times consecutively, and when a message is sent the typing status will not change to stopped. """ return TypingStatusMessage( conv_id=p.conversatio...