Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- """ The pyxform file utility functions. """ def _section_name(path_or_file_name): directory, filename = os.path.split(path_or_file_name) section_name, extension = os.path.splitext(filename) return section_name def load_file_to_dict(path):...
return name, utils.get_pyobj_from_json(path)
Next line prediction: <|code_start|># -*- coding: utf-8 -*- """ The pyxform file utility functions. """ def _section_name(path_or_file_name): directory, filename = os.path.split(path_or_file_name) section_name, extension = os.path.splitext(filename) return section_name def load_file_to_dict(path): ...
excel_reader = SurveyReader(path, name)
Based on the snippet: <|code_start|># -*- coding: utf-8 -*- """ Section survey element module. """ class Section(SurveyElement): def validate(self): super(Section, self).validate() for element in self.children: element.validate() self._validate_uniqueness_of_element_names() ...
raise PyXFormError(
Using the snippet: <|code_start|> for element in self.children: elem_lower = element.name.lower() if elem_lower in element_slugs: raise PyXFormError( "There are more than one survey elements named '%s' " "(case-insensitive) in the se...
elif isinstance(child, ExternalInstance):
Using the snippet: <|code_start|> element.validate() self._validate_uniqueness_of_element_names() # there's a stronger test of this when creating the xpath # dictionary for a survey. def _validate_uniqueness_of_element_names(self): element_slugs = set() for element in sel...
result = node(self.name, **attributes)
Next line prediction: <|code_start|> + " Values must begin with a letter or underscore. Subsequent " + "characters can include letters, numbers, dashes, underscores, and periods." ) def value_or_label_test(value: str) -> bool: query = re.search(r"^[a-zA-Z_][a-zA-Z0-9\-_\.]*$", value) if que...
raise PyXFormError(msg)
Predict the next line after this snippet: <|code_start|># -*- coding: utf-8 -*- """ Test xls2json_backends util functions. """ class BackendUtilsTests(TestCase): def test_xls_to_csv(self): specify_other_xls = utils.path_to_text_fixture("specify_other.xls") <|code_end|> using the current file's imports: ...
converted_xls = convert_file_to_csv_string(specify_other_xls)
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- """ Test xls2json_backends util functions. """ class BackendUtilsTests(TestCase): def test_xls_to_csv(self): <|code_end|> . Use current file imports: from unittest import TestCase from pyxform.xls2json_backends import convert_file_to_csv_string fr...
specify_other_xls = utils.path_to_text_fixture("specify_other.xls")
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- """ Tests by file. Runs through a list of *.xls files, and expects that the output for a *.xml with a matching prefix before the . is as expected. Possibly risky: all tests in this file are defined according to matching files. """ class MainTest(TestCas...
json_survey = xls2json.parse_file_to_json(
Next line prediction: <|code_start|># -*- coding: utf-8 -*- """ Tests by file. Runs through a list of *.xls files, and expects that the output for a *.xml with a matching prefix before the . is as expected. Possibly risky: all tests in this file are defined according to matching files. """ class MainTest(TestCase)...
path_to_excel_file = utils.path_to_text_fixture(file_to_test)
Here is a snippet: <|code_start|># -*- coding: utf-8 -*- """ Aliases for elements which could mean the same element in XForm but is represented differently on the XLSForm. """ # Aliases: # Ideally aliases should resolve to elements in the json form schema # select, control and settings alias keys used for parsing, # ...
"group": constants.GROUP,
Given the code snippet: <|code_start|> u"my_string": u"lor\xe9m ipsum", }, u"children": [ { u"name": u"your_name", u"label": {u"english": u"What is your name?"}, u"type": u"text", }, ...
survey = create_survey_from_path(self.path)
Here is a snippet: <|code_start|># -*- coding: utf-8 -*- """ Test settings sheet syntax. """ class SettingsTests(TestCase): maxDiff = None def setUp(self): self.path = utils.path_to_text_fixture("settings.xls") def test_survey_reader(self): <|code_end|> . Write the next line using the current...
survey_reader = SurveyReader(self.path, default_name="settings")
Next line prediction: <|code_start|># -*- coding: utf-8 -*- """ Test settings sheet syntax. """ class SettingsTests(TestCase): maxDiff = None def setUp(self): <|code_end|> . Use current file imports: (from unittest import TestCase from pyxform.builder import create_survey_from_path from pyxform.xls2json ...
self.path = utils.path_to_text_fixture("settings.xls")
Based on the snippet: <|code_start|> # e.g. ("jr:constraintMsg", "Try again") for bind_type, bind_cell in cell_content.items(): process_cell(typ=bind_type, cell=bind_cell) else: process_cell(typ=column_type, cell=cell_content) missing =...
translatable_columns=aliases.TRANSLATABLE_SURVEY_COLUMNS,
Given the following code snippet before the placeholder: <|code_start|>) -> "Optional[str]": """ Format the missing translations data into a warning message. :param _in: A dict structured as Dict[survey|choices: Dict[language: (columns)]]. In other words, for the survey or choices sheet, a dict of th...
survey = get_sheet_msg(name=constants.SURVEY, sheet=_in.get(constants.SURVEY))
Predict the next line for this snippet: <|code_start|> if TYPE_CHECKING: SheetData = List[Dict[str, Union[str, Dict]]] def format_missing_translations_msg( _in: "Dict[str, Dict[str, Sequence]]", ) -> "Optional[str]": """ Format the missing translations data into a warning message. :param _in: A...
PyXFormError(msg)
Given snippet: <|code_start|># -*- coding: utf-8 -*- """ XForm survey question type mapping dictionary module. """ def generate_new_dict(): """ This is just here incase there is ever any need to generate the question type dictionary from all.xls again. It shouldn't be called as part of any application...
json_dict = QuestionTypesReader(path_to_question_types).to_json_dict()
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- """ XForm survey question type mapping dictionary module. """ def generate_new_dict(): """ This is just here incase there is ever any need to generate the question type dictionary from all.xls again. It shouldn't be called as part of any ap...
print_pyobj_to_json(json_dict, "new_question_type_dict.json")
Next line prediction: <|code_start|> "label": {"English": "What's your father's phone number?"}, }, { "name": "age", "type": "integer", "label": {"English": "How...
survey = create_survey_element_from_dict(x_results)
Using the snippet: <|code_start|># -*- coding: utf-8 -*- """ Testing simple cases for Xls2Json """ class GroupTests(TestCase): def test_json(self): <|code_end|> , determine the next line of code. You have imports: from unittest import TestCase from pyxform.builder import create_survey_element_from_dict from pyx...
x = SurveyReader(utils.path_to_text_fixture("group.xls"), default_name="group")
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- """ Testing simple cases for Xls2Json """ class GroupTests(TestCase): def test_json(self): <|code_end|> . Use current file imports: from unittest import TestCase from pyxform.builder import create_survey_element_from_dict from pyxform.xls2json imp...
x = SurveyReader(utils.path_to_text_fixture("group.xls"), default_name="group")
Using the snippet: <|code_start|> writer = csv.writer(f, quoting=csv.QUOTE_ALL) mask = [v and len(v.strip()) > 0 for v in sheet.row_values(0)] for row_idx in range(sheet.nrows): csv_data = [] try: for v, m in zip(sheet.row(row_idx), mask): ...
mask = [not is_empty(cell.value) for cell in sheet[1]]
Given the code snippet: <|code_start|> for subli in li: for it in subli: yield it def sheet_to_csv(workbook_path, csv_path, sheet_name): if workbook_path.endswith(".xls"): return xls_sheet_to_csv(workbook_path, csv_path, sheet_name) else: return xlsx_sheet_to_csv(workboo...
data = xls_value_to_unicode(value, value_type, wb.datemode)
Predict the next line after this snippet: <|code_start|> if m: value = v.value value_type = v.ctype data = xls_value_to_unicode(value, value_type, wb.datemode) # clean the values of leading and trailing wh...
data = xlsx_value_to_str(v.value)
Continue the code snippet: <|code_start|> def decode_stream(stream): """ Decode a stream, e.g. stdout or stderr. On Windows, stderr may be latin-1; in which case utf-8 decode will fail. If both utf-8 and latin-1 decoding fail then raise all as IOError. If the above validate jar call fails, add make...
raise PyXFormError("Empty response from URL: '{u}'.".format(u=url))
Continue the code snippet: <|code_start|>Test xls2xform module. """ # The Django application xls2xform uses the function # pyxform.create_survey. We have a test here to make sure no one # breaks that function. try: except ImportError: class XLS2XFormTests(TestCase): survey_package = { "id_string": "tes...
_create_parser().parse_args([])
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- """ Test tutorial XLSForm. """ class TutorialTests(TestCase): def test_create_from_path(self): path = utils.path_to_text_fixture("tutorial.xls") <|code_end|> . Use current file imports: from unittest import TestCase from pyxform.builder im...
create_survey_from_path(path)
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*- """ Test tutorial XLSForm. """ class TutorialTests(TestCase): def test_create_from_path(self): <|code_end|> with the help of current file imports: from unittest import TestCase from pyxform.builder import create_survey_from_path from...
path = utils.path_to_text_fixture("tutorial.xls")
Predict the next line for this snippet: <|code_start|> try: row_dict[key] = xls_value_to_unicode( value, value_type, workbook.datemode ) except XLDateAmbiguous: ...
if sheet.name not in constants.SUPPORTED_SHEET_NAMES:
Predict the next line after this snippet: <|code_start|> def _list_to_dict_list(list_items): """ Takes a list and creates a dict with the list values as keys. Returns a list of the created dict or an empty list """ if list_items: k = OrderedDict() for item in list_items: ...
raise PyXFormError("Error reading .xls file: %s" % error)
Here is a snippet: <|code_start|> return {"node_name": self._name, "id": self._id, "children": children} def to_xml(self): """ A horrible way to do this, but it works (until we need the attributes pumped out in order, etc) """ open_str = """<?xml version='1.0' ?><%s ...
key_val_dict = parse_xform_instance(xml_str)
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- """ Test multiple XLSForm can be generated successfully. """ class DumpAndLoadTests(TestCase): def setUp(self): self.excel_files = [ "gps.xls", # "include.xls", "specify_other.xls", "group.xls...
self.surveys[filename] = create_survey_from_path(path)
Given snippet: <|code_start|># -*- coding: utf-8 -*- """ Test multiple XLSForm can be generated successfully. """ class DumpAndLoadTests(TestCase): def setUp(self): self.excel_files = [ "gps.xls", # "include.xls", "specify_other.xls", "group.xls", ...
path = utils.path_to_text_fixture(filename)
Based on the snippet: <|code_start|>################################################################################ # # This program is part of the HPMon Zenpack for Zenoss. # Copyright (C) 2008-2012 Egor Puzanov. # # This program can be used under the GNU General Public License version 2 # You can find full informati...
implements(interfaces.IcpqIdeControllerInfo)
Here is a snippet: <|code_start|># For python3 def _equals_bytes(a, b): if len(a) != len(b): return False result = 0 for x, y in zip(a, b): result |= x ^ y return result == 0 def _equals_str(a, b): if len(a) != len(b): return False result = 0 for x, y in zip(a, b): ...
key = OpenSSL.malloc(k, len(k))
Continue the code snippet: <|code_start|>""" Utility functions for tests. """ def mknode(id=None, ip=None, port=None, intid=None): """ Make a node. Created a random id if not specified. """ if intid is not None: id = pack('>l', intid) id = id or hashlib.sha1(str(random.getrandbits(255)))...
return Node(id, ip, port)
Given the following code snippet before the placeholder: <|code_start|>""" Utility functions for tests. """ def mknode(id=None, ip=None, port=None, intid=None): """ Make a node. Created a random id if not specified. """ if intid is not None: id = pack('>l', intid) id = id or hashlib.sha1...
self.router = RoutingTable(self, ksize, Node(sourceID))
Given the code snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2011 Yann GUIBET <yannguibet@gmail.com> # See LICENSE for details. class Cipher: """ Symmetric encryption import pyelliptic iv = pyelliptic.Cipher.gen_IV('aes-256-cfb') ctx = pyelli...
self.cipher = OpenSSL.get_cipher(ciphername)
Predict the next line for this snippet: <|code_start|> self.nearest.push(peers) def _find(self, rpcmethod): """ Get either a value or list of nodes. Args: rpcmethod: The protocol's callfindValue or callFindNode. The process: 1. calls find_* to current...
return deferredDict(ds).addCallback(self._nodesFound)
Next line prediction: <|code_start|>class RPCFindResponse(object): def __init__(self, response): """ A wrapper for the result of a RPC find. Args: response: This will be a tuple of (<response received>, <value>) where <value> will be a list of tuples if not...
return [Node(*nodeple) for nodeple in nodelist]
Predict the next line for this snippet: <|code_start|> class SpiderCrawl(object): """ Crawl the network and look for given 160-bit keys. """ def __init__(self, protocol, node, peers, ksize, alpha): """ Create a new C{SpiderCrawl}er. Args: protocol: A :class:`~kadem...
self.nearest = NodeHeap(self.node, self.ksize)
Next line prediction: <|code_start|> class NodeTest(unittest.TestCase): def test_longID(self): rid = hashlib.sha1(str(random.getrandbits(255))).digest() <|code_end|> . Use current file imports: (import random import hashlib from twisted.trial import unittest from subspace.node import Node, NodeHeap from...
n = Node(rid)
Continue the code snippet: <|code_start|> class NodeTest(unittest.TestCase): def test_longID(self): rid = hashlib.sha1(str(random.getrandbits(255))).digest() n = Node(rid) self.assertEqual(n.long_id, long(rid.encode('hex'), 16)) def test_distanceCalculation(self): ridone = ha...
n = NodeHeap(mknode(intid=0), 3)
Continue the code snippet: <|code_start|> class NodeTest(unittest.TestCase): def test_longID(self): rid = hashlib.sha1(str(random.getrandbits(255))).digest() n = Node(rid) self.assertEqual(n.long_id, long(rid.encode('hex'), 16)) def test_distanceCalculation(self): ridone = ha...
n = NodeHeap(mknode(intid=0), 3)
Continue the code snippet: <|code_start|> class UtilsTest(unittest.TestCase): def test_digest(self): d = hashlib.sha1('1').digest() self.assertEqual(d, digest(1)) d = hashlib.sha1('another').digest() self.assertEqual(d, digest('another')) def test_sharedPrefix(self): ...
self.assertEqual(sharedPrefix(args), 'prefix')
Predict the next line for this snippet: <|code_start|> class UtilsTest(unittest.TestCase): def test_digest(self): d = hashlib.sha1('1').digest() self.assertEqual(d, digest(1)) d = hashlib.sha1('another').digest() self.assertEqual(d, digest('another')) def test_sharedPrefix(s...
o = OrderedSet()
Next line prediction: <|code_start|> alice = pyelliptic.ECC() # default curve: sect283r1 bob = pyelliptic.ECC(curve='sect571r1') ciphertext = alice.encrypt("Hello Bob", bob.get_pubkey()) print bob.decrypt(ciphertext) signature = bob.sign("Hello Alice") # alice's job : ...
self.curve = OpenSSL.get_curve(curve)
Next line prediction: <|code_start|> else: return True # Good return False finally: OpenSSL.EC_KEY_free(key) OpenSSL.BN_free(pub_key_x) OpenSSL.BN_free(pub_key_y) OpenSSL.EC_POINT_free(pub_key) OpenSSL.E...
ctx = Cipher(key_e, iv, 1, ciphername)
Here is a snippet: <|code_start|> return False finally: OpenSSL.EC_KEY_free(key) OpenSSL.BN_free(pub_key_x) OpenSSL.BN_free(pub_key_y) OpenSSL.EC_POINT_free(pub_key) OpenSSL.EVP_MD_CTX_destroy(md_ctx) @staticmethod def encrypt(data...
mac = hmac_sha256(key_m, ciphertext)
Given the code snippet: <|code_start|> @staticmethod def raw_encrypt(data, pubkey_x, pubkey_y, curve='sect283r1', ephemcurve=None, ciphername='aes-256-cbc'): if ephemcurve is None: ephemcurve = curve ephem = ECC(curve=ephemcurve) key = sha512(ephem.raw_get...
if not equals(hmac_sha256(key_m, data[:len(data) - 32]), mac):
Next line prediction: <|code_start|> class KBucket(object): def __init__(self, rangeLower, rangeUpper, ksize): self.range = (rangeLower, rangeUpper) self.nodes = OrderedDict() <|code_end|> . Use current file imports: (import heapq import time import operator from collections import OrderedDict fr...
self.replacementNodes = OrderedSet()
Given the following code snippet before the placeholder: <|code_start|> del self.nodes[node.id] if len(self.replacementNodes) > 0: newnode = self.replacementNodes.pop() self.nodes[newnode.id] = newnode def hasInRange(self, node): return self.range[0] <= node.long_id <...
sp = sharedPrefix([n.id for n in self.nodes.values()])
Given snippet: <|code_start|> class IAMDatasource(DatasourcePlugin[str, IAMEntry], metaclass=Singleton): _arn_to_id: Dict[str, str] = {} def __init__(self, config: Optional[RepokidConfig] = None): super().__init__(config=config) def _fetch_account(self, account_number: str) -> Dict[str, IAMEntry]:...
raise NotFoundError
Given the code snippet: <|code_start|># Copyright 2021 Netflix, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
def __init__(self, config: Optional[RepokidConfig] = None):
Using the snippet: <|code_start|> def test_iam_get(): ds = IAMDatasource() arn = "pretend_arn" expected = {"a": "b"} ds._data = {arn: expected} result = ds.get(arn) assert result == expected @patch("repokid.datasource.iam.IAMDatasource._fetch") def test_iam_get_fallback_not_found(mock_fetch...
mock_fetch.side_effect = NotFoundError
Predict the next line after this snippet: <|code_start|> logger = logging.getLogger("repokid") class AccessAdvisorDatasource( DatasourcePlugin[str, AccessAdvisorEntry], metaclass=Singleton ): def __init__(self, config: Optional[RepokidConfig] = None): super().__init__(config=config) def _fetch(...
raise AardvarkError("aardvark not configured")
Here is a snippet: <|code_start|> r_aardvark = requests.post(api_location, params=params, json=payload) except requests.exceptions.RequestException as e: logger.exception("unable to get Aardvark data: {}".format(e)) raise AardvarkError("unable to get aardvark d...
raise NotFoundError
Given the code snippet: <|code_start|> logger = logging.getLogger("repokid") class AccessAdvisorDatasource( DatasourcePlugin[str, AccessAdvisorEntry], metaclass=Singleton ): def __init__(self, config: Optional[RepokidConfig] = None): super().__init__(config=config) def _fetch( self, accou...
response_data: AardvarkResponse = {}
Predict the next line after this snippet: <|code_start|># Copyright 2021 Netflix, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
def __init__(self, config: Optional[RepokidConfig] = None):
Given snippet: <|code_start|> bool """ exported_no_whitespace = json.dumps(policies, separators=(",", ":")) if len(exported_no_whitespace) > MAX_AWS_POLICY_SIZE: return True return False def delete_policy( name: str, role_name: str, account_number: str, conn: Dict[str, Any] ) -> Non...
raise IAMError(
Here is a snippet: <|code_start|># Copyright 2021 Netflix, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
def __init__(self, config: Optional[RepokidConfig] = None):
Given the following code snippet before the placeholder: <|code_start|> def test_access_advisor_get(): ds = AccessAdvisorDatasource() arn = "pretend_arn" expected = [{"a": "b"}] ds._data = {arn: expected} result = ds.get(arn) assert result == expected @patch("repokid.datasource.access_advisor....
with pytest.raises(NotFoundError):
Predict the next line for this snippet: <|code_start|> v1_api = Api(api_name='v1') v1_api.register(EventResource()) v1_api.register(InstanceResource()) <|code_end|> with the help of current file imports: from django.conf.urls.defaults import include, patterns, url from tastypie.api import Api from wprevents.events...
v1_api.register(SpaceResource())
Based on the snippet: <|code_start|> v1_api = Api(api_name='v1') v1_api.register(EventResource()) v1_api.register(InstanceResource()) v1_api.register(SpaceResource()) <|code_end|> , predict the immediate next line with the help of imports: from django.conf.urls.defaults import include, patterns, url from tastypie.a...
v1_api.register(FunctionalAreaResource())
Using the snippet: <|code_start|> return rdd.map(otsu) elif method == 'duel': return rdd.map(duel) elif method == 'phansalkar': block_size = args[0] return rdd.map(phansalkar) else: raise "Bad Threshold Method", method def peak_filter(rdd, smooth_size): ...
@exeTime
Using the snippet: <|code_start|> def peak_filter(rdd, smooth_size): def func(frame): frame = frame.astype(bool) binary = remove_small_objects(frame, smooth_size) #binary = ndi.binary_fill_holes(binary) #opened = binary_opening(frame, disk(smooth_size)) #opened = opene...
bar("info")(msg,z+1,end)
Using the snippet: <|code_start|>@exeTime def properties(labeled_stack, image_stack, min_radius, max_radius): prop = [] columns = ('x', 'y', 'z', 'intensitysum', 'size', 'tag') indices = [] end = len(labeled_stack) for z, frame in enumerate(labeled_stack): msg = " get the properties o...
log("info")("clustering start...")
Given the following code snippet before the placeholder: <|code_start|>################################ # Author : septicmk # Date : 2015/07/24 20:08:44 # FileName : test_p_fusion.py ################################ L_pwd = os.path.abspath('.') + '/test_data/L_side/' R_pwd = os.path.abspath('.') + '/test_data/R...
self.L_imgs = load_tiff(self.sc, L_pwd)
Given the code snippet: <|code_start|>################################ # Author : septicmk # Date : 2015/07/31 16:54:41 # FileName : seg.py ################################ conf = SparkConf().setAppName('seg').setMaster('local[64]').set('spark.executor.memory','20g').set('spark.driver.maxResultSize','20g').set(...
rdd = prep.intensity_normalization(rdd, 8)
Continue the code snippet: <|code_start|>################################ conf = SparkConf().setAppName('seg').setMaster('local[64]').set('spark.executor.memory','20g').set('spark.driver.maxResultSize','20g').set('spark.driver.memory','40g').set('spark.local.dir','/dev/shm').set('spark.storage.memoryFraction','0.2')....
rdd = seg.threshold(rdd,'otsu')
Here is a snippet: <|code_start|>################################ # Author : septicmk # Date : 2015/07/31 16:54:41 # FileName : seg.py ################################ conf = SparkConf().setAppName('seg').setMaster('local[64]').set('spark.executor.memory','20g').set('spark.driver.maxResultSize','20g').set('spar...
sub = IO.load_tiff(sc, pwd+'/train_n.tif')
Given the following code snippet before the placeholder: <|code_start|>################################ # Author : septicmk # Date : 2015/07/31 16:54:41 # FileName : seg.py ################################ conf = SparkConf().setAppName('seg').setMaster('local[64]').set('spark.executor.memory','20g').set('spark....
log('info')('load tiff ...')
Based on the snippet: <|code_start|> return binary def otsu(frame): threshold = threshold_otsu(frame) binary = frame > threshold return binary def duel(frame): threshold = threshold_otsu(frame) binary1 = frame > threshold frame = frame - binary1 * frame ...
@exeTime
Using the snippet: <|code_start|>################################ # Author : septicmk # Date : 2015/07/24 18:56:05 # FileName : test_p_registration.py ################################ L_pwd = os.path.abspath('.') + '/test_data/L_side_8/' R_pwd = os.path.abspath('.') + '/test_data/R_side_8/' class PySparkTestRe...
self.imgB = flip(self.R_imgs)[0]
Continue the code snippet: <|code_start|>################################ # Author : septicmk # Date : 2015/07/24 18:56:05 # FileName : test_p_registration.py ################################ L_pwd = os.path.abspath('.') + '/test_data/L_side_8/' R_pwd = os.path.abspath('.') + '/test_data/R_side_8/' class PySpa...
self.L_imgs = load_tiff(self.sc, L_pwd)
Continue the code snippet: <|code_start|>################################ # Author : septicmk # Date : 2015/07/24 19:02:34 # FileName : test_registration.py ################################ L_pwd = os.path.abspath('.') + '/test_data/L_side_8/' R_pwd = os.path.abspath('.') + '/test_data/R_side_8/' class LocalTe...
self.imgB = flip(self.R_imgs)[0]
Based on the snippet: <|code_start|>################################ # Author : septicmk # Date : 2015/07/24 19:02:34 # FileName : test_registration.py ################################ L_pwd = os.path.abspath('.') + '/test_data/L_side_8/' R_pwd = os.path.abspath('.') + '/test_data/R_side_8/' class LocalTestReg...
self.L_imgs = load_tiff(L_pwd)
Using the snippet: <|code_start|> tx, ty, sita, sx, sy, hx, hy= tuple(vec) A = np.array([[1, 0, tx], [0, 1, ty], [0, 0, 1]]) B = np.array([[math.cos(sita), -math.sin(sita), 0], [math.sin(sita), math.cos(sita), 0], [0, 0, 1]]) C = np.array([[sx, 0, 0], [0, sy, 0], [0, 0, 1]]) D = np.array([[...
@exeTime
Predict the next line for this snippet: <|code_start|>################################ # Author : septicmk # Date : 2015/07/24 18:56:01 # FileName : test_p_preprocess.py ################################ L_pwd = os.path.abspath('.') + '/test_data/L_side/' R_pwd = os.path.abspath('.') + '/test_data/R_side/' clas...
self.L_imgs = load_tiff(self.sc, L_pwd)
Based on the snippet: <|code_start|>################################ # Author : septicmk # Date : 2015/07/31 16:54:41 # FileName : seg.py ################################ conf = SparkConf().setAppName('seg').setMaster('local[64]').set('spark.executor.memory','20g').set('spark.driver.maxResultSize','20g').set('s...
rdd = prep.saturation(rdd, 0.01)
Using the snippet: <|code_start|>################################ # Author : septicmk # Date : 2015/07/31 16:54:41 # FileName : seg.py ################################ conf = SparkConf().setAppName('seg').setMaster('local[64]').set('spark.executor.memory','20g').set('spark.driver.maxResultSize','20g').set('spar...
rdd = seg.threshold(rdd, 'phansalkar', 20)
Based on the snippet: <|code_start|>################################ # Author : septicmk # Date : 2015/07/31 16:54:41 # FileName : seg.py ################################ conf = SparkConf().setAppName('seg').setMaster('local[64]').set('spark.executor.memory','20g').set('spark.driver.maxResultSize','20g').set('s...
sub_img = IO.load_tiff(pwd+'/sub_dev/')
Here is a snippet: <|code_start|>################################ # Author : septicmk # Date : 2015/07/31 16:54:41 # FileName : seg.py ################################ conf = SparkConf().setAppName('seg').setMaster('local[64]').set('spark.executor.memory','20g').set('spark.driver.maxResultSize','20g').set('spar...
log('info')('load tiff ...')
Predict the next line after this snippet: <|code_start|>################################ # Author : septicmk # Date : 2015/07/30 15:15:42 # FileName : test_p_segmentation.py ################################ L_pwd = os.path.abspath('.') + '/test_data/L_side_8/' R_pwd = os.path.abspath('.') + '/test_data/R_side_8...
self.L_imgs = load_tiff(self.sc, L_pwd)
Here is a snippet: <|code_start|>################################ # Author : septicmk # Date : 2015/07/31 16:54:41 # FileName : seg.py ################################ conf = SparkConf().setAppName('seg').setMaster('local[64]').set('spark.executor.memory','20g').set('spark.driver.maxResultSize','20g').set('spar...
sub_img = IO.load_tiff(pwd+'/sub_dev/')
Predict the next line after this snippet: <|code_start|>################################ # Author : septicmk # Date : 2015/07/31 16:54:41 # FileName : seg.py ################################ conf = SparkConf().setAppName('seg').setMaster('local[64]').set('spark.executor.memory','20g').set('spark.driver.maxResul...
log('info')('load tiff ...')
Based on the snippet: <|code_start|>################################ # Author : septicmk # Date : 2015/07/24 15:38:36 # FileName : test_fusion.py ################################ L_pwd = os.path.abspath('.') + '/test_data/L_side/' R_pwd = os.path.abspath('.') + '/test_data/R_side/' class LocalTestFusionCase(Lo...
self.L_imgs = load_tiff(L_pwd)
Predict the next line after this snippet: <|code_start|> - change the circle to pie Args: - size: the smooth size ''' def func(frame): return mor.black_tophat(frame, mor.disk(size)) return rdd.map(func) def subtract_Background(rdd, size=12): ''' Usage: - subtra...
@exeTime
Predict the next line for this snippet: <|code_start|>################################ # Author : septicmk # Date : 2015/07/25 10:44:53 # FileName : IO.py ################################ @exeTime def load_tiff(pwd, start_index=None, end_index=None): ''' Usage: - just read all the image under the p...
bar('info')(msg, z+1, end)
Next line prediction: <|code_start|>################################ # Author : septicmk # Date : 2015/08/17 11:13:23 # FileName : test.py ################################ conf = SparkConf().setAppName('seg').setMaster('local[128]').set('spark.executor.memory','20g').set('spark.driver.maxResultSize','20g').set(...
fus = IO.load_tiff(sc, pwd+'/fus_dev/')
Next line prediction: <|code_start|>################################ # Author : septicmk # Date : 2015/08/17 11:13:23 # FileName : test.py ################################ conf = SparkConf().setAppName('seg').setMaster('local[128]').set('spark.executor.memory','20g').set('spark.driver.maxResultSize','20g').set(...
log('info')('load tiff ...')
Here is a snippet: <|code_start|>################################ # Author : septicmk # Date : 2015/07/24 15:39:02 # FileName : test_preprocess.py ################################ L_pwd = os.path.abspath('.') + '/test_data/L_side/' R_pwd = os.path.abspath('.') + '/test_data/R_side/' class LocalTestPreprocessCa...
self.L_imgs = load_tiff(L_pwd)
Using the snippet: <|code_start|> tx, ty, sita, sx, sy, hx, hy= tuple(vec) A = np.array([[1, 0, tx], [0, 1, ty], [0, 0, 1]]) B = np.array([[math.cos(sita), -math.sin(sita), 0], [math.sin(sita), math.cos(sita), 0], [0, 0, 1]]) C = np.array([[sx, 0, 0], [0, sy, 0], [0, 0, 1]]) D = np.array([[...
@exeTime
Based on the snippet: <|code_start|>################################ # Author : septicmk # Date : 2015/07/30 15:30:35 # FileName : test_segmentation.py ################################ L_pwd = os.path.abspath('.') + '/test_data/L_side_8/' R_pwd = os.path.abspath('.') + '/test_data/R_side_8/' class LocalTestSe...
self.L_imgs = load_tiff(L_pwd)
Continue the code snippet: <|code_start|> return np.array(y) def curvature(x): """Curvature of a timeseries This test is commonly known as gradient for historical reasons, but that is a bad name choice since it is not the actual gradient, like: d/dx + d/dy + d/dz, but as defined by GTSPP, Euro...
class Gradient(QCCheckVar):
Predict the next line after this snippet: <|code_start|> "low": {"type": "trimf", "params": [0.0, 0.225, 0.45]}, "medium": {"type": "trimf", "params": [0.275, 0.5, 0.725]}, "high": {"type": "smf", "params": [0.55, 0.775]}, }, "features": { "f1": { "weight": 1, ...
rules = fuzzyfy(features, **CFG)
Predict the next line for this snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """ """ module_logger = logging.getLogger(__name__) try: except ImportError: module_logger.debug("Module Shapely is not available") <|code_end|> ...
class RegionalRange(QCCheckVar):
Given the code snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """ """ module_logger = logging.getLogger(__name__) class SpikeDepthConditional(QCCheckVar): def set_features(self): <|code_end|> , generate the next line usin...
self.features = {"spike": spike(self.data[self.varname])}
Given the following code snippet before the placeholder: <|code_start|> if (RoC_small (t) + 0.5 × RoC_medium (t)) < (cRoC_small (t - 1) + 0.5 × cRoC_medium (t - 1)): cRoC_i (t) = RoC_i (t) else cRoC_i (t) = (1 - k) × RoC_i(t) + k * cRoC_i(t - 1) i = small, medium, large """ module_logger = logging.getLogger...
class CumRateOfChange(QCCheckVar):