anchor
stringlengths
2
528
positive
stringlengths
4
6k
negative
stringlengths
6
6k
Takes an input range from generate_ranges and creates line segments and data points to represent access times.
def generate_access_time_plot_from_range(id_range, val): segments = [] points = [] for i in id_range: if isinstance(i, list): endpoints = [(i[0], val), (i[1], val)] segments.append(endpoints) else: points.append((i, val)) return segments, points
def plot_joint_angles_with_contact(t_start,t_stop): [time, ankle_l_trajectory, ankle_r_trajectory, foot_l_contact, foot_r_contact, muscle_lh_activations, muscle_rh_activations, muscle_lh_forces, muscle_rh_forces, joint_lh_positions, joint_rh_positions] = load_data()...
Get total number of initialized TTL channels. It is the sum of all connected Link TTL ports.
def fgt_get_TtlChannelCount(): low_level_function = low_level.fgt_get_TtlChannelCount c_error, count = low_level_function() exceptions.manage_generic_status(low_level_function.__name__, c_error) return count
def length(self): count = 0 current = self.head while current is not None: count += 1 current = current.next return count
Handle an unidentified dialogue. Respond to the sender with a default message containing the appropriate error information.
def _handle_unidentified_dialogue(self, fipa_msg: FipaMessage) -> None: self.context.logger.info( "received invalid fipa message={}, unidentified dialogue.".format(fipa_msg) ) default_dialogues = cast(DefaultDialogues, self.context.default_dialogues) default_msg, _ = default_...
def say_goodbye(request, responder): # Clear the dialogue frame to start afresh for the next user request. responder.frame = {} # Respond with a random selection from one of the canned "goodbye" responses. responder.reply(['Bye!', 'Goodbye!', 'Have a nice day.', 'See you later.'])
\( X(t) \)๊ฐ€ ๋‚˜ํƒ€๋‚ด๋Š” ๋ฒกํ„ฐ๋Š” ๋ฌด์—‡์ธ๊ฐ€?
\( X(t) \)๋Š” \(L\)๊ฐœ์˜ ์•ˆํ…Œ๋‚˜๋กœ๋ถ€ํ„ฐ ์ˆ˜์‹ ๋˜๋Š” Lx1์˜ ์‹ ํ˜ธ ๋ฒกํ„ฐ์ด๋ฉฐ, A๋Š” ์ž…์‚ฌ๋˜๋Š” \(K\)๊ฐœ์˜ ์‹ ํ˜ธ๋“ค์— ์˜ํ•ด ์•ˆํ…Œ๋‚˜๋งˆ๋‹ค ํ˜•์„ฑ๋œ Lx1์˜ ์กฐํ–ฅ๋ฒกํ„ฐ์˜ ์ง‘ํ•ฉ์œผ๋กœ ์ด ์กฐํ–ฅ๋ฒกํ„ฐ๋Š” ์‹ (2), (3)๊ณผ ๊ฐ™๋‹ค
์‹ (1)์˜ \( S(t) \)๋Š” source ์‹ ํ˜ธ์›์œผ๋กœ \( \mathrm{K} \times 1 \) ๋ฒกํ„ฐ, \( N(t) \)๋Š” AWGN (additive white gaussian noise)์œผ๋กœ \( \mathrm{L} \times 1 \) ๋ฒกํ„ฐ์ด๋‹ค.
Create a ctor function for a struct (aka C++ class). Use with PY_struct_arg==class. Used as __init__ function.
def create_struct_ctor(cls): name = cls.name + "_ctor" ast = Declaration() ast.attrs["_constructor"] = True ast.attrs["name"] = name ## _name="ctor", ast.typemap = cls.typemap ast.specifier = [ cls.name ] ast.params = [] return ast
def __new__(*args, **kwargs): # real signature unknown pass
์™„์„ฑ๋˜๋‹ค, ์œ„, ํŒฅ๋น™์ˆ˜, ์žฌ๋ฃŒ, ์–น๋‹ค, ๋ง›์žˆ๋‹ค
๊ทธ ์œ„์— ์—ฌ๋Ÿฌ ์žฌ๋ฃŒ๋ฅผ ์ฐจ๋ก€๋Œ€๋กœ ์–น์œผ๋ฉด ๋ง›์žˆ๋Š” ํŒฅ๋น™์ˆ˜๊ฐ€ ์™„์„ฑ๋œ๋‹ค.
์ˆ˜๋ฐ•, ์ฐธ์™ธ, ์กฐ๋กฑ๋ฐ•, ์ˆ˜์„ธ๋ฏธ, ์˜ค์ด, ๊ฐ€์ง€๋ฅผ ์ •์„ฑ๊ป ์‹ฌ์–ด ๋ฌด๋Ÿญ๋ฌด๋Ÿญ ํ‚ค์› ๋‹ค.
inst.get_phase_offsets(antennas=[1,2,3,...]) > values=[0.0,0.0,0.0,...] Returns the phase offsets for the given set of antennas, an empty set implies
def get_phase_offsets(self, args): self.logger.debug('get_phase_offsets(%d)'%len(args)) return self.get_values('phase_offsets', args, type='f')
def set_delay_offsets(self, args): self.logger.debug('set_delay_offsets') return self.set_values('delay_offsets', args, type='f')
๋, ์•ˆ๊ฒฝํ…Œ, ์ง€์„ฑ๋ฏธ, ํ’๊ธฐ๋‹ค
๋์ด ์˜ฌ๋ผ๊ฐ„ ๋””์ž์ธ์˜ ์•ˆ๊ฒฝํ…Œ๋Š” ์ง€์„ฑ๋ฏธ๋ฅผ ํ’๊ธด๋‹ค.
์˜›๋‚  ๋‹ค๊ณผ์ƒ ์ฐจ๋ฆผ์€ ๋…น์ฐจ, ๋ฌด์ง€๊ฐœ๋–ก, ๋ฐค๋‹ค์‹, ์ƒ๋ž€, ์œจ๋ž€, ์กฐ๋ž€ ๋“ฑ์ด๋‹ค.
ํŒŒ์ธ์• ํ”Œ์€ ์ž์—ฐ ํ•ญ์ƒ์ œ์ธ๊ฐ€?
ํŒŒ์ธ์• ํ”Œ์€ ๋˜ํ•œ ์ธํ›„ํ†ต์„ ์™„ํ™”์‹œํ‚ต๋‹ˆ๋‹ค. ํ‹ฐํŠธ๋ฆฌ ์˜ค์ผ์€ ํ™˜์ƒ์ ์ธ ์ž์—ฐ ํ•ญ์ƒ์ œ์ด๋ฉฐ, ๋งค์šฐ ํšจ๊ณผ์ ์ธ ํ”ผ๋ถ€ ์†Œ๋…์ œ์ธ ํ•ญ๊ท  ํ™”ํ•ฉ๋ฌผ์„ ํฌํ•จํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ƒํƒœ์˜ ์‹ฌ๊ฐ๋„์— ๋”ฐ๋ผ, ๋งค์ผ 5%์—์„œ 15%์˜ ๋†๋„๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋‹ค์Œ์€ ์œ ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๋‹ค๋ฅธ ์ž์—ฐ ํ•ญ๊ท ์ œ์ž…๋‹ˆ๋‹ค: 1. ๋ชฐ์ฝ”์‚ฐ - ๋†์ถ• ์œ ์ฒญ์—์„œ ์œ ๋ž˜ํ•˜๋ฉฐ, ๊ณฐํŒก์ด ๊ฐ์—ผ์— ํšจ๊ณผ์ ์œผ๋กœ ์‚ฌ์šฉ๋  ์ˆ˜ ์žˆ๊ณ  ํ›Œ๋ฅญํ•œ ํ•ญ๊ท ์ œ์ž…๋‹ˆ๋‹ค. 2. ์š”์˜ค๋“œ์™€ ๊ฐ™์€ ๋ฐฉ์‹์œผ๋กœ ์‚ฌ์šฉํ•˜์‹ญ์‹œ์˜ค. 3. ์„ธ์ธํŠธ์กด์Šค์›ŒํŠธ - ์™ธ๋ถ€ ํ•ญ๊ท ์ œ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
๋งˆ๋Š˜์€ ์ž‘์€ ์ƒ์ฒ˜์— ๋ฌธ์ง€๋ฅผ ์ˆ˜ ์žˆ๋Š” ์ž์—ฐ ํ•ญ์ƒ์ œ์ž…๋‹ˆ๋‹ค. ๋ธŒ๋กœ๋ฉœ๋ผ์ธ์€ ํŒŒ์ธ์• ํ”Œ ์‹๋ฌผ์˜ ์ž์—ฐ ์ถ”์ถœ๋ฌผ๋กœ, ๋‚ด๋ถ€์ ์œผ๋กœ ์„ญ์ทจํ•  ๊ฒฝ์šฐ ์น˜์œ ๋ฅผ ํฌ๊ฒŒ ์ด‰์ง„ํ•˜๋Š” ๊ฒƒ์œผ๋กœ ๋ฐํ˜€์กŒ์Šต๋‹ˆ๋‹ค. ์ƒ์ฒ˜์˜ ์ถœํ˜ˆ์„ ๋ฉˆ์ถ”๊ธฐ ์œ„ํ•ด์„œ๋Š” ์ƒ์ฒ˜์— ์••๋ ฅ์„ ๊ฐ€ํ•˜์—ฌ ํ˜ˆ์•ก์ด ์‘๊ณ ๋˜๋„๋ก ๋„์™€์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ถœํ˜ˆ์„ ๋ฉˆ์ถ”๋Š” ๋งค์šฐ ํšจ๊ณผ์ ์ธ ๋ฐฉ๋ฒ•์€ ์ƒ์ฒ˜์— ์นด์ด์—” ํŽ˜ํผ๋ฅผ ๋„‰๋„‰ํžˆ ๋ฟŒ๋ฆฌ๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.
Return a list of data files under tests/data These strings are suitable to be passed to read().
def list_files(): result = [] for dirname, dirnames, filenames in os.walk(_test_data_dir): dirname = (os.path.relpath(dirname, _test_data_dir) + '/')[2:] for filename in filenames: if filename.endswith('.data') and not filename.startswith('.'): result.append(dirname ...
def get_file_list(path_data, shuffle=True): # get the whole list FileList_data = [] for _, dirnames, _ in os.walk(path_data): for dirname in dirnames: data_file = glob(path_data+dirname+'/*.txt') for file in data_file: FileList_data.append(file) # shuffl...
Only writes the first 'self.msg_length' characters of each 'msg' into 'self.logfile' in order to avoid unreadable logs.
def write(self, msg): try: if not self.logfile.closed: self.logfile.write(time.strftime("%H:%M:%S", time.gmtime()) + ": " + msg[:self.msg_length] + '\n') elif not self.force_close: print ('ERROR (Logger.write):' + ' logfile = ' + self...
def print_endlog_msg(self): if self._console: for fh in self._logfh: if hasattr(fh, 'name'): self._console.write("Log written to \'{:s}\'.{}" .format(fh.name, self._eol)) else: self._conso...
๊น€์ •์ผ์ด ๋ฏผ์กฑ์•…๊ธฐ์™€ ์„œ์–‘์•…๊ธฐ ๋ฐฐํ•ฉ์˜ ์ค‘์š”์„ฑ์„ ๊ฐ•์กฐํ•œ ์ฑ…์€ ๋ฌด์—‡์ธ๊ฐ€?
์กฐ์„ ์ธ๋ฏผ๊ตฐ๊ณตํ›ˆ๊ตญ๊ฐ€ํ•ฉ์ฐฝ๋‹จ ์ดˆ๊ธฐ์—๋Š” ์กฐ์„ ์ธ๋ฏผ๊ตฐํ˜‘์ฃผ๋‹จ, ๋…๋ฆฝ ์ดํ›„์—๋Š” ์†Œ์† ๊ด€ํ˜„์•…๋‹จ์˜ ์—ฐ์ฃผ๋กœ ๊ณต์—ฐํ•˜๊ณ  ์žˆ์œผ๋ฉฐ ์„ ์ฐฝ๊ณผ ํ•ฉ์ฐฝ, ๊ด€ํ˜„์•…๊ณผ ํ•ฉ์ฐฝ, ๋ฌด๋ฐ˜์ฃผ ํ•ฉ์ฐฝ, ๋…ํŠนํ•œ ๊ด€ํ˜„์•… ์—ฐ์ฃผ ๊ทธ๋ฆฌ๊ณ  ํ•ฉ์ฐฝ์กฐ๊ณกํ˜•์‹์˜ ์ƒˆ๋กœ์šด ์˜์—ญ๊ฐœ์ฒ™ ๋“ฑ์œผ๋กœ ๋‹ค์–‘ํ•œ ํ•ฉ์ฐฝ์˜ˆ์ˆ ์„ ๋ณด์—ฌ์ฃผ๊ณ  ์žˆ๋‹ค. ๊ทผ๋ž˜์—๋Š” ๋Ÿฌ์‹œ์•„์˜ ๋ถ‰์€ ๊ตฐ๋Œ€ ํ•ฉ์ฐฝ๋‹จ์ด ๊ฑฐ๋А๋ฆฐ ๋ฐœ๋ž„๋ผ์ด์นด์™€ ๋ฐ”์–€(๋Ÿฌ์‹œ์•„ ์•„์ฝ”๋””์–ธ) ์ค‘์‹ฌ ๋ฐ˜์ฃผ์•…๋‹จ์˜ ์˜ˆ๋ฅผ ๋ชจ๋ฐฉํ•œ ๋“ฏ, ์—ฌ๋Ÿฌ ๊ทœ๊ฒฉ์œผ๋กœ ๊ฐœ๋Ÿ‰ํ•œ ๋ฏผ์กฑ์•…๊ธฐ ์–ด์€๊ธˆ๊ณผ ์•„์ฝ”๋””์–ธ์ด ์ฃผ๊ฐ€ ๋˜๋Š” ์–ด์€๊ธˆ์•…๋‹จ์ด ๋ฐ˜์ฃผ๋กœ ์ฐธ๊ฐ€ํ•˜๊ธฐ๋„ ํ•œ๋‹ค. ๊น€์ •์ผ์€ ใ€Š์Œ์•…์˜ˆ์ˆ ๋ก ใ€‹์—์„œ ๋ฏผ์กฑ์•…๊ธฐ์™€ ์„œ์–‘์•…๊ธฐ๋ฅผ ๋ฐฐํ•ฉํ•˜๋Š” ๊ฒƒ์€ '์ฃผ์ฒด์ '์ธ ์•…๊ธฐํŽธ์„ฑ์˜ ์ค‘์š”ํ•œ ์›์น™์ด๋ผ๊ณ  ๋ช…์‹œํ•˜์˜€...
์Œ์•…์‚ฌํ•™ ๋™์–‘์—์„œ ์Œ์•…์—ฐ๊ตฌ์˜ ์—ญ์‚ฌ๋Š” ์„œ์–‘์Œ์•…์‚ฌํ•™๊ณผ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ๋งค์šฐ ์žฅ๊ตฌํ•œ๋ฐ, ์ค‘๊ตญ ์ฃผ๋‚˜๋ผ ๋•Œ ์ฒญ์†Œ๋…„์˜ ํ•™์Šต๊ณผ๋ชฉ์ธ ์œก์˜ˆ(ๅ…ญ็ฆฎ) ๊ฐ€์šด๋ฐ ์•…(ๆจ‚)์ด ๋“ค์–ด์žˆ์—ˆ๊ณ , ์œ ๊ฐ€(ๅ„’ๅฎถ)์˜ ๊ฒฝ์ „์ธ ์œก๊ฒฝ ๊ฐ€์šด๋ฐ์—๋„ ์•…๊ฒฝ(ๆจ‚็ถ“)์ด ๋“ค์–ด์žˆ์—ˆ๋‹ค. ๋™์–‘์—์„œ์˜ ์Œ์•…๋„ ์„œ์–‘๊ณผ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ์ธ๊ฐ„ ์ƒํ™œ์˜ ํ•„์ˆ˜ ์š”์†Œ ์ค‘ ํ•˜๋‚˜์˜€๊ธฐ ๋•Œ๋ฌธ์— ์ •์‹ ์ˆ˜์–‘, ์˜ˆ์ˆ , ์˜๋ก€, ์˜ค๋ฝ์˜ ๊ธฐ๋Šฅ์„ ๋„˜์–ด์„œ ๊ตญ๊ฐ€๊ฐ„ ์™ธ๊ต์˜ ํ˜„์žฅ์—์„œ ์•…๋Œ€์˜ ๋ฐ˜์ฃผ๋กœ ์‹œ(่ฉฉ)๋ฅผ ๋…ธ๋ž˜ํ•˜์—ฌ ์„œ๋กœ ์˜์‚ฌ๋ฅผ ํƒ€์ง„ํ•˜์˜€๋‹ค๋Š” ๊ธฐ๋ก์ด ์žˆ์„ ๋งŒํผ ์Œ์•…์˜ ์œ„์น˜๋Š” ๋™์–‘์—์„œ ํŠน๋ณ„ํ•œ ๊ฒƒ์ด์—ˆ๋‹ค. ์˜ˆ๊ธฐ(็ฆฎ่จ˜) ์ค‘ ์•…๊ธฐๆจ‚่จ˜๋Š” ์ด๋Ÿฌํ•œ ์ค‘๊ตญ ๊ณ ๋Œ€์‚ฌ์—์„œ ์Œ์•…์ด ์˜ˆ์ˆ ์˜ ๋ฒ”์œ„๋ฅผ ๋„˜์–ด ํ†ต์น˜์™€ ...
create_vars_dot_env This method is invoked if the vars.env file is not found. It will create the file.
def create_vars_dot_env(self): print("Creating vars.env in your Google Drive!") with open(self.envpath, "w") as envfile: envfile.write("COLAB_ENV = Active\n")
def _create_config(env_path): s2e_yaml = 's2e.yaml' version_path = os.path.join(os.path.dirname(__file__), '..', 'dat', 'VERSION') with open(version_path, 'r', encoding='utf-8') as fp: context = { 'creation_time': str(datetime.datetime.now()), 'version': fp.read().strip(), ...
Updates / initializes a pusher object with a discovery packet. returns an old discovery packet for recycling.
def update_discovery(self, packet:DiscoveryPacket, timestamp=None): self.last_seen = timestamp or datetime.now() old_packet = self.last_packet self.last_packet = packet if not self.first_seen: self.first_seen = self.last_seen self.setup_strips() else: ...
async def async_handle_discovery_info( self, device: dr.DeviceEntry, disc_info: ZwaveDiscoveryInfo, value_updates_disc_info: dict[str, ZwaveDiscoveryInfo], ) -> None: # This migration logic was added in 2021.3 to handle a breaking change to # the value_id format. Some...
๊ตฐ์ธ๋“ค, ๊ตฐ๋ฒˆ, ํ‘œ, ์ฃผ์–ด์ง€๋‹ค, ์ ํžˆ๋‹ค
๊ตฐ์ธ๋“ค์—๊ฒŒ๋Š” ์ž์‹ ์˜ ๊ตฐ๋ฒˆ์ด ์ ํžŒ ํ‘œ๊ฐ€ ์ฃผ์–ด์ง„๋‹ค.
์†Œ๋Œ€์žฅ์€ ๋ณ‘์‚ฌ๋“ค์—๊ฒŒ ์†Œ์†, ๊ตฐ๋ฒˆ, ๊ณ„๊ธ‰, ์„ฑ๋ช…์„ ์ฐจ๋ก€๋กœ ๋‹ค์‹œ ๋ฌผ์—ˆ๋‹ค.
Returns an array('I') of partitions to be reassigned by gathering them from removed devices and overweight devices.
def _gather_reassign_parts(self): reassign_parts = array('I') if self._remove_devs: dev_ids = [d['id'] for d in self._remove_devs if d['parts']] if dev_ids: for replica in xrange(self.replicas): part2dev = self._replica2part2dev[replica] ...
def getPartitionsByDisk(device): # Gets a list of partitions based on file location obj = shell.Command("lsblk " + device + " --noheading -p --list | grep -E '" + device + "[a-zA-Z0-9]+' | awk '{print $1}'") parts = obj.GetStdout().split() # convert the list of string into parti...
๋…ธ์กฐ์ „์ž„์ž ๊ธ‰์—ฌ์ง€๊ธ‰ ๊ธˆ์ง€ ์ œ๋„๊ฐ€ ์ ์šฉ๋˜๋ฉด ๋…ธ๋™์กฐํ•ฉ์˜ ์กฐ์งํ˜•ํƒœ๊ฐ€ ๋งŽ์ด ๋ณ€๊ฒฝ๋  ๊ฒƒ์œผ๋กœ ๋ณด์ด์ง€
๋…ธ์กฐ์ „์ž„์ž ๊ธ‰์—ฌ์ง€๊ธ‰ ๊ธˆ์ง€๋Š” ์šฐ๋ฆฌ๋‚˜๋ผ ๋…ธ์‚ฌ๊ด€๊ณ„์— ํฐ ํŒŒ๊ธ‰ํšจ๊ณผ๋ฅผ ๋ฏธ์น  ์ˆ˜ ์žˆ๋Š” ์ œ๋„ ๋ณ€ํ™”์ด๋‹ค. ์ด ์ œ๋„๊ฐ€ ๋„์ž…๋˜๋ฉด ๋…ธ๋™์กฐํ•ฉ์˜ ์žฌ์ •๊ตฌ์กฐ, ๋…ธ๋™์กฐํ•ฉ์˜ ์กฐ์งํ˜•ํƒœ ๋ฐ ์‚ฌ์—…์žฅ ๋…ธ์‚ฌ๊ด€๊ณ„์˜ ์–‘ํƒœ ๋“ฑ์ด ํฌ๊ฒŒ ๋ฐ”๋€” ๊ฒƒ์œผ๋กœ ์˜ˆ์ƒ๋œ๋‹ค.
์ „์ž„์ž์˜ ๊ธ‰์—ฌ๋Š” ๋…ธ๋™์กฐํ•ฉ์˜ ํˆฌ์Ÿ์˜ ์‚ฐ๋ฌผ์ด๋ฉฐ ์ด๊ฒƒ์ด ์‹ค์งˆ์ ์œผ๋กœ ๋…ธ์กฐ์˜ ์ž์ฃผ์„ฑ์„ ํ•ดํ•˜์ง€ ์•Š๋Š”๋‹ค๋Š” ๋“ฑ ์—ฌ๋Ÿฌ ๊ฐ€์ง€ ๋ณ€ํ˜• ๋…ผ๋ฆฌ๊ฐ€ ์ฃผ์žฅ๋˜๊ณ  ์žˆ์œผ๋‚˜, ๊ฐ€๋Šฅํ•œ ํ•œ ์‚ฌ์šฉ์ž์— ์˜ํ•œ ๊ธ‰์—ฌ์ง€๊ธ‰ ์—†์ด ๋…ธ์กฐ์ „์ž„์ž์˜ ๊ธ‰์—ฌ๋ฅผ ์ž์ฒด์ ์œผ๋กœ ํ•ด๊ฒฐํ•˜๋Š” ๊ฒƒ์ด ๋…ธ์กฐ์˜ ์ž์ฃผ์„ฑ์„ ์ œ๊ณ ํ•˜๋Š” ๋ฐฉํ–ฅ์ž„์€ ๋ถ„๋ช…ํ•˜๋‹ค. ์ด๊ฒƒ์ด ํ˜„ํ–‰ ๋…ธ๋™์กฐํ•ฉ๋ฒ• ๋ฐ ๋…ธ๋™๊ด€๊ณ„ ์กฐ์ •๋ฒ• ์ œ24์กฐ์˜ ์ž…๋ฒ•์ทจ์ง€๋ผ๊ณ  ํ•  ์ˆ˜ ์žˆ๋‹ค(์ด์ธ์žฌ, 2008).
Asserts that the condition is true, If not, the state is set and the script is ended
def assert_true(self, condition, state): if not condition: self._state = state # Raises an exception to escape the run method raise StateAssertException()
def test_conditional_check_evaluation(self): pass
Converts main_dataframe to a xml file with the given encoding and exports it to the given filepath
def exportAsXMLFile(self, exported_file_path: str, encoding: str="UTF-8"): #defines the root element of the xml file the dataframe will be converted to using lxml root = etree.Element("root") #iterates over every row in the dataframe for _, row in self.main_dataframe.iterrows():...
def main(): out_file = open('output.xml', 'w') # List of Sample IDs. ids = get_samples() tissues = get_tissues() root = get_XML(ids, tissues) out_file.write(prettify(root)) out_file.write("\n") out_file.close() return 0
pyjsdl.sprite.collide_rect Check if the rects of the two sprites intersect. Can be used as spritecollide callback function.
def collide_rect(sprite1, sprite2): return sprite1.rect.intersects(sprite2.rect)
def collide_hit_rect(self, one, two): return one.hit_rect.colliderect(two.hit_rect)
Get property value and convert it to boolean. If no property found, default value will be returned.
def get_boolean_property(key: str, default: bool = None) -> bool: try: value = _properties[key] if value.lower() == "true": return True elif value.lower() == "false": return False raise ValueError("could not convert string to boolean: %s" % value) except K...
def visitBooleanLiteralNode(self, node): return getattr(self.out, 'lang_boolean_' + node.val)
Compute embedding based nearest neighbour in `another` for each Document in `self`, and store results in `matches`.
def match( self, darray: Union['DocumentArray', 'DocumentArrayMemmap'], metric: str = 'cosine', limit: Optional[int] = inf, is_distance: bool = False, ) -> None: X = np.stack(self.get_attributes('embedding')) Y = np.stack(darray.get_attributes('embedding')) ...
def cal_doc_keywords_similarity(self, document, top_k=10): d_tokens = self.__tokenizer.tokenize(document) # Do topic inference on documents to obtain topic distribution. doc = LDADoc() self.__engine.infer(d_tokens, doc) doc_topic_dist = doc.sparse_topic_dist() items = [...
open the JSON file with the IP information so we can pass it back for Vagrantfile creation
def BuildIPList(ipfilename): with open(ipfilename, 'r') as vagripfile: ipdict = {} ip_data = json.load(vagripfile) subnet = ip_data["subnet"] for box in ip_data["boxes"]: ipname = str(box["name"]) ip = subnet + str(box["ip"]) ipdict[ipname] = ip ...
def load_dotfile(): dotfile = os.path.join(os.environ.get('HOME', '.'), DOTFILE) if os.path.exists(dotfile): with open(dotfile, 'r') as infile: return json.load(infile) else: return {}
๋ฌด์‡ ์ธ๊ฐ„์˜ ์ •ํ™•ํ•œ ์œ„์น˜๋ฅผ ์•Œ๋ ค์ค˜
ํ˜„์žฌ๋Š” ๊ธธ๊ฐ€์— ์œ„์น˜ํ•ด ์žˆ์ง€๋งŒ ์ด ๊ธธ์€ 18์„ธ๊ธฐ ์ดˆ์— ๋งŒ๋“ค์–ด์ง„ ๊ฒƒ์œผ๋กœ, ๊ทธ ์ „์—๋Š” ๊ธธ๋„ ์—†๋Š” ์ˆฒ์† ํ•œ๊ฐ€์šด๋ฐ์— ๋ฉ๊ทธ๋Ÿฌ๋‹ˆ ๋ฌปํ˜€ ์žˆ์—ˆ๋‹ค. ์ค‘์•™์œ ๋Ÿฝ์˜ ๋Œ€ํ‘œ์ ์ธ ์˜คํŒŒ์ธ ๋กœ, ์ด๊ฒƒ์ด ์–ธ์ œ ์™œ ์ด ์ž๋ฆฌ์— ๋งŒ๋“ค์–ด์กŒ๋Š”์ง€ ์•„๋ฌด๋„ ๋ชจ๋ฅธ๋‹ค. 17์„ธ๊ธฐ์˜ ๋ฌธ์„œ์—๋„ ๊ทธ ์กด์žฌ๊ฐ€ ์–ธ๊ธ‰๋˜๋ฉฐ, ์ด ๋‹น์‹œ ๋งˆ์„ ์ด์ •ํ‘œ๋กœ ์‚ฌ์šฉ๋˜์—ˆ๋‹ค๊ณ  ํ•œ๋‹ค. 1970๋…„๋Œ€์— ์ด๋ฃจ์–ด์ง„ ๊ฒ€์‚ฌ ๊ฒฐ๊ณผ ์ด ์ฒ ๊ธฐ๋‘ฅ์€ ์„ ์ฒ ๋กœ ๋งŒ๋“ค์–ด์ ธ ์žˆ์œผ๋ฉฐ, ๋•…์„ ํŒŒ์„œ ๊ทธ ์•ˆ์— ์‡ณ๋ฌผ์„ ๋ถ€์–ด ๋งŒ๋“ค์—ˆ๋‹ค๊ณ  ํ•œ๋‹ค. ์ด๋Š” ์ค‘์„ธ์˜ ์ฒ ์ œํ’ˆ ์ œ์ž‘ ๋ฐฉ๋ฒ•๊ณผ ์ผ์น˜ํ•œ๋‹ค. ๋‚ ์”จ์™€ ์„ธ์›” ํƒ“์— ํ’ํ™”๋ฅผ ๊ฒช๊ณ  ์žˆ์ง€๋งŒ ์ด์ƒํ•  ์ •๋„๋กœ ๋…น์€ ์ ๊ฒŒ ์Šฌ์–ด ์žˆ๋‹ค. ๋ฌด์‡ ์ธ๊ฐ„์˜ ์ •ํ™•ํ•œ ์œ„์น˜๋Š” ๋ถ์œ„ 5...
๋ณด์–ด์˜ ์ƒˆ๋กœ์šด ์ด๋ก ๋“ค์€ ๋‹น์‹œ์˜ ๋งŽ์€ ์‹คํ—˜๋“ค๊ณผ ๋ฌผ์งˆ์ด ํŒŒ๋™๊ณผ ์ž…์ž์˜ ์ด์ค‘์„ฑ์„ ๋ค๋‹ค๋Š” ์‚ฌ์‹ค์„ ๋ฐ”ํƒ•์œผ๋กœ ํ•œ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ๊ทธ ํ›„์— ํ•˜์ด์  ๋ฒ ๋ฅดํฌ๋Š” ์ž…์ž์˜ ์œ„์น˜์™€ ์šด๋™๋Ÿ‰์ด ๋‘˜ ๋‹ค ๋งค์šฐ ์ •ํ™•ํ•˜๊ฒŒ ๊ตญ์†Œํ™”๋  ์ˆ˜ ์—†๋‹ค๋Š” ๋ถˆํ™•์ •์„ฑ ์›๋ฆฌ๋ฅผ ๋ฐœํ‘œํ•˜์˜€๋‹ค. ๋ณด์–ด์™€ ํ•˜์ด์  ๋ฒ ๋ฅดํฌ๋ฅผ ํƒœ๋™์œผ๋กœ ๋ฐœ์ „ํ•˜๊ฒŒ ๋œ ์–‘์ž์—ญํ•™์— ๋Œ€ํ•œ ์ฝ”ํŽœํ•˜๊ฒ ํ•ด์„์€ ์‚ฌ๊ฑด์— ๋Œ€ํ•œ ์ธ๊ฐ„์˜ ๊ด€์ธก ํ™œ๋™์ด ์‚ฌ๊ฑด์˜ ํ˜„์‹ค์„ ๋ณ€ํ™”์‹œํ‚จ๋‹ค๋ผ๋Š” ๊ฒฐ๋ก ์„ ๋‚ด๋ฆฌ๊ฒŒ ๋˜์—ˆ๋‹ค. ์ฝ”ํŽœํ•˜๊ฒ ํ•ด์„์—์„œ ํ•ต์‹ฌ์€ ์–ด๋–ค ๋ฌผ๋ฆฌ๋Ÿ‰์˜ ๊ฐ’์ด ์ธก์ •์ด๋ผ๋Š” ํ–‰์œ„ ์ด์ „์—๋Š” ์กด์žฌํ•œ๋‹ค๊ณ  ํ•˜๋Š” ๊ฒƒ์ด ๋ถˆํ•„์š”ํ•˜๋‹ค๋Š” ๊ฒƒ์ด๋‹ค. ๋ฐ˜๋Œ€๋กœ ๊ณ ์ „์—ญํ•™์—์„œ๋Š” ์ˆ˜์‹์œผ๋กœ ๋‚˜ํƒ€๋‚œ ๋ฌผ๋ฆฌ๋Ÿ‰์€ ์ธ๊ฐ„์˜ ์ธก์ • ํ–‰์œ„์— ๋ฌด๊ด€ํ•˜...
Produce the test dl2 file from the simulated dl1 test file using the random forest test models.
def simulated_dl2_file(temp_dir_simulated_files, simulated_dl1_file, rf_models): dl2_file = temp_dir_simulated_files / "dl2_simtel_theta_20_az_180_gdiffuse_10evts.h5" run_program( "lstchain_dl1_to_dl2", "--input-file", simulated_dl1_file, "--path-models", rf_models["path"...
def observed_dl1_files(temp_dir_observed_files, run_summary_path): # FIXME: naming criteria (suffixes, no stream) of dl1, dl2, # muons and datacheck files should be coherent # First set of files to be produced dl1_output_path1 = temp_dir_observed_files / "dl1_LST-1.Run02008.0000.h5" muons_file1 = ...
Find the hashes of documents referenced by the document, given the document's root element and doc type
def parse_references(doc_root, aggregation_type): global references_attempted, references_without_titles, references_without_authors, references_without_date, \ references_in_unexpected_format, references_with_invalid_date, references_succeeded, docs_missing_references,\ docs_with_few_references, r...
def getRefs(self): return [str(c.getRef()) for c in self.getChildren() if c.getRef()]
Logistic loss function. Params are in first position so that loss function is conveniently differentiable using JAX.
def logistic_loss(params, model, x, y): preds = model(params, x) return -binary_cross_entropy(y, preds)
def reg_logistic_regression(y, x, wi, iteration, gamma, lambda_, print_output=False): ws = [wi] losses = [calculate_loss(y, x, wi)] w = wi for i in range(iteration): grad = logistic_gradient(y, x, w, lambda_) w = w - gamma * grad loss = calculate_loss(y, x, w, lambda_) ...
Checks each validation result in results_to_filter and returns a list of results that are not in existing_results
def get_new_validation_results(cls, existing_results: Collection[ParsingResult], results_to_filter: Collection[ParsingResult]): return [file for file in results_to_filter if not cls._is_file_in_collection(file, existing_results)]
def filter_results_map(results_map, metric_name_regex, instance_regex=".*"): filtered_results_map = OrderedDict() for node_id in results_map: filtered_results_map[node_id] = [] for metric in results_map[node_id]: if (re.match(metric_name_regex, MetricsUtil.metric_name(me...
test_ensure_search_returns_nothing_if_query_searches_for_artilce_or_user_that_is_not_there should return true for no findings of either a user or article with an incorrect search
def test_ensure_search_returns_nothing_if_query_searches_for_artilce_or_user_that_is_not_there(self): user_prof = create_user_prof(username='nofindings') add_art(title='nofindings',author =user_prof) response = self.client.post(reverse('search'), data={'query': "a"}) self.assertEqual(...
def test_quick_search_bad_response(): bad_response_client.quick_search('deus ex', pybomb.PS3)
NFL ํŒ€์€ ๋ช‡ ๊ฐœ๋‚˜ ์žˆ์Šต๋‹ˆ๊นŒ?
NFL ํŒ€์€ AFC(๋ฏธ๊ตญ ํ’‹๋ณผ ์ปจํผ๋Ÿฐ์Šค)์™€ NFC(๋‚ด์…”๋„ ํ’‹๋ณผ ์ปจํผ๋Ÿฐ์Šค)๋กœ ๊ตฌ์„ฑ๋œ 32๊ฐœ ํŒ€์ด ์žˆ์Šต๋‹ˆ๋‹ค. AFC๋Š” 16๊ฐœ ํŒ€, NFC๋„ 16๊ฐœ ํŒ€์„ ๋ณด์œ ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. AFC์™€ NFC๋Š” ๊ฐ๊ฐ ๋ถ๋ถ€, ๋™๋ถ€, ๋‚จ๋ถ€, ์„œ๋ถ€๋กœ ๋‚˜๋‰ฉ๋‹ˆ๋‹ค. NFL ํŒ€ ๋ชฉ๋ก. AFC โ€“ ๋ฏธ๊ตญ ํ’‹๋ณผ ์ปจํผ๋Ÿฐ์Šค.
NFL ํŒ€์€ ๋ช‡ ๊ฐœ์ž…๋‹ˆ๊นŒ? NFL ํŒ€์€ AFC(๋ฏธ๊ตญ ํ’‹๋ณผ ์ฝ˜ํผ๋Ÿฐ์Šค)์™€ NFC(๋‚ด์…”๋„ ํ’‹๋ณผ ์ฝ˜ํผ๋Ÿฐ์Šค)๋กœ ๊ตฌ์„ฑ๋œ 32๊ฐœ ํŒ€์ด ์žˆ์Šต๋‹ˆ๋‹ค. AFC๋Š” 16๊ฐœ ํŒ€, NFC๋„ 16๊ฐœ ํŒ€์„ ๋ณด์œ ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. AFC์™€ NFC๋Š” ๊ฐ๊ฐ ๋ถ๋ถ€, ๋™๋ถ€, ๋‚จ๋ถ€, ์„œ๋ถ€๋กœ ๋‚˜๋‰ฉ๋‹ˆ๋‹ค.
Create a HTML Template given a site name, author, snippet to include JS files and CSS files
def _html_template(site_name, author, js_snippet, css_snippet): template_data = { 'site_name': site_name, 'author': author, 'js': js_snippet, 'css': css_snippet } with open('module43.template') as filehandle: template = filehandle.read() return template.format_map...
def _get_page(self, single): # Init source code from template js_elements = [] # links to external JS docs css_elements = [] # links to external CSS docs index_elements = [] # code to put in the index # Collect remote assets for url in self._remote_asset_names...
(str) > NoneType Print the puzzle with row and column numbers and two spaces between each letter.
def print_puzzle(puz): num_rows = get_num_rows(puz) # Gets the amount of rows in the puzzle num_columns = get_num_cols(puz) # Gets the amount of colummns in the puzzle # ADD code to print the column headings. print(" ", end = '') for num in range(num_columns): #Runs through the colu...
def show_board(board): from string import ascii_uppercase print(" ", end=" ") for i in range(len(board)): print(list(ascii_uppercase)[i], end=" ") print("") end = "" for i,fila in enumerate(board): if i >= 9: end=" " else: end=" " prin...
This check the config location for all the valid config files and loads them into the combobox.
def updateFacialConfig(self): self.facialConfig_cb.addItem('Select a config file') for each in os.listdir(self.configLocation): if not each.startswith('__') and each.endswith('.py'): self.facialConfig_cb.addItem(each)
def configPath(self): uic.loadUi("configPath.ui", self) self.insertOptions("Saved .exe Locations") # Load widgets addPath = self.findChild(qt.QPushButton, "addPath") addPath.clicked.connect(self.addNewPath) self.pathList = self.findChild(qt.QListWidget, "pathLis...
Test merged cube has updated forecast reference time and forecast period if specified using the 'cycletime' argument
def test_cycletime(self): result = self.plugin.process(self.cubelist, cycletime="20151123T0600Z") # test resulting cube has forecast period consistent with cycletime self.assertEqual(result.coord("forecast_period").points, [3600]) self.assertEqual( result.coord("forecast_refe...
def test_record_run_existing(self): plugin = MergeCubesForWeightedBlending( "model", weighting_coord="forecast_period", model_id_attr="mosg__model_configuration", record_run_attr="mosg__model_run", ) self.cube_ukv.attributes[ "mosg__mod...
Returns a dictionary containing some of the attributes of the landsat scene, unset, from the MTL file.
def get_scene_unset_attributes() -> dict: attributes = { 'LANDSAT_SCENE_ID': '', 'LANDSAT_PRODUCT_ID': '', 'SPACECRAFT_ID ': '', 'WRS_PATH': '', 'WRS_ROW': '', 'DATE_ACQUIRED': '', 'SCENE_CENTER_TIME': '', 'CLOUD_COVER': '', 'IMAGE_QUALITY_OLI'...
def extra_state_attributes(self): data = self.coordinator.data[self.sn] attributes = {k: v for k, v in data.items() if k is not None and v is not None} attributes["pv"] = data["pv"].replace('(W)', '') attributes["bettery"] = data["bettery"].replace('(W)', '') attributes["load"]...
Prints out an n x m multiplication table because hard coded constraints are not challenging at all.
def mul_table(n, m): table = "" maxlen = len(str(n * m)) format_string = "{0:" + str(maxlen) + "} " for i in range(n): i += 1 for j in range(m): j += 1 table += format_string.format(str(i * j)) table += "\n" return table
def printChart(chart, mterms) : print '----'*len(mterms) for i in mterms : print '%3d' % i, print '\n', '----'*len(mterms) for i in chart : for j in i : print '%3d' % j, print print '----'*len(mterms)
Returns True of the threeVH doesn't match vhNum, or threeIdx is not a natural neighbor of baseIdx.
def is3primeXover(strandType, vhNum, baseIdx, threeVH, threeIdx): if threeVH == -1: return False if vhNum != threeVH: return True if strandType == StrandType.Scaffold: offset = 1 else: offset = -1 if (vhNum % 2 == 0 and threeVH == vhNum and threeIdx != baseIdx+offset)...
def is_solvable(self): n_inverses = self._count_pebble_inversions() blank_pos_y_from_bottom = self.N - 1 - self.position_to_index(self.blank_position)[0] N_is_odd = self.N % 2 n_inverses_is_odd = n_inverses % 2 blank_pos_y_from_bottom_is_odd = (blank_pos_y_from_bottom) % 2 ...
Snapshots the current time and inserts it into the List as a Tuple with the passed description.
def take_time(self, description="", printme=False): self.times.append((datetime.now(), description)) if printme: self.output_func(description)
def getModifiedTime(): pass
Test service call when the specified device ID is not the device ID of a Mazda vehicle.
async def test_service_device_id_not_mazda_vehicle(hass: HomeAssistant) -> None: await init_integration(hass) device_registry = dr.async_get(hass) # Create another device and pass its device ID. # Service should fail because device is from wrong domain. other_config_entry = MockConfigEntry() ot...
async def test_invalid_params(self): mock_serial = MockSerial() username = "my_user" password = "my_password" with patch.object( pyinsteon.protocol.serial_transport, "serial", mock_serial ), patch.object(pyinsteon.protocol, "GetImInfoHandler", MockGetImInfoDelayed): ...
Return the value configured for this brand and the given setting name, or `None` if not configured.
def _find_brand_setting_value(setting_name: str) -> str | None: return brand_setting_service.find_setting_value(g.brand_id, setting_name)
def get_setting(key: str): active_config = get_active_config() return getattr(active_config, key, None)
Calculates the region overlap between two regions on the 5' strand and returns the degree of overlap
def cal_overlap_pos_strand(s1, e1, s2, e2): overlap = None len1 = abs(e1 - s1) len2 = abs(e2 - s2) min_len = min(len1, len2) # seq2 within seq1 if s1 < s2 and e2 < e1: overlap = COMP_OVL # partial overlap, seq1 before seq2 elif s1 <= s2 and s2 < e1 and e1 <= e2: over...
def overlap((a, b), func=max): return ( func( len(set(a).intersection(set(b))), len(set(b).intersection(set(a)))) / float(func(len(a), len(b))) ) * 100
x, y, z = ReadAccelerometer() Reads the X, Y and Z axis force, in terms of Gs
def ReadAccelerometer(): global bus global addressAccelerometer global gPerCount # Read the data from the accelerometer chip try: [status, x, y, z] = bus.read_i2c_block_data(addressAccelerometer, 0, 4) except: Print('Failed reading registers!') status = 0 x = 0 ...
def getSmoothAccelerometer(self): return self._smoothAccelX, self._smoothAccelY, self._smoothAccelZ
์Šค์ฝ”์ธ ๋ฐ์ผ์˜ ๋ง ์‡ผ
2018๋…„ ์ •๋ณด๋ฅผ ๋‹ค์‹œ ํ™•์ธํ•ด ์ฃผ์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค. ์Šค์ฝ”์ธ ๋ฐ์ผ ์•„๋ผ๋น„์•ˆ ํ˜ธ์Šค ์‡ผ๋Š” ํฅ๋ฏธ๋กœ์šด ๋Œ€ํšŒ, ๊ฐˆ๋ผ ํŒŒํ‹ฐ, ๊ต์œก ์„ธ๋ฏธ๋‚˜, ๊ตญ์ œ ์š”๋ฆฌ ์ฝ”ํŠธ ๋“ฑ์„ ๊ฐœ์ตœํ•˜๋ฉฐ, 300๊ฐœ ์ด์ƒ์˜ ํŒ๋งค ๋ถ€์Šค๋ฅผ ํŠน์ง•์œผ๋กœ ํ•˜์—ฌ ํ™”๋ คํ•œ ๋ณด์„, ์˜๋ฅ˜ ๋ฐ ์˜ˆ์ˆ  ์ž‘ํ’ˆ ๋“ฑ ๋‹ค์–‘ํ•œ ์ƒํ’ˆ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.
์Šค์ฝ”์ธ ๋ฐ์ผ ์•„๋ผ๋น„์•ˆ ๋ง ์‡ผ: ๋‚ ์งœ: 2018๋…„ 2์›” 16์ผ: ์‹œ๊ฐ„: ์˜ค์ „ 12์‹œ - ์˜คํ›„ 11์‹œ 59๋ถ„: ๋ฐ˜๋ณต ์ด๋ฒคํŠธ ์„ธ๋ถ€์‚ฌํ•ญ: ๋ฐœ์ƒ: 2018๋…„ 2์›” 25์ผ๊นŒ์ง€ ๋งค์ผ: ์žฅ์†Œ: ์Šค์ฝ”์ธ ๋ฐ์ผ ์›จ์ŠคํŠธ์›”๋“œ ์ง€๋„ 16601 N. ํ”ผ๋งˆ ๋กœ๋“œ ์Šค์ฝ”์ธ ๋ฐ์ผ, AZ: ๋น„์šฉ: ์›น์‚ฌ์ดํŠธ ์ฐธ์กฐ. ์—ฐ๋ฝ์ฒ˜: ์Šค์ฝ”์ธ ๋ฐ์ผ ์‡ผ. ์„ค๋ช…: ์Šค์ฝ”์ธ ๋ฐ์ผ ์•„๋ผ๋น„์•ˆ ๋ง ์‡ผ๊ฐ€ ์›จ์ŠคํŠธ์›”๋“œ๋กœ ํ–ฅํ•ฉ๋‹ˆ๋‹ค. 1955๋…„ ์ด๋ž˜๋กœ, ์—ฐ๋ก€ ๋ง ์‡ผ๋Š” ์•„๋ผ๋น„์•ˆ ๋ง ์„ธ๊ณ„์—์„œ์˜ ๊ธฐ์ค€์„ ์„ค์ •ํ•ด์™”์Šต๋‹ˆ๋‹ค. 50๋งˆ๋ฆฌ์˜ ๋ง์—์„œ 2,000๋งˆ๋ฆฌ ์ด์ƒ์˜ ๋ง๋กœ ์„ฑ์žฅํ•˜์˜€์œผ๋ฉฐ, ์„ธ๊ณ„ ๊ฐ์ง€์˜ ์ตœ๊ณ ์˜ ์†Œ์œ ์ž, ํ›ˆ๋ จ์‚ฌ ๋ฐ ์‚ฌ์œก์ž๋“ค์ด ๊ฒฝ์Ÿํ•˜์—ฌ ์šฐ์Šน์˜ ๊ธฐํšŒ๋ฅผ ๋…ธ...
MyGengo(public_key = None, private_key = None, sandbox = False, headers = None) Instantiates an instance of MyGengo.
def __init__(self, public_key = None, private_key = None, sandbox = False, api_version = '2', headers = None, debug = False): self.api_url = api_urls['sandbox'] if sandbox is True else api_urls['base'] self.api_version = str(api_version) if self.api_version not in ( '1.1', '2' ): raise Exception("mygengo-...
def globus_initFlow(): # Use client_id:client_secret for authorization userAndPass = "%s:%s" % (auth_settings.GLOBUS_OAUTH_ID, auth_settings.GLOBUS_OAUTH_SECRET) b64_userAndPass = b64encode(userAndPass) auth_header = "Basic %s" % b64_userAndPass flow = OAuth2WebServerFlow( client_id=auth_set...
Benchmark Extratrees Trains a ExtraForest with `n_trees` trees and returns training time, evaluation time and testing accuracy.
def bench(train_data, test_data, n_trees): print('-'*20, "This implementation") print("Going to train %d trees" % n_trees) forest = ExtraForest(n_trees=n_trees, n_min=10, criterion="entropy") print("Training...") t_start = time.time() forest.fit(train_data) t_train = time.time() - t_start ...
def test_orthants(self): for D, bf in [(1, .6), (2, .3), (3, .2), (4, .12)]: ds = tc.data_sources.SyntheticOrthants(D=D, N=10000, budget_fraction=bf) ds_eval = tc.data_sources.SyntheticOrthants(D=D, N=2000, budget_fraction=bf) ticl = tc.TimelyClassifier( ds, n...
์Šคํผ ํŠน์„ฑ๊ณผ ์ฑ„๋„ ๊ฐ„์˜ ์žก์Œ ํŠน์„ฑ์„ ์ข€ ๋” ๊ฐœ์„ ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ๊ธฐ์ค€ ์ฃผํŒŒ์ˆ˜๋ฅผ ๋ช‡๋ฐฐ ์˜ฌ๋ ค์•ผ ํ•˜์ง€?
๊ทธ๋Ÿฌ๋‚˜ ์Šคํผ ํŠน์„ฑ๊ณผ ์ฑ„๋„ ๊ฐ„์˜ ์žก์Œ ํŠน์„ฑ์„ ์ข€ ๋” ๊ฐœ์„ ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ๊ธฐ์ค€ ์ฃผํŒŒ์ˆ˜๋ฅผ ํ˜„์žฌ์˜ \( 6 \mathrm{MHz} \)์—์„œ \( 12 \mathrm{MHz} \)๋กœ 2๋ฐฐ ์˜ฌ๋ฆฌ๋Š” ๊ฒƒ์ด ๋ฐ”๋žŒ์งํ•  ๊ฒƒ์œผ๋กœ ๋ณด์ธ๋‹ค.
DFE ์˜ ์ข€ ๋” ํ–ฅ์ƒ๋œ ์„ฑ๋Šฅ์„ ์–ป๊ธฐ ์œ„ํ•ด์„œ๋Š” ์ฑ„๋„ ๋Œ€์—ญํญ ์ œํ•œ์— ์˜ํ•ด ์ƒ๊ธฐ๋Š” ISI์™€ ์ธ์ ‘ ์ฑ„๋„์— ์˜ํ•ด ๋ฐœ์ƒํ•˜๋Š” ๊ณ ์ฃผํŒŒ ์žก์Œ์ธ ํฌ๋กœ์Šคํ†ก์„ ์ œ๊ฑฐํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.
Run this to determine if the local machine has win32com, and if it does, include additional tests.
def has_win32com(): if not sys.platform.startswith('win32'): return False try: mod = __import__('win32com') except ImportError: return False return True
def test_install_by_quickinstaller_tool(self): self.install_by_quickinstaller_tool() self.product_is_usable()
Play a game of recursive combat, and return (winner, cards of player 1, cards of player 2).
def play_recursive_combat(self, game: int, cards1: List[int], cards2: List[int]) -> Tuple[int, List[int], List[int]]: self.game_count = game configurations = set() # type: Set[Tuple[Tuple[int, ...], Tuple[int, ...]]] game_round = 0 self.debug(f"=== Game {game} ===\n") while card...
def play_game(players): players = list(players) deck = list(full_deck) random.shuffle(deck) extra_card = deck.pop() #deck, extra_card = [3, 8, 2, 5, 4, 5, 3, 4, 7, 2, 1, 6, 1, 1, 1] , 1 # prints a line of code you can paste above here to repeat a game print 'deck, extra_card = ', deck, ',', extra_card ...
Set the set point that the autotune will use, as a percentage of the current set point.
def set_autotune_setpoint(self, value, **kw): self.info("setting autotune setpoint {:0.3f}".format(value)) register = self.protocol.get_register("atsp") self.write(register, value, nregisters=2, **kw)
def percent_pf_deviation(self, percent_pf_deviation): self._percent_pf_deviation = percent_pf_deviation
Test that the plugin's version is retrieved correctly if the build number is put in the brackets.
def test_plugin_version_with_build(self, mock_url_read): mock_url_read.return_value = '[{"key": "pmd", "name": "PMD", "version": "1.1 (build 1495)"}]' self.assertEqual('1.1.1495', self._sonar.plugin_version('pmd'))
def test_negative(self): client = Mock() client.info.return_value = {'version': {'number': '9.9.9'} } version = get_version(client) assert version != (8,8,8)
check_patient_status() Method evaluates the status transmitted by the module. It only checks for cases for patient_ready method.
def check_patient_status(self): for item in range(len(self.PatientStatus)): if self.PatientStatus[item] == 'S': acquire_status = self.PatientStatus[item+1:item+2] # print acquire_status break if int(acquire_status)==1: print "Patient...
def notify_data_controller_status(controller): try: resources = controller.get_control_status()["resources"] ready = 0 for k in range(len(resources)): if resources[k]["state"] == "ready": ready += 1 display("{0} out of {1} re...
์•„์ด๋ฆฌ์‹œ ์†Œ๋‹ค ๋ธŒ๋ ˆ๋“œ๋Š” ๋ฌด์—‡์ธ๊ฐ€์š”?
์ด ์†Œ๋‹ค ๋ธŒ๋ ˆ๋“œ๋Š” ์•ฝ๊ฐ„ ํ™”๋ คํ•˜๊ฒŒ ๋ณ€ํ˜•๋œ ๋ฏธ๊ตญ์‹ ๋ฒ„์ „์˜ ์•„์ผ๋žœ๋“œ ์ „ํ†ต ๋นต์œผ๋กœ, ๊ธฐ๋ณธ ๋ฐ˜์ฃฝ์— ์•ฝ๊ฐ„์˜ ๋ฒ„ํ„ฐ, ์„คํƒ•, ๊ณ„๋ž€, ๊ทธ๋ฆฌ๊ณ  ๊ฑดํฌ๋„๋‚˜ ๊ฑดํฌ๋„๊ฐ€ ์ถ”๊ฐ€๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ ์ฃผ์ฒ  ํ”„๋ผ์ดํŒฌ(์ด๊ฒƒ์ด ์ „ํ†ต์ ์ž…๋‹ˆ๋‹ค!)์ด๋‚˜ ์ผ๋ฐ˜ ๋ฒ ์ดํ‚น ์‹œํŠธ์—์„œ ๊ตฌ์šธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
์•„์ผ๋žœ๋“œ ์†Œ๋‹ค ๋นต์ด๋ž€ ๋ฌด์—‡์ธ๊ฐ€? ์•„์ผ๋žœ๋“œ ์†Œ๋‹ค ๋นต, ๋˜๋Š” ์›ํ•˜์‹ ๋‹ค๋ฉด ๋‹จ์ˆœํžˆ ์†Œ๋‹ค ๋นต์ด๋ผ๊ณ ๋„ ๋ถˆ๋ฆฌ๋Š” ์ด ๋นต์€ ๋ฒ ์ดํ‚น ์†Œ๋‹ค๋ฅผ ๋ฐœํšจ์ œ๋กœ ์‚ฌ์šฉํ•˜๋Š” ์ผ์ข…์˜ ๋น ๋ฅธ ๋นต์ด๋‹ค. ์š”์ฆ˜์—๋Š” ๋‹ค์–‘ํ•œ ๋ ˆ์‹œํ”ผ์—์„œ ๋ฒ ์ดํ‚น ์†Œ๋‹ค์˜ ๋ณดํŽธ์„ฑ์œผ๋กœ ์ธํ•ด ํฐ ํ˜์‹ ์ฒ˜๋Ÿผ ๋ณด์ด์ง€ ์•Š์„ ์ˆ˜ ์žˆ์ง€๋งŒ, 1800๋…„๋Œ€ ์ค‘๋ฐ˜ ์•„์ผ๋žœ๋“œ์˜ ์ œ๋นต์‚ฌ๋“ค์—๊ฒŒ๋Š” ํฐ ๋„์›€์ด ๋˜์—ˆ๋‹ค.
๋งก๋‹ค, ๊ทธ, ์Ÿ์•„๋ถ“๋‹ค, ์ž์‹ , ์•ˆ๊ฐ„ํž˜, ์ผ
๊ทธ๋Š” ์ž์‹ ์ด ๋งก์€ ์ผ์— ๋ชจ๋“  ์•ˆ๊ฐ„ํž˜์„ ์Ÿ์•„๋ถ€์—ˆ๋‹ค.
์žฌ์ฃผ๋Š” ์˜ˆ์ ˆ, ์Œ์•…, ํ™œ์˜๊ธฐ, ๊ธ€์“ฐ๊ธฐ, ๋งํƒ€๊ธฐ, ๊ณ„์‚ฐํ•˜๊ธฐ ๋“ฑ๋“ฑ ์ด๋‹ค.
Simple function to be used as a decorator to allow the decorated function to be threaded automatically
def threaded(func): @wraps(func) def wrapper(*args, **kwargs): thread = Thread(target=func, args=args, kwargs=kwargs) thread.start() return thread return wrapper
def timeit(func): @wraps(func) def wrapper(*args, **kwargs): # before calling the decorated function print('== starting timer') start = time.time() # call the decorated function func(*args, **kwargs) # after calling the decorated function end = time.tim...
Initializes the span, along with its header, and headers for any and all of its span blocks
def __init__(self, file: str): utils.log("Span: initializing from", file) self.file = file self.blocks = [] with open(file, 'rb') as spanFile: spanFile.seek(DiskHeader.OFFSET) try: self.header = DiskHeader(spanFile.read(DiskHeader.sizeof)) except ValueError as e: utils.log_exc("Span.__init__:...
def create_header(self, depth): if not (depth >= 0 and depth < len(self._headertexts)): return txt = self._headertexts[depth] if txt is None: return lbl = QtGui.QLabel(txt, self) return lbl
๋‚ ์”จ, ํ™”์ฐฝํ•˜๋‹ค, ๋ฐ–, ๋‚˜๊ฐ€๋‹ค, ์ข‹๋‹ค
๋‚ ์”จ๊ฐ€ ํ™”์ฐฝํ•  ๋•Œ ๋ฐ–์— ๋‚˜๊ฐ€์„œ ํ–‡๋ณ•์„ ์ฌ๋ฉด ๊ธฐ๋ถ„์ด ์ข‹๋‹ค.
์ „ํ†ต์ฃผ, ๊ณผ์‹ค์ฃผ๋Š” ๋ณต๋ถ„์ž, ํ‘๋ฏธ์ฃผ, ์†Œ๊ณก์ฃผ, ๊ณ ์ถ”์ˆ , ํ™์ฃผ ๋“ฑ์œผ๋กœ ์›๋ฃŒ๊ฐ€ ์ œ๊ฐ๊ธฐ ๋‹ค ๋‹ค๋ฅด๋‹ค.
๋ฐฅ ๋ฒ„๋ธ๋ผ๋Š” ๋ˆ„๊ตฌ์˜€๋Š”๊ฐ€?
๊ณ ์ธ(์‹ฌ์žฅ๋งˆ๋น„) ๋กœ๋ฒ„ํŠธ ์•ค๋“œ๋ฅ˜ ๋ฐฅ ๋ฒ ๋ฅด๋ธ๋ผ, ์ผ๋ช… ์บ”์ž์Šค ์‹œํ‹ฐ ์ •์œก์  ์ฃผ์ธ,์€ ์—ฐ์‡„ ์‚ด์ธ๋ฒ”์ด์ž ๊ฐ•๊ฐ„๋ฒ”์ด์—ˆ๋‹ค. ๋ฒ ๋ฅด๋ธ๋ผ๋Š” 1949๋…„ ์˜คํ•˜์ด์˜ค์ฃผ ์นด์•ผํ˜ธ๊ฐ€ ํญํฌ์—์„œ ํƒœ์–ด๋‚˜ ๊ฐ€ํ†จ๋ฆญ์œผ๋กœ ์ž๋ž์œผ๋‚˜, ์‹ญ๋Œ€ ์‹œ์ ˆ์— ๊ตํšŒ ์˜ˆ๋ฐฐ ์ฐธ์„์„ ์ค‘๋‹จํ–ˆ๋‹ค.
๊ณ ์ธ(์‹ฌ์žฅ๋งˆ๋น„) ๋กœ๋ฒ„ํŠธ ์•ค๋“œ๋ฅ˜ ๋ฐฅ ๋ฒ ๋ฅด๋ธ๋ผ, ์ผ๋ช… ์บ”์ž์Šค ์‹œํ‹ฐ ์ •์œก์  ์ฃผ์ธ,์€ ์—ฐ์‡„ ์‚ด์ธ๋ฒ”์ด์ž ๊ฐ•๊ฐ„๋ฒ”์ด์—ˆ๋‹ค. ๋ฒ ๋ฅด๋ธ๋ผ๋Š” 1949๋…„ ์˜คํ•˜์ด์˜ค์ฃผ ์นด์•ผํ˜ธ๊ฐ€ ํญํฌ์—์„œ ํƒœ์–ด๋‚˜ ๊ฐ€ํ†จ๋ฆญ์œผ๋กœ ์ž๋ž์œผ๋‚˜, ์‹ญ๋Œ€ ์‹œ์ ˆ์— ๊ตํšŒ ์˜ˆ๋ฐฐ ์ฐธ์„์„ ์ค‘๋‹จํ–ˆ๋‹ค.
Tests that a simple bspline that varies in a 3D coordinate system has the correct radius vector.
def test_three_axis_bspline_radius() -> None: # a length=1.0 curve in 3D control_points = np.array( [(0.0, 0.0, 0.0), (3.0 ** -0.5, 3.0 ** -0.5, 3.0 ** -0.5)] ) curve = BSplineCurve(control_points) for parameter in np.linspace(0.0, 1.0, num=5): radius = tuple(parameter * (3.0 ** -0.5...
def test_cressman_point(test_data): xp, yp, z = test_data r = 40 obs_tree = cKDTree(list(zip(xp, yp))) indices = obs_tree.query_ball_point([30, 30], r=r) dists = dist_2(30, 30, xp[indices], yp[indices]) values = z[indices] truth = 1.05499444404 value = cressman_point(dists, values,...
Store the mapping between an event's ID and its labels, with one row per (event_id, label) tuple.
def insert_labels_for_event_txn( self, txn, event_id, labels, room_id, topological_ordering ): return self.db.simple_insert_many_txn( txn=txn, table="event_labels", values=[ { "event_id": event_id, "label": l...
def label_encoding(df, features): mapped = {} encoders = {} for f in features: encoders[f] = LabelEncoder() encoders[f].fit(np.unique(df[f].astype(str).values)) mapped[f] = encoders[f].transform(df[f].astype(str).values) return mapped, encoders
๋ฐฑ๊ดด์‚ฌ์ „์˜ ์„ค๋ฆฝ์ž๋Š”?
๋ฐฑ๊ดด์‚ฌ์ „ ๋ฐฑ๊ดด์‚ฌ์ „(โ€”ไบ‹ๅ…ธ) ํ˜น์€ ์–ธ์‚ฌ์ดํด๋กœํ”ผ๋””์•„(์˜์–ด: Uncyclopedia)๋Š” ์œ„ํ‚ค๋ฐฑ๊ณผ๋ฅผ ํŒจ๋Ÿฌ๋””ํ•œ ์œ ๋จธ ์›น์‚ฌ์ดํŠธ๋กœ, 2005๋…„ 1์›” 5์ผ์— ์‹œ์ž‘๋˜์–ด ์ •๊ตํ•œ ํ’์ž์™€ ํŒจ๋Ÿฌ๋””์—์„œ๋ถ€ํ„ฐ ๋ฌด์ž‘์œ„์  ๊ฐœ๊ทธ๊นŒ์ง€ ์—ฌ๋Ÿฌ ์œ ๋จธ ์ˆ˜๋‹จ์„ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋‹ค. ์„ค๋ฆฝ์ž ์กฐ๋„ˆ์„  ํ™ฉ์ด โ€˜๋ˆ„๊ตฌ๋‚˜ ํŽธ์ง‘ํ•  ์ˆ˜ ์žˆ๋Š” ๋‚ด์šฉ ์—†๋Š” ๋ฐฑ๊ณผ์‚ฌ์ „โ€™(the content-free encyclopedia that anyone can edit, Uncyclopedia)์„ ์Šฌ๋กœ๊ฑด์œผ๋กœ ๋‚ด๊ฑธ์—ˆ๋‹ค. ์œ„ํ‚ค๋ฐฑ๊ณผ์™€ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ๋ฐฑ๊ดด์‚ฌ์ „๋„ ์‚ฌ์ดํŠธ์—์„œ ๋ฐ›์•„๋“ค์ผ ์ˆ˜ ์žˆ๋Š” ๊ฐ€์ด๋“œ๋ผ์ธ์„ ์ •ํ•ด ๋†“์€ ์ •์ฑ…๊ณผ ์ง€์นจ์ด ์žˆ์œผ๋ฉฐ, ์ด๋Ÿฐ ๊ทœ์ •๋“ค๋กœ ์ธํ•ด ๋‹ค๋ฅธ...
๋ฐฑ๊ดด์‚ฌ์ „ ๋ฐฑ๊ดด์‚ฌ์ „์€ ์œ„ํ‚ค๋ฐฑ๊ณผ์™€ ๋™์ผํ•œ ์—”์ง„์ธ ๋ฏธ๋””์–ด์œ„ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜๋ฉฐ, ๊ทธ ๋ฐ–์—๋„ ์‹œ์Šคํ…œ์˜ ๋งŽ์€ ๋ถ€๋ถ„๋“ค์ด ์œ„ํ‚ค๋ฐฑ๊ณผ์™€ ์œ ์‚ฌํ•˜๋‚˜, ์ฐจ์ด์ ๋„ ์žˆ๋‹ค.
Compute the Spectrum Kernel matrix using an occurrences dictionary of each sequence shingles list (to improve performances).
def occurrence_dict_spectrum_kernel(rows_data, cols_data): kernel_matrix = [] for rows_shingles_list in rows_data: row = [] rows_shingles_occ_dict = Counter(rows_shingles_list) for cols_shingles_list in cols_data: kernel = 0 cols_shingles_occ_dict = Counter(cols_s...
def generate_hm(height, width ,landmarks,s=3): Nlandmarks = len(landmarks) hm = np.zeros((height, width, Nlandmarks), dtype = np.float32) for i in range(Nlandmarks): if not np.array_equal(landmarks[i], [-1,-1]): hm[:,:,i] = gaussian_k(landmarks[i][0], ...
Upload a local charm to the model. This will automatically generate an archive from the charm dir.
async def add_local_charm_dir(self, charm_dir, series): fh = tempfile.NamedTemporaryFile() CharmArchiveGenerator(charm_dir).make_archive(fh.name) with fh: func = partial( self.add_local_charm, fh, series, os.stat(fh.name).st_size) charm_url = await self.lo...
def deploy(obj): logger.info(ASCII_LOGO) logger.info("Started local deployment at localhost:8080 ...\n") try: config = ConfigManager(os.path.join('.sagify.json')).get_config() api_local.deploy(dir=config.sagify_module_dir, docker_tag=obj['docker_tag'], image_name=config.image_name) exce...
Scheduling a delayed call at a point in the extreme future does not prevent normal reactor operation.
def test_distantDelayedCall(self): reactor = self.buildReactor() if IReactorThreads.providedBy(reactor): def eventSource(reactor, event): msg( format="Thread-based event-source scheduling %(event)r", event=event ) reactor.c...
def periodicCall(self): self.processIncoming( ) self.after(200, self.periodicCall)
์ง€๋ช…์— ํ•„์š”ํ•œ ๋ฏผ์ฃผ๋‹น ๋Œ€์˜์›์˜ ์ˆ˜๋Š” ์–ผ๋งˆ์ž…๋‹ˆ๊นŒ?
๋ฏผ์ฃผ๋‹น ํ›„๋ณด ์ง€๋ช…์„ ์–ป๊ธฐ ์œ„ํ•ด ํ•„์š”ํ•œ ๋Œ€์˜์› ์ˆ˜๋Š” 2,025๋ช…์ด๋‹ค. ๋ฏผ์ฃผ๋‹น ์‹œ์Šคํ…œ์€ ๋น„๋ก€์ ์œผ๋กœ ์„ค๊ณ„๋˜์—ˆ์œผ๋ฉฐ, ์ด๋Š” ๋ฒ„๋ฝ ์˜ค๋ฐ”๋งˆ ์ƒ์›์˜์›(D-IL)๊ณผ ํž๋Ÿฌ๋ฆฌ ํด๋ฆฐํ„ด ์ƒ์›์˜์›(D-NY)์ด ๋Œ€๋žต ๋น„์Šทํ•œ ์ˆ˜์˜ ๋Œ€์˜์›์„ ์–ป์„ ์ˆ˜ ์žˆ์Œ์„ ์˜๋ฏธํ•œ๋‹ค๊ณ  ํ”ผํ„ฐ ๋ฒ ์ธํ•˜๋ฅดํŠธ(CFR์˜ ๋ฏธ๊ตญ ์™ธ๊ต ์ •์ฑ… ์ˆ˜์„ ์—ฐ๊ตฌ์›)๊ฐ€ ๋งํ–ˆ๋‹ค.
๋ฏผ์ฃผ๋‹น ํ›„๋ณด ์ง€๋ช…์„ ์–ป๊ธฐ ์œ„ํ•ด์„œ๋Š” 2025๋ช…์˜ ๋Œ€์˜์›์ด ํ•„์š”ํ•˜๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ํ•„์š”ํ•œ ๋Œ€์˜์›์˜ 40% ์ด์ƒ์ด ์ด๋ฅธ๋ฐ” ์Šˆํผ ๋Œ€์˜์›์ด๋‹ค.
๋ง๋ฒˆ์€ ํŽœ์‹ค๋ฒ ์ด๋‹ˆ์•„์˜ ์–ด๋А ์นด์šดํ‹ฐ์— ์œ„์น˜ํ•ด ์žˆ์Šต๋‹ˆ๊นŒ?
๋ง๋ฒˆ, PA. ์˜จ๋ผ์ธ ์ œ์•ˆ. ๋ง๋ฒˆ์€ ๋ฏธ๊ตญ ํŽœ์‹ค๋ฒ ์ด๋‹ˆ์•„์ฃผ ์ฒด์Šคํ„ฐ ์นด์šดํ‹ฐ์— ์œ„์น˜ํ•œ ์ž์น˜๊ตฌ์ž…๋‹ˆ๋‹ค. 2010๋…„ ์ธ๊ตฌ ์กฐ์‚ฌ์— ๋”ฐ๋ฅด๋ฉด ์ธ๊ตฌ๋Š” 2,998๋ช…์ด์—ˆ์Šต๋‹ˆ๋‹ค. ์ž์น˜๊ตฌ๋ฅผ ๊ด€ํ†ตํ•˜๋Š” ์ฃผ์š” ๋„๋กœ๋Š” ํ‚น ์ŠคํŠธ๋ฆฌํŠธ์ด๋ฉฐ, ์ž์น˜๊ตฌ๋Š” ๋‚จ์ชฝ์œผ๋กœ๋Š” ํŒŒ์˜ฌ๋ฆฌ ํŒŒ์ดํฌ์™€ ์ ‘ํ•ด ์žˆ๊ณ , ๋ถ์ชฝ์œผ๋กœ๋Š” US 30 ๊ทผ์ฒ˜์— ์œ„์น˜ํ•ด ์žˆ์Šต๋‹ˆ๋‹ค. ์ฃผ์š” ๊ต์ฐจ ๋„๋กœ๋Š” ์›Œ๋ Œ ์• ๋น„๋‰ด์ž…๋‹ˆ๋‹ค.
ํ”„๋ ˆ์ด์ € ๋ง๋ฒˆ ํŽœDOT ์šด์ „ ๋ฉดํ—ˆ ์„ผํ„ฐ, ๋ง๋ฒˆ, ํŽœ์‹ค๋ฒ ์ด๋‹ˆ์•„; ํ”„๋ ˆ์ด์ € ๋ง๋ฒˆ ํŽœDOT ์šด์ „ ๋ฉดํ—ˆ ์„ผํ„ฐ์˜ ์šด์˜ ์‹œ๊ฐ„, ์ฃผ์†Œ, ์˜ˆ์•ฝ, ์ „ํ™”๋ฒˆํ˜ธ, ํœด์ผ ๋ฐ ์„œ๋น„์Šค. ํ”„๋ ˆ์ด์ € ๋ง๋ฒˆ ํŽœDOT ์šด์ „ ๋ฉดํ—ˆ ์„ผํ„ฐ์˜ ์šด์˜ ์‹œ๊ฐ„, ์ฃผ์†Œ, ์˜ˆ์•ฝ, ์ „ํ™”๋ฒˆํ˜ธ, ํœด์ผ ๋ฐ ์„œ๋น„์Šค.
Choose a item based its probability. prob_map contains mapping from probability to a list of items, e.g.
def prob_choice(prob_map, default=[]): rand = random.random() base = 0 for prob, items in prob_map.iteritems(): if rand >= base and rand < base + prob: return random.choice(items) base += prob # default return random.choice(default)
def decision(probability): return random.random() < probability
Check if a partition is unmounted and unmounts if necessary (only if it was mounted by LiloSetup).
def check_and_unmount(partition): mount_info=commands.getoutput("mount").splitlines() while mount_info: if partition in mount_info[0] : # The partition is mounted, we need to unmount it and remove the temporary mountpoint. # First we unmount the device but only if if was mounted ...
def unmount(self): #If nothing is mounted at the mountpoint, we needn't go further. currentMountPoint = self.getCurrentMountPoint() self.debug("The current mount point for " + self.name + " is: " + str(currentMountPoint) + "\n", 3) if not currentMountPoint: self.debug("This drive is not mounted: " + self.de...
An initializer for the cog. It just set the logging level and send the patchnote if asked.
async def _initialize(self, send_patchnote: bool = True) -> None: log_level = await self.data.log_level() log.setLevel(log_level) log.info("Captcha logging level has been set to: {lev}".format(lev=log_level)) log.debug( "This logging level is reserved for testing and monitori...
def __init__(self, logger): self.logger = logger
Returning click add new adjustment statement button Implementing logging for click add new adjustment statement button functionality
def click_add_new_adjustment_statement_button(self): is_clicked = None try: self.logger.info('Start: click add new adjustment statement button') self._bill_and_audit_page.click_add_new_adjustment_statement_button() is_clicked = True except WebDriverException a...
def is_new_adjustment_charge_created(self): try: self.logger.info('Start: is new adjustment charge created') return self._bill_and_audit_page.is_new_adjustment_charge_created() except WebDriverException as exp: self.logger.error(exp.msg) raise fina...
Allocate buffers. If an argument is not given, then the specific shape/data type will not be modified.
def allocate_buffers(self, send_shape = 0, send_dtype = None, recv_shape = 0, recv_dtype = None): if(send_shape is not 0 and send_dtype is not None): if self.send is not None: logging.error('The <send buffer> has already been allocated with dimensions:{}'.format([self.send....
def pc_input_buffers_full(self, *args): return _ofdm_allocator_swig.allocator_subcarrier_sptr_pc_input_buffers_full(self, *args)
separates document by items from the file, and saves file with ending filename being the item number
def separate_item(directory, tokenized): for subdir, dirs, files in os.walk(directory): for filename in files: if filename.endswith('.txt'): name_path = os.path.join(subdir, filename) filename_list = filename.rsplit("_") company = str(filename_lis...
def parse_docs_from_page(self, page_url: str, page_text: str) -> Iterable[Document]: soup = bs4.BeautifulSoup(page_text, features="lxml") usc_item_divs = soup.select('div.uscitemlist > div.uscitem') parsed_docs = [] for item_idx, item_div in enumerate(usc_item_divs): title...
Returns a sliding window of width winsize and step of winstep from the data. Returns a list.
def window(seq, winsize, winstep): assert winsize >= winstep, "Window step must me at most window size." gen = islice(window_1(seq, n=winsize), None, None, winstep) for result in gen: yield list(result)
def window(iterable, stride=3): for i in range(len(iterable) - stride + 1): yield iterable[i: i + stride]
๋‹ด๋‹นํ•˜๋‹ค, ํšŒ์‚ฌ, ์ผ, ์ค‘์š”ํ•˜๋‹ค, ๋ถ€์„œ, ์šฐ๋ฆฌ
์šฐ๋ฆฌ ๋ถ€์„œ๋Š” ํšŒ์‚ฌ์—์„œ ๊ฐ€์žฅ ์ค‘์š”ํ•œ ์ผ์„ ๋‹ด๋‹นํ•˜๊ณ  ์žˆ๋‹ค.
์žฌ์ฃผ๋Š” ์˜ˆ์ ˆ, ์Œ์•…, ํ™œ์˜๊ธฐ, ๊ธ€์“ฐ๊ธฐ, ๋งํƒ€๊ธฐ, ๊ณ„์‚ฐํ•˜๊ธฐ ๋“ฑ๋“ฑ ์ด๋‹ค.
์ฒซ ๋ฒˆ์งธ ์œ ๋Ÿฝ ์‹๋ฏผ์ง€ ๊ฐœ์ฒ™์ž๋“ค์€ ์–ด๋””์—์„œ ์™”์Šต๋‹ˆ๊นŒ?
๊ทธ๋Ÿฌ๋‚˜ 1650๋…„๊นŒ์ง€ ์ž‰๊ธ€๋žœ๋“œ๋Š” ๋Œ€์„œ์–‘ ์—ฐ์•ˆ์— ์ง€๋ฐฐ์ ์ธ ์กด์žฌ๊ฐ์„ ํ™•๋ฆฝํ•˜์˜€๋‹ค. ์ฒซ ๋ฒˆ์งธ ์‹๋ฏผ์ง€๋Š” 1607๋…„ ๋ฒ„์ง€๋‹ˆ์•„์˜ ์ œ์ž„์Šคํƒ€์šด์— ์„ค๋ฆฝ๋˜์—ˆ๋‹ค. ์‹ ์„ธ๊ณ„์— ์ •์ฐฉํ•œ ๋งŽ์€ ์‚ฌ๋žŒ๋“ค์€ ์ข…๊ต์  ๋ฐ•ํ•ด๋ฅผ ํ”ผํ•˜๊ธฐ ์œ„ํ•ด ์™”๋‹ค. ํ”Œ๋ฆฌ๋จธ์Šค, ๋งค์‚ฌ์ถ”์„ธ์ธ ์˜ ์ฐฝ๋ฆฝ์ž์ธ ํ•„๊ทธ๋ฆผ๋“ค์€ 1620๋…„์— ๋„์ฐฉํ•˜์˜€๋‹ค. ๋ฒ„์ง€๋‹ˆ์•„์™€ ๋งค์‚ฌ์ถ”์„ธ์ธ  ๋ชจ๋‘์—์„œ ์‹๋ฏผ์ง€ ๊ฐœ์ฒ™์ž๋“ค์€ ์›์ฃผ๋ฏผ์˜ ์ผ๋ถ€ ๋„์›€์„ ๋ฐ›์•„ ๋ฒˆ์ฐฝํ•˜์˜€๋‹ค.
1750๋…„๊นŒ์ง€ ์ž๋ฉ”์ด์นด๋Š” ์˜๊ตญ์˜ ์นด๋ฆฌ๋ธŒํ•ด ์‹๋ฏผ์ง€ ์ค‘ ๊ฐ€์žฅ ์ค‘์š”ํ•œ ๊ณณ์ด ๋˜์—ˆ์œผ๋ฉฐ, ๊ฒฝ์ œ์  ์ค‘์š”์„ฑ์—์„œ ๋ฐ”๋ฒ ์ด๋„์Šค๋ฅผ ๋Šฅ๊ฐ€ํ•˜์˜€์Šต๋‹ˆ๋‹ค. ์นด๋ฆฌ๋ธŒํ•ด์˜ ์ฒซ ๋ฒˆ์งธ ์‹๋ฏผ์ง€ ๊ฐœ์ฒ™์ž๋“ค์€ ์ด ์ง€์—ญ์—์„œ ๊ทธ๋“ค์˜ ๋ณธ๊ตญ ์œ ๋Ÿฝ ์‚ฌํšŒ๋ฅผ ์žฌํ˜„ํ•˜๋ ค๊ณ  ํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ์ ์—์„œ ์นด๋ฆฌ๋ธŒํ•ด์˜ ์ดˆ๊ธฐ ์‹๋ฏผ์ง€ ๊ฐœ์ฒ™์ž๋“ค์˜ ๋ชฉํ‘œ์™€ ์„ธ๊ณ„๊ด€์€ ๋ถ๋ฏธ ๋ณธํ† ์˜ ์‹๋ฏผ์ง€ ๊ฐœ์ฒ™์ž๋“ค๊ณผ ํฌ๊ฒŒ ๋‹ค๋ฅด์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค. ์นด๋ฆฌ๋ธŒํ•ด์—์„œ ์ฒซ ๋ฒˆ์งธ ์ œ๋Œ€๋กœ ๋œ ์œ ๋Ÿฝ ์ •์ฐฉ์ง€๋Š” 1502๋…„, ์„œ๋ถ€ ์ŠคํŽ˜์ธ์˜ ์ถฉ์‹คํ•œ ๊ตฐ์ธ์ธ ๋‹ˆ์ฝœ๋ผ์Šค ๋ฐ ์˜ค๋ฐ˜๋„๊ฐ€ ์•ฝ 2,500๋ช…์˜ ์ŠคํŽ˜์ธ ์‹๋ฏผ์ง€ ๊ฐœ์ฒ™์ž๋ฅผ ๋™๋ถ€ ์ด์ŠคํŒŒ๋‹ˆ์˜ฌ๋ผ์— ์ •์ฐฉ์‹œํ‚ค๋ฉด์„œ ์‹œ์ž‘๋˜์—ˆ์Šต๋‹ˆ๋‹ค.
If a primer is found at the end of a sequence, the correct value must be returned.
def testFoundAtEnd(self): seq = Seq("ACGT") self.assertEqual([2], findPrimer("GT", seq))
def max_le(seq, val): idx = len(seq)-1 while idx >= 0: if seq[idx] <= val: return seq[idx] idx -= 1 return None
์•„์ผ๋žœ๋“œ๋ฅผ ๋ณด๊ธฐ ๊ฐ€์žฅ ์ข‹์€ ์‹œ๊ธฐ
๋ด„์€ ์•„์ผ๋žœ๋“œ๋ฅผ ๋ฐฉ๋ฌธํ•˜๊ธฐ์— ํ›Œ๋ฅญํ•œ ์‹œ๊ธฐ์ž…๋‹ˆ๋‹ค. ๊ธฐ์˜จ์ด ๋”ฐ๋œปํ•ด์ง€๊ณ  ๊ฝƒ์ด ๋งŒ๊ฐœํ•ฉ๋‹ˆ๋‹ค. ์—ฌ๋ฆ„๋งŒํผ ํ’๋ถ€ํ•˜์ง€๋Š” ์•Š์ง€๋งŒ ์—ฌ์ „ํžˆ ์ผ์กฐ๋Ÿ‰์ด ๋งŽ์Šต๋‹ˆ๋‹ค. ๊ด€๊ด‘ ๋ช…์†Œ๋Š” ์šด์˜๋˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ๋ด„์€ ์—ฌ๋ฆ„๋งŒํผ ๋ฐ”์˜์ง€๋Š” ์•Š์ง€๋งŒ ์•„์ผ๋žœ๋“œ์—์„œ ๋‘ ๋ฒˆ์งธ๋กœ ๋ฐ”์œ ์—ฌํ–‰ ์‹œ์ฆŒ์ž…๋‹ˆ๋‹ค. 9์›”์—์„œ 10์›”์€ ์•„์ผ๋žœ๋“œ๋ฅผ ๋ฐฉ๋ฌธํ•˜๊ธฐ์— ๊ฐ€์žฅ ์ข‹์€ ์‹œ๊ธฐ ์ค‘ ํ•˜๋‚˜์ž…๋‹ˆ๋‹ค. ํ•ด๊ฐ€ ์ €๋ฌผ์ง€ ์•Š๊ณ  9์‹œ๊นŒ์ง€ ๋ฐ์œผ๋ฉฐ, ๊ธฐ์˜จ์€ ์—ฌ์ „ํžˆ ๋”ฐ๋œปํ•˜๊ณ  ๊ฐ•์ˆ˜๋Ÿ‰์€ ๋‹ค๋ฅธ ๊ณ„์ ˆ๋ณด๋‹ค ์ ์Šต๋‹ˆ๋‹ค. ์ด ์‹œ์ฆŒ์—๋Š” ๊ด€๊ด‘๊ฐ๋“ค์ด ์•„์ผ๋žœ๋“œ๋ฅผ ๋ฐฉ๋ฌธํ•˜๋ฏ€๋กœ ๊ฑฐ๋ฆฌ์™€ ๋ช…์†Œ๊ฐ€ ํ™ฉ๋Ÿ‰ํ•˜์ง€ ์•Š์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค.
์‚ฌ๋žŒ๋“ค์€ ์ข…์ข… ์•„์ผ๋žœ๋“œ๋ฅผ ๋ฐฉ๋ฌธํ•˜๊ธฐ์— ๊ฐ€์žฅ ์ข‹์€ ์‹œ๊ธฐ๊ฐ€ ์–ธ์ œ์ธ์ง€ ๋ฌป์Šต๋‹ˆ๋‹ค. ๊ทธ์— ๋Œ€ํ•œ ๋Œ€๋‹ต์€ ๊ฒฐ์ฝ” ์‰ฝ์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์•„์ผ๋žœ๋“œ๋Š” ๋‚ ์”จ๊ฐ€ ์—ฐ์ค‘ ๋น„๊ต์  ์ผ๊ด€๋˜๋‹ค๋Š” ์ ์—์„œ ํŠน์ดํ•ฉ๋‹ˆ๋‹ค. ๋‹ค์‹œ ๋งํ•ด, ๊ฑฐ์˜ ํ•ญ์ƒ ์•ฝ๊ฐ„์˜ ๋น„๋ฅผ ๋งž์„ ๊ฒƒ์ด๋ผ๊ณ  ๋ณด์žฅ๋ฉ๋‹ˆ๋‹ค.
Does the ''find_articulation_vertices'' function return a pair of articulation vertices for a graph where there are two?
def test_articulation_vertices_dual_cut_vertices(self): graph = utility_functions.build_simple_test_graph() expected = [1, 2] calculated = find_articulation_vertices(graph) calculated.sort() self.assertEqual(expected, calculated)
def test_vertex_neighbors(self): if not self.test_abstract(): bob, steve, friendship = self.test_make_edge_keyname() # see if we can get bob's friends, which should include steve _q = bob.neighbors(keys_only=True).fetch(adapter=self.subject(), limit=10) assert steve.key in _q, ( "f...
_makeWMStep_ Convienience method, instantiate a new WMStep with the name provided and wrap it in a helper
def makeWMStep(stepName): return WMStepHelper(WMStep(stepName))
def createPanelFile(cls, name=None): main.__dict__[cls.__name__] = cls if not name: name = cls.__name__ xml = '''<?xml version="1.0" encoding="UTF-8"?> <pythonPanelDocument> <interface name="{0}" label="{1}" icon="MISC_python"> <script><![CDATA[main = __import__('__main__') def createInterfac...
์ „์Ÿ, ์†Œ๋ฌธ, ๊ตญ๋ฏผ๋“ค, ํ˜ผ๋ž€, ๋น ์ง€๋‹ค, ๋‹ค๊ฐ€์˜ค๋‹ค
๊ตญ๊ฐ€์˜ ์ „์Ÿ์ด ๋‹ค๊ฐ€์˜จ๋‹ค๋Š” ์†Œ๋ฌธ์— ๊ตญ๋ฏผ๋“ค์ด ํ˜ผ๋ž€์— ๋น ์กŒ๋‹ค.
์žฌ์ฃผ๋ผ๋Š” ๊ฒƒ์€ ์˜ˆ์ ˆ, ์Œ์•…, ํ™œ์˜๊ธฐ, ๊ธ€์“ฐ๊ธฐ, ๋งํƒ€๊ธฐ, ๊ณ„์‚ฐํ•˜๊ธฐ๋‹ค.
๋…ธ์ด์พฐ๋ฅธ๊ตฌ๋Š” ์ง€์—ญ ์†Œ์žฌ 76๊ฐœ๊ต ์ „์ฒด์— ํ•™๊ต๊ฒฝ๋น„์šฉ์—ญ์„ ๋ฐฐ์น˜ํ•œ ํ›„ ํ•™๊ต์ถœ์ž…ํ†ต์ œ ์—…๋ฌด๋ฅผ ๋งก๊ฒผ์–ด
๋ฏผ๊ฐ„๊ฒฝ๋น„์šฉ์—ญํšŒ์‚ฌ์ธ 'Germania'์™€ ๊ณ„์•ฝ์„ ์ฒด๊ฒฐํ•œ ๋…ธ์ด์พฐ๋ฅธ๊ตฌ๋Š” ํ”„๋กœ์ ํŠธ์— ์ฐธ์—ฌ๋ฅผ ์›ํ•˜๋Š” ํ•™๊ต๋Š” ํ•™๊ตํ˜‘์˜ํšŒ์˜ ๋™์˜๋ฅผ ์–ป๋„๋ก ํ–ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  2007๋…„ 12์›”๋ถ€ํ„ฐ 2008๋…„ 7์›”๊นŒ์ง€ ๋…ธ์ด์พฐ๋ฅธ๊ตฌ์— ์†Œ์žฌํ•œ ์ด 76๊ฐœ๊ต ์ค‘ 13๊ฐœ๊ต์— 20๋ช…์˜ ํ•™๊ต๊ฒฝ๋น„์šฉ์—ญ์„ ํˆฌ์ž…ํ•˜์—ฌ ํ•™๊ต์ถœ์ž…ํ†ต์ œ ๊ด€๋ จ ์—…๋ฌด๋ฅผ ๋‹ด๋‹นํ•˜๊ฒŒ ํ–ˆ๋‹ค.
๋‘˜์งธ, ๋…ธ์ด์พฐ๋ฅธ๊ตฌ์˜ ์žฌ์ • ๋ถ€๋‹ด์ด ํฌ๋‹ค๋Š” ๋ฌธ์ œ๋„ ์ œ๊ธฐ๋˜์—ˆ๋‹ค. ๋‹น์‹œ ๋…ธ์ด์พฐ๋ฅธ๊ตฌ๋Š” 8,400๋งŒ ์œ ๋กœ๋ฅผ ๊ธด์ถ• ์žฌ์ •ํ•ด์•ผ ํ•˜๋Š” ์ƒํ™ฉ์ด๋ฏ€๋กœ, ์ „์ฒด ํ•™๊ต๋ฅผ ๋Œ€์ƒ์œผ๋กœ ๋ฏผ๊ฐ„๊ฒฝ๋น„์šฉ์—ญ์„ ์‹ค์‹œํ•˜๊ธฐ๋Š” ๋ถˆ๊ฐ€๋Šฅํ•˜๋‹ค๋Š” ์˜๊ฒฌ์ด ์ง€๋ฐฐ์ ์ด์—ˆ๋‹ค.
๋ชธ, ๋˜๋‹ค, ๊ธฐ์˜๋‹ค, ์ž์œ 
ํ•™๊ต๋ฅผ ๋– ๋‚˜ ์ž์œ ์˜ ๋ชธ์ด ๋˜์–ด ๊ธฐ์˜๋‹ค.
์ „ํ†ต์ฃผ, ๊ณผ์‹ค์ฃผ๋Š” ๋ณต๋ถ„์ž, ํ‘๋ฏธ์ฃผ, ์†Œ๊ณก์ฃผ, ๊ณ ์ถ”์ˆ , ํ™์ฃผ ๋“ฑ์œผ๋กœ ์›๋ฃŒ๊ฐ€ ์ œ๊ฐ๊ธฐ ๋‹ค ๋‹ค๋ฅด๋‹ค.
Tests that we can save and load state_dict for observers that are scripted in a quantized model.
def test_save_load_state_dict_script(self): obs_list = [MinMaxObserver, MovingAverageMinMaxObserver, HistogramObserver] for obs in obs_list: model = SingleLayerLinearModel().eval() qconfig = QConfig(activation=default_observer, weight=obs) qconfig_dict = {'' : qconfi...
def test_state_processed(self): job_record = get_job_record(job.STATE_PROCESSED, TEST_PRESET_TIMEPERIOD, PROCESS_SITE_HOURLY) self.sm_real.manage_job(job_record) self.assertEqual(len(self.sm_real.update_job.call_args_list), 0) self.assertEqual(len(self.time_table_mocked.get_tree.call_ar...
Find the root path by iterating to the root looking for the ``root_contained_file`` starting from directory ``start_path``.
def find_root(cls, start_path: Path, root_contained_file: Path = None) -> Path: if root_contained_file is None: root_contained_file = cls.DEFAULT_ROOT_CONTAINED_FILE logger.debug(f'using setup path: {start_path}') nname, dname = None, start_path while nname ...
def root_dir(): curr_dir = os.getcwd() while True: splited = os.path.dirname(curr_dir) if curr_dir == splited: break curr_dir = splited log.debug(">>> Root dir: %s" % curr_dir) return curr_dir
์กฐ์„ ์—…๊ณ„ ๋Œ€ํ˜• 3์‚ฌ ๊ฐ„ ์ œํœด ๋ฐ ํ˜‘๋ ฅ์ด ๊ฒ€ํ† ๋˜๊ณ  ์žˆ๋Š” ๋ถ„์•ผ๋Š” ๋ญ๋‹ˆ
3๋Œ€ ํ˜์‹ ์„ ํ†ตํ•œ ์กฐ์„ ์‚ฐ์—… ๋ฐœ์ „์ „๋žต - ์›๊ฐ€ํ˜์‹ , ๊ธฐ์ˆ ํ˜์‹ , ์‹œ์Šคํ…œํ˜์‹  - โ…ค. ์กฐ์„ ์—… ๋ฐœ์ „์ „๋žต ์ถ”์ง„๋ฐฉ์•ˆ 1 ์กฐ์„ ์‚ฌ๊ฐ„ ๊ฒฝ์Ÿ ๊ตฌ๋„ ๋ฐ ์‚ฌ์—… ์žฌํŽธ ๏€€ (๋Œ€ํ˜• 3์‚ฌ) ์‹œ์žฅยท์—…๊ณ„ ์ž์œจ์  ๋…ผ์˜๋ฅผ ํ†ตํ•œ ๊ฒฝ์Ÿ๊ตฌ๋„ ๋ณ€ํ™” ใ…‡ ํ˜„์žฌ์˜ ์œ„๊ธฐ๊ทน๋ณต์„ ์œ„ํ•œ ๋Œ€ํ˜• 3็คพ๋ณ„ ์ž๊ตฌ๊ณ„ํš* ์ดํ–‰ํ•˜๋Š” ํ•œํŽธ, ์ค‘์žฅ๊ธฐ ์ฒด์งˆ ์ „ํ™˜๊ณผ ํ•ต์‹ฌ ๊ฒฝ์Ÿ๋ ฅ ์œ ์ง€ ์œ„ํ•œ ๋…ธ๋ ฅ๋„ ๋ณ‘ํ–‰ * ์ž๊ตฌ๊ณ„ํš ์ดํ–‰๋ฅ (2018.2์›”): ํ˜„๋Œ€3์‚ฌ 100.5%, ์‚ผ์„ฑ์ค‘ 71.1%, ๋Œ€์šฐ์กฐ์„  47.4% ใ…‡ ๋Œ€ํ˜• 3็คพ๊ฐ„ ํ•ด์–‘ํ”Œ๋žœํŠธ ๊ด€๋ จ ์ œํœดยทํ˜‘๋ ฅ ๋ฐฉ์•ˆ์„ ๊ฒ€ํ†  ใ…‡ ์‹œ์žฅ์—ฌ๊ฑด, ๊ฒฝ์˜์ •์ƒํ™” ์ถ”์ด ๋“ฑ์„ ๊ฐ์•ˆํ•˜์—ฌ ์ค‘์žฅ๊ธฐ์ ์œผ๋กœ ๋Œ€์šฐ์กฐ์„ ์˜ ์ฃผ์ธ์ฐพ๊ธฐ ๊ฒ€ํ†  ๏€€ (...
๋ฏธ๋ž˜ ์กฐ์„ ํ•ด์–‘์‚ฐ์—… ํŠนํ—ˆ์ธ๋ ฅ์–‘์„ฑ์„ ์œ„ํ•ด ์‚ฐยทํ•™ยท๊ด€์ด ์†์žก๊ณ  ๋‚˜์„œ ์šฐ๋ฆฌ๋‚˜๋ผ ์กฐ์„ ํ•ด์–‘๋ถ„์•ผ ๋Œ€ํ•™์ƒ๋“ค์˜ ํŠนํ—ˆ์—ญ๋Ÿ‰์„ ๋†’์ด๊ธฐ ์œ„ํ•ด ํŠนํ—ˆ์ฒญ (์ฒญ์žฅ ๊น€์˜๋ฏผ)๊ณผ ๋Œ€ํ•œ์กฐ์„ ํ•™ํšŒ(ํšŒ์žฅ ***), ๊ทธ๋ฆฌ๊ณ  ๊ตญ๋‚ด ์กฐ์„ ์—…๊ณ„ ๋“ฑ 3์ž๊ฐ€ ํ•จ๊ป˜ ์†์žก๊ณ  ๋‚˜์„ฐ๋‹ค. ์ตœ๊ทผ ์„ธ๊ณ„ ์กฐ์„ ์—…๊ณ„๋Š” ์šฐ๋ฆฌ๋‚˜๋ผ, ์ผ๋ณธ, ์ค‘๊ตญ ๋“ฑ์„ ์ค‘์‹ฌ์œผ๋กœ ๊ณ ๋ถ€๊ฐ€ ๊ฐ€์น˜์„ , ๊ณ ํšจ์œจ ์นœํ™˜๊ฒฝ ์„ ๋ฐ• ๋ถ„์•ผ ๋“ฑ์—์„œ ์ฃผ๋„๊ถŒ์„ ํ™•๋ณดํ•˜๊ธฐ ์œ„ํ•œ ๊ธฐ์ˆ ๊ฒฝ์Ÿ์ด ๋งค์šฐ ์น˜์—ดํ•œ ์ƒํ™ฉ์ด๋‹ค. ๊ตญ๋‚ด ์กฐ์„ ์—…๊ณ„๋„ ๋Œ€ํ˜• ์กฐ์„  3์‚ฌ(ํ˜„๋Œ€์ค‘๊ณต์—…, ๋Œ€์šฐ์กฐ์„ ํ•ด์–‘, ์‚ผ์„ฑ์ค‘๊ณต์—…)๋ฅผ ์ค‘์‹ฌ์œผ๋กœ ์—ฐ๊ตฌ๊ฐœ๋ฐœ์— ๋งค์ง„ํ•˜๊ณ  ์žˆ๊ณ , ์—ฐ๊ฐ„ ์•ฝ 5,000์—ฌ ๊ฑด์˜ ํŠนํ—ˆ๋ฅผ ์ถœ์›ํ•˜๊ณ  ์žˆ๋‹ค. ์ด๋Š” ํ•˜๋ฃจ ์•ฝ 14๊ฑด์˜ ...
๋žจ๋ฒ„์Šค๋ž€ ๋ฌด์—‡์ธ๊ฐ€?
๋žจ๋ฒ„์Šค(Rambus)๋Š” ์บ˜๋ฆฌํฌ๋‹ˆ์•„์— ๋ณธ์‚ฌ๋ฅผ ๋‘” ํšŒ์‚ฌ๋กœ, 1990๋…„์— ์„ค๋ฆฝ๋˜์—ˆ์œผ๋ฉฐ 1997๋…„์— ๋ธ๋ผ์›จ์–ด ์ฃผ๋กœ ์žฌ์„ค๋ฆฝ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ด ํšŒ์‚ฌ๋Š” 1997๋…„์— NASDAQ์— RMBS๋ผ๋Š” ์ฝ”๋“œ๋กœ ์ƒ์žฅ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. 2006๋…„ 2์›” ๊ธฐ์ค€์œผ๋กœ, ๋žจ๋ฒ„์Šค๋Š” ๊ณ ๊ฐ์—๊ฒŒ ์นฉ ์ธํ„ฐํŽ˜์ด์Šค์— ๋Œ€ํ•œ ํŠนํ—ˆ ๋ผ์ด์„ผ์Šค๋ฅผ ์ œ๊ณตํ•จ์œผ๋กœ์จ ์—ฐ๊ฐ„ ์ˆ˜์ต์˜ ๋Œ€๋ถ€๋ถ„์„ ์ฐฝ์ถœํ•˜๊ณ  ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.
์ •์˜ - Rambus ๋™์  ์ž„์˜ ์ ‘๊ทผ ๋ฉ”๋ชจ๋ฆฌ(RDRAM)์˜ ์˜๋ฏธ๋Š” ๋ฌด์—‡์ธ๊ฐ€? Rambus ๋™์  ์ž„์˜ ์ ‘๊ทผ ๋ฉ”๋ชจ๋ฆฌ(RDRAM)๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ๋” ๋น ๋ฅธ ์†๋„๋กœ ์ „์†กํ•˜๊ธฐ ์œ„ํ•ด ์„ค๊ณ„๋œ ๋ฉ”๋ชจ๋ฆฌ ์„œ๋ธŒ์‹œ์Šคํ…œ์ด๋‹ค. RDRAM์€ ์ž„์˜ ์ ‘๊ทผ ๋ฉ”๋ชจ๋ฆฌ(RAM), RAM ์ปจํŠธ๋กค๋Ÿฌ ๋ฐ RAM์„ ๋งˆ์ดํฌ๋กœํ”„๋กœ์„ธ์„œ์™€ ๊ธฐํƒ€ PC ์žฅ์น˜์— ์—ฐ๊ฒฐํ•˜๋Š” ๋ฒ„์Šค ๊ฒฝ๋กœ๋กœ ๊ตฌ์„ฑ๋œ๋‹ค. RDRAM์€ 1999๋…„ Rambus, Inc.์— ์˜ํ•ด ๋„์ž…๋˜์—ˆ๋‹ค.
Function to switch the point of view of the chessboard. Will switch maxPlayer's peices to opponent's chessPieces
def changePerspective(self): # We only need to loop through the 'top' of the board for index in range(32): # Set our current row and column with respect to index row = index//8 column = index % 8 # If we are currently on one of our peices if s...
def game(self): self.board_printer() while self.moves_counter < 9 and not self.winner: self.new_coordinates() self.moves_counter += 1 self.board_printer() self.check_winner() self.change_players() if not self.winner: print('...
if you wanted to know the mean and CI of m samples taken at a value x_val
def predictSamples(m, x_val, x, y): n = len(x) x_mean = np.mean(x) yhat, upper, lower, stats = regression_with_CI(x, y) # mean at x_val: y_val = stats['a'] + stats['b'] * x_val # standard error of measurement at x_val for m samples: s_m = math.sqrt( stats['MS']*(1./m + 1./n + (x_val - x_mean)**2 / \ ...
def _batch_stats(self, x): mu = torch.mean(x, dim=0, keepdim=True) var = torch.var(x, dim=0, keepdim=True) return mu, var
์žฌ๋ถ„๋ฐฐ ์ •์˜ ์ •๋ถ€
์žฌ์กฐ์ •. ์˜ํšŒ ์„ ๊ฑฐ๊ตฌ๊ฐ€ ์žฌ์„ค๊ณ„๋˜๊ณ  ํ•˜์›์—์„œ ์ฃผ๋“ค ๊ฐ„์— ์˜์„์ด ์žฌ๋ถ„๋ฐฐ๋˜๋Š” ๊ณผ์ •. ์žฌ์กฐ์ •์€ ์ธ๊ตฌ ์กฐ์‚ฌ ๋ฐ์ดํ„ฐ๊ฐ€ ์„ ๊ฑฐ๊ตฌ์˜ ์ธ๊ตฌ ๋ณ€ํ™”๋ฅผ ๋ณด๊ณ ํ•˜๋Š” 10๋…„๋งˆ๋‹ค ๋ฐœ์ƒํ•œ๋‹ค. ๊ฐ ์„ ๊ฑฐ๊ตฌ๋Š” ๋™์ผํ•œ ์ˆ˜์˜ ๊ฑฐ์ฃผ์ž๋ฅผ ๊ฐ€์ ธ์•ผ ํ•œ๋‹ค. ๋Œ€์˜ ๋ฏผ์ฃผ์ฃผ์˜. ์‹œ๋ฏผ๋“ค์ด ๋Œ€๋ฆฌ์ธ์„ ์„ ์ถœํ•˜๊ณ , ์ด ๋Œ€๋ฆฌ์ธ์ด ์ •๋ถ€ ๋‚ด์—์„œ ์‹œ๋ฏผ์˜ ์ด์ต์„ ๋Œ€๋ณ€ํ•˜๋Š” ์ •๋ถ€ ํ˜•ํƒœ. ๋ฐ˜๋ฉด, ์ง์ ‘ ๋ฏผ์ฃผ์ฃผ์˜๋Š” ๋ชจ๋“  ์‹œ๋ฏผ์ด ๋ชจ๋“  ์ •๋ถ€ ๋ฌธ์ œ์— ํˆฌํ‘œํ•ด์•ผ ํ•œ๋‹ค. ๋ฏธ๊ตญ์€ ๋Œ€์˜ ๋ฏผ์ฃผ์ฃผ์˜์ด๋‹ค.
ยฉ2008 ๋Œ€ํ•™ ์œ„์›ํšŒ. ๋ชจ๋“  ๊ถŒ๋ฆฌ ๋ณด์œ . ๋Œ€ํ•™ ์œ„์›ํšŒ๋ฅผ ์›น์—์„œ ๋ฐฉ๋ฌธํ•˜์‹ญ์‹œ์˜ค: www.collegeboard.com. AP ยฎ ๋ฏธ๊ตญ ์ •๋ถ€ ๋ฐ ์ •์น˜ 2008 ์ฑ„์  ํ•ด์„ค ์งˆ๋ฌธ 1 ๊ฐœ์š” ์ด ์งˆ๋ฌธ์˜ ์ „๋ฐ˜์ ์ธ ์˜๋„๋Š” ์˜ํšŒ ์žฌ๋ถ„๋ฐฐ, ์„ ๊ฑฐ๊ตฌ ์žฌ์กฐ์ • ๋ฐ ๊ฒŒ๋ฆฌ๋งจ๋”๋ง์„ ์กฐ์‚ฌํ•˜๋Š” ๊ฒƒ์ด์—ˆ์Šต๋‹ˆ๋‹ค. ๋Œ€ํ•™ ์œ„์›ํšŒ๋ฅผ ์›น์—์„œ ๋ฐฉ๋ฌธํ•˜์‹ญ์‹œ์˜ค: www.collegeboard.com. AP ยฎ ๋ฏธ๊ตญ ์ •๋ถ€ ๋ฐ ์ •์น˜ 2008 ์ฑ„์  ํ•ด์„ค ์งˆ๋ฌธ 1 (๊ณ„์†) ์ƒ˜ํ”Œ: 1C ์ ์ˆ˜: 2 (a) ๋ถ€๋ถ„์—์„œ ํ•™์ƒ์€ ์˜ํšŒ ์žฌ๋ถ„๋ฐฐ์˜ ์ •์˜๋ฅผ ํฌํ•จํ•˜์ง€ ์•Š์•˜์œผ๋ฏ€๋กœ ์ ์ˆ˜๋ฅผ ์–ป์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค.
Picks a word from a list of words and also selects indecies of letters to be shown
def PickWord(list_of_words): i1=random.randint(1,len(list_of_words)) length=len(list_of_words[i1]) indecies_letters_to_show=[] indecies_letters_to_show.append(random.randint(0,length-2)) indecies_letters_to_show.append(random.randint(indecies_letters_to_show[0]+1,length-1)) return list_of_words...
def generate_text(word_list): text = "" random_word = random.choice(word_list) # choose one random word (for start) text = text.join(random_word.word + " ") # append this random word to text while len(text) < 120: # while text has smaller length than 100 random_word = select_next_word(random_word) append_wor...
๋ฃจํ‘ธ์Šค๋ฅผ ์น˜๋ฃŒํ•˜๋Š” ์˜์‚ฌ์˜ ์ข…๋ฅ˜๋Š” ๋ฌด์—‡์ธ๊ฐ€์š”?
๊ทธ๋Ÿฌ๋‚˜, ๋งŒ์•ฝ ๋‹น์‹ ์˜ ๋ฃจํ‘ธ์Šค๊ฐ€ ์‹ ์žฅ ๋ฌธ์ œ๋ฅผ ์ผ์œผํ‚จ๋‹ค๋ฉด, ๋‹น์‹ ์€ ์‹ ์žฅ ์‹œ์Šคํ…œ์˜ ์งˆ๋ณ‘์„ ์ „๋ฌธ์œผ๋กœ ํ•˜๋Š” ์‹ ์žฅ ์ „๋ฌธ์˜๋ฅผ ๋งŒ๋‚˜๊ฒŒ ๋  ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๋งŒ์•ฝ ๋ฐœ์ง„์ด๋‚˜ ๋ณ‘๋ณ€์ด ์žˆ๋‹ค๋ฉด, ๋‹น์‹ ์€ ํ”ผ๋ถ€์™€ ๋‘ํ”ผ ๋ฐ ์ž…์„ ํฌํ•จํ•œ ํ”ผ๋ถ€ ์งˆํ™˜์„ ์ „๋ฌธ์œผ๋กœ ํ•˜๋Š” ํ”ผ๋ถ€๊ณผ ์˜์‚ฌ๋ฅผ ๋งŒ๋‚˜๊ฒŒ ๋  ๊ฒƒ์ž…๋‹ˆ๋‹ค.
๊ทธ๋…€๋Š” ๋ฅ˜๋งˆํ‹ฐ์Šค ์ „๋ฌธ์˜๋ฅผ ๋งŒ๋‚˜์•ผ ํ•œ๋‹ค. ์น˜๋ฃŒ๋ฅผ ๋ฐ›์œผ๋ฉด ์‚ฌ๋žŒ๋“ค์€ ์ˆ˜๋…„ ๋™์•ˆ ์ด ์งˆํ™˜๊ณผ ํ•จ๊ป˜ ์‚ด ์ˆ˜ ์žˆ๋‹ค. ๋ฃจํ‘ธ์Šค ์ง„๋‹จ์„ ๋ฐ›์•˜๋‹ค๊ณ  ํ•ด์„œ ๊ทธ๋…€๊ฐ€ ๋‚ด์ผ์ด๋‚˜ ๊ณง ์ฃฝ๋Š”๋‹ค๋Š” ์˜๋ฏธ๋Š” ์•„๋‹ˆ๋‹ค. ๊ทธ๋…€๊ฐ€ ๋ฏธ๋ž˜์— ๋Œ€ํ•ด ๊ฑฑ์ •ํ•˜๊ณ  ์žˆ๋‹ค๋ฉด ๊ทธ๋…€์˜ ์•„์ด์™€์˜ ์‹œ๊ฐ„์„ ๋†“์น˜๊ณ  ์žˆ๋Š” ๊ฒƒ์ด๋‹ค. ๋ฃจํ‘ธ์Šค๋ฅผ ์น˜๋ฃŒํ•˜๋Š” ์˜์‚ฌ๋Š” ๊ทธ๋…€๋ฅผ ์น˜๋ฃŒํ•˜๊ณ  ๋ฏธ๋ž˜์— ์–ด๋–ค ์ผ์ด ์ผ์–ด๋‚  ์ˆ˜ ์žˆ๋Š”์ง€ ์•Œ๋ ค์ค„ ์ˆ˜ ์žˆ์„ ๊ฒƒ์ด๋‹ค. ๋‚ด ์‚ฌ์ดŒ์€ 19์„ธ์— ์ง„๋‹จ๋ฐ›์•˜๋‹ค.
Outbound CHAP user name, returned only if authtype is CHAP, and outbound authentication is set for initiator.
def outbound_user_name(self): return self._outbound_user_name
def get_user_name(self): if self.read_secure_cookie('user_id') != None: return self.read_secure_cookie('user_id')
์ฒจ๋‘์ „๋ ฅ๋น„ ์‹์—์„œ, \( P_{target} \)๋Š” ๋ฌด์—‡์„ ์˜๋ฏธํ•ด?
\( P_{target} \)๋Š” ํ‘œ์ ์ฒจ๋‘์ „๋ ฅ(peak power of target), ๊ทธ๋ฆฌ๊ณ  \( \bar{P}_{pseudo} \) ๋Š” ํ‰๊ท  ์œ ์‚ฌ์ฒจ๋‘์ „๋ ฅ์„ ๋‚˜ํƒ€๋‚ธ๋‹ค.
์—ฌ๊ธฐ์„œ PPR(peak power ratio)๋Š” ์ฒจ๋‘์ „๋ ฅ๋น„๋ฅผ ๋‚˜ํƒ€๋‚ธ๋‹ค.
๊ณ ์ถ”, ๋งต๋‹ค, ๋ˆˆ๋ฌผ, ์ •๋„, ๋‚˜๋‹ค
์‹๋‹น์—์„œ ๋‚˜์˜จ ๊ณ ์ถ”๊ฐ€ ๋งค์›Œ์„œ ๋ˆˆ๋ฌผ์ด ๋‚  ์ •๋„์ด๋‹ค.
์ „ํ†ต์ฃผ, ๊ณผ์‹ค์ฃผ๋Š” ๋ณต๋ถ„์ž, ํ‘๋ฏธ์ฃผ, ์†Œ๊ณก์ฃผ, ๊ณ ์ถ”์ˆ , ํ™์ฃผ ๋“ฑ์œผ๋กœ ์›๋ฃŒ๊ฐ€ ์ œ๊ฐ๊ธฐ ๋‹ค ๋‹ค๋ฅด๋‹ค.
Ensure we can create a new article when sending a body that contains all the possible fields
def test_post_article_with_all_fields(self): user = User.objects.create(username='ivan') self.client.force_authenticate(user=user) platform = create_platform() data = make_article_data_with_all_fields(platform.id) url = reverse('articles') response = self.client.post(url...
def test_ticket_create_validation_failed(self): res = self.client.post('/tickets/ticket_create', {'title': '', 'text': ''}) assert b'This field is required' in res.content
Retrieve the MD5 sum from a Gravatar URL. Returns None if the URL is invalid. >>> get_gravatar_md5sum(
def get_gravatar_md5sum(url): parts = urlparse.urlparse(url) if parts.netloc not in ['www.gravatar.com', 'secure.gravatar.com', 'gravatar.com']: return None if not parts.path.startswith('/avatar/'): return None md5sum = parts.path.split('/')[2] if len(md5sum) != 32: r...
def get_md5(self, s): if isinstance(s, str): s = bytes(s, encoding='utf-8') if s: h = hashlib.md5() h.update(s) return h.hexdigest() else: return ''
normalize a given code snippet by parsing it to AST and regenerate the surface code from it
def reformat_code(code): py_ast = ast.parse(code).body[0] reformatted_code = astor.to_source(py_ast).strip() return reformatted_code
def _make_code(fn: typing.Callable, trace_fn_name: str) -> types.CodeType: lines = inspect.getsourcelines(fn)[0] # Remove extra indentation init_indent = _indent_len(lines[0]) lines = [l[init_indent:] if len(l.strip()) > 0 else l for l in lines] # Get first `row` and `col` to insert trace function...
Sinusoidal color table Cyclic and smooth color table made with a sinus function for each color channel
def sin_colortable(rgb_thetas=[.85, .0, .15], ncol=2**12): def colormap(x, rgb_thetas): # x in [0,1] # Compute the frequency and phase of each channel y = np.column_stack(((x + rgb_thetas[0]) * 2 * math.pi, (x + rgb_thetas[1]) * 2 * math.pi, ...
def test_to_color(self, wfb, color0, S, atol): color = SpectralGradient(S, wave=wfb).to_color(wfb) assert np.isclose(color.to(color0.unit).value, color0.value, atol=atol)
Remove the cleaner from the list if it already exists. Returns True if the cleaner was removed.
def _removecleaner(self, cleaner): oldlen = len(self._old_cleaners) self._old_cleaners = [ oldc for oldc in self._old_cleaners if not oldc.issame(cleaner) ] return len(self._old_cleaners) != oldlen
def remove(self, item): if item in self.flowers: item.break_down() self._flowers.remove(item) elif item in self.accessories: self._accessories.remove(item) else: raise LookupError(Bouquet._not_exist.format(item=item, obj=self))
%prog split pairs.fastq Split shuffled pairs into `.1.fastq` and `.2.fastq`, using `sed`. Can work on gzipped file.
def split(args): from maize.apps.grid import Jobs p = OptionParser(split.__doc__) opts, args = p.parse_args(args) if len(args) != 1: sys.exit(not p.print_help()) pairsfastq, = args gz = pairsfastq.endswith(".gz") pf = pairsfastq.replace(".gz", "").rsplit(".", 1)[0] p1 = pf + "...
def test_split_tf(self): cases = [ (2, 0.8), (2, [0.8]), (3, [0.80, 0.10]), (3, [0.80, 0.10, 0.10]), ] for ( method, (n, ratios), ) in itt.product(splitter_resolver.options, cases): with self.subTest(meth...
Returns a compact (6byte) representation of peers, selected randomly from the queryset, up to the provided limit.
def compact(self, limit): peer_list = list(self.values_list('compact_representation', flat=True)) peer_list = sample(peer_list, min(limit, len(peer_list))) return a2b_base64(''.join(peer_list))
def get_transactions(self): return ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(2096))