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

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