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)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.