code
string
signature
string
docstring
string
loss_without_docstring
float64
loss_with_docstring
float64
factor
float64
if 'at_hash' not in claims and not access_token: return elif 'at_hash' in claims and not access_token: msg = 'No access_token provided to compare against at_hash claim.' raise JWTClaimsError(msg) elif access_token and 'at_hash' not in claims: msg = 'at_hash claim missing...
def _validate_at_hash(claims, access_token, algorithm)
Validates that the 'at_hash' parameter included in the claims matches with the access_token returned alongside the id token as part of the authorization_code flow. Args: claims (dict): The claims dictionary to validate. access_token (str): The access token returned by the OpenID Provider. ...
2.771888
2.954603
0.938159
''' get session token ''' # HTTP POST query to session authenticate API try: response = requests.post(self.__session_url__ + 'sessionauth/v1/authenticate', cert=(self.__crt__, self.__key__), verify=True) except requests.exceptions.RequestE...
def get_session_token(self)
get session token
3.681864
3.672605
1.002521
''' main program loop ''' conn = symphony.Config('example-bot.cfg') # connect to pod agent, pod, symphony_sid = conn.connect() agent.test_echo('test') # main loop msgFormat = 'MESSAGEML' message = '<messageML> hello world. </messageML>' # send message agent.send_message(symphony_...
def main()
main program loop
10.733163
10.869302
0.987475
''' create datafeed ''' response, status_code = self.__agent__.Datafeed.post_v4_datafeed_create( sessionToken=self.__session__, keyManagerToken=self.__keymngr__ ).result() # return the token self.logger.debug('%s: %s' % (status_code, response)) ret...
def create_datafeed(self)
create datafeed
8.392796
8.84796
0.948557
''' get datafeed ''' response, status_code = self.__agent__.Datafeed.get_v4_datafeed_id_read( sessionToken=self.__session__, keyManagerToken=self.__keymngr__, id=datafeed_id ).result() self.logger.debug('%s: %s' % (status_code, response)) retur...
def read_datafeed(self, datafeed_id)
get datafeed
6.229014
6.49575
0.958937
''' send message to threadid/stream ''' # using deprecated v3 message create because of bug in codegen of v4 ( multipart/form-data ) response, status_code = self.__agent__.Messages.post_v3_stream_sid_message_create( sessionToken=self.__session__, keyManagerToken=self.__ke...
def send_message(self, threadid, msgFormat, message)
send message to threadid/stream
9.926202
9.554216
1.038934
''' get datafeed ''' response, status_code = self.__agent__.Messages.get_v4_stream_sid_message( sessionToken=self.__session__, keyManagerToken=self.__keymngr__, sid=stream_id, since=since_epoch ).result() self.logger.debug('%s: %s' % (statu...
def read_stream(self, stream_id, since_epoch)
get datafeed
8.120495
7.316605
1.109872
r'''Returns the spectral radiance, in units of W/m^2/sr/µm. .. math:: I_{\lambda,blackbody,e}(\lambda,T)=\frac{2hc_o^2} {\lambda^5[\exp(hc_o/\lambda k T)-1]} Parameters ---------- T : float Temperature of the surface, [K] wavelength : float Length of the wave to...
def blackbody_spectral_radiance(T, wavelength)
r'''Returns the spectral radiance, in units of W/m^2/sr/µm. .. math:: I_{\lambda,blackbody,e}(\lambda,T)=\frac{2hc_o^2} {\lambda^5[\exp(hc_o/\lambda k T)-1]} Parameters ---------- T : float Temperature of the surface, [K] wavelength : float Length of the wave to be ...
6.138639
1.231996
4.982676
r'''Calculates Nusselt number for natural convection around a sphere according to the Churchill [1]_ correlation. Sphere must be isothermal. .. math:: Nu_D=2+\frac{0.589Ra_D^{1/4}} {\left[1+(0.469/Pr)^{9/16}\right]^{4/9}} \cdot\left\{1 + \frac{7.44\times 10^{-8}Ra} {[1+(0.469/Pr)^{9...
def Nu_sphere_Churchill(Pr, Gr)
r'''Calculates Nusselt number for natural convection around a sphere according to the Churchill [1]_ correlation. Sphere must be isothermal. .. math:: Nu_D=2+\frac{0.589Ra_D^{1/4}} {\left[1+(0.469/Pr)^{9/16}\right]^{4/9}} \cdot\left\{1 + \frac{7.44\times 10^{-8}Ra} {[1+(0.469/Pr)^{9/16}...
4.878296
1.315476
3.70839
r'''This function handles choosing which vertical cylinder free convection correlation is used. Generally this is used by a helper class, but can be used directly. Will automatically select the correlation to use if none is provided; returns None if insufficient information is provided. Preferred f...
def Nu_vertical_cylinder(Pr, Gr, L=None, D=None, Method=None, AvailableMethods=False)
r'''This function handles choosing which vertical cylinder free convection correlation is used. Generally this is used by a helper class, but can be used directly. Will automatically select the correlation to use if none is provided; returns None if insufficient information is provided. Preferred funct...
3.357836
1.382342
2.429092
r'''This function handles choosing which horizontal cylinder free convection correlation is used. Generally this is used by a helper class, but can be used directly. Will automatically select the correlation to use if none is provided; returns None if insufficient information is provided. Prefered ...
def Nu_horizontal_cylinder(Pr, Gr, Method=None, AvailableMethods=False)
r'''This function handles choosing which horizontal cylinder free convection correlation is used. Generally this is used by a helper class, but can be used directly. Will automatically select the correlation to use if none is provided; returns None if insufficient information is provided. Prefered func...
4.343061
1.422746
3.05259
r'''Returns the heat capacity rate for the minimum stream having flows `mh` and `mc`, with averaged heat capacities `Cph` and `Cpc`. .. math:: C_c = m_cC_{p,c} C_h = m_h C_{p,h} C_{min} = \min(C_c, C_h) Parameters ---------- mh : float Mass flow rate of hot st...
def calc_Cmin(mh, mc, Cph, Cpc)
r'''Returns the heat capacity rate for the minimum stream having flows `mh` and `mc`, with averaged heat capacities `Cph` and `Cpc`. .. math:: C_c = m_cC_{p,c} C_h = m_h C_{p,h} C_{min} = \min(C_c, C_h) Parameters ---------- mh : float Mass flow rate of hot stream...
4.206584
1.184539
3.55124
r'''Returns the heat capacity rate for the maximum stream having flows `mh` and `mc`, with averaged heat capacities `Cph` and `Cpc`. .. math:: C_c = m_cC_{p,c} C_h = m_h C_{p,h} C_{max} = \max(C_c, C_h) Parameters ---------- mh : float Mass flow rate of hot st...
def calc_Cmax(mh, mc, Cph, Cpc)
r'''Returns the heat capacity rate for the maximum stream having flows `mh` and `mc`, with averaged heat capacities `Cph` and `Cpc`. .. math:: C_c = m_cC_{p,c} C_h = m_h C_{p,h} C_{max} = \max(C_c, C_h) Parameters ---------- mh : float Mass flow rate of hot stream...
4.199149
1.183514
3.548035
r'''Returns the heat capacity rate ratio for a heat exchanger having flows `mh` and `mc`, with averaged heat capacities `Cph` and `Cpc`. .. math:: C_r=C^*=\frac{C_{min}}{C_{max}} Parameters ---------- mh : float Mass flow rate of hot stream, [kg/s] mc : float Mass f...
def calc_Cr(mh, mc, Cph, Cpc)
r'''Returns the heat capacity rate ratio for a heat exchanger having flows `mh` and `mc`, with averaged heat capacities `Cph` and `Cpc`. .. math:: C_r=C^*=\frac{C_{min}}{C_{max}} Parameters ---------- mh : float Mass flow rate of hot stream, [kg/s] mc : float Mass flow ...
4.216474
1.218868
3.459335
r'''Basic helper calculator which accepts a transformed R1 and NTU1 as inputs for a common term used in the calculation of the P-NTU method for plate exchangers. Returns a value which is normally used in other calculations before the actual P1 is calculated. Nominally used in counterflow cal...
def Pc(x, y)
r'''Basic helper calculator which accepts a transformed R1 and NTU1 as inputs for a common term used in the calculation of the P-NTU method for plate exchangers. Returns a value which is normally used in other calculations before the actual P1 is calculated. Nominally used in counterflow calcula...
9.227976
1.214697
7.596935
'''Private function to hold the common objective function used by all backwards solvers for the P-NTU method. These methods are really hard on on floating points (overflows and divide by zeroes due to numbers really close to 1), so if the function fails, mpmath is imported and tried. ''' tr...
def _NTU_from_P_objective(NTU1, R1, P1, function, **kwargs)
Private function to hold the common objective function used by all backwards solvers for the P-NTU method. These methods are really hard on on floating points (overflows and divide by zeroes due to numbers really close to 1), so if the function fails, mpmath is imported and tried.
9.8213
3.354754
2.927576
'''Private function to solve the P-NTU method backwards, given the function to use, the upper and lower NTU bounds for consideration, and the desired P1 and R1 values. ''' P1_max = _NTU_from_P_objective(NTU_max, R1, 0, function, **kwargs) P1_min = _NTU_from_P_objective(NTU_min, R1, 0, function, ...
def _NTU_from_P_solver(P1, R1, NTU_min, NTU_max, function, **kwargs)
Private function to solve the P-NTU method backwards, given the function to use, the upper and lower NTU bounds for consideration, and the desired P1 and R1 values.
3.360674
2.420959
1.388158
'''Private function to calculate the upper bound on the NTU1 value in the P-NTU method. This value is calculated via a pade approximation obtained on the result of a global minimizer which calculated the maximum P1 at a given R1 from ~1E-7 to approximately 100. This should suffice for engineering a...
def _NTU_max_for_P_solver(data, R1)
Private function to calculate the upper bound on the NTU1 value in the P-NTU method. This value is calculated via a pade approximation obtained on the result of a global minimizer which calculated the maximum P1 at a given R1 from ~1E-7 to approximately 100. This should suffice for engineering applicat...
11.433998
2.460207
4.647576
''' >>> check_tubing_TEMA(2, 22) False >>> check_tubing_TEMA(0.375, 22) True ''' if NPS in TEMA_tubing: if BWG in TEMA_tubing[NPS]: return True return False
def check_tubing_TEMA(NPS=None, BWG=None)
>>> check_tubing_TEMA(2, 22) False >>> check_tubing_TEMA(0.375, 22) True
3.029888
2.096896
1.44494
r'''Looks up the recommended clearance between a shell and tube bundle in a TEMA HX [1]. Either the bundle diameter or the shell diameter are needed provided. Parameters ---------- DBundle : float, optional Outer diameter of tube bundle, [m] DShell : float, optional Shell ...
def shell_clearance(DBundle=None, DShell=None)
r'''Looks up the recommended clearance between a shell and tube bundle in a TEMA HX [1]. Either the bundle diameter or the shell diameter are needed provided. Parameters ---------- DBundle : float, optional Outer diameter of tube bundle, [m] DShell : float, optional Shell inne...
3.16262
1.576055
2.006669
r'''Determines the thickness of baffles and support plates in TEMA HX [1]_. Applies to latitudinal baffles along the diameter of the HX, but not longitudinal baffles parallel to the tubes. Parameters ---------- Dshell : float Shell inner diameter, [m] L_unsupported : float D...
def baffle_thickness(Dshell, L_unsupported, service='C')
r'''Determines the thickness of baffles and support plates in TEMA HX [1]_. Applies to latitudinal baffles along the diameter of the HX, but not longitudinal baffles parallel to the tubes. Parameters ---------- Dshell : float Shell inner diameter, [m] L_unsupported : float Dista...
3.217988
1.4348
2.242814
r'''Determines the diameter of holes in baffles for tubes according to TEMA [1]_. Applies for all geometries. Parameters ---------- do : float Tube outer diameter, [m] L_unsupported : float Distance between tube supports, [m] Returns ------- dB : float Baffl...
def D_baffle_holes(do=None, L_unsupported=None)
r'''Determines the diameter of holes in baffles for tubes according to TEMA [1]_. Applies for all geometries. Parameters ---------- do : float Tube outer diameter, [m] L_unsupported : float Distance between tube supports, [m] Returns ------- dB : float Baffle ho...
4.086905
1.773481
2.304453
r'''Determines the maximum length of a heat exchanger tube can go without a support, acording to TEMA [1]_. The limits provided apply for the worst-case temperature allowed for the material to be used at. Parameters ---------- Do : float Outer tube diameter, [m] material : str ...
def L_unsupported_max(Do, material='CS')
r'''Determines the maximum length of a heat exchanger tube can go without a support, acording to TEMA [1]_. The limits provided apply for the worst-case temperature allowed for the material to be used at. Parameters ---------- Do : float Outer tube diameter, [m] material : str ...
8.045678
1.644888
4.891323
r'''Determine the bundle diameter required to fit a specified number of tubes in a heat exchanger. Uses the highly accurate method of [1]_, which takes into account pitch, number of tube passes, angle, and tube diameter. The method is analytically correct when used in the other direction (calculati...
def DBundle_for_Ntubes_Phadkeb(Ntubes, Do, pitch, Ntp, angle=30)
r'''Determine the bundle diameter required to fit a specified number of tubes in a heat exchanger. Uses the highly accurate method of [1]_, which takes into account pitch, number of tube passes, angle, and tube diameter. The method is analytically correct when used in the other direction (calculating n...
5.331151
1.764784
3.020852
r'''A rough equation presented in the HEDH for estimating the number of tubes in a tube bundle of differing geometries and tube sizes. No accuracy estimation given. Only 1 pass is supported. .. math:: N = \frac{0.78(D_{bundle} - D_o)^2}{C_1(\text{pitch})^2} C1 = 0.866 for 30° and 6...
def Ntubes_HEDH(DBundle=None, Do=None, pitch=None, angle=30)
r'''A rough equation presented in the HEDH for estimating the number of tubes in a tube bundle of differing geometries and tube sizes. No accuracy estimation given. Only 1 pass is supported. .. math:: N = \frac{0.78(D_{bundle} - D_o)^2}{C_1(\text{pitch})^2} C1 = 0.866 for 30° and 60° l...
4.2245
1.396267
3.025567
r'''A rough equation presented in the HEDH for estimating the tube bundle diameter necessary to fit a given number of tubes. No accuracy estimation given. Only 1 pass is supported. .. math:: D_{bundle} = (D_o + (\text{pitch})\sqrt{\frac{1}{0.78}}\cdot \sqrt{C_1\cdot N}) C1 = 0.86...
def DBundle_for_Ntubes_HEDH(N, Do, pitch, angle=30)
r'''A rough equation presented in the HEDH for estimating the tube bundle diameter necessary to fit a given number of tubes. No accuracy estimation given. Only 1 pass is supported. .. math:: D_{bundle} = (D_o + (\text{pitch})\sqrt{\frac{1}{0.78}}\cdot \sqrt{C_1\cdot N}) C1 = 0.866 fo...
4.654512
1.350978
3.445292
r'''Returns thermal conductivity of a building or insulating material from a table in [1]_. Thermal conductivity is independent of temperature here. Many entries in the table are listed for varying densities, but the appropriate ID from the table must be selected to account for that. Parameters ...
def ASHRAE_k(ID)
r'''Returns thermal conductivity of a building or insulating material from a table in [1]_. Thermal conductivity is independent of temperature here. Many entries in the table are listed for varying densities, but the appropriate ID from the table must be selected to account for that. Parameters ---...
5.61422
1.717029
3.269729
r'''Returns thermal conductivity of a refractory material from a table in [1]_. Here, thermal conductivity is a function of temperature between 673.15 K and 1473.15 K according to linear interpolation among 5 equally-spaced points. Here, thermal conductivity is not a function of porosity, which can ...
def refractory_VDI_k(ID, T=None)
r'''Returns thermal conductivity of a refractory material from a table in [1]_. Here, thermal conductivity is a function of temperature between 673.15 K and 1473.15 K according to linear interpolation among 5 equally-spaced points. Here, thermal conductivity is not a function of porosity, which can affe...
3.528277
1.371941
2.571741
r'''Returns heat capacity of a refractory material from a table in [1]_. Here, heat capacity is a function of temperature between 673.15 K and 1473.15 K according to linear interpolation among 5 equally-spaced points. Here, heat capacity is not a function of porosity, affects it. If T is outside the...
def refractory_VDI_Cp(ID, T=None)
r'''Returns heat capacity of a refractory material from a table in [1]_. Here, heat capacity is a function of temperature between 673.15 K and 1473.15 K according to linear interpolation among 5 equally-spaced points. Here, heat capacity is not a function of porosity, affects it. If T is outside the acc...
3.757257
1.373422
2.735691
r'''Returns the nearest hit to a given name from from dictionaries of building, insulating, or refractory material from tables in [1]_, [2]_, and [3]_. Function will pick the closest match based on a fuzzy search. if `complete` is True, will only return hits with all three of density, heat capacity,...
def nearest_material(name, complete=False)
r'''Returns the nearest hit to a given name from from dictionaries of building, insulating, or refractory material from tables in [1]_, [2]_, and [3]_. Function will pick the closest match based on a fuzzy search. if `complete` is True, will only return hits with all three of density, heat capacity, and...
4.391473
1.410041
3.114429
r'''Returns thermal conductivity of a building, insulating, or refractory material from tables in [1]_, [2]_, and [3]_. Thermal conductivity may or may not be dependent on temperature depending on the source used. Function must be provided with either a key to one of the dictionaries `refractories`...
def k_material(ID, T=298.15)
r'''Returns thermal conductivity of a building, insulating, or refractory material from tables in [1]_, [2]_, and [3]_. Thermal conductivity may or may not be dependent on temperature depending on the source used. Function must be provided with either a key to one of the dictionaries `refractories`, `A...
5.39936
1.316847
4.100217
r'''Returns the density of a building, insulating, or refractory material from tables in [1]_, [2]_, and [3]_. No temperature dependence is available. Function must be provided with either a key to one of the dictionaries `refractories`, `ASHRAE`, or `building_materials` - or a search term which wi...
def rho_material(ID)
r'''Returns the density of a building, insulating, or refractory material from tables in [1]_, [2]_, and [3]_. No temperature dependence is available. Function must be provided with either a key to one of the dictionaries `refractories`, `ASHRAE`, or `building_materials` - or a search term which will p...
5.534065
1.432816
3.862369
r'''Returns heat capacity of a building, insulating, or refractory material from tables in [1]_, [2]_, and [3]_. Heat capacity may or may not be dependent on temperature depending on the source used. Function must be provided with either a key to one of the dictionaries `refractories`, `ASHRAE`, or...
def Cp_material(ID, T=298.15)
r'''Returns heat capacity of a building, insulating, or refractory material from tables in [1]_, [2]_, and [3]_. Heat capacity may or may not be dependent on temperature depending on the source used. Function must be provided with either a key to one of the dictionaries `refractories`, `ASHRAE`, or `bu...
5.5301
1.5207
3.63655
r'''Calculates average internal convection Nusselt number for laminar flows in pipe during the thermal entry region according to [1]_ as shown in [2]_ and cited by [3]_. .. math:: Nu_D=3.66+\frac{0.0668\frac{D}{L}Re_{D}Pr}{1+0.04{(\frac{D}{L} Re_{D}Pr)}^{2/3}} Parameters ------...
def laminar_entry_thermal_Hausen(Re=None, Pr=None, L=None, Di=None)
r'''Calculates average internal convection Nusselt number for laminar flows in pipe during the thermal entry region according to [1]_ as shown in [2]_ and cited by [3]_. .. math:: Nu_D=3.66+\frac{0.0668\frac{D}{L}Re_{D}Pr}{1+0.04{(\frac{D}{L} Re_{D}Pr)}^{2/3}} Parameters ----------...
7.553864
1.221533
6.183919
r'''Calculates average internal convection Nusselt number for laminar flows in pipe during the thermal and velocity entry region according to [1]_ as shown in [2]_. .. math:: Nu_D=\frac{\frac{3.657}{\tanh[2.264 Gz_D^{-1/3}+1.7Gz_D^{-2/3}]} +0.0499Gz_D\tanh(Gz_D^{-1})}{\tanh(2.432Pr^{1/6...
def laminar_entry_Baehr_Stephan(Re=None, Pr=None, L=None, Di=None)
r'''Calculates average internal convection Nusselt number for laminar flows in pipe during the thermal and velocity entry region according to [1]_ as shown in [2]_. .. math:: Nu_D=\frac{\frac{3.657}{\tanh[2.264 Gz_D^{-1/3}+1.7Gz_D^{-2/3}]} +0.0499Gz_D\tanh(Gz_D^{-1})}{\tanh(2.432Pr^{1/6}Gz_...
4.787593
1.262095
3.793369
r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [1]_ and supposedly [2]_. .. math:: Nu = 0.027Re^{4/5}Pr^{1/3}\left(\frac{\mu}{\mu_s}\right)^{0.14} Parameters ---------- Re : float Reynolds number, [-] Pr : float Prandtl nu...
def turbulent_Sieder_Tate(Re, Pr, mu=None, mu_w=None)
r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [1]_ and supposedly [2]_. .. math:: Nu = 0.027Re^{4/5}Pr^{1/3}\left(\frac{\mu}{\mu_s}\right)^{0.14} Parameters ---------- Re : float Reynolds number, [-] Pr : float Prandtl number...
3.908607
1.179308
3.314321
r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [2]_ as in [1]_. .. math:: Nu = \frac{(f/8)Re Pr}{1 + 5(f/8)^{0.5}\left[Pr-1+\ln\left(\frac{5Pr+1} {6}\right)\right]} Parameters ---------- Re : float Reynolds number, [-] Pr ...
def turbulent_von_Karman(Re, Pr, fd)
r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [2]_ as in [1]_. .. math:: Nu = \frac{(f/8)Re Pr}{1 + 5(f/8)^{0.5}\left[Pr-1+\ln\left(\frac{5Pr+1} {6}\right)\right]} Parameters ---------- Re : float Reynolds number, [-] Pr : fl...
4.422886
1.219863
3.625725
r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [2]_ as in [1]_. .. math:: Nu = \frac{(f/8)RePr}{1.2 + 11.8(f/8)^{0.5}(Pr-1)Pr^{-1/3}} Parameters ---------- Re : float Reynolds number, [-] Pr : float Prandtl number, [-] ...
def turbulent_Friend_Metzner(Re, Pr, fd)
r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [2]_ as in [1]_. .. math:: Nu = \frac{(f/8)RePr}{1.2 + 11.8(f/8)^{0.5}(Pr-1)Pr^{-1/3}} Parameters ---------- Re : float Reynolds number, [-] Pr : float Prandtl number, [-] fd ...
4.602576
1.173034
3.923651
r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [2]_ as in [1]_. .. math:: Nu = \frac{(f/8)RePr}{1.07 + 9(f/8)^{0.5}(Pr-1)Pr^{1/4}} Parameters ---------- Re : float Reynolds number, [-] Pr : float Prandtl number, [-] fd...
def turbulent_Webb(Re, Pr, fd)
r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [2]_ as in [1]_. .. math:: Nu = \frac{(f/8)RePr}{1.07 + 9(f/8)^{0.5}(Pr-1)Pr^{1/4}} Parameters ---------- Re : float Reynolds number, [-] Pr : float Prandtl number, [-] fd : f...
4.940421
1.169845
4.223143
r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [2]_ as in [1]_. .. math:: Nu = \frac{(f/8)RePr}{12.48Pr^{2/3} - 7.853Pr^{1/3} + 3.613\ln Pr + 5.8 + C}\\ C = 2.78\ln((f/8)^{0.5} Re/45) Parameters ---------- Re : float Reynolds ...
def turbulent_Sandall(Re, Pr, fd)
r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [2]_ as in [1]_. .. math:: Nu = \frac{(f/8)RePr}{12.48Pr^{2/3} - 7.853Pr^{1/3} + 3.613\ln Pr + 5.8 + C}\\ C = 2.78\ln((f/8)^{0.5} Re/45) Parameters ---------- Re : float Reynolds numb...
4.202618
1.183778
3.550173
r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [2]_ as shown in [1]_. .. math:: Nu = \frac{RePr(f/8)^{0.5}}{5[Pr + \ln(1+5Pr) + 0.5\ln(Re(f/8)^{0.5}/60)]} Parameters ---------- Re : float Reynolds number, [-] Pr : float P...
def turbulent_Martinelli(Re, Pr, fd)
r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [2]_ as shown in [1]_. .. math:: Nu = \frac{RePr(f/8)^{0.5}}{5[Pr + \ln(1+5Pr) + 0.5\ln(Re(f/8)^{0.5}/60)]} Parameters ---------- Re : float Reynolds number, [-] Pr : float Prand...
4.614817
1.245925
3.703928
r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [2]_ as shown in [1]_. .. math:: Nu = \frac{RePr(f/8)}{1 + 1.5Re^{-1/8}Pr^{-1/6}[Pr(f/f_s)-1]} Parameters ---------- Re : float Reynolds number, [-] Pr : float Prandtl number,...
def turbulent_Nunner(Re, Pr, fd, fd_smooth)
r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [2]_ as shown in [1]_. .. math:: Nu = \frac{RePr(f/8)}{1 + 1.5Re^{-1/8}Pr^{-1/6}[Pr(f/f_s)-1]} Parameters ---------- Re : float Reynolds number, [-] Pr : float Prandtl number, [-]...
5.538311
1.254736
4.413926
r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [2]_ as shown in [1]_. .. math:: Nu = \frac{RePr(f/8)}{1 + (f/8)^{0.5}[5.19Re_\epsilon^{0.2} Pr^{0.44} - 8.48]} Parameters ---------- Re : float Reynolds number, [-] Pr : float ...
def turbulent_Dipprey_Sabersky(Re, Pr, fd, eD)
r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [2]_ as shown in [1]_. .. math:: Nu = \frac{RePr(f/8)}{1 + (f/8)^{0.5}[5.19Re_\epsilon^{0.2} Pr^{0.44} - 8.48]} Parameters ---------- Re : float Reynolds number, [-] Pr : float Pr...
3.91324
1.22344
3.198556
r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [2]_ as shown in [1]_. .. math:: Nu = \frac{Re Pr (f/8)^{0.5}} {4.5 + [0.155(Re(f/8)^{0.5})^{0.54} + (8/f)^{0.5}]Pr^{0.5}} Parameters ---------- Re : float Reynolds number, [-] ...
def turbulent_Gowen_Smith(Re, Pr, fd)
r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [2]_ as shown in [1]_. .. math:: Nu = \frac{Re Pr (f/8)^{0.5}} {4.5 + [0.155(Re(f/8)^{0.5})^{0.54} + (8/f)^{0.5}]Pr^{0.5}} Parameters ---------- Re : float Reynolds number, [-] Pr...
3.710386
1.181464
3.140499
r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [2]_ as shown in [1]_. The most widely used rough pipe turbulent correlation. .. math:: Nu_D = \frac{(f/8)Re_DPr}{1+\sqrt{f/8}(4.5Re_{\epsilon}^{0.2}Pr^{0.5}-8.48)} Parameters ---------- Re :...
def turbulent_Bhatti_Shah(Re, Pr, fd, eD)
r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [2]_ as shown in [1]_. The most widely used rough pipe turbulent correlation. .. math:: Nu_D = \frac{(f/8)Re_DPr}{1+\sqrt{f/8}(4.5Re_{\epsilon}^{0.2}Pr^{0.5}-8.48)} Parameters ---------- Re : flo...
5.6986
1.251517
4.553352
'''Setup perspective base class Arguments: data : dataframe/list/dict The static or live datasource Keyword Arguments: view : str or View what view to use. available in the enum View (default: {'hypergrid'}) columns : list of ...
def setup(self, data, view='hypergrid', schema=None, columns=None, rowpivots=None, columnpivots=None, aggregates=None, sort=None, index='', limit=-1, computedcolumns=...
Setup perspective base class Arguments: data : dataframe/list/dict The static or live datasource Keyword Arguments: view : str or View what view to use. available in the enum View (default: {'hypergrid'}) columns : list of str ...
3.249951
1.424097
2.282114
r'''Returns the thermal conductivity of a substance given its R-value, which can be in either SI units of m^2 K/(W*inch) or the Imperial units of ft^2 deg F*h/(BTU*inch). Parameters ---------- R_value : float R-value of a substance [m^2 K/(W*inch) or ft^2 deg F*h/(BTU*inch)] SI : bo...
def R_value_to_k(R_value, SI=True)
r'''Returns the thermal conductivity of a substance given its R-value, which can be in either SI units of m^2 K/(W*inch) or the Imperial units of ft^2 deg F*h/(BTU*inch). Parameters ---------- R_value : float R-value of a substance [m^2 K/(W*inch) or ft^2 deg F*h/(BTU*inch)] SI : bool, ...
3.811091
1.347392
2.828494
r'''Returns the R-value of a substance given its thermal conductivity, Will return R-value in SI units unless SI is false. SI units are m^2 K/(W*inch); Imperial units of R-value are ft^2 deg F*h/(BTU*inch). Parameters ---------- k : float Thermal conductivity of a substance [W/m/K] ...
def k_to_R_value(k, SI=True)
r'''Returns the R-value of a substance given its thermal conductivity, Will return R-value in SI units unless SI is false. SI units are m^2 K/(W*inch); Imperial units of R-value are ft^2 deg F*h/(BTU*inch). Parameters ---------- k : float Thermal conductivity of a substance [W/m/K] SI :...
3.250199
1.39611
2.328039
r'''Returns the thermal resistance `R` of a cylinder of constant thermal conductivity `k`, of inner and outer diameter `Di` and `Do`, and with a length `L`. .. math:: (hA)_{\text{cylinder}}=\frac{k}{\ln(D_o/D_i)} \cdot 2\pi L\\ R_{\text{cylinder}}=\frac{1}{(hA)_{\text{cylinder}}}= ...
def R_cylinder(Di, Do, k, L)
r'''Returns the thermal resistance `R` of a cylinder of constant thermal conductivity `k`, of inner and outer diameter `Di` and `Do`, and with a length `L`. .. math:: (hA)_{\text{cylinder}}=\frac{k}{\ln(D_o/D_i)} \cdot 2\pi L\\ R_{\text{cylinder}}=\frac{1}{(hA)_{\text{cylinder}}}= \...
3.663661
1.236876
2.962028
r'''Returns the Shape factor `S` of a pipe of constant outer temperature and of outer diameter `D1` which is `w` distance from another infinite pipe of outer diameter`D2`. Length `L` must be provided, but can be set to 1 to obtain a dimensionless shape factor used in some sources. .. math:: ...
def S_isothermal_pipe_to_isothermal_pipe(D1, D2, W, L=1.)
r'''Returns the Shape factor `S` of a pipe of constant outer temperature and of outer diameter `D1` which is `w` distance from another infinite pipe of outer diameter`D2`. Length `L` must be provided, but can be set to 1 to obtain a dimensionless shape factor used in some sources. .. math:: S =...
5.663794
1.167713
4.850331
r'''Returns the Shape factor `S` of a pipe of constant outer temperature and of outer diameter `D` which is `Z` distance from two infinite isothermal planes of equal temperatures, parallel to each other and enclosing the pipe. Length `L` must be provided, but can be set to 1 to obtain a dimensionles...
def S_isothermal_pipe_to_two_planes(D, Z, L=1.)
r'''Returns the Shape factor `S` of a pipe of constant outer temperature and of outer diameter `D` which is `Z` distance from two infinite isothermal planes of equal temperatures, parallel to each other and enclosing the pipe. Length `L` must be provided, but can be set to 1 to obtain a dimensionless sh...
7.67907
1.141035
6.729915
r'''Returns the Shape factor `S` of a pipe of constant outer temperature and of outer diameter `D1` which is `Z` distance from the center of another pipe of outer diameter`D2`. Length `L` must be provided, but can be set to 1 to obtain a dimensionless shape factor used in some sources. .. math:: ...
def S_isothermal_pipe_eccentric_to_isothermal_pipe(D1, D2, Z, L=1.)
r'''Returns the Shape factor `S` of a pipe of constant outer temperature and of outer diameter `D1` which is `Z` distance from the center of another pipe of outer diameter`D2`. Length `L` must be provided, but can be set to 1 to obtain a dimensionless shape factor used in some sources. .. math:: ...
5.474336
1.157783
4.728292
r'''Returns the log-mean temperature difference of an ideal counterflow or co-current heat exchanger. .. math:: \Delta T_{LMTD}=\frac{\Delta T_1-\Delta T_2}{\ln(\Delta T_1/\Delta T_2)} \text{For countercurrent: } \\ \Delta T_1=T_{h,i}-T_{c,o}\\ \Delta T_2=T_{h,o}-T_{c,...
def LMTD(Thi, Tho, Tci, Tco, counterflow=True)
r'''Returns the log-mean temperature difference of an ideal counterflow or co-current heat exchanger. .. math:: \Delta T_{LMTD}=\frac{\Delta T_1-\Delta T_2}{\ln(\Delta T_1/\Delta T_2)} \text{For countercurrent: } \\ \Delta T_1=T_{h,i}-T_{c,o}\\ \Delta T_2=T_{h,o}-T_{c,i} ...
3.304567
1.197004
2.760699
m.convert(kml_path, output_dir, separate_folders, style_type, style_filename)
def k2g(kml_path, output_dir, separate_folders, style_type, style_filename)
Given a path to a KML file, convert it to a a GeoJSON FeatureCollection file and save it to the given output directory. If ``--separate_folders``, then create several GeoJSON files, one for each folder in the KML file that contains geodata or that has a descendant node that contains geodata. Warning: this can ...
2.796977
4.139728
0.675643
for p in paths: p = Path(p) if p.exists(): if p.is_file(): p.unlink() else: shutil.rmtree(str(p))
def rm_paths(*paths)
Delete the given file paths/directory paths, if they exists.
2.082214
2.037102
1.022145
els = get(node, 'gx:coord') coordinates = [] times = [] coordinates = [gx_coords1(val(el)) for el in els] time_els = get(node, 'when') times = [val(t) for t in time_els] return { 'coordinates': coordinates, 'times': times, }
def gx_coords(node)
Given a KML DOM node, grab its <gx:coord> and <gx:timestamp><when>subnodes, and convert them into a dictionary with the keys and values - ``'coordinates'``: list of lists of float coordinates - ``'times'``: list of timestamps corresponding to the coordinates
5.263859
4.129273
1.274766
names_seen = set() new_names = [] for name in names: new_name = name while new_name in names_seen: new_name += mark new_names.append(new_name) names_seen.add(new_name) return new_names
def disambiguate(names, mark='1')
Given a list of strings ``names``, return a new list of names where repeated names have been disambiguated by repeatedly appending the given mark. EXAMPLE:: >>> disambiguate(['sing', 'song', 'sing', 'sing']) ['sing', 'song', 'sing1', 'sing11']
1.940132
2.429233
0.79866
s = re.sub(r'(?u)[^-\w. ]', '', s) s = s.strip().replace(' ', '_') return s
def to_filename(s)
Based on `django/utils/text.py <https://github.com/django/django/blob/master/django/utils/text.py>`_. Return the given string converted to a string that can be used for a clean filename. Specifically, leading and trailing spaces are removed; other spaces are converted to underscores, and anything that is not a ...
2.735735
4.368862
0.626189
# Set defaults color = '000000' opacity = 1 if s.startswith('#'): s = s[1:] if len(s) == 8: color = s[6:8] + s[4:6] + s[2:4] opacity = round(int(s[0:2], 16)/256, 2) elif len(s) == 6: color = s[4:6] + s[2:4] + s[0:2] elif len(s) == 3: color = s[::...
def build_rgb_and_opacity(s)
Given a KML color string, return an equivalent RGB hex color string and an opacity float rounded to 2 decimal places. EXAMPLE:: >>> build_rgb_and_opacity('ee001122') ('#221100', 0.93)
2.150094
2.354629
0.913135
d = {} for item in get(node, 'Style'): style_id = '#' + attr(item, 'id') # Create style properties props = {} for x in get(item, 'PolyStyle'): color = val(get1(x, 'color')) if color: rgb, opacity = build_rgb_and_opacity(color) ...
def build_svg_style(node)
Given a DOM node, grab its top-level Style nodes, convert every one into a SVG style dictionary, put them in a master dictionary of the form #style ID -> SVG style dictionary, and return the result. The possible keys and values of each SVG style dictionary, the style options, are - ``iconUrl``: ...
2.280214
2.270218
1.004403
geoms = [] times = [] if get1(node, 'MultiGeometry'): return build_geometry(get1(node, 'MultiGeometry')) if get1(node, 'MultiTrack'): return build_geometry(get1(node, 'MultiTrack')) if get1(node, 'gx:MultiTrack'): return build_geometry(get1(node, 'gx:MultiTrack')) fo...
def build_geometry(node)
Return a (decoded) GeoJSON geometry dictionary corresponding to the given KML node.
2.296679
2.110054
1.088446
geoms_and_times = build_geometry(node) if not geoms_and_times['geoms']: return None props = {} for x in get(node, 'name')[:1]: name = val(x) if name: props['name'] = val(x) for x in get(node, 'description')[:1]: desc = val(x) if desc: ...
def build_feature(node)
Build and return a (decoded) GeoJSON Feature corresponding to this KML node (typically a KML Placemark). Return ``None`` if no Feature can be built.
1.83291
1.755381
1.044166
# Initialize geojson = { 'type': 'FeatureCollection', 'features': [], } # Build features for placemark in get(node, 'Placemark'): feature = build_feature(placemark) if feature is not None: geojson['features'].append(feature) # Give the collection a ...
def build_feature_collection(node, name=None)
Build and return a (decoded) GeoJSON FeatureCollection corresponding to this KML DOM node (typically a KML Folder). If a name is given, store it in the FeatureCollection's ``'name'`` attribute.
2.724434
2.596094
1.049436
layers = [] names = [] for i, folder in enumerate(get(node, 'Folder')): name = val(get1(folder, 'name')) geojson = build_feature_collection(folder, name) if geojson['features']: layers.append(geojson) names.append(name) if not layers: # No fo...
def build_layers(node, disambiguate_names=True)
Return a list of GeoJSON FeatureCollections, one for each folder in the given KML DOM node that contains geodata. Name each FeatureCollection (via a ``'name'`` attribute) according to its corresponding KML folder name. If ``disambiguate_names == True``, then disambiguate repeated layer names via :func:`disambi...
2.600044
2.181158
1.192048
# Create absolute paths kml_path = Path(kml_path).resolve() output_dir = Path(output_dir) if not output_dir.exists(): output_dir.mkdir() output_dir = output_dir.resolve() # Parse KML with kml_path.open(encoding='utf-8', errors='ignore') as src: kml_str = src.read() ...
def convert(kml_path, output_dir, separate_folders=False, style_type=None, style_filename='style.json')
Given a path to a KML file, convert it to one or several GeoJSON FeatureCollection files and save the result(s) to the given output directory. If not ``separate_folders`` (the default), then create one GeoJSON file. Otherwise, create several GeoJSON files, one for each folder in the KML file that contains geod...
2.63801
2.638134
0.999953
perms = [] for tool in tools: perms.append((_get_permission_codename(tool, opts), 'Can %s %s' % \ (tool.name, opts.verbose_name_plural))) return perms
def _get_all_permissions(opts, tools)
Returns (codename, name) for all tools.
3.692039
2.877707
1.282979
from django.contrib.contenttypes.models import ContentType object_tools.autodiscover() tools = object_tools.tools._registry # This will hold the permissions we're looking for as # (content_type, (codename, name)) searched_perms = list() # The codenames and ctypes that should exist. ...
def _create_permissions(**kwargs)
Almost exactly the same as django.contrib.auth.management.__init__.py
3.528265
3.444979
1.024176
c = self.db.cursor() c.execute('''SELECT username, password, fullname FROM users WHERE rowid >= (abs(random()) % (SELECT max(rowid) FROM users)) LIMIT 1''') r = c.fetchone() return {"username": r[0], "password": r[1], "fullname": r[2]}
def get_random_user(self)
Gets a random user from the provider :returns: Dictionary
3.231367
3.592592
0.899453
if self.driver.is_element_present(locator): if self.driver.is_visible(locator): return True else: return False else: return False
def is_element_available(self, locator)
Synchronization method for making sure the element we're looking for is not only on the page, but also visible -- since Se will happily deal with things that aren't visible. Use this instead of is_element_present most of the time.
2.601768
2.459659
1.057776
for i in range(timeout_seconds): try: if self.is_element_available(locator): break except: pass time.sleep(1) else: raise ElementVisiblityTimeout("%s availability timed out" % locator) re...
def wait_for_available(self, locator)
Synchronization to deal with elements that are present, and are visible :raises: ElementVisiblityTimeout
3.975651
3.312997
1.200016
for i in range(timeout_seconds): try: if self.driver.is_visible(locator): break except: pass time.sleep(1) else: raise ElementVisiblityTimeout("%s visibility timed out" % locator) return ...
def wait_for_visible(self, locator)
Synchronization to deal with elements that are present, but are disabled until some action triggers their visibility. :raises: ElementVisiblityTimeout
3.740293
3.187049
1.173591
for i in range(timeout_seconds): try: e = self.driver.find_element_by_locator(locator) if e.text == text: break except: pass time.sleep(1) else: raise ElementTextTimeout("%s value...
def wait_for_text(self, locator, text)
Synchronization on some text being displayed in a particular element. :raises: ElementVisiblityTimeout
3.583296
3.679289
0.97391
for i in range(timeout_seconds): if self.driver.is_element_present(locator): time.sleep(1) else: break else: raise ElementVisiblityTimeout("%s presence timed out" % locator) return True
def wait_for_element_not_present(self, locator)
Synchronization helper to wait until some element is removed from the page :raises: ElementVisiblityTimeout
4.337188
3.518638
1.232633
if not hasattr(tool_class, 'name'): raise ImproperlyConfigured("No 'name' attribute found for tool %s." % ( tool_class.__name__ )) if not hasattr(tool_class, 'label'): raise ImproperlyConfigured("No 'label' attribute found for tool %s." % ( tool_class.__name...
def validate(tool_class, model_class)
Does basic ObjectTool option validation.
1.96966
1.911886
1.030218
if not object_tool_class: return None # Don't validate unless required. if object_tool_class and settings.DEBUG: from object_tools.validation import validate validate(object_tool_class, model_class) # = lambda model, adminclass: None ...
def register(self, object_tool_class, model_class=None)
Registers the given model(s) with the given object tool class. The model(s) should be Model classes, not instances. If a model class isn't given the object tool class will be registered for all models. If a model is already registered, this will raise AlreadyRegistered. If a ...
3.853171
3.686951
1.045083
choices = string.letters + ' ' text = [] if not random_length: random_length = random.randint(1, 30) for x in range(random_length): text.append(random.choice(choices)) return "".join(text)
def random_string(random_length=None)
A generator for creating random string data of letters plus ' ' (whitespace) :params random_length: how many characters of random string data. if not provided, will be between 1 - 30 :returns: String
2.756722
2.872094
0.95983
if not hasattr(self, 'form_class'): return None if request.method == 'POST': form = self.form_class(self.model, request.POST, request.FILES) else: form = self.form_class(self.model) return form
def construct_form(self, request)
Constructs form from POST method using self.form_class.
2.160385
2.036785
1.060684
return user.has_perm( self.model._meta.app_label + '.' + self.get_permission() )
def has_permission(self, user)
Returns True if the given request has permission to use the tool. Can be overriden by the user in subclasses.
4.087102
3.727536
1.096462
js = ['admin/js/core.js', 'admin/js/admin/RelatedObjectLookups.js', 'admin/js/jquery.min.js', 'admin/js/jquery.init.js'] media = forms.Media( js=['%s%s' % (settings.STATIC_URL, u) for u in js], ) if form: for name, field in form.fields.ite...
def media(self, form)
Collects admin and form media.
3.128918
2.781334
1.12497
info = ( self.model._meta.app_label, self.model._meta.model_name, self.name, ) urlpatterns = [ url(r'^%s/$' % self.name, self._view, name='%s_%s_%s' % info) ] return urlpatterns
def _urls(self)
URL patterns for tool linked to _view method.
3.134411
2.478342
1.264721
opts = self.model._meta app_label = opts.app_label object_name = opts.object_name.lower() form = self.construct_form(request) media = self.media(form) context = { 'user': request.user, 'title': '%s %s' % (self.label, opts.verbose_name_plu...
def construct_context(self, request)
Builds context with various required variables.
3.231165
3.260185
0.991098
if not self.has_permission(request.user): raise PermissionDenied return self.view(request, self.construct_context(request))
def _view(self, request, extra_context=None)
View wrapper taking care of houskeeping for painless form rendering.
5.149444
4.928164
1.044901
l = [] for row in self.data: l.append(row) return random.choice(l)
def randomRow(self)
Gets a random row from the provider :returns: List
4.392075
4.760265
0.922653
from provider.models import User u = User.objects.order_by('?')[0] return {"username": u.username, "password": u.password, "fullname": u.fullname}
def get_random_user(self)
Gets a random user from the provider :returns: Dictionary
4.284499
4.1011
1.044719
try: self.assert_equal(first, second, msg) except AssertionError, e: if msg: m = "%s:\n%s" % (msg, str(e)) else: m = str(e) self.verification_erorrs.append(m)
def verify_equal(self, first, second, msg="")
Soft assert for equality :params want: the value to compare against :params second: the value to compare with :params msg: (Optional) msg explaining the difference
3.158164
3.322117
0.950648
try: self.assert_not_equal(first, second, msg) except AssertionError, e: if msg: m = "%s:\n%s" % (msg, str(e)) else: m = str(e) self.verification_erorrs.append(m)
def verify_not_equal(self, first, second, msg="")
Soft assert for inequality :params want: the value to compare against :params second: the value to compare with :params msg: (Optional) msg explaining the difference
3.169979
3.326348
0.952991
try: self.assert_true(expr, msg) except AssertionError, e: if msg: m = "%s:\n%s" % (msg, str(e)) else: m = str(e) self.verification_erorrs.append(m)
def verify_true(self, expr, msg=None)
Soft assert for whether the condition is true :params expr: the statement to evaluate :params msg: (Optional) msg explaining the difference
3.148175
3.353883
0.938666
try: self.assert_false(expr, msg) except AssertionError, e: if msg: m = "%s:\n%s" % (msg, str(e)) else: m = str(e) self.verification_erorrs.append(m)
def verify_false(self, expr, msg=None)
Soft assert for whether the condition is false :params expr: the statement to evaluate :params msg: (Optional) msg explaining the difference
3.226755
3.431707
0.940277
try: self.assert_is(first, second, msg) except AssertionError, e: if msg: m = "%s:\n%s" % (msg, str(e)) else: m = str(e) self.verification_erorrs.append(m)
def verify_is(self, first, second, msg=None)
Soft assert for whether the parameters evaluate to the same object :params want: the object to compare against :params second: the object to compare with :params msg: (Optional) msg explaining the difference
3.21235
3.4224
0.938625
try: self.assert_is_not(first, second, msg) except AssertionError, e: if msg: m = "%s:\n%s" % (msg, str(e)) else: m = str(e) self.verification_erorrs.append(m)
def verify_is_not(self, first, second, msg=None)
Soft assert for whether the parameters do not evaluate to the same object :params want: the object to compare against :params second: the object to compare with :params msg: (Optional) msg explaining the difference
3.164097
3.286997
0.96261
try: self.assert_is_none(expr, msg) except AssertionError, e: if msg: m = "%s:\n%s" % (msg, str(e)) else: m = str(e) self.verification_erorrs.append(m)
def verify_is_none(self, expr, msg=None)
Soft assert for whether the expr is None :params want: the object to compare against :params second: the object to compare with :params msg: (Optional) msg explaining the difference
3.064553
3.354343
0.913607
try: self.assert_is_not_none(expr, msg) except AssertionError, e: if msg: m = "%s:\n%s" % (msg, str(e)) else: m = str(e) self.verification_erorrs.append(m)
def verify_is_not_none(self, expr, msg=None)
Soft assert for whether the expr is not None :params want: the object to compare against :params second: the object to compare with :params msg: (Optional) msg explaining the difference
2.97307
3.251431
0.914388
try: self.assert_in(first, second, msg) except AssertionError, e: if msg: m = "%s:\n%s" % (msg, str(e)) else: m = str(e) self.verification_erorrs.append(m)
def verify_in(self, first, second, msg="")
Soft assert for whether the first is in second :params first: the value to check :params second: the container to check in :params msg: (Optional) msg explaining the difference
3.317764
3.333197
0.99537
try: self.assert_not_in(first, second, msg) except AssertionError, e: if msg: m = "%s:\n%s" % (msg, str(e)) else: m = str(e) self.verification_erorrs.append(m)
def verify_not_in(self, first, second, msg="")
Soft assert for whether the first is not in second :params first: the value to check :params second: the container to check in :params msg: (Optional) msg explaining the difference
3.116924
3.224731
0.966569
try: self.assert_is_instance(obj, cls, msg) except AssertionError, e: if msg: m = "%s:\n%s" % (msg, str(e)) else: m = str(e) self.verification_erorrs.append(m)
def verify_is_instance(self, obj, cls, msg="")
Soft assert for whether the is an instance of cls :params obj: the object instance :params cls: the class to compare against :params msg: (Optional) msg explaining the difference
3.053393
3.145458
0.970731
try: self.assert_is_not_instance(obj, cls, msg) except AssertionError, e: if msg: m = "%s:\n%s" % (msg, str(e)) else: m = str(e) self.verification_erorrs.append(m)
def verify_is_not_instance(self, obj, cls, msg="")
Soft assert for whether the is not an instance of cls :params obj: the object instance :params cls: the class to compare against :params msg: (Optional) msg explaining the difference
3.026122
3.101974
0.975547
e = driver.find_element_by_tag_name('body') assert text in e.text
def assert_text_present(self, text, msg=None)
Hard assert for whether the text if visible in the current window/frame :params text: the string to search for :params msg: (Optional) msg explaining the difference
4.656285
6.577378
0.707924
try: self.assert_text_present(text, msg) except AssertionError, e: if msg: m = "%s:\n%s" % (msg, str(e)) else: m = str(e) self.verification_erorrs.append(m)
def verify_text_present(self, text, msg=None)
Soft assert for whether the text if visible in the current window/frame :params text: the string to search for :params msg: (Optional) msg explaining the difference
3.063114
3.296506
0.9292
e = driver.find_elements_by_locator(locator) if len(e) == 0: raise AssertionError("Element at %s was not found" % locator)
def asset_element_present(self, locator, msg=None)
Hard assert for whether and element is present in the current window/frame :params locator: the locator of the element to search for :params msg: (Optional) msg explaining the difference
4.251462
4.781078
0.889227
try: self.asset_element_present(locator, msg) except AssertionError, e: if msg: m = "%s:\n%s" % (msg, str(e)) else: m = str(e) self.verification_erorrs.append(m)
def verify_element_present(self, locator, msg=None)
Soft assert for whether and element is present in the current window/frame :params locator: the locator of the element to search for :params msg: (Optional) msg explaining the difference
3.480464
4.006373
0.868732