body_hash
stringlengths
64
64
body
stringlengths
23
109k
docstring
stringlengths
1
57k
path
stringlengths
4
198
name
stringlengths
1
115
repository_name
stringlengths
7
111
repository_stars
float64
0
191k
lang
stringclasses
1 value
body_without_docstring
stringlengths
14
108k
unified
stringlengths
45
133k
01418ee1b9b26d43152879e0b1d901e68d16d625fd50f92f1234b2deedcf0951
def _getResourceRecords(self, structure): "\n Given a DnsResourceRecordArray() structure, return a list of Resource \n Records as (dnstype, dnsclass, ttl, fqdn, adata) tuples. If a parser\n is available for the dnsclass, the 'rdata' field will be further parsed \n into its components (as a tuple if necessary).\n " ret = [] for (fname, rr) in structure.vsGetFields(): fqdn = self.getDnsName(*rr.dnsname.getTypeVal()) rdata = None if (rr.rrtype == DNS_TYPE_A): rdata = vs_inet.reprIPv4Addr(rr.rdata.address) elif (rr.rrtype == DNS_TYPE_AAAA): rdata = vs_inet.reprIPv6Addr(rr.rdata.address) elif (rr.rrtype == DNS_TYPE_NS): rdata = self.getDnsName(*rr.rdata.nsdname.getTypeVal()) elif (rr.rrtype == DNS_TYPE_CNAME): rdata = self.getDnsName(*rr.rdata.cname.getTypeVal()) elif (rr.rrtype == DNS_TYPE_SOA): rdata = (self.getDnsName(*rr.rdata.mname.getTypeVal()), self.getDnsName(*rr.rdata.rname.getTypeVal()), rr.rdata.serial, rr.rdata.refresh, rr.rdata.retry, rr.rdata.expire, rr.rdata.minimum) elif (rr.rrtype == DNS_TYPE_PTR): rdata = self.getDnsName(*rr.rdata.ptrdname.getTypeVal()) elif (rr.rrtype == DNS_TYPE_MX): rdata = (rr.rdata.preference, self.getDnsName(*rr.rdata.exchange.getTypeVal())) elif (rr.rrtype == DNS_TYPE_TXT): rdata = rr.rdata.txtdata else: rdata = rr.rdata.bytez ret.append((rr.rrtype, rr.dnsclass, rr.ttl, fqdn, rdata)) return ret
Given a DnsResourceRecordArray() structure, return a list of Resource Records as (dnstype, dnsclass, ttl, fqdn, adata) tuples. If a parser is available for the dnsclass, the 'rdata' field will be further parsed into its components (as a tuple if necessary).
vstruct/defs/dns.py
_getResourceRecords
TomSomerville/vivisect
716
python
def _getResourceRecords(self, structure): "\n Given a DnsResourceRecordArray() structure, return a list of Resource \n Records as (dnstype, dnsclass, ttl, fqdn, adata) tuples. If a parser\n is available for the dnsclass, the 'rdata' field will be further parsed \n into its components (as a tuple if necessary).\n " ret = [] for (fname, rr) in structure.vsGetFields(): fqdn = self.getDnsName(*rr.dnsname.getTypeVal()) rdata = None if (rr.rrtype == DNS_TYPE_A): rdata = vs_inet.reprIPv4Addr(rr.rdata.address) elif (rr.rrtype == DNS_TYPE_AAAA): rdata = vs_inet.reprIPv6Addr(rr.rdata.address) elif (rr.rrtype == DNS_TYPE_NS): rdata = self.getDnsName(*rr.rdata.nsdname.getTypeVal()) elif (rr.rrtype == DNS_TYPE_CNAME): rdata = self.getDnsName(*rr.rdata.cname.getTypeVal()) elif (rr.rrtype == DNS_TYPE_SOA): rdata = (self.getDnsName(*rr.rdata.mname.getTypeVal()), self.getDnsName(*rr.rdata.rname.getTypeVal()), rr.rdata.serial, rr.rdata.refresh, rr.rdata.retry, rr.rdata.expire, rr.rdata.minimum) elif (rr.rrtype == DNS_TYPE_PTR): rdata = self.getDnsName(*rr.rdata.ptrdname.getTypeVal()) elif (rr.rrtype == DNS_TYPE_MX): rdata = (rr.rdata.preference, self.getDnsName(*rr.rdata.exchange.getTypeVal())) elif (rr.rrtype == DNS_TYPE_TXT): rdata = rr.rdata.txtdata else: rdata = rr.rdata.bytez ret.append((rr.rrtype, rr.dnsclass, rr.ttl, fqdn, rdata)) return ret
def _getResourceRecords(self, structure): "\n Given a DnsResourceRecordArray() structure, return a list of Resource \n Records as (dnstype, dnsclass, ttl, fqdn, adata) tuples. If a parser\n is available for the dnsclass, the 'rdata' field will be further parsed \n into its components (as a tuple if necessary).\n " ret = [] for (fname, rr) in structure.vsGetFields(): fqdn = self.getDnsName(*rr.dnsname.getTypeVal()) rdata = None if (rr.rrtype == DNS_TYPE_A): rdata = vs_inet.reprIPv4Addr(rr.rdata.address) elif (rr.rrtype == DNS_TYPE_AAAA): rdata = vs_inet.reprIPv6Addr(rr.rdata.address) elif (rr.rrtype == DNS_TYPE_NS): rdata = self.getDnsName(*rr.rdata.nsdname.getTypeVal()) elif (rr.rrtype == DNS_TYPE_CNAME): rdata = self.getDnsName(*rr.rdata.cname.getTypeVal()) elif (rr.rrtype == DNS_TYPE_SOA): rdata = (self.getDnsName(*rr.rdata.mname.getTypeVal()), self.getDnsName(*rr.rdata.rname.getTypeVal()), rr.rdata.serial, rr.rdata.refresh, rr.rdata.retry, rr.rdata.expire, rr.rdata.minimum) elif (rr.rrtype == DNS_TYPE_PTR): rdata = self.getDnsName(*rr.rdata.ptrdname.getTypeVal()) elif (rr.rrtype == DNS_TYPE_MX): rdata = (rr.rdata.preference, self.getDnsName(*rr.rdata.exchange.getTypeVal())) elif (rr.rrtype == DNS_TYPE_TXT): rdata = rr.rdata.txtdata else: rdata = rr.rdata.bytez ret.append((rr.rrtype, rr.dnsclass, rr.ttl, fqdn, rdata)) return ret<|docstring|>Given a DnsResourceRecordArray() structure, return a list of Resource Records as (dnstype, dnsclass, ttl, fqdn, adata) tuples. If a parser is available for the dnsclass, the 'rdata' field will be further parsed into its components (as a tuple if necessary).<|endoftext|>
4da492fd644f90ff3335d634a91939f95f37f40d971161788748987277e7cdef
def getAnswerRecords(self): "\n Return a list of Answer records as (rrtype, dnsclass, ttl, fqdn,\n rdata) tuples. If a parser is available for the dnsclass, the \n 'rdata' field will be further parsed into its components (as a\n tuple if necessary).\n " if (not self._cache_ars): self._cache_ars = self._getResourceRecords(structure=self.section.answer) return self._cache_ars
Return a list of Answer records as (rrtype, dnsclass, ttl, fqdn, rdata) tuples. If a parser is available for the dnsclass, the 'rdata' field will be further parsed into its components (as a tuple if necessary).
vstruct/defs/dns.py
getAnswerRecords
TomSomerville/vivisect
716
python
def getAnswerRecords(self): "\n Return a list of Answer records as (rrtype, dnsclass, ttl, fqdn,\n rdata) tuples. If a parser is available for the dnsclass, the \n 'rdata' field will be further parsed into its components (as a\n tuple if necessary).\n " if (not self._cache_ars): self._cache_ars = self._getResourceRecords(structure=self.section.answer) return self._cache_ars
def getAnswerRecords(self): "\n Return a list of Answer records as (rrtype, dnsclass, ttl, fqdn,\n rdata) tuples. If a parser is available for the dnsclass, the \n 'rdata' field will be further parsed into its components (as a\n tuple if necessary).\n " if (not self._cache_ars): self._cache_ars = self._getResourceRecords(structure=self.section.answer) return self._cache_ars<|docstring|>Return a list of Answer records as (rrtype, dnsclass, ttl, fqdn, rdata) tuples. If a parser is available for the dnsclass, the 'rdata' field will be further parsed into its components (as a tuple if necessary).<|endoftext|>
4b7fd80d25ddb097fc48ae24b024fd3ff6476b8d6896b9e49ef3b75fff230f16
def getAuthorityRecords(self): "\n Return a list of Authority records as (rrtype, dnsclass, ttl, \n fqdn, rdata) tuples. If a parser is available for the dnsclass, \n the 'rdata' field will be further parsed into its components \n (as a tuple if necessary).\n " return self._getResourceRecords(structure=self.section.authority)
Return a list of Authority records as (rrtype, dnsclass, ttl, fqdn, rdata) tuples. If a parser is available for the dnsclass, the 'rdata' field will be further parsed into its components (as a tuple if necessary).
vstruct/defs/dns.py
getAuthorityRecords
TomSomerville/vivisect
716
python
def getAuthorityRecords(self): "\n Return a list of Authority records as (rrtype, dnsclass, ttl, \n fqdn, rdata) tuples. If a parser is available for the dnsclass, \n the 'rdata' field will be further parsed into its components \n (as a tuple if necessary).\n " return self._getResourceRecords(structure=self.section.authority)
def getAuthorityRecords(self): "\n Return a list of Authority records as (rrtype, dnsclass, ttl, \n fqdn, rdata) tuples. If a parser is available for the dnsclass, \n the 'rdata' field will be further parsed into its components \n (as a tuple if necessary).\n " return self._getResourceRecords(structure=self.section.authority)<|docstring|>Return a list of Authority records as (rrtype, dnsclass, ttl, fqdn, rdata) tuples. If a parser is available for the dnsclass, the 'rdata' field will be further parsed into its components (as a tuple if necessary).<|endoftext|>
88d4e9d5abbb1631324758a137df2b224d8d09baac0f1ab562a7f079325c1e10
def getAdditionalRecords(self): "\n Return a list of Additional records as (rrtype, dnsclass, ttl, \n fqdn, rdata) tuples. If a parser is available for the dnsclass, \n the 'rdata' field will be further parsed into its components (as \n a tuple if necessary).\n " return self._getResourceRecords(structure=self.section.additional)
Return a list of Additional records as (rrtype, dnsclass, ttl, fqdn, rdata) tuples. If a parser is available for the dnsclass, the 'rdata' field will be further parsed into its components (as a tuple if necessary).
vstruct/defs/dns.py
getAdditionalRecords
TomSomerville/vivisect
716
python
def getAdditionalRecords(self): "\n Return a list of Additional records as (rrtype, dnsclass, ttl, \n fqdn, rdata) tuples. If a parser is available for the dnsclass, \n the 'rdata' field will be further parsed into its components (as \n a tuple if necessary).\n " return self._getResourceRecords(structure=self.section.additional)
def getAdditionalRecords(self): "\n Return a list of Additional records as (rrtype, dnsclass, ttl, \n fqdn, rdata) tuples. If a parser is available for the dnsclass, \n the 'rdata' field will be further parsed into its components (as \n a tuple if necessary).\n " return self._getResourceRecords(structure=self.section.additional)<|docstring|>Return a list of Additional records as (rrtype, dnsclass, ttl, fqdn, rdata) tuples. If a parser is available for the dnsclass, the 'rdata' field will be further parsed into its components (as a tuple if necessary).<|endoftext|>
7b42e8db28848b6ccb7e7c7a32216dafbb1078535b441fd29630f5f43cfa93f9
def getDnsNames(self): '\n Return a list of the DNS names in the message.\n ' fqdns = set() for (ofs, indent, fname, fobj) in self.vsGetPrintInfo(): if (fobj.vsGetTypeName() == 'DnsName'): fqdns.add(self.getDnsName(*fobj.getTypeVal())) return list(fqdns)
Return a list of the DNS names in the message.
vstruct/defs/dns.py
getDnsNames
TomSomerville/vivisect
716
python
def getDnsNames(self): '\n \n ' fqdns = set() for (ofs, indent, fname, fobj) in self.vsGetPrintInfo(): if (fobj.vsGetTypeName() == 'DnsName'): fqdns.add(self.getDnsName(*fobj.getTypeVal())) return list(fqdns)
def getDnsNames(self): '\n \n ' fqdns = set() for (ofs, indent, fname, fobj) in self.vsGetPrintInfo(): if (fobj.vsGetTypeName() == 'DnsName'): fqdns.add(self.getDnsName(*fobj.getTypeVal())) return list(fqdns)<|docstring|>Return a list of the DNS names in the message.<|endoftext|>
53695de49d94fa5106ee0dbb7fd197e4e156aec62ea975391f505929b23174b3
def getIPv4Integers(self): '\n Return a list of the IPv4 addresses in the message.\n ' ips = set() for (ofs, indent, fname, fobj) in self.vsGetPrintInfo(): if (fobj.vsGetTypeName() == 'IPv4Address'): ips.add(fobj._vs_value) return list(ips)
Return a list of the IPv4 addresses in the message.
vstruct/defs/dns.py
getIPv4Integers
TomSomerville/vivisect
716
python
def getIPv4Integers(self): '\n \n ' ips = set() for (ofs, indent, fname, fobj) in self.vsGetPrintInfo(): if (fobj.vsGetTypeName() == 'IPv4Address'): ips.add(fobj._vs_value) return list(ips)
def getIPv4Integers(self): '\n \n ' ips = set() for (ofs, indent, fname, fobj) in self.vsGetPrintInfo(): if (fobj.vsGetTypeName() == 'IPv4Address'): ips.add(fobj._vs_value) return list(ips)<|docstring|>Return a list of the IPv4 addresses in the message.<|endoftext|>
b6f7b6db6b9337315c5ec04edfc5079e5a5bdc2f5fffb3443ab53f4816f05421
def getEmailAddresses(self): '\n Return a list of the email addresses which are encoded as DNS names\n in the message (they are decoded back to email addresses here).\n ' emails = set() for (ofs, indent, fname, fobj) in self.vsGetPrintInfo(): if (fobj.vsGetTypeName() == 'DnsMailboxAsName'): mailbox = self.getDnsName(*fobj.getTypeVal()) parts = mailbox.split('.', 1) emails.add('@'.join(parts)) return list(emails)
Return a list of the email addresses which are encoded as DNS names in the message (they are decoded back to email addresses here).
vstruct/defs/dns.py
getEmailAddresses
TomSomerville/vivisect
716
python
def getEmailAddresses(self): '\n Return a list of the email addresses which are encoded as DNS names\n in the message (they are decoded back to email addresses here).\n ' emails = set() for (ofs, indent, fname, fobj) in self.vsGetPrintInfo(): if (fobj.vsGetTypeName() == 'DnsMailboxAsName'): mailbox = self.getDnsName(*fobj.getTypeVal()) parts = mailbox.split('.', 1) emails.add('@'.join(parts)) return list(emails)
def getEmailAddresses(self): '\n Return a list of the email addresses which are encoded as DNS names\n in the message (they are decoded back to email addresses here).\n ' emails = set() for (ofs, indent, fname, fobj) in self.vsGetPrintInfo(): if (fobj.vsGetTypeName() == 'DnsMailboxAsName'): mailbox = self.getDnsName(*fobj.getTypeVal()) parts = mailbox.split('.', 1) emails.add('@'.join(parts)) return list(emails)<|docstring|>Return a list of the email addresses which are encoded as DNS names in the message (they are decoded back to email addresses here).<|endoftext|>
9f54401031e28551fd1f8d6cc78b7746107d04ec0e34b9dcd71a0a31d68886e9
def test_base_dataset(config): 'Test to create `baseDataset`.\n ' cfg = config cfg.dataset.pop('transforms') dataset = BaseDataset(**cfg.dataset)
Test to create `baseDataset`.
test/data/test_dataset.py
test_base_dataset
Min-Sheng/template
6
python
def test_base_dataset(config): '\n ' cfg = config cfg.dataset.pop('transforms') dataset = BaseDataset(**cfg.dataset)
def test_base_dataset(config): '\n ' cfg = config cfg.dataset.pop('transforms') dataset = BaseDataset(**cfg.dataset)<|docstring|>Test to create `baseDataset`.<|endoftext|>
9efb57b93bee2279755b4f3df8dcadbfffc0ad0b19e99e9950acb9af03fd1b5a
def test_my_dataset(config, dummy_input): 'Test to create the derived dataset.\n ' cfg = config (image, label) = dummy_input(image_size=(10, 32, 32, 3), label_size=(10, 32, 32, 1)) dataset = MyDataset(image, label, **cfg.dataset)
Test to create the derived dataset.
test/data/test_dataset.py
test_my_dataset
Min-Sheng/template
6
python
def test_my_dataset(config, dummy_input): '\n ' cfg = config (image, label) = dummy_input(image_size=(10, 32, 32, 3), label_size=(10, 32, 32, 1)) dataset = MyDataset(image, label, **cfg.dataset)
def test_my_dataset(config, dummy_input): '\n ' cfg = config (image, label) = dummy_input(image_size=(10, 32, 32, 3), label_size=(10, 32, 32, 1)) dataset = MyDataset(image, label, **cfg.dataset)<|docstring|>Test to create the derived dataset.<|endoftext|>
f00db4a58b97b5f093637db098fa95b521661a327ccaa9ed38f5d30c509dfe8b
def test_data_loader(config, dummy_input): 'Test to create the dataloader and yield a batch of data.\n ' cfg = config (image, label) = dummy_input(image_size=(10, 32, 32, 3), label_size=(10, 32, 32, 1)) dataset = MyDataset(image, label, **cfg.dataset) dataloader = Dataloader(dataset, **cfg.dataloader) for batch in dataloader: assert (batch['input'].shape == (cfg.dataloader.batch_size, *image.shape[1:])) assert (batch['target'].shape == (cfg.dataloader.batch_size, *label.shape[1:]))
Test to create the dataloader and yield a batch of data.
test/data/test_dataset.py
test_data_loader
Min-Sheng/template
6
python
def test_data_loader(config, dummy_input): '\n ' cfg = config (image, label) = dummy_input(image_size=(10, 32, 32, 3), label_size=(10, 32, 32, 1)) dataset = MyDataset(image, label, **cfg.dataset) dataloader = Dataloader(dataset, **cfg.dataloader) for batch in dataloader: assert (batch['input'].shape == (cfg.dataloader.batch_size, *image.shape[1:])) assert (batch['target'].shape == (cfg.dataloader.batch_size, *label.shape[1:]))
def test_data_loader(config, dummy_input): '\n ' cfg = config (image, label) = dummy_input(image_size=(10, 32, 32, 3), label_size=(10, 32, 32, 1)) dataset = MyDataset(image, label, **cfg.dataset) dataloader = Dataloader(dataset, **cfg.dataloader) for batch in dataloader: assert (batch['input'].shape == (cfg.dataloader.batch_size, *image.shape[1:])) assert (batch['target'].shape == (cfg.dataloader.batch_size, *label.shape[1:]))<|docstring|>Test to create the dataloader and yield a batch of data.<|endoftext|>
0f9fdce3bdc8581b43fe2b09885ad25421b7abcabd5d67f6c4dd8f6db398a5d6
def __init__(self, hostname=ssh_config.HOST, port=ssh_config.PORT, username=ssh_config.USER, password=ssh_config.PASSWORD): '\n\n :param hostname: 想连接的主机地址\n :param port: ssh服务所监听的端口号\n :param username: 想连接的主机用户名\n :param password: 想连接的主机密码\n for example:\n ssh = SSHConnect()\n stdin, stdout, stderr = ssh.exec_command("ls")\n print(stdout)\n ' self.ssh = paramiko.SSHClient() self.ssh.connect(hostname=hostname, port=port, username=username, password=password)
:param hostname: 想连接的主机地址 :param port: ssh服务所监听的端口号 :param username: 想连接的主机用户名 :param password: 想连接的主机密码 for example: ssh = SSHConnect() stdin, stdout, stderr = ssh.exec_command("ls") print(stdout)
common/connect_ssh.py
__init__
yhj2013/AAT_FrameWork
5
python
def __init__(self, hostname=ssh_config.HOST, port=ssh_config.PORT, username=ssh_config.USER, password=ssh_config.PASSWORD): '\n\n :param hostname: 想连接的主机地址\n :param port: ssh服务所监听的端口号\n :param username: 想连接的主机用户名\n :param password: 想连接的主机密码\n for example:\n ssh = SSHConnect()\n stdin, stdout, stderr = ssh.exec_command("ls")\n print(stdout)\n ' self.ssh = paramiko.SSHClient() self.ssh.connect(hostname=hostname, port=port, username=username, password=password)
def __init__(self, hostname=ssh_config.HOST, port=ssh_config.PORT, username=ssh_config.USER, password=ssh_config.PASSWORD): '\n\n :param hostname: 想连接的主机地址\n :param port: ssh服务所监听的端口号\n :param username: 想连接的主机用户名\n :param password: 想连接的主机密码\n for example:\n ssh = SSHConnect()\n stdin, stdout, stderr = ssh.exec_command("ls")\n print(stdout)\n ' self.ssh = paramiko.SSHClient() self.ssh.connect(hostname=hostname, port=port, username=username, password=password)<|docstring|>:param hostname: 想连接的主机地址 :param port: ssh服务所监听的端口号 :param username: 想连接的主机用户名 :param password: 想连接的主机密码 for example: ssh = SSHConnect() stdin, stdout, stderr = ssh.exec_command("ls") print(stdout)<|endoftext|>
4b2a5c4a821abc16e1499aa9451a299e2e329085c946b895bccd5699408d4087
def exec_command(self, command): '\n\n :param command: 执行的\n :return: stdin: 标准输入, stdout: 标准输出, stderr: 错误输出\n ' if isinstance(command, str): (stdin, stdout, stderr) = self.ssh.exec_command(command) return (stdin, stdout, stderr)
:param command: 执行的 :return: stdin: 标准输入, stdout: 标准输出, stderr: 错误输出
common/connect_ssh.py
exec_command
yhj2013/AAT_FrameWork
5
python
def exec_command(self, command): '\n\n :param command: 执行的\n :return: stdin: 标准输入, stdout: 标准输出, stderr: 错误输出\n ' if isinstance(command, str): (stdin, stdout, stderr) = self.ssh.exec_command(command) return (stdin, stdout, stderr)
def exec_command(self, command): '\n\n :param command: 执行的\n :return: stdin: 标准输入, stdout: 标准输出, stderr: 错误输出\n ' if isinstance(command, str): (stdin, stdout, stderr) = self.ssh.exec_command(command) return (stdin, stdout, stderr)<|docstring|>:param command: 执行的 :return: stdin: 标准输入, stdout: 标准输出, stderr: 错误输出<|endoftext|>
65022dee06bd8d05553e3b62ba8092d68c48a1cc00acb1072b40a4c2e03c6f31
def polyfitThermalConductivity(self, power=2): "\n Calculates the coefficients of a polynomial fit for thermalConductivity.\n Based on data from http://www.specialmetals.com/documents/Inconel%20alloy%20X-750.pdf\n Fits a polynomial to the data set and returns the coefficients.\n\n Parameters\n ----------\n power : int, optional\n power of the polynomial fit equation\n\n Returns\n -------\n list of length 'power' containing the polynomial fit coefficients for thermal conductivity.\n\n " Tc = [(- 156.7), (- 128.9), (- 73.3), 21.1, 93.3, 204.4, 315.6, 426.7, 537.8, 648.9, 760.0, 871.1] k = [9.66, 10.1, 10.67, 11.97, 12.84, 14.13, 15.72, 17.31, 18.89, 20.62, 22.21, 23.65] return numpy.polyfit(numpy.array(Tc), numpy.array(k), power).tolist()
Calculates the coefficients of a polynomial fit for thermalConductivity. Based on data from http://www.specialmetals.com/documents/Inconel%20alloy%20X-750.pdf Fits a polynomial to the data set and returns the coefficients. Parameters ---------- power : int, optional power of the polynomial fit equation Returns ------- list of length 'power' containing the polynomial fit coefficients for thermal conductivity.
armi/materials/inconelX750.py
polyfitThermalConductivity
DennisYelizarov/armi
162
python
def polyfitThermalConductivity(self, power=2): "\n Calculates the coefficients of a polynomial fit for thermalConductivity.\n Based on data from http://www.specialmetals.com/documents/Inconel%20alloy%20X-750.pdf\n Fits a polynomial to the data set and returns the coefficients.\n\n Parameters\n ----------\n power : int, optional\n power of the polynomial fit equation\n\n Returns\n -------\n list of length 'power' containing the polynomial fit coefficients for thermal conductivity.\n\n " Tc = [(- 156.7), (- 128.9), (- 73.3), 21.1, 93.3, 204.4, 315.6, 426.7, 537.8, 648.9, 760.0, 871.1] k = [9.66, 10.1, 10.67, 11.97, 12.84, 14.13, 15.72, 17.31, 18.89, 20.62, 22.21, 23.65] return numpy.polyfit(numpy.array(Tc), numpy.array(k), power).tolist()
def polyfitThermalConductivity(self, power=2): "\n Calculates the coefficients of a polynomial fit for thermalConductivity.\n Based on data from http://www.specialmetals.com/documents/Inconel%20alloy%20X-750.pdf\n Fits a polynomial to the data set and returns the coefficients.\n\n Parameters\n ----------\n power : int, optional\n power of the polynomial fit equation\n\n Returns\n -------\n list of length 'power' containing the polynomial fit coefficients for thermal conductivity.\n\n " Tc = [(- 156.7), (- 128.9), (- 73.3), 21.1, 93.3, 204.4, 315.6, 426.7, 537.8, 648.9, 760.0, 871.1] k = [9.66, 10.1, 10.67, 11.97, 12.84, 14.13, 15.72, 17.31, 18.89, 20.62, 22.21, 23.65] return numpy.polyfit(numpy.array(Tc), numpy.array(k), power).tolist()<|docstring|>Calculates the coefficients of a polynomial fit for thermalConductivity. Based on data from http://www.specialmetals.com/documents/Inconel%20alloy%20X-750.pdf Fits a polynomial to the data set and returns the coefficients. Parameters ---------- power : int, optional power of the polynomial fit equation Returns ------- list of length 'power' containing the polynomial fit coefficients for thermal conductivity.<|endoftext|>
578a64f03e0778ea0556b6ec72408f8b93ba35733db6ebb3b0361e6dfca09a80
def thermalConductivity(self, Tk=None, Tc=None): '\n Returns the thermal conductivity of InconelX750.\n\n Parameters\n ----------\n Tk : float, optional\n Temperature in Kelvin.\n Tc : float, optional\n Temperature in degrees Celsius.\n\n Returns\n -------\n thermalCond : float\n thermal conductivity in W/m/C\n\n ' Tc = getTc(Tc, Tk) self.checkTempRange((- 156.7), 871.1, Tc, 'thermal conductivity') thermalCond = (((1.4835e-06 * (Tc ** 2)) + (0.012668 * Tc)) + 11.632) return thermalCond
Returns the thermal conductivity of InconelX750. Parameters ---------- Tk : float, optional Temperature in Kelvin. Tc : float, optional Temperature in degrees Celsius. Returns ------- thermalCond : float thermal conductivity in W/m/C
armi/materials/inconelX750.py
thermalConductivity
DennisYelizarov/armi
162
python
def thermalConductivity(self, Tk=None, Tc=None): '\n Returns the thermal conductivity of InconelX750.\n\n Parameters\n ----------\n Tk : float, optional\n Temperature in Kelvin.\n Tc : float, optional\n Temperature in degrees Celsius.\n\n Returns\n -------\n thermalCond : float\n thermal conductivity in W/m/C\n\n ' Tc = getTc(Tc, Tk) self.checkTempRange((- 156.7), 871.1, Tc, 'thermal conductivity') thermalCond = (((1.4835e-06 * (Tc ** 2)) + (0.012668 * Tc)) + 11.632) return thermalCond
def thermalConductivity(self, Tk=None, Tc=None): '\n Returns the thermal conductivity of InconelX750.\n\n Parameters\n ----------\n Tk : float, optional\n Temperature in Kelvin.\n Tc : float, optional\n Temperature in degrees Celsius.\n\n Returns\n -------\n thermalCond : float\n thermal conductivity in W/m/C\n\n ' Tc = getTc(Tc, Tk) self.checkTempRange((- 156.7), 871.1, Tc, 'thermal conductivity') thermalCond = (((1.4835e-06 * (Tc ** 2)) + (0.012668 * Tc)) + 11.632) return thermalCond<|docstring|>Returns the thermal conductivity of InconelX750. Parameters ---------- Tk : float, optional Temperature in Kelvin. Tc : float, optional Temperature in degrees Celsius. Returns ------- thermalCond : float thermal conductivity in W/m/C<|endoftext|>
9ade7042d18ce8d169baa027b0f5650f50c8401c11578067aaff18653802c52f
def polyfitHeatCapacity(self, power=3): "\n Calculates the coefficients of a polynomial fit for heatCapacity.\n Based on data from http://www.specialmetals.com/documents/Inconel%20alloy%20X-750.pdf\n Fits a polynomial to the data set and returns the coefficients.\n\n Parameters\n ----------\n power : int, optional\n power of the polynomial fit equation\n\n Returns\n -------\n list of length 'power' containing the polynomial fit coefficients for heat capacity.\n\n " Tc = [21.1, 93.3, 204.4, 315.6, 426.7, 537.8, 648.9, 760.0, 871.1] cp = [431.2, 456.4, 485.7, 502.4, 523.4, 544.3, 573.6, 632.2, 715.9] return numpy.polyfit(numpy.array(Tc), numpy.array(cp), power).tolist()
Calculates the coefficients of a polynomial fit for heatCapacity. Based on data from http://www.specialmetals.com/documents/Inconel%20alloy%20X-750.pdf Fits a polynomial to the data set and returns the coefficients. Parameters ---------- power : int, optional power of the polynomial fit equation Returns ------- list of length 'power' containing the polynomial fit coefficients for heat capacity.
armi/materials/inconelX750.py
polyfitHeatCapacity
DennisYelizarov/armi
162
python
def polyfitHeatCapacity(self, power=3): "\n Calculates the coefficients of a polynomial fit for heatCapacity.\n Based on data from http://www.specialmetals.com/documents/Inconel%20alloy%20X-750.pdf\n Fits a polynomial to the data set and returns the coefficients.\n\n Parameters\n ----------\n power : int, optional\n power of the polynomial fit equation\n\n Returns\n -------\n list of length 'power' containing the polynomial fit coefficients for heat capacity.\n\n " Tc = [21.1, 93.3, 204.4, 315.6, 426.7, 537.8, 648.9, 760.0, 871.1] cp = [431.2, 456.4, 485.7, 502.4, 523.4, 544.3, 573.6, 632.2, 715.9] return numpy.polyfit(numpy.array(Tc), numpy.array(cp), power).tolist()
def polyfitHeatCapacity(self, power=3): "\n Calculates the coefficients of a polynomial fit for heatCapacity.\n Based on data from http://www.specialmetals.com/documents/Inconel%20alloy%20X-750.pdf\n Fits a polynomial to the data set and returns the coefficients.\n\n Parameters\n ----------\n power : int, optional\n power of the polynomial fit equation\n\n Returns\n -------\n list of length 'power' containing the polynomial fit coefficients for heat capacity.\n\n " Tc = [21.1, 93.3, 204.4, 315.6, 426.7, 537.8, 648.9, 760.0, 871.1] cp = [431.2, 456.4, 485.7, 502.4, 523.4, 544.3, 573.6, 632.2, 715.9] return numpy.polyfit(numpy.array(Tc), numpy.array(cp), power).tolist()<|docstring|>Calculates the coefficients of a polynomial fit for heatCapacity. Based on data from http://www.specialmetals.com/documents/Inconel%20alloy%20X-750.pdf Fits a polynomial to the data set and returns the coefficients. Parameters ---------- power : int, optional power of the polynomial fit equation Returns ------- list of length 'power' containing the polynomial fit coefficients for heat capacity.<|endoftext|>
1fb56b878b5f28d364b71c065c34093cf02c48b35041fd1c09320fa9e4fe342b
def heatCapacity(self, Tk=None, Tc=None): '\n Returns the specific heat capacity of InconelX750.\n\n Parameters\n ----------\n Tk : float, optional\n Temperature in Kelvin.\n Tc : float, optional\n Temperature in degrees Celsius.\n\n Returns\n -------\n heatCapacity : float\n heat capacity in J/kg/C\n\n ' Tc = getTc(Tc, Tk) self.checkTempRange((- 18.0), 1093.0, Tc, 'heat capacity') heatCapacity = ((((9.2261e-07 * (Tc ** 3)) - (0.00096368 * (Tc ** 2))) + (0.47778 * Tc)) + 420.55) return heatCapacity
Returns the specific heat capacity of InconelX750. Parameters ---------- Tk : float, optional Temperature in Kelvin. Tc : float, optional Temperature in degrees Celsius. Returns ------- heatCapacity : float heat capacity in J/kg/C
armi/materials/inconelX750.py
heatCapacity
DennisYelizarov/armi
162
python
def heatCapacity(self, Tk=None, Tc=None): '\n Returns the specific heat capacity of InconelX750.\n\n Parameters\n ----------\n Tk : float, optional\n Temperature in Kelvin.\n Tc : float, optional\n Temperature in degrees Celsius.\n\n Returns\n -------\n heatCapacity : float\n heat capacity in J/kg/C\n\n ' Tc = getTc(Tc, Tk) self.checkTempRange((- 18.0), 1093.0, Tc, 'heat capacity') heatCapacity = ((((9.2261e-07 * (Tc ** 3)) - (0.00096368 * (Tc ** 2))) + (0.47778 * Tc)) + 420.55) return heatCapacity
def heatCapacity(self, Tk=None, Tc=None): '\n Returns the specific heat capacity of InconelX750.\n\n Parameters\n ----------\n Tk : float, optional\n Temperature in Kelvin.\n Tc : float, optional\n Temperature in degrees Celsius.\n\n Returns\n -------\n heatCapacity : float\n heat capacity in J/kg/C\n\n ' Tc = getTc(Tc, Tk) self.checkTempRange((- 18.0), 1093.0, Tc, 'heat capacity') heatCapacity = ((((9.2261e-07 * (Tc ** 3)) - (0.00096368 * (Tc ** 2))) + (0.47778 * Tc)) + 420.55) return heatCapacity<|docstring|>Returns the specific heat capacity of InconelX750. Parameters ---------- Tk : float, optional Temperature in Kelvin. Tc : float, optional Temperature in degrees Celsius. Returns ------- heatCapacity : float heat capacity in J/kg/C<|endoftext|>
d00b3be826233374ba59caf62c8ce3b95029e841539528d01a208fe97d0b8176
def polyfitLinearExpansionPercent(self, power=2): "\n Calculates the coefficients of a polynomial fit for linearExpansionPercent.\n Based on data from http://www.specialmetals.com/documents/Inconel%20alloy%20X-750.pdf\n\n Uses mean CTE values to find percent thermal strain values. Fits a polynomial\n to the data set and returns the coefficients.\n\n Parameters\n ----------\n power : int, optional\n power of the polynomial fit equation\n\n Returns\n -------\n list of length 'power' containing the polynomial fit coefficients for linearExpansionPercent\n\n " refTempC = getTc(None, Tk=self.p.refTempK) Tc = [93.3, 204.4, 315.6, 426.7, 537.8, 648.9, 760.0, 871.1, 982.2] alpha_mean = [1.26e-05, 1.296e-05, 1.35e-05, 1.404e-05, 1.458e-05, 1.512e-05, 1.584e-05, 1.674e-05, 1.764e-05] linExpPercent = [0.0] for (i, alpha) in enumerate(alpha_mean): linExpPercentVal = ((100.0 * alpha) * (Tc[i] - refTempC)) linExpPercent.append(linExpPercentVal) Tc.insert(0, refTempC) return numpy.polyfit(numpy.array(Tc), numpy.array(linExpPercent), power).tolist()
Calculates the coefficients of a polynomial fit for linearExpansionPercent. Based on data from http://www.specialmetals.com/documents/Inconel%20alloy%20X-750.pdf Uses mean CTE values to find percent thermal strain values. Fits a polynomial to the data set and returns the coefficients. Parameters ---------- power : int, optional power of the polynomial fit equation Returns ------- list of length 'power' containing the polynomial fit coefficients for linearExpansionPercent
armi/materials/inconelX750.py
polyfitLinearExpansionPercent
DennisYelizarov/armi
162
python
def polyfitLinearExpansionPercent(self, power=2): "\n Calculates the coefficients of a polynomial fit for linearExpansionPercent.\n Based on data from http://www.specialmetals.com/documents/Inconel%20alloy%20X-750.pdf\n\n Uses mean CTE values to find percent thermal strain values. Fits a polynomial\n to the data set and returns the coefficients.\n\n Parameters\n ----------\n power : int, optional\n power of the polynomial fit equation\n\n Returns\n -------\n list of length 'power' containing the polynomial fit coefficients for linearExpansionPercent\n\n " refTempC = getTc(None, Tk=self.p.refTempK) Tc = [93.3, 204.4, 315.6, 426.7, 537.8, 648.9, 760.0, 871.1, 982.2] alpha_mean = [1.26e-05, 1.296e-05, 1.35e-05, 1.404e-05, 1.458e-05, 1.512e-05, 1.584e-05, 1.674e-05, 1.764e-05] linExpPercent = [0.0] for (i, alpha) in enumerate(alpha_mean): linExpPercentVal = ((100.0 * alpha) * (Tc[i] - refTempC)) linExpPercent.append(linExpPercentVal) Tc.insert(0, refTempC) return numpy.polyfit(numpy.array(Tc), numpy.array(linExpPercent), power).tolist()
def polyfitLinearExpansionPercent(self, power=2): "\n Calculates the coefficients of a polynomial fit for linearExpansionPercent.\n Based on data from http://www.specialmetals.com/documents/Inconel%20alloy%20X-750.pdf\n\n Uses mean CTE values to find percent thermal strain values. Fits a polynomial\n to the data set and returns the coefficients.\n\n Parameters\n ----------\n power : int, optional\n power of the polynomial fit equation\n\n Returns\n -------\n list of length 'power' containing the polynomial fit coefficients for linearExpansionPercent\n\n " refTempC = getTc(None, Tk=self.p.refTempK) Tc = [93.3, 204.4, 315.6, 426.7, 537.8, 648.9, 760.0, 871.1, 982.2] alpha_mean = [1.26e-05, 1.296e-05, 1.35e-05, 1.404e-05, 1.458e-05, 1.512e-05, 1.584e-05, 1.674e-05, 1.764e-05] linExpPercent = [0.0] for (i, alpha) in enumerate(alpha_mean): linExpPercentVal = ((100.0 * alpha) * (Tc[i] - refTempC)) linExpPercent.append(linExpPercentVal) Tc.insert(0, refTempC) return numpy.polyfit(numpy.array(Tc), numpy.array(linExpPercent), power).tolist()<|docstring|>Calculates the coefficients of a polynomial fit for linearExpansionPercent. Based on data from http://www.specialmetals.com/documents/Inconel%20alloy%20X-750.pdf Uses mean CTE values to find percent thermal strain values. Fits a polynomial to the data set and returns the coefficients. Parameters ---------- power : int, optional power of the polynomial fit equation Returns ------- list of length 'power' containing the polynomial fit coefficients for linearExpansionPercent<|endoftext|>
5c7c2bd84fa3e0fa78d6e076c1daa9c7949d1fc922626ee2d1ba0d8d67a28779
def linearExpansionPercent(self, Tk=None, Tc=None): '\n Returns percent linear expansion of InconelX750.\n\n Parameters\n ----------\n Tk : float\n temperature in (K)\n Tc : float\n Temperature in (C)\n\n Returns\n -------\n linExpPercent in %-m/m/C\n\n ' Tc = getTc(Tc, Tk) self.checkTempRange(21.1, 982.2, Tc, 'linear expansion percent') linExpPercent = (((6.8378e-07 * (Tc ** 2)) + (0.001056 * Tc)) - 0.013161) return linExpPercent
Returns percent linear expansion of InconelX750. Parameters ---------- Tk : float temperature in (K) Tc : float Temperature in (C) Returns ------- linExpPercent in %-m/m/C
armi/materials/inconelX750.py
linearExpansionPercent
DennisYelizarov/armi
162
python
def linearExpansionPercent(self, Tk=None, Tc=None): '\n Returns percent linear expansion of InconelX750.\n\n Parameters\n ----------\n Tk : float\n temperature in (K)\n Tc : float\n Temperature in (C)\n\n Returns\n -------\n linExpPercent in %-m/m/C\n\n ' Tc = getTc(Tc, Tk) self.checkTempRange(21.1, 982.2, Tc, 'linear expansion percent') linExpPercent = (((6.8378e-07 * (Tc ** 2)) + (0.001056 * Tc)) - 0.013161) return linExpPercent
def linearExpansionPercent(self, Tk=None, Tc=None): '\n Returns percent linear expansion of InconelX750.\n\n Parameters\n ----------\n Tk : float\n temperature in (K)\n Tc : float\n Temperature in (C)\n\n Returns\n -------\n linExpPercent in %-m/m/C\n\n ' Tc = getTc(Tc, Tk) self.checkTempRange(21.1, 982.2, Tc, 'linear expansion percent') linExpPercent = (((6.8378e-07 * (Tc ** 2)) + (0.001056 * Tc)) - 0.013161) return linExpPercent<|docstring|>Returns percent linear expansion of InconelX750. Parameters ---------- Tk : float temperature in (K) Tc : float Temperature in (C) Returns ------- linExpPercent in %-m/m/C<|endoftext|>
c250de0c30b590c9e1fed4fb6e84dcc21c88e505c8939f94195b6c3939afd01e
def linearExpansion(self, Tk=None, Tc=None): '\n From http://www.specialmetals.com/documents/Inconel%20alloy%20X-750.pdf\n\n Using the correlation for linearExpansionPercent, the 2nd order polynomial is divided by 100 to convert\n from percent strain to strain, then differentiated with respect to temperature to find the correlation\n for instantaneous linear expansion.\n\n i.e. for a linearExpansionPercent correlation of a*Tc**2 + b*Tc + c, the linearExpansion correlation is 2*a/100*Tc + b/100\n\n 2*(6.8378e-7/100.0)*Tc + 1.056e-3/100.0\n\n Parameters\n ----------\n Tk : float\n temperature in (K)\n Tc : float\n Temperature in (C)\n\n Returns\n -------\n linExp in m/m/C\n\n ' Tc = getTc(Tc, Tk) self.checkTempRange(21.1, 982.2, Tc, 'linear expansion') linExp = ((1.36756e-08 * Tc) + 1.056e-05) return linExp
From http://www.specialmetals.com/documents/Inconel%20alloy%20X-750.pdf Using the correlation for linearExpansionPercent, the 2nd order polynomial is divided by 100 to convert from percent strain to strain, then differentiated with respect to temperature to find the correlation for instantaneous linear expansion. i.e. for a linearExpansionPercent correlation of a*Tc**2 + b*Tc + c, the linearExpansion correlation is 2*a/100*Tc + b/100 2*(6.8378e-7/100.0)*Tc + 1.056e-3/100.0 Parameters ---------- Tk : float temperature in (K) Tc : float Temperature in (C) Returns ------- linExp in m/m/C
armi/materials/inconelX750.py
linearExpansion
DennisYelizarov/armi
162
python
def linearExpansion(self, Tk=None, Tc=None): '\n From http://www.specialmetals.com/documents/Inconel%20alloy%20X-750.pdf\n\n Using the correlation for linearExpansionPercent, the 2nd order polynomial is divided by 100 to convert\n from percent strain to strain, then differentiated with respect to temperature to find the correlation\n for instantaneous linear expansion.\n\n i.e. for a linearExpansionPercent correlation of a*Tc**2 + b*Tc + c, the linearExpansion correlation is 2*a/100*Tc + b/100\n\n 2*(6.8378e-7/100.0)*Tc + 1.056e-3/100.0\n\n Parameters\n ----------\n Tk : float\n temperature in (K)\n Tc : float\n Temperature in (C)\n\n Returns\n -------\n linExp in m/m/C\n\n ' Tc = getTc(Tc, Tk) self.checkTempRange(21.1, 982.2, Tc, 'linear expansion') linExp = ((1.36756e-08 * Tc) + 1.056e-05) return linExp
def linearExpansion(self, Tk=None, Tc=None): '\n From http://www.specialmetals.com/documents/Inconel%20alloy%20X-750.pdf\n\n Using the correlation for linearExpansionPercent, the 2nd order polynomial is divided by 100 to convert\n from percent strain to strain, then differentiated with respect to temperature to find the correlation\n for instantaneous linear expansion.\n\n i.e. for a linearExpansionPercent correlation of a*Tc**2 + b*Tc + c, the linearExpansion correlation is 2*a/100*Tc + b/100\n\n 2*(6.8378e-7/100.0)*Tc + 1.056e-3/100.0\n\n Parameters\n ----------\n Tk : float\n temperature in (K)\n Tc : float\n Temperature in (C)\n\n Returns\n -------\n linExp in m/m/C\n\n ' Tc = getTc(Tc, Tk) self.checkTempRange(21.1, 982.2, Tc, 'linear expansion') linExp = ((1.36756e-08 * Tc) + 1.056e-05) return linExp<|docstring|>From http://www.specialmetals.com/documents/Inconel%20alloy%20X-750.pdf Using the correlation for linearExpansionPercent, the 2nd order polynomial is divided by 100 to convert from percent strain to strain, then differentiated with respect to temperature to find the correlation for instantaneous linear expansion. i.e. for a linearExpansionPercent correlation of a*Tc**2 + b*Tc + c, the linearExpansion correlation is 2*a/100*Tc + b/100 2*(6.8378e-7/100.0)*Tc + 1.056e-3/100.0 Parameters ---------- Tk : float temperature in (K) Tc : float Temperature in (C) Returns ------- linExp in m/m/C<|endoftext|>
a27f9ca7feca8b6bd4d0d045a05c2dd7a372b4bc1aff55efa5758e7f31905779
def make_celery(): '\n Create celery tasks.\n :return: celery object\n ' celery = Celery(app.import_name, broker=Config.REDISTOGO_URL, include=CELERY_TASK_LIST) celery.conf.update(app.config) TaskBase = celery.Task class ContextTask(TaskBase): abstract = True def __call__(self, *args, **kwargs): with app.app_context(): return TaskBase.__call__(self, *args, **kwargs) celery.Task = ContextTask return celery
Create celery tasks. :return: celery object
app/__init__.py
make_celery
aabramos/backend-coding-challenge
0
python
def make_celery(): '\n Create celery tasks.\n :return: celery object\n ' celery = Celery(app.import_name, broker=Config.REDISTOGO_URL, include=CELERY_TASK_LIST) celery.conf.update(app.config) TaskBase = celery.Task class ContextTask(TaskBase): abstract = True def __call__(self, *args, **kwargs): with app.app_context(): return TaskBase.__call__(self, *args, **kwargs) celery.Task = ContextTask return celery
def make_celery(): '\n Create celery tasks.\n :return: celery object\n ' celery = Celery(app.import_name, broker=Config.REDISTOGO_URL, include=CELERY_TASK_LIST) celery.conf.update(app.config) TaskBase = celery.Task class ContextTask(TaskBase): abstract = True def __call__(self, *args, **kwargs): with app.app_context(): return TaskBase.__call__(self, *args, **kwargs) celery.Task = ContextTask return celery<|docstring|>Create celery tasks. :return: celery object<|endoftext|>
58dac787a828a1082431ef4cd347b554f2f89726859bd6d10d03bf982484aef0
def background_thread(): '\n The websocket is maintained in the background, and this\n function outputs a table for the client every two seconds\n :return: None.\n ' with app.test_request_context(): while True: socketio.sleep(2) translations = Translation.query.with_entities(Translation.source_text, Translation.translated_text, Translation.status).order_by(func.length(Translation.translated_text)).all() if translations: translations_schema = TranslationSchema(many=True) json_data = translations_schema.dump(translations).data formatted_data = json.dumps(json_data) socketio.emit('my_response', formatted_data, namespace='/unbabel', json=True)
The websocket is maintained in the background, and this function outputs a table for the client every two seconds :return: None.
app/__init__.py
background_thread
aabramos/backend-coding-challenge
0
python
def background_thread(): '\n The websocket is maintained in the background, and this\n function outputs a table for the client every two seconds\n :return: None.\n ' with app.test_request_context(): while True: socketio.sleep(2) translations = Translation.query.with_entities(Translation.source_text, Translation.translated_text, Translation.status).order_by(func.length(Translation.translated_text)).all() if translations: translations_schema = TranslationSchema(many=True) json_data = translations_schema.dump(translations).data formatted_data = json.dumps(json_data) socketio.emit('my_response', formatted_data, namespace='/unbabel', json=True)
def background_thread(): '\n The websocket is maintained in the background, and this\n function outputs a table for the client every two seconds\n :return: None.\n ' with app.test_request_context(): while True: socketio.sleep(2) translations = Translation.query.with_entities(Translation.source_text, Translation.translated_text, Translation.status).order_by(func.length(Translation.translated_text)).all() if translations: translations_schema = TranslationSchema(many=True) json_data = translations_schema.dump(translations).data formatted_data = json.dumps(json_data) socketio.emit('my_response', formatted_data, namespace='/unbabel', json=True)<|docstring|>The websocket is maintained in the background, and this function outputs a table for the client every two seconds :return: None.<|endoftext|>
1d3cec5e37fd449f7fcee9a24d063208223db954aeb16f1faf28ea8026f6c2c7
def _calcular_tfs(self): 'Método que cálcula o TF de uma palavra\n Calculo do TF de uma palavra: qtd da palavra no texto/total de palavras no texto.\n ' for palavra in self.palavras: tf = (float(self.texto.count(palavra)) / float(self.total_palavras)) self.tf_palavras[palavra] = tf
Método que cálcula o TF de uma palavra Calculo do TF de uma palavra: qtd da palavra no texto/total de palavras no texto.
summarizer.py
_calcular_tfs
DouglasHSS/AdvancedTopicsInAI
0
python
def _calcular_tfs(self): 'Método que cálcula o TF de uma palavra\n Calculo do TF de uma palavra: qtd da palavra no texto/total de palavras no texto.\n ' for palavra in self.palavras: tf = (float(self.texto.count(palavra)) / float(self.total_palavras)) self.tf_palavras[palavra] = tf
def _calcular_tfs(self): 'Método que cálcula o TF de uma palavra\n Calculo do TF de uma palavra: qtd da palavra no texto/total de palavras no texto.\n ' for palavra in self.palavras: tf = (float(self.texto.count(palavra)) / float(self.total_palavras)) self.tf_palavras[palavra] = tf<|docstring|>Método que cálcula o TF de uma palavra Calculo do TF de uma palavra: qtd da palavra no texto/total de palavras no texto.<|endoftext|>
7021d8ca36ffc3db5c3d2071c0559856daaa16b1e3410c676a8e0ca55bd42f99
def _calcular_idfs(self): 'Método que cálcula o IDF de uma palavra\n ' for palavra in self.palavras: ocorrencias = sum([1 for sentenca in self.sentencas if (palavra in sentenca)]) if (ocorrencias > 0): idf = log((float((self.total_sentencas + 1)) / float(ocorrencias))) self.idf_palavras[palavra] = idf
Método que cálcula o IDF de uma palavra
summarizer.py
_calcular_idfs
DouglasHSS/AdvancedTopicsInAI
0
python
def _calcular_idfs(self): '\n ' for palavra in self.palavras: ocorrencias = sum([1 for sentenca in self.sentencas if (palavra in sentenca)]) if (ocorrencias > 0): idf = log((float((self.total_sentencas + 1)) / float(ocorrencias))) self.idf_palavras[palavra] = idf
def _calcular_idfs(self): '\n ' for palavra in self.palavras: ocorrencias = sum([1 for sentenca in self.sentencas if (palavra in sentenca)]) if (ocorrencias > 0): idf = log((float((self.total_sentencas + 1)) / float(ocorrencias))) self.idf_palavras[palavra] = idf<|docstring|>Método que cálcula o IDF de uma palavra<|endoftext|>
2cdf41d7908f2f5423cce0e25321b065c4db761184cc79750eed9efe556102ea
def check_target_configuration(): '\n Checking target database configuration\n :return:\n ' parser.get_database_configuration(mode.Client.TARGET)
Checking target database configuration :return:
db_sync_tool/utility/system.py
check_target_configuration
jackd248/t3-db-sync
3
python
def check_target_configuration(): '\n Checking target database configuration\n :return:\n ' parser.get_database_configuration(mode.Client.TARGET)
def check_target_configuration(): '\n Checking target database configuration\n :return:\n ' parser.get_database_configuration(mode.Client.TARGET)<|docstring|>Checking target database configuration :return:<|endoftext|>
f1f654736673696de66d8d4b08d0b0c6368d667c4c73c80ee7587a154fec1c11
def get_configuration(host_config, args={}): '\n Checking configuration information by file or dictionary\n :param host_config: Dictionary\n :param args: Dictionary\n :return:\n ' global config config[mode.Client.TARGET] = {} config[mode.Client.ORIGIN] = {} if host_config: if (type(host_config) is dict): config.update(__m=host_config) else: config.update(__m=json.dumps(obj=host_config)) _config_file_path = config['config_file_path'] if (not (_config_file_path is None)): if os.path.isfile(_config_file_path): with open(_config_file_path, 'r') as read_file: if _config_file_path.endswith('.json'): config.update(json.load(read_file)) elif (_config_file_path.endswith('.yaml') or _config_file_path.endswith('.yml')): config.update(yaml.safe_load(read_file)) else: sys.exit(output.message(output.Subject.ERROR, f"Unsupported configuration file type [json,yml,yaml]: {config['config_file_path']}", False)) output.message(output.Subject.LOCAL, f'Loading host configuration {output.CliFormat.BLACK}{_config_file_path}{output.CliFormat.ENDC}', True) else: sys.exit(output.message(output.Subject.ERROR, f"Local configuration not found: {config['config_file_path']}", False)) args_config = build_config(args) validation.check(config) check_options() if ((not config[mode.Client.TARGET]) and (not config[mode.Client.ORIGIN])): sys.exit(output.message(output.Subject.ERROR, f'Configuration is missing, use a separate file or provide host parameter', False)) helper.run_script(script='before') log.get_logger().info('Starting db_sync_tool')
Checking configuration information by file or dictionary :param host_config: Dictionary :param args: Dictionary :return:
db_sync_tool/utility/system.py
get_configuration
jackd248/t3-db-sync
3
python
def get_configuration(host_config, args={}): '\n Checking configuration information by file or dictionary\n :param host_config: Dictionary\n :param args: Dictionary\n :return:\n ' global config config[mode.Client.TARGET] = {} config[mode.Client.ORIGIN] = {} if host_config: if (type(host_config) is dict): config.update(__m=host_config) else: config.update(__m=json.dumps(obj=host_config)) _config_file_path = config['config_file_path'] if (not (_config_file_path is None)): if os.path.isfile(_config_file_path): with open(_config_file_path, 'r') as read_file: if _config_file_path.endswith('.json'): config.update(json.load(read_file)) elif (_config_file_path.endswith('.yaml') or _config_file_path.endswith('.yml')): config.update(yaml.safe_load(read_file)) else: sys.exit(output.message(output.Subject.ERROR, f"Unsupported configuration file type [json,yml,yaml]: {config['config_file_path']}", False)) output.message(output.Subject.LOCAL, f'Loading host configuration {output.CliFormat.BLACK}{_config_file_path}{output.CliFormat.ENDC}', True) else: sys.exit(output.message(output.Subject.ERROR, f"Local configuration not found: {config['config_file_path']}", False)) args_config = build_config(args) validation.check(config) check_options() if ((not config[mode.Client.TARGET]) and (not config[mode.Client.ORIGIN])): sys.exit(output.message(output.Subject.ERROR, f'Configuration is missing, use a separate file or provide host parameter', False)) helper.run_script(script='before') log.get_logger().info('Starting db_sync_tool')
def get_configuration(host_config, args={}): '\n Checking configuration information by file or dictionary\n :param host_config: Dictionary\n :param args: Dictionary\n :return:\n ' global config config[mode.Client.TARGET] = {} config[mode.Client.ORIGIN] = {} if host_config: if (type(host_config) is dict): config.update(__m=host_config) else: config.update(__m=json.dumps(obj=host_config)) _config_file_path = config['config_file_path'] if (not (_config_file_path is None)): if os.path.isfile(_config_file_path): with open(_config_file_path, 'r') as read_file: if _config_file_path.endswith('.json'): config.update(json.load(read_file)) elif (_config_file_path.endswith('.yaml') or _config_file_path.endswith('.yml')): config.update(yaml.safe_load(read_file)) else: sys.exit(output.message(output.Subject.ERROR, f"Unsupported configuration file type [json,yml,yaml]: {config['config_file_path']}", False)) output.message(output.Subject.LOCAL, f'Loading host configuration {output.CliFormat.BLACK}{_config_file_path}{output.CliFormat.ENDC}', True) else: sys.exit(output.message(output.Subject.ERROR, f"Local configuration not found: {config['config_file_path']}", False)) args_config = build_config(args) validation.check(config) check_options() if ((not config[mode.Client.TARGET]) and (not config[mode.Client.ORIGIN])): sys.exit(output.message(output.Subject.ERROR, f'Configuration is missing, use a separate file or provide host parameter', False)) helper.run_script(script='before') log.get_logger().info('Starting db_sync_tool')<|docstring|>Checking configuration information by file or dictionary :param host_config: Dictionary :param args: Dictionary :return:<|endoftext|>
15b7c348663f3827d7012fccec0b0183496877cf18b3beb526bd25eb0c382547
def build_config(args): '\n ADding the provided arguments\n :param args:\n :return:\n ' if ((args is None) or (not args)): return {} if (not (args.type is None)): config['type'] = args.type if (not (args.tables is None)): config['tables'] = args.tables if (not (args.origin is None)): config['link_origin'] = args.origin if (not (args.target is None)): config['link_target'] = args.target if (not (args.target_path is None)): config[mode.Client.TARGET]['path'] = args.target_path if (not (args.target_name is None)): config[mode.Client.TARGET]['name'] = args.target_name if (not (args.target_host is None)): config[mode.Client.TARGET]['host'] = args.target_host if (not (args.target_user is None)): config[mode.Client.TARGET]['user'] = args.target_user if (not (args.target_password is None)): config[mode.Client.TARGET]['password'] = args.target_password if (not (args.target_key is None)): config[mode.Client.TARGET]['ssh_key'] = args.target_key if (not (args.target_port is None)): config[mode.Client.TARGET]['port'] = args.target_port if (not (args.target_dump_dir is None)): config[mode.Client.TARGET]['dump_dir'] = args.target_dump_dir if (not (args.target_db_name is None)): config[mode.Client.TARGET]['db']['name'] = args.target_db_name if (not (args.target_db_host is None)): config[mode.Client.TARGET]['db']['host'] = args.target_db_host if (not (args.target_db_user is None)): config[mode.Client.TARGET]['db']['user'] = args.target_db_user if (not (args.target_db_password is None)): config[mode.Client.TARGET]['db']['password'] = args.target_db_password if (not (args.target_db_port is None)): config[mode.Client.TARGET]['db']['port'] = args.target_db_port if (not (args.target_after_dump is None)): config[mode.Client.TARGET]['after_dump'] = args.target_after_dump if (not (args.origin_path is None)): config[mode.Client.ORIGIN]['path'] = args.origin_path if (not (args.origin_name is None)): config[mode.Client.ORIGIN]['name'] = args.origin_name if (not (args.origin_host is None)): config[mode.Client.ORIGIN]['host'] = args.origin_host if (not (args.origin_user is None)): config[mode.Client.ORIGIN]['user'] = args.origin_user if (not (args.origin_password is None)): config[mode.Client.ORIGIN]['password'] = args.origin_password if (not (args.origin_key is None)): config[mode.Client.ORIGIN]['ssh_key'] = args.origin_key if (not (args.origin_port is None)): config[mode.Client.ORIGIN]['port'] = args.origin_port if (not (args.origin_dump_dir is None)): config[mode.Client.ORIGIN]['dump_dir'] = args.origin_dump_dir if (not (args.origin_db_name is None)): config[mode.Client.ORIGIN]['db']['name'] = args.origin_db_name if (not (args.origin_db_host is None)): config[mode.Client.ORIGIN]['db']['host'] = args.origin_db_host if (not (args.origin_db_user is None)): config[mode.Client.ORIGIN]['db']['user'] = args.origin_db_user if (not (args.origin_db_password is None)): config[mode.Client.ORIGIN]['db']['password'] = args.origin_db_password if (not (args.origin_db_port is None)): config[mode.Client.ORIGIN]['db']['port'] = args.origin_db_port return config
ADding the provided arguments :param args: :return:
db_sync_tool/utility/system.py
build_config
jackd248/t3-db-sync
3
python
def build_config(args): '\n ADding the provided arguments\n :param args:\n :return:\n ' if ((args is None) or (not args)): return {} if (not (args.type is None)): config['type'] = args.type if (not (args.tables is None)): config['tables'] = args.tables if (not (args.origin is None)): config['link_origin'] = args.origin if (not (args.target is None)): config['link_target'] = args.target if (not (args.target_path is None)): config[mode.Client.TARGET]['path'] = args.target_path if (not (args.target_name is None)): config[mode.Client.TARGET]['name'] = args.target_name if (not (args.target_host is None)): config[mode.Client.TARGET]['host'] = args.target_host if (not (args.target_user is None)): config[mode.Client.TARGET]['user'] = args.target_user if (not (args.target_password is None)): config[mode.Client.TARGET]['password'] = args.target_password if (not (args.target_key is None)): config[mode.Client.TARGET]['ssh_key'] = args.target_key if (not (args.target_port is None)): config[mode.Client.TARGET]['port'] = args.target_port if (not (args.target_dump_dir is None)): config[mode.Client.TARGET]['dump_dir'] = args.target_dump_dir if (not (args.target_db_name is None)): config[mode.Client.TARGET]['db']['name'] = args.target_db_name if (not (args.target_db_host is None)): config[mode.Client.TARGET]['db']['host'] = args.target_db_host if (not (args.target_db_user is None)): config[mode.Client.TARGET]['db']['user'] = args.target_db_user if (not (args.target_db_password is None)): config[mode.Client.TARGET]['db']['password'] = args.target_db_password if (not (args.target_db_port is None)): config[mode.Client.TARGET]['db']['port'] = args.target_db_port if (not (args.target_after_dump is None)): config[mode.Client.TARGET]['after_dump'] = args.target_after_dump if (not (args.origin_path is None)): config[mode.Client.ORIGIN]['path'] = args.origin_path if (not (args.origin_name is None)): config[mode.Client.ORIGIN]['name'] = args.origin_name if (not (args.origin_host is None)): config[mode.Client.ORIGIN]['host'] = args.origin_host if (not (args.origin_user is None)): config[mode.Client.ORIGIN]['user'] = args.origin_user if (not (args.origin_password is None)): config[mode.Client.ORIGIN]['password'] = args.origin_password if (not (args.origin_key is None)): config[mode.Client.ORIGIN]['ssh_key'] = args.origin_key if (not (args.origin_port is None)): config[mode.Client.ORIGIN]['port'] = args.origin_port if (not (args.origin_dump_dir is None)): config[mode.Client.ORIGIN]['dump_dir'] = args.origin_dump_dir if (not (args.origin_db_name is None)): config[mode.Client.ORIGIN]['db']['name'] = args.origin_db_name if (not (args.origin_db_host is None)): config[mode.Client.ORIGIN]['db']['host'] = args.origin_db_host if (not (args.origin_db_user is None)): config[mode.Client.ORIGIN]['db']['user'] = args.origin_db_user if (not (args.origin_db_password is None)): config[mode.Client.ORIGIN]['db']['password'] = args.origin_db_password if (not (args.origin_db_port is None)): config[mode.Client.ORIGIN]['db']['port'] = args.origin_db_port return config
def build_config(args): '\n ADding the provided arguments\n :param args:\n :return:\n ' if ((args is None) or (not args)): return {} if (not (args.type is None)): config['type'] = args.type if (not (args.tables is None)): config['tables'] = args.tables if (not (args.origin is None)): config['link_origin'] = args.origin if (not (args.target is None)): config['link_target'] = args.target if (not (args.target_path is None)): config[mode.Client.TARGET]['path'] = args.target_path if (not (args.target_name is None)): config[mode.Client.TARGET]['name'] = args.target_name if (not (args.target_host is None)): config[mode.Client.TARGET]['host'] = args.target_host if (not (args.target_user is None)): config[mode.Client.TARGET]['user'] = args.target_user if (not (args.target_password is None)): config[mode.Client.TARGET]['password'] = args.target_password if (not (args.target_key is None)): config[mode.Client.TARGET]['ssh_key'] = args.target_key if (not (args.target_port is None)): config[mode.Client.TARGET]['port'] = args.target_port if (not (args.target_dump_dir is None)): config[mode.Client.TARGET]['dump_dir'] = args.target_dump_dir if (not (args.target_db_name is None)): config[mode.Client.TARGET]['db']['name'] = args.target_db_name if (not (args.target_db_host is None)): config[mode.Client.TARGET]['db']['host'] = args.target_db_host if (not (args.target_db_user is None)): config[mode.Client.TARGET]['db']['user'] = args.target_db_user if (not (args.target_db_password is None)): config[mode.Client.TARGET]['db']['password'] = args.target_db_password if (not (args.target_db_port is None)): config[mode.Client.TARGET]['db']['port'] = args.target_db_port if (not (args.target_after_dump is None)): config[mode.Client.TARGET]['after_dump'] = args.target_after_dump if (not (args.origin_path is None)): config[mode.Client.ORIGIN]['path'] = args.origin_path if (not (args.origin_name is None)): config[mode.Client.ORIGIN]['name'] = args.origin_name if (not (args.origin_host is None)): config[mode.Client.ORIGIN]['host'] = args.origin_host if (not (args.origin_user is None)): config[mode.Client.ORIGIN]['user'] = args.origin_user if (not (args.origin_password is None)): config[mode.Client.ORIGIN]['password'] = args.origin_password if (not (args.origin_key is None)): config[mode.Client.ORIGIN]['ssh_key'] = args.origin_key if (not (args.origin_port is None)): config[mode.Client.ORIGIN]['port'] = args.origin_port if (not (args.origin_dump_dir is None)): config[mode.Client.ORIGIN]['dump_dir'] = args.origin_dump_dir if (not (args.origin_db_name is None)): config[mode.Client.ORIGIN]['db']['name'] = args.origin_db_name if (not (args.origin_db_host is None)): config[mode.Client.ORIGIN]['db']['host'] = args.origin_db_host if (not (args.origin_db_user is None)): config[mode.Client.ORIGIN]['db']['user'] = args.origin_db_user if (not (args.origin_db_password is None)): config[mode.Client.ORIGIN]['db']['password'] = args.origin_db_password if (not (args.origin_db_port is None)): config[mode.Client.ORIGIN]['db']['port'] = args.origin_db_port return config<|docstring|>ADding the provided arguments :param args: :return:<|endoftext|>
17551d33b4804015ffb9e7a7abb8c5ceb64f01a7035bfee98862927fa383aa94
def check_options(): '\n Checking configuration provided file\n :return:\n ' global config if ('dump_dir' in config[mode.Client.ORIGIN]): config['default_origin_dump_dir'] = False if ('dump_dir' in config[mode.Client.TARGET]): config['default_target_dump_dir'] = False if ('check_dump' in config): config['check_dump'] = config['check_dump'] link_configuration_with_hosts() reverse_hosts() mode.check_sync_mode()
Checking configuration provided file :return:
db_sync_tool/utility/system.py
check_options
jackd248/t3-db-sync
3
python
def check_options(): '\n Checking configuration provided file\n :return:\n ' global config if ('dump_dir' in config[mode.Client.ORIGIN]): config['default_origin_dump_dir'] = False if ('dump_dir' in config[mode.Client.TARGET]): config['default_target_dump_dir'] = False if ('check_dump' in config): config['check_dump'] = config['check_dump'] link_configuration_with_hosts() reverse_hosts() mode.check_sync_mode()
def check_options(): '\n Checking configuration provided file\n :return:\n ' global config if ('dump_dir' in config[mode.Client.ORIGIN]): config['default_origin_dump_dir'] = False if ('dump_dir' in config[mode.Client.TARGET]): config['default_target_dump_dir'] = False if ('check_dump' in config): config['check_dump'] = config['check_dump'] link_configuration_with_hosts() reverse_hosts() mode.check_sync_mode()<|docstring|>Checking configuration provided file :return:<|endoftext|>
04db59b01ad55f563016825818451e651885b4a861543987974b55cddd9454de
def check_authorizations(): '\n Checking authorization for clients\n :return:\n ' check_authorization(mode.Client.ORIGIN) check_authorization(mode.Client.TARGET)
Checking authorization for clients :return:
db_sync_tool/utility/system.py
check_authorizations
jackd248/t3-db-sync
3
python
def check_authorizations(): '\n Checking authorization for clients\n :return:\n ' check_authorization(mode.Client.ORIGIN) check_authorization(mode.Client.TARGET)
def check_authorizations(): '\n Checking authorization for clients\n :return:\n ' check_authorization(mode.Client.ORIGIN) check_authorization(mode.Client.TARGET)<|docstring|>Checking authorization for clients :return:<|endoftext|>
a6da0fa3eb359e4b85042152fa6d38dad140a2a6bd9b2e7e4153ea71036809e7
def check_authorization(client): '\n Checking arguments and fill options array\n :param client: String\n :return:\n ' if mode.is_remote(client): if (((mode.get_sync_mode() == mode.SyncMode.DUMP_REMOTE) and (client == mode.Client.TARGET)) or ((mode.get_sync_mode() == mode.SyncMode.DUMP_LOCAL) and (client == mode.Client.ORIGIN)) or ((mode.get_sync_mode() == mode.SyncMode.IMPORT_REMOTE) and (client == mode.Client.ORIGIN))): return if config['force_password']: config[client]['password'] = get_password_by_user(client) elif ('ssh_key' in config[client]): _ssh_key = config[client]['ssh_key'] if (not os.path.isfile(_ssh_key)): sys.exit(output.message(output.Subject.ERROR, f'SSH {client} private key not found: {_ssh_key}', False)) elif ('password' in config[client]): config[client]['password'] = config[client]['password'] elif remote_utility.check_keys_from_ssh_agent(): config['ssh_agent'] = True else: config[client]['password'] = get_password_by_user(client) if ((mode.get_sync_mode() == mode.SyncMode.DUMP_REMOTE) and (client == mode.Client.ORIGIN) and ('password' in config[mode.Client.ORIGIN])): config[mode.Client.TARGET]['password'] = config[mode.Client.ORIGIN]['password']
Checking arguments and fill options array :param client: String :return:
db_sync_tool/utility/system.py
check_authorization
jackd248/t3-db-sync
3
python
def check_authorization(client): '\n Checking arguments and fill options array\n :param client: String\n :return:\n ' if mode.is_remote(client): if (((mode.get_sync_mode() == mode.SyncMode.DUMP_REMOTE) and (client == mode.Client.TARGET)) or ((mode.get_sync_mode() == mode.SyncMode.DUMP_LOCAL) and (client == mode.Client.ORIGIN)) or ((mode.get_sync_mode() == mode.SyncMode.IMPORT_REMOTE) and (client == mode.Client.ORIGIN))): return if config['force_password']: config[client]['password'] = get_password_by_user(client) elif ('ssh_key' in config[client]): _ssh_key = config[client]['ssh_key'] if (not os.path.isfile(_ssh_key)): sys.exit(output.message(output.Subject.ERROR, f'SSH {client} private key not found: {_ssh_key}', False)) elif ('password' in config[client]): config[client]['password'] = config[client]['password'] elif remote_utility.check_keys_from_ssh_agent(): config['ssh_agent'] = True else: config[client]['password'] = get_password_by_user(client) if ((mode.get_sync_mode() == mode.SyncMode.DUMP_REMOTE) and (client == mode.Client.ORIGIN) and ('password' in config[mode.Client.ORIGIN])): config[mode.Client.TARGET]['password'] = config[mode.Client.ORIGIN]['password']
def check_authorization(client): '\n Checking arguments and fill options array\n :param client: String\n :return:\n ' if mode.is_remote(client): if (((mode.get_sync_mode() == mode.SyncMode.DUMP_REMOTE) and (client == mode.Client.TARGET)) or ((mode.get_sync_mode() == mode.SyncMode.DUMP_LOCAL) and (client == mode.Client.ORIGIN)) or ((mode.get_sync_mode() == mode.SyncMode.IMPORT_REMOTE) and (client == mode.Client.ORIGIN))): return if config['force_password']: config[client]['password'] = get_password_by_user(client) elif ('ssh_key' in config[client]): _ssh_key = config[client]['ssh_key'] if (not os.path.isfile(_ssh_key)): sys.exit(output.message(output.Subject.ERROR, f'SSH {client} private key not found: {_ssh_key}', False)) elif ('password' in config[client]): config[client]['password'] = config[client]['password'] elif remote_utility.check_keys_from_ssh_agent(): config['ssh_agent'] = True else: config[client]['password'] = get_password_by_user(client) if ((mode.get_sync_mode() == mode.SyncMode.DUMP_REMOTE) and (client == mode.Client.ORIGIN) and ('password' in config[mode.Client.ORIGIN])): config[mode.Client.TARGET]['password'] = config[mode.Client.ORIGIN]['password']<|docstring|>Checking arguments and fill options array :param client: String :return:<|endoftext|>
72ed032195850f33a8cd1fd268ff25d548dad6d497209caa038247a2ff8d3e2a
def get_password_by_user(client): '\n Getting password by user input\n :param client: String\n :return: String password\n ' _password = getpass.getpass(output.message(output.Subject.INFO, (('SSH password ' + helper.get_ssh_host_name(client, True)) + ': '), False)) while (_password.strip() == ''): output.message(output.Subject.WARNING, 'Password seems to be empty. Please enter a valid password.', True) _password = getpass.getpass(output.message(output.Subject.INFO, (('SSH password ' + helper.get_ssh_host_name(client, True)) + ': '), False)) return _password
Getting password by user input :param client: String :return: String password
db_sync_tool/utility/system.py
get_password_by_user
jackd248/t3-db-sync
3
python
def get_password_by_user(client): '\n Getting password by user input\n :param client: String\n :return: String password\n ' _password = getpass.getpass(output.message(output.Subject.INFO, (('SSH password ' + helper.get_ssh_host_name(client, True)) + ': '), False)) while (_password.strip() == ): output.message(output.Subject.WARNING, 'Password seems to be empty. Please enter a valid password.', True) _password = getpass.getpass(output.message(output.Subject.INFO, (('SSH password ' + helper.get_ssh_host_name(client, True)) + ': '), False)) return _password
def get_password_by_user(client): '\n Getting password by user input\n :param client: String\n :return: String password\n ' _password = getpass.getpass(output.message(output.Subject.INFO, (('SSH password ' + helper.get_ssh_host_name(client, True)) + ': '), False)) while (_password.strip() == ): output.message(output.Subject.WARNING, 'Password seems to be empty. Please enter a valid password.', True) _password = getpass.getpass(output.message(output.Subject.INFO, (('SSH password ' + helper.get_ssh_host_name(client, True)) + ': '), False)) return _password<|docstring|>Getting password by user input :param client: String :return: String password<|endoftext|>
89484bc382fc29660d5a77ab386cb908a0bd98ac02857dd0756459cbe0d1dcef
def check_args_options(config_file=None, verbose=False, yes=False, mute=False, dry_run=False, import_file=None, dump_name=None, keep_dump=None, host_file=None, clear=False, force_password=False, use_rsync=False, use_rsync_options=None, reverse=False): '\n Checking arguments and fill options array\n :param config_file:\n :param verbose:\n :param yes:\n :param mute:\n :param dry_run:\n :param import_file:\n :param dump_name:\n :param keep_dump:\n :param host_file:\n :param clear:\n :param force_password:\n :param use_rsync:\n :param use_rsync_options:\n :param reverse:\n :return:\n ' global config global default_local_sync_path if (not (config_file is None)): config['config_file_path'] = config_file if (not (verbose is None)): config['verbose'] = verbose if (not (yes is None)): config['yes'] = yes if (not (mute is None)): config['mute'] = mute if (not (dry_run is None)): config['dry_run'] = dry_run if dry_run: output.message(output.Subject.INFO, 'Test mode: DRY RUN', True) if (not (import_file is None)): config['import'] = import_file if (not (dump_name is None)): config['dump_name'] = dump_name if (not (host_file is None)): config['link_hosts'] = host_file if (not (clear is None)): config['clear_database'] = clear if (not (force_password is None)): config['force_password'] = force_password if (not (use_rsync is None)): config['use_rsync'] = use_rsync if (use_rsync is True): helper.check_rsync_version() helper.check_sshpass_version() if (not (use_rsync_options is None)): config['use_rsync_options'] = use_rsync_options if (not (reverse is None)): config['reverse'] = reverse if (not (keep_dump is None)): default_local_sync_path = keep_dump if (default_local_sync_path[(- 1)] != '/'): default_local_sync_path += '/' config['keep_dump'] = True output.message(output.Subject.INFO, '"Keep dump" option chosen', True)
Checking arguments and fill options array :param config_file: :param verbose: :param yes: :param mute: :param dry_run: :param import_file: :param dump_name: :param keep_dump: :param host_file: :param clear: :param force_password: :param use_rsync: :param use_rsync_options: :param reverse: :return:
db_sync_tool/utility/system.py
check_args_options
jackd248/t3-db-sync
3
python
def check_args_options(config_file=None, verbose=False, yes=False, mute=False, dry_run=False, import_file=None, dump_name=None, keep_dump=None, host_file=None, clear=False, force_password=False, use_rsync=False, use_rsync_options=None, reverse=False): '\n Checking arguments and fill options array\n :param config_file:\n :param verbose:\n :param yes:\n :param mute:\n :param dry_run:\n :param import_file:\n :param dump_name:\n :param keep_dump:\n :param host_file:\n :param clear:\n :param force_password:\n :param use_rsync:\n :param use_rsync_options:\n :param reverse:\n :return:\n ' global config global default_local_sync_path if (not (config_file is None)): config['config_file_path'] = config_file if (not (verbose is None)): config['verbose'] = verbose if (not (yes is None)): config['yes'] = yes if (not (mute is None)): config['mute'] = mute if (not (dry_run is None)): config['dry_run'] = dry_run if dry_run: output.message(output.Subject.INFO, 'Test mode: DRY RUN', True) if (not (import_file is None)): config['import'] = import_file if (not (dump_name is None)): config['dump_name'] = dump_name if (not (host_file is None)): config['link_hosts'] = host_file if (not (clear is None)): config['clear_database'] = clear if (not (force_password is None)): config['force_password'] = force_password if (not (use_rsync is None)): config['use_rsync'] = use_rsync if (use_rsync is True): helper.check_rsync_version() helper.check_sshpass_version() if (not (use_rsync_options is None)): config['use_rsync_options'] = use_rsync_options if (not (reverse is None)): config['reverse'] = reverse if (not (keep_dump is None)): default_local_sync_path = keep_dump if (default_local_sync_path[(- 1)] != '/'): default_local_sync_path += '/' config['keep_dump'] = True output.message(output.Subject.INFO, '"Keep dump" option chosen', True)
def check_args_options(config_file=None, verbose=False, yes=False, mute=False, dry_run=False, import_file=None, dump_name=None, keep_dump=None, host_file=None, clear=False, force_password=False, use_rsync=False, use_rsync_options=None, reverse=False): '\n Checking arguments and fill options array\n :param config_file:\n :param verbose:\n :param yes:\n :param mute:\n :param dry_run:\n :param import_file:\n :param dump_name:\n :param keep_dump:\n :param host_file:\n :param clear:\n :param force_password:\n :param use_rsync:\n :param use_rsync_options:\n :param reverse:\n :return:\n ' global config global default_local_sync_path if (not (config_file is None)): config['config_file_path'] = config_file if (not (verbose is None)): config['verbose'] = verbose if (not (yes is None)): config['yes'] = yes if (not (mute is None)): config['mute'] = mute if (not (dry_run is None)): config['dry_run'] = dry_run if dry_run: output.message(output.Subject.INFO, 'Test mode: DRY RUN', True) if (not (import_file is None)): config['import'] = import_file if (not (dump_name is None)): config['dump_name'] = dump_name if (not (host_file is None)): config['link_hosts'] = host_file if (not (clear is None)): config['clear_database'] = clear if (not (force_password is None)): config['force_password'] = force_password if (not (use_rsync is None)): config['use_rsync'] = use_rsync if (use_rsync is True): helper.check_rsync_version() helper.check_sshpass_version() if (not (use_rsync_options is None)): config['use_rsync_options'] = use_rsync_options if (not (reverse is None)): config['reverse'] = reverse if (not (keep_dump is None)): default_local_sync_path = keep_dump if (default_local_sync_path[(- 1)] != '/'): default_local_sync_path += '/' config['keep_dump'] = True output.message(output.Subject.INFO, '"Keep dump" option chosen', True)<|docstring|>Checking arguments and fill options array :param config_file: :param verbose: :param yes: :param mute: :param dry_run: :param import_file: :param dump_name: :param keep_dump: :param host_file: :param clear: :param force_password: :param use_rsync: :param use_rsync_options: :param reverse: :return:<|endoftext|>
63324792007507240c12b884df380a3129b1eb51fcbdb6d702ff3f335fe5d80d
def reverse_hosts(): '\n Checking authorization for clients\n :return:\n ' if config['reverse']: _origin = config[mode.Client.ORIGIN] _target = config[mode.Client.TARGET] config[mode.Client.ORIGIN] = _target config[mode.Client.TARGET] = _origin output.message(output.Subject.INFO, 'Reverse origin and target hosts', True)
Checking authorization for clients :return:
db_sync_tool/utility/system.py
reverse_hosts
jackd248/t3-db-sync
3
python
def reverse_hosts(): '\n Checking authorization for clients\n :return:\n ' if config['reverse']: _origin = config[mode.Client.ORIGIN] _target = config[mode.Client.TARGET] config[mode.Client.ORIGIN] = _target config[mode.Client.TARGET] = _origin output.message(output.Subject.INFO, 'Reverse origin and target hosts', True)
def reverse_hosts(): '\n Checking authorization for clients\n :return:\n ' if config['reverse']: _origin = config[mode.Client.ORIGIN] _target = config[mode.Client.TARGET] config[mode.Client.ORIGIN] = _target config[mode.Client.TARGET] = _origin output.message(output.Subject.INFO, 'Reverse origin and target hosts', True)<|docstring|>Checking authorization for clients :return:<|endoftext|>
c292770623712b0c286237978bb7c8d3dc0ec0d9a42b07d579ae876f4beca627
def link_configuration_with_hosts(): '\n Merging the hosts definition with the given configuration file\n @ToDo Simplify function\n :return:\n ' if ((('link' in config[mode.Client.ORIGIN]) or ('link' in config[mode.Client.TARGET])) and (config['link_hosts'] == '')): _host = (str(config[mode.Client.ORIGIN]['link'].split('@')[0]) if ('link' in config[mode.Client.ORIGIN]) else '') _host = (str(config[mode.Client.TARGET]['link'].split('@')[0]) if ('link' in config[mode.Client.TARGET]) else _host) config['link_hosts'] = _host if (config['link_hosts'] == ''): sys.exit(output.message(output.Subject.ERROR, f'Missing hosts file for linking hosts with configuration. Use the "-o" / "--hosts" argument to define the filepath for the hosts file, when using a link parameter within the configuration or define the the filepath direct in the link entry e.g. "host.yaml@entry1".', False)) if (config['link_hosts'] != ''): if (config['link_hosts'][0] != '/'): config['link_hosts'] = ((os.path.dirname(os.path.abspath(config['config_file_path'])) + '/') + config['link_hosts']) if os.path.isfile(config['link_hosts']): with open(config['link_hosts'], 'r') as read_file: if config['link_hosts'].endswith('.json'): _hosts = json.load(read_file) elif (config['link_hosts'].endswith('.yaml') or config['link_hosts'].endswith('.yml')): _hosts = yaml.safe_load(read_file) output.message(output.Subject.INFO, f"Linking configuration with hosts {output.CliFormat.BLACK}{config['link_hosts']}{output.CliFormat.ENDC}", True) if (not (config['config_file_path'] is None)): if ('link' in config[mode.Client.ORIGIN]): _host_name = str(config[mode.Client.ORIGIN]['link']).split('@')[1] if (_host_name in _hosts): config[mode.Client.ORIGIN] = {**config[mode.Client.ORIGIN], **_hosts[_host_name]} if ('link' in config[mode.Client.TARGET]): _host_name = str(config[mode.Client.TARGET]['link']).split('@')[1] if (_host_name in _hosts): config[mode.Client.TARGET] = {**config[mode.Client.TARGET], **_hosts[_host_name]} elif (('link_target' in config) and ('link_origin' in config)): if ((config['link_target'] in _hosts) and (config['link_origin'] in _hosts)): config[mode.Client.TARGET] = _hosts[config['link_target']] config[mode.Client.ORIGIN] = _hosts[config['link_origin']] else: sys.exit(output.message(output.Subject.ERROR, f"Misconfiguration of link hosts {config['link_origin']}, {config['link_target']} in {config['link_hosts']}", False)) else: sys.exit(output.message(output.Subject.ERROR, f"Missing link hosts for {config['link_hosts']}", False)) else: sys.exit(output.message(output.Subject.ERROR, f"Local host file not found: {config['link_hosts']}", False))
Merging the hosts definition with the given configuration file @ToDo Simplify function :return:
db_sync_tool/utility/system.py
link_configuration_with_hosts
jackd248/t3-db-sync
3
python
def link_configuration_with_hosts(): '\n Merging the hosts definition with the given configuration file\n @ToDo Simplify function\n :return:\n ' if ((('link' in config[mode.Client.ORIGIN]) or ('link' in config[mode.Client.TARGET])) and (config['link_hosts'] == )): _host = (str(config[mode.Client.ORIGIN]['link'].split('@')[0]) if ('link' in config[mode.Client.ORIGIN]) else ) _host = (str(config[mode.Client.TARGET]['link'].split('@')[0]) if ('link' in config[mode.Client.TARGET]) else _host) config['link_hosts'] = _host if (config['link_hosts'] == ): sys.exit(output.message(output.Subject.ERROR, f'Missing hosts file for linking hosts with configuration. Use the "-o" / "--hosts" argument to define the filepath for the hosts file, when using a link parameter within the configuration or define the the filepath direct in the link entry e.g. "host.yaml@entry1".', False)) if (config['link_hosts'] != ): if (config['link_hosts'][0] != '/'): config['link_hosts'] = ((os.path.dirname(os.path.abspath(config['config_file_path'])) + '/') + config['link_hosts']) if os.path.isfile(config['link_hosts']): with open(config['link_hosts'], 'r') as read_file: if config['link_hosts'].endswith('.json'): _hosts = json.load(read_file) elif (config['link_hosts'].endswith('.yaml') or config['link_hosts'].endswith('.yml')): _hosts = yaml.safe_load(read_file) output.message(output.Subject.INFO, f"Linking configuration with hosts {output.CliFormat.BLACK}{config['link_hosts']}{output.CliFormat.ENDC}", True) if (not (config['config_file_path'] is None)): if ('link' in config[mode.Client.ORIGIN]): _host_name = str(config[mode.Client.ORIGIN]['link']).split('@')[1] if (_host_name in _hosts): config[mode.Client.ORIGIN] = {**config[mode.Client.ORIGIN], **_hosts[_host_name]} if ('link' in config[mode.Client.TARGET]): _host_name = str(config[mode.Client.TARGET]['link']).split('@')[1] if (_host_name in _hosts): config[mode.Client.TARGET] = {**config[mode.Client.TARGET], **_hosts[_host_name]} elif (('link_target' in config) and ('link_origin' in config)): if ((config['link_target'] in _hosts) and (config['link_origin'] in _hosts)): config[mode.Client.TARGET] = _hosts[config['link_target']] config[mode.Client.ORIGIN] = _hosts[config['link_origin']] else: sys.exit(output.message(output.Subject.ERROR, f"Misconfiguration of link hosts {config['link_origin']}, {config['link_target']} in {config['link_hosts']}", False)) else: sys.exit(output.message(output.Subject.ERROR, f"Missing link hosts for {config['link_hosts']}", False)) else: sys.exit(output.message(output.Subject.ERROR, f"Local host file not found: {config['link_hosts']}", False))
def link_configuration_with_hosts(): '\n Merging the hosts definition with the given configuration file\n @ToDo Simplify function\n :return:\n ' if ((('link' in config[mode.Client.ORIGIN]) or ('link' in config[mode.Client.TARGET])) and (config['link_hosts'] == )): _host = (str(config[mode.Client.ORIGIN]['link'].split('@')[0]) if ('link' in config[mode.Client.ORIGIN]) else ) _host = (str(config[mode.Client.TARGET]['link'].split('@')[0]) if ('link' in config[mode.Client.TARGET]) else _host) config['link_hosts'] = _host if (config['link_hosts'] == ): sys.exit(output.message(output.Subject.ERROR, f'Missing hosts file for linking hosts with configuration. Use the "-o" / "--hosts" argument to define the filepath for the hosts file, when using a link parameter within the configuration or define the the filepath direct in the link entry e.g. "host.yaml@entry1".', False)) if (config['link_hosts'] != ): if (config['link_hosts'][0] != '/'): config['link_hosts'] = ((os.path.dirname(os.path.abspath(config['config_file_path'])) + '/') + config['link_hosts']) if os.path.isfile(config['link_hosts']): with open(config['link_hosts'], 'r') as read_file: if config['link_hosts'].endswith('.json'): _hosts = json.load(read_file) elif (config['link_hosts'].endswith('.yaml') or config['link_hosts'].endswith('.yml')): _hosts = yaml.safe_load(read_file) output.message(output.Subject.INFO, f"Linking configuration with hosts {output.CliFormat.BLACK}{config['link_hosts']}{output.CliFormat.ENDC}", True) if (not (config['config_file_path'] is None)): if ('link' in config[mode.Client.ORIGIN]): _host_name = str(config[mode.Client.ORIGIN]['link']).split('@')[1] if (_host_name in _hosts): config[mode.Client.ORIGIN] = {**config[mode.Client.ORIGIN], **_hosts[_host_name]} if ('link' in config[mode.Client.TARGET]): _host_name = str(config[mode.Client.TARGET]['link']).split('@')[1] if (_host_name in _hosts): config[mode.Client.TARGET] = {**config[mode.Client.TARGET], **_hosts[_host_name]} elif (('link_target' in config) and ('link_origin' in config)): if ((config['link_target'] in _hosts) and (config['link_origin'] in _hosts)): config[mode.Client.TARGET] = _hosts[config['link_target']] config[mode.Client.ORIGIN] = _hosts[config['link_origin']] else: sys.exit(output.message(output.Subject.ERROR, f"Misconfiguration of link hosts {config['link_origin']}, {config['link_target']} in {config['link_hosts']}", False)) else: sys.exit(output.message(output.Subject.ERROR, f"Missing link hosts for {config['link_hosts']}", False)) else: sys.exit(output.message(output.Subject.ERROR, f"Local host file not found: {config['link_hosts']}", False))<|docstring|>Merging the hosts definition with the given configuration file @ToDo Simplify function :return:<|endoftext|>
498ea4e099a25a3da302868fc7aa5eeb225fa30c48f2878e3d1f9a814e9848cc
def _validate_query(query: dict) -> dict: 'Validate a query dictionary.' if (not isinstance(query, dict)): raise TypeError('Query must me a dictionary.') return query
Validate a query dictionary.
scivision/catalog/catalog.py
_validate_query
Alex-Gregory-1/scivision
0
python
def _validate_query(query: dict) -> dict: if (not isinstance(query, dict)): raise TypeError('Query must me a dictionary.') return query
def _validate_query(query: dict) -> dict: if (not isinstance(query, dict)): raise TypeError('Query must me a dictionary.') return query<|docstring|>Validate a query dictionary.<|endoftext|>
2486ca91a8fc68deef54a7fb8cd0a5e614f2617bf4bd5584a209325223baac7d
@koala def query(query: Dict[(str, str)]) -> list: 'Search the catalog using the query.\n\n Parameters\n ----------\n query : dict\n A dictionary describing the search query as key value pairs.\n\n Returns\n -------\n result : list\n A list of catalog entries matching the search requirements.\n ' result = _catalog.query(query) return result
Search the catalog using the query. Parameters ---------- query : dict A dictionary describing the search query as key value pairs. Returns ------- result : list A list of catalog entries matching the search requirements.
scivision/catalog/catalog.py
query
Alex-Gregory-1/scivision
0
python
@koala def query(query: Dict[(str, str)]) -> list: 'Search the catalog using the query.\n\n Parameters\n ----------\n query : dict\n A dictionary describing the search query as key value pairs.\n\n Returns\n -------\n result : list\n A list of catalog entries matching the search requirements.\n ' result = _catalog.query(query) return result
@koala def query(query: Dict[(str, str)]) -> list: 'Search the catalog using the query.\n\n Parameters\n ----------\n query : dict\n A dictionary describing the search query as key value pairs.\n\n Returns\n -------\n result : list\n A list of catalog entries matching the search requirements.\n ' result = _catalog.query(query) return result<|docstring|>Search the catalog using the query. Parameters ---------- query : dict A dictionary describing the search query as key value pairs. Returns ------- result : list A list of catalog entries matching the search requirements.<|endoftext|>
f8db951ed835964f89b6bc01f7155662608012dbf53497afb4ac9a89e8065edb
def _query(self, query: Dict[(str, str)]) -> list: 'Query the Pandas dataframe.' queries = [f"{k} == '{v}'" for (k, v) in query.items()] query_str = ' & '.join(queries) result = self._database.query(query_str) return result.to_dict('records')
Query the Pandas dataframe.
scivision/catalog/catalog.py
_query
Alex-Gregory-1/scivision
0
python
def _query(self, query: Dict[(str, str)]) -> list: queries = [f"{k} == '{v}'" for (k, v) in query.items()] query_str = ' & '.join(queries) result = self._database.query(query_str) return result.to_dict('records')
def _query(self, query: Dict[(str, str)]) -> list: queries = [f"{k} == '{v}'" for (k, v) in query.items()] query_str = ' & '.join(queries) result = self._database.query(query_str) return result.to_dict('records')<|docstring|>Query the Pandas dataframe.<|endoftext|>
d2ea73f085733ebe0d10da29121ebee91d88fe4caae38f980c1e966f119d8195
@property def keys(self) -> List[str]: 'Return the query keys.' return self._database.columns.tolist()
Return the query keys.
scivision/catalog/catalog.py
keys
Alex-Gregory-1/scivision
0
python
@property def keys(self) -> List[str]: return self._database.columns.tolist()
@property def keys(self) -> List[str]: return self._database.columns.tolist()<|docstring|>Return the query keys.<|endoftext|>
62c626f2c09df01a990cc6b609e78b6e8cdd6bbcbaaed08b99d8d588e880b84d
def values(self, key: str) -> List[str]: 'Return the unique values for a query key.' if (key not in self.keys): raise ValueError(f'Key {key} not found.') values = self._database[key].tolist() return list(set(values))
Return the unique values for a query key.
scivision/catalog/catalog.py
values
Alex-Gregory-1/scivision
0
python
def values(self, key: str) -> List[str]: if (key not in self.keys): raise ValueError(f'Key {key} not found.') values = self._database[key].tolist() return list(set(values))
def values(self, key: str) -> List[str]: if (key not in self.keys): raise ValueError(f'Key {key} not found.') values = self._database[key].tolist() return list(set(values))<|docstring|>Return the unique values for a query key.<|endoftext|>
a70ad9203502a9742b7556feb0ca75d35a73a608722c33d7ab97666a09494ba7
def _write_to_device(self, command, value): 'Write command and data value to the device.' with self._device: self._device.write(bytes([(command & 255), (value & 255)]))
Write command and data value to the device.
code/cedargrove_ad5245.py
_write_to_device
CedarGroveStudios/AD9833_ADSR_FeatherWing
1
python
def _write_to_device(self, command, value): with self._device: self._device.write(bytes([(command & 255), (value & 255)]))
def _write_to_device(self, command, value): with self._device: self._device.write(bytes([(command & 255), (value & 255)]))<|docstring|>Write command and data value to the device.<|endoftext|>
8e7773a39329a866324bf7d2717f059612754cadab4636821a81a5e3dc85a486
def _read_from_device(self): 'Reads the contents of the data register.' with self._device: self._device.readinto(self._BUFFER) return self._BUFFER
Reads the contents of the data register.
code/cedargrove_ad5245.py
_read_from_device
CedarGroveStudios/AD9833_ADSR_FeatherWing
1
python
def _read_from_device(self): with self._device: self._device.readinto(self._BUFFER) return self._BUFFER
def _read_from_device(self): with self._device: self._device.readinto(self._BUFFER) return self._BUFFER<|docstring|>Reads the contents of the data register.<|endoftext|>
952f2e29c0afd54facb83263bab0d235a2ab0173a86af3328808c2959962559e
@property def wiper(self): "The raw value of the potentionmeter's wiper.\n :param wiper_value: The raw wiper value from 0 to 255.\n " return self._wiper
The raw value of the potentionmeter's wiper. :param wiper_value: The raw wiper value from 0 to 255.
code/cedargrove_ad5245.py
wiper
CedarGroveStudios/AD9833_ADSR_FeatherWing
1
python
@property def wiper(self): "The raw value of the potentionmeter's wiper.\n :param wiper_value: The raw wiper value from 0 to 255.\n " return self._wiper
@property def wiper(self): "The raw value of the potentionmeter's wiper.\n :param wiper_value: The raw wiper value from 0 to 255.\n " return self._wiper<|docstring|>The raw value of the potentionmeter's wiper. :param wiper_value: The raw wiper value from 0 to 255.<|endoftext|>
4fad6cb9d1551a95e5c255599d11d6601c992a77be661e45f444b69075a72041
@property def normalized_wiper(self): "The normalized value of the potentionmeter's wiper.\n :param normalized_wiper_value: The normalized wiper value from 0.0 to 1.0.\n " return self._normalized_wiper
The normalized value of the potentionmeter's wiper. :param normalized_wiper_value: The normalized wiper value from 0.0 to 1.0.
code/cedargrove_ad5245.py
normalized_wiper
CedarGroveStudios/AD9833_ADSR_FeatherWing
1
python
@property def normalized_wiper(self): "The normalized value of the potentionmeter's wiper.\n :param normalized_wiper_value: The normalized wiper value from 0.0 to 1.0.\n " return self._normalized_wiper
@property def normalized_wiper(self): "The normalized value of the potentionmeter's wiper.\n :param normalized_wiper_value: The normalized wiper value from 0.0 to 1.0.\n " return self._normalized_wiper<|docstring|>The normalized value of the potentionmeter's wiper. :param normalized_wiper_value: The normalized wiper value from 0.0 to 1.0.<|endoftext|>
67f01f0aedd2dd7dc5bdfae891d360125ea4a296d3af64d31d966d8eaaec6172
@property def default_wiper(self): "The default value of the potentionmeter's wiper.\n :param wiper_value: The raw wiper value from 0 to 255.\n " return self._default_wiper
The default value of the potentionmeter's wiper. :param wiper_value: The raw wiper value from 0 to 255.
code/cedargrove_ad5245.py
default_wiper
CedarGroveStudios/AD9833_ADSR_FeatherWing
1
python
@property def default_wiper(self): "The default value of the potentionmeter's wiper.\n :param wiper_value: The raw wiper value from 0 to 255.\n " return self._default_wiper
@property def default_wiper(self): "The default value of the potentionmeter's wiper.\n :param wiper_value: The raw wiper value from 0 to 255.\n " return self._default_wiper<|docstring|>The default value of the potentionmeter's wiper. :param wiper_value: The raw wiper value from 0 to 255.<|endoftext|>
b228552e8719e4604c03b0c08b62c911f2889c24bf58c7cb2219dc2f9e1d4b9e
def set_default(self, default): "A dummy helper to maintain UI compatibility digital\n potentiometers with EEROM capability (dS3502). The AD5245's\n wiper value will be set to 0 unless the default value is\n set explicitly during or after class instantiation." self._default_wiper = default
A dummy helper to maintain UI compatibility digital potentiometers with EEROM capability (dS3502). The AD5245's wiper value will be set to 0 unless the default value is set explicitly during or after class instantiation.
code/cedargrove_ad5245.py
set_default
CedarGroveStudios/AD9833_ADSR_FeatherWing
1
python
def set_default(self, default): "A dummy helper to maintain UI compatibility digital\n potentiometers with EEROM capability (dS3502). The AD5245's\n wiper value will be set to 0 unless the default value is\n set explicitly during or after class instantiation." self._default_wiper = default
def set_default(self, default): "A dummy helper to maintain UI compatibility digital\n potentiometers with EEROM capability (dS3502). The AD5245's\n wiper value will be set to 0 unless the default value is\n set explicitly during or after class instantiation." self._default_wiper = default<|docstring|>A dummy helper to maintain UI compatibility digital potentiometers with EEROM capability (dS3502). The AD5245's wiper value will be set to 0 unless the default value is set explicitly during or after class instantiation.<|endoftext|>
c9547b2bbb840d8577e924101d092a9caafeae6e3c45e8f0616db62602a40e45
def shutdown(self): 'Connects the W to the B terminal and open circuits the A terminal.\n The contents of the wiper register are not changed.' self._write_to_device(32, 0)
Connects the W to the B terminal and open circuits the A terminal. The contents of the wiper register are not changed.
code/cedargrove_ad5245.py
shutdown
CedarGroveStudios/AD9833_ADSR_FeatherWing
1
python
def shutdown(self): 'Connects the W to the B terminal and open circuits the A terminal.\n The contents of the wiper register are not changed.' self._write_to_device(32, 0)
def shutdown(self): 'Connects the W to the B terminal and open circuits the A terminal.\n The contents of the wiper register are not changed.' self._write_to_device(32, 0)<|docstring|>Connects the W to the B terminal and open circuits the A terminal. The contents of the wiper register are not changed.<|endoftext|>
31434209e593ea995c3437d175ff4d3727d84f276963867ccb596b0dc3d7bf5f
def on_tick() -> None: '\n OnTick callback.\n ' global demo_window demo_window.handle_messages()
OnTick callback.
examples/ui_demo.py
on_tick
X-EcutiOnner/Bourgeon
20
python
def on_tick() -> None: '\n \n ' global demo_window demo_window.handle_messages()
def on_tick() -> None: '\n \n ' global demo_window demo_window.handle_messages()<|docstring|>OnTick callback.<|endoftext|>
053629f0e38b4243bd208af9118d54bc08dca65677c7b9e0cf790802013183ad
def chunks(l, n=25): 'Yield successive n-sized chunks from l.' for i in range(0, len(l), n): (yield l[i:(i + n)])
Yield successive n-sized chunks from l.
ryan/util.py
chunks
ryanlee/project
0
python
def chunks(l, n=25): for i in range(0, len(l), n): (yield l[i:(i + n)])
def chunks(l, n=25): for i in range(0, len(l), n): (yield l[i:(i + n)])<|docstring|>Yield successive n-sized chunks from l.<|endoftext|>
a2c56b7ddb06f9d3445f2059c907d86398a8bf1b50edc5f3d6cb2c812de2714b
def deflatten(self, flat_sch) -> Schedule: ' <ndarray(c*5,)> -> Sch ' return flat_sch.reshape(len(self.schedule_param.sections), 5)
<ndarray(c*5,)> -> Sch
core/models/ScheduleOperator.py
deflatten
AluBhorta/UCSPy-Engine
6
python
def deflatten(self, flat_sch) -> Schedule: ' ' return flat_sch.reshape(len(self.schedule_param.sections), 5)
def deflatten(self, flat_sch) -> Schedule: ' ' return flat_sch.reshape(len(self.schedule_param.sections), 5)<|docstring|><ndarray(c*5,)> -> Sch<|endoftext|>
72db7c3ba4fbb7416da2b8b11cef0c1c15a0da076512020175643b4feace6579
def numrepr_to_sch(self, numrepr) -> Schedule: ' <ndarray(n,5)> -> <Sch> ' return Schedule(classes=[Class(Section(self.schedule_param.get_course(i[0]), i[1]), self.schedule_param.get_instructor(i[2]), self.schedule_param.get_room(i[3]), self.schedule_param.get_timeslot(i[4])) for i in numrepr])
<ndarray(n,5)> -> <Sch>
core/models/ScheduleOperator.py
numrepr_to_sch
AluBhorta/UCSPy-Engine
6
python
def numrepr_to_sch(self, numrepr) -> Schedule: ' ' return Schedule(classes=[Class(Section(self.schedule_param.get_course(i[0]), i[1]), self.schedule_param.get_instructor(i[2]), self.schedule_param.get_room(i[3]), self.schedule_param.get_timeslot(i[4])) for i in numrepr])
def numrepr_to_sch(self, numrepr) -> Schedule: ' ' return Schedule(classes=[Class(Section(self.schedule_param.get_course(i[0]), i[1]), self.schedule_param.get_instructor(i[2]), self.schedule_param.get_room(i[3]), self.schedule_param.get_timeslot(i[4])) for i in numrepr])<|docstring|><ndarray(n,5)> -> <Sch><|endoftext|>
785309c5a65a3ae2cc60bcf4c84339f441e3941a0b659f7ee66db3724df58d3e
@abstractmethod def _build_db(self): 'Build the necessary DB elements'
Build the necessary DB elements
covid19/pgconnectors/pgconnector.py
_build_db
clambin/covid19mon
0
python
@abstractmethod def _build_db(self):
@abstractmethod def _build_db(self): <|docstring|>Build the necessary DB elements<|endoftext|>
c151a375626a138d708d52d5278297ac05bdaec743f5c8d85159f309c3567a21
@abstractmethod def _drop_db(self): 'Remove the necessary DB elements'
Remove the necessary DB elements
covid19/pgconnectors/pgconnector.py
_drop_db
clambin/covid19mon
0
python
@abstractmethod def _drop_db(self):
@abstractmethod def _drop_db(self): <|docstring|>Remove the necessary DB elements<|endoftext|>
10c3ed375d971a706cfae3218a0e8bf2f0fe85765b19aab92c654c58c242dbd3
@pytest.mark.usefixtures('f2003_create') def test_zero_size_array_constructor(): ' Test that we can parse a valid, zero-size array constructor. ' fcode = 'integer ::' ast = Fortran2003.Ac_Spec(fcode) assert isinstance(ast, Fortran2003.Ac_Spec) assert isinstance(ast.children[0], Fortran2003.Intrinsic_Type_Spec)
Test that we can parse a valid, zero-size array constructor.
src/fparser/two/tests/fortran2003/test_array_constructor_spec_r466.py
test_zero_size_array_constructor
reuterbal/fparser
33
python
@pytest.mark.usefixtures('f2003_create') def test_zero_size_array_constructor(): ' ' fcode = 'integer ::' ast = Fortran2003.Ac_Spec(fcode) assert isinstance(ast, Fortran2003.Ac_Spec) assert isinstance(ast.children[0], Fortran2003.Intrinsic_Type_Spec)
@pytest.mark.usefixtures('f2003_create') def test_zero_size_array_constructor(): ' ' fcode = 'integer ::' ast = Fortran2003.Ac_Spec(fcode) assert isinstance(ast, Fortran2003.Ac_Spec) assert isinstance(ast.children[0], Fortran2003.Intrinsic_Type_Spec)<|docstring|>Test that we can parse a valid, zero-size array constructor.<|endoftext|>
e447663ab753096168df21202aadeeb2c757f0b65e237d946f27ef6c4e2142f6
def test_int_literals_array_constructor(): ' Test when a simple list of integer literals is provided as the\n content of the constructor. ' fcode = '1, 2, 3' ast = Fortran2003.Ac_Spec(fcode) assert isinstance(ast, Fortran2003.Ac_Value_List)
Test when a simple list of integer literals is provided as the content of the constructor.
src/fparser/two/tests/fortran2003/test_array_constructor_spec_r466.py
test_int_literals_array_constructor
reuterbal/fparser
33
python
def test_int_literals_array_constructor(): ' Test when a simple list of integer literals is provided as the\n content of the constructor. ' fcode = '1, 2, 3' ast = Fortran2003.Ac_Spec(fcode) assert isinstance(ast, Fortran2003.Ac_Value_List)
def test_int_literals_array_constructor(): ' Test when a simple list of integer literals is provided as the\n content of the constructor. ' fcode = '1, 2, 3' ast = Fortran2003.Ac_Spec(fcode) assert isinstance(ast, Fortran2003.Ac_Value_List)<|docstring|>Test when a simple list of integer literals is provided as the content of the constructor.<|endoftext|>
b5de4de8447a343af8a924ff9e8f07d84438ce959392aaafd44fe66618c053af
def test_expr_list_array_constructor(): ' Test when the provided content consists of expressions. ' fcode = 'ACOS(-1.0), SIN(1.0), 1.0+3.0' ast = Fortran2003.Ac_Spec(fcode) assert isinstance(ast, Fortran2003.Ac_Value_List)
Test when the provided content consists of expressions.
src/fparser/two/tests/fortran2003/test_array_constructor_spec_r466.py
test_expr_list_array_constructor
reuterbal/fparser
33
python
def test_expr_list_array_constructor(): ' ' fcode = 'ACOS(-1.0), SIN(1.0), 1.0+3.0' ast = Fortran2003.Ac_Spec(fcode) assert isinstance(ast, Fortran2003.Ac_Value_List)
def test_expr_list_array_constructor(): ' ' fcode = 'ACOS(-1.0), SIN(1.0), 1.0+3.0' ast = Fortran2003.Ac_Spec(fcode) assert isinstance(ast, Fortran2003.Ac_Value_List)<|docstring|>Test when the provided content consists of expressions.<|endoftext|>
45f524a70fb5567e1f22351aa47761836a7d81012bb01e8a447d5fd7987ab0a1
@pytest.mark.usefixtures('f2003_create') def test_array_spec_char_len(): ' Test with a specifier that specifies a length type parameter. ' fcode = "CHARACTER(LEN=7) :: 'Takata', 'Tanaka', 'Hayashi'" ast = Fortran2003.Ac_Spec(fcode) assert isinstance(ast, Fortran2003.Ac_Spec) assert isinstance(ast.children[0], Fortran2003.Intrinsic_Type_Spec) assert ("CHARACTER(LEN = 7) :: 'Takata', 'Tanaka', 'Hayashi'" in str(ast))
Test with a specifier that specifies a length type parameter.
src/fparser/two/tests/fortran2003/test_array_constructor_spec_r466.py
test_array_spec_char_len
reuterbal/fparser
33
python
@pytest.mark.usefixtures('f2003_create') def test_array_spec_char_len(): ' ' fcode = "CHARACTER(LEN=7) :: 'Takata', 'Tanaka', 'Hayashi'" ast = Fortran2003.Ac_Spec(fcode) assert isinstance(ast, Fortran2003.Ac_Spec) assert isinstance(ast.children[0], Fortran2003.Intrinsic_Type_Spec) assert ("CHARACTER(LEN = 7) :: 'Takata', 'Tanaka', 'Hayashi'" in str(ast))
@pytest.mark.usefixtures('f2003_create') def test_array_spec_char_len(): ' ' fcode = "CHARACTER(LEN=7) :: 'Takata', 'Tanaka', 'Hayashi'" ast = Fortran2003.Ac_Spec(fcode) assert isinstance(ast, Fortran2003.Ac_Spec) assert isinstance(ast.children[0], Fortran2003.Intrinsic_Type_Spec) assert ("CHARACTER(LEN = 7) :: 'Takata', 'Tanaka', 'Hayashi'" in str(ast))<|docstring|>Test with a specifier that specifies a length type parameter.<|endoftext|>
44e626b01332b3e6d7e298494e6d083890f3e97adf6b449948da756c0aafe367
@pytest.mark.usefixtures('f2003_create') def test_array_spec_no_match(): ' Check that incorrect content is not matched. ' fcode = 'call hello()' with pytest.raises(NoMatchError): Fortran2003.Ac_Spec(fcode)
Check that incorrect content is not matched.
src/fparser/two/tests/fortran2003/test_array_constructor_spec_r466.py
test_array_spec_no_match
reuterbal/fparser
33
python
@pytest.mark.usefixtures('f2003_create') def test_array_spec_no_match(): ' ' fcode = 'call hello()' with pytest.raises(NoMatchError): Fortran2003.Ac_Spec(fcode)
@pytest.mark.usefixtures('f2003_create') def test_array_spec_no_match(): ' ' fcode = 'call hello()' with pytest.raises(NoMatchError): Fortran2003.Ac_Spec(fcode)<|docstring|>Check that incorrect content is not matched.<|endoftext|>
2eea20f3e08cad18fd63e532eedb612b3fc267b7eb5c3bfb36da8a89d796aa1b
def get(self): 'Get all users' response_object = {'status': 'success', 'data': {'users': [user.to_json() for user in User.query.all()]}} return (response_object, 200)
Get all users
services/users/project/api/users.py
get
Kayt/ClosingBrace-Microservices
0
python
def get(self): response_object = {'status': 'success', 'data': {'users': [user.to_json() for user in User.query.all()]}} return (response_object, 200)
def get(self): response_object = {'status': 'success', 'data': {'users': [user.to_json() for user in User.query.all()]}} return (response_object, 200)<|docstring|>Get all users<|endoftext|>
68ac82c352cc90468b6f179cb7b1bbf9ef0150f65364051089c5109033b46ba9
def get(self, user_id): 'Get single user details' response_object = {'status': 'fail', 'message': 'User does not exist'} try: user = User.query.filter_by(id=int(user_id)).first() if (not user): return (response_object, 404) else: response_object = {'status': 'success', 'data': {'id': user.id, 'username': user.username, 'email': user.email, 'active': user.active}} return (response_object, 200) except ValueError: return (response_object, 404)
Get single user details
services/users/project/api/users.py
get
Kayt/ClosingBrace-Microservices
0
python
def get(self, user_id): response_object = {'status': 'fail', 'message': 'User does not exist'} try: user = User.query.filter_by(id=int(user_id)).first() if (not user): return (response_object, 404) else: response_object = {'status': 'success', 'data': {'id': user.id, 'username': user.username, 'email': user.email, 'active': user.active}} return (response_object, 200) except ValueError: return (response_object, 404)
def get(self, user_id): response_object = {'status': 'fail', 'message': 'User does not exist'} try: user = User.query.filter_by(id=int(user_id)).first() if (not user): return (response_object, 404) else: response_object = {'status': 'success', 'data': {'id': user.id, 'username': user.username, 'email': user.email, 'active': user.active}} return (response_object, 200) except ValueError: return (response_object, 404)<|docstring|>Get single user details<|endoftext|>
dd20128b1cdb9b9e27591b40165f17f6bb9edc189423ecc66b475d80c4dce3a6
def login(request, template_name='registration/login.html', redirect_field_name=REDIRECT_FIELD_NAME): 'Displays the login form and handles the login action.' redirect_to = request.REQUEST.get(redirect_field_name, '') if (request.method == 'POST'): form = AuthenticationForm(data=request.POST) if form.is_valid(): if ((not redirect_to) or ('//' in redirect_to) or (' ' in redirect_to)): redirect_to = settings.LOGIN_REDIRECT_URL from django.contrib.auth import login login(request, form.get_user()) if request.session.test_cookie_worked(): request.session.delete_test_cookie() return HttpResponseRedirect(redirect_to) else: form = AuthenticationForm(request) request.session.set_test_cookie() if Site._meta.installed: current_site = Site.objects.get_current() else: current_site = RequestSite(request) return render_to_response(template_name, {'form': form, 'reg_form': RegistrationForm(), redirect_field_name: redirect_to, 'site_name': current_site.name}, context_instance=RequestContext(request))
Displays the login form and handles the login action.
wbcms/utils/views.py
login
westurner/wbcms
0
python
def login(request, template_name='registration/login.html', redirect_field_name=REDIRECT_FIELD_NAME): redirect_to = request.REQUEST.get(redirect_field_name, ) if (request.method == 'POST'): form = AuthenticationForm(data=request.POST) if form.is_valid(): if ((not redirect_to) or ('//' in redirect_to) or (' ' in redirect_to)): redirect_to = settings.LOGIN_REDIRECT_URL from django.contrib.auth import login login(request, form.get_user()) if request.session.test_cookie_worked(): request.session.delete_test_cookie() return HttpResponseRedirect(redirect_to) else: form = AuthenticationForm(request) request.session.set_test_cookie() if Site._meta.installed: current_site = Site.objects.get_current() else: current_site = RequestSite(request) return render_to_response(template_name, {'form': form, 'reg_form': RegistrationForm(), redirect_field_name: redirect_to, 'site_name': current_site.name}, context_instance=RequestContext(request))
def login(request, template_name='registration/login.html', redirect_field_name=REDIRECT_FIELD_NAME): redirect_to = request.REQUEST.get(redirect_field_name, ) if (request.method == 'POST'): form = AuthenticationForm(data=request.POST) if form.is_valid(): if ((not redirect_to) or ('//' in redirect_to) or (' ' in redirect_to)): redirect_to = settings.LOGIN_REDIRECT_URL from django.contrib.auth import login login(request, form.get_user()) if request.session.test_cookie_worked(): request.session.delete_test_cookie() return HttpResponseRedirect(redirect_to) else: form = AuthenticationForm(request) request.session.set_test_cookie() if Site._meta.installed: current_site = Site.objects.get_current() else: current_site = RequestSite(request) return render_to_response(template_name, {'form': form, 'reg_form': RegistrationForm(), redirect_field_name: redirect_to, 'site_name': current_site.name}, context_instance=RequestContext(request))<|docstring|>Displays the login form and handles the login action.<|endoftext|>
5ee074b85cb7b9028ac28f2c5c03764a6fef618f2e0c5202e46eabfe10c07eeb
def init_pretrained_weights(model, model_url): "Initializes model with pretrained weights.\n\n Layers that don't match with pretrained layers in name or size are kept unchanged.\n " pretrain_dict = model_zoo.load_url(model_url) model_dict = model.state_dict() pretrain_dict = {k: v for (k, v) in pretrain_dict.items() if ((k in model_dict) and (model_dict[k].size() == v.size()))} model_dict.update(pretrain_dict) model.load_state_dict(model_dict) print('Initialized model with pretrained weights from {}'.format(model_url))
Initializes model with pretrained weights. Layers that don't match with pretrained layers in name or size are kept unchanged.
torchreid/models/resnet_ibn_a_hgnn.py
init_pretrained_weights
lujiaxuan0520/NAIC-ReID-2020-contest
1
python
def init_pretrained_weights(model, model_url): "Initializes model with pretrained weights.\n\n Layers that don't match with pretrained layers in name or size are kept unchanged.\n " pretrain_dict = model_zoo.load_url(model_url) model_dict = model.state_dict() pretrain_dict = {k: v for (k, v) in pretrain_dict.items() if ((k in model_dict) and (model_dict[k].size() == v.size()))} model_dict.update(pretrain_dict) model.load_state_dict(model_dict) print('Initialized model with pretrained weights from {}'.format(model_url))
def init_pretrained_weights(model, model_url): "Initializes model with pretrained weights.\n\n Layers that don't match with pretrained layers in name or size are kept unchanged.\n " pretrain_dict = model_zoo.load_url(model_url) model_dict = model.state_dict() pretrain_dict = {k: v for (k, v) in pretrain_dict.items() if ((k in model_dict) and (model_dict[k].size() == v.size()))} model_dict.update(pretrain_dict) model.load_state_dict(model_dict) print('Initialized model with pretrained weights from {}'.format(model_url))<|docstring|>Initializes model with pretrained weights. Layers that don't match with pretrained layers in name or size are kept unchanged.<|endoftext|>
f14d8313d41f9c884ca82ed70c82a1f606dd340d93de1764f623131ee65e89b5
def resnet50_ibn_a(last_stride, pretrained=False, **kwargs): 'Constructs a ResNet-50 model.\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n ' model = ResNet_IBN(last_stride, Bottleneck_IBN, [3, 4, 6, 3], **kwargs) if pretrained: model.load_state_dict(model_zoo.load_url(model_urls['resnet50'])) return model
Constructs a ResNet-50 model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet
torchreid/models/resnet_ibn_a_hgnn.py
resnet50_ibn_a
lujiaxuan0520/NAIC-ReID-2020-contest
1
python
def resnet50_ibn_a(last_stride, pretrained=False, **kwargs): 'Constructs a ResNet-50 model.\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n ' model = ResNet_IBN(last_stride, Bottleneck_IBN, [3, 4, 6, 3], **kwargs) if pretrained: model.load_state_dict(model_zoo.load_url(model_urls['resnet50'])) return model
def resnet50_ibn_a(last_stride, pretrained=False, **kwargs): 'Constructs a ResNet-50 model.\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n ' model = ResNet_IBN(last_stride, Bottleneck_IBN, [3, 4, 6, 3], **kwargs) if pretrained: model.load_state_dict(model_zoo.load_url(model_urls['resnet50'])) return model<|docstring|>Constructs a ResNet-50 model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet<|endoftext|>
7bfa471273ede2e5c404110251ae444b32d34dfe9d317da76e3e29ca7a62d8f4
def resnet101_ibn_a(num_classes, isFinal=False, global_branch=False, pretrained=False, **kwargs): 'Constructs a ResNet-101 model.\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n ' model = ResNet_IBN_HGNN(num_classes=num_classes, block=Bottleneck_IBN, layers=[3, 4, 23, 3], last_stride=1, num_split=8, pyramid_part=True, num_gb=2, use_pose=False, learn_graph=True, consistent_loss=False, m_prob=1.0, K_neigs=[3], is_probH=True, dropout=0.5, learn_attention=False, isFinal=isFinal, global_branch=global_branch, **kwargs) return model
Constructs a ResNet-101 model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet
torchreid/models/resnet_ibn_a_hgnn.py
resnet101_ibn_a
lujiaxuan0520/NAIC-ReID-2020-contest
1
python
def resnet101_ibn_a(num_classes, isFinal=False, global_branch=False, pretrained=False, **kwargs): 'Constructs a ResNet-101 model.\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n ' model = ResNet_IBN_HGNN(num_classes=num_classes, block=Bottleneck_IBN, layers=[3, 4, 23, 3], last_stride=1, num_split=8, pyramid_part=True, num_gb=2, use_pose=False, learn_graph=True, consistent_loss=False, m_prob=1.0, K_neigs=[3], is_probH=True, dropout=0.5, learn_attention=False, isFinal=isFinal, global_branch=global_branch, **kwargs) return model
def resnet101_ibn_a(num_classes, isFinal=False, global_branch=False, pretrained=False, **kwargs): 'Constructs a ResNet-101 model.\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n ' model = ResNet_IBN_HGNN(num_classes=num_classes, block=Bottleneck_IBN, layers=[3, 4, 23, 3], last_stride=1, num_split=8, pyramid_part=True, num_gb=2, use_pose=False, learn_graph=True, consistent_loss=False, m_prob=1.0, K_neigs=[3], is_probH=True, dropout=0.5, learn_attention=False, isFinal=isFinal, global_branch=global_branch, **kwargs) return model<|docstring|>Constructs a ResNet-101 model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet<|endoftext|>
e2c59c61055da7c554cf67a61acf32baa4baf3529b116d2e593b368f72c8fb1e
def resnet152_ibn_a(last_stride, pretrained=False, **kwargs): 'Constructs a ResNet-152 model.\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n ' model = ResNet_IBN(last_stride, Bottleneck_IBN, [3, 8, 36, 3], **kwargs) if pretrained: model.load_state_dict(model_zoo.load_url(model_urls['resnet152'])) return model
Constructs a ResNet-152 model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet
torchreid/models/resnet_ibn_a_hgnn.py
resnet152_ibn_a
lujiaxuan0520/NAIC-ReID-2020-contest
1
python
def resnet152_ibn_a(last_stride, pretrained=False, **kwargs): 'Constructs a ResNet-152 model.\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n ' model = ResNet_IBN(last_stride, Bottleneck_IBN, [3, 8, 36, 3], **kwargs) if pretrained: model.load_state_dict(model_zoo.load_url(model_urls['resnet152'])) return model
def resnet152_ibn_a(last_stride, pretrained=False, **kwargs): 'Constructs a ResNet-152 model.\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n ' model = ResNet_IBN(last_stride, Bottleneck_IBN, [3, 8, 36, 3], **kwargs) if pretrained: model.load_state_dict(model_zoo.load_url(model_urls['resnet152'])) return model<|docstring|>Constructs a ResNet-152 model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet<|endoftext|>
aa768a838a3c735985623323d5ab191874bc15dcdd986140f53707e95ee249c1
def _attention_op(self, feat): '\n do attention fusion\n :param feat: (batch, seq_len, num_split, c)\n :return: feat: (batch, num_split, c)\n ' att = F.normalize(feat.norm(p=2, dim=2, keepdim=True), p=1, dim=1) f = feat.mul(att).sum(dim=1) return f
do attention fusion :param feat: (batch, seq_len, num_split, c) :return: feat: (batch, num_split, c)
torchreid/models/resnet_ibn_a_hgnn.py
_attention_op
lujiaxuan0520/NAIC-ReID-2020-contest
1
python
def _attention_op(self, feat): '\n do attention fusion\n :param feat: (batch, seq_len, num_split, c)\n :return: feat: (batch, num_split, c)\n ' att = F.normalize(feat.norm(p=2, dim=2, keepdim=True), p=1, dim=1) f = feat.mul(att).sum(dim=1) return f
def _attention_op(self, feat): '\n do attention fusion\n :param feat: (batch, seq_len, num_split, c)\n :return: feat: (batch, num_split, c)\n ' att = F.normalize(feat.norm(p=2, dim=2, keepdim=True), p=1, dim=1) f = feat.mul(att).sum(dim=1) return f<|docstring|>do attention fusion :param feat: (batch, seq_len, num_split, c) :return: feat: (batch, num_split, c)<|endoftext|>
edb5c76a197235d684c67309a38b8fb7dec9073bb957bf2361b2f2268582d0f8
def _learn_attention_op(self, feat): '\n do attention fusion, with the weight learned\n :param feat: (batch, seq_len, num_split, c)\n :return: feat: (batch, num_split, c)\n ' f = feat.mul(self.attention_weight) f = f.sum(dim=1) return f
do attention fusion, with the weight learned :param feat: (batch, seq_len, num_split, c) :return: feat: (batch, num_split, c)
torchreid/models/resnet_ibn_a_hgnn.py
_learn_attention_op
lujiaxuan0520/NAIC-ReID-2020-contest
1
python
def _learn_attention_op(self, feat): '\n do attention fusion, with the weight learned\n :param feat: (batch, seq_len, num_split, c)\n :return: feat: (batch, num_split, c)\n ' f = feat.mul(self.attention_weight) f = f.sum(dim=1) return f
def _learn_attention_op(self, feat): '\n do attention fusion, with the weight learned\n :param feat: (batch, seq_len, num_split, c)\n :return: feat: (batch, num_split, c)\n ' f = feat.mul(self.attention_weight) f = f.sum(dim=1) return f<|docstring|>do attention fusion, with the weight learned :param feat: (batch, seq_len, num_split, c) :return: feat: (batch, num_split, c)<|endoftext|>
7c3ab6fde11ad6878df7ed329e9a23682663890ab1ee9ee97e5e9afd0a8bae9c
def __init__(self, hass, device, sensor_data, parameter): 'Initialize the Centrometarl Boiler Sensor.' self.hass = hass self.web_boiler_client = hass.data[DOMAIN][device.username][WEB_BOILER_CLIENT] self.web_boiler_system = hass.data[DOMAIN][device.username][WEB_BOILER_SYSTEM] self.parameter = parameter self.device = device self._unit = sensor_data[0] self._icon = sensor_data[1] self._device_class = sensor_data[2] self._description = sensor_data[3] self._attributes = (sensor_data[4] if (len(sensor_data) == 5) else {}) self._serial = device['serial'] self._parameter_name = parameter['name'] self._product = device['product'] self._name = format_name(hass, device, f'{self._product} {self._description}') self._unique_id = f'{self._serial}-{self._parameter_name}' self.added_to_hass = False self.parameter['used'] = True for attribute in self._attributes: attribute_parameter = self.device.get_parameter(attribute) attribute_parameter['used'] = True
Initialize the Centrometarl Boiler Sensor.
custom_components/centrometal_boiler/sensors/WebBoilerGenericSensor.py
__init__
9a4gl/hass-peltec
2
python
def __init__(self, hass, device, sensor_data, parameter): self.hass = hass self.web_boiler_client = hass.data[DOMAIN][device.username][WEB_BOILER_CLIENT] self.web_boiler_system = hass.data[DOMAIN][device.username][WEB_BOILER_SYSTEM] self.parameter = parameter self.device = device self._unit = sensor_data[0] self._icon = sensor_data[1] self._device_class = sensor_data[2] self._description = sensor_data[3] self._attributes = (sensor_data[4] if (len(sensor_data) == 5) else {}) self._serial = device['serial'] self._parameter_name = parameter['name'] self._product = device['product'] self._name = format_name(hass, device, f'{self._product} {self._description}') self._unique_id = f'{self._serial}-{self._parameter_name}' self.added_to_hass = False self.parameter['used'] = True for attribute in self._attributes: attribute_parameter = self.device.get_parameter(attribute) attribute_parameter['used'] = True
def __init__(self, hass, device, sensor_data, parameter): self.hass = hass self.web_boiler_client = hass.data[DOMAIN][device.username][WEB_BOILER_CLIENT] self.web_boiler_system = hass.data[DOMAIN][device.username][WEB_BOILER_SYSTEM] self.parameter = parameter self.device = device self._unit = sensor_data[0] self._icon = sensor_data[1] self._device_class = sensor_data[2] self._description = sensor_data[3] self._attributes = (sensor_data[4] if (len(sensor_data) == 5) else {}) self._serial = device['serial'] self._parameter_name = parameter['name'] self._product = device['product'] self._name = format_name(hass, device, f'{self._product} {self._description}') self._unique_id = f'{self._serial}-{self._parameter_name}' self.added_to_hass = False self.parameter['used'] = True for attribute in self._attributes: attribute_parameter = self.device.get_parameter(attribute) attribute_parameter['used'] = True<|docstring|>Initialize the Centrometarl Boiler Sensor.<|endoftext|>
7a723a4664d7d38f9f257df1adfcc1a4146245bdd914942ca4b189179f89c5f1
async def async_added_to_hass(self): 'Subscribe to sensor events.' self.added_to_hass = True self.async_schedule_update_ha_state(False) self.parameter.set_update_callback(self.update_callback, 'generic')
Subscribe to sensor events.
custom_components/centrometal_boiler/sensors/WebBoilerGenericSensor.py
async_added_to_hass
9a4gl/hass-peltec
2
python
async def async_added_to_hass(self): self.added_to_hass = True self.async_schedule_update_ha_state(False) self.parameter.set_update_callback(self.update_callback, 'generic')
async def async_added_to_hass(self): self.added_to_hass = True self.async_schedule_update_ha_state(False) self.parameter.set_update_callback(self.update_callback, 'generic')<|docstring|>Subscribe to sensor events.<|endoftext|>
43d68a020068e5cc6e859d932feb652ea932b61b111b0327f8e6b8c1b4be9fdc
@property def should_poll(self) -> bool: 'No polling needed for a sensor.' return False
No polling needed for a sensor.
custom_components/centrometal_boiler/sensors/WebBoilerGenericSensor.py
should_poll
9a4gl/hass-peltec
2
python
@property def should_poll(self) -> bool: return False
@property def should_poll(self) -> bool: return False<|docstring|>No polling needed for a sensor.<|endoftext|>
4cc5f154ef2afd186977f8245faaf6e0bc0cadff4de50077959227a10ad563d7
async def update_callback(self, parameter): 'Call update for Home Assistant when the parameter is updated.' self.async_write_ha_state()
Call update for Home Assistant when the parameter is updated.
custom_components/centrometal_boiler/sensors/WebBoilerGenericSensor.py
update_callback
9a4gl/hass-peltec
2
python
async def update_callback(self, parameter): self.async_write_ha_state()
async def update_callback(self, parameter): self.async_write_ha_state()<|docstring|>Call update for Home Assistant when the parameter is updated.<|endoftext|>
959514ff3ad36bfa3d9e493ec80719a74614a7e62c186c5799451855e3d3f810
@property def name(self): 'Return the name of the device.' return self._name
Return the name of the device.
custom_components/centrometal_boiler/sensors/WebBoilerGenericSensor.py
name
9a4gl/hass-peltec
2
python
@property def name(self): return self._name
@property def name(self): return self._name<|docstring|>Return the name of the device.<|endoftext|>
855c584131a3df52ee8c47f2b359b9d9ec09cb3b437ff32024745b23fbedeece
@property def unique_id(self) -> str: 'Return a unique ID.' return self._unique_id
Return a unique ID.
custom_components/centrometal_boiler/sensors/WebBoilerGenericSensor.py
unique_id
9a4gl/hass-peltec
2
python
@property def unique_id(self) -> str: return self._unique_id
@property def unique_id(self) -> str: return self._unique_id<|docstring|>Return a unique ID.<|endoftext|>
1978fa32e16ae93df38c43cdc440475bca9f9db8bb639d7cd507ee7b31059757
@property def icon(self): 'Return the icon to use in the frontend.' return self._icon
Return the icon to use in the frontend.
custom_components/centrometal_boiler/sensors/WebBoilerGenericSensor.py
icon
9a4gl/hass-peltec
2
python
@property def icon(self): return self._icon
@property def icon(self): return self._icon<|docstring|>Return the icon to use in the frontend.<|endoftext|>
e01e91b76c41f993481667c2292d78e1a2ef81b7c9d5677c629af879c56edb34
@property def unit_of_measurement(self): 'Return the unit of measurement of this entity, if any.' return self._unit
Return the unit of measurement of this entity, if any.
custom_components/centrometal_boiler/sensors/WebBoilerGenericSensor.py
unit_of_measurement
9a4gl/hass-peltec
2
python
@property def unit_of_measurement(self): return self._unit
@property def unit_of_measurement(self): return self._unit<|docstring|>Return the unit of measurement of this entity, if any.<|endoftext|>
f8f1764239a98784ffd055f3382389240d30180290c77999caa53b6817454a93
@property def native_unit_of_measurement(self): 'Return the unit this state is expressed in.' return self._unit
Return the unit this state is expressed in.
custom_components/centrometal_boiler/sensors/WebBoilerGenericSensor.py
native_unit_of_measurement
9a4gl/hass-peltec
2
python
@property def native_unit_of_measurement(self): return self._unit
@property def native_unit_of_measurement(self): return self._unit<|docstring|>Return the unit this state is expressed in.<|endoftext|>
21c14481cb9f48072081a91d46c5f38c7be188aa32b8037ff5d10179c8d460c3
@property def device_class(self): 'Return the device class of this entity.' return self._device_class
Return the device class of this entity.
custom_components/centrometal_boiler/sensors/WebBoilerGenericSensor.py
device_class
9a4gl/hass-peltec
2
python
@property def device_class(self): return self._device_class
@property def device_class(self): return self._device_class<|docstring|>Return the device class of this entity.<|endoftext|>
ee0d6158cc6ed60837358fafb0b654ad79beaa601f37bfca72e2c1c4d5b46fc3
@property def native_value(self): 'Return the value of the sensor.' return self.parameter['value']
Return the value of the sensor.
custom_components/centrometal_boiler/sensors/WebBoilerGenericSensor.py
native_value
9a4gl/hass-peltec
2
python
@property def native_value(self): return self.parameter['value']
@property def native_value(self): return self.parameter['value']<|docstring|>Return the value of the sensor.<|endoftext|>
d68fa059210e3949fcf64b7ec166e941e68984afc92d7259e481811002429bb6
@property def available(self): 'Return the availablity of the sensor.' return self.web_boiler_client.is_websocket_connected()
Return the availablity of the sensor.
custom_components/centrometal_boiler/sensors/WebBoilerGenericSensor.py
available
9a4gl/hass-peltec
2
python
@property def available(self): return self.web_boiler_client.is_websocket_connected()
@property def available(self): return self.web_boiler_client.is_websocket_connected()<|docstring|>Return the availablity of the sensor.<|endoftext|>
ad463ee3c84398c9aea9f58e701f06607491c3ba2ade924011ea633a0c302ed4
@property def extra_state_attributes(self): 'Return the state attributes of the sensor.' attributes = {} if ('timestamp' in self.parameter): last_updated = format_time(self.hass, int(self.parameter['timestamp'])) for (key, description) in self._attributes.items(): parameter = self.device.get_parameter(key) attributes[description] = (parameter['value'] or '?') attributes['Last updated'] = last_updated attributes['Original name'] = self.parameter['name'] return attributes
Return the state attributes of the sensor.
custom_components/centrometal_boiler/sensors/WebBoilerGenericSensor.py
extra_state_attributes
9a4gl/hass-peltec
2
python
@property def extra_state_attributes(self): attributes = {} if ('timestamp' in self.parameter): last_updated = format_time(self.hass, int(self.parameter['timestamp'])) for (key, description) in self._attributes.items(): parameter = self.device.get_parameter(key) attributes[description] = (parameter['value'] or '?') attributes['Last updated'] = last_updated attributes['Original name'] = self.parameter['name'] return attributes
@property def extra_state_attributes(self): attributes = {} if ('timestamp' in self.parameter): last_updated = format_time(self.hass, int(self.parameter['timestamp'])) for (key, description) in self._attributes.items(): parameter = self.device.get_parameter(key) attributes[description] = (parameter['value'] or '?') attributes['Last updated'] = last_updated attributes['Original name'] = self.parameter['name'] return attributes<|docstring|>Return the state attributes of the sensor.<|endoftext|>
5a62eac40d50865c470f1a2be1b53a6805f3587a67d0fc99417658ad2b16cbbd
def __init__(__self__, *, end_ip_address: pulumi.Input[str], start_ip_address: pulumi.Input[str], synapse_workspace_id: pulumi.Input[str], name: Optional[pulumi.Input[str]]=None): '\n The set of arguments for constructing a FirewallRule resource.\n :param pulumi.Input[str] end_ip_address: The ending IP address to allow through the firewall for this rule.\n :param pulumi.Input[str] start_ip_address: The starting IP address to allow through the firewall for this rule.\n :param pulumi.Input[str] synapse_workspace_id: The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.\n :param pulumi.Input[str] name: The Name of the firewall rule. Changing this forces a new resource to be created.\n ' pulumi.set(__self__, 'end_ip_address', end_ip_address) pulumi.set(__self__, 'start_ip_address', start_ip_address) pulumi.set(__self__, 'synapse_workspace_id', synapse_workspace_id) if (name is not None): pulumi.set(__self__, 'name', name)
The set of arguments for constructing a FirewallRule resource. :param pulumi.Input[str] end_ip_address: The ending IP address to allow through the firewall for this rule. :param pulumi.Input[str] start_ip_address: The starting IP address to allow through the firewall for this rule. :param pulumi.Input[str] synapse_workspace_id: The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created. :param pulumi.Input[str] name: The Name of the firewall rule. Changing this forces a new resource to be created.
sdk/python/pulumi_azure/synapse/firewall_rule.py
__init__
henriktao/pulumi-azure
109
python
def __init__(__self__, *, end_ip_address: pulumi.Input[str], start_ip_address: pulumi.Input[str], synapse_workspace_id: pulumi.Input[str], name: Optional[pulumi.Input[str]]=None): '\n The set of arguments for constructing a FirewallRule resource.\n :param pulumi.Input[str] end_ip_address: The ending IP address to allow through the firewall for this rule.\n :param pulumi.Input[str] start_ip_address: The starting IP address to allow through the firewall for this rule.\n :param pulumi.Input[str] synapse_workspace_id: The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.\n :param pulumi.Input[str] name: The Name of the firewall rule. Changing this forces a new resource to be created.\n ' pulumi.set(__self__, 'end_ip_address', end_ip_address) pulumi.set(__self__, 'start_ip_address', start_ip_address) pulumi.set(__self__, 'synapse_workspace_id', synapse_workspace_id) if (name is not None): pulumi.set(__self__, 'name', name)
def __init__(__self__, *, end_ip_address: pulumi.Input[str], start_ip_address: pulumi.Input[str], synapse_workspace_id: pulumi.Input[str], name: Optional[pulumi.Input[str]]=None): '\n The set of arguments for constructing a FirewallRule resource.\n :param pulumi.Input[str] end_ip_address: The ending IP address to allow through the firewall for this rule.\n :param pulumi.Input[str] start_ip_address: The starting IP address to allow through the firewall for this rule.\n :param pulumi.Input[str] synapse_workspace_id: The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.\n :param pulumi.Input[str] name: The Name of the firewall rule. Changing this forces a new resource to be created.\n ' pulumi.set(__self__, 'end_ip_address', end_ip_address) pulumi.set(__self__, 'start_ip_address', start_ip_address) pulumi.set(__self__, 'synapse_workspace_id', synapse_workspace_id) if (name is not None): pulumi.set(__self__, 'name', name)<|docstring|>The set of arguments for constructing a FirewallRule resource. :param pulumi.Input[str] end_ip_address: The ending IP address to allow through the firewall for this rule. :param pulumi.Input[str] start_ip_address: The starting IP address to allow through the firewall for this rule. :param pulumi.Input[str] synapse_workspace_id: The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created. :param pulumi.Input[str] name: The Name of the firewall rule. Changing this forces a new resource to be created.<|endoftext|>
d5634ada3879e097a799e913a7cbf7d72c5ba1ae968f86a0c470533a89226cbb
@property @pulumi.getter(name='endIpAddress') def end_ip_address(self) -> pulumi.Input[str]: '\n The ending IP address to allow through the firewall for this rule.\n ' return pulumi.get(self, 'end_ip_address')
The ending IP address to allow through the firewall for this rule.
sdk/python/pulumi_azure/synapse/firewall_rule.py
end_ip_address
henriktao/pulumi-azure
109
python
@property @pulumi.getter(name='endIpAddress') def end_ip_address(self) -> pulumi.Input[str]: '\n \n ' return pulumi.get(self, 'end_ip_address')
@property @pulumi.getter(name='endIpAddress') def end_ip_address(self) -> pulumi.Input[str]: '\n \n ' return pulumi.get(self, 'end_ip_address')<|docstring|>The ending IP address to allow through the firewall for this rule.<|endoftext|>
f4f85911b5dab44e95d6952ed9e24d86b086f77d474c08f7a7e15a7c740f511b
@property @pulumi.getter(name='startIpAddress') def start_ip_address(self) -> pulumi.Input[str]: '\n The starting IP address to allow through the firewall for this rule.\n ' return pulumi.get(self, 'start_ip_address')
The starting IP address to allow through the firewall for this rule.
sdk/python/pulumi_azure/synapse/firewall_rule.py
start_ip_address
henriktao/pulumi-azure
109
python
@property @pulumi.getter(name='startIpAddress') def start_ip_address(self) -> pulumi.Input[str]: '\n \n ' return pulumi.get(self, 'start_ip_address')
@property @pulumi.getter(name='startIpAddress') def start_ip_address(self) -> pulumi.Input[str]: '\n \n ' return pulumi.get(self, 'start_ip_address')<|docstring|>The starting IP address to allow through the firewall for this rule.<|endoftext|>
8ae20ced7fe954bcd2efba30f0b1ded559a4ecc1f3e9da4b15b4402ef9473e37
@property @pulumi.getter(name='synapseWorkspaceId') def synapse_workspace_id(self) -> pulumi.Input[str]: '\n The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.\n ' return pulumi.get(self, 'synapse_workspace_id')
The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.
sdk/python/pulumi_azure/synapse/firewall_rule.py
synapse_workspace_id
henriktao/pulumi-azure
109
python
@property @pulumi.getter(name='synapseWorkspaceId') def synapse_workspace_id(self) -> pulumi.Input[str]: '\n \n ' return pulumi.get(self, 'synapse_workspace_id')
@property @pulumi.getter(name='synapseWorkspaceId') def synapse_workspace_id(self) -> pulumi.Input[str]: '\n \n ' return pulumi.get(self, 'synapse_workspace_id')<|docstring|>The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.<|endoftext|>
42beab7c1671cfa736de4f5f8715450cb1ac13aa487b8b66d2235265604e17c4
@property @pulumi.getter def name(self) -> Optional[pulumi.Input[str]]: '\n The Name of the firewall rule. Changing this forces a new resource to be created.\n ' return pulumi.get(self, 'name')
The Name of the firewall rule. Changing this forces a new resource to be created.
sdk/python/pulumi_azure/synapse/firewall_rule.py
name
henriktao/pulumi-azure
109
python
@property @pulumi.getter def name(self) -> Optional[pulumi.Input[str]]: '\n \n ' return pulumi.get(self, 'name')
@property @pulumi.getter def name(self) -> Optional[pulumi.Input[str]]: '\n \n ' return pulumi.get(self, 'name')<|docstring|>The Name of the firewall rule. Changing this forces a new resource to be created.<|endoftext|>
cee8fcd8ca50ac2f1873e4d001c2a167fcafa82b9402e349df77c804b16f54b0
def __init__(__self__, *, end_ip_address: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, start_ip_address: Optional[pulumi.Input[str]]=None, synapse_workspace_id: Optional[pulumi.Input[str]]=None): '\n Input properties used for looking up and filtering FirewallRule resources.\n :param pulumi.Input[str] end_ip_address: The ending IP address to allow through the firewall for this rule.\n :param pulumi.Input[str] name: The Name of the firewall rule. Changing this forces a new resource to be created.\n :param pulumi.Input[str] start_ip_address: The starting IP address to allow through the firewall for this rule.\n :param pulumi.Input[str] synapse_workspace_id: The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.\n ' if (end_ip_address is not None): pulumi.set(__self__, 'end_ip_address', end_ip_address) if (name is not None): pulumi.set(__self__, 'name', name) if (start_ip_address is not None): pulumi.set(__self__, 'start_ip_address', start_ip_address) if (synapse_workspace_id is not None): pulumi.set(__self__, 'synapse_workspace_id', synapse_workspace_id)
Input properties used for looking up and filtering FirewallRule resources. :param pulumi.Input[str] end_ip_address: The ending IP address to allow through the firewall for this rule. :param pulumi.Input[str] name: The Name of the firewall rule. Changing this forces a new resource to be created. :param pulumi.Input[str] start_ip_address: The starting IP address to allow through the firewall for this rule. :param pulumi.Input[str] synapse_workspace_id: The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.
sdk/python/pulumi_azure/synapse/firewall_rule.py
__init__
henriktao/pulumi-azure
109
python
def __init__(__self__, *, end_ip_address: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, start_ip_address: Optional[pulumi.Input[str]]=None, synapse_workspace_id: Optional[pulumi.Input[str]]=None): '\n Input properties used for looking up and filtering FirewallRule resources.\n :param pulumi.Input[str] end_ip_address: The ending IP address to allow through the firewall for this rule.\n :param pulumi.Input[str] name: The Name of the firewall rule. Changing this forces a new resource to be created.\n :param pulumi.Input[str] start_ip_address: The starting IP address to allow through the firewall for this rule.\n :param pulumi.Input[str] synapse_workspace_id: The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.\n ' if (end_ip_address is not None): pulumi.set(__self__, 'end_ip_address', end_ip_address) if (name is not None): pulumi.set(__self__, 'name', name) if (start_ip_address is not None): pulumi.set(__self__, 'start_ip_address', start_ip_address) if (synapse_workspace_id is not None): pulumi.set(__self__, 'synapse_workspace_id', synapse_workspace_id)
def __init__(__self__, *, end_ip_address: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, start_ip_address: Optional[pulumi.Input[str]]=None, synapse_workspace_id: Optional[pulumi.Input[str]]=None): '\n Input properties used for looking up and filtering FirewallRule resources.\n :param pulumi.Input[str] end_ip_address: The ending IP address to allow through the firewall for this rule.\n :param pulumi.Input[str] name: The Name of the firewall rule. Changing this forces a new resource to be created.\n :param pulumi.Input[str] start_ip_address: The starting IP address to allow through the firewall for this rule.\n :param pulumi.Input[str] synapse_workspace_id: The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.\n ' if (end_ip_address is not None): pulumi.set(__self__, 'end_ip_address', end_ip_address) if (name is not None): pulumi.set(__self__, 'name', name) if (start_ip_address is not None): pulumi.set(__self__, 'start_ip_address', start_ip_address) if (synapse_workspace_id is not None): pulumi.set(__self__, 'synapse_workspace_id', synapse_workspace_id)<|docstring|>Input properties used for looking up and filtering FirewallRule resources. :param pulumi.Input[str] end_ip_address: The ending IP address to allow through the firewall for this rule. :param pulumi.Input[str] name: The Name of the firewall rule. Changing this forces a new resource to be created. :param pulumi.Input[str] start_ip_address: The starting IP address to allow through the firewall for this rule. :param pulumi.Input[str] synapse_workspace_id: The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.<|endoftext|>
b2e56a927f32c131e5bc8dc233436c51881fdc1241b728a662a927663a39865c
@property @pulumi.getter(name='endIpAddress') def end_ip_address(self) -> Optional[pulumi.Input[str]]: '\n The ending IP address to allow through the firewall for this rule.\n ' return pulumi.get(self, 'end_ip_address')
The ending IP address to allow through the firewall for this rule.
sdk/python/pulumi_azure/synapse/firewall_rule.py
end_ip_address
henriktao/pulumi-azure
109
python
@property @pulumi.getter(name='endIpAddress') def end_ip_address(self) -> Optional[pulumi.Input[str]]: '\n \n ' return pulumi.get(self, 'end_ip_address')
@property @pulumi.getter(name='endIpAddress') def end_ip_address(self) -> Optional[pulumi.Input[str]]: '\n \n ' return pulumi.get(self, 'end_ip_address')<|docstring|>The ending IP address to allow through the firewall for this rule.<|endoftext|>
42beab7c1671cfa736de4f5f8715450cb1ac13aa487b8b66d2235265604e17c4
@property @pulumi.getter def name(self) -> Optional[pulumi.Input[str]]: '\n The Name of the firewall rule. Changing this forces a new resource to be created.\n ' return pulumi.get(self, 'name')
The Name of the firewall rule. Changing this forces a new resource to be created.
sdk/python/pulumi_azure/synapse/firewall_rule.py
name
henriktao/pulumi-azure
109
python
@property @pulumi.getter def name(self) -> Optional[pulumi.Input[str]]: '\n \n ' return pulumi.get(self, 'name')
@property @pulumi.getter def name(self) -> Optional[pulumi.Input[str]]: '\n \n ' return pulumi.get(self, 'name')<|docstring|>The Name of the firewall rule. Changing this forces a new resource to be created.<|endoftext|>
2d83f9f8c97a40d3cedb0525e0afae33529bbb94c7406538d96322dcb56dc708
@property @pulumi.getter(name='startIpAddress') def start_ip_address(self) -> Optional[pulumi.Input[str]]: '\n The starting IP address to allow through the firewall for this rule.\n ' return pulumi.get(self, 'start_ip_address')
The starting IP address to allow through the firewall for this rule.
sdk/python/pulumi_azure/synapse/firewall_rule.py
start_ip_address
henriktao/pulumi-azure
109
python
@property @pulumi.getter(name='startIpAddress') def start_ip_address(self) -> Optional[pulumi.Input[str]]: '\n \n ' return pulumi.get(self, 'start_ip_address')
@property @pulumi.getter(name='startIpAddress') def start_ip_address(self) -> Optional[pulumi.Input[str]]: '\n \n ' return pulumi.get(self, 'start_ip_address')<|docstring|>The starting IP address to allow through the firewall for this rule.<|endoftext|>
c0fd6e1e5475290f66f311f6be5bbde96222a526e6a7901f3c46a8626e03da0b
@property @pulumi.getter(name='synapseWorkspaceId') def synapse_workspace_id(self) -> Optional[pulumi.Input[str]]: '\n The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.\n ' return pulumi.get(self, 'synapse_workspace_id')
The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.
sdk/python/pulumi_azure/synapse/firewall_rule.py
synapse_workspace_id
henriktao/pulumi-azure
109
python
@property @pulumi.getter(name='synapseWorkspaceId') def synapse_workspace_id(self) -> Optional[pulumi.Input[str]]: '\n \n ' return pulumi.get(self, 'synapse_workspace_id')
@property @pulumi.getter(name='synapseWorkspaceId') def synapse_workspace_id(self) -> Optional[pulumi.Input[str]]: '\n \n ' return pulumi.get(self, 'synapse_workspace_id')<|docstring|>The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.<|endoftext|>
6f5dc3162a3b3ba0100cdc8a330247d14a6dc015682ca2634607f28fd63677e2
@overload def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, end_ip_address: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, start_ip_address: Optional[pulumi.Input[str]]=None, synapse_workspace_id: Optional[pulumi.Input[str]]=None, __props__=None): '\n Allows you to Manages a Synapse Firewall Rule.\n\n ## Example Usage\n\n ```python\n import pulumi\n import pulumi_azure as azure\n\n example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")\n example_account = azure.storage.Account("exampleAccount",\n resource_group_name=example_resource_group.name,\n location=example_resource_group.location,\n account_tier="Standard",\n account_replication_type="LRS",\n account_kind="StorageV2",\n is_hns_enabled=True)\n example_data_lake_gen2_filesystem = azure.storage.DataLakeGen2Filesystem("exampleDataLakeGen2Filesystem", storage_account_id=example_account.id)\n example_workspace = azure.synapse.Workspace("exampleWorkspace",\n resource_group_name=example_resource_group.name,\n location=example_resource_group.location,\n storage_data_lake_gen2_filesystem_id=example_data_lake_gen2_filesystem.id,\n sql_administrator_login="sqladminuser",\n sql_administrator_login_password="H@Sh1CoR3!")\n example_firewall_rule = azure.synapse.FirewallRule("exampleFirewallRule",\n synapse_workspace_id=azurerm_synapse_workspace["test"]["id"],\n start_ip_address="0.0.0.0",\n end_ip_address="255.255.255.255")\n ```\n\n ## Import\n\n Synapse Firewall Rule can be imported using the `resource id`, e.g.\n\n ```sh\n $ pulumi import azure:synapse/firewallRule:FirewallRule example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourcegroup1/providers/Microsoft.Synapse/workspaces/workspace1/firewallRules/rule1\n ```\n\n :param str resource_name: The name of the resource.\n :param pulumi.ResourceOptions opts: Options for the resource.\n :param pulumi.Input[str] end_ip_address: The ending IP address to allow through the firewall for this rule.\n :param pulumi.Input[str] name: The Name of the firewall rule. Changing this forces a new resource to be created.\n :param pulumi.Input[str] start_ip_address: The starting IP address to allow through the firewall for this rule.\n :param pulumi.Input[str] synapse_workspace_id: The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.\n ' ...
Allows you to Manages a Synapse Firewall Rule. ## Example Usage ```python import pulumi import pulumi_azure as azure example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe") example_account = azure.storage.Account("exampleAccount", resource_group_name=example_resource_group.name, location=example_resource_group.location, account_tier="Standard", account_replication_type="LRS", account_kind="StorageV2", is_hns_enabled=True) example_data_lake_gen2_filesystem = azure.storage.DataLakeGen2Filesystem("exampleDataLakeGen2Filesystem", storage_account_id=example_account.id) example_workspace = azure.synapse.Workspace("exampleWorkspace", resource_group_name=example_resource_group.name, location=example_resource_group.location, storage_data_lake_gen2_filesystem_id=example_data_lake_gen2_filesystem.id, sql_administrator_login="sqladminuser", sql_administrator_login_password="H@Sh1CoR3!") example_firewall_rule = azure.synapse.FirewallRule("exampleFirewallRule", synapse_workspace_id=azurerm_synapse_workspace["test"]["id"], start_ip_address="0.0.0.0", end_ip_address="255.255.255.255") ``` ## Import Synapse Firewall Rule can be imported using the `resource id`, e.g. ```sh $ pulumi import azure:synapse/firewallRule:FirewallRule example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourcegroup1/providers/Microsoft.Synapse/workspaces/workspace1/firewallRules/rule1 ``` :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[str] end_ip_address: The ending IP address to allow through the firewall for this rule. :param pulumi.Input[str] name: The Name of the firewall rule. Changing this forces a new resource to be created. :param pulumi.Input[str] start_ip_address: The starting IP address to allow through the firewall for this rule. :param pulumi.Input[str] synapse_workspace_id: The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.
sdk/python/pulumi_azure/synapse/firewall_rule.py
__init__
henriktao/pulumi-azure
109
python
@overload def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, end_ip_address: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, start_ip_address: Optional[pulumi.Input[str]]=None, synapse_workspace_id: Optional[pulumi.Input[str]]=None, __props__=None): '\n Allows you to Manages a Synapse Firewall Rule.\n\n ## Example Usage\n\n ```python\n import pulumi\n import pulumi_azure as azure\n\n example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")\n example_account = azure.storage.Account("exampleAccount",\n resource_group_name=example_resource_group.name,\n location=example_resource_group.location,\n account_tier="Standard",\n account_replication_type="LRS",\n account_kind="StorageV2",\n is_hns_enabled=True)\n example_data_lake_gen2_filesystem = azure.storage.DataLakeGen2Filesystem("exampleDataLakeGen2Filesystem", storage_account_id=example_account.id)\n example_workspace = azure.synapse.Workspace("exampleWorkspace",\n resource_group_name=example_resource_group.name,\n location=example_resource_group.location,\n storage_data_lake_gen2_filesystem_id=example_data_lake_gen2_filesystem.id,\n sql_administrator_login="sqladminuser",\n sql_administrator_login_password="H@Sh1CoR3!")\n example_firewall_rule = azure.synapse.FirewallRule("exampleFirewallRule",\n synapse_workspace_id=azurerm_synapse_workspace["test"]["id"],\n start_ip_address="0.0.0.0",\n end_ip_address="255.255.255.255")\n ```\n\n ## Import\n\n Synapse Firewall Rule can be imported using the `resource id`, e.g.\n\n ```sh\n $ pulumi import azure:synapse/firewallRule:FirewallRule example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourcegroup1/providers/Microsoft.Synapse/workspaces/workspace1/firewallRules/rule1\n ```\n\n :param str resource_name: The name of the resource.\n :param pulumi.ResourceOptions opts: Options for the resource.\n :param pulumi.Input[str] end_ip_address: The ending IP address to allow through the firewall for this rule.\n :param pulumi.Input[str] name: The Name of the firewall rule. Changing this forces a new resource to be created.\n :param pulumi.Input[str] start_ip_address: The starting IP address to allow through the firewall for this rule.\n :param pulumi.Input[str] synapse_workspace_id: The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.\n ' ...
@overload def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, end_ip_address: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, start_ip_address: Optional[pulumi.Input[str]]=None, synapse_workspace_id: Optional[pulumi.Input[str]]=None, __props__=None): '\n Allows you to Manages a Synapse Firewall Rule.\n\n ## Example Usage\n\n ```python\n import pulumi\n import pulumi_azure as azure\n\n example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")\n example_account = azure.storage.Account("exampleAccount",\n resource_group_name=example_resource_group.name,\n location=example_resource_group.location,\n account_tier="Standard",\n account_replication_type="LRS",\n account_kind="StorageV2",\n is_hns_enabled=True)\n example_data_lake_gen2_filesystem = azure.storage.DataLakeGen2Filesystem("exampleDataLakeGen2Filesystem", storage_account_id=example_account.id)\n example_workspace = azure.synapse.Workspace("exampleWorkspace",\n resource_group_name=example_resource_group.name,\n location=example_resource_group.location,\n storage_data_lake_gen2_filesystem_id=example_data_lake_gen2_filesystem.id,\n sql_administrator_login="sqladminuser",\n sql_administrator_login_password="H@Sh1CoR3!")\n example_firewall_rule = azure.synapse.FirewallRule("exampleFirewallRule",\n synapse_workspace_id=azurerm_synapse_workspace["test"]["id"],\n start_ip_address="0.0.0.0",\n end_ip_address="255.255.255.255")\n ```\n\n ## Import\n\n Synapse Firewall Rule can be imported using the `resource id`, e.g.\n\n ```sh\n $ pulumi import azure:synapse/firewallRule:FirewallRule example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourcegroup1/providers/Microsoft.Synapse/workspaces/workspace1/firewallRules/rule1\n ```\n\n :param str resource_name: The name of the resource.\n :param pulumi.ResourceOptions opts: Options for the resource.\n :param pulumi.Input[str] end_ip_address: The ending IP address to allow through the firewall for this rule.\n :param pulumi.Input[str] name: The Name of the firewall rule. Changing this forces a new resource to be created.\n :param pulumi.Input[str] start_ip_address: The starting IP address to allow through the firewall for this rule.\n :param pulumi.Input[str] synapse_workspace_id: The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.\n ' ...<|docstring|>Allows you to Manages a Synapse Firewall Rule. ## Example Usage ```python import pulumi import pulumi_azure as azure example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe") example_account = azure.storage.Account("exampleAccount", resource_group_name=example_resource_group.name, location=example_resource_group.location, account_tier="Standard", account_replication_type="LRS", account_kind="StorageV2", is_hns_enabled=True) example_data_lake_gen2_filesystem = azure.storage.DataLakeGen2Filesystem("exampleDataLakeGen2Filesystem", storage_account_id=example_account.id) example_workspace = azure.synapse.Workspace("exampleWorkspace", resource_group_name=example_resource_group.name, location=example_resource_group.location, storage_data_lake_gen2_filesystem_id=example_data_lake_gen2_filesystem.id, sql_administrator_login="sqladminuser", sql_administrator_login_password="H@Sh1CoR3!") example_firewall_rule = azure.synapse.FirewallRule("exampleFirewallRule", synapse_workspace_id=azurerm_synapse_workspace["test"]["id"], start_ip_address="0.0.0.0", end_ip_address="255.255.255.255") ``` ## Import Synapse Firewall Rule can be imported using the `resource id`, e.g. ```sh $ pulumi import azure:synapse/firewallRule:FirewallRule example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourcegroup1/providers/Microsoft.Synapse/workspaces/workspace1/firewallRules/rule1 ``` :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[str] end_ip_address: The ending IP address to allow through the firewall for this rule. :param pulumi.Input[str] name: The Name of the firewall rule. Changing this forces a new resource to be created. :param pulumi.Input[str] start_ip_address: The starting IP address to allow through the firewall for this rule. :param pulumi.Input[str] synapse_workspace_id: The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.<|endoftext|>
cc2af0cd9767e3ee3ce890a14b57bf544ce09d3c4aa5dbc29cbe0dace37de2c7
@overload def __init__(__self__, resource_name: str, args: FirewallRuleArgs, opts: Optional[pulumi.ResourceOptions]=None): '\n Allows you to Manages a Synapse Firewall Rule.\n\n ## Example Usage\n\n ```python\n import pulumi\n import pulumi_azure as azure\n\n example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")\n example_account = azure.storage.Account("exampleAccount",\n resource_group_name=example_resource_group.name,\n location=example_resource_group.location,\n account_tier="Standard",\n account_replication_type="LRS",\n account_kind="StorageV2",\n is_hns_enabled=True)\n example_data_lake_gen2_filesystem = azure.storage.DataLakeGen2Filesystem("exampleDataLakeGen2Filesystem", storage_account_id=example_account.id)\n example_workspace = azure.synapse.Workspace("exampleWorkspace",\n resource_group_name=example_resource_group.name,\n location=example_resource_group.location,\n storage_data_lake_gen2_filesystem_id=example_data_lake_gen2_filesystem.id,\n sql_administrator_login="sqladminuser",\n sql_administrator_login_password="H@Sh1CoR3!")\n example_firewall_rule = azure.synapse.FirewallRule("exampleFirewallRule",\n synapse_workspace_id=azurerm_synapse_workspace["test"]["id"],\n start_ip_address="0.0.0.0",\n end_ip_address="255.255.255.255")\n ```\n\n ## Import\n\n Synapse Firewall Rule can be imported using the `resource id`, e.g.\n\n ```sh\n $ pulumi import azure:synapse/firewallRule:FirewallRule example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourcegroup1/providers/Microsoft.Synapse/workspaces/workspace1/firewallRules/rule1\n ```\n\n :param str resource_name: The name of the resource.\n :param FirewallRuleArgs args: The arguments to use to populate this resource\'s properties.\n :param pulumi.ResourceOptions opts: Options for the resource.\n ' ...
Allows you to Manages a Synapse Firewall Rule. ## Example Usage ```python import pulumi import pulumi_azure as azure example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe") example_account = azure.storage.Account("exampleAccount", resource_group_name=example_resource_group.name, location=example_resource_group.location, account_tier="Standard", account_replication_type="LRS", account_kind="StorageV2", is_hns_enabled=True) example_data_lake_gen2_filesystem = azure.storage.DataLakeGen2Filesystem("exampleDataLakeGen2Filesystem", storage_account_id=example_account.id) example_workspace = azure.synapse.Workspace("exampleWorkspace", resource_group_name=example_resource_group.name, location=example_resource_group.location, storage_data_lake_gen2_filesystem_id=example_data_lake_gen2_filesystem.id, sql_administrator_login="sqladminuser", sql_administrator_login_password="H@Sh1CoR3!") example_firewall_rule = azure.synapse.FirewallRule("exampleFirewallRule", synapse_workspace_id=azurerm_synapse_workspace["test"]["id"], start_ip_address="0.0.0.0", end_ip_address="255.255.255.255") ``` ## Import Synapse Firewall Rule can be imported using the `resource id`, e.g. ```sh $ pulumi import azure:synapse/firewallRule:FirewallRule example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourcegroup1/providers/Microsoft.Synapse/workspaces/workspace1/firewallRules/rule1 ``` :param str resource_name: The name of the resource. :param FirewallRuleArgs args: The arguments to use to populate this resource's properties. :param pulumi.ResourceOptions opts: Options for the resource.
sdk/python/pulumi_azure/synapse/firewall_rule.py
__init__
henriktao/pulumi-azure
109
python
@overload def __init__(__self__, resource_name: str, args: FirewallRuleArgs, opts: Optional[pulumi.ResourceOptions]=None): '\n Allows you to Manages a Synapse Firewall Rule.\n\n ## Example Usage\n\n ```python\n import pulumi\n import pulumi_azure as azure\n\n example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")\n example_account = azure.storage.Account("exampleAccount",\n resource_group_name=example_resource_group.name,\n location=example_resource_group.location,\n account_tier="Standard",\n account_replication_type="LRS",\n account_kind="StorageV2",\n is_hns_enabled=True)\n example_data_lake_gen2_filesystem = azure.storage.DataLakeGen2Filesystem("exampleDataLakeGen2Filesystem", storage_account_id=example_account.id)\n example_workspace = azure.synapse.Workspace("exampleWorkspace",\n resource_group_name=example_resource_group.name,\n location=example_resource_group.location,\n storage_data_lake_gen2_filesystem_id=example_data_lake_gen2_filesystem.id,\n sql_administrator_login="sqladminuser",\n sql_administrator_login_password="H@Sh1CoR3!")\n example_firewall_rule = azure.synapse.FirewallRule("exampleFirewallRule",\n synapse_workspace_id=azurerm_synapse_workspace["test"]["id"],\n start_ip_address="0.0.0.0",\n end_ip_address="255.255.255.255")\n ```\n\n ## Import\n\n Synapse Firewall Rule can be imported using the `resource id`, e.g.\n\n ```sh\n $ pulumi import azure:synapse/firewallRule:FirewallRule example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourcegroup1/providers/Microsoft.Synapse/workspaces/workspace1/firewallRules/rule1\n ```\n\n :param str resource_name: The name of the resource.\n :param FirewallRuleArgs args: The arguments to use to populate this resource\'s properties.\n :param pulumi.ResourceOptions opts: Options for the resource.\n ' ...
@overload def __init__(__self__, resource_name: str, args: FirewallRuleArgs, opts: Optional[pulumi.ResourceOptions]=None): '\n Allows you to Manages a Synapse Firewall Rule.\n\n ## Example Usage\n\n ```python\n import pulumi\n import pulumi_azure as azure\n\n example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")\n example_account = azure.storage.Account("exampleAccount",\n resource_group_name=example_resource_group.name,\n location=example_resource_group.location,\n account_tier="Standard",\n account_replication_type="LRS",\n account_kind="StorageV2",\n is_hns_enabled=True)\n example_data_lake_gen2_filesystem = azure.storage.DataLakeGen2Filesystem("exampleDataLakeGen2Filesystem", storage_account_id=example_account.id)\n example_workspace = azure.synapse.Workspace("exampleWorkspace",\n resource_group_name=example_resource_group.name,\n location=example_resource_group.location,\n storage_data_lake_gen2_filesystem_id=example_data_lake_gen2_filesystem.id,\n sql_administrator_login="sqladminuser",\n sql_administrator_login_password="H@Sh1CoR3!")\n example_firewall_rule = azure.synapse.FirewallRule("exampleFirewallRule",\n synapse_workspace_id=azurerm_synapse_workspace["test"]["id"],\n start_ip_address="0.0.0.0",\n end_ip_address="255.255.255.255")\n ```\n\n ## Import\n\n Synapse Firewall Rule can be imported using the `resource id`, e.g.\n\n ```sh\n $ pulumi import azure:synapse/firewallRule:FirewallRule example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourcegroup1/providers/Microsoft.Synapse/workspaces/workspace1/firewallRules/rule1\n ```\n\n :param str resource_name: The name of the resource.\n :param FirewallRuleArgs args: The arguments to use to populate this resource\'s properties.\n :param pulumi.ResourceOptions opts: Options for the resource.\n ' ...<|docstring|>Allows you to Manages a Synapse Firewall Rule. ## Example Usage ```python import pulumi import pulumi_azure as azure example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe") example_account = azure.storage.Account("exampleAccount", resource_group_name=example_resource_group.name, location=example_resource_group.location, account_tier="Standard", account_replication_type="LRS", account_kind="StorageV2", is_hns_enabled=True) example_data_lake_gen2_filesystem = azure.storage.DataLakeGen2Filesystem("exampleDataLakeGen2Filesystem", storage_account_id=example_account.id) example_workspace = azure.synapse.Workspace("exampleWorkspace", resource_group_name=example_resource_group.name, location=example_resource_group.location, storage_data_lake_gen2_filesystem_id=example_data_lake_gen2_filesystem.id, sql_administrator_login="sqladminuser", sql_administrator_login_password="H@Sh1CoR3!") example_firewall_rule = azure.synapse.FirewallRule("exampleFirewallRule", synapse_workspace_id=azurerm_synapse_workspace["test"]["id"], start_ip_address="0.0.0.0", end_ip_address="255.255.255.255") ``` ## Import Synapse Firewall Rule can be imported using the `resource id`, e.g. ```sh $ pulumi import azure:synapse/firewallRule:FirewallRule example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourcegroup1/providers/Microsoft.Synapse/workspaces/workspace1/firewallRules/rule1 ``` :param str resource_name: The name of the resource. :param FirewallRuleArgs args: The arguments to use to populate this resource's properties. :param pulumi.ResourceOptions opts: Options for the resource.<|endoftext|>
cd626ae456890ede7733f0308d6b5b418df641740ffdb965c6769bd144d81db6
@staticmethod def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None, end_ip_address: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, start_ip_address: Optional[pulumi.Input[str]]=None, synapse_workspace_id: Optional[pulumi.Input[str]]=None) -> 'FirewallRule': "\n Get an existing FirewallRule resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n :param str resource_name: The unique name of the resulting resource.\n :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.\n :param pulumi.ResourceOptions opts: Options for the resource.\n :param pulumi.Input[str] end_ip_address: The ending IP address to allow through the firewall for this rule.\n :param pulumi.Input[str] name: The Name of the firewall rule. Changing this forces a new resource to be created.\n :param pulumi.Input[str] start_ip_address: The starting IP address to allow through the firewall for this rule.\n :param pulumi.Input[str] synapse_workspace_id: The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.\n " opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id)) __props__ = _FirewallRuleState.__new__(_FirewallRuleState) __props__.__dict__['end_ip_address'] = end_ip_address __props__.__dict__['name'] = name __props__.__dict__['start_ip_address'] = start_ip_address __props__.__dict__['synapse_workspace_id'] = synapse_workspace_id return FirewallRule(resource_name, opts=opts, __props__=__props__)
Get an existing FirewallRule resource's state with the given name, id, and optional extra properties used to qualify the lookup. :param str resource_name: The unique name of the resulting resource. :param pulumi.Input[str] id: The unique provider ID of the resource to lookup. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[str] end_ip_address: The ending IP address to allow through the firewall for this rule. :param pulumi.Input[str] name: The Name of the firewall rule. Changing this forces a new resource to be created. :param pulumi.Input[str] start_ip_address: The starting IP address to allow through the firewall for this rule. :param pulumi.Input[str] synapse_workspace_id: The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.
sdk/python/pulumi_azure/synapse/firewall_rule.py
get
henriktao/pulumi-azure
109
python
@staticmethod def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None, end_ip_address: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, start_ip_address: Optional[pulumi.Input[str]]=None, synapse_workspace_id: Optional[pulumi.Input[str]]=None) -> 'FirewallRule': "\n Get an existing FirewallRule resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n :param str resource_name: The unique name of the resulting resource.\n :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.\n :param pulumi.ResourceOptions opts: Options for the resource.\n :param pulumi.Input[str] end_ip_address: The ending IP address to allow through the firewall for this rule.\n :param pulumi.Input[str] name: The Name of the firewall rule. Changing this forces a new resource to be created.\n :param pulumi.Input[str] start_ip_address: The starting IP address to allow through the firewall for this rule.\n :param pulumi.Input[str] synapse_workspace_id: The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.\n " opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id)) __props__ = _FirewallRuleState.__new__(_FirewallRuleState) __props__.__dict__['end_ip_address'] = end_ip_address __props__.__dict__['name'] = name __props__.__dict__['start_ip_address'] = start_ip_address __props__.__dict__['synapse_workspace_id'] = synapse_workspace_id return FirewallRule(resource_name, opts=opts, __props__=__props__)
@staticmethod def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None, end_ip_address: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, start_ip_address: Optional[pulumi.Input[str]]=None, synapse_workspace_id: Optional[pulumi.Input[str]]=None) -> 'FirewallRule': "\n Get an existing FirewallRule resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n :param str resource_name: The unique name of the resulting resource.\n :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.\n :param pulumi.ResourceOptions opts: Options for the resource.\n :param pulumi.Input[str] end_ip_address: The ending IP address to allow through the firewall for this rule.\n :param pulumi.Input[str] name: The Name of the firewall rule. Changing this forces a new resource to be created.\n :param pulumi.Input[str] start_ip_address: The starting IP address to allow through the firewall for this rule.\n :param pulumi.Input[str] synapse_workspace_id: The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.\n " opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id)) __props__ = _FirewallRuleState.__new__(_FirewallRuleState) __props__.__dict__['end_ip_address'] = end_ip_address __props__.__dict__['name'] = name __props__.__dict__['start_ip_address'] = start_ip_address __props__.__dict__['synapse_workspace_id'] = synapse_workspace_id return FirewallRule(resource_name, opts=opts, __props__=__props__)<|docstring|>Get an existing FirewallRule resource's state with the given name, id, and optional extra properties used to qualify the lookup. :param str resource_name: The unique name of the resulting resource. :param pulumi.Input[str] id: The unique provider ID of the resource to lookup. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[str] end_ip_address: The ending IP address to allow through the firewall for this rule. :param pulumi.Input[str] name: The Name of the firewall rule. Changing this forces a new resource to be created. :param pulumi.Input[str] start_ip_address: The starting IP address to allow through the firewall for this rule. :param pulumi.Input[str] synapse_workspace_id: The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.<|endoftext|>
07b17ab18a2cc51a6a4ccc60a292ebd885a9223b301593a0775b590b21f7af1e
@property @pulumi.getter(name='endIpAddress') def end_ip_address(self) -> pulumi.Output[str]: '\n The ending IP address to allow through the firewall for this rule.\n ' return pulumi.get(self, 'end_ip_address')
The ending IP address to allow through the firewall for this rule.
sdk/python/pulumi_azure/synapse/firewall_rule.py
end_ip_address
henriktao/pulumi-azure
109
python
@property @pulumi.getter(name='endIpAddress') def end_ip_address(self) -> pulumi.Output[str]: '\n \n ' return pulumi.get(self, 'end_ip_address')
@property @pulumi.getter(name='endIpAddress') def end_ip_address(self) -> pulumi.Output[str]: '\n \n ' return pulumi.get(self, 'end_ip_address')<|docstring|>The ending IP address to allow through the firewall for this rule.<|endoftext|>
38fec59d157ad95b064833f07f4e9f0f0b4cb01e504dca8ebeb0c41e090258bf
@property @pulumi.getter def name(self) -> pulumi.Output[str]: '\n The Name of the firewall rule. Changing this forces a new resource to be created.\n ' return pulumi.get(self, 'name')
The Name of the firewall rule. Changing this forces a new resource to be created.
sdk/python/pulumi_azure/synapse/firewall_rule.py
name
henriktao/pulumi-azure
109
python
@property @pulumi.getter def name(self) -> pulumi.Output[str]: '\n \n ' return pulumi.get(self, 'name')
@property @pulumi.getter def name(self) -> pulumi.Output[str]: '\n \n ' return pulumi.get(self, 'name')<|docstring|>The Name of the firewall rule. Changing this forces a new resource to be created.<|endoftext|>
15d596442030962c535a3a1a6ce788bbd16eb07822fdd76cf9cac3a80f9c07ee
@property @pulumi.getter(name='startIpAddress') def start_ip_address(self) -> pulumi.Output[str]: '\n The starting IP address to allow through the firewall for this rule.\n ' return pulumi.get(self, 'start_ip_address')
The starting IP address to allow through the firewall for this rule.
sdk/python/pulumi_azure/synapse/firewall_rule.py
start_ip_address
henriktao/pulumi-azure
109
python
@property @pulumi.getter(name='startIpAddress') def start_ip_address(self) -> pulumi.Output[str]: '\n \n ' return pulumi.get(self, 'start_ip_address')
@property @pulumi.getter(name='startIpAddress') def start_ip_address(self) -> pulumi.Output[str]: '\n \n ' return pulumi.get(self, 'start_ip_address')<|docstring|>The starting IP address to allow through the firewall for this rule.<|endoftext|>
be3c48b2b7b398db1a5f56e2be4e542074da47d17d5ca24fbf0a7d58dfdae890
@property @pulumi.getter(name='synapseWorkspaceId') def synapse_workspace_id(self) -> pulumi.Output[str]: '\n The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.\n ' return pulumi.get(self, 'synapse_workspace_id')
The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.
sdk/python/pulumi_azure/synapse/firewall_rule.py
synapse_workspace_id
henriktao/pulumi-azure
109
python
@property @pulumi.getter(name='synapseWorkspaceId') def synapse_workspace_id(self) -> pulumi.Output[str]: '\n \n ' return pulumi.get(self, 'synapse_workspace_id')
@property @pulumi.getter(name='synapseWorkspaceId') def synapse_workspace_id(self) -> pulumi.Output[str]: '\n \n ' return pulumi.get(self, 'synapse_workspace_id')<|docstring|>The ID of the Synapse Workspace on which to create the Firewall Rule. Changing this forces a new resource to be created.<|endoftext|>
2639b4668bbd838b9072f5adf458ab634e0e494ca2dad9c69cdbfe4dbc736247
@pytest.fixture(scope='module') def configuration(): 'Create a system db, system and configuration.' db = SystemDB(filename='file:seamm_db?mode=memory&cache=shared') system = db.create_system(name='default') configuration = system.create_configuration(name='default') (yield configuration) db.close() try: del db except: print('Caught error deleting the database')
Create a system db, system and configuration.
tests/test_formats.py
configuration
paulsaxe/read_structure_step
0
python
@pytest.fixture(scope='module') def configuration(): db = SystemDB(filename='file:seamm_db?mode=memory&cache=shared') system = db.create_system(name='default') configuration = system.create_configuration(name='default') (yield configuration) db.close() try: del db except: print('Caught error deleting the database')
@pytest.fixture(scope='module') def configuration(): db = SystemDB(filename='file:seamm_db?mode=memory&cache=shared') system = db.create_system(name='default') configuration = system.create_configuration(name='default') (yield configuration) db.close() try: del db except: print('Caught error deleting the database')<|docstring|>Create a system db, system and configuration.<|endoftext|>
5d4e6c488ba30d4df39ac1e6a5dc14503e15162d7bc32a410546c946d73faba0
def prefilter_boxes(keypoints, skip_threshold=0.0): '\n Create dict with boxes stored by its label.\n\n Parameters\n ----------\n keypoints: np.array\n keypoints.\n skip_threshold: float \n threshold for skipping keypoints with low confedences.\n \n Returns\n -------\n new_keypoints: dict\n dict with keypoints stored by its label.\n ' new_keypoints = dict() for keypoint in keypoints: score = keypoint[3] if (score < skip_threshold): continue label = int(keypoint[2]) if (label not in new_keypoints): new_keypoints[label] = [] new_keypoints[label].append(keypoint) for k in new_keypoints: current_boxes = sorted(new_keypoints[k], key=(lambda x: x[3]), reverse=True) new_keypoints[k] = np.stack(current_boxes) return new_keypoints
Create dict with boxes stored by its label. Parameters ---------- keypoints: np.array keypoints. skip_threshold: float threshold for skipping keypoints with low confedences. Returns ------- new_keypoints: dict dict with keypoints stored by its label.
contextnet/utils/utils.py
prefilter_boxes
ushakovegor/ContextNetwork
0
python
def prefilter_boxes(keypoints, skip_threshold=0.0): '\n Create dict with boxes stored by its label.\n\n Parameters\n ----------\n keypoints: np.array\n keypoints.\n skip_threshold: float \n threshold for skipping keypoints with low confedences.\n \n Returns\n -------\n new_keypoints: dict\n dict with keypoints stored by its label.\n ' new_keypoints = dict() for keypoint in keypoints: score = keypoint[3] if (score < skip_threshold): continue label = int(keypoint[2]) if (label not in new_keypoints): new_keypoints[label] = [] new_keypoints[label].append(keypoint) for k in new_keypoints: current_boxes = sorted(new_keypoints[k], key=(lambda x: x[3]), reverse=True) new_keypoints[k] = np.stack(current_boxes) return new_keypoints
def prefilter_boxes(keypoints, skip_threshold=0.0): '\n Create dict with boxes stored by its label.\n\n Parameters\n ----------\n keypoints: np.array\n keypoints.\n skip_threshold: float \n threshold for skipping keypoints with low confedences.\n \n Returns\n -------\n new_keypoints: dict\n dict with keypoints stored by its label.\n ' new_keypoints = dict() for keypoint in keypoints: score = keypoint[3] if (score < skip_threshold): continue label = int(keypoint[2]) if (label not in new_keypoints): new_keypoints[label] = [] new_keypoints[label].append(keypoint) for k in new_keypoints: current_boxes = sorted(new_keypoints[k], key=(lambda x: x[3]), reverse=True) new_keypoints[k] = np.stack(current_boxes) return new_keypoints<|docstring|>Create dict with boxes stored by its label. Parameters ---------- keypoints: np.array keypoints. skip_threshold: float threshold for skipping keypoints with low confedences. Returns ------- new_keypoints: dict dict with keypoints stored by its label.<|endoftext|>
edbb456a14f54e577ad2fe2246e0a216f311547e534f12be83209f66d37ce277
def get_weighted_box(points, conf_type='avg'): '\n Create weighted box for set of boxes.\n\n Parameters\n ----------\n points: np.array\n one keypoint.\n conf_type: str\n the type of confidence.\n\n Returns\n -------\n box: np.array\n new keypoint.\n ' box = np.zeros(4, dtype=float) conf = 0 conf_list = [] for b in points: box[:2] += (b[3] * b[:2]) conf += b[3] conf_list.append(b[3]) box[2] = points[0][2] if (conf_type == 'avg'): box[3] = (conf / len(points)) elif (conf_type == 'max'): box[3] = np.array(conf_list).max() elif (conf_type in ['box_and_model_avg', 'absent_model_aware_avg']): box[3] = (conf / len(points)) box[:2] /= conf return box
Create weighted box for set of boxes. Parameters ---------- points: np.array one keypoint. conf_type: str the type of confidence. Returns ------- box: np.array new keypoint.
contextnet/utils/utils.py
get_weighted_box
ushakovegor/ContextNetwork
0
python
def get_weighted_box(points, conf_type='avg'): '\n Create weighted box for set of boxes.\n\n Parameters\n ----------\n points: np.array\n one keypoint.\n conf_type: str\n the type of confidence.\n\n Returns\n -------\n box: np.array\n new keypoint.\n ' box = np.zeros(4, dtype=float) conf = 0 conf_list = [] for b in points: box[:2] += (b[3] * b[:2]) conf += b[3] conf_list.append(b[3]) box[2] = points[0][2] if (conf_type == 'avg'): box[3] = (conf / len(points)) elif (conf_type == 'max'): box[3] = np.array(conf_list).max() elif (conf_type in ['box_and_model_avg', 'absent_model_aware_avg']): box[3] = (conf / len(points)) box[:2] /= conf return box
def get_weighted_box(points, conf_type='avg'): '\n Create weighted box for set of boxes.\n\n Parameters\n ----------\n points: np.array\n one keypoint.\n conf_type: str\n the type of confidence.\n\n Returns\n -------\n box: np.array\n new keypoint.\n ' box = np.zeros(4, dtype=float) conf = 0 conf_list = [] for b in points: box[:2] += (b[3] * b[:2]) conf += b[3] conf_list.append(b[3]) box[2] = points[0][2] if (conf_type == 'avg'): box[3] = (conf / len(points)) elif (conf_type == 'max'): box[3] = np.array(conf_list).max() elif (conf_type in ['box_and_model_avg', 'absent_model_aware_avg']): box[3] = (conf / len(points)) box[:2] /= conf return box<|docstring|>Create weighted box for set of boxes. Parameters ---------- points: np.array one keypoint. conf_type: str the type of confidence. Returns ------- box: np.array new keypoint.<|endoftext|>
7279056eaf700b49b5470fccff5103696ec6b562542c2798eccb3801f2c501e8
def find_matching_box(points, new_point, similarity, match_sim): '\n Compute similarity score between new points and all points to find most similar.\n\n Parameters\n ----------\n points: list\n The list of points for measering similarity.\n new_point: np.array\n The point which is wanted to match with one from points.\n similarity: func\n Similarity function.\n match_sim: float \n threshold for similarity.\n Returns\n -------\n best_index: int\n index of most similar point in points to new_point.\n best_sim: float\n value of similarity between best similar point and new_point.\n ' best_sim = match_sim best_index = (- 1) for i in range(len(points)): box = points[i] sim = float(similarity.measure(box[:2], new_point[:2])) if (sim > best_sim): best_index = i best_sim = sim return (best_index, best_sim)
Compute similarity score between new points and all points to find most similar. Parameters ---------- points: list The list of points for measering similarity. new_point: np.array The point which is wanted to match with one from points. similarity: func Similarity function. match_sim: float threshold for similarity. Returns ------- best_index: int index of most similar point in points to new_point. best_sim: float value of similarity between best similar point and new_point.
contextnet/utils/utils.py
find_matching_box
ushakovegor/ContextNetwork
0
python
def find_matching_box(points, new_point, similarity, match_sim): '\n Compute similarity score between new points and all points to find most similar.\n\n Parameters\n ----------\n points: list\n The list of points for measering similarity.\n new_point: np.array\n The point which is wanted to match with one from points.\n similarity: func\n Similarity function.\n match_sim: float \n threshold for similarity.\n Returns\n -------\n best_index: int\n index of most similar point in points to new_point.\n best_sim: float\n value of similarity between best similar point and new_point.\n ' best_sim = match_sim best_index = (- 1) for i in range(len(points)): box = points[i] sim = float(similarity.measure(box[:2], new_point[:2])) if (sim > best_sim): best_index = i best_sim = sim return (best_index, best_sim)
def find_matching_box(points, new_point, similarity, match_sim): '\n Compute similarity score between new points and all points to find most similar.\n\n Parameters\n ----------\n points: list\n The list of points for measering similarity.\n new_point: np.array\n The point which is wanted to match with one from points.\n similarity: func\n Similarity function.\n match_sim: float \n threshold for similarity.\n Returns\n -------\n best_index: int\n index of most similar point in points to new_point.\n best_sim: float\n value of similarity between best similar point and new_point.\n ' best_sim = match_sim best_index = (- 1) for i in range(len(points)): box = points[i] sim = float(similarity.measure(box[:2], new_point[:2])) if (sim > best_sim): best_index = i best_sim = sim return (best_index, best_sim)<|docstring|>Compute similarity score between new points and all points to find most similar. Parameters ---------- points: list The list of points for measering similarity. new_point: np.array The point which is wanted to match with one from points. similarity: func Similarity function. match_sim: float threshold for similarity. Returns ------- best_index: int index of most similar point in points to new_point. best_sim: float value of similarity between best similar point and new_point.<|endoftext|>
9fccf409fb5d6b610407428d13996837b9c243dd658876e74b06ffdc89c083d2
def WBF(keypoints, similarity, threshold, skip_threshold=0.0, conf_type='avg'): '\n Weighted Boxes Fusion method for matching keypoints.\n\n Parameters\n ----------\n keypoints: np.array\n input keypoints.\n similarity: func\n the function to measure similariry between keypoints.\n threshold: float\n threshold for similarity.\n skip_threshold: float\n the threshold to skip keypoints with low confidence.\n conf_type: str\n type of confidence.\n Returns\n -------\n match_keypoints: np.array\n matched keypoints.\n ' match_keypoints = [] filtered_keypoints = prefilter_boxes(keypoints, skip_threshold) for label in filtered_keypoints: points = filtered_keypoints[label] new_points = [] weighted_points = [] for j in range(0, len(points)): (index, best_sim) = find_matching_box(weighted_points, points[j], similarity, threshold) if (index != (- 1)): new_points[index].append(points[j]) weighted_points[index] = get_weighted_box(new_points[index], conf_type) else: new_points.append([points[j].copy()]) weighted_points.append(points[j].copy()) match_keypoints += weighted_points match_keypoints = np.stack(match_keypoints) return match_keypoints
Weighted Boxes Fusion method for matching keypoints. Parameters ---------- keypoints: np.array input keypoints. similarity: func the function to measure similariry between keypoints. threshold: float threshold for similarity. skip_threshold: float the threshold to skip keypoints with low confidence. conf_type: str type of confidence. Returns ------- match_keypoints: np.array matched keypoints.
contextnet/utils/utils.py
WBF
ushakovegor/ContextNetwork
0
python
def WBF(keypoints, similarity, threshold, skip_threshold=0.0, conf_type='avg'): '\n Weighted Boxes Fusion method for matching keypoints.\n\n Parameters\n ----------\n keypoints: np.array\n input keypoints.\n similarity: func\n the function to measure similariry between keypoints.\n threshold: float\n threshold for similarity.\n skip_threshold: float\n the threshold to skip keypoints with low confidence.\n conf_type: str\n type of confidence.\n Returns\n -------\n match_keypoints: np.array\n matched keypoints.\n ' match_keypoints = [] filtered_keypoints = prefilter_boxes(keypoints, skip_threshold) for label in filtered_keypoints: points = filtered_keypoints[label] new_points = [] weighted_points = [] for j in range(0, len(points)): (index, best_sim) = find_matching_box(weighted_points, points[j], similarity, threshold) if (index != (- 1)): new_points[index].append(points[j]) weighted_points[index] = get_weighted_box(new_points[index], conf_type) else: new_points.append([points[j].copy()]) weighted_points.append(points[j].copy()) match_keypoints += weighted_points match_keypoints = np.stack(match_keypoints) return match_keypoints
def WBF(keypoints, similarity, threshold, skip_threshold=0.0, conf_type='avg'): '\n Weighted Boxes Fusion method for matching keypoints.\n\n Parameters\n ----------\n keypoints: np.array\n input keypoints.\n similarity: func\n the function to measure similariry between keypoints.\n threshold: float\n threshold for similarity.\n skip_threshold: float\n the threshold to skip keypoints with low confidence.\n conf_type: str\n type of confidence.\n Returns\n -------\n match_keypoints: np.array\n matched keypoints.\n ' match_keypoints = [] filtered_keypoints = prefilter_boxes(keypoints, skip_threshold) for label in filtered_keypoints: points = filtered_keypoints[label] new_points = [] weighted_points = [] for j in range(0, len(points)): (index, best_sim) = find_matching_box(weighted_points, points[j], similarity, threshold) if (index != (- 1)): new_points[index].append(points[j]) weighted_points[index] = get_weighted_box(new_points[index], conf_type) else: new_points.append([points[j].copy()]) weighted_points.append(points[j].copy()) match_keypoints += weighted_points match_keypoints = np.stack(match_keypoints) return match_keypoints<|docstring|>Weighted Boxes Fusion method for matching keypoints. Parameters ---------- keypoints: np.array input keypoints. similarity: func the function to measure similariry between keypoints. threshold: float threshold for similarity. skip_threshold: float the threshold to skip keypoints with low confidence. conf_type: str type of confidence. Returns ------- match_keypoints: np.array matched keypoints.<|endoftext|>