Code Duplication    Length = 20-20 lines in 2 locations

rsudp/c_alert.py 1 location

@@ 99-118 (lines=20) @@
96
				self.cha = chn
97
98
99
	def _set_channel(self, cha):
100
		'''
101
		This function sets the channel to listen to. Allowed values are as follows:
102
103
		- "SHZ"``, ``"EHZ"``, ``"EHN"`` or ``"EHE"`` - velocity channels
104
		- ``"ENZ"``, ``"ENN"``, ``"ENE"`` - acceleration channels
105
		- ``"HDF"`` - pressure transducer channel
106
		- ``"all"`` - resolves to either ``"EHZ"`` or ``"SHZ"`` if available
107
108
		:param cha: the channel to listen to
109
		:type cha: str
110
		'''
111
		cha = self.default_ch if (cha == 'all') else cha
112
		self.cha = cha if isinstance(cha, str) else cha[0]
113
114
		if self.cha in str(rs.chns):
115
			self._find_chn()
116
		else:
117
			printE('Could not find channel %s in list of channels! Please correct and restart.' % self.cha, self.sender)
118
			sys.exit(2)
119
120
121
	def _print_filt(self):

rsudp/c_rsam.py 1 location

@@ 104-123 (lines=20) @@
101
				self.cha = chn
102
103
104
	def _set_channel(self, cha):
105
		"""
106
		This function sets the channel to listen to. Allowed values are as follows:
107
108
		- "SHZ"``, ``"EHZ"``, ``"EHN"`` or ``"EHE"`` - velocity channels
109
		- ``"ENZ"``, ``"ENN"``, ``"ENE"`` - acceleration channels
110
		- ``"HDF"`` - pressure transducer channel
111
		- ``"all"`` - resolves to either ``"EHZ"`` or ``"SHZ"`` if available
112
113
		:param cha: the channel to listen to
114
		:type cha: str
115
		"""
116
		cha = self.default_ch if (cha == 'all') else cha
117
		self.cha = cha if isinstance(cha, str) else cha[0]
118
119
		if self.cha in str(rs.chns):
120
			self._find_chn()
121
		else:
122
			printE('Could not find channel %s in list of channels! Please correct and restart.' % self.cha, self.sender)
123
			sys.exit(2)
124
125
126
	def _getq(self):