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

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