hexsha string | size int64 | ext string | lang string | max_stars_repo_path string | max_stars_repo_name string | max_stars_repo_head_hexsha string | max_stars_repo_licenses list | max_stars_count int64 | max_stars_repo_stars_event_min_datetime string | max_stars_repo_stars_event_max_datetime string | max_issues_repo_path string | max_issues_repo_name string | max_issues_repo_head_hexsha string | max_issues_repo_licenses list | max_issues_count int64 | max_issues_repo_issues_event_min_datetime string | max_issues_repo_issues_event_max_datetime string | max_forks_repo_path string | max_forks_repo_name string | max_forks_repo_head_hexsha string | max_forks_repo_licenses list | max_forks_count int64 | max_forks_repo_forks_event_min_datetime string | max_forks_repo_forks_event_max_datetime string | content string | avg_line_length float64 | max_line_length int64 | alphanum_fraction float64 | qsc_code_num_words_quality_signal int64 | qsc_code_num_chars_quality_signal float64 | qsc_code_mean_word_length_quality_signal float64 | qsc_code_frac_words_unique_quality_signal float64 | qsc_code_frac_chars_top_2grams_quality_signal float64 | qsc_code_frac_chars_top_3grams_quality_signal float64 | qsc_code_frac_chars_top_4grams_quality_signal float64 | qsc_code_frac_chars_dupe_5grams_quality_signal float64 | qsc_code_frac_chars_dupe_6grams_quality_signal float64 | qsc_code_frac_chars_dupe_7grams_quality_signal float64 | qsc_code_frac_chars_dupe_8grams_quality_signal float64 | qsc_code_frac_chars_dupe_9grams_quality_signal float64 | qsc_code_frac_chars_dupe_10grams_quality_signal float64 | qsc_code_frac_chars_replacement_symbols_quality_signal float64 | qsc_code_frac_chars_digital_quality_signal float64 | qsc_code_frac_chars_whitespace_quality_signal float64 | qsc_code_size_file_byte_quality_signal float64 | qsc_code_num_lines_quality_signal float64 | qsc_code_num_chars_line_max_quality_signal float64 | qsc_code_num_chars_line_mean_quality_signal float64 | qsc_code_frac_chars_alphabet_quality_signal float64 | qsc_code_frac_chars_comments_quality_signal float64 | qsc_code_cate_xml_start_quality_signal float64 | qsc_code_frac_lines_dupe_lines_quality_signal float64 | qsc_code_cate_autogen_quality_signal float64 | qsc_code_frac_lines_long_string_quality_signal float64 | qsc_code_frac_chars_string_length_quality_signal float64 | qsc_code_frac_chars_long_word_length_quality_signal float64 | qsc_code_frac_lines_string_concat_quality_signal float64 | qsc_code_cate_encoded_data_quality_signal float64 | qsc_code_frac_chars_hex_words_quality_signal float64 | qsc_code_frac_lines_prompt_comments_quality_signal float64 | qsc_code_frac_lines_assert_quality_signal float64 | qsc_codepython_cate_ast_quality_signal float64 | qsc_codepython_frac_lines_func_ratio_quality_signal float64 | qsc_codepython_cate_var_zero_quality_signal bool | qsc_codepython_frac_lines_pass_quality_signal float64 | qsc_codepython_frac_lines_import_quality_signal float64 | qsc_codepython_frac_lines_simplefunc_quality_signal float64 | qsc_codepython_score_lines_no_logic_quality_signal float64 | qsc_codepython_frac_lines_print_quality_signal float64 | qsc_code_num_words int64 | qsc_code_num_chars int64 | qsc_code_mean_word_length int64 | qsc_code_frac_words_unique null | qsc_code_frac_chars_top_2grams int64 | qsc_code_frac_chars_top_3grams int64 | qsc_code_frac_chars_top_4grams int64 | qsc_code_frac_chars_dupe_5grams int64 | qsc_code_frac_chars_dupe_6grams int64 | qsc_code_frac_chars_dupe_7grams int64 | qsc_code_frac_chars_dupe_8grams int64 | qsc_code_frac_chars_dupe_9grams int64 | qsc_code_frac_chars_dupe_10grams int64 | qsc_code_frac_chars_replacement_symbols int64 | qsc_code_frac_chars_digital int64 | qsc_code_frac_chars_whitespace int64 | qsc_code_size_file_byte int64 | qsc_code_num_lines int64 | qsc_code_num_chars_line_max int64 | qsc_code_num_chars_line_mean int64 | qsc_code_frac_chars_alphabet int64 | qsc_code_frac_chars_comments int64 | qsc_code_cate_xml_start int64 | qsc_code_frac_lines_dupe_lines int64 | qsc_code_cate_autogen int64 | qsc_code_frac_lines_long_string int64 | qsc_code_frac_chars_string_length int64 | qsc_code_frac_chars_long_word_length int64 | qsc_code_frac_lines_string_concat null | qsc_code_cate_encoded_data int64 | qsc_code_frac_chars_hex_words int64 | qsc_code_frac_lines_prompt_comments int64 | qsc_code_frac_lines_assert int64 | qsc_codepython_cate_ast int64 | qsc_codepython_frac_lines_func_ratio int64 | qsc_codepython_cate_var_zero int64 | qsc_codepython_frac_lines_pass int64 | qsc_codepython_frac_lines_import int64 | qsc_codepython_frac_lines_simplefunc int64 | qsc_codepython_score_lines_no_logic int64 | qsc_codepython_frac_lines_print int64 | effective string | hits int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4d3d8fc2911f183a7020c9cab6743e3ac5587a77 | 2,089 | py | Python | plyer/facades/vibrator.py | malverick/noti_improve | c8b379285e0de041f2133ec4d22b0affdf4a993e | [
"MIT"
] | null | null | null | plyer/facades/vibrator.py | malverick/noti_improve | c8b379285e0de041f2133ec4d22b0affdf4a993e | [
"MIT"
] | null | null | null | plyer/facades/vibrator.py | malverick/noti_improve | c8b379285e0de041f2133ec4d22b0affdf4a993e | [
"MIT"
] | null | null | null | '''
Vibrator
=======
The :class:`Vibrator` provides access to public methods to use vibrator of your
device.
.. note::
On Android your app needs the VIBRATE permission to
access the vibrator.
Simple Examples
---------------
To vibrate your device::
>>> from plyer import vibrator
>>> time=2
>>> vibrator.vibrate(time=time)
To set a pattern::
>>> vibrator.pattern(pattern=pattern, repeat=repeat)
To know whether vibrator exists or not::
>>> vibrator.exists()
To cancel vibration::
>>> vibrator.cancel()
'''
class Vibrator(object):
'''Vibration facade.
'''
def vibrate(self, time=1):
'''Ask the vibrator to vibrate for the given period.
:param time: Time to vibrate for, in seconds. Default is 1.
'''
self._vibrate(time=time)
def _vibrate(self, **kwargs):
raise NotImplementedError()
def pattern(self, pattern=(0, 1), repeat=-1):
'''Ask the vibrator to vibrate with the given pattern, with an
optional repeat.
:param pattern: Pattern to vibrate with. Should be a list of
times in seconds. The first number is how long to wait
before vibrating, and subsequent numbers are times to
vibrate and not vibrate alternately.
Defaults to ``[0, 1]``.
:param repeat: Index at which to repeat the pattern. When the
vibration pattern reaches this index, it will start again
from the beginning. Defaults to ``-1``, which means no
repeat.
'''
self._pattern(pattern=pattern, repeat=repeat)
def _pattern(self, **kwargs):
raise NotImplementedError()
def exists(self):
'''Check if the device has a vibrator. Returns True or
False.
'''
return self._exists()
def _exists(self, **kwargs):
raise NotImplementedError()
def cancel(self):
'''Cancels any current vibration, and stops the vibrator.'''
self._cancel()
def _cancel(self, **kwargs):
raise NotImplementedError()
| 24.576471 | 79 | 0.615606 | 252 | 2,089 | 5.071429 | 0.392857 | 0.042254 | 0.046948 | 0.106416 | 0.176056 | 0.037559 | 0 | 0 | 0 | 0 | 0 | 0.005964 | 0.277645 | 2,089 | 84 | 80 | 24.869048 | 0.840954 | 0.626616 | 0 | 0.235294 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.470588 | false | 0 | 0 | 0 | 0.588235 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
4d4813a0cabd30326685371980d32fe263667279 | 18,637 | py | Python | pysnmp-with-texts/ONEACCESS-SYS-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 8 | 2019-05-09T17:04:00.000Z | 2021-06-09T06:50:51.000Z | pysnmp-with-texts/ONEACCESS-SYS-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 4 | 2019-05-31T16:42:59.000Z | 2020-01-31T21:57:17.000Z | pysnmp-with-texts/ONEACCESS-SYS-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 10 | 2019-04-30T05:51:36.000Z | 2022-02-16T03:33:41.000Z | #
# PySNMP MIB module ONEACCESS-SYS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ONEACCESS-SYS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:34:42 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint", "SingleValueConstraint")
oacExpIMSystem, oacMIBModules = mibBuilder.importSymbols("ONEACCESS-GLOBAL-REG", "oacExpIMSystem", "oacMIBModules")
NotificationGroup, ObjectGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ObjectGroup", "ModuleCompliance")
ModuleIdentity, TimeTicks, ObjectIdentity, Unsigned32, MibIdentifier, iso, Counter64, Counter32, Integer32, NotificationType, Bits, MibScalar, MibTable, MibTableRow, MibTableColumn, Gauge32, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "TimeTicks", "ObjectIdentity", "Unsigned32", "MibIdentifier", "iso", "Counter64", "Counter32", "Integer32", "NotificationType", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Gauge32", "IpAddress")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
oacSysMIBModule = ModuleIdentity((1, 3, 6, 1, 4, 1, 13191, 1, 100, 671))
oacSysMIBModule.setRevisions(('2014-05-05 00:01', '2011-06-15 00:00', '2010-12-14 00:01', '2010-08-11 10:00', '2010-07-08 10:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: oacSysMIBModule.setRevisionsDescriptions(('Contact updated', 'oacExpIMSysFactory OID updated', 'Add objects for Factory area description.', 'Fixed minor corrections. changed oacExpIMSysHwcDescription type from OCTET STRING to DisplayString.', 'This MIB module describes system Management objects.',))
if mibBuilder.loadTexts: oacSysMIBModule.setLastUpdated('201405050001Z')
if mibBuilder.loadTexts: oacSysMIBModule.setOrganization(' OneAccess ')
if mibBuilder.loadTexts: oacSysMIBModule.setContactInfo('Pascal KESTELOOT Postal: ONE ACCESS 381 Avenue du Gnral de Gaulle 92140 Clamart, France FRANCE Tel: (+33) 01 41 87 70 00 Fax: (+33) 01 41 87 74 00 E-mail: pascal.kesteloot@oneaccess-net.com')
if mibBuilder.loadTexts: oacSysMIBModule.setDescription('Add Cpu usage table for multicore HW')
class OASysHwcClass(TextualConvention, Integer32):
description = 'The object specify the class of OASysHwc'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2))
namedValues = NamedValues(("board", 0), ("cpu", 1), ("slot", 2))
class OASysHwcType(TextualConvention, Integer32):
description = 'The object specify the type of OASysHwc'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6))
namedValues = NamedValues(("mainboard", 0), ("microprocessor", 1), ("ram", 2), ("flash", 3), ("dsp", 4), ("uplink", 5), ("module", 6))
class OASysCoreType(TextualConvention, Integer32):
description = 'The object specify the type of Core usage'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3))
namedValues = NamedValues(("controlplane", 0), ("dataforwarding", 1), ("application", 2), ("mixed", 3))
oacExpIMSysStatistics = MibIdentifier((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1))
oacExpIMSysHardwareDescription = MibIdentifier((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2))
oacSysMemStatistics = MibIdentifier((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 1))
oacSysCpuStatistics = MibIdentifier((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 2))
oacSysSecureCrashlogCount = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 100), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacSysSecureCrashlogCount.setStatus('current')
if mibBuilder.loadTexts: oacSysSecureCrashlogCount.setDescription('The number of avaiable crash logs')
oacSysStartCaused = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 200), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacSysStartCaused.setStatus('current')
if mibBuilder.loadTexts: oacSysStartCaused.setDescription('Cause of system start')
oacSysIMSysMainBoard = MibIdentifier((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 1))
oacExpIMSysHwComponents = MibIdentifier((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 2))
oacExpIMSysFactory = MibIdentifier((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 3))
oacSysIMSysMainIdentifier = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 1, 1), ObjectIdentifier()).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacSysIMSysMainIdentifier.setStatus('current')
if mibBuilder.loadTexts: oacSysIMSysMainIdentifier.setDescription("The vendor's authoritative identification of the main board. This value is allocated within the SMI enterprise subtree")
oacSysIMSysMainManufacturedIdentity = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacSysIMSysMainManufacturedIdentity.setStatus('current')
if mibBuilder.loadTexts: oacSysIMSysMainManufacturedIdentity.setDescription("Unique ID string self to each equipment. By default, it is retrieved from the manufacturer of the equipment. Can also be configure by CLI ( see command 'snmp chassis-id') for customer purposes")
oacSysIMSysMainManufacturedDate = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacSysIMSysMainManufacturedDate.setStatus('current')
if mibBuilder.loadTexts: oacSysIMSysMainManufacturedDate.setDescription('the date of the manufacturing of the equipment')
oacSysIMSysMainCPU = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacSysIMSysMainCPU.setStatus('current')
if mibBuilder.loadTexts: oacSysIMSysMainCPU.setDescription('Description of the main CPU used on the main board')
oacSysIMSysMainBSPVersion = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 1, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacSysIMSysMainBSPVersion.setStatus('current')
if mibBuilder.loadTexts: oacSysIMSysMainBSPVersion.setDescription('the current BSP version supported on the equipment')
oacSysIMSysMainBootVersion = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 1, 6), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacSysIMSysMainBootVersion.setStatus('current')
if mibBuilder.loadTexts: oacSysIMSysMainBootVersion.setDescription('the current boot version supported on the equipment')
oacSysIMSysMainBootDateCreation = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 1, 7), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacSysIMSysMainBootDateCreation.setStatus('current')
if mibBuilder.loadTexts: oacSysIMSysMainBootDateCreation.setDescription('the date the current boot version has been generated')
oacSysMemoryFree = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 1, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacSysMemoryFree.setStatus('current')
if mibBuilder.loadTexts: oacSysMemoryFree.setDescription('The number of bytes in free memory ')
oacSysMemoryAllocated = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 1, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacSysMemoryAllocated.setStatus('current')
if mibBuilder.loadTexts: oacSysMemoryAllocated.setDescription('The number of bytes in allocated memory ')
oacSysMemoryTotal = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 1, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacSysMemoryTotal.setStatus('current')
if mibBuilder.loadTexts: oacSysMemoryTotal.setDescription('Total number of bytes in the system memory partition ')
oacSysMemoryUsed = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacSysMemoryUsed.setStatus('current')
if mibBuilder.loadTexts: oacSysMemoryUsed.setDescription('Used memory expressed in percent of the total memory size ')
oacSysCpuUsed = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 2, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacSysCpuUsed.setStatus('current')
if mibBuilder.loadTexts: oacSysCpuUsed.setDescription('Used cpu in percent ')
oacSysCpuUsedCoresCount = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 2, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacSysCpuUsedCoresCount.setStatus('current')
if mibBuilder.loadTexts: oacSysCpuUsedCoresCount.setDescription('The number of Cores for the equipment')
oacSysCpuUsedCoresTable = MibTable((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 2, 3), )
if mibBuilder.loadTexts: oacSysCpuUsedCoresTable.setStatus('current')
if mibBuilder.loadTexts: oacSysCpuUsedCoresTable.setDescription('Table for Oneaccess hardware Cores')
oacSysCpuUsedCoresEntry = MibTableRow((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 2, 3, 1), ).setIndexNames((0, "ONEACCESS-SYS-MIB", "oacSysCpuUsedIndex"))
if mibBuilder.loadTexts: oacSysCpuUsedCoresEntry.setStatus('current')
if mibBuilder.loadTexts: oacSysCpuUsedCoresEntry.setDescription('Table entry for a hardware Core')
oacSysCpuUsedIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 2, 3, 1, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacSysCpuUsedIndex.setStatus('current')
if mibBuilder.loadTexts: oacSysCpuUsedIndex.setDescription('Core index')
oacSysCpuUsedCoreType = MibTableColumn((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 2, 3, 1, 2), OASysCoreType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacSysCpuUsedCoreType.setStatus('current')
if mibBuilder.loadTexts: oacSysCpuUsedCoreType.setDescription('Type of the core')
oacSysCpuUsedValue = MibTableColumn((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 2, 3, 1, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacSysCpuUsedValue.setStatus('current')
if mibBuilder.loadTexts: oacSysCpuUsedValue.setDescription('Used cpu in percent : equivalent for core 0 to the oacSysCpuUsed object. This is the current value')
oacSysCpuUsedOneMinuteValue = MibTableColumn((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 2, 3, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacSysCpuUsedOneMinuteValue.setStatus('current')
if mibBuilder.loadTexts: oacSysCpuUsedOneMinuteValue.setDescription('Cpu load for the last minute period')
oacSysLastRebootCause = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 3), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacSysLastRebootCause.setStatus('current')
if mibBuilder.loadTexts: oacSysLastRebootCause.setDescription('To display the cause for the last reboot.')
oacExpIMSysHwComponentsCount = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 2, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacExpIMSysHwComponentsCount.setStatus('current')
if mibBuilder.loadTexts: oacExpIMSysHwComponentsCount.setDescription('The number of components for the equipment')
oacExpIMSysHwComponentsTable = MibTable((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 2, 2), )
if mibBuilder.loadTexts: oacExpIMSysHwComponentsTable.setStatus('current')
if mibBuilder.loadTexts: oacExpIMSysHwComponentsTable.setDescription('Table for Oneaccess hardware components')
oacExpIMSysHwComponentsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 2, 2, 1), ).setIndexNames((0, "ONEACCESS-SYS-MIB", "oacExpIMSysHwcIndex"))
if mibBuilder.loadTexts: oacExpIMSysHwComponentsEntry.setStatus('current')
if mibBuilder.loadTexts: oacExpIMSysHwComponentsEntry.setDescription('Table entry for a hardware component')
oacExpIMSysHwcIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 2, 2, 1, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacExpIMSysHwcIndex.setStatus('current')
if mibBuilder.loadTexts: oacExpIMSysHwcIndex.setDescription('Component index')
oacExpIMSysHwcClass = MibTableColumn((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 2, 2, 1, 2), OASysHwcClass()).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacExpIMSysHwcClass.setStatus('current')
if mibBuilder.loadTexts: oacExpIMSysHwcClass.setDescription('Class of the component')
oacExpIMSysHwcType = MibTableColumn((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 2, 2, 1, 3), OASysHwcType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacExpIMSysHwcType.setStatus('current')
if mibBuilder.loadTexts: oacExpIMSysHwcType.setDescription('Type of the component')
oacExpIMSysHwcDescription = MibTableColumn((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 2, 2, 1, 4), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacExpIMSysHwcDescription.setStatus('current')
if mibBuilder.loadTexts: oacExpIMSysHwcDescription.setDescription('Component description, identifies the component')
oacExpIMSysHwcSerialNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 2, 2, 1, 5), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacExpIMSysHwcSerialNumber.setStatus('current')
if mibBuilder.loadTexts: oacExpIMSysHwcSerialNumber.setDescription("Component's serial number")
oacExpIMSysHwcManufacturer = MibTableColumn((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 2, 2, 1, 6), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacExpIMSysHwcManufacturer.setStatus('current')
if mibBuilder.loadTexts: oacExpIMSysHwcManufacturer.setDescription('Component manufacturer')
oacExpIMSysHwcManufacturedDate = MibTableColumn((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 2, 2, 1, 7), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 10))).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacExpIMSysHwcManufacturedDate.setStatus('current')
if mibBuilder.loadTexts: oacExpIMSysHwcManufacturedDate.setDescription("Component's manufacturing date")
oacExpIMSysHwcProductName = MibTableColumn((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 2, 2, 1, 8), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacExpIMSysHwcProductName.setStatus('current')
if mibBuilder.loadTexts: oacExpIMSysHwcProductName.setDescription('The Product name')
oacExpIMSysFactorySupplierID = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 3, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 14))).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacExpIMSysFactorySupplierID.setStatus('current')
if mibBuilder.loadTexts: oacExpIMSysFactorySupplierID.setDescription('Supplier ID. Mapped to Mid field of product-info-area. String is empty if Mid field is not included in product-info-area.')
oacExpIMSysFactoryProductSalesCode = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 3, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 22))).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacExpIMSysFactoryProductSalesCode.setStatus('current')
if mibBuilder.loadTexts: oacExpIMSysFactoryProductSalesCode.setDescription('OA Product Sales Code. Mapped to Mcode field of product-info-area. String is empty if Mcode field is not included in product-info-area.')
oacExpIMSysFactoryHwRevision = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 3, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(2, 7))).setMaxAccess("readonly")
if mibBuilder.loadTexts: oacExpIMSysFactoryHwRevision.setStatus('current')
if mibBuilder.loadTexts: oacExpIMSysFactoryHwRevision.setDescription('Hardware Revision. Mapped to Mrevision field of product-info-area. String is empty if Mrevision field is not included in product-info-area.')
mibBuilder.exportSymbols("ONEACCESS-SYS-MIB", oacSysCpuUsedCoresCount=oacSysCpuUsedCoresCount, oacSysIMSysMainBSPVersion=oacSysIMSysMainBSPVersion, oacExpIMSysHwcIndex=oacExpIMSysHwcIndex, oacSysIMSysMainIdentifier=oacSysIMSysMainIdentifier, oacExpIMSysHwcType=oacExpIMSysHwcType, oacSysMemoryUsed=oacSysMemoryUsed, oacSysIMSysMainManufacturedIdentity=oacSysIMSysMainManufacturedIdentity, oacExpIMSysHwComponents=oacExpIMSysHwComponents, oacSysCpuUsedOneMinuteValue=oacSysCpuUsedOneMinuteValue, oacExpIMSysHwComponentsTable=oacExpIMSysHwComponentsTable, oacExpIMSysStatistics=oacExpIMSysStatistics, oacSysStartCaused=oacSysStartCaused, oacSysMemoryAllocated=oacSysMemoryAllocated, oacExpIMSysFactoryProductSalesCode=oacExpIMSysFactoryProductSalesCode, oacSysMIBModule=oacSysMIBModule, OASysCoreType=OASysCoreType, oacSysMemStatistics=oacSysMemStatistics, oacSysIMSysMainManufacturedDate=oacSysIMSysMainManufacturedDate, oacSysCpuUsedCoresTable=oacSysCpuUsedCoresTable, oacExpIMSysHardwareDescription=oacExpIMSysHardwareDescription, oacSysMemoryTotal=oacSysMemoryTotal, oacSysIMSysMainBootDateCreation=oacSysIMSysMainBootDateCreation, oacExpIMSysHwComponentsEntry=oacExpIMSysHwComponentsEntry, oacSysIMSysMainCPU=oacSysIMSysMainCPU, oacExpIMSysHwcProductName=oacExpIMSysHwcProductName, oacSysCpuStatistics=oacSysCpuStatistics, oacExpIMSysHwcManufacturedDate=oacExpIMSysHwcManufacturedDate, oacSysIMSysMainBoard=oacSysIMSysMainBoard, oacExpIMSysFactorySupplierID=oacExpIMSysFactorySupplierID, oacExpIMSysHwcSerialNumber=oacExpIMSysHwcSerialNumber, OASysHwcType=OASysHwcType, oacSysCpuUsedCoreType=oacSysCpuUsedCoreType, oacSysLastRebootCause=oacSysLastRebootCause, oacSysCpuUsedCoresEntry=oacSysCpuUsedCoresEntry, oacExpIMSysHwcDescription=oacExpIMSysHwcDescription, oacSysCpuUsedIndex=oacSysCpuUsedIndex, oacExpIMSysHwcClass=oacExpIMSysHwcClass, oacExpIMSysFactoryHwRevision=oacExpIMSysFactoryHwRevision, oacSysMemoryFree=oacSysMemoryFree, oacExpIMSysHwComponentsCount=oacExpIMSysHwComponentsCount, oacSysCpuUsed=oacSysCpuUsed, oacSysCpuUsedValue=oacSysCpuUsedValue, oacSysIMSysMainBootVersion=oacSysIMSysMainBootVersion, oacSysSecureCrashlogCount=oacSysSecureCrashlogCount, oacExpIMSysHwcManufacturer=oacExpIMSysHwcManufacturer, OASysHwcClass=OASysHwcClass, oacExpIMSysFactory=oacExpIMSysFactory, PYSNMP_MODULE_ID=oacSysMIBModule)
| 117.955696 | 2,330 | 0.790095 | 2,052 | 18,637 | 7.174951 | 0.163255 | 0.062759 | 0.109828 | 0.011954 | 0.42763 | 0.278204 | 0.246757 | 0.235142 | 0.192624 | 0.176798 | 0 | 0.064615 | 0.088212 | 18,637 | 157 | 2,331 | 118.707006 | 0.801801 | 0.017599 | 0 | 0.020548 | 0 | 0.034247 | 0.204317 | 0.005628 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.047945 | 0 | 0.150685 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4d49c36180b4a2214801da1aa96429fd3625ac8b | 751 | py | Python | s/Hyp.py | BobNobrain/matstat-labs | bf7c95b29a6dc8b65675a780871400fd729f9e35 | [
"MIT"
] | null | null | null | s/Hyp.py | BobNobrain/matstat-labs | bf7c95b29a6dc8b65675a780871400fd729f9e35 | [
"MIT"
] | null | null | null | s/Hyp.py | BobNobrain/matstat-labs | bf7c95b29a6dc8b65675a780871400fd729f9e35 | [
"MIT"
] | 7 | 2018-11-18T06:31:49.000Z | 2020-11-09T18:36:40.000Z | from enum import Enum
class AltHypKind(Enum):
LEFT = -1
RIGHT = 1
TWO_SIDED = 0
class Hyp(object):
dist = None
kind = None
def __init__(self, dist, kind=AltHypKind.TWO_SIDED):
self.dist = dist
self.kind = kind
def critical_values(self, alpha):
level = alpha / 2 if self.kind == AltHypKind.TWO_SIDED else alpha
return self.dist.ppf(level), self.dist.ppf(1 - level)
def p_value(self, criterion_value):
left_p = self.dist.cdf(criterion_value)
if self.kind == AltHypKind.LEFT:
return left_p
if self.kind == AltHypKind.RIGHT:
return 1 - left_p
if self.kind == AltHypKind.TWO_SIDED:
return 2 * min(left_p, 1 - left_p)
| 25.033333 | 73 | 0.60719 | 105 | 751 | 4.180952 | 0.314286 | 0.091116 | 0.091116 | 0.182232 | 0.1959 | 0.1959 | 0 | 0 | 0 | 0 | 0 | 0.015123 | 0.295606 | 751 | 29 | 74 | 25.896552 | 0.814745 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.136364 | false | 0 | 0.045455 | 0 | 0.681818 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
4d5555918222b2e2e98c3bab1dcc9b6dfeb01603 | 96,548 | py | Python | pygl_nf/GL.py | dedisvoin/Pygl | dc42fbeed647d1ffdaed56a7d168a98fc75836b2 | [
"Apache-2.0"
] | null | null | null | pygl_nf/GL.py | dedisvoin/Pygl | dc42fbeed647d1ffdaed56a7d168a98fc75836b2 | [
"Apache-2.0"
] | null | null | null | pygl_nf/GL.py | dedisvoin/Pygl | dc42fbeed647d1ffdaed56a7d168a98fc75836b2 | [
"Apache-2.0"
] | null | null | null |
from ast import Str
from tkinter.messagebox import NO
from xmlrpc.client import TRANSPORT_ERROR
import colorama
import sys
from pyclbr import Function
import py
import pygame.gfxdraw
import pygame_widgets
import pygame
import keyboard
import math
import time
import random
import mouse
import pygame.camera
from pygame_widgets.slider import Slider
from pygame_widgets.textbox import TextBox
from pygame_widgets.button import Button
from pygame_widgets.toggle import Toggle
from pygame_widgets.dropdown import Dropdown
start_time = 0
anim_time = 1
pygame.init()
def Get_CAM_zvt_prost():
return ['RGB','HSV','YUV']
def Mod(num):
if num < 0:num = -num
return num
def Get_GRPgraph_wersion():
print(colorama.Fore.BLUE+'GRPgraph version (16.8)'+colorama.Fore.RESET)
def Get_fonts():
return pygame.font.get_fonts()
# 1
class Vec2_:
def __init__(self,vect2d_start=[-1],vect2d_end=[-1],pos=[0,0]):
if vect2d_start[0]!=-1 and vect2d_end[0]!=-1:
self.vect2d_start = vect2d_start
self.vect2d_end = vect2d_end
self.vec2D = [self.vect2d_start,self.vect2d_end]
self.x = vect2d_end[0]-vect2d_start[0]
self.y = vect2d_end[1]-vect2d_start[1]
else:
self.x = pos[0]
self.y = pos[1]
self.size = int(math.sqrt(self.x**2+self.y**2))
self.absv = Mod(self.size)
self.pos1 = [self.x,self.y]
def RAV_2D(self,vector2D):
parperx_st_ = int(vector2D.vect2d_start[0]-self.vect2d_start[0])
parperx_en_ = int(vector2D.vect2d_end[0]-self.vect2d_end[0])
parpery_st_ = int(vector2D.vect2d_start[1]-self.vect2d_start[1])
parpery_en_ = int(vector2D.vect2d_end[1]-self.vect2d_end[1])
if Mod(parperx_st_) == Mod(parperx_en_) and Mod(parpery_st_) == Mod(parpery_en_):
return True
else:
return False
def POV_2D(self,ugl):
pos = [int(self.x*math.cos(ugl)-self.y*math.sin(ugl)),int(self.y*math.cos(ugl)+self.x*math.sin(ugl))]
vec3 = Vec2_(pos=pos)
return vec3
def SUM(self,vector2D):
pos=[self.x+vector2D.x,self.y+vector2D.y]
vec3 = Vec2_(pos=pos)
return vec3
def RAZ(self,vector2D):
pos=[self.x-vector2D.x,self.y-vector2D.y]
vec3 = Vec2_(pos=pos)
return vec3
def UMN(self,delta):
pos=[self.x*delta,self.y*delta]
vec3 = Vec2_(pos=pos)
return vec3
def SCAL(self,vector2D):
scl = self.x*vector2D.x+self.y*vector2D.y
return scl
def NUL(self):
if self.vect2d_end==self.vect2d_start:return True
else:return False
def NAP(self,vector2D):
parperx_st_ = int(vector2D.vect2d_start[0]-self.vect2d_start[0])
parperx_en_ = int(vector2D.vect2d_end[0]-self.vect2d_end[0])
parpery_st_ = int(vector2D.vect2d_start[1]-self.vect2d_start[1])
parpery_en_ = int(vector2D.vect2d_end[1]-self.vect2d_end[1])
if parperx_en_ == parperx_st_ and parpery_en_ == parpery_st_ :
return True
else:
return False
# 2
class Surfases_:
def __init__(self,size=[],pos=[0,0],color=(200,200,200),alpha=0):
self.screen = pygame.Surface((size[0],size[1]))
self.screen.fill(color)
self.color = color
self.size = size
self.alpha = alpha
self.pos = pos
if self.alpha > 255:self.alpha=255
if self.alpha < 0:self.alpha=0
self.screen.set_alpha(self.alpha)
def SET_ALPHA(self,al):
if al > 255:al=255
if al < 0:al=0
self.screen.set_alpha(al)
def GET_PIXEL_COLOR(self,pos):
col = self.screen.get_at(pos)
return [col[0],col[1],col[2]]
def DRAW_SURF_ON_SCREEN(self,screen_surf,pos=None):
if pos!=None:self.pos = pos
screen_surf.blit(self.screen,(self.pos[0],self.pos[1]))
def SAVE_SURF(self,filename):
pygame.image.save(self.screen,filename)
def SET_BG_COLOR(self,color):
self.color = color
def GET_BG_COLOR(self):
return self.color
def UPDATE(self):
self.screen.fill(self.color)
def FILL_SURF(self,col=()):
self.screen.fill(col)
def GET_SIZE(self):
return self.size
def GET_WIDTH(self):
return self.size[0]
def GET_POS(self):
return self.pos
def GET_HEIGHT(self):
return self.size[1]
def SET_POS(self,pos=[]):
self.pos = pos
def GET_LEFT(self):
return [self.pos[0],self.pos[1]+self.size[1]/2]
def GET_RIGHT(self):
return [self.pos[0]+self.size[0],self.pos[1]+self.size[1]/2]
def GET_UP(self):
return [self.pos[0]+self.size[0]/2,self.pos[1]]
def GET_DOWN(self):
return [self.pos[0]+self.size[0]/2,self.pos[1]+self.size[1]]
# 3
class Kamera_:
def __init__(self,SIZE=[],zvet_prost='RGB',NUM=0):
self.size = SIZE
pygame.camera.init()
self.cam = pygame.camera.Camera(pygame.camera.list_cameras()[NUM],(self.size[0],self.size[1]), zvet_prost)
self.cam.set_controls(True,False,1)
def LIST_CAM(self):
cams = pygame.camera.list_cameras()
return cams
def START(self):self.cam.start()
def END(self):self.cam.stop()
def GET_IMG(self):
img = self.cam.get_image()
im = Img_(img)
return im
def GET_SIZE(self):
width , height = self.cam.get_size()
return width , height
def SET_SETINGS(self,wflip,hflip,sun):
self.cam.set_controls(wflip,hflip,sun)
def GET_SETINGS(self):
cont = self.cam.get_controls()
return cont
# 4
class Time_:
def __init__(self):
pass
def DELLAY(self,MILISECONDS):
pygame.time.delay(MILISECONDS)
def WAIT(self,MILISECONDS):
pygame.time.wait(MILISECONDS)
class TIMER():
def __init__(self):
colc = pygame.time.Clock()
self.time = colc.get_time()
def return_time(self):
return self.time
# 5
class Text_:
def __init__(self,TEXT='',GLASS=False,COLOR=(),FONT='arial',SIZE=0,POSITION=[],BG_COLOR=None):
pygame.font.init()
self.text = TEXT
self.pos = POSITION
self.pix = SIZE
self.font = FONT
self.x = self.pos[0]
self.y = self.pos[1]
self.pos = [self.x,self.y]
self.glass = GLASS
self.col = COLOR
self.bg_color = BG_COLOR
self.RENDER_TEXT = pygame.font.SysFont(self.font,self.pix)
RENDERING = self.RENDER_TEXT.render(self.text,self.glass,self.col,self.bg_color)
self.RENDERING = RENDERING
self.screen = screen
def RENDER(self,POSITION=[None,None]):
if POSITION[0]!=None and POSITION[1]!=None:
self.x = POSITION[0] ; self.y = POSITION[1]
self.screen.blit(self.RENDERING,(self.x,self.y))
def SET_TEXT(self,text=''):
self.text = text
RENDERING = self.RENDER_TEXT.render(self.text,self.glass,self.col,self.bg_color)
self.RENDERING = RENDERING
def GET_POSITION(self):
return self.pos
def SET_FONT(self,FONT=None):
self.font = FONT
self.RENDER_TEXT = pygame.font.SysFont(self.font,self.pix)
def GET_FONT(self):
return self.font
def SET_UNDERLINE(self,UNDERLINE=True):
self.RENDER_TEXT.set_underline(UNDERLINE)
def SET_POS(self,POSITION=[]):
self.pos = POSITION
self.x = POSITION[0]
self.y = POSITION[1]
def SET_TEXT_COLOR(self,COLOR=None):
self.col = COLOR
self.RENDERING = self.RENDER_TEXT.render(self.text,self.glass,self.col,self.bg_color)
def GET_TEXT_COLOR(self):
return self.col
def GET_BG_COLOR(self):
return self.bg_color
def GET_TEXT(self):
return self.text
def SET_BG_COLOR(self,COLOR=None):
self.bg_color = COLOR
self.RENDERING = self.RENDER_TEXT.render(self.text,self.glass,self.col,self.bg_color)
# 6 -- new !! do not work
class Math_:
def __init__(self):
pass
def COS(self,ugl):
return math.cos(ugl)
def SIN(self,ugl):
return math.sin(ugl)
def RAST(self,pos1=[],pos2=[]):
if pos1[0]>pos2[0]:w = pos1[0]-pos2[0]
else: w = pos2[0]-pos1[0]
if pos1[1]>pos2[1]:h = pos1[1]-pos2[1]
else: h = pos2[1]-pos1[1]
dl = math.sqrt(w*w+h*h)
return dl
class Randomings():
def __init__(self):
pass
class Randints():
def __init__(self,a,b):
self.a = a
self.b = b
self.num = random.randint(self.a,self.b)
def Get(self):
return self.num
class Randrages():
def __init__(self,a,b,step):
self.a = a
self.b = b
self.step = step
self.num = random.randrange(self.a,self.b,self.step)
def Get(self):
return self.num
class Randoms():
def __init__(self):
self.num = random.random()
def Get(self):
return self.num
# 7
class Color_:
def __init__(self,r,g,b,hsv=0):
self.hsv = hsv
self.r = r
self.b = b
self.g = g
if self.r == 'r' or self.r == 'R':self.r = random.randint(0,255)
if self.g == 'r' or self.g == 'R':self.g = random.randint(0,255)
if self.b == 'r' or self.b == 'R':self.b = random.randint(0,255)
self.r = self.r - self.hsv
self.g = self.g - self.hsv
self.b = self.b - self.hsv
if self.r < 0: self.r = 0
if self.g < 0: self.g = 0
if self.b < 0: self.b = 0
if self.r > 255: self.r = 255
if self.g > 255: self.g = 255
if self.b > 255: self.b = 255
self.color = (self.r,self.g,self.b)
def SETHSV(self,hsv):
self.hsv = hsv
self.r = self.r - self.hsv
self.g = self.g - self.hsv
self.b = self.b - self.hsv
if self.r < 0: self.r = 0
if self.g < 0: self.g = 0
if self.b < 0: self.b = 0
if self.r > 255: self.r = 255
if self.g > 255: self.g = 255
if self.b > 255: self.b = 255
self.color = (self.r,self.g,self.b)
return self.color
def Color_mesh(self,color,mesh=0.5):
hsv = (self.hsv + color.hsv)/mesh
r = (self.r + color.r)/mesh
g = (self.g + color.g)/mesh
b = (self.b + color.b)/mesh
col = Color_(r,g,b,hsv)
return col
def Color_Reverse(self):
if self.r <= 127.5:r = 127.5+(127.5-self.r)
if self.g <= 127.5:g = 127.5+(127.5-self.g)
if self.b <= 127.5:b = 127.5+(127.5-self.b)
if self.r > 127.5:r = 127.5-(self.r - 127.5 )
if self.g > 127.5:g = 127.5-(self.g - 127.5 )
if self.b > 127.5:b = 127.5-(self.b - 127.5 )
hsv = -self.hsv
col = Color_(r,g,b,hsv)
return col
def Set_chb(self):
gr = (self.color[0]+self.color[1]+self.color[2])/3
hsv = 0
col = Color_(gr,gr,gr,hsv)
return col
# 8
class Sub_events_:
def __init__(self):
pass
class Board_init:
def __init__(self):
pass
def PRESS_SUB(self,key):
on = keyboard.is_pressed(key)
return on
def PRESS_FUNCTION(self,key,function):
if True==keyboard.is_pressed(key):
function()
class Mouse_init:
def __init__(self):
pass
def GET_POSITION(self,PYGL_WINDOW='y'):
if PYGL_WINDOW=='y':
pos = pygame.mouse.get_pos();
pos = [pos[0],pos[1]]
return pos
elif PYGL_WINDOW=='n':
pos = mouse.get_position();
pos = [pos[0],pos[1]]
return pos
else:
print(colorama.Fore.RED+'Error'+colorama.Fore.RESET)
print(colorama.Fore.YELLOW+'None flag'+colorama.Fore.RESET)
print(colorama.Fore.YELLOW+'''flags : y , n'''+colorama.Fore.RESET)
sys.exit()
def GET_PRESS_ON_DISPLAY(self,BUTTON='left'):
if BUTTON!='left' and BUTTON!='right' :
print(colorama.Fore.RED+'Error'+colorama.Fore.RESET)
print(colorama.Fore.YELLOW+'None flag'+colorama.Fore.RESET)
print(colorama.Fore.YELLOW+'''flags : left , right'''+colorama.Fore.RESET)
sys.exit()
bol = mouse.is_pressed(BUTTON)
return bol
def GET_PRESS_ON_PYGL_WINDOW(self,BUTTON="l"):
if BUTTON!='l' and BUTTON!='r' :
print(colorama.Fore.RED+'Error'+colorama.Fore.RESET)
print(colorama.Fore.YELLOW+'None flag'+colorama.Fore.RESET)
print(colorama.Fore.YELLOW+'''flags : l , r'''+colorama.Fore.RESET)
sys.exit()
pr = pygame.mouse.get_pressed()
if BUTTON == "l": return pr[0]
elif BUTTON == "r": return pr[2]
elif BUTTON == "m": return pr[1]
def PRESS_FUNCTION_ON_PYGL_WINDOW(self,button,function):
pr = pygame.mouse.get_pressed()
if button == "l" and pr[0] == True:
function()
elif button == "r" and pr[2] == True:
function()
elif button == "m" and pr[1] == True:
function()
def SET_VISIBLE_ON_PYGL_WINDOW(self,viz):
pygame.mouse.set_visible(viz)
def SET_POS_ON_PYGL_WINDOW(self,pos=[]):
pygame.mouse.set_pos([pos[0],pos[1]])
def SET_POS_ON_DISPLAY(self,pos=[]):
mouse.move(pos[0],pos[1])
def ON_DISPLAY_MOVE(self,pos=[],absolute=True,second=0):
mouse.move(pos[0],pos[1],absolute,second)
def ON_CLICK(self,BUTTON='left'):
if BUTTON!='left' and BUTTON!='right':
print(colorama.Fore.RED+'Error'+colorama.Fore.RESET)
print(colorama.Fore.YELLOW+'None flag'+colorama.Fore.RESET)
print(colorama.Fore.YELLOW+'''flags : left , right'''+colorama.Fore.RESET)
sys.exit()
mouse.click(BUTTON)
def ON_DUBLE_CLICK(self,BUTTON='left'):
if BUTTON!='left' and BUTTON!='right':
print(colorama.Fore.RED+'Error'+colorama.Fore.RESET)
print(colorama.Fore.YELLOW+'None flag'+colorama.Fore.RESET)
print(colorama.Fore.YELLOW+'''flags : left , right'''+colorama.Fore.RESET)
sys.exit()
mouse.double_click(BUTTON)
# 9
class Display_init:
def __init__(self,size=[600,400],caption='Program',flags='NONE'):
global screen,clock
self.caption = caption
pygame.init()
pygame.display.init()
clock = pygame.time.Clock()
if flags == 'FULL':
screen = pygame.display.set_mode((0,0),pygame.FULLSCREEN)
elif flags == 'RESZ':
self.width = size[0]
self.height = size[1]
screen = pygame.display.set_mode((self.width,self.height),pygame.RESIZABLE)
elif flags == 'NONE':
self.width = size[0]
self.height = size[1]
screen = pygame.display.set_mode((self.width,self.height))
else:
print(colorama.Fore.RED+'Error'+colorama.Fore.RESET)
print(colorama.Fore.YELLOW+'None flag'+colorama.Fore.RESET)
print(colorama.Fore.YELLOW+'''flags : FULL - this is full screen
NONE - this is none'''+colorama.Fore.RESET)
sys.exit()
self.width = screen.get_size()[0]
self.height = screen.get_size()[1]
self.win_size = screen.get_size()
self.up = 0
self.down = self.height
self.left = 0
self.right = self.width
self.clock = clock
self.screen = screen
pygame.display.set_caption(self.caption)
def GET_DISPLAY_INFO(self):
return pygame.display.Info()
def SET_FULL(self):
self.screen = pygame.display.set_mode((0,0),pygame.FULLSCREEN)
def SET_RESIZE(self):
self.screen = pygame.display.set_mode((self.width,self.height),pygame.RESIZABLE)
def SET_NONE(self):
self.screen = pygame.display.set_mode((self.width,self.height))
def GET_TOGGLE_FULLSCREEN(self):
return pygame.display.toggle_fullscreen()
def SET_CAPTION(self,caption=''):
self.caption = caption
pygame.display.set_caption(self.caption)
def GET_ACTIVE(self):
return pygame.display.get_active()
def SET_ALPHA(self,alp):
screen.set_alpha(alp)
def GET_COLOR(self,x,y):
col = screen.get_at([x,y])
col1 = [col[0],col[1],col[2]]
return col1
def GET_WIN_CENTER(self):
xc = self.screen.get_width()/2
yc = self.screen.get_height()/2
return xc , yc
def SET_FPS(self,fps):
if type(fps)==str:
if fps == "MAX":fps = 1000
elif fps == "MIN":fps = 30
else:
print(colorama.Fore.RED+'Error'+colorama.Fore.RESET)
print(colorama.Fore.YELLOW+'None fps'+colorama.Fore.RESET)
sys.exit()
self.clock.tick(fps)
def GET_INIT(self):
return pygame.display.get_init()
def GET_DISPLAY_DRIVER(self):
return pygame.display.get_driver()
def GET_TOP(self,cor='X',storona='left'):
if cor=='X' or cor=='x' and storona=='left':return 0
elif cor=='X' or cor=='x' and storona=='right':return self.screen.get_width()
elif cor=='Y' or cor=='y' and storona=='left':return 0
elif cor=='Y' or cor=='y' and storona=='right':return 0
else:
print(colorama.Fore.RED+'Error'+colorama.Fore.RESET)
print(colorama.Fore.YELLOW+'None cordinate'+colorama.Fore.RESET)
print(colorama.Fore.YELLOW+'Uses left or fight'+colorama.Fore.RESET)
sys.exit()
def GET_DOWN(self,cor='X',storona='left'):
if cor=='X' or cor=='x' and storona=='left':return 0
elif cor=='X' or cor=='x' and storona=='right':return self.screen.get_width()
elif cor=='Y' or cor=='y' and storona=='left':return self.screen.get_height()
elif cor=='Y' or cor=='y' and storona=='right':return self.screen.get_height()
else:
print(colorama.Fore.RED+'Error'+colorama.Fore.RESET)
print(colorama.Fore.YELLOW+'None cordinate'+colorama.Fore.RESET)
print(colorama.Fore.YELLOW+'Uses left or fight'+colorama.Fore.RESET)
sys.exit()
def GET_LEFT(self,cor='X',storona='up'):
if cor=='X' or cor=='x' and storona=='up':return 0
elif cor=='X' or cor=='x' and storona=='down':return 0
elif cor=='Y' or cor=='y' and storona=='up':return 0
elif cor=='Y' or cor=='y' and storona=='down':return self.screen.get_height()
else:
print(colorama.Fore.RED+'Error'+colorama.Fore.RESET)
print(colorama.Fore.YELLOW+'None cordinate'+colorama.Fore.RESET)
print(colorama.Fore.YELLOW+'Uses up or down'+colorama.Fore.RESET)
sys.exit()
def GET_RIGHT(self,cor='X',storona='up'):
if cor=='X' or cor=='x' and storona=='up':return self.screen.get_width()
elif cor=='X' or cor=='x' and storona=='down':return self.screen.get_width()
elif cor=='Y' or cor=='y' and storona=='up':return 0
elif cor=='Y' or cor=='y' and storona=='down':return self.screen.get_height()
else:
print(colorama.Fore.RED+'Error'+colorama.Fore.RESET)
print(colorama.Fore.YELLOW+'None cordinate'+colorama.Fore.RESET)
print(colorama.Fore.YELLOW+'Uses up or down'+colorama.Fore.RESET)
sys.exit()
def GET_FPS(self):return int(self.clock.get_fps())
def CLOSE(self,running=True,EXIT_BUTTON='esc'):
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
events = pygame.event.get()
pygame_widgets.update(events)
if keyboard.is_pressed(EXIT_BUTTON):
sys.exit()
return running
def EXIT(self,EXIT_BUTTON='esc'):
if keyboard.is_pressed(EXIT_BUTTON):
sys.exit()
def GET_WIN_SIZE(self):
return self.screen.get_size()
def GET_WIN_WIDTH(self):
return self.screen.get_size()[0]
def GET_WIN_HEIGHT(self):
return self.screen.get_size()[1]
def GET_EVENT(self):
events = pygame.event.get()
return events
def FUNCTION(self,functions=[]):
for i in range(len(functions)):
functions[i]()
def GET_GL_FUNCTIONS(self):
print(colorama.Fore.GREEN+'GL_FUNCTIONS---')
print('''
Draw f- D-none
Obv f- O-(rrr)(ggg)(bbb)-THICKNESS
DrOb f- OD-(rrr)(ggg)(bbb)-THICKNESS
'''+colorama.Fore.RESET)
def UPDATE_SCREEN(self):
self.width = self.screen.get_width()
self.height = self.screen.get_height()
class UPDATE():
def __init__(self):
pygame.display.flip()
def GETTIME(self):
global start_time
start_time+=1
return start_time
def SETBGCOLOR(self,col='white'):
screen.fill(col)
class GL:
def __init__(self):
pass
class Rect:
def __init__(self,COLOR=(),POSITION=[],SIZE=[],THICKNESS=0,SURF=None,FUNCTION='none'):
sh2 = 1
center = [POSITION[0] + SIZE[0]/2,POSITION[1]+SIZE[1]/2]
pos=[POSITION[0],POSITION[1]]
up = [POSITION[0],POSITION[1]]
down = [POSITION[0]+SIZE[1],POSITION[1]+SIZE[0]]
right = [POSITION[0]+SIZE[1],POSITION[1]+SIZE[0]]
left = [POSITION[0],POSITION[1]]
self.pos = pos
self.size = SIZE
if SURF=='s' and type(SURF)==str:self.surf = screen
else:self.surf = SURF
self.col = COLOR
self.obv_color = 'black'
self.sh = THICKNESS
self.sh2 = sh2
self.center = center
self.up = up
self.down = down
self.left = left
self.right = right
self.DL_diagonal = math.sqrt(SIZE[0]**2+SIZE[1]**2)
if FUNCTION=='D':
rect = pygame.Rect(self.pos[0],self.pos[1],self.size[0],self.size[1])
pygame.draw.rect(self.surf,self.col,rect,self.sh)
elif FUNCTION[1]=='D':
col = [int(FUNCTION[3:6]),int(FUNCTION[7:10]),int(FUNCTION[11:14])]
sh2 = int(FUNCTION[15:len(FUNCTION)])
if col!=None:self.obv_color = col
if sh2!=None:self.sh2 = sh2
rect = pygame.Rect(self.pos[0],self.pos[1],self.size[0],self.size[1])
pygame.draw.rect(self.surf,self.col,rect,self.sh)
pygame.draw.rect(self.surf,self.obv_color,rect,self.sh2)
elif FUNCTION[0]=='O':
col = [int(FUNCTION[2:5]),int(FUNCTION[6:9]),int(FUNCTION[10:13])]
sh2 = int(FUNCTION[14:len(FUNCTION)])
if col!=[0,0,0]:self.obv_color = col
if sh2!=None:self.sh2 = sh2
rect = pygame.Rect(self.pos[0],self.pos[1],self.size[0],self.size[1])
pygame.draw.rect(self.surf,self.obv_color,rect,self.sh2)
else:
pass
def FILL(self):
rect = pygame.Rect(self.pos[0],self.pos[1],self.size[0],self.size[1])
pygame.draw.rect(self.surf,self.col,rect,self.sh)
def FILLOUT(self,COLOR=None,THICKNESS=None):
if COLOR!=None:self.obv_color = COLOR
if THICKNESS!=None:self.sh2 = THICKNESS
rect = pygame.Rect(self.pos[0],self.pos[1],self.size[0],self.size[1])
pygame.draw.rect(self.surf,self.col,rect,self.sh)
pygame.draw.rect(self.surf,self.obv_color,rect,self.sh2)
def OUTLINE(self,COLOR=None,THICKNESS=None):
if COLOR!=None:self.obv_color = COLOR
if THICKNESS!=None:self.sh2 = THICKNESS
rect = pygame.Rect(self.pos[0],self.pos[1],self.size[0],self.size[1])
pygame.draw.rect(self.surf,self.obv_color,rect,self.sh2)
def SET_SIZE(self,SIZE=[]):
self.size = SIZE
def SET_THICKNESS(self,THICKNESS):
self.sh = THICKNESS
def SET_COLOR(self,COLOR=()):
self.col = COLOR
def GET_SIZE(self):
return self.size
def GET_THICKNESS(self):
return self.sh
def SET_OUTLINE_THICKNESS(self,THICKNESS):
self.sh2=THICKNESS
def GET_CENTER(self):
return self.center
def GET_SURF(self):
return self.surf
def GET_OUTLINE_THICKNESS(self):
return self.sh2
def SET_POSITION(self,POSITION):
self.pos = POSITION
up = [self.pos[0],self.pos[1]]
down = [self.pos[0]+self.size[1],self.pos[1]+self.size[0]]
right = [self.pos[0]+self.size[1],self.pos[1]+self.size[0]]
left = [self.pos[0],self.pos[1]]
self.up = up
self.down = down
self.left = left
self.right = right
def GET_POSITION(self):
return self.pos
class Poligon:
def __init__(self,COLOR=(),POINTS=(),THICKNESS=0,SURF=None,FUNCTION='none'):
self.points = POINTS
self.col = COLOR
self.sh = THICKNESS
self.sh2 = 1
if SURF=='s' and type(SURF)==str:self.surf=screen
else:self.surf = SURF
self.obv_col = 'black'
if FUNCTION=='D':
pygame.draw.polygon(self.surf,self.col,self.points,self.sh)
elif FUNCTION[1]=='D':
COLOR = [int(FUNCTION[3:6]),int(FUNCTION[7:10]),int(FUNCTION[11:14])]
THICKNESS = int(FUNCTION[15:len(FUNCTION)])
pygame.draw.polygon(self.surf,self.col,self.points,self.sh)
if COLOR!=None:self.obv_col = COLOR
if THICKNESS!=None:self.sh2 = THICKNESS
pygame.draw.polygon(self.surf,self.obv_col,self.points,self.sh2)
elif FUNCTION[0]=='O':
COLOR = [int(FUNCTION[2:5]),int(FUNCTION[6:9]),int(FUNCTION[10:13])]
THICKNESS = int(FUNCTION[14:len(FUNCTION)])
if COLOR!=None:self.obv_col = COLOR
if THICKNESS!=None:self.sh2 = THICKNESS
pygame.draw.polygon(self.surf,self.obv_col,self.points,self.sh2)
else:
pass
def FILL(self):
pygame.draw.polygon(self.surf,self.col,self.points,self.sh)
def OUTLINE(self,COLOR=None,THICKNESS=None):
if COLOR!=None:self.obv_col = COLOR
if THICKNESS!=None:self.sh2 = THICKNESS
pygame.draw.polygon(self.surf,self.obv_col,self.points,self.sh2)
def FILLOUT(self,COLOR=None,THICKNESS=None):
pygame.draw.polygon(self.surf,self.col,self.points,self.sh)
if COLOR!=None:self.obv_col = COLOR
if THICKNESS!=None:self.sh2 = THICKNESS
pygame.draw.polygon(self.surf,self.obv_col,self.points,self.sh2)
def GET_POINTS(self):
return self.points
def GET_COLOR(self):
return self.col
def GET_OUTLINE_COLOR(self):
return self.obv_col
def GET_THICKNESS(self):
return self.sh
def GET_OUTLINE_THICKNESS(self):
return self.sh2
def GET_SURF(self):
return self.surf
def SET_THICKNESS(self,THICKNESS):
self.sh = THICKNESS
def SET_OUTLINE_THICKNESS(self,THICKNESS):
self.sh2 = THICKNESS
def SET_OUTLINE_COLOR(self,COLOR=()):
self.obv_col = COLOR
def SET_COLOR(self,COLOR=()):
self.col = COLOR
class Circle:
def __init__(self,COLOR=(),POSITION=[],RADIUS=0,THICKNESS=0,SURF=0,FUNCTION='none'):
global g_c_pos , g_c_rad
center = [POSITION[0],POSITION[1]]
sh2 = 1
self.sh2 = sh2
self.col = COLOR
self.sh = THICKNESS
self.rad = RADIUS ; g_c_rad = self.rad
self.obv_col = (0,0,0)
if SURF=='s' and type(SURF)==str:self.surf=screen
else:self.surf = SURF
self.center = center
self.pos = POSITION ; g_e_pos = self.pos
up_cic = [POSITION[0],POSITION[1]-self.rad] ; self.up = up_cic
down_cic = [POSITION[0],POSITION[1]+self.rad] ; self.down = down_cic
left_cic = [POSITION[0]-self.rad,POSITION[1]] ; self.left = left_cic
right_cic = [POSITION[0]+self.rad,POSITION[1]] ; self.right = right_cic
if FUNCTION=='D':
pygame.draw.circle(self.surf,self.col,(self.pos[0],self.pos[1]),self.rad,self.sh)
elif FUNCTION[1]=='D':
COLOR = [int(FUNCTION[3:6]),int(FUNCTION[7:10]),int(FUNCTION[11:14])]
THICKNESS = int(FUNCTION[15:len(FUNCTION)])
pygame.draw.circle(self.surf,self.col,(self.pos[0],self.pos[1]),self.rad,self.sh)
if COLOR!=None:self.obv_col = COLOR
if THICKNESS!=None:self.sh2 = THICKNESS
pygame.draw.circle(self.surf,COLOR,(self.pos[0],self.pos[1]),self.rad,self.sh2)
elif FUNCTION[0]=='O':
COLOR = [int(FUNCTION[2:5]),int(FUNCTION[6:9]),int(FUNCTION[10:13])]
THICKNESS = int(FUNCTION[14:len(FUNCTION)])
if COLOR!=None:self.obv_col = COLOR
if THICKNESS!=None:self.sh2 = THICKNESS
pygame.draw.circle(self.surf,COLOR,(self.pos[0],self.pos[1]),self.rad,self.sh2)
else:
pass
def FILL(self):
global g_c_pos
if g_c_pos!=None:self.pos = g_c_pos
pygame.draw.circle(self.surf,self.col,(self.pos[0],self.pos[1]),self.rad,self.sh)
def OUTLINE(self,COLOR=None,THICKNESS=None):
global g_c_pos
if g_c_pos!=None:self.pos = g_c_pos
if COLOR!=None:self.obv_col = COLOR
if THICKNESS!=None:self.sh2 = THICKNESS
pygame.draw.circle(self.surf,self.obv_col,(self.pos[0],self.pos[1]),self.rad,self.sh2)
def FILLOUT(self,COLOR=None,THICKNESS=None):
global g_c_pos
if g_c_pos!=None:self.pos = g_c_pos
pygame.draw.circle(self.surf,self.col,(self.pos[0],self.pos[1]),self.rad,self.sh)
if COLOR!=None:self.obv_col = COLOR
if THICKNESS!=None:self.sh2 = THICKNESS
pygame.draw.circle(self.surf,self.obv_col,(self.pos[0],self.pos[1]),self.rad,self.sh2)
def SET_RADIUS(self,RADIUS):
self.rad = RADIUS
def SET_COLOR(self,COLOR=()):
self.col = COLOR
def GET_RADIUS(self):
return self.rad
def GET_THICKNESS(self):
return self.sh
def GET_CENTER(self):
return self.center
def GET_SURF(self):
return self.surf
def SET_OUTLINE_THICKNESS(self,sh2):
self.sh2 = sh2
def SET_THICKNESS(self,THICKNESS):
self.sh=THICKNESS
def GET_OUTLINE_THICKNESS(self):
return self.sh2
class SET_POSITION():
def __init__(self,POSITION=[]):
global g_c_rad , g_c_pos
self.POSITION = POSITION
g_c_pos = [POSITION[0]+g_c_rad, POSITION[1]+g_c_rad]
up_cic = [POSITION[0],POSITION[1]-g_c_rad]
down_cic = [POSITION[0],POSITION[1]+g_c_rad]
left_cic = [POSITION[0]-g_c_rad,POSITION[1]]
right_cic = [POSITION[0]+g_c_rad,POSITION[1]]
self.up = up_cic
self.down = down_cic
self.left = left_cic
self.right = right_cic
def ON_CENTER(self):
global g_c_rad , g_c_pos
POSITION = self.POSITION
g_c_pos = POSITION
up_cic = [POSITION[0],POSITION[1]-g_c_rad]
down_cic = [POSITION[0],POSITION[1]+g_c_rad]
left_cic = [POSITION[0]-g_c_rad,POSITION[1]]
right_cic = [POSITION[0]+g_c_rad,POSITION[1]]
self.up = up_cic
self.down = down_cic
self.left = left_cic
self.right = right_cic
def GET_POSITION(self):
return self.pos
class Ellips:
def __init__(self,COLOR=(),POSITION=[],SIZE=[],THICKNESS=0,SURF=0,FUNCTION='none'):
global g_e_size , g_e_pos
center = [POSITION[0] + SIZE[0]/2,POSITION[1] + SIZE[1]/2]
self.sh2 = 1
self.sh = THICKNESS
self.center = center
self.size = SIZE ; g_e_size = self.size
self.col = COLOR
self.obv_color = 'black'
self.pos = POSITION ; g_e_pos = self.pos
if SURF=='s' and type(SURF)==str:self.surf=screen
else:self.surf = SURF
el_up = [POSITION[0]+SIZE[0]/2,POSITION[1]] ; self.up = el_up
el_down = [POSITION[0]+SIZE[0]/2,POSITION[1]+SIZE[1]] ; self.down = el_down
el_left = [POSITION[0],POSITION[1]+SIZE[1]/2] ; self.left = el_left
el_right = [POSITION[0]+SIZE[0],POSITION[1]+SIZE[1]/2] ; self.right = el_right
if FUNCTION=='D':
if g_pos!=None:self.pos = g_pos
rect = pygame.Rect(self.pos[0],self.pos[1],self.size[0],self.size[1])
pygame.draw.ellipse(self.surf,self.col,rect,self.sh)
elif FUNCTION[1]=='D':
COLOR = [int(FUNCTION[3:6]),int(FUNCTION[7:10]),int(FUNCTION[11:14])]
THICKNESS = int(FUNCTION[15:len(FUNCTION)])
if g_pos!=None:self.pos = g_pos
rect = pygame.Rect(self.pos[0],self.pos[1],self.size[0],self.size[1])
pygame.draw.ellipse(self.surf,self.col,rect,self.sh)
if COLOR!=None:self.obv_color = COLOR
if THICKNESS!=None:self.sh2 = THICKNESS
rect = pygame.Rect(self.pos[0],self.pos[1],self.size[0],self.size[1])
pygame.draw.ellipse(self.surf,self.obv_color,rect,self.sh2)
elif FUNCTION[0]=='O':
COLOR = [int(FUNCTION[2:5]),int(FUNCTION[6:9]),int(FUNCTION[10:13])]
THICKNESS = int(FUNCTION[14:len(FUNCTION)])
if COLOR!=None:self.obv_color = COLOR
if THICKNESS!=None:self.sh2 = THICKNESS
if g_pos!=None:self.pos = g_pos
rect = pygame.Rect(self.pos[0],self.pos[1],self.size[0],self.size[1])
pygame.draw.ellipse(self.surf,self.obv_color,rect,self.sh2)
else:
pass
def FILL(self):
global g_e_pos
if g_e_pos!=None:self.pos = g_e_pos
rect = pygame.Rect(self.pos[0],self.pos[1],self.size[0],self.size[1])
pygame.draw.ellipse(self.surf,self.col,rect,self.sh)
def OUTLINE(self,COLOR=None,THICKNESS=None):
global g_e_pos
if COLOR!=None:self.obv_color = COLOR
if THICKNESS!=None:self.sh2 = THICKNESS
if g_e_pos!=None:self.pos = g_e_pos
rect = pygame.Rect(self.pos[0],self.pos[1],self.size[0],self.size[1])
pygame.draw.ellipse(self.surf,self.obv_color,rect,self.sh2)
def FILLOUT(self,COLOR=None,THICKNESS=None):
global g_e_pos
if g_e_pos!=None:self.pos = g_e_pos
rect = pygame.Rect(self.pos[0],self.pos[1],self.size[0],self.size[1])
pygame.draw.ellipse(self.surf,self.col,rect,self.sh)
if COLOR!=None:self.obv_color = COLOR
if THICKNESS!=None:self.sh2 = THICKNESS
rect = pygame.Rect(self.pos[0],self.pos[1],self.size[0],self.size[1])
pygame.draw.ellipse(self.surf,self.obv_color,rect,self.sh2)
def SET_SIZE(self,SIZE=[]):
self.size = SIZE
def GET_CENTER(self):
return self.center
def GET_THICKNESS(self):
return self.sh
def GET_SURF(self):
return self.surf
def SET_COLOR(self,COLOR=()):
self.col = COLOR
def GET_SIZE(self):
return self.size
def GET_OUTLINE_THICKNESS(self):
return self.sh2
def SET_OUTLINE_THICKNESS(self,OUTLINE_THICKNESS):
self.sh2 = OUTLINE_THICKNESS
def SET_THICKNESS(self,THICKNESS):
self.sh = THICKNESS
class SET_POSITION():
def __init__(self,POSITION=[]):
global g_e_pos , g_e_size
self.POSITION = POSITION
g_e_pos = POSITION
el_up = [POSITION[0]+g_e_size[0]/2,POSITION[1]]
el_down = [POSITION[0]+g_e_size[0]/2,POSITION[1]+g_e_size[1]]
el_left = [POSITION[0],POSITION[1]+g_e_size[1]/2]
el_right = [POSITION[0]+g_e_size[0],POSITION[1]+g_e_size[1]/2]
self.up = el_up
self.down = el_down
self.left = el_left
self.right = el_right
def ON_CENTER(self):
global g_pos
POSITION = self.POSITION
g_e_pos = [POSITION[0]-g_e_size[0]/2,POSITION[1]-g_e_size[1]/2]
el_up = [POSITION[0]+g_e_size[0]/2,POSITION[1]]
el_down = [POSITION[0]+g_e_size[0]/2,POSITION[1]+g_e_size[1]]
el_left = [POSITION[0],POSITION[1]+g_e_size[1]/2]
el_right = [POSITION[0]+g_e_size[0],POSITION[1]+g_e_size[1]/2]
self.up = el_up
self.down = el_down
self.left = el_left
self.right = el_right
class Triangl:
def __init__(self,col=(),pos1=[],pos2=[],pos3=[],sh=0,surf=0):
rectt = [pos1,pos2,pos3,col,sh]
sh2 = 1
self.sh2 = sh2
self.col = col
self.pos1 = pos1
self.pos2 = pos2
self.pos3 = pos3
self.poses = [self.pos1,self.pos2,self.pos3]
self.sh = sh
self.surf = surf
self.rectt = rectt
def Draw(self):
pygame.draw.polygon(
self.surf,
self.col,
[(self.pos1[0],self.pos1[1]),(self.pos2[0],self.pos2[1]),(self.pos3[0],self.pos3[1])],
self.sh
)
def Obv(self,col=(0,0,0)):
pygame.draw.polygon(
self.surf,
col,
[(self.pos1[0],self.pos1[1]),(self.pos2[0],self.pos2[1]),(self.pos3[0],self.pos3[1])],
self.sh2
)
def DrOb(self,col=(0,0,0)):
pygame.draw.polygon(
self.surf,
self.col,
[(self.pos1[0],self.pos1[1]),(self.pos2[0],self.pos2[1]),(self.pos3[0],self.pos3[1])],
self.sh
)
pygame.draw.polygon(
self.surf,
col,
[(self.pos1[0],self.pos1[1]),(self.pos2[0],self.pos2[1]),(self.pos3[0],self.pos3[1])],
self.sh2
)
def Get_sh(self):
return self.sh
def Get_sh2(self):
return self.sh2
def Set_sh(self,sh2):
self.sh = sh2
def Set_sh2(self,sh2):
self.sh2 = sh2
def Set_col(self,col):
self.col = col
def Set_poses(self,poses=[]):
self.poses = poses
self.pos1 = poses[0]
self.pos2 = poses[1]
self.pos3 = poses[2]
def Set_pos1(self,pos1=[]):
self.pos1 = pos1
def Set_pos2(self,pos2=[]):
self.pos2 = pos2
def Set_pos3(self,pos3=[]):
self.pos3 = pos3
class Line:
def __init__(self,col=(),start_pos=[],end_pos=[],sh=1,surf=0,type='R'):
xcnt = start_pos[0]+(end_pos[0]-start_pos[0])/2;ycnt = start_pos[1]+(end_pos[1]-start_pos[1])/2
center = [xcnt,ycnt]
rectt = [start_pos,end_pos,center,col,sh]
self.x_center = xcnt
self.y_center = ycnt
self.center = center
self.rectt = rectt
self.col = col
self.start_pos = start_pos
self.end_pos = end_pos
self.sh = sh
self.surf = surf
self.type = type
self.poses = [self.start_pos,self.end_pos]
def Draw(self):
pygame.draw.line(
self.surf,
self.col,
(self.start_pos[0],self.start_pos[1]),
(self.end_pos[0],self.end_pos[1]),
self.sh
)
if self.type == 'S' or self.type == 's':
Display_init.GL.Circle(self.col,[self.start_pos[0]+self.sh/12-1,self.start_pos[1]+1]
,self.sh/2,0,self.surf).FILL()
Display_init.GL.Circle(self.col,[self.end_pos[0]+self.sh/12-1,self.end_pos[1]+1]
,self.sh/2,0,self.surf).FILL()
elif self.type == 'r' or self.type == 'R':
pass
else:
print(colorama.Fore.RED+'Error'+colorama.Fore.RESET)
print(colorama.Fore.YELLOW+'(none) type detected'+colorama.Fore.RESET)
print(colorama.Fore.YELLOW+'Uses s(S) or r(R)'+colorama.Fore.RESET)
sys.exit()
def Set_col(self,col):
self.col = col
def Set_type(self,type2):
self.type = type2
def Set_poses(self,poses=[]):
self.poses = poses
self.start_pos = poses[0]
self.end_pos = poses[1]
def Set_start_pos(self,pos=[]):
self.start_pos = pos
def Set_end_pos(self,pos=[]):
self.end_pos = pos
def Set_sh(self,sh2):
self.sh = sh2
def Get_col(self):
return self.col
def Get_poses(self):
return self.poses
def Get_start_pos(self):
return self.start_pos
def Get_end_pos(self):
return self.end_pos
class Liness:
def __init__(self,col=(),points=(),snap=False,sh=1,surf=0):
rectt = [points,col,snap,sh]
self.col = col
self.points = points
self.snap = snap
self.sh = sh
self.surf = surf
self.rectt = rectt
def Draw(self):
pygame.draw.lines(
self.surf,
self.col,
self.snap,
self.points,
self.sh
)
def Get_points_ind(self,index=0,cor=None):
if cor == None:
return self.points[index]
elif cor == "x" or cor == "X":
return self.points[index][0]
elif cor == "y" or cor == "Y":
return self.points[index][1]
else:
print(colorama.Fore.RED+'Error'+colorama.Fore.RESET)
print(colorama.Fore.YELLOW+'None 2D cords detected.'+colorama.Fore.RESET)
sys.exit()
def Get_points(self):
return self.points
def Get_col(self):
return self.col
def Get_sh(self):
return self.sh
def Get_snap(self):
return self.snap
def Set_col(self,col):
self.col = col
def Set_sh(self,sh2):
self.sh = sh2
class Pixel:
def __init__(self,col=(),pos=[],sh=1,surf=0):
rectt = [pos,col,sh]
self.rectt = rectt
self.pos = pos
self.col = col
self.sh = sh
self.surf = surf
def Draw(self):
pygame.draw.line(
self.surf,
self.col,
(self.pos[0],self.pos[1]),
(self.pos[0],self.pos[1]),
self.sh
)
def Get_pos(self):
return self.pos
def Get_col(self):
return self.col
def Get_sh(self):
return self.sh
def Set_col(self,col):
self.col = col
def Set_pos(self,pos=[]):
self.pos = pos
def Set_sh(self,sh2):
self.sh = sh2
class Arc:
def __init__(self,col=(),pos=[],start_angle=0,stop_angle=0,rad=1,sh=1,st='-',surf=0):
grad = 56.5
ugl1 = start_angle/grad
rectt=[pos,start_angle,stop_angle,col,sh,st]
self.grad = grad
self.ugl = ugl1
self.start_angl = start_angle
self.end_angl = stop_angle
self.col = col
self.pos = pos
self.rad = rad
self.sh = sh
self.st = st
self.surf = surf
self.rectt = rectt
def Draw(self):
for l in range(int(self.end_angl*3.5)):
if self.st=='-': self.ugl+=0.005
elif self.st=='+': self.ugl-=0.005
else:
print('no positions detected.')
sys.exit()
for i in range(0,self.rad,2):
xl=self.pos[0]+i*math.sin(self.ugl);yl=self.pos[1]+i*math.cos(self.ugl)
if i == self.rad - self.sh:
xpos = xl;ypos = yl
pygame.draw.line(self.surf,
self.col,
[xl,yl],
[xpos,ypos],
5)
def Set_end_ugl(self,ugl):
self.end_angl = ugl
def Set_start_ugl(self,ugl):
self.start_angl = ugl
def Set_st(self,st='-'):
self.st = st
def Get_st(self):
return self.st
def Get_col(self):
return self.col
def Set_col(self,col):
self.col = col
def Set_rad(self,rad):
self.rad = rad
def Get_rad(self):
return self.rad
def Set_sh(self,sh2):
self.sh = sh2
def Get_sh(self):
return self.sh
# 10
class Sprites_(Surfases_):
def __init__(self,file=''):
img = pygame.image.load(file)
self.img = img
self.start_img = img
self.img_rect = self.start_img.get_rect()
def Draw(self,pos=[]):
self.pos = pos
self.rect = self.img.get_rect(bottomright=(pos[0]+self.img.get_width(),pos[1]+self.img.get_height()))
screen.blit(self.img,self.rect)
return self.rect
def Draw_on_surf(self,surf,pos=[]):
self.pos = pos
self.rect = self.img.get_rect(bottomright=(pos[0]+self.img.get_width(),pos[1]+self.img.get_height()))
surf.screen.blit(self.img,self.rect)
def Set_pos(self,pos=[]):
self.img_rect = self.start_img.get_rect(center=(pos[0],pos[1]))
self.pos = pos
def Scale(self,size=[]):
self.img = pygame.transform.scale(self.img,(size[0],size[1]))
def Rotate(self,ugl):
self.img = pygame.transform.rotate(self.start_img,ugl)
def Rotate_center(self,ugl):
rot_img = pygame.transform.rotate(self.start_img,ugl)
self.rect = rot_img.get_rect(center = self.img_rect.center)
self.img = rot_img
def Blit(self,rect):
screen.blit(self.img,rect)
def Get_rect(self):
return self.start_img.get_rect()
def Save(self,plane,file_name = ''):
pygame.image.save(plane,file_name)
def Get_pos(self):
return self.pos
# 11 -- new !! do not work
class Sprites_Group_:
def __init__(self,sprites=[]):
self.sprites = sprites
self.sprites_pack = []
for i in self.sprites:
self.sprites_pack.append(pygame.image.load(i))
def Draw(self,pos=[0,0],sprite_index=0):
self.pos = pos
self.rect = self.sprites_pack[sprite_index].get_rect(bottomright=(pos[0]+self.sprites_pack[sprite_index].get_width(),
pos[1]+self.sprites_pack[sprite_index].get_height()))
screen.blit(self.sprites_pack[sprite_index],self.rect)
# 12
class Graphick_:
def __init__(self):
pass
def SETcirclGRAPH(self,col=[],znh=[]):
pit = [col,znh]
return pit
def DRcirclGRAPH_2D(self,r=1,xp=1,yp=1,grph=[]):
kf = 0
ugl = 1;ugl1=1
c=r
g1 = 0
for g in range(len(grph[0])):
kf = kf + grph[0][g]
for g in range(len(grph[1])):
coll = grph[1][g]
ugl = ugl1
for n in range(int(700/kf*grph[0][g1])):
xl = xp + c * math.sin(ugl)
yl = yp + c * math.cos(ugl)
ugl+=0.009
pygame.draw.line(screen,coll,(xp,yp),(xl,yl),4)
ugl1 = ugl
g1 +=1
# 13 -- new !!
class Widgets_:
def __init__(self):
pass
class Sliders:
def __init__(self,plane,
pos=[],
len=100,
size=10,
min=0,
max=100,
step=1,
color_slider=(0,0,0),
handl_color=(30,30,30),
handl_radius=10,
curved = True
):
self.plane = plane
self.pos = pos
self.posx = pos[0]
self.posy = pos[1]
self.len = len
self.curved = curved
self.size = size
self.min = min
self.max = max
self.step = step
self.color_slider = color_slider
self.handl_color = handl_color
self.handl_radius = handl_radius
slide = Slider(self.plane,
self.posx,
self.posy,
self.len,
self.size,
min = self.min,
max = self.max,
step = self.step,
colour = self.color_slider,
handleColour = self.handl_color,
handleRadius = self.handl_radius,
curved = self.curved)
self.slide = slide
def Get_value(self):
val = self.slide.getValue()
return val
def Update(self):
events = pygame.event.get()
for event in events:
if event.type == pygame.QUIT:
pygame.quit()
quit()
pygame_widgets.update(events)
def Set_pos(self,pos=[]):
self.pos = pos
self.posx = pos[0]
self.posy = pos[1]
self.slide.setX(pos[0])
self.slide.setY(pos[1])
def Set_posx(self,x):
self.posx = x
self.slide.setX(x)
def Set_posy(self,y):
self.posy = y
self.slide.setY(y)
def Set_width(self,width):
self.len = width
self.slide.setWidth(width)
def Set_height(self,height):
self.size = height
self.slide.setHeight(height)
def Set_size(self,size=[]):
self.size = size[1]
self.len = size[0]
self.slide.setHeight(size[1])
self.slide.setWidth(size[0])
def Hide(self):
self.slide.hide()
def Show(self):
self.slide.show()
def Set_value(self,value):
self.slide.setValue(value)
def Get_curved(self):
return self.curved
def Get_pos(self):
return self.pos
def Get_posx(self):
return self.posx
def Get_posy(self):
return self.posy
def Get_size(self):
return self.size
def Get_value(self):
return self.slide.getValue()
def Get_min(self):
return self.min
def Get_max(self):
return self.max
def Get_step(self):
return self.step
def Get_slider_color(self):
return self.color_slider
def Get_handl_color(self):
return self.handl_color
def Get_handl_radius(self):
return self.handl_radius
def Disable(self):
self.slide.disable()
def Enable(self):
self.slide.enable()
def Set_orintation(self,orint):
self.slide.vertical = orint
def Get_selected(self):
return self.slide.selected
class TextBoxs:
def __init__(self,plane,
pos=[],
size=[],
font_size=30,
border_color=(0,0,0),
text_color = (0,0,0),
onSub=Function,radius = 1,
border_size=5
):
self.plane = plane
self.pos = pos
self.size = size
self.width = size[0]
self.height = size[1]
self.font_size = font_size
self.border_color = border_color
self.text_color = text_color
self.radius = radius
self.border_size = border_size
self.posx = self.pos[0]
self.posy = self.pos[1]
tb = TextBox(self.plane,
self.posx,self.posy,
self.width,self.height,
fontSize = self.font_size,
borderColour = self.border_color,
textColour = text_color,
onSubmit = onSub,
radius = self.radius,
borderThickness = self.border_size)
self.tb = tb
def Get_text(self):
text = self.tb.getText()
return text
def Set_text(self,text=''):
self.tb.setText(text)
def Update(self):
events = pygame.event.get()
for event in events:
if event.type == pygame.QUIT:
pygame.quit()
quit()
pygame_widgets.update(events)
def Set_size(self,size=[]):
self.width = size[0]
self.height = size[1]
self.tb.setWidth(size[0])
self.tb.setHeight(size[1])
def Set_posx(self,x):
self.posx = x
self.tb.setX(x)
def Set_posy(self,y):
self.posy = y
self.tb.setY(y)
def Set_pos(self,pos=[]):
self.posy = pos[1]
self.tb.setY(pos[1])
self.posx = pos[0]
self.tb.setX(pos[0])
def Hide(self):
self.tb.hide()
def Show(self):
self.tb.show()
def Set_output_disable(self):
self.tb.disable()
def Set_output_enable(self):
self.tb.enable()
def Set_width(self,width):
self.width = width
self.tb.setWidth(width)
def Set_height(self,height):
self.height = height
self.tb.setHeight = height
def Get_height(self):
return self.tb.getHeight()
def Get_width(self):
return self.tb.getWidth()
def Get_pos(self):
return self.pos
def Get_posx(self):
return self.posx
def Get_posy(self):
return self.posy
def Get_size(self):
return self.size
def Get_font_size(self):
return self.font_size
def Get_border_color(self):
return self.border_color
def Get_text_color(self):
return self.text_color
def Get_radius(self):
return self.radius
def Get_border_size(self):
return self.border_size
def Disable(self):
self.tb.disable()
def Enable(self):
self.tb.enable()
def Get_selected(self):
return self.tb.selected
class Buttons:
def __init__(self,plane,
pos=[],
size=[],
text='',
text_color=(0,0,0),
font_size=20,
margin = 20,
no_activ_color = (10,10,10),
activ_color = (30,30,30),
pressed_color=(60,60,60),
radius=20,
functions=Function,
shadow_dist = 0,
shadow_color = (0,0,0)
):
self.plane = plane
self.pos = pos
self.size = size
self.posx = self.pos[0]
self.posy = self.pos[1]
self.width = self.size[0]
self.height = self.size[1]
self.text = text
self.font_size = font_size
self.margin = margin
self.no_activ_color = no_activ_color
self.activ_color = activ_color
self.pressed_color = pressed_color
self.radius = radius
self.text_color = text_color
self.shadow_dist = shadow_dist
self.shadow_color = shadow_color
bt = Button(
self.plane,
self.posx,self.posy,
self.width,self.height,
text=self.text,
fontSize = self.font_size,
margin = self.margin,
inactiveColour = self.no_activ_color,
hoverColour = self.activ_color,
pressedColour = self.pressed_color,
radius = self.radius,
onClick = functions,
textColour = self.text_color,
shadowColour = self.shadow_color,
shadowDistance = self.shadow_dist
)
self.bt = bt
def Update(self):
events = pygame.event.get()
for event in events:
if event.type == pygame.QUIT:
pygame.quit()
quit()
pygame_widgets.update(events)
def Set_posx(self,x):
self.posx = x
self.bt.setX(x)
def Set_posy(self,y):
self.posy = y
self.bt.setY(y)
def Set_width(self,width):
self.width = width
self.bt.setWidth(width)
def Set_height(self,height):
self.height = height
self.bt.setHeight(height)
def Set_size(self,size=[]):
self.height = size[1]
self.width = size[0]
self.bt.setWidth(size[0])
self.bt.setHeight(size[1])
def Set_pos(self,pos = []):
self.posx = pos[0]
self.posy = pos[1]
self.bt.setX(pos[0])
self.bt.setY(pos[1])
def Set_pressed_color(self,color):
self.pressed_color = color
self.bt.setPressedColour(color)
def Set_activ_color(self,color):
self.activ_color = color
self.bt.setHoverColour(color)
def Set_no_activ_color(self,color):
self.no_activ_color = color
self.bt.setInactiveColour(color)
def Get_pos(self):
return self.pos
def Get_posx(self):
return self.posx
def Get_posy(self):
return self.posy
def Get_size(self):
return self.size
def Get_width(self):
return self.width
def Get_height(self):
return self.height
def Get_text(self):
return self.text
def Get_font_size(self):
return self.font_size
def Get_margin(self):
return self.margin
def Get_no_activ_color(self):
return self.no_activ_color
def Get_activ_color(self):
return self.activ_color
def Get_pressed_color(self):
return self.pressed_color
def Get_radius(self):
return self.radius
def Get_text_color(self):
return self.text_color
def Get_shadow_color(self):
return self.shadow_color
def Get_shadow_distance(self):
return self.shadow_dist
def Show(self):
self.bt.show()
def Hide(self):
self.bt.hide()
def Get_pressed(self):
return self.bt.clicked
def Sleep(self):
self.bt.disable()
def Stendup(self):
self.bt.enable()
def Disable(self):
self.bt.disable()
def Enable(self):
self.bt.enable()
class Toggles:
def __init__(self,plane,
pos = [],
size = [],
startType = False,
oncolor = (141, 185, 244),
offcolor = (150, 150, 150),
handl_oncolor = (26, 115, 232),
handl_offcolor = (200, 200, 200),
radius = 20
):
self.plane = plane
self.pos = pos
self.posx = self.pos[0]
self.posy = self.pos[1]
self.size = size
self.width = self.size[0]
self.height = self.size[1]
self.startType = startType
self.oncolor = oncolor
self.offcolor = offcolor
self.handl_oncolor = handl_oncolor
self.handl_offcolor = handl_offcolor
self.radius = radius
tg = Toggle(
self.plane,
self.posx,self.posy,
self.width,self.height,
startOn = self.startType,
offColour = self.offcolor,
onColour = self.oncolor,
handleOnColour = self.handl_oncolor,
handleOffColour = self.handl_offcolor,
handleRadius = self.radius
)
self.tg = tg
def Update(self):
events = pygame.event.get()
for event in events:
if event.type == pygame.QUIT:
pygame.quit()
quit()
pygame_widgets.update(events)
def Set_pos(self,pos=[]):
self.posx = pos[0]
self.posy = pos[1]
self.tg.setX(pos[0])
self.tg.setY(pos[1])
def Set_posx(self,x):
self.posx = x
self.tg.setX(x)
def Set_posy(self,y):
self.posy = y
self.tg.setY(y)
def Set_width(self,width):
self.width = width
self.tg.setWidth(width)
def Set_height(self,height):
self.height = height
self.tg.setHeight(height)
def Hide(self):
self.tg.hide()
def Show(self):
self.tg.show()
def Get_value(self):
val = self.tg.getValue()
return val
def Get_height(self):
return self.tg.getHeight()
def Get_width(self):
return self.tg.getWidth()
def Get_size(self):
return self.size
def Get_pos(self):
return self.pos
def Get_posx(self):
return self.posx
def Get_posy(self):
return self.posy
def Get_start_Type(self):
return self.startType
def Get_oncolor(self):
return self.oncolor
def Get_offcolor(self):
return self.offcolor
def Get_handl_oncolor(self):
return self.handl_oncolor
def Get_handl_offcolor(self):
return self.handl_offcolor
def Get_radius(self):
return self.radius
class Dropdowns:
def __init__(self,plane,
pos = [],
size = [],
name = '',
choices = [],
radius = 0,
color = (),
values = [],
direction = 'down',
issubwidget = False,
text_color=(0,0,0),
font=None,
font_size=20):
self.plane = plane
self.pos = pos
self.posx = pos[0]
self.posy = pos[1]
self.size = size
self.width = size[0]
self.height = size[1]
self.name = name
self.choices = choices
self.radius = radius
self.color = color
self.values = values
self.direction = direction
self.issubwidget = issubwidget
self.text_color = text_color
self.font = font
self.font_size = font_size
dd = Dropdown(
self.plane,
self.posx,self.posy,
self.width,self.height,
self.name,
self.choices,
self.issubwidget,
borderRadius = self.radius,
colour = self.color,
values = self.values,
direction = self.direction,
textColour = self.text_color,
fontSize = self.font_size
)
self.dd = dd
def Update(self):
events = pygame.event.get()
for event in events:
if event.type == pygame.QUIT:
pygame.quit()
quit()
pygame_widgets.update(events)
def Get_selected(self):
return self.dd.getSelected()
def Get_dropped(self):
return self.dd.isDropped()
def Get_x(self):
return self.dd.getX()
def Get_y(self):
return self.dd.getY()
def Set_pos(self,pos=[]):
self.posx = pos[0]
self.posy = pos[1]
self.dd.setX(pos[0])
self.dd.setY(pos[1])
def Get_pos(self):
return [self.dd.getX(),self.dd.getY()]
def Get_size(self):
return [self.dd.getWidth(),self.dd.getHeight()]
def Get_width(self):
return self.dd.getWidth()
def Get_height(self):
return self.dd.getHeight()
def Set_height(self, height):
self.height = height
self.dd.setHeight(height)
def Set_width(self, width):
self.width = width
self.dd.setWidth(width)
def Set_posx(self,x):
self.posx = x
self.dd.setX(x)
def Set_posy(self,y):
self.posy = y
self.dd.setY(y)
def Hide(self):
self.dd.hide()
def Show(self):
self.dd.show()
def Enable(self):
self.dd.enable()
def Disable(self):
self.dd.disable()
# 14 -- new !!
class Objectes_:
def __init__(self,name='obj'):
self.name = name
self.pack = []
def Add(self,obj,mass=False):
if mass == True:
self.pack.append(obj)
else:
if len(obj)>1:
for i in range(len(obj)):
self.pack.append(obj[i])
else:
self.pack.append(obj)
def Del_min(self,index):
self.pack.pop(index)
def Del_max(self,a_index,b_index):
del self.pack[a_index-1:b_index]
def Get_name(self):
return self.name
def Set_name(self,name):
self.name = name
def Get_pack(self):
return self.pack
# 15 -- new !!
class Img_:
def __init__(self,surface):
self.surface = surface
def Draw(self,pos =[]):
self.pos = pos
self.rect = self.surface.get_rect(bottomright=(pos[0]+self.surface.get_width(),pos[1]+self.surface.get_height()))
screen.blit(self.surface,self.rect)
| 43.295067 | 175 | 0.372167 | 8,887 | 96,548 | 3.917858 | 0.051311 | 0.026538 | 0.051066 | 0.012752 | 0.625682 | 0.572549 | 0.521426 | 0.490637 | 0.448504 | 0.412057 | 0 | 0.026294 | 0.539514 | 96,548 | 2,229 | 176 | 43.314491 | 0.756855 | 0.001264 | 0 | 0.518414 | 0 | 0 | 0.009868 | 0.000584 | 0 | 0 | 0 | 0 | 0 | 1 | 0.22153 | false | 0.007932 | 0.011898 | 0.07762 | 0.354108 | 0.023229 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4d664f21be6af9ee800137cc69e6e9a069e88bcc | 2,295 | py | Python | atlas/foundations_contrib/src/test/test_bucket_pipeline_archive.py | DeepLearnI/atlas | 8aca652d7e647b4e88530b93e265b536de7055ed | [
"Apache-2.0"
] | 296 | 2020-03-16T19:55:00.000Z | 2022-01-10T19:46:05.000Z | atlas/foundations_contrib/src/test/test_bucket_pipeline_archive.py | DeepLearnI/atlas | 8aca652d7e647b4e88530b93e265b536de7055ed | [
"Apache-2.0"
] | 57 | 2020-03-17T11:15:57.000Z | 2021-07-10T14:42:27.000Z | atlas/foundations_contrib/src/test/test_bucket_pipeline_archive.py | DeepLearnI/atlas | 8aca652d7e647b4e88530b93e265b536de7055ed | [
"Apache-2.0"
] | 38 | 2020-03-17T21:06:05.000Z | 2022-02-08T03:19:34.000Z |
from foundations_spec import *
class TestBucketPipelineArchive(Spec):
@let
def bucket_klass(self):
klass = ConditionalReturn()
klass.return_when(self.bucket, *self.constructor_args, **self.constructor_kwargs)
return klass
bucket = let_mock()
@let
def constructor_args(self):
return self.faker.words()
@let
def constructor_kwargs(self):
return self.faker.pydict()
@let
def object_name(self):
return self.faker.name()
@let
def random_data(self):
return self.faker.uuid4()
@let
def random_prefix(self):
return self.faker.uuid4()
@let
def file_listing_with_prefix(self):
return [f'{self.random_prefix}/{file}' for file in self.faker.words()]
@let
def blob_exists(self):
return self.faker.boolean()
@let
def archive(self):
from foundations_contrib.bucket_pipeline_archive import BucketPipelineArchive
return BucketPipelineArchive(self.bucket_klass, *self.constructor_args, **self.constructor_kwargs)
def test_append_binary_uploads_string_to_bucket(self):
self.archive.append_binary(self.object_name, self.random_data, self.random_prefix)
self.bucket.upload_from_string.assert_called_with(f'{self.random_prefix}/{self.object_name}', self.random_data)
def test_list_files_returns_list_of_files(self):
self.bucket.list_files = ConditionalReturn()
self.bucket.list_files.return_when(self.file_listing_with_prefix, f'{self.random_prefix}/*')
result = self.archive.list_files('*', self.random_prefix)
self.assertEqual(self.file_listing_with_prefix, result)
def test_exists_forwards_to_underlying_bucket(self):
self.bucket.exists = ConditionalReturn()
self.bucket.exists.return_when(self.blob_exists, f'{self.object_name}')
self.assertEqual(self.blob_exists, self.archive.exists(self.object_name))
def test_exists_forwards_to_underlying_bucket_with_prefix(self):
self.bucket.exists = ConditionalReturn()
self.bucket.exists.return_when(self.blob_exists, f'{self.random_prefix}/{self.object_name}')
self.assertEqual(self.blob_exists, self.archive.exists(self.object_name, prefix=self.random_prefix)) | 34.253731 | 119 | 0.714161 | 290 | 2,295 | 5.372414 | 0.196552 | 0.03466 | 0.071887 | 0.073171 | 0.449936 | 0.392169 | 0.316431 | 0.227856 | 0.197689 | 0.197689 | 0 | 0.001066 | 0.182135 | 2,295 | 67 | 120 | 34.253731 | 0.828982 | 0 | 0 | 0.265306 | 0 | 0 | 0.063617 | 0.055338 | 0 | 0 | 0 | 0 | 0.081633 | 1 | 0.265306 | false | 0 | 0.040816 | 0.142857 | 0.530612 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
4d92298b7d6c16d0141055490263b9e479cfd26a | 107 | py | Python | Class 6/helloTkinter.py | GRCosta/vgp245 | 4b5e727a597d884d9bd7ae4a41f5f35e8c0de459 | [
"MIT"
] | 1 | 2019-01-09T19:48:11.000Z | 2019-01-09T19:48:11.000Z | Class 6/helloTkinter.py | GRCosta/vgp245 | 4b5e727a597d884d9bd7ae4a41f5f35e8c0de459 | [
"MIT"
] | null | null | null | Class 6/helloTkinter.py | GRCosta/vgp245 | 4b5e727a597d884d9bd7ae4a41f5f35e8c0de459 | [
"MIT"
] | null | null | null | import tkinter
root = tkinter.Tk()
w = root.Label(root, text = "Hello world!!")
w.pack()
root.mainloop() | 13.375 | 44 | 0.663551 | 16 | 107 | 4.4375 | 0.6875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.149533 | 107 | 8 | 45 | 13.375 | 0.78022 | 0 | 0 | 0 | 0 | 0 | 0.12037 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4d99fc642cac9205f757b68db416bd9413bdec51 | 3,148 | py | Python | model/Database_model.py | premsvmm/sherlock | 1d9c5ac5c082a639039a62de3335dd37679f9b70 | [
"MIT"
] | null | null | null | model/Database_model.py | premsvmm/sherlock | 1d9c5ac5c082a639039a62de3335dd37679f9b70 | [
"MIT"
] | null | null | null | model/Database_model.py | premsvmm/sherlock | 1d9c5ac5c082a639039a62de3335dd37679f9b70 | [
"MIT"
] | null | null | null | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import text
from config import Config
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = Config.DATABASE_URL
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
class User(db.Model):
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
username = db.Column(db.String(80), unique=True, nullable=False)
password = db.Column(db.String(30), nullable=False)
email = db.Column(db.String(120), unique=True, nullable=False)
stocks = db.relationship('Stock', backref="stock price")
def __repr__(self):
return str({
"id": self.id,
"username": self.username,
"password": self.password,
"email": self.email
})
def validate_user(self,email, password):
status = User.query.filter_by(email=email.lower()).filter_by(password=password).first()
if status is None:
return False
else:
return True
def verify_user_is_available(self,email):
status = User.query.filter_by(email=email.lower()).first()
if status is None:
return True
else:
return False
def get_all_user(self):
return User.query.all()
def create_user(self,username,email, password):
new_user = User(username=username, password=password, email=email.lower())
db.session.add(new_user)
db.session.commit()
class Stock(db.Model):
__tablename__ = 'stocks'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
userId = db.Column(db.Integer,db.ForeignKey('users.id'))
stockId = db.Column(db.String(80), nullable=False)
buy = db.Column(db.String(30), nullable=False)
sell = db.Column(db.String(30), nullable=False)
loss = db.Column(db.String(30), nullable=False)
emailtrigger = db.Column(db.Boolean, nullable=False)
def __repr__(self):
return str({
"id": self.id,
"userId": self.userId,
"stockId": self.stockId,
"buy": self.buy,
"sell": self.sell,
"loss": self.loss
})
def create_stock(self,userid,stockId,buy,sell,loss):
new_stock = Stock(userId = userid, stockId = stockId.upper() , buy = buy , sell = sell , loss = loss,
emailtrigger =True)
db.session.add(new_stock)
db.session.commit()
def get_stocklist_by_userid(self,userid):
return Stock.query.filter_by(userId=userid).all()
def update_status_for_user_stock(self,userid,stockid,status=False):
stock_list = Stock.query.filter_by(userId=str(userid)).filter_by(stockId=str(stockid)).first()
stock_list.emailtrigger = status
db.session.commit()
def update_status_to_true(self):
sql = text("UPDATE stocks set emailtrigger=TRUE WHERE emailtrigger in (SELECT emailtrigger from stocks where emailtrigger=FALSE)")
db.engine.execute(sql)
db.session.commit()
| 22.647482 | 138 | 0.635642 | 390 | 3,148 | 4.982051 | 0.223077 | 0.045291 | 0.056613 | 0.057643 | 0.252187 | 0.208955 | 0.183222 | 0.119403 | 0.051467 | 0.051467 | 0 | 0.006308 | 0.2446 | 3,148 | 138 | 139 | 22.811594 | 0.810765 | 0 | 0 | 0.30137 | 0 | 0 | 0.08042 | 0.016847 | 0 | 0 | 0 | 0 | 0 | 1 | 0.136986 | false | 0.082192 | 0.054795 | 0.054795 | 0.520548 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
4daef04d71e51efc6449eb186b9553d862d354fb | 5,305 | py | Python | python/ray/ml/preprocessors/encoder.py | siddgoel/ray | 7f3031f451de410b71a5fcb18e04452bfa7351d6 | [
"Apache-2.0"
] | 22 | 2018-05-08T05:52:34.000Z | 2020-04-01T10:09:55.000Z | python/ray/ml/preprocessors/encoder.py | siddgoel/ray | 7f3031f451de410b71a5fcb18e04452bfa7351d6 | [
"Apache-2.0"
] | 51 | 2018-05-17T05:55:28.000Z | 2020-03-18T06:49:49.000Z | python/ray/ml/preprocessors/encoder.py | AyushExel/ray | 46465abd6d866c3903b17c601e84e81b46c67190 | [
"Apache-2.0"
] | 10 | 2018-04-27T10:50:59.000Z | 2020-02-24T02:41:43.000Z | from typing import List, Dict, Set
import pandas as pd
from ray.data import Dataset
from ray.ml.preprocessor import Preprocessor
class OrdinalEncoder(Preprocessor):
"""Encode values within columns as ordered integer values.
Currently, order within a column is based on the values from the fitted
dataset in sorted order.
Transforming values not included in the fitted dataset will be encoded as ``None``.
Args:
columns: The columns that will individually be encoded.
"""
def __init__(self, columns: List[str]):
# TODO: allow user to specify order of values within each column.
super().__init__()
self.columns = columns
def _fit(self, dataset: Dataset) -> Preprocessor:
self.stats_ = _get_unique_value_indices(dataset, *self.columns)
return self
def _transform_pandas(self, df: pd.DataFrame):
_validate_df(df, *self.columns)
def column_ordinal_encoder(s: pd.Series):
s_values = self.stats_[f"unique_values({s.name})"]
return s.map(s_values)
df.loc[:, self.columns] = df.loc[:, self.columns].transform(
column_ordinal_encoder
)
return df
def __repr__(self):
return f"<Encoder columns={self.columns} stats={self.stats_}>"
class OneHotEncoder(Preprocessor):
"""Encode columns as new columns using one-hot encoding.
The transformed dataset will have a new column in the form ``{column}_{value}``
for each of the values from the fitted dataset. The value of a column will
be set to 1 if the value matches, otherwise 0.
Transforming values not included in the fitted dataset will result in all
of the encoded column values being 0.
Args:
columns: The columns that will individually be encoded.
"""
def __init__(self, columns: List[str]):
# TODO: add `drop` parameter.
super().__init__()
self.columns = columns
def _fit(self, dataset: Dataset) -> Preprocessor:
self.stats_ = _get_unique_value_indices(dataset, *self.columns)
return self
def _transform_pandas(self, df: pd.DataFrame):
_validate_df(df, *self.columns)
# Compute new one-hot encoded columns
for column in self.columns:
column_values = self.stats_[f"unique_values({column})"]
for column_value in column_values:
df[f"{column}_{column_value}"] = (df[column] == column_value).astype(
int
)
# Drop original unencoded columns.
df = df.drop(columns=self.columns)
return df
def __repr__(self):
return f"<Encoder columns={self.columns} stats={self.stats_}>"
class LabelEncoder(Preprocessor):
"""Encode values within a label column as ordered integer values.
Currently, order within a column is based on the values from the fitted
dataset in sorted order.
Transforming values not included in the fitted dataset will be encoded as ``None``.
Args:
label_column: The label column that will be encoded.
"""
def __init__(self, label_column: str):
super().__init__()
self.label_column = label_column
def _fit(self, dataset: Dataset) -> Preprocessor:
self.stats_ = _get_unique_value_indices(dataset, self.label_column)
return self
def _transform_pandas(self, df: pd.DataFrame):
_validate_df(df, self.label_column)
def column_label_encoder(s: pd.Series):
s_values = self.stats_[f"unique_values({s.name})"]
return s.map(s_values)
df[self.label_column] = df[self.label_column].transform(column_label_encoder)
return df
def __repr__(self):
return f"<Encoder label column={self.label_column} stats={self.stats_}>"
def _get_unique_value_indices(
dataset: Dataset, *columns: str
) -> Dict[str, Dict[str, int]]:
results = {}
for column in columns:
values = _get_unique_values(dataset, column)
if any(pd.isnull(v) for v in values):
raise ValueError(
f"Unable to fit column '{column}' because it contains null values. "
f"Consider imputing missing values first."
)
value_to_index = _sorted_value_indices(values)
results[f"unique_values({column})"] = value_to_index
return results
def _get_unique_values(dataset: Dataset, column: str) -> Set[str]:
agg_ds = dataset.groupby(column).count()
# TODO: Support an upper limit by using `agg_ds.take(N)` instead.
return {row[column] for row in agg_ds.iter_rows()}
def _sorted_value_indices(values: Set) -> Dict[str, int]:
"""Converts values to a Dict mapping to unique indexes.
Values will be sorted.
Example:
>>> _sorted_value_indices({"b", "a", "c", "a"})
{"a": 0, "b": 1, "c": 2}
"""
return {value: i for i, value in enumerate(sorted(values))}
def _validate_df(df: pd.DataFrame, *columns: str) -> None:
null_columns = [column for column in columns if df[column].isnull().values.any()]
if null_columns:
raise ValueError(
f"Unable to transform columns {null_columns} because they contain "
f"null values. Consider imputing missing values first."
)
| 32.950311 | 87 | 0.653911 | 696 | 5,305 | 4.788793 | 0.208333 | 0.046205 | 0.031503 | 0.025203 | 0.476148 | 0.426943 | 0.409841 | 0.409841 | 0.409841 | 0.380438 | 0 | 0.001505 | 0.248633 | 5,305 | 160 | 88 | 33.15625 | 0.834671 | 0.272573 | 0 | 0.409639 | 0 | 0 | 0.134316 | 0.049598 | 0 | 0 | 0 | 0.01875 | 0 | 1 | 0.216867 | false | 0 | 0.048193 | 0.036145 | 0.46988 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4db06905a70ab1b545620f712b0dd207a9caf37d | 403 | py | Python | dji_asdk_to_python/utils/FPS.py | PSBPOSAS/dji-asdk-to-python | 39fd29e172249656ce9f6e7b6273eeff6790d8c1 | [
"BSD-3-Clause"
] | 7 | 2020-11-02T16:31:28.000Z | 2021-11-09T21:32:44.000Z | dji_asdk_to_python/utils/FPS.py | PSBPOSAS/dji-asdk-to-python | 39fd29e172249656ce9f6e7b6273eeff6790d8c1 | [
"BSD-3-Clause"
] | 64 | 2020-09-03T04:32:39.000Z | 2022-02-21T20:30:16.000Z | dji_asdk_to_python/utils/FPS.py | PSBPOSAS/dji-asdk-to-python | 39fd29e172249656ce9f6e7b6273eeff6790d8c1 | [
"BSD-3-Clause"
] | 4 | 2020-09-16T19:07:30.000Z | 2022-02-21T04:48:10.000Z | import collections
import time
class FPS:
def __init__(self, avarageof=50):
self.frametimestamps = collections.deque(maxlen=avarageof)
def __call__(self):
self.frametimestamps.append(time.time())
if(len(self.frametimestamps) > 1):
return len(self.frametimestamps) / (self.frametimestamps[-1] - self.frametimestamps[0])
else:
return 0.0
| 26.866667 | 99 | 0.655087 | 44 | 403 | 5.818182 | 0.477273 | 0.445313 | 0.171875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022654 | 0.233251 | 403 | 14 | 100 | 28.785714 | 0.805825 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0 | 0.181818 | 0 | 0.636364 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
4db83a35874715394e4db8bbd479191b11a158f3 | 701 | py | Python | training_function.py | xiaoyanLi629/Bacteria_project | 04c17f3446d604fd2539a6cfe2e2f32c60888390 | [
"MIT"
] | null | null | null | training_function.py | xiaoyanLi629/Bacteria_project | 04c17f3446d604fd2539a6cfe2e2f32c60888390 | [
"MIT"
] | null | null | null | training_function.py | xiaoyanLi629/Bacteria_project | 04c17f3446d604fd2539a6cfe2e2f32c60888390 | [
"MIT"
] | null | null | null | import numpy as np
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import datetime
import time
from test_images import test_images
import torch.utils.data as Data
def train_func(model, loader, loss_func, optimizer, device):
# torch.multiprocessing.freeze_support()
for step, (batch_x, batch_y) in enumerate(loader):
batch_x = batch_x.to(device)
batch_y = batch_y.to(device)
output = model(batch_x)
loss = loss_func(output, batch_y) # cross entropy loss
optimizer.zero_grad() # clear gradients for this training step
loss.backward() # backpropagation, compute gradients
optimizer.step() # apply gradientsd | 35.05 | 71 | 0.710414 | 97 | 701 | 4.979381 | 0.505155 | 0.049689 | 0.066253 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.215407 | 701 | 20 | 72 | 35.05 | 0.878182 | 0.211127 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.058824 | false | 0 | 0.470588 | 0 | 0.529412 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
4dc64ff46ddce89022022a49b2806759443ea104 | 2,246 | py | Python | applications/acsmejorado/controllers/default.py | Mexarm/web2pytests | d8917751cbc5f0adc6f9f7f47654dae2e6b591d4 | [
"BSD-3-Clause"
] | null | null | null | applications/acsmejorado/controllers/default.py | Mexarm/web2pytests | d8917751cbc5f0adc6f9f7f47654dae2e6b591d4 | [
"BSD-3-Clause"
] | null | null | null | applications/acsmejorado/controllers/default.py | Mexarm/web2pytests | d8917751cbc5f0adc6f9f7f47654dae2e6b591d4 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations
#########################################################################
## This is a sample controller
## - index is the default action of any application
## - user is required for authentication and authorization
## - download is for downloading files uploaded in the db (does streaming)
## - api is an example of Hypermedia API support and access control
#########################################################################
def index():
acuse = request.vars['acuse']
q=db.acuse.codigo==acuse
row = db(q).select().first()
#cid = db(db.container.barcode==form.vars.containercode).select().first()
#return dict(row=row)
message="Demo Acuse QP"
return dict(q=q,acuse=acuse,row=row,message=message)
def user():
"""
exposes:
http://..../[app]/default/user/login
http://..../[app]/default/user/logout
http://..../[app]/default/user/register
http://..../[app]/default/user/profile
http://..../[app]/default/user/retrieve_password
http://..../[app]/default/user/change_password
http://..../[app]/default/user/manage_users (requires membership in
use @auth.requires_login()
@auth.requires_membership('group name')
@auth.requires_permission('read','table name',record_id)
to decorate functions that need access control
"""
return dict(form=auth())
@cache.action()
def download():
"""
allows downloading of uploaded files
http://..../[app]/default/download/[filename]
"""
return response.download(request, db)
def call():
"""
exposes services. for example:
http://..../[app]/default/call/jsonrpc
decorate with @services.jsonrpc the functions to expose
supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv
"""
return service()
@auth.requires_login()
def api():
"""
this is example of API with access control
WEB2PY provides Hypermedia API (Collection+JSON) Experimental
"""
from gluon.contrib.hypermedia import Collection
rules = {
'<tablename>': {'GET':{},'POST':{},'PUT':{},'DELETE':{}},
}
return Collection(db).process(request,response,rules)
| 32.085714 | 79 | 0.612645 | 261 | 2,246 | 5.241379 | 0.475096 | 0.046053 | 0.092105 | 0.092105 | 0.038012 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001078 | 0.174087 | 2,246 | 69 | 80 | 32.550725 | 0.736388 | 0.594835 | 0 | 0 | 0 | 0 | 0.071885 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.05 | 0 | 0.55 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
4dc870a08d570a2d20728d63b0190a5945add2fc | 3,721 | py | Python | discussions/migrations/0001_initial.py | fossabot/flaam-api | d11651aa77c4b7c5e26b6443f9699e0a4bec4354 | [
"MIT"
] | 1 | 2022-01-07T04:01:06.000Z | 2022-01-07T04:01:06.000Z | discussions/migrations/0001_initial.py | fossabot/flaam-api | d11651aa77c4b7c5e26b6443f9699e0a4bec4354 | [
"MIT"
] | 26 | 2021-11-14T06:02:59.000Z | 2022-03-29T14:17:39.000Z | discussions/migrations/0001_initial.py | fossabot/flaam-api | d11651aa77c4b7c5e26b6443f9699e0a4bec4354 | [
"MIT"
] | 1 | 2022-01-05T18:51:01.000Z | 2022-01-05T18:51:01.000Z | # Generated by Django 3.2.8 on 2021-10-26 08:11
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("ideas", "0001_initial"),
]
operations = [
migrations.CreateModel(
name="Discussion",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("title", models.CharField(max_length=255)),
("body", models.TextField(blank=True)),
("draft", models.BooleanField(default=True)),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"downvotes",
models.ManyToManyField(
blank=True,
related_name="downvoted_discussions",
to=settings.AUTH_USER_MODEL,
),
),
(
"idea",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="discussions",
to="ideas.idea",
),
),
(
"owner",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL,
),
),
(
"upvotes",
models.ManyToManyField(
blank=True,
related_name="upvoted_discussions",
to=settings.AUTH_USER_MODEL,
),
),
(
"views",
models.ManyToManyField(
blank=True,
related_name="viewed_discussions",
to=settings.AUTH_USER_MODEL,
),
),
],
),
migrations.CreateModel(
name="DiscussionComment",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("body", models.TextField(max_length=500)),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"discussion",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="comments",
to="discussions.discussion",
),
),
(
"owner",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="discussion_comments",
to=settings.AUTH_USER_MODEL,
),
),
],
),
]
| 33.827273 | 72 | 0.398818 | 244 | 3,721 | 5.893443 | 0.327869 | 0.03338 | 0.066759 | 0.087622 | 0.59249 | 0.560501 | 0.404033 | 0.404033 | 0.404033 | 0.404033 | 0 | 0.013789 | 0.512765 | 3,721 | 109 | 73 | 34.137615 | 0.779371 | 0.012094 | 0 | 0.617647 | 1 | 0 | 0.077028 | 0.011704 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.029412 | 0 | 0.068627 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4dc8ab2fb545c88ec9b74564ed348f33e6abea2f | 4,603 | py | Python | les_spm.py | vegardsteen/oving_9 | 3e7fe79549dc56ffc05111516801f0fc6310ba62 | [
"MIT"
] | null | null | null | les_spm.py | vegardsteen/oving_9 | 3e7fe79549dc56ffc05111516801f0fc6310ba62 | [
"MIT"
] | null | null | null | les_spm.py | vegardsteen/oving_9 | 3e7fe79549dc56ffc05111516801f0fc6310ba62 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Tue Oct 26 16:36:10 2021
@author: vegar
"""
with open("sporsmaalsfil.txt", "r", encoding = "UTF8") as fil:
tekst = []
fasit = []
alt = []
for linje in fil:
splitrow = linje.split(":")
tekst.append(splitrow[0])
fasit.append(splitrow[1])
for i in range(len(fasit)):
fasit[i] = int(fasit[i])
alternaltiver = splitrow[2].strip("[").split(",")
alt.append(alternaltiver)
score1 = 0
score2 = 0
from klasse_spm import Spm
if __name__ == "__main__":
spm_1 = Spm(tekst[0], alt[0], fasit[0])
print(spm_1)
bruker_svar1 = int(input("Velg alternaltiv for spiller 1: "))
bruker_svar2 = int(input("Velg alternaltiv for spiller 2: "))
spm_1.korrekt_svar()
if spm_1.sjekk_svar(bruker_svar1):
print("Spiller 1: riktig svar! \n")
score1 += 1
else:
print("Spiller 1: feil. \n")
if spm_1.sjekk_svar(bruker_svar2):
print("Spiller 2: riktig svar! \n")
score2 += 1
else:
print("Spiller 2: feil.\n")
spm_2 = Spm(tekst[1], alt[1], fasit[1])
print(spm_2)
bruker_svar1 = int(input("Velg alternaltiv for spiller 1: "))
bruker_svar2 = int(input("Velg alternaltiv for spiller 2: "))
spm_2.korrekt_svar()
if spm_2.sjekk_svar(bruker_svar1):
print("Spilelr 1: riktig svar! \n")
score1 += 1
else:
print("Spiller 1: feil. \n")
if spm_2.sjekk_svar(bruker_svar2):
print("Spiller 2: riktig svar! \n")
score2 += 1
else:
print("Spiller 2: feil. \n")
spm_3 = Spm(tekst[2], alt[2], fasit[2])
print(spm_3)
bruker_svar1 = int(input("Velg alternaltiv for spiller 1: "))
bruker_svar2 = int(input("Velg alternaltiv for spiller 2: "))
spm_3.korrekt_svar()
if spm_3.sjekk_svar(bruker_svar1):
print("Spilelr 1: riktig svar! \n")
score1 += 1
else:
print("Spiller 1: feil.\n")
if spm_3.sjekk_svar(bruker_svar2):
print("Spiller 2: riktig svar! \n")
score2 += 1
else:
print("Spiller 2: feil.\n")
spm_4 = Spm(tekst[3], alt[3], fasit[3])
print(spm_4)
bruker_svar1 = int(input("Velg alternaltiv for spiller 1: "))
bruker_svar2 = int(input("Velg alternaltiv for spiller 2: "))
spm_4.korrekt_svar()
if spm_4.sjekk_svar(bruker_svar1):
print("Spilelr 1: riktig svar! \n")
score1 += 1
else:
print("Spiller 1: feil.\n")
if spm_4.sjekk_svar(bruker_svar2):
print("Spiller 2: riktig svar! \n")
score2 += 1
else:
print("Spiller 2: feil.\n")
spm_5 = Spm(tekst[4], alt[4], fasit[4])
print(spm_5)
bruker_svar1 = int(input("Velg alternaltiv for spiller 1: "))
bruker_svar2 = int(input("Velg alternaltiv for spiller 2: "))
spm_5.korrekt_svar()
if spm_5.sjekk_svar(bruker_svar1):
print("Spilelr 1: riktig svar! \n")
score1 += 1
else:
print("Spiller 1: feil.\n")
if spm_5.sjekk_svar(bruker_svar2):
print("Spiller 2: riktig svar! \n")
score2 += 1
else:
print("Spiller 2: feil.\n")
spm_6 = Spm(tekst[5], alt[5], fasit[5])
print(spm_6)
bruker_svar1 = int(input("Velg alternaltiv for spiller 1: "))
bruker_svar2 = int(input("Velg alternaltiv for spiller 2: "))
spm_6.korrekt_svar()
if spm_6.sjekk_svar(bruker_svar1):
print("Spilelr 1: riktig svar! \n")
score1 += 1
else:
print("Spiller 1: feil. \n")
if spm_6.sjekk_svar(bruker_svar2):
print("Spiller 2: riktig svar! \n")
score2 += 1
else:
print("Spiller 2: feil.\n")
spm_7 = Spm(tekst[6], alt[6], fasit[6])
print(spm_7)
bruker_svar1 = int(input("Velg alternaltiv for spiller 1: "))
bruker_svar2 = int(input("Velg alternaltiv for spiller 2: "))
spm_7.korrekt_svar()
if spm_7.sjekk_svar(bruker_svar1):
print("Spilelr 1: riktig svar! \n")
score1 += 1
else:
print("Spiller 1: feil.\n")
if spm_7.sjekk_svar(bruker_svar2):
print("Spiller 2: riktig svar! \n")
score2 += 1
else:
print("Spiller 2: feil.\n")
print("Spiller 1 fikk", score1, "poeng.")
print("Spiller 2 fikk", score2, "poeng.")
| 26.302857 | 65 | 0.547904 | 616 | 4,603 | 3.943182 | 0.118506 | 0.118567 | 0.08028 | 0.132565 | 0.727872 | 0.723755 | 0.697406 | 0.697406 | 0.697406 | 0.697406 | 0 | 0.056753 | 0.314795 | 4,603 | 175 | 66 | 26.302857 | 0.71338 | 0.016076 | 0 | 0.560976 | 0 | 0 | 0.252322 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.00813 | 0 | 0.00813 | 0.300813 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4dd1aec1a7348fd3e48782b20e38416590762358 | 533 | py | Python | .venv/lib/python3.8/site-packages/azure/functions/extension/extension_hook_meta.py | MarkusMeyer13/graph-teams-presence | c302b79248f31623a1b209e098afc4f85d96228d | [
"MIT"
] | null | null | null | .venv/lib/python3.8/site-packages/azure/functions/extension/extension_hook_meta.py | MarkusMeyer13/graph-teams-presence | c302b79248f31623a1b209e098afc4f85d96228d | [
"MIT"
] | 1 | 2021-07-28T09:45:24.000Z | 2021-07-28T09:45:24.000Z | .venv/lib/python3.8/site-packages/azure/functions/extension/extension_hook_meta.py | MarkusMeyer13/graph-teams-presence | c302b79248f31623a1b209e098afc4f85d96228d | [
"MIT"
] | null | null | null | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from typing import Callable, NamedTuple
class ExtensionHookMeta(NamedTuple):
"""The metadata of a single life-cycle hook.
The ext_name has the class name of an extension class.
The ext_impl has the callable function that is used by the worker.
"""
ext_name: str
ext_impl: Callable
# When adding more fields, make sure they have default values (e.g.
# ext_new_field: Optional[str] = None
| 31.352941 | 72 | 0.705441 | 76 | 533 | 4.868421 | 0.723684 | 0.032432 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.232645 | 533 | 16 | 73 | 33.3125 | 0.904645 | 0.667917 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.25 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
4dd75bef97e954f9043ff169ae545497096b2ab9 | 3,366 | py | Python | django/docs/releases/1.4.18.txt.py | roshanba/mangal | f7b428811dc07214009cc33f0beb665ead402038 | [
"bzip2-1.0.6",
"MIT"
] | null | null | null | django/docs/releases/1.4.18.txt.py | roshanba/mangal | f7b428811dc07214009cc33f0beb665ead402038 | [
"bzip2-1.0.6",
"MIT"
] | null | null | null | django/docs/releases/1.4.18.txt.py | roshanba/mangal | f7b428811dc07214009cc33f0beb665ead402038 | [
"bzip2-1.0.6",
"MIT"
] | null | null | null | XXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXX XXXXXX XXXXXXX XXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXX XXX XXXXX
XXXXXX XXXXXX XXXXX XXXXXXX XXXXXXXX XXXXXX XX XXXXXX XX XXXX XX X XXXXXXXXXX
XX XXXXXX XXX XX XXX XXXXXX XXXXXXXX
XXXX XXXXXX XXXXXXXX XXX XXXXXXXXXXXXXXX XXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXX XXXX XXXXXXX XXX XXXXXX XXXX XXX XXXX XXXXXXXX XXXX XXX XXXXXXXXXX XX
XXXXXXXXXX XX XXXXXXXXXX XXXXXXXXXX XXX XXXXXX XX XXXXXXXXXXXX XXX XXXXXXXXXX
XXXXXXXXXX XXX XXXXXXXXX X XXXXXX XXXXXXXXXXXXXXX XXXXX XXXXXX
XXXXXXXXXXXXXXXXXXXX XX XXX XXXX XXXXXXX XXXX XXXX XXXX XX XXXXXXXX
XXXXXXXXXXXXXXXX XXXXXXXXXXXX
XXXXXXXXXXXXXX XXXX XXXXX XXXX XXX XXXX XXXXXXX XXXXXX XXXXXXXXXXX XXXXXXX
XXXXXXX XXXXXXXXXX XXXXXX XXX XXXXXXX XXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXX
XXX XXXXXXXXXXXXXXX XXXX XXXXXX XXXXXXXXXXXXXXXXXXXXX XXXX XXXXX XXXX XX X
XXXXXX XX XXXX XX X XXXXXXXXXXXXXXXXXX XXX XXXX XXXXXXXXX XXXXXXX
XXXXXXXXXXXXXX XXXXXXXXXXX XXXXX XXXX X XXXXXXXXX XXXXXXX XXXX XX XXX XXXXX
XXXXXXXXX XXXXXX XXX XXXXXXXX XXXXX XXX XXXXXXXXXXXXXXXX XX XXXXXXXX XXX XX
XXXX XX XXXXXXX XX XXXXXXXXXXXXXXX XXXXXX XXXXX XXXXXXXXXXX XXX XXXXXX XXXX
XXXXXXXXXXX
XX XXXXX XX XXXXXXX XXXX XXXXXXXX XXXX XXXXX XXX XXXXXX XXXX XXXXX XXX XXXXXXX
XXXXXXXXXX XXXXXXXXXXX XXXX XXXXXXXX XXXXXXXX XX XXXXXXXX XXXXXXXX XXXXXXXX
XXXXXXXXXXX XXXXXX XXX XXXX XXX XXXXX XXXXXXXX XXXXXXXXXXX XXXXXX XX XXX
XXXXXXXXXXX XXX XXXXXXXXXX XXXX XXX XXXXXXXX XXX XXXXXXXX XX XXXXXX XXXXXXXXXX
XXXXXXX XXXXXXX XXX XXXXXXX XXXX XXX XXXXXXXX XXXXXXX XXXXXX XXXXXXXXXXX
XXXXXXXXX XXXXXXXX XXX XXXXXX XXX XXXXXXXXXXXXX XXXXXXXX XXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXX XXXXXX XX XXXX XXXXX XX XXXX XXXXX XXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX
XX XXXXXXXX XXX XXXX XX XX XXX XXXXXXXX XXXX XXX XXXXXXXX XXXXXX XXX XXXXX
XXXXXXXXX XXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX XXXXX XXXXXXX
XXXXXXXXXX XX XXX XXXXXX XXX XXX XX XXXX XXXXXXXXXX XXXX XXXX
XXXXXXXXXXXXXXXXXXXX XXXXX XX X XXXXXXXXX XXXXXX XX XXXXXXXXXXXXXXXXX XX
XXXXXXX XXXX XXXXXXXX XXXXXXX XXX XXX XXXX X XXX XXXX X XXXXX XXXX XXXXX XXXXXX
XXXX X XXX XXXXXXX XXXX XXX XXXXXXX XXXXXX XXXXXX XXXXXXXXXX XXXXX XX XXXX XXX
XXXX XXX XXXX XXX XXXXXXXXXXXX XXXXXXXX XXXXXX XXX XXXXXXXX XXXX XX XXXXXX
XXXXXXXXXX XXXXXX
XXXXXXXXXXXXXXXXX XXXXXX XXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX XXXXX XXXXXXXX XX XXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX XXXX
XXX XXXXX XX XXXXXX XXX XXXX XX X XXXXX XXXXXXXXXX X XXX XXXX XXXX XX XXXXXXXX
XXXXX XXXXXX XX XXXXXX XXXXX XXXXX XX XXX XXXX XX XXXX XXXXX XX XXXXXXXX XXXXX
XXXXXXX XXXX XXX XXXXXX X XXXXXXXXXXXXXXXXX XXXXXX XX XXXXXXXXXXXXXX XXXXXXXXXX
XXXX XXXXX XXXXXX XXXX XXXX XXX XXXXX XXX XXXX XX XXXXXX XX XXXXXXX XXXXX
XXXXXX XXXXXX
XXXXX XXXXXXXX XXXX XXXX XXXX XXX XXXXXX XXXXXXX X XXXXXXX XXXX XX XX XXX
XXXXXXXX XXX XXXXXXXXXX XXX XXX XXXXXX XX XXXX XXXX XX X XXXXXXXXXXX XXXX XXX
XXX XX X XXXX XXXX XX XXXXX XXXX XXXXXXX XXX XXXXX XXXX XXXXX XX XXXXXXXXXX
XXXXX X XXXX XXXXXXXXX XXX XXXXXX XX XXX XXX XXX XXXXX XXX
XXXXXXXX
XXXXXXXX
X XX XXXXXXXX XXXXXXXXXXXXX XXXX XXXXXX XXXX XXXXXXXX XXXXXXXX XXXXXXX XX XXXX
XXXXXXXXXXXXXXXXXXXXX XXX XXXX XXXXXXXXXX XX XXXXX XXXXX XX XXX XXXX
XXXXXXX XX XXXXXXX XXXXXX XXXX
| 48.782609 | 79 | 0.856506 | 466 | 3,366 | 6.186695 | 0.062232 | 0.038848 | 0.01214 | 0.015262 | 0.036767 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.143494 | 3,366 | 68 | 80 | 49.5 | 1 | 0 | 0 | 0.745455 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4ddfd7d8717952622125a592afd849991bea6740 | 182 | py | Python | S10/enum_test.py | Tooopik/Kurs_Python | 5c8f040467dae5f9b90ff6a85550708ac4d88549 | [
"Unlicense"
] | null | null | null | S10/enum_test.py | Tooopik/Kurs_Python | 5c8f040467dae5f9b90ff6a85550708ac4d88549 | [
"Unlicense"
] | null | null | null | S10/enum_test.py | Tooopik/Kurs_Python | 5c8f040467dae5f9b90ff6a85550708ac4d88549 | [
"Unlicense"
] | null | null | null | from enum import IntEnum
MenuPogoda = IntEnum('Pogda', 'Słonce Deszcz Wiatr Chmury')
wybor = 2
if wybor == MenuPogoda.Deszcz:
print(MenuPogoda.Deszcz)
else:
print('NIC')
| 15.166667 | 59 | 0.703297 | 23 | 182 | 5.565217 | 0.695652 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006711 | 0.181319 | 182 | 11 | 60 | 16.545455 | 0.852349 | 0 | 0 | 0 | 0 | 0 | 0.186813 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.142857 | 0.285714 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4df62d99d89627d346ae377aa5f750e10a341144 | 2,736 | py | Python | lab2/zad5/zad5.py | DominikSpiljak/Design-Patterns | 51d1a11bd097d28775419eb6fc2a6361d16aa4a4 | [
"Apache-2.0"
] | null | null | null | lab2/zad5/zad5.py | DominikSpiljak/Design-Patterns | 51d1a11bd097d28775419eb6fc2a6361d16aa4a4 | [
"Apache-2.0"
] | null | null | null | lab2/zad5/zad5.py | DominikSpiljak/Design-Patterns | 51d1a11bd097d28775419eb6fc2a6361d16aa4a4 | [
"Apache-2.0"
] | null | null | null | from __future__ import annotations
from abc import ABC, abstractmethod
import time
from datetime import datetime
import statistics
class Subject(ABC):
@abstractmethod
def attach(self, observer: Observer):
pass
@abstractmethod
def detach(self, observer: Observer):
pass
@abstractmethod
def notify(self):
pass
class SlijedBrojeva(Subject):
def __init__(self, input_method):
self.array = []
self.input_method = input_method
self._observers = []
def kreni(self):
while True:
number = self.input_method.getNextInput()
if self.input_method.out_of_resources:
break
self.array.append(number)
self.notify()
time.sleep(1)
def attach(self, observer):
self._observers.append(observer)
def detach(self, observer):
self._observers.remove(observer)
def notify(self):
for observer in self._observers:
observer.update(self)
class Observer(ABC):
@abstractmethod
def update(self, subject: Subject):
pass
class FileWriterObserver(Observer):
def __init__(self, file):
self._file = file
with open(file, 'w'):
pass
def update(self, subject):
with open(self._file, "a") as out:
out.write(str(subject.array) + ', ' + str(datetime.now().isoformat(' ')) + '\n')
class SumPrinterObserver(Observer):
def update(self, subject):
print("Sum:", sum(subject.array))
class AvgPrinterObserver(Observer):
def update(self, subject):
print("Average:", sum(subject.array)/len(subject.array))
class MedianPrinterObserver(Observer):
def update(self, subject):
print("Median:", statistics.median(subject.array))
class InputMethod(ABC):
out_of_resources = False
@abstractmethod
def getNextInput(self):
pass
class TipkovnickiIzvor(InputMethod):
def getNextInput(self):
number = int(input("Input a number or -1 to end inputs: "))
if number == -1:
self.out_of_resources = True
return number
class DatotecniIzvor(InputMethod):
def __init__(self, file):
self._file = open(file)
def getNextInput(self):
number = int(self._file.readline().strip())
if number == -1:
self.out_of_resources = True
return number
def main():
sb = SlijedBrojeva(DatotecniIzvor('input.txt'))
sb.attach(FileWriterObserver('output.txt'))
sb.attach(SumPrinterObserver())
sb.attach(AvgPrinterObserver())
sb.attach(MedianPrinterObserver())
sb.kreni()
if __name__ == "__main__":
main()
| 21.543307 | 92 | 0.621711 | 292 | 2,736 | 5.671233 | 0.267123 | 0.039855 | 0.039251 | 0.060386 | 0.222826 | 0.18901 | 0.051932 | 0.051932 | 0.051932 | 0.051932 | 0 | 0.002 | 0.269006 | 2,736 | 126 | 93 | 21.714286 | 0.826 | 0 | 0 | 0.333333 | 0 | 0 | 0.032529 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.22619 | false | 0.071429 | 0.059524 | 0 | 0.440476 | 0.035714 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
4df6831787ce445cca1ef2bb0b28ed8be126d533 | 396 | py | Python | ubuild.py | zillow/orbital-core | fd1b1fba0647fcc60a9aa24d8d9b5d3be27ceb67 | [
"Apache-2.0"
] | 2 | 2018-03-16T07:17:06.000Z | 2019-01-14T13:11:30.000Z | ubuild.py | zillow/orbital-core | fd1b1fba0647fcc60a9aa24d8d9b5d3be27ceb67 | [
"Apache-2.0"
] | null | null | null | ubuild.py | zillow/orbital-core | fd1b1fba0647fcc60a9aa24d8d9b5d3be27ceb67 | [
"Apache-2.0"
] | 2 | 2019-07-16T14:27:54.000Z | 2020-06-08T15:48:24.000Z | from uranium import current_build
current_build.packages.install("uranium-plus[vscode]")
import uranium_plus
current_build.config.update(
{
"uranium-plus": {
"module": "orbital_core",
"test": {"packages": ["pytest-aiohttp", "pytest-xdist"]},
"publish": {"additional_args": ["--release"]},
}
}
)
uranium_plus.bootstrap(current_build)
| 23.294118 | 69 | 0.621212 | 39 | 396 | 6.102564 | 0.589744 | 0.201681 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.219697 | 396 | 16 | 70 | 24.75 | 0.770227 | 0 | 0 | 0 | 0 | 0 | 0.300505 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.153846 | 0 | 0.153846 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4df874214201d7ac38ddd33517c50632569d2e61 | 1,804 | py | Python | models/miniwiki_models.py | irom-lab/PAC-BUS | bafd60a3584086530fece34f74ce72a6b0579b9c | [
"MIT"
] | 5 | 2021-01-31T18:11:35.000Z | 2022-03-31T21:55:50.000Z | models/miniwiki_models.py | irom-lab/PAC-BUS | bafd60a3584086530fece34f74ce72a6b0579b9c | [
"MIT"
] | null | null | null | models/miniwiki_models.py | irom-lab/PAC-BUS | bafd60a3584086530fece34f74ce72a6b0579b9c | [
"MIT"
] | 1 | 2021-03-15T10:10:41.000Z | 2021-03-15T10:10:41.000Z | import torch
import torch.nn as nn
import numpy as np
from sklearn.linear_model import LogisticRegression as Logit
from scipy.optimize import brentq
from models.layers import StochasticLinear as SLinear
from models.layers import NotStochasticLinear as Linear
from models.layers import BoundedStochasticModel
class SMiniWikiModel(BoundedStochasticModel):
def __init__(self, input_dim, output_dim, radius):
super().__init__(radius, mag_input=1)
self.names = ('layer1',)
self.layer1 = SLinear(input_dim, output_dim, bias=False)
def forward(self, x):
scale = self.get_scale()
return self.layer1(x, scale)
class MiniWikiModel(BoundedStochasticModel):
def __init__(self, input_dim, output_dim, radius):
super().__init__(radius, mag_input=1)
self.names = ('layer1',)
self.layer1 = Linear(input_dim, output_dim, bias=False)
def forward(self, x):
scale = self.get_scale()
return self.layer1(x, scale)
class LogReg(nn.Module):
def __init__(self, input_dim, output_dim):
super(LogReg, self).__init__()
self.input_dim = input_dim
self.output_dim = output_dim
self.linear = torch.nn.Linear(input_dim, output_dim, bias=False)
def forward(self, x):
return self.linear(x)
class ConstrainedLogit(Logit):
def __init__(self, radius=1.0, interval=[-4, 4], **kwargs):
self.radius = radius
self.interval = interval
self.kwargs = kwargs
def logit(self, logC, X, Y):
super().__init__(C=10 ** logC, fit_intercept=False, **self.kwargs, max_iter=1000)
super().fit(X, Y)
return np.linalg.norm(self.coef_) - self.radius
def fit(self, X, Y):
brentq(self.logit, *self.interval, args=(X, Y), full_output=True)
| 31.103448 | 89 | 0.676829 | 240 | 1,804 | 4.85 | 0.270833 | 0.054983 | 0.072165 | 0.087629 | 0.396048 | 0.396048 | 0.396048 | 0.371993 | 0.371993 | 0.371993 | 0 | 0.012649 | 0.211197 | 1,804 | 57 | 90 | 31.649123 | 0.805341 | 0 | 0 | 0.302326 | 0 | 0 | 0.006656 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.209302 | false | 0 | 0.186047 | 0.023256 | 0.581395 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
150538a9741d119e14f2e15d72281b72c44210bf | 74 | py | Python | python/coursera_python/WESLEYAN/week3/COURSERA/week_3/t_6.py | SayanGhoshBDA/code-backup | 8b6135facc0e598e9686b2e8eb2d69dd68198b80 | [
"MIT"
] | 16 | 2018-11-26T08:39:42.000Z | 2019-05-08T10:09:52.000Z | python/coursera_python/WESLEYAN/week3/COURSERA/week_3/t_6.py | SayanGhoshBDA/code-backup | 8b6135facc0e598e9686b2e8eb2d69dd68198b80 | [
"MIT"
] | 8 | 2020-05-04T06:29:26.000Z | 2022-02-12T05:33:16.000Z | python/coursera_python/WESLEYAN/week3/COURSERA/week_3/t_6.py | SayanGhoshBDA/code-backup | 8b6135facc0e598e9686b2e8eb2d69dd68198b80 | [
"MIT"
] | 5 | 2020-02-11T16:02:21.000Z | 2021-02-05T07:48:30.000Z | infilename = input()
outfilename = input()
print(infilename,outfilename)
| 14.8 | 29 | 0.77027 | 7 | 74 | 8.142857 | 0.571429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.108108 | 74 | 4 | 30 | 18.5 | 0.863636 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
150c68d211460765ed3da92f0225a1594ba934c0 | 284 | py | Python | Mundo2/FOR/for003.py | JoaoPauloPereirax/Python-Study | 806dce740b0b734085aeff8d6822ef0bbc001f5a | [
"MIT"
] | null | null | null | Mundo2/FOR/for003.py | JoaoPauloPereirax/Python-Study | 806dce740b0b734085aeff8d6822ef0bbc001f5a | [
"MIT"
] | null | null | null | Mundo2/FOR/for003.py | JoaoPauloPereirax/Python-Study | 806dce740b0b734085aeff8d6822ef0bbc001f5a | [
"MIT"
] | null | null | null | '''Faça um programa que calcule a soma entre todos os números ímpares que são múltiplos de três e que se encontram no intervalo de 1 até 500.'''
soma=0
for cont in range(0,500):
if(cont%3==0 and cont%2!=0):
print(cont)
soma+=cont
print('A soma é: {}'.format(soma)) | 40.571429 | 144 | 0.665493 | 53 | 284 | 3.566038 | 0.679245 | 0.05291 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.058036 | 0.211268 | 284 | 7 | 145 | 40.571429 | 0.785714 | 0.485915 | 0 | 0 | 0 | 0 | 0.085106 | 0 | 0 | 0 | 0 | 0.142857 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
127beadbfb4e2244415757220735a6db068ceafa | 3,115 | py | Python | shm/properties.py | TurpIF/clubelek-c3po | ebacab3b99580ccadb9e4eacaf3e45228eb7a027 | [
"MIT"
] | null | null | null | shm/properties.py | TurpIF/clubelek-c3po | ebacab3b99580ccadb9e4eacaf3e45228eb7a027 | [
"MIT"
] | null | null | null | shm/properties.py | TurpIF/clubelek-c3po | ebacab3b99580ccadb9e4eacaf3e45228eb7a027 | [
"MIT"
] | null | null | null | from multiprocessing import Lock
from functools import partial as _bind
class BaseProperty:
"""
Base interface for properties, who always should extend this class.
"""
def __init__(self):
"""Initialize the property with a multiprocess lock."""
self.lock = Lock()
# list of exposed methods through the shm
EXPOSED = ('typeid', 'get', 'set')
def typeid(self):
"""Retreive a unique identifier for the property's type."""
return self.__class__.__name__
def get(self):
"""
Return the data representation of this property.
"""
with self.lock:
return self.get_value()
def set(self, value):
"""
Change the data for this property, the value should be unpacked here,
raising by convention a ValueError if the value given won't fit for
this property, or a TypeError if the datatype isn't valid.
"""
with self.lock:
self.set_value(value)
def get_value(self):
"""Implement this method with the property's actual getting method."""
raise NotImplementedError
def set_value(self, value):
"""Implement this method with the property's actual setting method."""
raise NotImplementedError
class Value(BaseProperty):
"""
The most simple property, a simple single value. The given value must be
JSON serializable.
TODO type/value checking?
"""
def __init__(self, value):
BaseProperty.__init__(self)
self.value = self.format_value(value)
def format_value(self, value):
"""
Called right before setting the value, formats the value and can raise
TypeError / ValueError in case the value isn't correct.
"""
return value
def get_value(self):
return self.value
def set_value(self, value):
self.value = self.format_value(value)
class TypedValue(Value):
"""Value with a type."""
def __init__(self, value, type):
self.type = type
Value.__init__(self, value)
def format_value(self, value):
return self.type(value)
class Array(Value):
def __init__(self, value, type=None, length=None):
self.type = type
self.length = length
Value.__init__(self, value)
def format_value(self, value):
if self.length is not None and self.length != len(value):
raise ValueError('array should be of length %s' % self.length)
if self.type is not None:
value = tuple((self.type(v) for v in value))
return Value.format_value(self, value)
# basic types
class Bool(TypedValue):
def __init__(self, value):
TypedValue.__init__(self, value, type=bool)
class Int(TypedValue):
def __init__(self, value):
TypedValue.__init__(self, value, type=int)
class Float(TypedValue):
def __init__(self, value):
TypedValue.__init__(self, value, type=float)
# composite but basic types
class Point(Array):
def __init__(self, x, y, z):
Array.__init__(self, (x, y, z), type=float, length=3)
| 29.386792 | 78 | 0.636276 | 400 | 3,115 | 4.7525 | 0.2775 | 0.099421 | 0.075224 | 0.0505 | 0.287217 | 0.21252 | 0.169911 | 0.169911 | 0.126775 | 0.08364 | 0 | 0.000438 | 0.267095 | 3,115 | 105 | 79 | 29.666667 | 0.832238 | 0.286035 | 0 | 0.368421 | 0 | 0 | 0.01937 | 0 | 0 | 0 | 0 | 0.009524 | 0 | 1 | 0.315789 | false | 0 | 0.035088 | 0.035088 | 0.614035 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
128c2338575b1ce26ae7294601f0ec7b75058f2c | 380 | py | Python | C-digosPython/entradaSalida.py | Jav10/Python | b419a86825313b8ee537757079c95f3097f4dbad | [
"MIT"
] | null | null | null | C-digosPython/entradaSalida.py | Jav10/Python | b419a86825313b8ee537757079c95f3097f4dbad | [
"MIT"
] | null | null | null | C-digosPython/entradaSalida.py | Jav10/Python | b419a86825313b8ee537757079c95f3097f4dbad | [
"MIT"
] | null | null | null | #Entrada y Salida Estándar
#Autor: Javier Arturo Hernández Sosa
#Fecha: 3/Sep/2017
#Descripcion: Curso Python FES Acatlán
#Entrada y Salida Estándar
#Salida
x="Paco"
print("Hola ",x) #print puede tener varios valores separados por coma
print("Hola",x,"¿Cómo estas?")
print(f"Hola, {x}. ¿Cómo estas?") #Notacón PEP 498
#Entrada
x = input("Dame un número: ")
print(x) | 27.142857 | 70 | 0.702632 | 60 | 380 | 4.483333 | 0.666667 | 0.055762 | 0.104089 | 0.163569 | 0.111524 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025237 | 0.165789 | 380 | 14 | 71 | 27.142857 | 0.817035 | 0.573684 | 0 | 0 | 0 | 0 | 0.453901 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.666667 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
12a8e1bb799177ae7866a677e2addf28ee4470ae | 2,135 | py | Python | oo/carro.py | victorsmorais/pythonbirds | 3c593a11f6a013f6e50a05163f6d5ba4a042fa6d | [
"MIT"
] | null | null | null | oo/carro.py | victorsmorais/pythonbirds | 3c593a11f6a013f6e50a05163f6d5ba4a042fa6d | [
"MIT"
] | null | null | null | oo/carro.py | victorsmorais/pythonbirds | 3c593a11f6a013f6e50a05163f6d5ba4a042fa6d | [
"MIT"
] | null | null | null | class Motor:
"""
doctest para motor
>>> # testando motor
>>> motor=Motor()
>>> motor.acelerar()
>>> motor.velocidade
1
>>> motor.frear()
>>> motor.velocidade
0
"""
def __init__(self, velocidade=0):
self.velocidade = velocidade
def acelerar(self):
self.velocidade += 1
def frear(self):
if self.velocidade > 1:
self.velocidade -= 2
elif self.velocidade == 1:
self.velocidade -= 1
motor1 = Motor()
class Direcao:
def __init__(self, direcao='Norte'):
self.direcao = direcao
def girar_a_direita(self):
if self.direcao == 'Norte':
self.direcao = 'Leste'
elif self.direcao == 'Leste':
self.direcao = 'Sul'
elif self.direcao == 'Sul':
self.direcao = 'Oeste'
elif self.direcao == 'Oeste':
self.direcao = 'Norte'
def girar_a_esquerda(self):
if self.direcao == 'Norte':
self.direcao = 'Oeste'
elif self.direcao == 'Oeste':
self.direcao = 'Sul'
elif self.direcao == 'Sul':
self.direcao = 'Leste'
elif self.direcao == 'Leste':
self.direcao = 'Norte'
direcao1 = Direcao()
class Carro:
def __init__(self, motor=Motor(), direcao=Direcao()):
self.motor = motor
self.direcao = direcao
def calcular_velocidade(self):
return self.motor.velocidade
def mostrar_direcao(self):
return self.direcao.direcao
def acelerar(self):
self.motor.acelerar()
def frear(self):
self.motor.frear()
def girar_a_esquerda(self):
self.direcao.girar_a_esquerda()
def girar_a_direita(self):
self.direcao.girar_a_direita()
carro = Carro()
if __name__ == '__main__':
print(carro.calcular_velocidade())
print(carro.mostrar_direcao())
carro.acelerar()
carro.acelerar()
print(carro.calcular_velocidade())
carro.frear()
print(carro.calcular_velocidade())
carro.girar_a_esquerda()
carro.girar_a_esquerda()
print(carro.mostrar_direcao())
| 21.785714 | 57 | 0.582201 | 232 | 2,135 | 5.172414 | 0.146552 | 0.201667 | 0.075 | 0.05 | 0.444167 | 0.228333 | 0.228333 | 0.191667 | 0.191667 | 0 | 0 | 0.006609 | 0.291335 | 2,135 | 97 | 58 | 22.010309 | 0.786517 | 0.066979 | 0 | 0.57377 | 0 | 0 | 0.043724 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.213115 | false | 0 | 0 | 0.032787 | 0.295082 | 0.081967 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
12a916fa60824cf804ba8624e2e8631445e5b693 | 2,174 | py | Python | oauth/services/gitlab.py | giuseppe/quay | a1b7e4b51974edfe86f66788621011eef2667e6a | [
"Apache-2.0"
] | 2,027 | 2019-11-12T18:05:48.000Z | 2022-03-31T22:25:04.000Z | oauth/services/gitlab.py | giuseppe/quay | a1b7e4b51974edfe86f66788621011eef2667e6a | [
"Apache-2.0"
] | 496 | 2019-11-12T18:13:37.000Z | 2022-03-31T10:43:45.000Z | oauth/services/gitlab.py | giuseppe/quay | a1b7e4b51974edfe86f66788621011eef2667e6a | [
"Apache-2.0"
] | 249 | 2019-11-12T18:02:27.000Z | 2022-03-22T12:19:19.000Z | from oauth.base import OAuthService, OAuthEndpoint
from util import slash_join
class GitLabOAuthService(OAuthService):
def __init__(self, config, key_name):
super(GitLabOAuthService, self).__init__(config, key_name)
def service_id(self):
return "gitlab"
def service_name(self):
return "GitLab"
def _endpoint(self):
return self.config.get("GITLAB_ENDPOINT", "https://gitlab.com")
def user_endpoint(self):
raise NotImplementedError
def api_endpoint(self):
return self._endpoint()
def get_public_url(self, suffix):
return slash_join(self._endpoint(), suffix)
def authorize_endpoint(self):
return OAuthEndpoint(slash_join(self._endpoint(), "/oauth/authorize"))
def token_endpoint(self):
return OAuthEndpoint(slash_join(self._endpoint(), "/oauth/token"))
def validate_client_id_and_secret(self, http_client, url_scheme_and_hostname):
# We validate the client ID and secret by hitting the OAuth token exchange endpoint with
# the real client ID and secret, but a fake auth code to exchange. Gitlab's implementation will
# return `invalid_client` as the `error` if the client ID or secret is invalid; otherwise, it
# will return another error.
url = self.token_endpoint().to_url()
redirect_uri = self.get_redirect_uri(url_scheme_and_hostname, redirect_suffix="trigger")
data = {
"code": "fakecode",
"client_id": self.client_id(),
"client_secret": self.client_secret(),
"grant_type": "authorization_code",
"redirect_uri": redirect_uri,
}
# We validate by checking the error code we receive from this call.
result = http_client.post(url, data=data, timeout=5)
value = result.json()
if not value:
return False
return value.get("error", "") != "invalid_client"
def get_public_config(self):
return {
"CLIENT_ID": self.client_id(),
"AUTHORIZE_ENDPOINT": self.authorize_endpoint().to_url(),
"GITLAB_ENDPOINT": self._endpoint(),
}
| 35.064516 | 103 | 0.655474 | 262 | 2,174 | 5.19084 | 0.332061 | 0.047059 | 0.052941 | 0.046324 | 0.113235 | 0.083824 | 0.083824 | 0.083824 | 0.083824 | 0 | 0 | 0.00061 | 0.24563 | 2,174 | 61 | 104 | 35.639344 | 0.828659 | 0.167893 | 0 | 0 | 0 | 0 | 0.119246 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.261905 | false | 0 | 0.047619 | 0.190476 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
12b00de17627858f30751c103c51dab78ab25cc3 | 186 | py | Python | CodeWars/7 Kyu/Bingo ( Or Not ).py | anubhab-code/Competitive-Programming | de28cb7d44044b9e7d8bdb475da61e37c018ac35 | [
"MIT"
] | null | null | null | CodeWars/7 Kyu/Bingo ( Or Not ).py | anubhab-code/Competitive-Programming | de28cb7d44044b9e7d8bdb475da61e37c018ac35 | [
"MIT"
] | null | null | null | CodeWars/7 Kyu/Bingo ( Or Not ).py | anubhab-code/Competitive-Programming | de28cb7d44044b9e7d8bdb475da61e37c018ac35 | [
"MIT"
] | null | null | null | def bingo(array):
ctr = 0
for i in [2, 9, 14, 7, 15]:
if i in list(set(array)):
ctr += 1
if ctr == 5:
return "WIN"
else:
return "LOSE" | 20.666667 | 33 | 0.430108 | 29 | 186 | 2.758621 | 0.758621 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.09434 | 0.430108 | 186 | 9 | 34 | 20.666667 | 0.660377 | 0 | 0 | 0 | 0 | 0 | 0.037433 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
12b9eebc91723d9b8e388a4f94480fccc8f348bf | 229 | py | Python | test/system/anarchism/molecule/default/tests/test_testaid_system_anarchism_project_github_issues.py | RebelCodeBase/testaid | 998c827b826fe4374ecf0a234fef61a975e2fcd7 | [
"Apache-2.0"
] | 17 | 2019-08-04T09:29:19.000Z | 2020-05-16T02:25:20.000Z | test/system/anarchism/molecule/default/tests/test_testaid_system_anarchism_project_github_issues.py | RebelCodeBase/testaid | 998c827b826fe4374ecf0a234fef61a975e2fcd7 | [
"Apache-2.0"
] | 12 | 2019-07-19T22:20:42.000Z | 2020-01-20T06:45:38.000Z | test/system/anarchism/molecule/default/tests/test_testaid_system_anarchism_project_github_issues.py | RebelCodeBase/testaid | 998c827b826fe4374ecf0a234fef61a975e2fcd7 | [
"Apache-2.0"
] | 3 | 2019-08-08T18:18:13.000Z | 2019-10-07T13:46:03.000Z | import testaid
testinfra_hosts = testaid.hosts()
# issue: https://github.com/RebelCodeBase/testaid/issues/1
def test_testaid_system_github_issues_1(host, testvars):
assert testvars['project_github_issues_1_file'] == 'bar'
| 25.444444 | 60 | 0.790393 | 31 | 229 | 5.516129 | 0.645161 | 0.122807 | 0.152047 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014493 | 0.09607 | 229 | 8 | 61 | 28.625 | 0.811594 | 0.244541 | 0 | 0 | 0 | 0 | 0.181287 | 0.163743 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
12c2bca5896e2a19d416d182ba7334345710f453 | 13,599 | py | Python | utils.py | SidRama/Longitudinal-VAE | 3b8a341da14063728dd37a8e76b4372eb5256c97 | [
"MIT"
] | 4 | 2021-04-02T04:06:45.000Z | 2022-03-11T08:18:36.000Z | utils.py | SidRama/Longitudinal-VAE | 3b8a341da14063728dd37a8e76b4372eb5256c97 | [
"MIT"
] | 1 | 2021-10-30T14:00:59.000Z | 2021-10-30T14:00:59.000Z | utils.py | SidRama/Longitudinal-VAE | 3b8a341da14063728dd37a8e76b4372eb5256c97 | [
"MIT"
] | 1 | 2022-02-19T07:23:08.000Z | 2022-02-19T07:23:08.000Z | from torch.utils.data.sampler import Sampler
from torch.utils.data.sampler import BatchSampler
import torch
import numpy as np
import itertools
from collections import OrderedDict
class _RepeatSampler(object):
"""
Sampler that repeats forever.
Args:
sampler (Sampler)
"""
def __init__(self, sampler):
self.sampler = sampler
def __iter__(self):
while True:
yield from iter(self.sampler)
class HensmanDataLoader(torch.utils.data.dataloader.DataLoader):
"""
Dataloader when using minibatching with Stochastic Variational Inference.
"""
def __init__(self, dataset, batch_sampler, num_workers):
super().__init__(dataset, batch_sampler=_RepeatSampler(batch_sampler), num_workers=num_workers)
self.iterator = super().__iter__()
def __len__(self):
return len(self.batch_sampler.sampler)
def __iter__(self):
for i in range(len(self)):
yield next(self.iterator)
class SubjectSampler(Sampler):
"""
Perform individual-wise sampling
"""
def __init__(self, data_source, P, T):
super(SubjectSampler, self).__init__(data_source)
self.data_source = data_source
self.P = P
self.T = T
def __iter__(self):
r = np.arange(self.P)
np.random.shuffle(r)
list_of_lists = list(map(lambda x: [i for i in range(self.T*x, self.T*(x+1))], r))
res = list(itertools.chain.from_iterable(list_of_lists))
return iter(res)
def __len__(self):
return len(self.data_source)
class VaryingLengthSubjectSampler(Sampler):
"""
Perform individual-wise sampling when individuals have varying number of temporal samples.
"""
def __init__(self, data_source, id_covariate):
super(VaryingLengthSubjectSampler, self).__init__(data_source)
self.data_source = data_source
self.id_covariate = id_covariate
def f(x):
return int(x['label'][id_covariate].item())
l = list(map(f, data_source))
self.P = len(set(l))
self.start_indices = [l.index(x) for x in list(OrderedDict.fromkeys(l))]
self.end_indices = self.start_indices[1:] + [len(data_source)]
def __iter__(self):
r = np.arange(self.P)
np.random.shuffle(r)
list_of_lists = list(map(lambda x: [(i, x) for i in range(self.start_indices[x], self.end_indices[x])], r))
res = iter(itertools.chain.from_iterable(list_of_lists))
return iter(res)
def __len__(self):
return self.P
class VaryingLengthBatchSampler(BatchSampler):
"""
Perform batch sampling when individuals have varying number of temporal samples.
"""
def __init__(self, sampler, batch_size):
super(VaryingLengthBatchSampler, self).__init__(sampler, batch_size, False)
assert isinstance(sampler, VaryingLengthSubjectSampler)
self.sampler = sampler
self.batch_size = batch_size
#__len__ defined by the superclass
def __iter__(self):
batch = []
batch_subjects = set()
for idx, subj in self.sampler:
if subj not in batch_subjects:
if len(batch_subjects) == self.batch_size:
yield batch
batch = []
batch_subjects.clear()
batch_subjects.add(subj)
batch.append(idx)
yield batch
def batch_predict_varying_T(latent_dim, covar_module0, covar_module1, likelihoods, prediction_x,
test_x, mu, zt_list, id_covariate, eps):
"""
Perform batch predictions when individuals have varying number of temporal samples.
"""
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
Q = prediction_x.shape[1]
M = zt_list[0].shape[0]
I_M = torch.eye(M, dtype=torch.double).to(device)
if isinstance(covar_module0, list):
K0xz = torch.zeros(latent_dim, prediction_x.shape[0], M).double().to(device)
K0zz = torch.zeros(latent_dim, M, M).double().to(device)
K0Xz = torch.zeros(latent_dim, test_x.shape[0], M).double().to(device)
for i in range(latent_dim):
covar_module0[i].eval()
covar_module1[i].eval()
likelihoods[i].eval()
z = zt_list[i].to(device)
K0xz[i] = covar_module0[i](prediction_x, z).evaluate()
K0zz[i] = covar_module0[i](z, z).evaluate()
K0Xz[i] = covar_module0[i](test_x, z).evaluate()
else:
covar_module0.eval()
covar_module1.eval()
likelihoods.eval()
K0xz = covar_module0(prediction_x, zt_list).evaluate()
K0zz = covar_module0(zt_list, zt_list).evaluate()
K0Xz = covar_module0(test_x, zt_list).evaluate()
K0zz = K0zz + eps * I_M
K0zx = K0xz.transpose(-1, -2)
iB_st_list = []
H = K0zz
subjects = torch.unique(prediction_x[:, id_covariate]).tolist()
iB_mu = torch.zeros(latent_dim, prediction_x.shape[0], 1, dtype=torch.double).to(device)
for s in subjects:
indices = prediction_x[:, id_covariate] == s
x_st = prediction_x[indices]
T = x_st.shape[0]
I_T = torch.eye(T, dtype=torch.double).to(device)
if isinstance(covar_module0, list):
B_st = torch.zeros(latent_dim, T, T, dtype=torch.double).to(device)
for i in range(latent_dim):
B_st[i] = covar_module1[i](x_st, x_st).evaluate() + I_T * likelihoods[i].noise_covar.noise
else:
stacked_x_st = torch.stack([x_st for i in range(latent_dim)], dim=0)
B_st = covar_module1(stacked_x_st, stacked_x_st).evaluate() + I_T * likelihoods.noise_covar.noise.unsqueeze(dim=2)
LB_st = torch.cholesky(B_st)
iB_st = torch.cholesky_solve(I_T, LB_st)
K0xz_st = K0xz[:, indices]
K0zx_st = K0xz_st.transpose(-1, -2)
iB_K0xz = torch.matmul(iB_st, K0xz_st)
K0zx_iB_K0xz = torch.matmul(K0zx_st, iB_K0xz)
H = H + K0zx_iB_K0xz
iB_mu[:, indices] = torch.matmul(iB_st, mu[indices].T.unsqueeze(dim=2))
iB_st_list.append(iB_st)
K0xz_iH_K0zx_iB_mu_st = torch.matmul(K0xz, torch.solve(torch.matmul(K0zx, iB_mu), H)[0])
iB_K0xz_iH_K0zx_iB_mu = torch.zeros(latent_dim, prediction_x.shape[0], 1, dtype=torch.double).to(device)
for i, s in enumerate(subjects):
indices = prediction_x[:, id_covariate] == s
iB_K0xz_iH_K0zx_iB_mu[:, indices] = torch.matmul(iB_st_list[i], K0xz_iH_K0zx_iB_mu_st[:, indices])
mu_tilde = iB_mu - iB_K0xz_iH_K0zx_iB_mu
K0Xz_iK0zz_K0zx_mu_tilde = torch.matmul(K0Xz, torch.solve(torch.matmul(K0zx, mu_tilde), K0zz)[0])
test_subjects = torch.unique(test_x[:, id_covariate]).cpu().numpy()
mask = np.isin(prediction_x[:, id_covariate].cpu().numpy(), test_subjects)
K1Xx_mu_tilde = torch.zeros(latent_dim, test_x.shape[0], 1, dtype=torch.double).to(device)
for s in test_subjects:
indices = test_x[:, id_covariate] == s
if isinstance(covar_module0, list):
K1Xx = torch.zeros(latent_dim, test_x[indices].shape[0], np.sum(mask)).double().to(device)
for i in range(latent_dim):
K1Xx[i] = covar_module1[i](test_x[indices], prediction_x[mask]).evaluate()
else:
stacked_test_x_indices = torch.stack([test_x[indices] for i in range(latent_dim)], dim=0)
stacked_prediction_x_mask = torch.stack([prediction_x[mask] for i in range(latent_dim)], dim=0)
K1Xx = covar_module1(stacked_test_x_indices, stacked_prediction_x_mask).evaluate()
K1Xx_mu_tilde[:, indices] = torch.matmul(K1Xx, mu_tilde[:, mask])
Z_pred = (K0Xz_iK0zz_K0zx_mu_tilde + K1Xx_mu_tilde).squeeze(dim=2).T
return Z_pred
def batch_predict(latent_dim, covar_module0, covar_module1, likelihoods, prediction_x, test_x, mu,
zt_list, P, T, id_covariate, eps):
"""
Perform batch-wise predictions
"""
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
Q = prediction_x.shape[1]
M = zt_list[0].shape[0]
I_M = torch.eye(M, dtype=torch.double).to(device)
I_T = torch.eye(T, dtype=torch.double).to(device)
x_st = torch.reshape(prediction_x, [P, T, Q])
mu = mu.T
mu_st = torch.reshape(mu, [latent_dim, P, T, 1])
if isinstance(covar_module0, list):
K0xz = torch.zeros(latent_dim, P*T, M).double().to(device)
K0zz = torch.zeros(latent_dim, M, M).double().to(device)
B_st = torch.zeros(latent_dim, P, T, T).double().to(device)
K0Xz = torch.zeros(latent_dim, test_x.shape[0], M).double().to(device)
for i in range(latent_dim):
covar_module0[i].eval()
covar_module1[i].eval()
likelihoods[i].eval()
z = zt_list[i].to(device)
K0xz[i] = covar_module0[i](prediction_x, z).evaluate()
K0zz[i] = covar_module0[i](z, z).evaluate()
B_st[i] = covar_module1[i](x_st, x_st).evaluate() + I_T * likelihoods[i].noise_covar.noise
K0Xz[i] = covar_module0[i](test_x, z).evaluate()
else:
covar_module0.eval()
covar_module1.eval()
likelihoods.eval()
stacked_x_st = torch.stack([x_st for i in range(latent_dim)], dim=1)
K0xz = covar_module0(prediction_x, zt_list).evaluate()
K0zz = covar_module0(zt_list, zt_list).evaluate()
B_st = (covar_module1(stacked_x_st, stacked_x_st).evaluate() + I_T * likelihoods.noise_covar.noise.unsqueeze(dim=2)).transpose(0, 1)
K0Xz = covar_module0(test_x, zt_list).evaluate()
K0zz = K0zz + eps * I_M
LB_st = torch.cholesky(B_st)
iB_st = torch.cholesky_solve(I_T, LB_st)
K0xz_st = torch.reshape(K0xz, [latent_dim, P, T, M])
K0zx_st = K0xz_st.transpose(-1, -2)
K0zx = K0xz.transpose(-1, -2)
iB_K0xz = torch.matmul(iB_st, K0xz_st)
K0zx_iB_K0xz = torch.matmul(K0zx, torch.reshape(iB_K0xz, [latent_dim, P*T, M]))
H = K0zz + K0zx_iB_K0xz
iB_mu = torch.matmul(iB_st, mu_st).view(latent_dim, -1, 1)
K0xz_iH_K0zx_iB_mu_st = torch.matmul(K0xz, torch.solve(torch.matmul(K0zx, iB_mu), H)[0]).reshape(latent_dim, P, T, -1)
iB_K0xz_iH_K0zx_iB_mu = torch.matmul(iB_st, K0xz_iH_K0zx_iB_mu_st).view(latent_dim, -1, 1)
mu_tilde = iB_mu - iB_K0xz_iH_K0zx_iB_mu
K0Xz_iK0zz_K0zx_mu_tilde = torch.matmul(K0Xz, torch.solve(torch.matmul(K0zx, mu_tilde), K0zz)[0])
test_subjects = torch.unique(test_x[:, id_covariate]).cpu().numpy()
mask = np.isin(prediction_x[:, id_covariate].cpu().numpy(), test_subjects)
K1Xx_mu_tilde = torch.zeros(latent_dim, test_x.shape[0], 1, dtype=torch.double).to(device)
for s in test_subjects:
indices = test_x[:, id_covariate] == s
if isinstance(covar_module0, list):
K1Xx = torch.zeros(latent_dim, test_x[indices].shape[0], np.sum(mask)).double().to(device)
for i in range(latent_dim):
K1Xx[i] = covar_module1[i](test_x[indices], prediction_x[mask]).evaluate()
else:
stacked_test_x_indices = torch.stack([test_x[indices] for i in range(latent_dim)], dim=0)
stacked_prediction_x_mask = torch.stack([prediction_x[mask] for i in range(latent_dim)], dim=0)
K1Xx = covar_module1(stacked_test_x_indices, stacked_prediction_x_mask).evaluate()
K1Xx_mu_tilde[:, indices] = torch.matmul(K1Xx, mu_tilde[:, mask])
Z_pred = (K0Xz_iK0zz_K0zx_mu_tilde + K1Xx_mu_tilde).squeeze(dim=2).T
return Z_pred
def predict(covar_module0, covar_module1, likelihood, train_xt, test_x, mu, z, P, T, id_covariate, eps):
"""
Helper function to perform predictions.
"""
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
Q = train_xt.shape[1]
M = z.shape[0]
I_M = torch.eye(M, dtype=torch.double).to(device)
I_T = torch.eye(T, dtype=torch.double).to(device)
x_st = torch.reshape(train_xt, [P, T, Q])
mu_st = torch.reshape(mu, [P, T, 1])
K0xz = covar_module0(train_xt, z).evaluate()
K0zz = covar_module0(z, z).evaluate() + eps * I_M
K1_st = covar_module1(x_st, x_st).evaluate()
K0Xz = covar_module0(test_x, z).evaluate()
B_st = K1_st + I_T * likelihood.noise_covar.noise
LB_st = torch.cholesky(B_st)
iB_st = torch.cholesky_solve(I_T, LB_st)
K0xz_st = torch.reshape(K0xz, [P, T, M])
K0zx_st = K0xz_st.transpose(-1, -2)
iB_K0xz = torch.matmul(iB_st, K0xz_st)
K0zx_iB_K0xz = torch.matmul(K0xz.T, torch.reshape(iB_K0xz, [P*T, M]))
H = K0zz + K0zx_iB_K0xz
iB_mu = torch.matmul(iB_st, mu_st).view(-1)
K0xz_iH_K0zx_iB_mu_st = torch.matmul(K0xz, torch.solve(torch.matmul(K0xz.T, iB_mu).unsqueeze(dim=1), H)[0]).reshape(P, T, -1)
iB_K0xz_iH_K0zx_iB_mu = torch.matmul(iB_st, K0xz_iH_K0zx_iB_mu_st).view(-1)
mu_tilde = iB_mu - iB_K0xz_iH_K0zx_iB_mu
K0Xz_iK0zz_K0zx_mu_tilde = torch.matmul(K0Xz, torch.solve(torch.matmul(K0xz.T, mu_tilde).unsqueeze(dim=1), K0zz)[0]).squeeze()
test_subjects = torch.unique(test_x[:, id_covariate]).cpu().numpy()
mask = np.isin(train_xt[:, id_covariate].cpu().numpy(), test_subjects)
K1Xx_mu_tilde = torch.zeros(test_x.shape[0], dtype=torch.double).to(device)
for s in test_subjects:
indices = test_x[:, id_covariate] == s
K1Xx = covar_module1(test_x[indices], train_xt[mask]).evaluate()
K1Xx_mu_tilde[indices] = torch.matmul(K1Xx, mu_tilde[mask])
Z_pred = K0Xz_iK0zz_K0zx_mu_tilde + K1Xx_mu_tilde
return Z_pred
| 39.190202 | 140 | 0.649312 | 2,018 | 13,599 | 4.089693 | 0.087711 | 0.035987 | 0.035623 | 0.01866 | 0.761057 | 0.722283 | 0.692112 | 0.671392 | 0.662789 | 0.657458 | 0 | 0.024333 | 0.22031 | 13,599 | 346 | 141 | 39.303468 | 0.754032 | 0.038679 | 0 | 0.561475 | 0 | 0 | 0.002014 | 0 | 0 | 0 | 0 | 0 | 0.004098 | 1 | 0.069672 | false | 0 | 0.02459 | 0.016393 | 0.151639 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
12d2a6afb013e8510f32f143ec60ae2f61b24b66 | 2,709 | py | Python | src/third_party/dart/samples-dev/swarm/buildapp.py | rhencke/engine | 1016db292c4e73374a0a11536b18303c9522a224 | [
"BSD-3-Clause"
] | 21 | 2021-06-04T21:08:21.000Z | 2022-03-04T14:21:34.000Z | src/third_party/dart/samples-dev/swarm/buildapp.py | rhencke/engine | 1016db292c4e73374a0a11536b18303c9522a224 | [
"BSD-3-Clause"
] | 1 | 2021-01-21T14:45:59.000Z | 2021-01-21T14:45:59.000Z | src/third_party/dart/samples-dev/swarm/buildapp.py | rhencke/engine | 1016db292c4e73374a0a11536b18303c9522a224 | [
"BSD-3-Clause"
] | 9 | 2021-03-16T09:29:26.000Z | 2022-01-06T08:38:10.000Z | # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
#!/usr/bin/env python
#
# This script builds a Chrome App file (.crx) for Swarm
import os
import platform
import subprocess
import sys
DART_PATH = os.path.normpath(os.path.dirname(__file__) + '/../../..')
CLIENT_PATH = os.path.normpath(DART_PATH + '/client')
# Add the tools directory so we can find utils.py.
sys.path.append(os.path.abspath(DART_PATH + '/tools'))
import utils
buildRoot = CLIENT_PATH + '/' + utils.GetBuildRoot(utils.GuessOS(), 'debug',
'dartc')
def execute(*command):
'''
Executes the given command in a new process. If the command fails (returns
non-zero) halts the script and returns that exit code.
'''
exitcode = subprocess.call(command)
if exitcode != 0:
sys.exit(exitcode)
def createChromeApp(buildRoot, antTarget, resultFile):
buildDir = os.path.join(buildRoot, 'war')
# Use ant to create the 'war' directory
# TODO(jmesserly): we should factor out as much as possible from the ant file
# It's not really doing anything useful for us besides compiling Dart code
# with DartC and copying files. But for now, it helps us share code with
# our appengine update.py, which is good.
execute(DART_PATH + '/third_party/apache_ant/v1_7_1/bin/ant', '-f',
'build-appengine.xml', '-Dbuild.dir=' + buildRoot, antTarget)
# Call Dartium (could be any Chrome--but we know Dartium will be there) and
# ask it to create the .crx file for us using the checked in developer key.
chrome = CLIENT_PATH + '/tests/drt/chrome'
# On Mac Chrome is under a .app folder
if platform.system() == 'Darwin':
chrome = CLIENT_PATH + '/tests/drt/Chromium.app/Contents/MacOS/Chromium'
keyFile = DART_PATH + '/samples/swarm/swarm-dev.pem'
execute(chrome, '--pack-extension=' + buildDir,
'--pack-extension-key=' + keyFile)
resultFile = os.path.join(buildRoot, resultFile)
os.rename(buildDir + '.crx', resultFile)
return os.path.abspath(resultFile)
def main():
# Create a DartC and Dartium app
dartiumResult = createChromeApp(buildRoot, 'build_dart_app', 'swarm.crx')
dartCResult = createChromeApp(buildRoot, 'build_js_app', 'swarm-js.crx')
print '''
Successfully created Chrome apps!
Dartium: file://%s
DartC/JS: file://%s
To install, open this URL in Chrome and select Continue at the bottom.
''' % (dartiumResult, dartCResult)
return 0
if __name__ == '__main__':
sys.exit(main())
| 33.444444 | 81 | 0.680694 | 378 | 2,709 | 4.801587 | 0.478836 | 0.023141 | 0.011019 | 0.019835 | 0.026446 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004186 | 0.206349 | 2,709 | 80 | 82 | 33.8625 | 0.84 | 0.311185 | 0 | 0 | 0 | 0 | 0.26612 | 0.078546 | 0 | 0 | 0 | 0.0125 | 0 | 0 | null | null | 0 | 0.128205 | null | null | 0.025641 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
12d503090c02e42186f327a60d8607c785fc971f | 1,538 | py | Python | gtsfm/averaging/rotation/rotation_averaging_base.py | swershrimpy/gtsfm | 8d301eb3ef9172345a1ac1369fd4e19764d28946 | [
"Apache-2.0"
] | 122 | 2021-02-07T23:01:58.000Z | 2022-03-30T13:10:35.000Z | gtsfm/averaging/rotation/rotation_averaging_base.py | swershrimpy/gtsfm | 8d301eb3ef9172345a1ac1369fd4e19764d28946 | [
"Apache-2.0"
] | 273 | 2021-01-30T16:45:26.000Z | 2022-03-16T15:02:33.000Z | gtsfm/averaging/rotation/rotation_averaging_base.py | swershrimpy/gtsfm | 8d301eb3ef9172345a1ac1369fd4e19764d28946 | [
"Apache-2.0"
] | 13 | 2021-03-12T03:01:27.000Z | 2022-03-11T03:16:54.000Z | """Base class for the rotation averaging component of the GTSFM pipeline.
Authors: Jing Wu, Ayush Baid
"""
import abc
from typing import Dict, List, Optional, Tuple
import dask
from dask.delayed import Delayed
from gtsam import Rot3
class RotationAveragingBase(metaclass=abc.ABCMeta):
"""Base class for rotation averaging.
This class generates global rotation estimates from the pairwise relative
rotations.
"""
# ignored-abstractmethod
@abc.abstractmethod
def run(self, num_images: int, i2Ri1_dict: Dict[Tuple[int, int], Optional[Rot3]]) -> List[Optional[Rot3]]:
"""Run the rotation averaging.
Args:
num_images: number of poses.
i2Ri1_dict: relative rotations as dictionary (i1, i2): i2Ri1.
Returns:
Global rotations for each camera pose, i.e. wRi, as a list. The number of entries in the list is
`num_images`. The list may contain `None` where the global rotation could not be computed (either
underconstrained system or ill-constrained system).
"""
def create_computation_graph(self, num_images: int, i2Ri1_graph: Delayed) -> Delayed:
"""Create the computation graph for performing rotation averaging.
Args:
num_images: number of poses.
i2Ri1_graph: dictionary of relative rotations as a delayed task.
Returns:
global rotations wrapped using dask.delayed.
"""
return dask.delayed(self.run)(num_images, i2Ri1_graph)
| 32.723404 | 113 | 0.675553 | 192 | 1,538 | 5.34375 | 0.447917 | 0.052632 | 0.023392 | 0.031189 | 0.134503 | 0.093567 | 0.093567 | 0.093567 | 0.093567 | 0 | 0 | 0.014757 | 0.250975 | 1,538 | 46 | 114 | 33.434783 | 0.875868 | 0.577373 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.5 | 0 | 0.9 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
12d886fefab071878521b5f6be8983a8e9da6171 | 801 | py | Python | vsitapp/migrations/0006_add_django_vote_app_for_voting.py | Rishabh570/refresher | 7eca89c42a38fa2bc59957c85469a2627d640e1b | [
"MIT"
] | null | null | null | vsitapp/migrations/0006_add_django_vote_app_for_voting.py | Rishabh570/refresher | 7eca89c42a38fa2bc59957c85469a2627d640e1b | [
"MIT"
] | 6 | 2020-06-05T18:09:58.000Z | 2022-02-10T08:09:32.000Z | vsitapp/migrations/0006_add_django_vote_app_for_voting.py | Rishabh570/refresher | 7eca89c42a38fa2bc59957c85469a2627d640e1b | [
"MIT"
] | null | null | null | # Generated by Django 2.0.2 on 2018-03-21 17:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('vsitapp', '0005_add_model_method_remove_extra_manager'),
]
operations = [
migrations.AddField(
model_name='post',
name='num_vote_down',
field=models.PositiveIntegerField(db_index=True, default=0),
),
migrations.AddField(
model_name='post',
name='num_vote_up',
field=models.PositiveIntegerField(db_index=True, default=0),
),
migrations.AddField(
model_name='post',
name='vote_score',
field=models.IntegerField(db_index=True, default=0),
),
]
| 27.62069 | 73 | 0.573034 | 82 | 801 | 5.390244 | 0.512195 | 0.122172 | 0.156109 | 0.183258 | 0.538462 | 0.495475 | 0.495475 | 0.495475 | 0.384615 | 0.384615 | 0 | 0.040367 | 0.319601 | 801 | 28 | 74 | 28.607143 | 0.770642 | 0.05618 | 0 | 0.5 | 1 | 0 | 0.130854 | 0.057851 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.045455 | 0 | 0.181818 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
12df29c3dc41702e427fd7d4875a57db993919a2 | 72,942 | py | Python | pysnmp/CISCO-PSM-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 11 | 2021-02-02T16:27:16.000Z | 2021-08-31T06:22:49.000Z | pysnmp/CISCO-PSM-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 75 | 2021-02-24T17:30:31.000Z | 2021-12-08T00:01:18.000Z | pysnmp/CISCO-PSM-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 10 | 2019-04-30T05:51:36.000Z | 2022-02-16T03:33:41.000Z | #
# PySNMP MIB module CISCO-PSM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-PSM-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:39:07 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, ValueRangeConstraint, ValueSizeConstraint, ConstraintsUnion, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsUnion", "SingleValueConstraint")
ciscoMgmt, = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt")
FcNameId, DomainId, PortMemberList, DomainIdOrZero, FcNameIdOrZero = mibBuilder.importSymbols("CISCO-ST-TC", "FcNameId", "DomainId", "PortMemberList", "DomainIdOrZero", "FcNameIdOrZero")
vsanIndex, = mibBuilder.importSymbols("CISCO-VSAN-MIB", "vsanIndex")
InterfaceIndex, InterfaceIndexOrZero = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex", "InterfaceIndexOrZero")
ModuleCompliance, ObjectGroup, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "ObjectGroup", "NotificationGroup")
IpAddress, Unsigned32, TimeTicks, MibIdentifier, iso, ObjectIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64, NotificationType, Counter32, Gauge32, Bits, ModuleIdentity, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "IpAddress", "Unsigned32", "TimeTicks", "MibIdentifier", "iso", "ObjectIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64", "NotificationType", "Counter32", "Gauge32", "Bits", "ModuleIdentity", "Integer32")
TimeStamp, RowStatus, TruthValue, DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "TimeStamp", "RowStatus", "TruthValue", "DisplayString", "TextualConvention")
ciscoPsmMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 364))
ciscoPsmMIB.setRevisions(('2004-10-15 00:00', '2004-03-16 00:00', '2003-11-27 00:00', '2003-11-10 00:00', '2003-10-17 00:00', '2003-10-06 00:00', '2003-08-07 00:00',))
if mibBuilder.loadTexts: ciscoPsmMIB.setLastUpdated('200410150000Z')
if mibBuilder.loadTexts: ciscoPsmMIB.setOrganization('Cisco Systems Inc.')
ciscoPsmMIBNotifs = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 364, 0))
ciscoPsmMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 364, 1))
ciscoPsmMIBConform = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 364, 2))
cpsmConfiguration = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1))
cpsmStats = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2))
class CpsmVirtNwType(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2))
namedValues = NamedValues(("vsan", 1), ("vlan", 2))
class CpsmPortBindDevType(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))
namedValues = NamedValues(("mac", 1), ("nWwn", 2), ("pWwn", 3), ("sWwn", 4), ("wildCard", 5))
class CpsmPortBindSwPortType(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))
namedValues = NamedValues(("fwwn", 1), ("intfIndex", 2), ("wildCard", 3), ("swwn", 4))
class CpsmDbActivate(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))
namedValues = NamedValues(("activate", 1), ("activateWithAutoLearnOff", 2), ("forceActivate", 3), ("forceActivateWithAutoLearnOff", 4), ("deactivate", 5), ("noop", 6))
class CpsmActivateResult(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))
namedValues = NamedValues(("success", 1), ("actFailNullDb", 2), ("actFailConflictDb", 3), ("actFailSystemErr", 4), ("actFailAutoLearnOn", 5), ("deactFailNoActive", 6))
class CpsmAutoLearnEnable(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2))
namedValues = NamedValues(("on", 1), ("off", 2))
class CpsmClearStats(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2))
namedValues = NamedValues(("clear", 1), ("noop", 2))
class CpsmClearAutoLearnDb(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3))
namedValues = NamedValues(("clearOnVsan", 1), ("clearOnIntf", 2), ("noop", 3))
class CpsmDiffDb(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3))
namedValues = NamedValues(("configDb", 1), ("activeDb", 2), ("noop", 3))
class CpsmDiffReason(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3))
namedValues = NamedValues(("extra", 1), ("missing", 2), ("conflict", 3))
class CpsmStatsCounter(TextualConvention, Unsigned32):
status = 'current'
subtypeSpec = Unsigned32.subtypeSpec + ValueRangeConstraint(0, 4294967295)
class CpsmViolationReasonCode(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))
namedValues = NamedValues(("unknown", 1), ("noSwwn", 2), ("domIdMismatch", 3), ("efmdDbMismatch", 4), ("noRespFromRemote", 5))
cpsmPortBindTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 1), )
if mibBuilder.loadTexts: cpsmPortBindTable.setStatus('current')
cpsmPortBindEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 1, 1), ).setIndexNames((0, "CISCO-PSM-MIB", "cpsmPortBindNwType"), (0, "CISCO-PSM-MIB", "cpsmPortBindNwIndex"), (0, "CISCO-PSM-MIB", "cpsmPortBindIndex"))
if mibBuilder.loadTexts: cpsmPortBindEntry.setStatus('current')
cpsmPortBindNwType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 1, 1, 1), CpsmVirtNwType())
if mibBuilder.loadTexts: cpsmPortBindNwType.setStatus('current')
cpsmPortBindNwIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 1, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4093)))
if mibBuilder.loadTexts: cpsmPortBindNwIndex.setStatus('current')
cpsmPortBindIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 1, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4096)))
if mibBuilder.loadTexts: cpsmPortBindIndex.setStatus('current')
cpsmPortBindLoginDevType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 1, 1, 4), CpsmPortBindDevType().clone('pWwn')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cpsmPortBindLoginDevType.setStatus('current')
cpsmPortBindLoginDev = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 1, 1, 5), OctetString().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(0, 0), ValueSizeConstraint(6, 6), ValueSizeConstraint(8, 8), ))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cpsmPortBindLoginDev.setStatus('current')
cpsmPortBindLoginPointType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 1, 1, 6), CpsmPortBindSwPortType().clone('fwwn')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cpsmPortBindLoginPointType.setStatus('current')
cpsmPortBindLoginPoint = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 1, 1, 7), OctetString().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(0, 0), ValueSizeConstraint(4, 4), ValueSizeConstraint(8, 8), ))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cpsmPortBindLoginPoint.setStatus('current')
cpsmPortBindRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 1, 1, 8), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cpsmPortBindRowStatus.setStatus('current')
cpsmPortBindActivateTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 2), )
if mibBuilder.loadTexts: cpsmPortBindActivateTable.setStatus('current')
cpsmPortBindActivateEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 2, 1), ).setIndexNames((0, "CISCO-PSM-MIB", "cpsmPortBindNwType"), (0, "CISCO-PSM-MIB", "cpsmPortBindNwIndex"))
if mibBuilder.loadTexts: cpsmPortBindActivateEntry.setStatus('current')
cpsmPortBindActivate = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 2, 1, 1), CpsmDbActivate()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpsmPortBindActivate.setStatus('current')
cpsmPortBindResult = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 2, 1, 2), CpsmActivateResult()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmPortBindResult.setStatus('current')
cpsmPortBindLastActTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 2, 1, 3), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmPortBindLastActTime.setStatus('current')
cpsmPortBindActState = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 2, 1, 4), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmPortBindActState.setStatus('current')
cpsmFabricBindTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 3), )
if mibBuilder.loadTexts: cpsmFabricBindTable.setStatus('current')
cpsmFabricBindEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 3, 1), ).setIndexNames((0, "CISCO-PSM-MIB", "cpsmFabricBindNwType"), (0, "CISCO-PSM-MIB", "cpsmFabricBindNwIndex"), (0, "CISCO-PSM-MIB", "cpsmFabricBindIndex"))
if mibBuilder.loadTexts: cpsmFabricBindEntry.setStatus('current')
cpsmFabricBindNwType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 3, 1, 1), CpsmVirtNwType())
if mibBuilder.loadTexts: cpsmFabricBindNwType.setStatus('current')
cpsmFabricBindNwIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 3, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4093)))
if mibBuilder.loadTexts: cpsmFabricBindNwIndex.setStatus('current')
cpsmFabricBindIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 3, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4096)))
if mibBuilder.loadTexts: cpsmFabricBindIndex.setStatus('current')
cpsmFabricBindSwitchWwn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 3, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cpsmFabricBindSwitchWwn.setStatus('current')
cpsmFabricBindDomId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 3, 1, 5), DomainId()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cpsmFabricBindDomId.setStatus('current')
cpsmFabricBindRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 3, 1, 6), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cpsmFabricBindRowStatus.setStatus('current')
cpsmFabricBindActivateTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 4), )
if mibBuilder.loadTexts: cpsmFabricBindActivateTable.setStatus('current')
cpsmFabricBindActivateEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 4, 1), ).setIndexNames((0, "CISCO-PSM-MIB", "cpsmFabricBindNwType"), (0, "CISCO-PSM-MIB", "cpsmFabricBindNwIndex"))
if mibBuilder.loadTexts: cpsmFabricBindActivateEntry.setStatus('current')
cpsmFabricBindActivate = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 4, 1, 1), CpsmDbActivate()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpsmFabricBindActivate.setStatus('current')
cpsmFabricBindResult = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 4, 1, 2), CpsmActivateResult()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmFabricBindResult.setStatus('current')
cpsmFabricBindLastActTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 4, 1, 3), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmFabricBindLastActTime.setStatus('current')
cpsmFabricBindActState = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 4, 1, 4), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmFabricBindActState.setStatus('current')
cpsmPortBindCopyTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 5), )
if mibBuilder.loadTexts: cpsmPortBindCopyTable.setStatus('current')
cpsmPortBindCopyEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 5, 1), ).setIndexNames((0, "CISCO-PSM-MIB", "cpsmPortBindNwType"), (0, "CISCO-PSM-MIB", "cpsmPortBindNwIndex"))
if mibBuilder.loadTexts: cpsmPortBindCopyEntry.setStatus('current')
cpsmPortBindCopyActToConfig = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 5, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("copy", 1), ("noop", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpsmPortBindCopyActToConfig.setStatus('current')
cpsmPortBindLastChangeTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 5, 1, 2), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmPortBindLastChangeTime.setStatus('current')
cpsmFabricBindCopyTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 6), )
if mibBuilder.loadTexts: cpsmFabricBindCopyTable.setStatus('current')
cpsmFabricBindCopyEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 6, 1), ).setIndexNames((0, "CISCO-PSM-MIB", "cpsmFabricBindNwType"), (0, "CISCO-PSM-MIB", "cpsmFabricBindNwIndex"))
if mibBuilder.loadTexts: cpsmFabricBindCopyEntry.setStatus('current')
cpsmFabricBindCopyActToConfig = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 6, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("copy", 1), ("noop", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpsmFabricBindCopyActToConfig.setStatus('current')
cpsmFabricBindLastChangeTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 6, 1, 2), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmFabricBindLastChangeTime.setStatus('current')
cpsmPortBindEnfTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 7), )
if mibBuilder.loadTexts: cpsmPortBindEnfTable.setStatus('current')
cpsmPortBindEnfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 7, 1), ).setIndexNames((0, "CISCO-PSM-MIB", "cpsmPortBindEnfNwType"), (0, "CISCO-PSM-MIB", "cpsmPortBindEnfNwIndex"), (0, "CISCO-PSM-MIB", "cpsmPortBindEnfIndex"))
if mibBuilder.loadTexts: cpsmPortBindEnfEntry.setStatus('current')
cpsmPortBindEnfNwType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 7, 1, 1), CpsmVirtNwType())
if mibBuilder.loadTexts: cpsmPortBindEnfNwType.setStatus('current')
cpsmPortBindEnfNwIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 7, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4093)))
if mibBuilder.loadTexts: cpsmPortBindEnfNwIndex.setStatus('current')
cpsmPortBindEnfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 7, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4096)))
if mibBuilder.loadTexts: cpsmPortBindEnfIndex.setStatus('current')
cpsmPortBindEnfLoginDevType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 7, 1, 4), CpsmPortBindDevType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmPortBindEnfLoginDevType.setStatus('current')
cpsmPortBindEnfLoginDev = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 7, 1, 5), OctetString().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(0, 0), ValueSizeConstraint(6, 6), ValueSizeConstraint(8, 8), ))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmPortBindEnfLoginDev.setStatus('current')
cpsmPortBindEnfLoginPointType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 7, 1, 6), CpsmPortBindSwPortType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmPortBindEnfLoginPointType.setStatus('current')
cpsmPortBindEnfLoginPoint = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 7, 1, 7), OctetString().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(0, 0), ValueSizeConstraint(4, 4), ValueSizeConstraint(8, 8), ))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmPortBindEnfLoginPoint.setStatus('current')
cpsmPortBindEnfIsLearnt = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 7, 1, 8), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmPortBindEnfIsLearnt.setStatus('current')
cpsmFabricBindEnfTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 8), )
if mibBuilder.loadTexts: cpsmFabricBindEnfTable.setStatus('current')
cpsmFabricBindEnfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 8, 1), ).setIndexNames((0, "CISCO-PSM-MIB", "cpsmFabricBindEnfNwType"), (0, "CISCO-PSM-MIB", "cpsmFabricBindEnfNwIndex"), (0, "CISCO-PSM-MIB", "cpsmFabricBindEnfIndex"))
if mibBuilder.loadTexts: cpsmFabricBindEnfEntry.setStatus('current')
cpsmFabricBindEnfNwType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 8, 1, 1), CpsmVirtNwType())
if mibBuilder.loadTexts: cpsmFabricBindEnfNwType.setStatus('current')
cpsmFabricBindEnfNwIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 8, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4093)))
if mibBuilder.loadTexts: cpsmFabricBindEnfNwIndex.setStatus('current')
cpsmFabricBindEnfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 8, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4096)))
if mibBuilder.loadTexts: cpsmFabricBindEnfIndex.setStatus('current')
cpsmFabricBindEnfSwitchWwn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 8, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmFabricBindEnfSwitchWwn.setStatus('current')
cpsmFabricBindEnfDomId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 8, 1, 5), DomainId()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmFabricBindEnfDomId.setStatus('current')
cpsmFabricBindEnfIsLearnt = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 8, 1, 6), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmFabricBindEnfIsLearnt.setStatus('current')
cpsmPortBindAutoLearnTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 9), )
if mibBuilder.loadTexts: cpsmPortBindAutoLearnTable.setStatus('current')
cpsmPortBindAutoLearnEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 9, 1), ).setIndexNames((0, "CISCO-PSM-MIB", "cpsmPortBindAutoLearnIndexType"), (0, "CISCO-PSM-MIB", "cpsmPortBindAutoLearnIndex"))
if mibBuilder.loadTexts: cpsmPortBindAutoLearnEntry.setStatus('current')
cpsmPortBindAutoLearnIndexType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 9, 1, 1), CpsmVirtNwType())
if mibBuilder.loadTexts: cpsmPortBindAutoLearnIndexType.setStatus('current')
cpsmPortBindAutoLearnIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 9, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4093)))
if mibBuilder.loadTexts: cpsmPortBindAutoLearnIndex.setStatus('current')
cpsmPortBindAutoLearnEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 9, 1, 3), CpsmAutoLearnEnable().clone('off')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpsmPortBindAutoLearnEnable.setStatus('current')
cpsmFabricBindAutoLearnTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 10), )
if mibBuilder.loadTexts: cpsmFabricBindAutoLearnTable.setStatus('deprecated')
cpsmFabricBindAutoLearnEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 10, 1), ).setIndexNames((0, "CISCO-PSM-MIB", "cpsmFabricBindAutoLearnIndexType"), (0, "CISCO-PSM-MIB", "cpsmFabricBindAutoLearnIndex"))
if mibBuilder.loadTexts: cpsmFabricBindAutoLearnEntry.setStatus('deprecated')
cpsmFabricBindAutoLearnIndexType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 10, 1, 1), CpsmVirtNwType())
if mibBuilder.loadTexts: cpsmFabricBindAutoLearnIndexType.setStatus('deprecated')
cpsmFabricBindAutoLearnIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 10, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4093)))
if mibBuilder.loadTexts: cpsmFabricBindAutoLearnIndex.setStatus('deprecated')
cpsmFabricBindAutoLearnEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 10, 1, 3), CpsmAutoLearnEnable().clone('off')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpsmFabricBindAutoLearnEnable.setStatus('deprecated')
cpsmPortBindClearTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 11), )
if mibBuilder.loadTexts: cpsmPortBindClearTable.setStatus('current')
cpsmPortBindClearEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 11, 1), ).setIndexNames((0, "CISCO-PSM-MIB", "cpsmPortBindClearNwType"), (0, "CISCO-PSM-MIB", "cpsmPortBindClearNwIndex"))
if mibBuilder.loadTexts: cpsmPortBindClearEntry.setStatus('current')
cpsmPortBindClearNwType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 11, 1, 1), CpsmVirtNwType())
if mibBuilder.loadTexts: cpsmPortBindClearNwType.setStatus('current')
cpsmPortBindClearNwIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 11, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4093)))
if mibBuilder.loadTexts: cpsmPortBindClearNwIndex.setStatus('current')
cpsmPortBindClearStats = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 11, 1, 3), CpsmClearStats()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpsmPortBindClearStats.setStatus('current')
cpsmPortBindClearAutoLearnDb = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 11, 1, 4), CpsmClearAutoLearnDb()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpsmPortBindClearAutoLearnDb.setStatus('current')
cpsmPortBindClearAutoLearnIntf = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 11, 1, 5), PortMemberList().clone(hexValue="")).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpsmPortBindClearAutoLearnIntf.setStatus('current')
cpsmFabricBindClearTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 12), )
if mibBuilder.loadTexts: cpsmFabricBindClearTable.setStatus('current')
cpsmFabricBindClearEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 12, 1), ).setIndexNames((0, "CISCO-PSM-MIB", "cpsmFabricBindClearNwType"), (0, "CISCO-PSM-MIB", "cpsmFabricBindClearNwIndex"))
if mibBuilder.loadTexts: cpsmFabricBindClearEntry.setStatus('current')
cpsmFabricBindClearNwType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 12, 1, 1), CpsmVirtNwType())
if mibBuilder.loadTexts: cpsmFabricBindClearNwType.setStatus('current')
cpsmFabricBindClearNwIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 12, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4093)))
if mibBuilder.loadTexts: cpsmFabricBindClearNwIndex.setStatus('current')
cpsmFabricBindClearStats = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 12, 1, 3), CpsmClearStats()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpsmFabricBindClearStats.setStatus('current')
cpsmFabricBindClearAutoLearnDb = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 12, 1, 4), CpsmClearAutoLearnDb()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpsmFabricBindClearAutoLearnDb.setStatus('current')
cpsmFabricBindClearAutoLearnIntf = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 12, 1, 5), InterfaceIndexOrZero()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpsmFabricBindClearAutoLearnIntf.setStatus('deprecated')
cpsmPortBindDiffConfigTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 13), )
if mibBuilder.loadTexts: cpsmPortBindDiffConfigTable.setStatus('current')
cpsmPortBindDiffConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 13, 1), ).setIndexNames((0, "CISCO-PSM-MIB", "cpsmPortBindDiffConfigNwType"), (0, "CISCO-PSM-MIB", "cpsmPortBindDiffConfigNwIndex"))
if mibBuilder.loadTexts: cpsmPortBindDiffConfigEntry.setStatus('current')
cpsmPortBindDiffConfigNwType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 13, 1, 1), CpsmVirtNwType())
if mibBuilder.loadTexts: cpsmPortBindDiffConfigNwType.setStatus('current')
cpsmPortBindDiffConfigNwIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 13, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4093)))
if mibBuilder.loadTexts: cpsmPortBindDiffConfigNwIndex.setStatus('current')
cpsmPortBindDiffConfigDb = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 13, 1, 3), CpsmDiffDb()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpsmPortBindDiffConfigDb.setStatus('current')
cpsmPortBindDiffTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 14), )
if mibBuilder.loadTexts: cpsmPortBindDiffTable.setStatus('current')
cpsmPortBindDiffEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 14, 1), ).setIndexNames((0, "CISCO-PSM-MIB", "cpsmPortBindDiffNwType"), (0, "CISCO-PSM-MIB", "cpsmPortBindDiffNwIndex"), (0, "CISCO-PSM-MIB", "cpsmPortBindDiffIndex"))
if mibBuilder.loadTexts: cpsmPortBindDiffEntry.setStatus('current')
cpsmPortBindDiffNwType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 14, 1, 1), CpsmVirtNwType())
if mibBuilder.loadTexts: cpsmPortBindDiffNwType.setStatus('current')
cpsmPortBindDiffNwIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 14, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4093)))
if mibBuilder.loadTexts: cpsmPortBindDiffNwIndex.setStatus('current')
cpsmPortBindDiffIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 14, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4096)))
if mibBuilder.loadTexts: cpsmPortBindDiffIndex.setStatus('current')
cpsmPortBindDiffReason = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 14, 1, 4), CpsmDiffReason()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmPortBindDiffReason.setStatus('current')
cpsmPortBindDiffLoginDevType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 14, 1, 5), CpsmPortBindDevType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmPortBindDiffLoginDevType.setStatus('current')
cpsmPortBindDiffLoginDev = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 14, 1, 6), OctetString().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(0, 0), ValueSizeConstraint(6, 6), ValueSizeConstraint(8, 8), ))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmPortBindDiffLoginDev.setStatus('current')
cpsmPortBindDiffLoginPointType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 14, 1, 7), CpsmPortBindSwPortType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmPortBindDiffLoginPointType.setStatus('current')
cpsmPortBindDiffLoginPoint = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 14, 1, 8), OctetString().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(0, 0), ValueSizeConstraint(4, 4), ValueSizeConstraint(8, 8), ))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmPortBindDiffLoginPoint.setStatus('current')
cpsmFabricBindDiffConfigTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 15), )
if mibBuilder.loadTexts: cpsmFabricBindDiffConfigTable.setStatus('current')
cpsmFabricBindDiffConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 15, 1), ).setIndexNames((0, "CISCO-PSM-MIB", "cpsmFabricBindDiffConfigNwType"), (0, "CISCO-PSM-MIB", "cpsmFabricBindDiffConfigNwIndex"))
if mibBuilder.loadTexts: cpsmFabricBindDiffConfigEntry.setStatus('current')
cpsmFabricBindDiffConfigNwType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 15, 1, 1), CpsmVirtNwType())
if mibBuilder.loadTexts: cpsmFabricBindDiffConfigNwType.setStatus('current')
cpsmFabricBindDiffConfigNwIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 15, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4093)))
if mibBuilder.loadTexts: cpsmFabricBindDiffConfigNwIndex.setStatus('current')
cpsmFabricBindDiffConfigDb = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 15, 1, 3), CpsmDiffDb()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpsmFabricBindDiffConfigDb.setStatus('current')
cpsmFabricBindDiffTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 16), )
if mibBuilder.loadTexts: cpsmFabricBindDiffTable.setStatus('current')
cpsmFabricBindDiffEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 16, 1), ).setIndexNames((0, "CISCO-PSM-MIB", "cpsmFabricBindDiffNwType"), (0, "CISCO-PSM-MIB", "cpsmFabricBindDiffNwIndex"), (0, "CISCO-PSM-MIB", "cpsmFabricBindDiffIndex"))
if mibBuilder.loadTexts: cpsmFabricBindDiffEntry.setStatus('current')
cpsmFabricBindDiffNwType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 16, 1, 1), CpsmVirtNwType())
if mibBuilder.loadTexts: cpsmFabricBindDiffNwType.setStatus('current')
cpsmFabricBindDiffNwIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 16, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4093)))
if mibBuilder.loadTexts: cpsmFabricBindDiffNwIndex.setStatus('current')
cpsmFabricBindDiffIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 16, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4096)))
if mibBuilder.loadTexts: cpsmFabricBindDiffIndex.setStatus('current')
cpsmFabricBindDiffReason = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 16, 1, 4), CpsmDiffReason()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmFabricBindDiffReason.setStatus('current')
cpsmFabricBindDiffSwitchWwn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 16, 1, 5), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmFabricBindDiffSwitchWwn.setStatus('current')
cpsmFabricBindDiffDomId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 16, 1, 6), DomainId()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmFabricBindDiffDomId.setStatus('current')
cpsmPortBindStatsTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 1), )
if mibBuilder.loadTexts: cpsmPortBindStatsTable.setStatus('current')
cpsmPortBindStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 1, 1), ).setIndexNames((0, "CISCO-PSM-MIB", "cpsmPortBindVsanVlanType"), (0, "CISCO-PSM-MIB", "cpsmPortBindVsanVlanIndex"))
if mibBuilder.loadTexts: cpsmPortBindStatsEntry.setStatus('current')
cpsmPortBindVsanVlanType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 1, 1, 1), CpsmVirtNwType())
if mibBuilder.loadTexts: cpsmPortBindVsanVlanType.setStatus('current')
cpsmPortBindVsanVlanIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 1, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4093)))
if mibBuilder.loadTexts: cpsmPortBindVsanVlanIndex.setStatus('current')
cpsmPortBindAllowedLogins = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 1, 1, 3), CpsmStatsCounter()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmPortBindAllowedLogins.setStatus('current')
cpsmPortBindDeniedLogins = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 1, 1, 4), CpsmStatsCounter()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmPortBindDeniedLogins.setStatus('current')
cpsmFabricBindStatsTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 2), )
if mibBuilder.loadTexts: cpsmFabricBindStatsTable.setStatus('current')
cpsmFabricBindStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 2, 1), ).setIndexNames((0, "CISCO-PSM-MIB", "cpsmFabricBindVsanVlanType"), (0, "CISCO-PSM-MIB", "cpsmFabricBindVsanVlanIndex"))
if mibBuilder.loadTexts: cpsmFabricBindStatsEntry.setStatus('current')
cpsmFabricBindVsanVlanType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 2, 1, 1), CpsmVirtNwType())
if mibBuilder.loadTexts: cpsmFabricBindVsanVlanType.setStatus('current')
cpsmFabricBindVsanVlanIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 2, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4093)))
if mibBuilder.loadTexts: cpsmFabricBindVsanVlanIndex.setStatus('current')
cpsmFabricBindAllowedReqs = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 2, 1, 3), CpsmStatsCounter()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmFabricBindAllowedReqs.setStatus('current')
cpsmFabricBindDeniedReqs = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 2, 1, 4), CpsmStatsCounter()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmFabricBindDeniedReqs.setStatus('current')
cpsmPortBindViolationTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 3), )
if mibBuilder.loadTexts: cpsmPortBindViolationTable.setStatus('current')
cpsmPortBindViolationEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 3, 1), ).setIndexNames((0, "CISCO-PSM-MIB", "cpsmPortBindViolationNwType"), (0, "CISCO-PSM-MIB", "cpsmPortBindViolationNwIndex"), (0, "CISCO-PSM-MIB", "cpsmPortBindViolationIndex"))
if mibBuilder.loadTexts: cpsmPortBindViolationEntry.setStatus('current')
cpsmPortBindViolationNwType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 3, 1, 1), CpsmVirtNwType())
if mibBuilder.loadTexts: cpsmPortBindViolationNwType.setStatus('current')
cpsmPortBindViolationNwIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 3, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4093)))
if mibBuilder.loadTexts: cpsmPortBindViolationNwIndex.setStatus('current')
cpsmPortBindViolationIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 3, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 100)))
if mibBuilder.loadTexts: cpsmPortBindViolationIndex.setStatus('current')
cpsmPortBindLoginPwwn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 3, 1, 4), FcNameIdOrZero()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmPortBindLoginPwwn.setStatus('current')
cpsmPortBindLoginNwwn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 3, 1, 5), FcNameIdOrZero()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmPortBindLoginNwwn.setStatus('current')
cpsmPortBindLoginSwwn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 3, 1, 6), FcNameIdOrZero()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmPortBindLoginSwwn.setStatus('current')
cpsmPortBindLoginPort = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 3, 1, 7), FcNameId()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmPortBindLoginPort.setStatus('current')
cpsmPortBindLoginTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 3, 1, 8), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmPortBindLoginTime.setStatus('current')
cpsmPortBindLoginCount = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 3, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmPortBindLoginCount.setStatus('current')
cpsmPortBindLoginIntf = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 3, 1, 10), InterfaceIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmPortBindLoginIntf.setStatus('current')
cpsmFabricBindViolationTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 4), )
if mibBuilder.loadTexts: cpsmFabricBindViolationTable.setStatus('deprecated')
cpsmFabricBindViolationEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 4, 1), ).setIndexNames((0, "CISCO-PSM-MIB", "cpsmFabricBindViolationIndex"))
if mibBuilder.loadTexts: cpsmFabricBindViolationEntry.setStatus('deprecated')
cpsmFabricBindViolationIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 4, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 100)))
if mibBuilder.loadTexts: cpsmFabricBindViolationIndex.setStatus('deprecated')
cpsmFabricBindSwwn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 4, 1, 2), FcNameId()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmFabricBindSwwn.setStatus('deprecated')
cpsmFabricBindLocalPort = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 4, 1, 3), FcNameId()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmFabricBindLocalPort.setStatus('deprecated')
cpsmFabricBindDenialTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 4, 1, 4), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmFabricBindDenialTime.setStatus('deprecated')
cpsmFabricBindLocalIntf = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 4, 1, 5), InterfaceIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmFabricBindLocalIntf.setStatus('deprecated')
cpsmFabricBindViolationNewTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 5), )
if mibBuilder.loadTexts: cpsmFabricBindViolationNewTable.setStatus('current')
cpsmFabricBindViolationNewEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 5, 1), ).setIndexNames((0, "CISCO-PSM-MIB", "cpsmFabricBindViolationNwTypeR1"), (0, "CISCO-PSM-MIB", "cpsmFabricBindViolationNwIndexR1"), (0, "CISCO-PSM-MIB", "cpsmFabricBindViolationIndexR1"))
if mibBuilder.loadTexts: cpsmFabricBindViolationNewEntry.setStatus('current')
cpsmFabricBindViolationNwTypeR1 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 5, 1, 1), CpsmVirtNwType())
if mibBuilder.loadTexts: cpsmFabricBindViolationNwTypeR1.setStatus('current')
cpsmFabricBindViolationNwIndexR1 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 5, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4093)))
if mibBuilder.loadTexts: cpsmFabricBindViolationNwIndexR1.setStatus('current')
cpsmFabricBindViolationIndexR1 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 5, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 100)))
if mibBuilder.loadTexts: cpsmFabricBindViolationIndexR1.setStatus('current')
cpsmFabricBindSwwnR1 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 5, 1, 4), FcNameId()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmFabricBindSwwnR1.setStatus('current')
cpsmFabricBindDenialTimeR1 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 5, 1, 5), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmFabricBindDenialTimeR1.setStatus('current')
cpsmFabricBindDenialCountR1 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 5, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmFabricBindDenialCountR1.setStatus('current')
cpsmFabricBindDenialDomId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 5, 1, 7), DomainIdOrZero()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmFabricBindDenialDomId.setStatus('current')
cpsmFabricBindDenialReasonCode = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 5, 1, 8), CpsmViolationReasonCode()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmFabricBindDenialReasonCode.setStatus('current')
cpsmEfmdStatsTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 6), )
if mibBuilder.loadTexts: cpsmEfmdStatsTable.setStatus('current')
cpsmEfmdStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 6, 1), ).setIndexNames((0, "CISCO-VSAN-MIB", "vsanIndex"))
if mibBuilder.loadTexts: cpsmEfmdStatsEntry.setStatus('current')
cpsmEfmdTxMergeReqs = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 6, 1, 1), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmEfmdTxMergeReqs.setStatus('current')
cpsmEfmdRxMergeReqs = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 6, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmEfmdRxMergeReqs.setStatus('current')
cpsmEfmdTxMergeAccs = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 6, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmEfmdTxMergeAccs.setStatus('current')
cpsmEfmdRxMergeAccs = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 6, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmEfmdRxMergeAccs.setStatus('current')
cpsmEfmdTxMergeRejs = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 6, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmEfmdTxMergeRejs.setStatus('current')
cpsmEfmdRxMergeRejs = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 6, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmEfmdRxMergeRejs.setStatus('current')
cpsmEfmdTxMergeBusys = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 6, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmEfmdTxMergeBusys.setStatus('current')
cpsmEfmdRxMergeBusys = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 6, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmEfmdRxMergeBusys.setStatus('current')
cpsmEfmdTxMergeErrs = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 6, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmEfmdTxMergeErrs.setStatus('current')
cpsmEfmdRxMergeErrs = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 2, 6, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmEfmdRxMergeErrs.setStatus('current')
cpsmNotifyEnable = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 17), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpsmNotifyEnable.setStatus('current')
cpsmEfmdConfigTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 18), )
if mibBuilder.loadTexts: cpsmEfmdConfigTable.setStatus('current')
cpsmEfmdConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 18, 1), ).setIndexNames((0, "CISCO-VSAN-MIB", "vsanIndex"))
if mibBuilder.loadTexts: cpsmEfmdConfigEntry.setStatus('current')
cpsmEfmdConfigEnforce = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 18, 1, 1), TruthValue().clone('true')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpsmEfmdConfigEnforce.setStatus('current')
cpsmPortBindNextFreeTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 19), )
if mibBuilder.loadTexts: cpsmPortBindNextFreeTable.setStatus('current')
cpsmPortBindNextFreeEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 19, 1), ).setIndexNames((0, "CISCO-PSM-MIB", "cpsmPortBindNextFreeNwType"), (0, "CISCO-PSM-MIB", "cpsmPortBindNextFreeNwIndex"))
if mibBuilder.loadTexts: cpsmPortBindNextFreeEntry.setStatus('current')
cpsmPortBindNextFreeNwType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 19, 1, 1), CpsmVirtNwType())
if mibBuilder.loadTexts: cpsmPortBindNextFreeNwType.setStatus('current')
cpsmPortBindNextFreeNwIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 19, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4093)))
if mibBuilder.loadTexts: cpsmPortBindNextFreeNwIndex.setStatus('current')
cpsmPortBindNextFreeIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 19, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4095))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmPortBindNextFreeIndex.setStatus('current')
cpsmFabricBindNextFreeTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 20), )
if mibBuilder.loadTexts: cpsmFabricBindNextFreeTable.setStatus('current')
cpsmFabricBindNextFreeEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 20, 1), ).setIndexNames((0, "CISCO-PSM-MIB", "cpsmFabricBindNextFreeNwType"), (0, "CISCO-PSM-MIB", "cpsmFabricBindNextFreeNwIndex"))
if mibBuilder.loadTexts: cpsmFabricBindNextFreeEntry.setStatus('current')
cpsmFabricBindNextFreeNwType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 20, 1, 1), CpsmVirtNwType())
if mibBuilder.loadTexts: cpsmFabricBindNextFreeNwType.setStatus('current')
cpsmFabricBindNextFreeNwIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 20, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4093)))
if mibBuilder.loadTexts: cpsmFabricBindNextFreeNwIndex.setStatus('current')
cpsmFabricBindNextFreeIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 364, 1, 1, 20, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4095))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpsmFabricBindNextFreeIndex.setStatus('current')
ciscoPsmPortBindFPortDenyNotify = NotificationType((1, 3, 6, 1, 4, 1, 9, 9, 364, 0, 1)).setObjects(("CISCO-PSM-MIB", "cpsmPortBindLoginPwwn"), ("CISCO-PSM-MIB", "cpsmPortBindLoginPort"), ("CISCO-PSM-MIB", "cpsmPortBindLoginTime"))
if mibBuilder.loadTexts: ciscoPsmPortBindFPortDenyNotify.setStatus('current')
ciscoPsmPortBindEPortDenyNotify = NotificationType((1, 3, 6, 1, 4, 1, 9, 9, 364, 0, 2)).setObjects(("CISCO-PSM-MIB", "cpsmPortBindLoginSwwn"), ("CISCO-PSM-MIB", "cpsmPortBindLoginPort"), ("CISCO-PSM-MIB", "cpsmPortBindLoginTime"))
if mibBuilder.loadTexts: ciscoPsmPortBindEPortDenyNotify.setStatus('current')
ciscoPsmFabricBindDenyNotify = NotificationType((1, 3, 6, 1, 4, 1, 9, 9, 364, 0, 3)).setObjects(("CISCO-PSM-MIB", "cpsmFabricBindSwwn"), ("CISCO-PSM-MIB", "cpsmFabricBindLocalPort"), ("CISCO-PSM-MIB", "cpsmFabricBindDenialTime"))
if mibBuilder.loadTexts: ciscoPsmFabricBindDenyNotify.setStatus('deprecated')
ciscoPsmFabricBindDenyNotifyNew = NotificationType((1, 3, 6, 1, 4, 1, 9, 9, 364, 0, 4)).setObjects(("CISCO-PSM-MIB", "cpsmFabricBindSwwnR1"), ("CISCO-PSM-MIB", "cpsmFabricBindDenialTimeR1"), ("CISCO-PSM-MIB", "cpsmFabricBindDenialReasonCode"))
if mibBuilder.loadTexts: ciscoPsmFabricBindDenyNotifyNew.setStatus('current')
ciscoPsmMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 1))
ciscoPsmMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 2))
ciscoPsmMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 1, 1)).setObjects(("CISCO-PSM-MIB", "ciscoPsmPortBindConfigGroup"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindConfigGroup"), ("CISCO-PSM-MIB", "ciscoPsmPortBindEnforcedGroup"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindEnforcedGroup"), ("CISCO-PSM-MIB", "ciscoPsmPortBindStatsGroup"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindStatsGroup"), ("CISCO-PSM-MIB", "ciscoPsmPortBindNotifyGroup"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindNotifyGroup"), ("CISCO-PSM-MIB", "ciscoPsmNotifyEnableGroup"), ("CISCO-PSM-MIB", "ciscoPsmPortBindAutoLearnGroup"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindAutoLearnGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmMIBCompliance = ciscoPsmMIBCompliance.setStatus('deprecated')
ciscoPsmMIBComplianceRev1 = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 1, 2)).setObjects(("CISCO-PSM-MIB", "ciscoPsmPortBindConfigGroup"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindConfigGroup1"), ("CISCO-PSM-MIB", "ciscoPsmPortBindEnforcedGroup"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindEnforcedGroup"), ("CISCO-PSM-MIB", "ciscoPsmPortBindStatsGroup"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindStatsGroup1"), ("CISCO-PSM-MIB", "ciscoPsmPortBindNotifyGroup"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindNotifyGroupR1"), ("CISCO-PSM-MIB", "ciscoPsmNotifyEnableGroup"), ("CISCO-PSM-MIB", "ciscoPsmPortBindAutoLearnGroup"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindAutoLearnGroup"), ("CISCO-PSM-MIB", "ciscoPsmEfmdConfigGroup"), ("CISCO-PSM-MIB", "ciscoPsmEfmdStatsGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmMIBComplianceRev1 = ciscoPsmMIBComplianceRev1.setStatus('deprecated')
ciscoPsmMIBComplianceRev2 = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 1, 3)).setObjects(("CISCO-PSM-MIB", "ciscoPsmPortBindConfigGroup"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindConfigGroup1"), ("CISCO-PSM-MIB", "ciscoPsmPortBindEnforcedGroup"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindEnforcedGroup"), ("CISCO-PSM-MIB", "ciscoPsmPortBindStatsGroup"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindStatsGroup1"), ("CISCO-PSM-MIB", "ciscoPsmPortBindNotifyGroup"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindNotifyGroupR1"), ("CISCO-PSM-MIB", "ciscoPsmNotifyEnableGroup"), ("CISCO-PSM-MIB", "ciscoPsmPortBindAutoLearnGroup"), ("CISCO-PSM-MIB", "ciscoPsmEfmdConfigGroup"), ("CISCO-PSM-MIB", "ciscoPsmEfmdStatsGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmMIBComplianceRev2 = ciscoPsmMIBComplianceRev2.setStatus('deprecated')
ciscoPsmMIBComplianceRev3 = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 1, 4)).setObjects(("CISCO-PSM-MIB", "ciscoPsmPortBindConfigGroup"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindConfigGroup1"), ("CISCO-PSM-MIB", "ciscoPsmPortBindEnforcedGroup"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindEnforcedGroup"), ("CISCO-PSM-MIB", "ciscoPsmPortBindStatsGroup"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindStatsGroup2"), ("CISCO-PSM-MIB", "ciscoPsmPortBindNotifyGroup"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindNotifyGroupR1"), ("CISCO-PSM-MIB", "ciscoPsmNotifyEnableGroup"), ("CISCO-PSM-MIB", "ciscoPsmPortBindAutoLearnGroup"), ("CISCO-PSM-MIB", "ciscoPsmEfmdConfigGroup"), ("CISCO-PSM-MIB", "ciscoPsmEfmdStatsGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmMIBComplianceRev3 = ciscoPsmMIBComplianceRev3.setStatus('deprecated')
ciscoPsmMIBComplianceRev4 = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 1, 5)).setObjects(("CISCO-PSM-MIB", "ciscoPsmPortBindConfigGroup"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindConfigGroup1"), ("CISCO-PSM-MIB", "ciscoPsmPortBindEnforcedGroup"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindEnforcedGroup"), ("CISCO-PSM-MIB", "ciscoPsmPortBindStatsGroup"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindStatsGroup3"), ("CISCO-PSM-MIB", "ciscoPsmPortBindNotifyGroup"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindNotifyGroupR1"), ("CISCO-PSM-MIB", "ciscoPsmNotifyEnableGroup"), ("CISCO-PSM-MIB", "ciscoPsmPortBindAutoLearnGroup"), ("CISCO-PSM-MIB", "ciscoPsmEfmdConfigGroup"), ("CISCO-PSM-MIB", "ciscoPsmEfmdStatsGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmMIBComplianceRev4 = ciscoPsmMIBComplianceRev4.setStatus('deprecated')
ciscoPsmMIBComplianceRev5 = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 1, 6)).setObjects(("CISCO-PSM-MIB", "ciscoPsmPortBindConfigGroup1"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindConfigGroup2"), ("CISCO-PSM-MIB", "ciscoPsmPortBindEnforcedGroup"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindEnforcedGroup"), ("CISCO-PSM-MIB", "ciscoPsmPortBindStatsGroup"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindStatsGroup3"), ("CISCO-PSM-MIB", "ciscoPsmPortBindNotifyGroup"), ("CISCO-PSM-MIB", "ciscoPsmFabricBindNotifyGroupR1"), ("CISCO-PSM-MIB", "ciscoPsmNotifyEnableGroup"), ("CISCO-PSM-MIB", "ciscoPsmPortBindAutoLearnGroup"), ("CISCO-PSM-MIB", "ciscoPsmEfmdConfigGroup"), ("CISCO-PSM-MIB", "ciscoPsmEfmdStatsGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmMIBComplianceRev5 = ciscoPsmMIBComplianceRev5.setStatus('current')
ciscoPsmPortBindConfigGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 2, 1)).setObjects(("CISCO-PSM-MIB", "cpsmPortBindLoginDevType"), ("CISCO-PSM-MIB", "cpsmPortBindLoginDev"), ("CISCO-PSM-MIB", "cpsmPortBindLoginPointType"), ("CISCO-PSM-MIB", "cpsmPortBindLoginPoint"), ("CISCO-PSM-MIB", "cpsmPortBindRowStatus"), ("CISCO-PSM-MIB", "cpsmPortBindActivate"), ("CISCO-PSM-MIB", "cpsmPortBindResult"), ("CISCO-PSM-MIB", "cpsmPortBindLastActTime"), ("CISCO-PSM-MIB", "cpsmPortBindActState"), ("CISCO-PSM-MIB", "cpsmPortBindCopyActToConfig"), ("CISCO-PSM-MIB", "cpsmPortBindLastChangeTime"), ("CISCO-PSM-MIB", "cpsmPortBindClearStats"), ("CISCO-PSM-MIB", "cpsmPortBindClearAutoLearnDb"), ("CISCO-PSM-MIB", "cpsmPortBindClearAutoLearnIntf"), ("CISCO-PSM-MIB", "cpsmPortBindDiffConfigDb"), ("CISCO-PSM-MIB", "cpsmPortBindDiffReason"), ("CISCO-PSM-MIB", "cpsmPortBindDiffLoginDevType"), ("CISCO-PSM-MIB", "cpsmPortBindDiffLoginDev"), ("CISCO-PSM-MIB", "cpsmPortBindDiffLoginPointType"), ("CISCO-PSM-MIB", "cpsmPortBindDiffLoginPoint"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmPortBindConfigGroup = ciscoPsmPortBindConfigGroup.setStatus('deprecated')
ciscoPsmFabricBindConfigGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 2, 2)).setObjects(("CISCO-PSM-MIB", "cpsmFabricBindSwitchWwn"), ("CISCO-PSM-MIB", "cpsmFabricBindDomId"), ("CISCO-PSM-MIB", "cpsmFabricBindRowStatus"), ("CISCO-PSM-MIB", "cpsmFabricBindActivate"), ("CISCO-PSM-MIB", "cpsmFabricBindResult"), ("CISCO-PSM-MIB", "cpsmFabricBindLastActTime"), ("CISCO-PSM-MIB", "cpsmFabricBindActState"), ("CISCO-PSM-MIB", "cpsmFabricBindCopyActToConfig"), ("CISCO-PSM-MIB", "cpsmFabricBindLastChangeTime"), ("CISCO-PSM-MIB", "cpsmFabricBindClearStats"), ("CISCO-PSM-MIB", "cpsmFabricBindClearAutoLearnDb"), ("CISCO-PSM-MIB", "cpsmFabricBindClearAutoLearnIntf"), ("CISCO-PSM-MIB", "cpsmFabricBindDiffConfigDb"), ("CISCO-PSM-MIB", "cpsmFabricBindDiffReason"), ("CISCO-PSM-MIB", "cpsmFabricBindDiffSwitchWwn"), ("CISCO-PSM-MIB", "cpsmFabricBindDiffDomId"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmFabricBindConfigGroup = ciscoPsmFabricBindConfigGroup.setStatus('deprecated')
ciscoPsmPortBindEnforcedGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 2, 3)).setObjects(("CISCO-PSM-MIB", "cpsmPortBindEnfLoginDevType"), ("CISCO-PSM-MIB", "cpsmPortBindEnfLoginDev"), ("CISCO-PSM-MIB", "cpsmPortBindEnfLoginPointType"), ("CISCO-PSM-MIB", "cpsmPortBindEnfLoginPoint"), ("CISCO-PSM-MIB", "cpsmPortBindEnfIsLearnt"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmPortBindEnforcedGroup = ciscoPsmPortBindEnforcedGroup.setStatus('current')
ciscoPsmFabricBindEnforcedGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 2, 4)).setObjects(("CISCO-PSM-MIB", "cpsmFabricBindEnfSwitchWwn"), ("CISCO-PSM-MIB", "cpsmFabricBindEnfDomId"), ("CISCO-PSM-MIB", "cpsmFabricBindEnfIsLearnt"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmFabricBindEnforcedGroup = ciscoPsmFabricBindEnforcedGroup.setStatus('current')
ciscoPsmPortBindStatsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 2, 5)).setObjects(("CISCO-PSM-MIB", "cpsmPortBindAllowedLogins"), ("CISCO-PSM-MIB", "cpsmPortBindDeniedLogins"), ("CISCO-PSM-MIB", "cpsmPortBindLoginPwwn"), ("CISCO-PSM-MIB", "cpsmPortBindLoginNwwn"), ("CISCO-PSM-MIB", "cpsmPortBindLoginSwwn"), ("CISCO-PSM-MIB", "cpsmPortBindLoginPort"), ("CISCO-PSM-MIB", "cpsmPortBindLoginTime"), ("CISCO-PSM-MIB", "cpsmPortBindLoginCount"), ("CISCO-PSM-MIB", "cpsmPortBindLoginIntf"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmPortBindStatsGroup = ciscoPsmPortBindStatsGroup.setStatus('current')
ciscoPsmFabricBindStatsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 2, 6)).setObjects(("CISCO-PSM-MIB", "cpsmFabricBindAllowedReqs"), ("CISCO-PSM-MIB", "cpsmFabricBindDeniedReqs"), ("CISCO-PSM-MIB", "cpsmFabricBindSwwn"), ("CISCO-PSM-MIB", "cpsmFabricBindLocalPort"), ("CISCO-PSM-MIB", "cpsmFabricBindDenialTime"), ("CISCO-PSM-MIB", "cpsmFabricBindLocalIntf"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmFabricBindStatsGroup = ciscoPsmFabricBindStatsGroup.setStatus('deprecated')
ciscoPsmPortBindNotifyGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 2, 7)).setObjects(("CISCO-PSM-MIB", "ciscoPsmPortBindFPortDenyNotify"), ("CISCO-PSM-MIB", "ciscoPsmPortBindEPortDenyNotify"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmPortBindNotifyGroup = ciscoPsmPortBindNotifyGroup.setStatus('current')
ciscoPsmFabricBindNotifyGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 2, 8)).setObjects(("CISCO-PSM-MIB", "ciscoPsmFabricBindDenyNotify"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmFabricBindNotifyGroup = ciscoPsmFabricBindNotifyGroup.setStatus('deprecated')
ciscoPsmPortBindAutoLearnGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 2, 9)).setObjects(("CISCO-PSM-MIB", "cpsmPortBindAutoLearnEnable"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmPortBindAutoLearnGroup = ciscoPsmPortBindAutoLearnGroup.setStatus('current')
ciscoPsmFabricBindAutoLearnGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 2, 10)).setObjects(("CISCO-PSM-MIB", "cpsmFabricBindAutoLearnEnable"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmFabricBindAutoLearnGroup = ciscoPsmFabricBindAutoLearnGroup.setStatus('deprecated')
ciscoPsmNotifyEnableGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 2, 11)).setObjects(("CISCO-PSM-MIB", "cpsmNotifyEnable"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmNotifyEnableGroup = ciscoPsmNotifyEnableGroup.setStatus('current')
ciscoPsmFabricBindConfigGroup1 = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 2, 12)).setObjects(("CISCO-PSM-MIB", "cpsmFabricBindSwitchWwn"), ("CISCO-PSM-MIB", "cpsmFabricBindDomId"), ("CISCO-PSM-MIB", "cpsmFabricBindRowStatus"), ("CISCO-PSM-MIB", "cpsmFabricBindActivate"), ("CISCO-PSM-MIB", "cpsmFabricBindResult"), ("CISCO-PSM-MIB", "cpsmFabricBindLastActTime"), ("CISCO-PSM-MIB", "cpsmFabricBindActState"), ("CISCO-PSM-MIB", "cpsmFabricBindCopyActToConfig"), ("CISCO-PSM-MIB", "cpsmFabricBindLastChangeTime"), ("CISCO-PSM-MIB", "cpsmFabricBindClearStats"), ("CISCO-PSM-MIB", "cpsmFabricBindClearAutoLearnDb"), ("CISCO-PSM-MIB", "cpsmFabricBindDiffConfigDb"), ("CISCO-PSM-MIB", "cpsmFabricBindDiffReason"), ("CISCO-PSM-MIB", "cpsmFabricBindDiffSwitchWwn"), ("CISCO-PSM-MIB", "cpsmFabricBindDiffDomId"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmFabricBindConfigGroup1 = ciscoPsmFabricBindConfigGroup1.setStatus('deprecated')
ciscoPsmFabricBindStatsGroup1 = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 2, 13)).setObjects(("CISCO-PSM-MIB", "cpsmFabricBindAllowedReqs"), ("CISCO-PSM-MIB", "cpsmFabricBindDeniedReqs"), ("CISCO-PSM-MIB", "cpsmFabricBindSwwnR1"), ("CISCO-PSM-MIB", "cpsmFabricBindDenialTimeR1"), ("CISCO-PSM-MIB", "cpsmFabricBindDenialCountR1"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmFabricBindStatsGroup1 = ciscoPsmFabricBindStatsGroup1.setStatus('deprecated')
ciscoPsmFabricBindNotifyGroupR1 = NotificationGroup((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 2, 14)).setObjects(("CISCO-PSM-MIB", "ciscoPsmFabricBindDenyNotifyNew"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmFabricBindNotifyGroupR1 = ciscoPsmFabricBindNotifyGroupR1.setStatus('current')
ciscoPsmEfmdConfigGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 2, 15)).setObjects(("CISCO-PSM-MIB", "cpsmEfmdConfigEnforce"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmEfmdConfigGroup = ciscoPsmEfmdConfigGroup.setStatus('current')
ciscoPsmEfmdStatsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 2, 16)).setObjects(("CISCO-PSM-MIB", "cpsmEfmdTxMergeReqs"), ("CISCO-PSM-MIB", "cpsmEfmdRxMergeReqs"), ("CISCO-PSM-MIB", "cpsmEfmdTxMergeAccs"), ("CISCO-PSM-MIB", "cpsmEfmdRxMergeAccs"), ("CISCO-PSM-MIB", "cpsmEfmdTxMergeRejs"), ("CISCO-PSM-MIB", "cpsmEfmdRxMergeRejs"), ("CISCO-PSM-MIB", "cpsmEfmdTxMergeBusys"), ("CISCO-PSM-MIB", "cpsmEfmdRxMergeBusys"), ("CISCO-PSM-MIB", "cpsmEfmdTxMergeErrs"), ("CISCO-PSM-MIB", "cpsmEfmdRxMergeErrs"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmEfmdStatsGroup = ciscoPsmEfmdStatsGroup.setStatus('current')
ciscoPsmFabricBindStatsGroup2 = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 2, 17)).setObjects(("CISCO-PSM-MIB", "cpsmFabricBindAllowedReqs"), ("CISCO-PSM-MIB", "cpsmFabricBindDeniedReqs"), ("CISCO-PSM-MIB", "cpsmFabricBindSwwnR1"), ("CISCO-PSM-MIB", "cpsmFabricBindDenialTimeR1"), ("CISCO-PSM-MIB", "cpsmFabricBindDenialCountR1"), ("CISCO-PSM-MIB", "cpsmFabricBindDenialDomId"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmFabricBindStatsGroup2 = ciscoPsmFabricBindStatsGroup2.setStatus('deprecated')
ciscoPsmFabricBindStatsGroup3 = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 2, 18)).setObjects(("CISCO-PSM-MIB", "cpsmFabricBindAllowedReqs"), ("CISCO-PSM-MIB", "cpsmFabricBindDeniedReqs"), ("CISCO-PSM-MIB", "cpsmFabricBindSwwnR1"), ("CISCO-PSM-MIB", "cpsmFabricBindDenialTimeR1"), ("CISCO-PSM-MIB", "cpsmFabricBindDenialCountR1"), ("CISCO-PSM-MIB", "cpsmFabricBindDenialDomId"), ("CISCO-PSM-MIB", "cpsmFabricBindDenialReasonCode"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmFabricBindStatsGroup3 = ciscoPsmFabricBindStatsGroup3.setStatus('current')
ciscoPsmPortBindConfigGroup1 = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 2, 19)).setObjects(("CISCO-PSM-MIB", "cpsmPortBindLoginDevType"), ("CISCO-PSM-MIB", "cpsmPortBindLoginDev"), ("CISCO-PSM-MIB", "cpsmPortBindLoginPointType"), ("CISCO-PSM-MIB", "cpsmPortBindLoginPoint"), ("CISCO-PSM-MIB", "cpsmPortBindRowStatus"), ("CISCO-PSM-MIB", "cpsmPortBindActivate"), ("CISCO-PSM-MIB", "cpsmPortBindResult"), ("CISCO-PSM-MIB", "cpsmPortBindLastActTime"), ("CISCO-PSM-MIB", "cpsmPortBindActState"), ("CISCO-PSM-MIB", "cpsmPortBindCopyActToConfig"), ("CISCO-PSM-MIB", "cpsmPortBindLastChangeTime"), ("CISCO-PSM-MIB", "cpsmPortBindClearStats"), ("CISCO-PSM-MIB", "cpsmPortBindClearAutoLearnDb"), ("CISCO-PSM-MIB", "cpsmPortBindClearAutoLearnIntf"), ("CISCO-PSM-MIB", "cpsmPortBindDiffConfigDb"), ("CISCO-PSM-MIB", "cpsmPortBindDiffReason"), ("CISCO-PSM-MIB", "cpsmPortBindDiffLoginDevType"), ("CISCO-PSM-MIB", "cpsmPortBindDiffLoginDev"), ("CISCO-PSM-MIB", "cpsmPortBindDiffLoginPointType"), ("CISCO-PSM-MIB", "cpsmPortBindDiffLoginPoint"), ("CISCO-PSM-MIB", "cpsmPortBindNextFreeIndex"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmPortBindConfigGroup1 = ciscoPsmPortBindConfigGroup1.setStatus('current')
ciscoPsmFabricBindConfigGroup2 = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 364, 2, 2, 20)).setObjects(("CISCO-PSM-MIB", "cpsmFabricBindSwitchWwn"), ("CISCO-PSM-MIB", "cpsmFabricBindDomId"), ("CISCO-PSM-MIB", "cpsmFabricBindRowStatus"), ("CISCO-PSM-MIB", "cpsmFabricBindActivate"), ("CISCO-PSM-MIB", "cpsmFabricBindResult"), ("CISCO-PSM-MIB", "cpsmFabricBindLastActTime"), ("CISCO-PSM-MIB", "cpsmFabricBindActState"), ("CISCO-PSM-MIB", "cpsmFabricBindCopyActToConfig"), ("CISCO-PSM-MIB", "cpsmFabricBindLastChangeTime"), ("CISCO-PSM-MIB", "cpsmFabricBindClearStats"), ("CISCO-PSM-MIB", "cpsmFabricBindClearAutoLearnDb"), ("CISCO-PSM-MIB", "cpsmFabricBindDiffConfigDb"), ("CISCO-PSM-MIB", "cpsmFabricBindDiffReason"), ("CISCO-PSM-MIB", "cpsmFabricBindDiffSwitchWwn"), ("CISCO-PSM-MIB", "cpsmFabricBindDiffDomId"), ("CISCO-PSM-MIB", "cpsmFabricBindNextFreeIndex"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoPsmFabricBindConfigGroup2 = ciscoPsmFabricBindConfigGroup2.setStatus('current')
mibBuilder.exportSymbols("CISCO-PSM-MIB", cpsmPortBindEnfEntry=cpsmPortBindEnfEntry, ciscoPsmPortBindAutoLearnGroup=ciscoPsmPortBindAutoLearnGroup, cpsmFabricBindEnfNwType=cpsmFabricBindEnfNwType, cpsmFabricBindCopyActToConfig=cpsmFabricBindCopyActToConfig, cpsmPortBindDiffTable=cpsmPortBindDiffTable, cpsmFabricBindDenialTime=cpsmFabricBindDenialTime, cpsmFabricBindClearAutoLearnDb=cpsmFabricBindClearAutoLearnDb, ciscoPsmMIBComplianceRev2=ciscoPsmMIBComplianceRev2, cpsmPortBindLoginIntf=cpsmPortBindLoginIntf, cpsmFabricBindEnfIndex=cpsmFabricBindEnfIndex, cpsmPortBindClearAutoLearnDb=cpsmPortBindClearAutoLearnDb, cpsmPortBindAutoLearnTable=cpsmPortBindAutoLearnTable, cpsmPortBindActivate=cpsmPortBindActivate, cpsmPortBindCopyActToConfig=cpsmPortBindCopyActToConfig, cpsmFabricBindClearEntry=cpsmFabricBindClearEntry, cpsmPortBindDiffLoginDevType=cpsmPortBindDiffLoginDevType, cpsmFabricBindViolationTable=cpsmFabricBindViolationTable, ciscoPsmPortBindEnforcedGroup=ciscoPsmPortBindEnforcedGroup, ciscoPsmMIBNotifs=ciscoPsmMIBNotifs, cpsmPortBindDiffIndex=cpsmPortBindDiffIndex, cpsmPortBindVsanVlanType=cpsmPortBindVsanVlanType, cpsmFabricBindNwType=cpsmFabricBindNwType, cpsmPortBindNwIndex=cpsmPortBindNwIndex, cpsmPortBindDiffConfigTable=cpsmPortBindDiffConfigTable, cpsmPortBindActivateEntry=cpsmPortBindActivateEntry, cpsmFabricBindAutoLearnEnable=cpsmFabricBindAutoLearnEnable, cpsmFabricBindClearAutoLearnIntf=cpsmFabricBindClearAutoLearnIntf, cpsmEfmdRxMergeAccs=cpsmEfmdRxMergeAccs, cpsmPortBindClearNwIndex=cpsmPortBindClearNwIndex, cpsmFabricBindViolationNewEntry=cpsmFabricBindViolationNewEntry, cpsmFabricBindDiffNwType=cpsmFabricBindDiffNwType, cpsmFabricBindDiffIndex=cpsmFabricBindDiffIndex, cpsmFabricBindDenialReasonCode=cpsmFabricBindDenialReasonCode, ciscoPsmFabricBindStatsGroup=ciscoPsmFabricBindStatsGroup, cpsmPortBindActivateTable=cpsmPortBindActivateTable, cpsmFabricBindTable=cpsmFabricBindTable, cpsmPortBindCopyTable=cpsmPortBindCopyTable, cpsmFabricBindNwIndex=cpsmFabricBindNwIndex, cpsmFabricBindActState=cpsmFabricBindActState, cpsmPortBindViolationTable=cpsmPortBindViolationTable, cpsmConfiguration=cpsmConfiguration, ciscoPsmPortBindConfigGroup=ciscoPsmPortBindConfigGroup, cpsmFabricBindAutoLearnIndexType=cpsmFabricBindAutoLearnIndexType, cpsmEfmdStatsTable=cpsmEfmdStatsTable, cpsmFabricBindLastActTime=cpsmFabricBindLastActTime, cpsmPortBindAllowedLogins=cpsmPortBindAllowedLogins, cpsmFabricBindSwwn=cpsmFabricBindSwwn, cpsmFabricBindDomId=cpsmFabricBindDomId, cpsmFabricBindDiffReason=cpsmFabricBindDiffReason, ciscoPsmMIBComplianceRev3=ciscoPsmMIBComplianceRev3, ciscoPsmNotifyEnableGroup=ciscoPsmNotifyEnableGroup, cpsmFabricBindDiffNwIndex=cpsmFabricBindDiffNwIndex, cpsmEfmdConfigEntry=cpsmEfmdConfigEntry, cpsmFabricBindViolationIndex=cpsmFabricBindViolationIndex, cpsmPortBindNextFreeTable=cpsmPortBindNextFreeTable, ciscoPsmMIBGroups=ciscoPsmMIBGroups, cpsmPortBindEnfNwType=cpsmPortBindEnfNwType, cpsmEfmdTxMergeReqs=cpsmEfmdTxMergeReqs, CpsmViolationReasonCode=CpsmViolationReasonCode, cpsmPortBindDiffLoginDev=cpsmPortBindDiffLoginDev, cpsmFabricBindDiffEntry=cpsmFabricBindDiffEntry, cpsmEfmdRxMergeBusys=cpsmEfmdRxMergeBusys, ciscoPsmPortBindConfigGroup1=ciscoPsmPortBindConfigGroup1, cpsmFabricBindRowStatus=cpsmFabricBindRowStatus, CpsmDbActivate=CpsmDbActivate, cpsmEfmdTxMergeRejs=cpsmEfmdTxMergeRejs, cpsmFabricBindViolationNwIndexR1=cpsmFabricBindViolationNwIndexR1, cpsmPortBindLoginDev=cpsmPortBindLoginDev, cpsmFabricBindSwwnR1=cpsmFabricBindSwwnR1, cpsmPortBindNextFreeIndex=cpsmPortBindNextFreeIndex, cpsmEfmdStatsEntry=cpsmEfmdStatsEntry, CpsmPortBindSwPortType=CpsmPortBindSwPortType, ciscoPsmFabricBindDenyNotify=ciscoPsmFabricBindDenyNotify, cpsmFabricBindDeniedReqs=cpsmFabricBindDeniedReqs, cpsmFabricBindEntry=cpsmFabricBindEntry, cpsmPortBindAutoLearnEnable=cpsmPortBindAutoLearnEnable, cpsmPortBindDiffConfigEntry=cpsmPortBindDiffConfigEntry, cpsmEfmdConfigEnforce=cpsmEfmdConfigEnforce, cpsmPortBindLastChangeTime=cpsmPortBindLastChangeTime, cpsmPortBindEnfTable=cpsmPortBindEnfTable, cpsmPortBindDiffConfigNwIndex=cpsmPortBindDiffConfigNwIndex, cpsmFabricBindViolationNwTypeR1=cpsmFabricBindViolationNwTypeR1, cpsmNotifyEnable=cpsmNotifyEnable, cpsmFabricBindLocalPort=cpsmFabricBindLocalPort, cpsmPortBindLoginTime=cpsmPortBindLoginTime, ciscoPsmFabricBindConfigGroup2=ciscoPsmFabricBindConfigGroup2, cpsmPortBindLoginPointType=cpsmPortBindLoginPointType, ciscoPsmMIBComplianceRev1=ciscoPsmMIBComplianceRev1, ciscoPsmFabricBindStatsGroup3=ciscoPsmFabricBindStatsGroup3, cpsmFabricBindViolationIndexR1=cpsmFabricBindViolationIndexR1, ciscoPsmMIBObjects=ciscoPsmMIBObjects, cpsmFabricBindIndex=cpsmFabricBindIndex, cpsmEfmdTxMergeAccs=cpsmEfmdTxMergeAccs, cpsmPortBindEnfNwIndex=cpsmPortBindEnfNwIndex, cpsmPortBindEnfLoginDevType=cpsmPortBindEnfLoginDevType, cpsmPortBindDiffConfigDb=cpsmPortBindDiffConfigDb, cpsmEfmdConfigTable=cpsmEfmdConfigTable, cpsmPortBindClearNwType=cpsmPortBindClearNwType, cpsmFabricBindVsanVlanIndex=cpsmFabricBindVsanVlanIndex, ciscoPsmPortBindStatsGroup=ciscoPsmPortBindStatsGroup, CpsmDiffReason=CpsmDiffReason, cpsmFabricBindNextFreeIndex=cpsmFabricBindNextFreeIndex, cpsmFabricBindDiffConfigTable=cpsmFabricBindDiffConfigTable, cpsmFabricBindEnfDomId=cpsmFabricBindEnfDomId, cpsmFabricBindLastChangeTime=cpsmFabricBindLastChangeTime, CpsmStatsCounter=CpsmStatsCounter, cpsmPortBindLoginSwwn=cpsmPortBindLoginSwwn, ciscoPsmFabricBindNotifyGroupR1=ciscoPsmFabricBindNotifyGroupR1, cpsmPortBindVsanVlanIndex=cpsmPortBindVsanVlanIndex, cpsmPortBindRowStatus=cpsmPortBindRowStatus, cpsmPortBindEnfIsLearnt=cpsmPortBindEnfIsLearnt, ciscoPsmMIBConform=ciscoPsmMIBConform, CpsmPortBindDevType=CpsmPortBindDevType, ciscoPsmMIB=ciscoPsmMIB, cpsmPortBindEnfLoginPointType=cpsmPortBindEnfLoginPointType, cpsmFabricBindDiffConfigNwType=cpsmFabricBindDiffConfigNwType, ciscoPsmMIBCompliances=ciscoPsmMIBCompliances, cpsmFabricBindEnfNwIndex=cpsmFabricBindEnfNwIndex, CpsmClearStats=CpsmClearStats, cpsmPortBindAutoLearnEntry=cpsmPortBindAutoLearnEntry, cpsmPortBindClearAutoLearnIntf=cpsmPortBindClearAutoLearnIntf, cpsmPortBindCopyEntry=cpsmPortBindCopyEntry, cpsmFabricBindDiffTable=cpsmFabricBindDiffTable, ciscoPsmPortBindFPortDenyNotify=ciscoPsmPortBindFPortDenyNotify, cpsmFabricBindStatsEntry=cpsmFabricBindStatsEntry, cpsmPortBindStatsEntry=cpsmPortBindStatsEntry, cpsmPortBindClearEntry=cpsmPortBindClearEntry, cpsmPortBindDeniedLogins=cpsmPortBindDeniedLogins, cpsmFabricBindLocalIntf=cpsmFabricBindLocalIntf, ciscoPsmEfmdConfigGroup=ciscoPsmEfmdConfigGroup, cpsmPortBindResult=cpsmPortBindResult, ciscoPsmEfmdStatsGroup=ciscoPsmEfmdStatsGroup, cpsmPortBindAutoLearnIndexType=cpsmPortBindAutoLearnIndexType, CpsmActivateResult=CpsmActivateResult, CpsmAutoLearnEnable=CpsmAutoLearnEnable, cpsmPortBindNextFreeNwIndex=cpsmPortBindNextFreeNwIndex, cpsmPortBindLoginDevType=cpsmPortBindLoginDevType, cpsmFabricBindResult=cpsmFabricBindResult, cpsmEfmdRxMergeRejs=cpsmEfmdRxMergeRejs, cpsmPortBindDiffNwType=cpsmPortBindDiffNwType, cpsmPortBindEntry=cpsmPortBindEntry, cpsmPortBindViolationNwType=cpsmPortBindViolationNwType, PYSNMP_MODULE_ID=ciscoPsmMIB, cpsmPortBindEnfLoginPoint=cpsmPortBindEnfLoginPoint, cpsmFabricBindDiffConfigEntry=cpsmFabricBindDiffConfigEntry, cpsmFabricBindCopyTable=cpsmFabricBindCopyTable, CpsmClearAutoLearnDb=CpsmClearAutoLearnDb, cpsmPortBindLoginPoint=cpsmPortBindLoginPoint, cpsmFabricBindAllowedReqs=cpsmFabricBindAllowedReqs, cpsmFabricBindActivateTable=cpsmFabricBindActivateTable, cpsmFabricBindAutoLearnTable=cpsmFabricBindAutoLearnTable, cpsmPortBindActState=cpsmPortBindActState, CpsmDiffDb=CpsmDiffDb, cpsmPortBindDiffReason=cpsmPortBindDiffReason, cpsmPortBindStatsTable=cpsmPortBindStatsTable, cpsmFabricBindDenialDomId=cpsmFabricBindDenialDomId, ciscoPsmFabricBindEnforcedGroup=ciscoPsmFabricBindEnforcedGroup, cpsmFabricBindNextFreeTable=cpsmFabricBindNextFreeTable, cpsmPortBindLoginPwwn=cpsmPortBindLoginPwwn, cpsmFabricBindViolationNewTable=cpsmFabricBindViolationNewTable, ciscoPsmPortBindNotifyGroup=ciscoPsmPortBindNotifyGroup, ciscoPsmFabricBindAutoLearnGroup=ciscoPsmFabricBindAutoLearnGroup, cpsmPortBindDiffNwIndex=cpsmPortBindDiffNwIndex, cpsmFabricBindNextFreeNwType=cpsmFabricBindNextFreeNwType, cpsmFabricBindCopyEntry=cpsmFabricBindCopyEntry, cpsmFabricBindStatsTable=cpsmFabricBindStatsTable, cpsmFabricBindVsanVlanType=cpsmFabricBindVsanVlanType, cpsmPortBindViolationNwIndex=cpsmPortBindViolationNwIndex, ciscoPsmFabricBindConfigGroup1=ciscoPsmFabricBindConfigGroup1, cpsmFabricBindEnfEntry=cpsmFabricBindEnfEntry, CpsmVirtNwType=CpsmVirtNwType, cpsmPortBindIndex=cpsmPortBindIndex, cpsmPortBindLastActTime=cpsmPortBindLastActTime, cpsmFabricBindEnfTable=cpsmFabricBindEnfTable, cpsmPortBindNwType=cpsmPortBindNwType, cpsmPortBindNextFreeEntry=cpsmPortBindNextFreeEntry, cpsmPortBindDiffLoginPoint=cpsmPortBindDiffLoginPoint, ciscoPsmFabricBindDenyNotifyNew=ciscoPsmFabricBindDenyNotifyNew, cpsmFabricBindDenialTimeR1=cpsmFabricBindDenialTimeR1, cpsmFabricBindClearNwType=cpsmFabricBindClearNwType, ciscoPsmPortBindEPortDenyNotify=ciscoPsmPortBindEPortDenyNotify, cpsmFabricBindEnfSwitchWwn=cpsmFabricBindEnfSwitchWwn, cpsmFabricBindAutoLearnEntry=cpsmFabricBindAutoLearnEntry, cpsmFabricBindClearTable=cpsmFabricBindClearTable, cpsmPortBindEnfLoginDev=cpsmPortBindEnfLoginDev, cpsmFabricBindClearStats=cpsmFabricBindClearStats, cpsmFabricBindDiffDomId=cpsmFabricBindDiffDomId, cpsmEfmdTxMergeErrs=cpsmEfmdTxMergeErrs, cpsmPortBindClearTable=cpsmPortBindClearTable, cpsmFabricBindActivate=cpsmFabricBindActivate, cpsmEfmdRxMergeErrs=cpsmEfmdRxMergeErrs, cpsmPortBindLoginPort=cpsmPortBindLoginPort, cpsmPortBindDiffLoginPointType=cpsmPortBindDiffLoginPointType, cpsmPortBindViolationIndex=cpsmPortBindViolationIndex, ciscoPsmMIBComplianceRev4=ciscoPsmMIBComplianceRev4, cpsmFabricBindDiffConfigNwIndex=cpsmFabricBindDiffConfigNwIndex, cpsmPortBindNextFreeNwType=cpsmPortBindNextFreeNwType, cpsmStats=cpsmStats, cpsmFabricBindNextFreeEntry=cpsmFabricBindNextFreeEntry, cpsmFabricBindNextFreeNwIndex=cpsmFabricBindNextFreeNwIndex, cpsmPortBindDiffEntry=cpsmPortBindDiffEntry, cpsmPortBindClearStats=cpsmPortBindClearStats, ciscoPsmMIBCompliance=ciscoPsmMIBCompliance, cpsmFabricBindDenialCountR1=cpsmFabricBindDenialCountR1, cpsmFabricBindActivateEntry=cpsmFabricBindActivateEntry, cpsmFabricBindEnfIsLearnt=cpsmFabricBindEnfIsLearnt, ciscoPsmMIBComplianceRev5=ciscoPsmMIBComplianceRev5, cpsmEfmdTxMergeBusys=cpsmEfmdTxMergeBusys, cpsmFabricBindViolationEntry=cpsmFabricBindViolationEntry, cpsmPortBindViolationEntry=cpsmPortBindViolationEntry, cpsmFabricBindSwitchWwn=cpsmFabricBindSwitchWwn, ciscoPsmFabricBindConfigGroup=ciscoPsmFabricBindConfigGroup, cpsmPortBindTable=cpsmPortBindTable, ciscoPsmFabricBindStatsGroup2=ciscoPsmFabricBindStatsGroup2, ciscoPsmFabricBindStatsGroup1=ciscoPsmFabricBindStatsGroup1, cpsmFabricBindAutoLearnIndex=cpsmFabricBindAutoLearnIndex, cpsmPortBindEnfIndex=cpsmPortBindEnfIndex, ciscoPsmFabricBindNotifyGroup=ciscoPsmFabricBindNotifyGroup, cpsmFabricBindDiffConfigDb=cpsmFabricBindDiffConfigDb, cpsmEfmdRxMergeReqs=cpsmEfmdRxMergeReqs, cpsmPortBindLoginCount=cpsmPortBindLoginCount, cpsmPortBindAutoLearnIndex=cpsmPortBindAutoLearnIndex, cpsmPortBindLoginNwwn=cpsmPortBindLoginNwwn, cpsmFabricBindClearNwIndex=cpsmFabricBindClearNwIndex, cpsmFabricBindDiffSwitchWwn=cpsmFabricBindDiffSwitchWwn, cpsmPortBindDiffConfigNwType=cpsmPortBindDiffConfigNwType)
| 137.367232 | 11,462 | 0.768295 | 7,473 | 72,942 | 7.498863 | 0.055667 | 0.040971 | 0.056336 | 0.015204 | 0.44842 | 0.430165 | 0.38723 | 0.380217 | 0.352433 | 0.350934 | 0 | 0.062971 | 0.080393 | 72,942 | 530 | 11,463 | 137.626415 | 0.772459 | 0.004387 | 0 | 0.09505 | 0 | 0 | 0.199138 | 0.087436 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.019802 | 0 | 0.112871 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
12f4e8bd8a5fba828b358f3aa830d23e7c438dfc | 504 | py | Python | Scripts/Prism_Kitsu_Tools_Functions.py | francis-ng/Kitsu-for-Prism | 560bef52bbaee78ffc8eeabf8373b277f324e0c4 | [
"MIT"
] | 15 | 2020-11-22T10:18:25.000Z | 2022-02-14T23:37:08.000Z | Scripts/Prism_Kitsu_Tools_Functions.py | francis-ng/Kitsu-for-Prism | 560bef52bbaee78ffc8eeabf8373b277f324e0c4 | [
"MIT"
] | 5 | 2021-02-09T06:15:49.000Z | 2022-01-24T16:58:23.000Z | Scripts/Prism_Kitsu_Tools_Functions.py | francis-ng/Kitsu-for-Prism | 560bef52bbaee78ffc8eeabf8373b277f324e0c4 | [
"MIT"
] | 8 | 2021-01-06T13:07:19.000Z | 2021-10-03T02:39:57.000Z | import os
import errno
try:
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
except:
from PySide.QtCore import *
from PySide.QtGui import *
def printText(text, name="Print"):
QMessageBox.warning(QWidget(), str(name), str(text))
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc: # Python >2.5
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
else:
raise
| 20.16 | 61 | 0.625 | 66 | 504 | 4.757576 | 0.560606 | 0.105096 | 0.101911 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013661 | 0.27381 | 504 | 24 | 62 | 21 | 0.844262 | 0.021825 | 0 | 0.105263 | 0 | 0 | 0.010183 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.105263 | false | 0.052632 | 0.368421 | 0 | 0.473684 | 0.052632 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 2 |
12fd6baeb63d7949cf8f66ea39166291d470735e | 1,184 | py | Python | Accounts/decarators.py | Anand911/E-LEARNING-SCLMAXO- | a16c317ae482c91f4f91c967ddc3e498a43ac7e9 | [
"MIT"
] | 1 | 2021-02-14T10:43:21.000Z | 2021-02-14T10:43:21.000Z | Accounts/decarators.py | Anand911/E-LEARNING-SCLMAXO- | a16c317ae482c91f4f91c967ddc3e498a43ac7e9 | [
"MIT"
] | 1 | 2021-01-12T07:22:08.000Z | 2021-01-13T19:07:02.000Z | Accounts/decarators.py | Anand911/E-LEARNING-SCLMAXO- | a16c317ae482c91f4f91c967ddc3e498a43ac7e9 | [
"MIT"
] | 6 | 2020-12-13T17:46:37.000Z | 2021-02-10T13:47:25.000Z | from django.http import HttpResponse
from django.shortcuts import redirect
from .models import classroom
def getclasslist(request):
c=classroom.objects.filter(members=request.user.profile)
c_list=[]
for class_room in c:
c_list.append(class_room.classid)
return c_list
def unauthenticated_user(view_func):
def wrapper_func(request,*args,**kwargs):
if request.user.is_authenticated:
return redirect('home')
else:
return view_func(request,*args,**kwargs)
return wrapper_func
def is_class_member(allowed_class=[]):
def decorator(view_func):
def wrapper_func(request,c_id):
allowed_class=getclasslist(request)
if c_id in allowed_class:
return view_func(request,c_id)
else:
return redirect('home')
return wrapper_func
return decorator
def is_class_admin(view_func):
def wrapper_func(request,c_id):
class_admin=classroom.objects.get(classid=c_id).admin
if request.user==class_admin:
return view_func(request,c_id)
else:
return redirect('/classroom/'+c_id)
return wrapper_func
| 30.358974 | 61 | 0.673142 | 152 | 1,184 | 5.013158 | 0.282895 | 0.027559 | 0.062992 | 0.073491 | 0.232283 | 0.232283 | 0.194226 | 0.194226 | 0.110236 | 0 | 0 | 0 | 0.240709 | 1,184 | 38 | 62 | 31.157895 | 0.847608 | 0 | 0 | 0.352941 | 0 | 0 | 0.016047 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.235294 | false | 0 | 0.088235 | 0 | 0.647059 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
420566d95b7fc1fbb9016407a24d9b8785f03868 | 409 | py | Python | Ejercicio4.py | mariagarciau/introduccion-algoritmica | 1543005a290daca8969f8ca3364f46d8149f8434 | [
"Apache-2.0"
] | null | null | null | Ejercicio4.py | mariagarciau/introduccion-algoritmica | 1543005a290daca8969f8ca3364f46d8149f8434 | [
"Apache-2.0"
] | null | null | null | Ejercicio4.py | mariagarciau/introduccion-algoritmica | 1543005a290daca8969f8ca3364f46d8149f8434 | [
"Apache-2.0"
] | null | null | null | def media(n1=int(input("introduce la nota ")),n2=int(input("introduce la nota ")),
n3=int(input("introduce la nota ")),n4=int(input("introduce la nota "))):
notaMedia=(n1+n2+n3+n4)/4
if notaMedia>15:
return print("Alumno con talento")
elif notaMedia>=12 and notaMedia<=15:
return print("Con capacidad")
elif notaMedia<12:
return print("Debe reorientarse")
media()
| 34.083333 | 82 | 0.647922 | 58 | 409 | 4.568966 | 0.448276 | 0.120755 | 0.256604 | 0.286792 | 0.34717 | 0 | 0 | 0 | 0 | 0 | 0 | 0.051672 | 0.195599 | 409 | 11 | 83 | 37.181818 | 0.753799 | 0 | 0 | 0 | 0 | 0 | 0.294118 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0 | 0 | 0.4 | 0.3 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4221684004f615171ca0fce416be4be16c990d76 | 12,946 | py | Python | tests/integration/test_translator.py | Kami/python-protobuf-cloud-datastore-entity-translator | f1f6d5b1c2aac7f7c7aa949f3c46dcf13b148659 | [
"Apache-2.0"
] | 3 | 2019-07-11T11:48:34.000Z | 2020-03-27T12:47:56.000Z | tests/integration/test_translator.py | Kami/python-protobuf-cloud-datastore-entity-translator | f1f6d5b1c2aac7f7c7aa949f3c46dcf13b148659 | [
"Apache-2.0"
] | 20 | 2019-06-24T20:44:17.000Z | 2020-04-03T12:59:00.000Z | tests/integration/test_translator.py | Kami/python-protobuf-cloud-datastore-entity-translator | f1f6d5b1c2aac7f7c7aa949f3c46dcf13b148659 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright 2019 Tomaz Muraus
# Copyright 2019 Extreme Networks, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
__all__ = [
'GoogleDatastoreTranslatorIntegrationTestCase'
]
import sys
from google.cloud import datastore
from tests.generated import example_pb2
from tests.mocks import EXAMPLE_DICT_POPULATED
from tests.mocks import EXAMPLE_DICT_DEFAULT_VALUES
from tests.mocks import EXAMPLE_PB_POPULATED
from tests.mocks import EXAMPLE_PB_DEFAULT_VALUES
from tests.integration.base import BaseDatastoreIntegrationTestCase
from protobuf_cloud_datastore_translator import model_pb_to_entity_pb
from protobuf_cloud_datastore_translator import entity_pb_to_model_pb
__all__ = [
'GoogleDatastoreTranslatorIntegrationTestCase'
]
class GoogleDatastoreTranslatorIntegrationTestCase(BaseDatastoreIntegrationTestCase):
"""
NOTE: Those tests rely on datastore emulator running (gcloud beta emulator datastore start
--no-store-on-disk).
"""
def setUp(self):
super(GoogleDatastoreTranslatorIntegrationTestCase, self).setUp()
modules_to_remove = [
'tests.generated.options_pb2',
'tests.generated.models.options_pb2',
'tests.generated.example_with_options_pb2',
'tests.generated.models.example_with_options_pb2',
]
for module_name in modules_to_remove:
if module_name in sys.modules:
del sys.modules[module_name]
def test_store_and_retrieve_populated_translated_object_from_datastore(self):
# type: () -> None
"""
Test case which stores raw entity object in the datastore and verifies it matched the
same object which is stored using translated Protobuf definition.
"""
key_native = self.client.key('ExampleModel', 'native_entity_populated')
entity_native = datastore.Entity(key=key_native)
entity_native.update(EXAMPLE_DICT_POPULATED)
self.client.put(entity_native)
entity_native_retrieved = self.client.get(key_native)
self.assertTrue(entity_native_retrieved)
# Verify retrieved data matches the original input
self.assertEqual(entity_native_retrieved, EXAMPLE_DICT_POPULATED)
# Store custom Protobuf object in a datastore by translating it to Entity object
key_translated = self.client.key('ExampleModel', 'translated_entity_populated')
example_pb = EXAMPLE_PB_POPULATED
entity_pb_translated = model_pb_to_entity_pb(model_pb=example_pb)
# pylint: disable=no-member
entity_pb_translated.key.CopyFrom(key_translated.to_protobuf())
entity_translated = datastore.helpers.entity_from_protobuf(entity_pb_translated)
self.client.put(entity_translated)
# Verify that the translated entity results in the same end result as using native
# entity object
entity_translated_retrieved = self.client.get(key_translated)
self.assertTrue(entity_translated_retrieved.key != entity_native_retrieved.key)
# NOTE: key won't be the same so we clear it
entity_translated_retrieved.key = None
entity_native_retrieved.key = None
self.assertEqual(entity_translated_retrieved, entity_native_retrieved)
# If we translate retrieved entity back to the original Protobuf object definition, it
# should be the same as the original model (minus the key since the original model doesn't
# contain a key)
entity_pb_retrieved = datastore.helpers.entity_to_protobuf(entity_translated_retrieved)
entity_pb_translated.ClearField('key')
self.assertEqual(entity_pb_translated, entity_pb_retrieved)
example_pb_retrieved = entity_pb_to_model_pb(example_pb2.ExampleDBModel,
entity_pb_retrieved)
self.assertEqual(example_pb_retrieved, example_pb)
def test_store_and_retrieve_default_values_and_translated_object_from_datastore(self):
# type: () -> None
key_native = self.client.key('ExampleModel', 'native_entity_default_values')
entity_native = datastore.Entity(key=key_native)
entity_native.update(EXAMPLE_DICT_DEFAULT_VALUES)
self.client.put(entity_native)
entity_native_retrieved = self.client.get(key_native)
self.assertTrue(entity_native_retrieved)
# Verify retrieved data matches the original input
self.assertEqual(entity_native_retrieved, EXAMPLE_DICT_DEFAULT_VALUES)
# Store custom Protobuf object in a datastore by translating it to Entity object
key_translated = self.client.key('ExampleModel', 'translated_entity_default_values')
example_pb = EXAMPLE_PB_DEFAULT_VALUES
entity_pb_translated = model_pb_to_entity_pb(model_pb=example_pb)
# pylint: disable=no-member
entity_pb_translated.key.CopyFrom(key_translated.to_protobuf())
entity_translated = datastore.helpers.entity_from_protobuf(entity_pb_translated)
self.client.put(entity_translated)
# Verify that the translated entity results in the same end result as using native
# entity object
entity_translated_retrieved = self.client.get(key_translated)
self.assertTrue(entity_translated_retrieved.key != entity_native_retrieved.key)
# NOTE: key won't be the same so we clear it
entity_translated_retrieved.key = None
entity_native_retrieved.key = None
self.assertEqual(entity_translated_retrieved, entity_native_retrieved)
# If we translate retrieved entity back to the original Protobuf object definition, it
# should be the same as the original model (minus the key since the original model doesn't
# contain a key)
entity_pb_retrieved = datastore.helpers.entity_to_protobuf(entity_translated_retrieved)
entity_pb_translated.ClearField('key')
self.assertEqual(entity_pb_translated, entity_pb_retrieved)
example_pb_retrieved = entity_pb_to_model_pb(example_pb2.ExampleDBModel,
entity_pb_retrieved)
self.assertEqual(example_pb_retrieved, example_pb)
# Storing and retrieving empty object should have the same end result
key_native_empty = self.client.key('ExampleModel', 'native_entity_empty')
entity_native_empty = datastore.Entity(key=key_native_empty)
entity_native_empty.update({})
self.client.put(entity_native_empty)
entity_native_empty_retrieved = self.client.get(key_native_empty)
self.assertTrue(entity_native_empty_retrieved is not None)
# Verify retrieved data matches the original input
self.assertEqual(entity_native_empty_retrieved, {})
# Store custom Protobuf object in a datastore by translating it to Entity object
key_translated_empty = self.client.key('ExampleModel', 'translated_entity_empty')
example_pb = example_pb2.ExampleDBModel()
entity_pb_translated_empty = model_pb_to_entity_pb(model_pb=example_pb)
# pylint: disable=no-member
entity_pb_translated_empty.key.CopyFrom(key_translated_empty.to_protobuf())
entity_translated_empty = datastore.helpers.entity_from_protobuf(entity_pb_translated_empty)
self.client.put(entity_translated_empty)
# Verify that the translated entity results in the same end result as using native
# entity object
entity_translated_empty_retrieved = self.client.get(key_translated_empty)
self.assertTrue(entity_translated_empty_retrieved.key != entity_native_empty_retrieved.key)
# NOTE: key won't be the same so we clear it
entity_translated_empty_retrieved.key = None
entity_native_empty_retrieved.key = None
# self.assertEqual(entity_translated_empty_retrieved, entity_native_empty_retrieved)
# return
# If we translate retrieved entity back to the original Protobuf object definition, it
# should be the same as the original model (minus the key since the original model doesn't
# contain a key)
entity_pb_empty_retrieved = \
datastore.helpers.entity_to_protobuf(entity_translated_empty_retrieved)
entity_pb_translated_empty.ClearField('key')
entity_pb_empty_retrieved.ClearField('key')
self.assertEqual(entity_pb_translated_empty, entity_pb_empty_retrieved)
example_pb_empty_retrieved = entity_pb_to_model_pb(example_pb2.ExampleDBModel,
entity_pb_empty_retrieved)
self.assertEqual(example_pb_empty_retrieved, example_pb)
def test_model_pb_to_entity_pb_exclude_from_index_fields(self):
# type: () -> None
example_pb = example_pb2.ExampleDBModel()
example_pb.int32_key = 100
example_pb.string_key = 'string bar'
example_pb.bytes_key = b'foobarbytes'
example_pb.enum_key = 1 # type: ignore
# No exclude from index provided
entity_pb = model_pb_to_entity_pb(model_pb=example_pb)
entity_translated = datastore.helpers.entity_from_protobuf(entity_pb)
self.assertEqual(entity_translated.exclude_from_indexes, set([]))
entity_translated.key = self.client.key('ExampleModel', 'exclude_from_indexes_1')
self.client.put(entity_translated)
entity_translated_retrieved = self.client.get(entity_translated.key)
self.assertEqual(entity_translated, entity_translated_retrieved)
# Exclude from index provided for some fields
entity_pb = model_pb_to_entity_pb(model_pb=example_pb,
exclude_from_index=['int32_key', 'bytes_key'])
entity_translated = datastore.helpers.entity_from_protobuf(entity_pb)
self.assertEqual(entity_translated.exclude_from_indexes, set(['int32_key', 'bytes_key']))
entity_translated.key = self.client.key('ExampleModel', 'exclude_from_indexes_2')
self.client.put(entity_translated)
entity_translated_retrieved = self.client.get(entity_translated.key)
self.assertEqual(entity_translated, entity_translated_retrieved)
def test_model_pb_to_entity_pb_exclude_from_index_custom_extension_model_without_package(self):
# type: () -> None
from tests.generated import example_with_options_pb2
model_pb = example_with_options_pb2.ExampleDBModelWithOptions1()
model_pb.string_key_one = 'one'
model_pb.string_key_two = 'two'
model_pb.string_key_three = 'three'
model_pb.string_key_four = 'four'
model_pb.int32_field_one = 111
model_pb.int32_field_two = 222
entity_pb = model_pb_to_entity_pb(model_pb=model_pb)
entity_translated = datastore.helpers.entity_from_protobuf(entity_pb)
self.assertEqual(entity_translated.exclude_from_indexes,
set(['string_key_one', 'int32_field_two', 'string_key_three']))
entity_translated.key = self.client.key('ExampleModelWithOptions', 'exclude_from_index_1')
self.client.put(entity_translated)
entity_translated_retrieved = self.client.get(entity_translated.key)
self.assertEqual(entity_translated, entity_translated_retrieved)
def test_model_pb_to_entity_pb_exclude_from_index_custom_extension_model_with_package(self):
# type: () -> None
from tests.generated.models import example_with_options_pb2
model_pb = example_with_options_pb2.ExampleDBModelWithOptions1()
model_pb.string_key_one = 'one'
model_pb.string_key_two = 'two'
model_pb.string_key_three = 'three'
model_pb.string_key_four = 'four'
model_pb.int32_field_one = 111
model_pb.int32_field_two = 222
entity_pb = model_pb_to_entity_pb(model_pb=model_pb)
entity_translated = datastore.helpers.entity_from_protobuf(entity_pb)
self.assertEqual(entity_translated.exclude_from_indexes,
set(['string_key_one', 'int32_field_two', 'string_key_three']))
entity_translated.key = self.client.key('ExampleModelWithOptions', 'exclude_from_index_1')
self.client.put(entity_translated)
entity_translated_retrieved = self.client.get(entity_translated.key)
self.assertEqual(entity_translated, entity_translated_retrieved)
| 45.265734 | 100 | 0.730882 | 1,599 | 12,946 | 5.569106 | 0.130707 | 0.095227 | 0.050533 | 0.018529 | 0.78192 | 0.713307 | 0.663672 | 0.63571 | 0.613139 | 0.613139 | 0 | 0.006502 | 0.204001 | 12,946 | 285 | 101 | 45.424561 | 0.857642 | 0.204465 | 0 | 0.518987 | 0 | 0 | 0.078756 | 0.045018 | 0 | 0 | 0 | 0 | 0.158228 | 1 | 0.037975 | false | 0 | 0.075949 | 0 | 0.120253 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4221a8e76fc64f746b03f68ee2bbf2f18b7f2a8f | 942 | py | Python | metagov/metagov/plugins/revshare/schemas.py | hozzjss/metagov-prototype | ff9c1e938d913bb529d67ce3be69e3e08017c6b8 | [
"MIT"
] | 13 | 2020-12-31T10:41:45.000Z | 2021-11-16T18:48:54.000Z | metagov/metagov/plugins/revshare/schemas.py | hozzjss/metagov-prototype | ff9c1e938d913bb529d67ce3be69e3e08017c6b8 | [
"MIT"
] | 58 | 2020-12-31T10:23:00.000Z | 2021-11-16T19:24:36.000Z | metagov/metagov/plugins/revshare/schemas.py | hozzjss/metagov-prototype | ff9c1e938d913bb529d67ce3be69e3e08017c6b8 | [
"MIT"
] | 5 | 2021-02-24T19:53:42.000Z | 2021-06-03T06:34:28.000Z | add_pointer_input = {
"type": "object",
"additionalProperties": False,
"properties": {"pointer": {"type": "string"}, "weight": {"type": "integer"}, "key": {"type": "string"}},
"required": ["pointer", "weight"],
}
remove_pointer_input = {
"type": "object",
"additionalProperties": False,
"properties": {"pointer": {"type": "string"}, "key": {"type": "string"}},
"required": ["pointer"],
}
replace_config_input = {
"type": "object",
"additionalProperties": False,
"properties": {"pointers": {"type": "object"}, "key": {"type": "string"}},
"required": ["pointers"],
}
get_config_input = {
"type": "object",
"additionalProperties": False,
"properties": {"key": {"type": "string"}}
}
pick_pointer_input = get_config_input
pick_pointer_output = {
"type": "object",
"additionalProperties": False,
"properties": {"pointer": {"type": "string"}},
"required": ["pointer"],
}
| 28.545455 | 108 | 0.590234 | 82 | 942 | 6.609756 | 0.243902 | 0.129151 | 0.276753 | 0.322878 | 0.697417 | 0.594096 | 0.594096 | 0.387454 | 0.273063 | 0.273063 | 0 | 0 | 0.171975 | 942 | 32 | 109 | 29.4375 | 0.694872 | 0 | 0 | 0.4 | 0 | 0 | 0.429936 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
422286081f477f29282e7feeab09d7387eb23da3 | 2,013 | py | Python | recohut/datasets/taobao.py | sparsh-ai/recohut | 4121f665761ffe38c9b6337eaa9293b26bee2376 | [
"Apache-2.0"
] | null | null | null | recohut/datasets/taobao.py | sparsh-ai/recohut | 4121f665761ffe38c9b6337eaa9293b26bee2376 | [
"Apache-2.0"
] | 1 | 2022-01-12T05:40:57.000Z | 2022-01-12T05:40:57.000Z | recohut/datasets/taobao.py | RecoHut-Projects/recohut | 4121f665761ffe38c9b6337eaa9293b26bee2376 | [
"Apache-2.0"
] | null | null | null | # AUTOGENERATED! DO NOT EDIT! File to edit: nbs/datasets/datasets.taobao.ipynb (unless otherwise specified).
__all__ = ['TaobaoDataset', 'TaobaoDataModule']
# Cell
from .bases.ctr import *
from ..utils.common_utils import download_url
from datetime import date
# Cell
class TaobaoDataset(CTRDataset):
feature_cols = [{'name': ["userid","adgroup_id","pid","cate_id","campaign_id","customer","brand","cms_segid",
"cms_group_id","final_gender_code","age_level","pvalue_level","shopping_level","occupation"],
'active': True, 'dtype': 'str', 'type': 'categorical'}]
label_col = {'name': 'clk', 'dtype': float}
train_url = "https://github.com/RecoHut-Datasets/sample_ctr/raw/v1/train_sample.csv"
valid_url = "https://github.com/RecoHut-Datasets/sample_ctr/raw/v1/valid_sample.csv"
test_url = "https://github.com/RecoHut-Datasets/sample_ctr/raw/v1/test_sample.csv"
@property
def raw_file_names(self):
return ['train_sample.csv',
'valid_sample.csv',
'test_sample.csv']
def download(self):
download_url(self.train_url, self.raw_dir)
download_url(self.valid_url, self.raw_dir)
download_url(self.test_url, self.raw_dir)
def convert_hour(self, df, col_name):
return df['time_stamp'].apply(lambda ts: ts[11:13])
def convert_weekday(self, df, col_name):
def _convert_weekday(timestamp):
dt = date(int(timestamp[0:4]), int(timestamp[5:7]), int(timestamp[8:10]))
return dt.strftime('%w')
return df['time_stamp'].apply(_convert_weekday)
def convert_weekend(self, df, col_name):
def _convert_weekend(timestamp):
dt = date(int(timestamp[0:4]), int(timestamp[5:7]), int(timestamp[8:10]))
return '1' if dt.strftime('%w') in ['6', '0'] else '0'
return df['time_stamp'].apply(_convert_weekend)
# Cell
class TaobaoDataModule(CTRDataModule):
dataset_cls = TaobaoDataset | 38.711538 | 125 | 0.654744 | 266 | 2,013 | 4.729323 | 0.409774 | 0.042925 | 0.033386 | 0.040541 | 0.356121 | 0.338633 | 0.255962 | 0.211447 | 0.211447 | 0.211447 | 0 | 0.015451 | 0.196225 | 2,013 | 52 | 126 | 38.711538 | 0.762052 | 0.060109 | 0 | 0.057143 | 1 | 0 | 0.26536 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.085714 | 0.057143 | 0.685714 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
422696cd16687255e2c0af4fe94e903929f759dc | 5,871 | py | Python | 04-Python/lexer/lexer_test.py | feiwofeifeixiaowo/monkey-py | f86a51780d4cc727321ffc6d72d33467c083a1b6 | [
"MIT"
] | null | null | null | 04-Python/lexer/lexer_test.py | feiwofeifeixiaowo/monkey-py | f86a51780d4cc727321ffc6d72d33467c083a1b6 | [
"MIT"
] | null | null | null | 04-Python/lexer/lexer_test.py | feiwofeifeixiaowo/monkey-py | f86a51780d4cc727321ffc6d72d33467c083a1b6 | [
"MIT"
] | null | null | null | import sys
sys.path.append('..')
import unittest
from lexer import new
from tokens import TokenType
class TestNextToken(unittest.TestCase):
def test_next_token(self):
input = 'let five = 5; \
let ten = 10; \
let add = fn(x, y) { \
x + y; \
}; \
let result = add(five, ten);\
!-/*5;\
5 < 10 > 5;\
if (5 < 10) { \
return true;\
} else {\
return false;\
}\
10 == 10;\
10 != 9; \
"foobar" \
"foo bar" \
[1, 2]; \
{"foo": "bar"} \
'
class ExpectedToken:
def __init__(self, type_name: TokenType, literal: str) -> None:
self.exp_token_type = type_name
self.exp_literal = literal
tests = [
ExpectedToken(TokenType.LET, 'let'),
ExpectedToken(TokenType.IDENT, 'five'),
ExpectedToken(TokenType.ASSIGN, '='),
ExpectedToken(TokenType.INT, '5'),
ExpectedToken(TokenType.SEMICOLON, ';'),
ExpectedToken(TokenType.LET, 'let'),
ExpectedToken(TokenType.IDENT, 'ten'),
ExpectedToken(TokenType.ASSIGN, '='),
ExpectedToken(TokenType.INT, '10'),
ExpectedToken(TokenType.SEMICOLON, ';'),
ExpectedToken(TokenType.LET, 'let'),
ExpectedToken(TokenType.IDENT, 'add'),
ExpectedToken(TokenType.ASSIGN, '='),
ExpectedToken(TokenType.FUNCTION, 'fn'),
ExpectedToken(TokenType.LPAREN, '('),
ExpectedToken(TokenType.IDENT, 'x'),
ExpectedToken(TokenType.COMMA, ','),
ExpectedToken(TokenType.IDENT, 'y'),
ExpectedToken(TokenType.RPAREN, ')'),
ExpectedToken(TokenType.LBRACE, '{'),
ExpectedToken(TokenType.IDENT, 'x'),
ExpectedToken(TokenType.PLUS, '+'),
ExpectedToken(TokenType.IDENT, 'y'),
ExpectedToken(TokenType.SEMICOLON, ';'),
ExpectedToken(TokenType.RBRACE, '}'),
ExpectedToken(TokenType.SEMICOLON, ';'),
ExpectedToken(TokenType.LET, 'let'),
ExpectedToken(TokenType.IDENT, 'result'),
ExpectedToken(TokenType.ASSIGN, '='),
ExpectedToken(TokenType.IDENT, 'add'),
ExpectedToken(TokenType.LPAREN, '('),
ExpectedToken(TokenType.IDENT, 'five'),
ExpectedToken(TokenType.COMMA, ','),
ExpectedToken(TokenType.IDENT, 'ten'),
ExpectedToken(TokenType.RPAREN, ')'),
ExpectedToken(TokenType.SEMICOLON, ';'),
ExpectedToken(TokenType.BANG, '!'),
ExpectedToken(TokenType.MINUS, '-'),
ExpectedToken(TokenType.SLASH, '/'),
ExpectedToken(TokenType.ASTERISK, '*'),
ExpectedToken(TokenType.INT, '5'),
ExpectedToken(TokenType.SEMICOLON, ';'),
ExpectedToken(TokenType.INT, '5'),
ExpectedToken(TokenType.LT, '<'),
ExpectedToken(TokenType.INT, '10'),
ExpectedToken(TokenType.GT, '>'),
ExpectedToken(TokenType.INT, '5'),
ExpectedToken(TokenType.SEMICOLON, ';'),
ExpectedToken(TokenType.IF, 'if'),
ExpectedToken(TokenType.LPAREN, '('),
ExpectedToken(TokenType.INT, '5'),
ExpectedToken(TokenType.LT, '<'),
ExpectedToken(TokenType.INT, '10'),
ExpectedToken(TokenType.RPAREN, ')'),
ExpectedToken(TokenType.LBRACE, '{'),
ExpectedToken(TokenType.RETURN, 'return'),
ExpectedToken(TokenType.TRUE, 'true'),
ExpectedToken(TokenType.SEMICOLON, ';'),
ExpectedToken(TokenType.RBRACE, '}'),
ExpectedToken(TokenType.ELSE, 'else'),
ExpectedToken(TokenType.LBRACE, '{'),
ExpectedToken(TokenType.RETURN, 'return'),
ExpectedToken(TokenType.FALSE, 'false'),
ExpectedToken(TokenType.SEMICOLON, ';'),
ExpectedToken(TokenType.RBRACE, '}'),
ExpectedToken(TokenType.INT, '10'),
ExpectedToken(TokenType.EQ, '=='),
ExpectedToken(TokenType.INT, '10'),
ExpectedToken(TokenType.SEMICOLON, ';'),
ExpectedToken(TokenType.INT, '10'),
ExpectedToken(TokenType.NOT_EQ, '!='),
ExpectedToken(TokenType.INT, '9'),
ExpectedToken(TokenType.SEMICOLON, ';'),
ExpectedToken(TokenType.STRING, 'foobar'),
ExpectedToken(TokenType.STRING, 'foo bar'),
ExpectedToken(TokenType.LBRACKET, '['),
ExpectedToken(TokenType.INT, '1'),
ExpectedToken(TokenType.COMMA, ','),
ExpectedToken(TokenType.INT, '2'),
ExpectedToken(TokenType.RBRACKET, ']'),
ExpectedToken(TokenType.SEMICOLON, ';'),
ExpectedToken(TokenType.LBRACE, '{'),
ExpectedToken(TokenType.STRING, 'foo'),
ExpectedToken(TokenType.COLON, ':'),
ExpectedToken(TokenType.STRING, 'bar'),
ExpectedToken(TokenType.RBRACE, '}'),
ExpectedToken(TokenType.EOF, ''),
]
l = new(input)
for i, tt in enumerate(tests):
tok = l.next_token()
self.assertEqual(tok.token_type, tt.exp_token_type,
'tests[{}] - token_type wrong, expected {}, got {}'.format(i, tt.exp_token_type,
tok.token_type))
self.assertEqual(tok.literal, tt.exp_literal,
'tests[{}] - literal wrong, expected {}, got {}'.format(i, tt.exp_literal, tok.literal))
if __name__ == '__main__':
unittest.main()
| 42.23741 | 117 | 0.534151 | 452 | 5,871 | 6.871681 | 0.190265 | 0.616227 | 0.112685 | 0.169994 | 0.696072 | 0.575016 | 0.421442 | 0.385705 | 0.287508 | 0.146813 | 0 | 0.01006 | 0.322773 | 5,871 | 138 | 118 | 42.543478 | 0.771127 | 0 | 0 | 0.507692 | 0 | 0 | 0.048033 | 0 | 0 | 0 | 0 | 0 | 0.015385 | 1 | 0.015385 | false | 0 | 0.030769 | 0 | 0.076923 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4226ec9704cb8cfc3e8ca462dae34b98269087ea | 1,031 | py | Python | pipeline/schemas/runnable.py | mystic-ai/pipeline | 487c5e755a862a12c90572b0eff170853ecb3790 | [
"Apache-2.0"
] | 7 | 2022-01-28T20:27:50.000Z | 2022-02-22T15:30:00.000Z | pipeline/schemas/runnable.py | mystic-ai/pipeline | 487c5e755a862a12c90572b0eff170853ecb3790 | [
"Apache-2.0"
] | 17 | 2022-01-11T12:05:38.000Z | 2022-03-25T15:29:43.000Z | pipeline/schemas/runnable.py | neuro-ai-dev/pipeline | c7edcc83576158062fe48f266dfaea62d754e761 | [
"Apache-2.0"
] | null | null | null | import enum
from typing import List, Optional
from pydantic import Field
from .base import BaseModel
from .project import ProjectGet
class RunnableType(enum.Enum):
function = "function"
pipeline = "pipeline"
class RunnableIOGet(BaseModel):
"""Unrealised/expected input/output data to a Runnable."""
name: str
type: str
class RunnableGet(BaseModel):
id: str
type: str
name: Optional[str]
project: ProjectGet
class RunnableGetDetailed(RunnableGet):
expected_inputs: List[RunnableIOGet] = []
expected_outputs: List[RunnableIOGet] = []
code_excerpt: Optional[str] = None
last_runs = []
# NOTE QUESTION: do we use these classes?
class FunctionGet(RunnableGet):
type: RunnableType = Field(RunnableType.function, const=True)
class FunctionGetDetailed(FunctionGet, RunnableGetDetailed):
pass
class PipelineGet(RunnableGet):
type: RunnableType = Field(RunnableType.pipeline, const=True)
class PipelineGetDetailed(PipelineGet, RunnableGetDetailed):
pass
| 20.215686 | 65 | 0.736178 | 109 | 1,031 | 6.926606 | 0.477064 | 0.039735 | 0.02649 | 0.084768 | 0.116556 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.177498 | 1,031 | 50 | 66 | 20.62 | 0.89033 | 0.090204 | 0 | 0.137931 | 0 | 0 | 0.017167 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.068966 | 0.172414 | 0 | 0.931034 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
423aeb80d50fea128bea973ddabe2235bd04d319 | 1,581 | py | Python | wifiphisher-1.4/wifiphisher/common/firewall.py | defNotTrendy/secureLogin | 85c4ed6a389132f44df2c393fe17475d6152fdcf | [
"MIT"
] | null | null | null | wifiphisher-1.4/wifiphisher/common/firewall.py | defNotTrendy/secureLogin | 85c4ed6a389132f44df2c393fe17475d6152fdcf | [
"MIT"
] | null | null | null | wifiphisher-1.4/wifiphisher/common/firewall.py | defNotTrendy/secureLogin | 85c4ed6a389132f44df2c393fe17475d6152fdcf | [
"MIT"
] | null | null | null | #pylint: skip-file
import subprocess
from wifiphisher.common.constants import *
class Fw():
def __init__(self):
pass
def nat(self, internal_interface, external_interface):
subprocess.call(
('iptables -t nat -A POSTROUTING -o %s -j MASQUERADE' %
(external_interface, )),
shell=True)
subprocess.call(
('iptables -A FORWARD -i %s -o %s -j ACCEPT' %
(internal_interface, external_interface)),
shell=True)
def clear_rules(self):
subprocess.call('iptables -F', shell=True)
subprocess.call('iptables -X', shell=True)
subprocess.call('iptables -t nat -F', shell=True)
subprocess.call('iptables -t nat -X', shell=True)
def redirect_requests_localhost(self):
subprocess.call(
('iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination %s:%s'
% (NETWORK_GW_IP, PORT)),
shell=True)
subprocess.call(
('iptables -t nat -A PREROUTING -p udp --dport 53 -j DNAT --to-destination %s:%s'
% (NETWORK_GW_IP, 53)),
shell=True)
subprocess.call(
('iptables -t nat -A PREROUTING -p tcp --dport 53 -j DNAT --to-destination %s:%s'
% (NETWORK_GW_IP, 53)),
shell=True)
subprocess.call(
('iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination %s:%s'
% (NETWORK_GW_IP, SSL_PORT)),
shell=True)
def on_exit(self):
self.clear_rules()
| 33.638298 | 94 | 0.56673 | 192 | 1,581 | 4.546875 | 0.302083 | 0.160367 | 0.252005 | 0.184422 | 0.573883 | 0.538373 | 0.469645 | 0.389462 | 0.389462 | 0.318442 | 0 | 0.011861 | 0.306768 | 1,581 | 46 | 95 | 34.369565 | 0.784672 | 0.010753 | 0 | 0.368421 | 0 | 0.105263 | 0.295585 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.131579 | false | 0.026316 | 0.052632 | 0 | 0.210526 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
42603b096736df0f0e112c409bc5076abbca3919 | 5,879 | py | Python | setup.py | victor-gil-sepulveda/pyProCT | 2777c73efb48d5ca6543c69a31719421c4d54694 | [
"MIT"
] | 10 | 2015-03-07T09:00:06.000Z | 2019-01-25T15:00:59.000Z | setup.py | victor-gil-sepulveda/pyProCT | 2777c73efb48d5ca6543c69a31719421c4d54694 | [
"MIT"
] | 6 | 2015-01-08T11:17:14.000Z | 2018-10-08T15:17:32.000Z | setup.py | victor-gil-sepulveda/pyProCT | 2777c73efb48d5ca6543c69a31719421c4d54694 | [
"MIT"
] | 11 | 2015-03-02T11:13:24.000Z | 2022-02-22T16:21:56.000Z | """
Created on 25/02/2013
@author: victor
"""
if __name__ == '__main__': # Compatibility with sphynx
from distutils.core import setup, Extension
import numpy
import distutils.sysconfig
import os
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='pyProCT',
version='1.7.3',
description='pyProCT is an open source cluster analysis software especially adapted for jobs related with structural proteomics',
author='Victor Alejandro Gil Sepulveda',
author_email='victor.gil.sepulveda@gmail.com',
url='https://github.com/victor-gil-sepulveda/pyProCT',
license = 'LICENSE.txt',
long_description = read('README.rst'),
packages=[
'pyproct',
'pyproct.clustering',
'pyproct.clustering.algorithms',
'pyproct.clustering.algorithms.dbscan',
'pyproct.clustering.algorithms.dbscan.cython',
'pyproct.clustering.algorithms.gromos',
'pyproct.clustering.algorithms.hierarchical',
'pyproct.clustering.algorithms.kmedoids',
'pyproct.clustering.algorithms.random',
'pyproct.clustering.algorithms.spectral',
'pyproct.clustering.algorithms.spectral.cython',
'pyproct.clustering.evaluation',
'pyproct.clustering.evaluation.analysis',
'pyproct.clustering.evaluation.metrics',
'pyproct.clustering.evaluation.metrics.cython',
'pyproct.clustering.evaluation.metrics.cython.graph',
'pyproct.clustering.filtering',
'pyproct.clustering.protocol',
'pyproct.clustering.protocol.exploration',
'pyproct.clustering.protocol.refinement',
'pyproct.clustering.selection',
'pyproct.data',
'pyproct.data.handler',
'pyproct.data.handler.featurearray',
'pyproct.data.handler.protein',
'pyproct.data.matrix',
'pyproct.data.matrix.featurearray',
'pyproct.data.matrix.combination',
'pyproct.data.matrix.protein',
'pyproct.data.matrix.protein.cases',
'pyproct.data.matrix.protein.cases.rmsd',
'pyproct.data.matrix.protein.cases.euclidean',
'pyproct.driver',
'pyproct.driver.observer',
'pyproct.driver.results',
'pyproct.driver.scheduling',
'pyproct.driver.time',
'pyproct.driver.workspace',
'pyproct.postprocess',
'pyproct.postprocess.actions',
'pyproct.postprocess.actions.confSpaceComparison',
'pyproct.tools'
],
include_dirs = [numpy.get_include(),
distutils.sysconfig.get_python_inc()],
ext_modules=[
# Graph metrics
Extension('pyproct.clustering.evaluation.metrics.cython.graph.nCut',[
'pyproct/clustering/evaluation/metrics/cython/graph/nCut.c'
], extra_compile_args=["-O3","-ffast-math"]),
Extension('pyproct.clustering.evaluation.metrics.cython.graph.ratioCut',[
'pyproct/clustering/evaluation/metrics/cython/graph/ratioCut.c'
], extra_compile_args=["-O3","-ffast-math"]),
Extension('pyproct.clustering.evaluation.metrics.cython.graph.minMaxCut',[
'pyproct/clustering/evaluation/metrics/cython/graph/minMaxCut.c'
], extra_compile_args=["-O3","-ffast-math"]),
Extension('pyproct.clustering.evaluation.metrics.cython.graph.tools',[
'pyproct/clustering/evaluation/metrics/cython/graph/tools.c'
], extra_compile_args=["-O3","-ffast-math"]),
# Other metrics
Extension('pyproct.clustering.evaluation.metrics.cython.cohesion', [
'pyproct/clustering/evaluation/metrics/cython/cohesion.c'
], extra_compile_args=["-O3","-ffast-math"]),
Extension('pyproct.clustering.evaluation.metrics.cython.silhouette',[
'pyproct/clustering/evaluation/metrics/cython/silhouette.c'
], extra_compile_args=["-O3","-ffast-math"]),
# Algorithm tools
Extension("pyproct.clustering.algorithms.dbscan.cython.cythonDbscanTools", [
'pyproct/clustering/algorithms/dbscan/cython/cythonDbscanTools.c'
],extra_compile_args=["-O3","-ffast-math"]),
Extension("pyproct.clustering.algorithms.spectral.cython.spectralTools", [
'pyproct/clustering/algorithms/spectral/cython/spectralTools.c'
],extra_compile_args=["-O3","-ffast-math"])
],
install_requires=[
"pyRMSD>=4.0.0",
"pyScheduler>=0.1.0",
"fastcluster>=1.1.6",
"ProDy>=1.4.2",
"numpy>=1.6.1",
"scipy>=0.9.0",
"scikit-learn>=0.12",
"Pillow>=2.6.2",
"matplotlib>=1.1.1rc",
"mpi4py>=1.3"
]
)
| 49.822034 | 139 | 0.519136 | 472 | 5,879 | 6.389831 | 0.302966 | 0.202918 | 0.152188 | 0.169098 | 0.457891 | 0.389257 | 0.268568 | 0.125 | 0.125 | 0.125 | 0 | 0.013102 | 0.363837 | 5,879 | 117 | 140 | 50.247863 | 0.793316 | 0.018541 | 0 | 0.089109 | 0 | 0 | 0.47352 | 0.363952 | 0 | 0 | 0 | 0 | 0 | 1 | 0.009901 | false | 0 | 0.039604 | 0.009901 | 0.059406 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4262d3fb2c59450ed6f1ef93ecd34415d135d0e9 | 432 | py | Python | rapidflask/app/main/views.py | TM-KUNGFOOO/rapidflask-orchestra | 0526b6b99163aa8ea5584008609c689159881c22 | [
"MIT"
] | null | null | null | rapidflask/app/main/views.py | TM-KUNGFOOO/rapidflask-orchestra | 0526b6b99163aa8ea5584008609c689159881c22 | [
"MIT"
] | null | null | null | rapidflask/app/main/views.py | TM-KUNGFOOO/rapidflask-orchestra | 0526b6b99163aa8ea5584008609c689159881c22 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Toni Michel'
from datetime import datetime
from flask import render_template, redirect, url_for, abort, flash, make_response, jsonify, session, g
from . import main
from app import db
from .forms import *
from app.decorators import *
@main.route('/', methods=["GET", "POST"])
def index():
return render_template('main_index.html', current_time=datetime.utcnow())
| 24 | 102 | 0.724537 | 60 | 432 | 5.05 | 0.7 | 0.092409 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002688 | 0.138889 | 432 | 17 | 103 | 25.411765 | 0.811828 | 0.097222 | 0 | 0 | 0 | 0 | 0.087629 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0.6 | 0.1 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
4264567f7b503a31412deffd11e5ea2a61db79df | 1,973 | py | Python | common/xrd-ui-tests-python/tests/xroad_cp_generate_configuration_dir/XroadGenerateConfigurationDir.py | ria-ee/XTM | 6103f3f5bbba387b8b59b050c0c4f1fb2180fc37 | [
"MIT"
] | 3 | 2018-03-15T14:22:50.000Z | 2021-11-08T10:30:35.000Z | common/xrd-ui-tests-python/tests/xroad_cp_generate_configuration_dir/XroadGenerateConfigurationDir.py | ria-ee/XTM | 6103f3f5bbba387b8b59b050c0c4f1fb2180fc37 | [
"MIT"
] | 11 | 2017-04-06T09:25:41.000Z | 2018-06-04T09:08:48.000Z | common/xrd-ui-tests-python/tests/xroad_cp_generate_configuration_dir/XroadGenerateConfigurationDir.py | ria-ee/XTM | 6103f3f5bbba387b8b59b050c0c4f1fb2180fc37 | [
"MIT"
] | 20 | 2017-03-14T07:21:58.000Z | 2019-05-21T09:26:30.000Z | import unittest
from helpers import ssh_client
from main.maincontroller import MainController
from tests.xroad_cp_generate_configuration_dir import generate_configuration_dir
class XroadGenerateConfigurationDir(unittest.TestCase):
"""
CP_16 Generate Configuration Directory
RIA URL: https://jira.ria.ee/browse/XTKB-212
Depends on finishing other test(s): CP_02, CP_13
Requires helper scenarios:
X-Road version: 6.16.0
"""
def test_generate_configuration_dir(self):
main = MainController(self)
cp_ssh_host = main.config.get('cp.ssh_host')
cp_ssh_user = main.config.get('cp.ssh_user')
cp_ssh_pass = main.config.get('cp.ssh_pass')
cs_ssh_host = main.config.get('cs.ssh_host')
cs_ssh_user = main.config.get('cs.ssh_user')
cs_ssh_pass = main.config.get('cs.ssh_pass')
cp_identifier = main.config.get('cp.identifier')
cs_identifier = main.config.get('cs.identifier')
cp_ssh_client = ssh_client.SSHClient(cp_ssh_host, cp_ssh_user, cp_ssh_pass)
cp_url = main.config.get('cp.conf_url')
conf_dir = main.config.get('cp.generated_conf_path')
hash_algorithm = main.config.get('cp.hash_algorithm')
instance_conf_dir = '{}/{}'.format(conf_dir, cp_identifier)
cs_ssh_client = ssh_client.SSHClient(cs_ssh_host, cs_ssh_user, cs_ssh_pass)
test_generate_conf_dir = generate_configuration_dir.test_generate_configuration_dir(main, cp_ssh_client,
cs_ssh_client,
instance_conf_dir,
conf_dir, cs_identifier,
hash_algorithm, cp_url)
test_generate_conf_dir()
| 50.589744 | 116 | 0.593512 | 233 | 1,973 | 4.669528 | 0.257511 | 0.050551 | 0.131434 | 0.096507 | 0.259191 | 0.115809 | 0 | 0 | 0 | 0 | 0 | 0.00976 | 0.324886 | 1,973 | 38 | 117 | 51.921053 | 0.807057 | 0.092245 | 0 | 0 | 1 | 0 | 0.08357 | 0.012507 | 0 | 0 | 0 | 0 | 0 | 1 | 0.037037 | false | 0.148148 | 0.148148 | 0 | 0.222222 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
42878b74138333b243bd372551d2e5bf12720d38 | 285 | py | Python | server/cgi/test_urlencode.py | zturchan/CMPUT410-Lab3 | ccccefe9992ca297d6f6a64d90b24791d115fd6c | [
"Apache-2.0"
] | null | null | null | server/cgi/test_urlencode.py | zturchan/CMPUT410-Lab3 | ccccefe9992ca297d6f6a64d90b24791d115fd6c | [
"Apache-2.0"
] | null | null | null | server/cgi/test_urlencode.py | zturchan/CMPUT410-Lab3 | ccccefe9992ca297d6f6a64d90b24791d115fd6c | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
import cgi
form = cgi.FieldStorage()
val1 = form.getvalue('first')
val2 = form.getvalue('last')
print "Content-type:text/html"
print
print "<html><head><title>Test url encoding</title></head><body>Hello, My name is %s %s." % (val1, val2)
print "</body></html>"
| 25.909091 | 104 | 0.684211 | 44 | 285 | 4.431818 | 0.659091 | 0.123077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01581 | 0.112281 | 285 | 10 | 105 | 28.5 | 0.754941 | 0.070175 | 0 | 0 | 0 | 0.125 | 0.477273 | 0.30303 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.125 | null | null | 0.5 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
4297d0f71e064aa3012a94ab2ce27f59f56517e3 | 104 | py | Python | pyesasky/imgFormat.py | pierfra-ro/pyesasky | a9342efcaa5cca088ed9a5afa2c98d3e9aa4bd0f | [
"BSD-3-Clause"
] | 13 | 2019-05-30T19:57:37.000Z | 2021-09-10T09:43:49.000Z | pyesasky/imgFormat.py | pierfra-ro/pyesasky | a9342efcaa5cca088ed9a5afa2c98d3e9aa4bd0f | [
"BSD-3-Clause"
] | 21 | 2019-06-21T18:55:25.000Z | 2022-02-27T14:48:13.000Z | pyesasky/imgFormat.py | pierfra-ro/pyesasky | a9342efcaa5cca088ed9a5afa2c98d3e9aa4bd0f | [
"BSD-3-Clause"
] | 8 | 2019-05-30T12:20:48.000Z | 2022-03-04T04:01:20.000Z |
__all__ = ['ImgFormat']
class ImgFormat():
JPEG = 'jpeg'
PNG = 'png'
| 8.666667 | 23 | 0.423077 | 8 | 104 | 5 | 0.625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.442308 | 104 | 11 | 24 | 9.454545 | 0.689655 | 0 | 0 | 0 | 0 | 0 | 0.15534 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
429ee34694d2247e15450c6b50d9d15140f35bf5 | 390 | py | Python | histoqc/tests/test_data_cli.py | kaczmarj/HistoQC | d31c11781f8ee86be64a08fd5200c6ef04b71365 | [
"BSD-3-Clause-Clear"
] | 140 | 2018-05-25T04:04:04.000Z | 2022-03-30T15:38:24.000Z | histoqc/tests/test_data_cli.py | kaczmarj/HistoQC | d31c11781f8ee86be64a08fd5200c6ef04b71365 | [
"BSD-3-Clause-Clear"
] | 300 | 2018-05-21T18:38:58.000Z | 2022-03-09T14:19:33.000Z | histoqc/tests/test_data_cli.py | kaczmarj/HistoQC | d31c11781f8ee86be64a08fd5200c6ef04b71365 | [
"BSD-3-Clause-Clear"
] | 66 | 2018-05-24T22:13:36.000Z | 2022-03-28T16:57:14.000Z | import os
from histoqc.data.__main__ import main
def test_data_cli_write_output(tmp_path):
assert main([os.fspath(tmp_path)]) == 0
assert set(x.name for x in tmp_path.iterdir()) == {'templates', 'models', 'pen'}
def test_data_cli_incorrect_output(capsys):
assert main(['does-not-exist']) == -1
captured = capsys.readouterr()
assert 'does-not-exist' in captured.err
| 26 | 84 | 0.705128 | 59 | 390 | 4.40678 | 0.576271 | 0.080769 | 0.084615 | 0.107692 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006061 | 0.153846 | 390 | 14 | 85 | 27.857143 | 0.781818 | 0 | 0 | 0 | 0 | 0 | 0.117949 | 0 | 0 | 0 | 0 | 0 | 0.444444 | 1 | 0.222222 | false | 0 | 0.222222 | 0 | 0.444444 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
42b12fb6d8e43322de8bc412d11e626d289ffba9 | 2,253 | py | Python | gp/GPhelpers.py | ericlee0803/surrogate-GCP | 0d04355bf17dc330b383353b51a62a28276de063 | [
"BSD-3-Clause"
] | null | null | null | gp/GPhelpers.py | ericlee0803/surrogate-GCP | 0d04355bf17dc330b383353b51a62a28276de063 | [
"BSD-3-Clause"
] | null | null | null | gp/GPhelpers.py | ericlee0803/surrogate-GCP | 0d04355bf17dc330b383353b51a62a28276de063 | [
"BSD-3-Clause"
] | null | null | null | import GPy
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
# ~~~~WARNING: ONLY SUPPORT FOR 1D RIGHT NOW~~~~ #
# TODO
def batch():
pass
# Calculates GP from input and output vectors X and Y respectively
def calcGP(X, Y, kernel='rbf', variance=1., lengthscale=1.):
# Reshape in 1D Case to proper column vector form
if(len(X.shape) == 1):
X = np.reshape(X, (len(X),1))
if(len(Y.shape) == 1):
Y = np.reshape(Y, (len(Y),1))
if(kernel=='rbf'):
kernel = GPy.kern.RBF(input_dim=1, variance=variance, lengthscale=lengthscale)
m = GPy.models.GPRegression(X,Y,kernel)
return m
else:
print('Kernel is not supported, please use one that is supported or use the default RBF Kernel')
return None
# Updates GP with a set of new function evaluations Y at points X
def updateGP(model, kernel, Xnew, Ynew):
# Reshape in 1D Case
if(len(Xnew.shape) == 1):
Xnew = np.reshape(X, (len(Xnew),1))
if(len(Ynew.shape) == 1):
Ynew = np.reshape(Y, (len(Ynew),1))
X = np.append(model.X, Xnew, 0)
Y = np.append(model.Y, Ynew, 0)
m = GPy.models.GPRegression(X,Y,kernel)
return m
# Using Expected Improvement, send out a number of further evaluations
# -batchsize = number of new evals
# -fidelity = number of points used to estimate EI
# -bounds = determines how new evals points are spaced
def batchNewEvals_EI(model, bounds=1, batchsize=50, fidelity=100):
P, ei = compute_ei(model, fidelity)
idx = np.argmax(ei)
xnew = P[idx]
X = np.linspace(xnew-bounds, xnew+bounds, num=batchsize)
return X
# Calculates EI given means mu and variances sigma2
def compute_ei_inner(ybest, mu, sigma2):
sigma = np.sqrt(sigma2)
u = (ybest - mu) / sigma
ucdf = norm.cdf(u)
updf = norm.pdf(u)
ei = sigma * (updf + u * ucdf)
return ei
# Takes in GP model from GPy and computes EI at points P
# We are assuming minimization, and thus ybest represents the smallest point we have so far
def compute_ei(model, numsamples):
P = np.linspace(model.X[0], model.X[-1], num=numsamples)
ybest = np.amax(model.Y)
P = np.reshape(P, [len(P), 1])
mu, sigma2 = model.predict(P)
return P, compute_ei_inner(ybest, mu, sigma2)
def plotGP(model):
fig = model.plot()
regfig = GPy.plotting.show(fig)
regfig.savefig('GPmodel.png')
| 30.04 | 98 | 0.697736 | 380 | 2,253 | 4.115789 | 0.392105 | 0.028772 | 0.015345 | 0.019182 | 0.081841 | 0.081841 | 0.047315 | 0.047315 | 0.047315 | 0 | 0 | 0.016043 | 0.169996 | 2,253 | 74 | 99 | 30.445946 | 0.820321 | 0.287617 | 0 | 0.08 | 0 | 0 | 0.065409 | 0 | 0 | 0 | 0 | 0.013514 | 0 | 0 | null | null | 0.02 | 0.08 | null | null | 0.02 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
35ef2ad2a8de8b0dd4299e31d54b17507de980bb | 305 | py | Python | FishCDailyQuestion/ex021-030/Python3_027/027_04.py | YorkFish/git_study | 6e023244daaa22e12b24e632e76a13e5066f2947 | [
"MIT"
] | null | null | null | FishCDailyQuestion/ex021-030/Python3_027/027_04.py | YorkFish/git_study | 6e023244daaa22e12b24e632e76a13e5066f2947 | [
"MIT"
] | null | null | null | FishCDailyQuestion/ex021-030/Python3_027/027_04.py | YorkFish/git_study | 6e023244daaa22e12b24e632e76a13e5066f2947 | [
"MIT"
] | null | null | null | from itertools import permutations as pt
for each in pt(range(1, 10), 9):
a, b, c, d, e, f, g, h, i = each
if a + b + c == d + e + f == g + h + i == a + d + g == b + e + h == c + f + i == a + e + i == c + e + g:
print('-' * 7, '\n', a, b, c, '\n', d, e, f, '\n', g, h, i)
print('-' * 7)
| 33.888889 | 108 | 0.386885 | 65 | 305 | 1.815385 | 0.4 | 0.050847 | 0.076271 | 0.067797 | 0.152542 | 0.152542 | 0.152542 | 0.152542 | 0.152542 | 0 | 0 | 0.030303 | 0.35082 | 305 | 8 | 109 | 38.125 | 0.565657 | 0 | 0 | 0 | 0 | 0 | 0.026316 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.166667 | 0.333333 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
35ef55004ef198c1f9821f06fa6b98a293e078a6 | 2,070 | py | Python | Basic/Python/QiPy/Python3/SdsViewProperty.py | sukhdev1103/Qi-Samples | 75e7b5095e31c874f905c2bf9a8e6a9ce8cdc4be | [
"Apache-2.0"
] | null | null | null | Basic/Python/QiPy/Python3/SdsViewProperty.py | sukhdev1103/Qi-Samples | 75e7b5095e31c874f905c2bf9a8e6a9ce8cdc4be | [
"Apache-2.0"
] | null | null | null | Basic/Python/QiPy/Python3/SdsViewProperty.py | sukhdev1103/Qi-Samples | 75e7b5095e31c874f905c2bf9a8e6a9ce8cdc4be | [
"Apache-2.0"
] | null | null | null | # SdsViewProperty.py
#
# Copyright (C) 2018 OSIsoft, LLC. All rights reserved.
#
# THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE SECRETS OF
# OSIsoft, LLC. USE, DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT
# THE PRIOR EXPRESS WRITTEN PERMISSION OF OSIsoft, LLC.
#
# RESTRICTED RIGHTS LEGEND
# Use, duplication, or disclosure by the Government is subject to restrictions
# as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and
# Computer Software clause at DFARS 252.227.7013
#
# OSIsoft, LLC
# 1600 Alvarado St, San Leandro, CA 94577
import json
import SdsView
class SdsViewProperty(object):
"""Sds View Property definition"""
@property
def SourceId(self):
return self.__sourceId
@SourceId.setter
def SourceId(self, id):
self.__sourceId = id
@property
def TargetId(self):
return self.__targetId
@TargetId.setter
def TargetId(self, name):
self.__targetId = name
@property
def SdsView(self):
return self.__sdsView
@SdsView.setter
def SdsView(self, description):
self.__sdsView = description
def toJson(self):
return json.dumps(self.toDictionary())
def toDictionary(self):
# required properties
dictionary = { 'SourceId' : self.SourceId, 'TargetId' : self.TargetId }
if hasattr(self, 'SdsView'):
dictionary['SdsView'] = self.SdsView.toDictionary()
return dictionary
@staticmethod
def fromJson(jsonObj):
return SdsViewProperty.fromDictionary(jsonObj)
@staticmethod
def fromDictionary(content):
viewProperty = SdsViewProperty()
if len(content) == 0:
return viewProperty
if 'SourceId' in content:
viewProperty.SourceId = content['SourceId']
if 'TargetId' in content:
viewProperty.TargetId = content['TargetId']
if 'SdsView' in content:
viewProperty.SdsView = SdsView.fromDictionary(content['SdsView'])
return viewProperty
| 26.883117 | 79 | 0.663285 | 220 | 2,070 | 6.186364 | 0.436364 | 0.02939 | 0.03086 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016129 | 0.251208 | 2,070 | 76 | 80 | 27.236842 | 0.861935 | 0.286473 | 0 | 0.162791 | 0 | 0 | 0.052234 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.232558 | false | 0 | 0.046512 | 0.116279 | 0.488372 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
c4043ff68e7da146d4c542f9304e4ecd72a00f91 | 228 | py | Python | esolang_golfer_prototype/config_example.py | hiromi-mi/esolang_golfer_prototype | 58e109d79d9f877c053c8dff8dd2af1910ab77f3 | [
"Unlicense"
] | null | null | null | esolang_golfer_prototype/config_example.py | hiromi-mi/esolang_golfer_prototype | 58e109d79d9f877c053c8dff8dd2af1910ab77f3 | [
"Unlicense"
] | null | null | null | esolang_golfer_prototype/config_example.py | hiromi-mi/esolang_golfer_prototype | 58e109d79d9f877c053c8dff8dd2af1910ab77f3 | [
"Unlicense"
] | null | null | null | PROBLEM = "テスト問題"
TESTCASES = [("input_example", "output_example")]
FIELDS = {"rust": {"fieldname": "rust", "fieldlangs": ["rust"]}, "Brainfuck/C++": {"fieldname": "Brainfuck/C++", "fieldlangs": ["brainfuck-bfi", "cpp-clang"]}}
| 57 | 159 | 0.631579 | 23 | 228 | 6.173913 | 0.652174 | 0.140845 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.087719 | 228 | 3 | 160 | 76 | 0.682692 | 0 | 0 | 0 | 0 | 0 | 0.570175 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c4046096b5bdb2c585ec2df8b3e25a04271057da | 16,040 | py | Python | stubs.min/Autodesk/Revit/DB/__init___parts/DisplayUnitType.py | ricardyn/ironpython-stubs | 4d2b405eda3ceed186e8adca55dd97c332c6f49d | [
"MIT"
] | 1 | 2021-02-02T13:39:16.000Z | 2021-02-02T13:39:16.000Z | stubs.min/Autodesk/Revit/DB/__init___parts/DisplayUnitType.py | hdm-dt-fb/ironpython-stubs | 4d2b405eda3ceed186e8adca55dd97c332c6f49d | [
"MIT"
] | null | null | null | stubs.min/Autodesk/Revit/DB/__init___parts/DisplayUnitType.py | hdm-dt-fb/ironpython-stubs | 4d2b405eda3ceed186e8adca55dd97c332c6f49d | [
"MIT"
] | null | null | null | class DisplayUnitType(Enum,IComparable,IFormattable,IConvertible):
"""
The units and display format used to format numbers as strings. Also used for unit conversions.
enum DisplayUnitType,values: DUT_1_RATIO (182),DUT_ACRES (7),DUT_AMPERES (69),DUT_ATMOSPHERES (54),DUT_BARS (55),DUT_BRITISH_THERMAL_UNIT_PER_FAHRENHEIT (186),DUT_BRITISH_THERMAL_UNITS (31),DUT_BRITISH_THERMAL_UNITS_PER_HOUR (42),DUT_BRITISH_THERMAL_UNITS_PER_HOUR_CUBIC_FOOT (167),DUT_BRITISH_THERMAL_UNITS_PER_HOUR_FOOT_FAHRENHEIT (231),DUT_BRITISH_THERMAL_UNITS_PER_HOUR_SQUARE_FOOT (166),DUT_BRITISH_THERMAL_UNITS_PER_HOUR_SQUARE_FOOT_FAHRENHEIT (155),DUT_BRITISH_THERMAL_UNITS_PER_POUND (233),DUT_BRITISH_THERMAL_UNITS_PER_POUND_FAHRENHEIT (232),DUT_BRITISH_THERMAL_UNITS_PER_SECOND (41),DUT_CALORIES (32),DUT_CALORIES_PER_SECOND (43),DUT_CANDELAS (81),DUT_CANDELAS_PER_SQUARE_METER (80),DUT_CANDLEPOWER (82),DUT_CELSIUS (57),DUT_CELSIUS_DIFFERENCE (244),DUT_CENTIMETERS (1),DUT_CENTIMETERS_PER_MINUTE (62),DUT_CENTIMETERS_TO_THE_FOURTH_POWER (200),DUT_CENTIMETERS_TO_THE_SIXTH_POWER (205),DUT_CENTIPOISES (131),DUT_CUBIC_CENTIMETERS (24),DUT_CUBIC_FEET (13),DUT_CUBIC_FEET_PER_KIP (124),DUT_CUBIC_FEET_PER_MINUTE (63),DUT_CUBIC_FEET_PER_MINUTE_CUBIC_FOOT (169),DUT_CUBIC_FEET_PER_MINUTE_SQUARE_FOOT (156),DUT_CUBIC_FEET_PER_MINUTE_TON_OF_REFRIGERATION (171),DUT_CUBIC_INCHES (23),DUT_CUBIC_METERS (14),DUT_CUBIC_METERS_PER_HOUR (66),DUT_CUBIC_METERS_PER_KILONEWTON (123),DUT_CUBIC_METERS_PER_SECOND (65),DUT_CUBIC_MILLIMETERS (25),DUT_CUBIC_YARDS (10),DUT_CURRENCY (175),DUT_CUSTOM (-1),DUT_CYCLES_PER_SECOND (76),DUT_DECANEWTON_METERS (112),DUT_DECANEWTON_METERS_PER_METER (140),DUT_DECANEWTONS (88),DUT_DECANEWTONS_PER_METER (96),DUT_DECANEWTONS_PER_SQUARE_METER (104),DUT_DECIMAL_DEGREES (15),DUT_DECIMAL_FEET (3),DUT_DECIMAL_INCHES (6),DUT_DECIMETERS (236),DUT_DEGREES_AND_MINUTES (16),DUT_FAHRENHEIT (56),DUT_FAHRENHEIT_DIFFERENCE (243),DUT_FEET_FRACTIONAL_INCHES (4),DUT_FEET_OF_WATER (128),DUT_FEET_OF_WATER_PER_100FT (127),DUT_FEET_PER_KIP (120),DUT_FEET_PER_MINUTE (60),DUT_FEET_PER_SECOND (132),DUT_FEET_PER_SECOND_SQUARED (195),DUT_FEET_TO_THE_FOURTH_POWER (197),DUT_FEET_TO_THE_SIXTH_POWER (202),DUT_FIXED (18),DUT_FOOTCANDLES (78),DUT_FOOTLAMBERTS (79),DUT_FRACTIONAL_INCHES (5),DUT_GALLONS_US (27),DUT_GALLONS_US_PER_HOUR (68),DUT_GALLONS_US_PER_MINUTE (67),DUT_GENERAL (17),DUT_GRADS (215),DUT_GRAINS_PER_HOUR_SQUARE_FOOT_INCH_MERCURY (234),DUT_HECTARES (8),DUT_HERTZ (75),DUT_HORSEPOWER (86),DUT_HOUR_SQUARE_FOOT_FAHRENHEIT_PER_BRITISH_THERMAL_UNIT (184),DUT_HOURS (220),DUT_INCHES_OF_MERCURY (52),DUT_INCHES_OF_WATER (47),DUT_INCHES_OF_WATER_PER_100FT (37),DUT_INCHES_PER_SECOND_SQUARED (194),DUT_INCHES_TO_THE_FOURTH_POWER (198),DUT_INCHES_TO_THE_SIXTH_POWER (203),DUT_INV_CELSIUS (138),DUT_INV_FAHRENHEIT (137),DUT_INV_KILONEWTONS (125),DUT_INV_KIPS (126),DUT_JOULES (34),DUT_JOULES_PER_GRAM (228),DUT_JOULES_PER_GRAM_CELSIUS (227),DUT_JOULES_PER_KELVIN (187),DUT_JOULES_PER_KILOGRAM_CELSIUS (237),DUT_KELVIN (58),DUT_KELVIN_DIFFERENCE (245),DUT_KILOAMPERES (70),DUT_KILOCALORIES (33),DUT_KILOCALORIES_PER_SECOND (44),DUT_KILOGRAM_FORCE_METERS (116),DUT_KILOGRAM_FORCE_METERS_PER_METER (144),DUT_KILOGRAMS_FORCE (92),DUT_KILOGRAMS_FORCE_PER_METER (100),DUT_KILOGRAMS_FORCE_PER_SQUARE_METER (108),DUT_KILOGRAMS_MASS (189),DUT_KILOGRAMS_MASS_PER_METER (212),DUT_KILOGRAMS_MASS_PER_SQUARE_METER (224),DUT_KILOGRAMS_PER_CUBIC_METER (28),DUT_KILOJOULES (223),DUT_KILOJOULES_PER_KELVIN (188),DUT_KILOMETERS_PER_HOUR (221),DUT_KILOMETERS_PER_SECOND_SQUARED (193),DUT_KILONEWTON_METERS (113),DUT_KILONEWTON_METERS_PER_DEGREE (151),DUT_KILONEWTON_METERS_PER_DEGREE_PER_METER (153),DUT_KILONEWTON_METERS_PER_METER (141),DUT_KILONEWTONS (89),DUT_KILONEWTONS_PER_CUBIC_METER (134),DUT_KILONEWTONS_PER_METER (97),DUT_KILONEWTONS_PER_SQUARE_CENTIMETER (178),DUT_KILONEWTONS_PER_SQUARE_METER (105),DUT_KILONEWTONS_PER_SQUARE_MILLIMETER (180),DUT_KILOPASCALS (49),DUT_KILOVOLT_AMPERES (85),DUT_KILOVOLTS (73),DUT_KILOWATT_HOURS (35),DUT_KILOWATTS (40),DUT_KIP_FEET (115),DUT_KIP_FEET_PER_DEGREE (150),DUT_KIP_FEET_PER_DEGREE_PER_FOOT (152),DUT_KIP_FEET_PER_FOOT (143),DUT_KIPS (91),DUT_KIPS_PER_CUBIC_FOOT (149),DUT_KIPS_PER_CUBIC_INCH (136),DUT_KIPS_PER_FOOT (99),DUT_KIPS_PER_INCH (148),DUT_KIPS_PER_SQUARE_FOOT (107),DUT_KIPS_PER_SQUARE_INCH (133),DUT_LITERS (26),DUT_LITERS_PER_MINUTE (242),DUT_LITERS_PER_SECOND (64),DUT_LITERS_PER_SECOND_CUBIC_METER (170),DUT_LITERS_PER_SECOND_KILOWATTS (172),DUT_LITERS_PER_SECOND_SQUARE_METER (157),DUT_LUMENS (83),DUT_LUMENS_PER_WATT (176),DUT_LUX (77),DUT_MEGANEWTON_METERS (114),DUT_MEGANEWTON_METERS_PER_METER (142),DUT_MEGANEWTONS (90),DUT_MEGANEWTONS_PER_METER (98),DUT_MEGANEWTONS_PER_SQUARE_METER (106),DUT_MEGAPASCALS (50),DUT_METERS (0),DUT_METERS_CENTIMETERS (9),DUT_METERS_PER_KILONEWTON (119),DUT_METERS_PER_SECOND (61),DUT_METERS_PER_SECOND_SQUARED (192),DUT_METERS_TO_THE_FOURTH_POWER (201),DUT_METERS_TO_THE_SIXTH_POWER (206),DUT_MICROINCHES_PER_INCH_FAHRENHEIT (239),DUT_MICROMETERS_PER_METER_CELSIUS (238),DUT_MILES_PER_HOUR (222),DUT_MILES_PER_SECOND_SQUARED (196),DUT_MILISECONDS (217),DUT_MILLIAMPERES (71),DUT_MILLIMETERS (2),DUT_MILLIMETERS_OF_MERCURY (53),DUT_MILLIMETERS_TO_THE_FOURTH_POWER (199),DUT_MILLIMETERS_TO_THE_SIXTH_POWER (204),DUT_MILLIVOLTS (74),DUT_MINUTES (219),DUT_NANOGRAMS_PER_PASCAL_SECOND_SQUARE_METER (229),DUT_NEWTON_METERS (111),DUT_NEWTON_METERS_PER_METER (139),DUT_NEWTONS (87),DUT_NEWTONS_PER_METER (95),DUT_NEWTONS_PER_SQUARE_METER (103),DUT_NEWTONS_PER_SQUARE_MILLIMETER (179),DUT_OHM_METERS (230),DUT_PASCAL_SECONDS (129),DUT_PASCALS (48),DUT_PASCALS_PER_METER (38),DUT_PER_MILLE (235),DUT_PERCENTAGE (19),DUT_POUND_FORCE_FEET (118),DUT_POUND_FORCE_FEET_PER_FOOT (146),DUT_POUNDS_FORCE (94),DUT_POUNDS_FORCE_PER_CUBIC_FOOT (135),DUT_POUNDS_FORCE_PER_FOOT (102),DUT_POUNDS_FORCE_PER_SQUARE_FOOT (110),DUT_POUNDS_FORCE_PER_SQUARE_INCH (51),DUT_POUNDS_MASS (191),DUT_POUNDS_MASS_PER_CUBIC_FOOT (29),DUT_POUNDS_MASS_PER_CUBIC_INCH (30),DUT_POUNDS_MASS_PER_FOOT (213),DUT_POUNDS_MASS_PER_FOOT_HOUR (147),DUT_POUNDS_MASS_PER_FOOT_SECOND (130),DUT_POUNDS_MASS_PER_SQUARE_FOOT (225),DUT_RADIANS (214),DUT_RADIANS_PER_SECOND (216),DUT_RANKINE (59),DUT_RANKINE_DIFFERENCE (246),DUT_RATIO_10 (158),DUT_RATIO_12 (159),DUT_RISE_OVER_10_FEET (183),DUT_RISE_OVER_120_INCHES (181),DUT_RISE_OVER_FOOT (162),DUT_RISE_OVER_INCHES (161),DUT_RISE_OVER_MMS (163),DUT_SECONDS (218),DUT_SLOPE_DEGREES (160),DUT_SQUARE_CENTIMETERS (21),DUT_SQUARE_CENTIMETERS_PER_METER (210),DUT_SQUARE_FEET (11),DUT_SQUARE_FEET_PER_FOOT (207),DUT_SQUARE_FEET_PER_KIP (122),DUT_SQUARE_FEET_PER_THOUSAND_BRITISH_THERMAL_UNITS_PER_HOUR (177),DUT_SQUARE_FEET_PER_TON_OF_REFRIGERATION (173),DUT_SQUARE_INCHES (20),DUT_SQUARE_INCHES_PER_FOOT (208),DUT_SQUARE_METER_KELVIN_PER_WATT (185),DUT_SQUARE_METERS (12),DUT_SQUARE_METERS_PER_KILONEWTON (121),DUT_SQUARE_METERS_PER_KILOWATTS (174),DUT_SQUARE_METERS_PER_METER (211),DUT_SQUARE_MILLIMETERS (22),DUT_SQUARE_MILLIMETERS_PER_METER (209),DUT_THERMS (36),DUT_TON_OF_REFRIGERATION (168),DUT_TONNE_FORCE_METERS (117),DUT_TONNE_FORCE_METERS_PER_METER (145),DUT_TONNES_FORCE (93),DUT_TONNES_FORCE_PER_METER (101),DUT_TONNES_FORCE_PER_SQUARE_METER (109),DUT_TONNES_MASS (190),DUT_UNDEFINED (-2),DUT_USTONNES_FORCE (241),DUT_USTONNES_MASS (240),DUT_VOLT_AMPERES (84),DUT_VOLTS (72),DUT_WATTS (39),DUT_WATTS_PER_CUBIC_FOOT (164),DUT_WATTS_PER_CUBIC_METER (165),DUT_WATTS_PER_METER_KELVIN (226),DUT_WATTS_PER_SQUARE_FOOT (45),DUT_WATTS_PER_SQUARE_METER (46),DUT_WATTS_PER_SQUARE_METER_KELVIN (154)
"""
def __eq__(self,*args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """
pass
def __format__(self,*args):
""" __format__(formattable: IFormattable,format: str) -> str """
pass
def __ge__(self,*args):
pass
def __gt__(self,*args):
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __le__(self,*args):
pass
def __lt__(self,*args):
pass
def __ne__(self,*args):
pass
def __reduce_ex__(self,*args):
pass
def __str__(self,*args):
pass
DUT_1_RATIO=None
DUT_ACRES=None
DUT_AMPERES=None
DUT_ATMOSPHERES=None
DUT_BARS=None
DUT_BRITISH_THERMAL_UNITS=None
DUT_BRITISH_THERMAL_UNITS_PER_HOUR=None
DUT_BRITISH_THERMAL_UNITS_PER_HOUR_CUBIC_FOOT=None
DUT_BRITISH_THERMAL_UNITS_PER_HOUR_FOOT_FAHRENHEIT=None
DUT_BRITISH_THERMAL_UNITS_PER_HOUR_SQUARE_FOOT=None
DUT_BRITISH_THERMAL_UNITS_PER_HOUR_SQUARE_FOOT_FAHRENHEIT=None
DUT_BRITISH_THERMAL_UNITS_PER_POUND=None
DUT_BRITISH_THERMAL_UNITS_PER_POUND_FAHRENHEIT=None
DUT_BRITISH_THERMAL_UNITS_PER_SECOND=None
DUT_BRITISH_THERMAL_UNIT_PER_FAHRENHEIT=None
DUT_CALORIES=None
DUT_CALORIES_PER_SECOND=None
DUT_CANDELAS=None
DUT_CANDELAS_PER_SQUARE_METER=None
DUT_CANDLEPOWER=None
DUT_CELSIUS=None
DUT_CELSIUS_DIFFERENCE=None
DUT_CENTIMETERS=None
DUT_CENTIMETERS_PER_MINUTE=None
DUT_CENTIMETERS_TO_THE_FOURTH_POWER=None
DUT_CENTIMETERS_TO_THE_SIXTH_POWER=None
DUT_CENTIPOISES=None
DUT_CUBIC_CENTIMETERS=None
DUT_CUBIC_FEET=None
DUT_CUBIC_FEET_PER_KIP=None
DUT_CUBIC_FEET_PER_MINUTE=None
DUT_CUBIC_FEET_PER_MINUTE_CUBIC_FOOT=None
DUT_CUBIC_FEET_PER_MINUTE_SQUARE_FOOT=None
DUT_CUBIC_FEET_PER_MINUTE_TON_OF_REFRIGERATION=None
DUT_CUBIC_INCHES=None
DUT_CUBIC_METERS=None
DUT_CUBIC_METERS_PER_HOUR=None
DUT_CUBIC_METERS_PER_KILONEWTON=None
DUT_CUBIC_METERS_PER_SECOND=None
DUT_CUBIC_MILLIMETERS=None
DUT_CUBIC_YARDS=None
DUT_CURRENCY=None
DUT_CUSTOM=None
DUT_CYCLES_PER_SECOND=None
DUT_DECANEWTONS=None
DUT_DECANEWTONS_PER_METER=None
DUT_DECANEWTONS_PER_SQUARE_METER=None
DUT_DECANEWTON_METERS=None
DUT_DECANEWTON_METERS_PER_METER=None
DUT_DECIMAL_DEGREES=None
DUT_DECIMAL_FEET=None
DUT_DECIMAL_INCHES=None
DUT_DECIMETERS=None
DUT_DEGREES_AND_MINUTES=None
DUT_FAHRENHEIT=None
DUT_FAHRENHEIT_DIFFERENCE=None
DUT_FEET_FRACTIONAL_INCHES=None
DUT_FEET_OF_WATER=None
DUT_FEET_OF_WATER_PER_100FT=None
DUT_FEET_PER_KIP=None
DUT_FEET_PER_MINUTE=None
DUT_FEET_PER_SECOND=None
DUT_FEET_PER_SECOND_SQUARED=None
DUT_FEET_TO_THE_FOURTH_POWER=None
DUT_FEET_TO_THE_SIXTH_POWER=None
DUT_FIXED=None
DUT_FOOTCANDLES=None
DUT_FOOTLAMBERTS=None
DUT_FRACTIONAL_INCHES=None
DUT_GALLONS_US=None
DUT_GALLONS_US_PER_HOUR=None
DUT_GALLONS_US_PER_MINUTE=None
DUT_GENERAL=None
DUT_GRADS=None
DUT_GRAINS_PER_HOUR_SQUARE_FOOT_INCH_MERCURY=None
DUT_HECTARES=None
DUT_HERTZ=None
DUT_HORSEPOWER=None
DUT_HOURS=None
DUT_HOUR_SQUARE_FOOT_FAHRENHEIT_PER_BRITISH_THERMAL_UNIT=None
DUT_INCHES_OF_MERCURY=None
DUT_INCHES_OF_WATER=None
DUT_INCHES_OF_WATER_PER_100FT=None
DUT_INCHES_PER_SECOND_SQUARED=None
DUT_INCHES_TO_THE_FOURTH_POWER=None
DUT_INCHES_TO_THE_SIXTH_POWER=None
DUT_INV_CELSIUS=None
DUT_INV_FAHRENHEIT=None
DUT_INV_KILONEWTONS=None
DUT_INV_KIPS=None
DUT_JOULES=None
DUT_JOULES_PER_GRAM=None
DUT_JOULES_PER_GRAM_CELSIUS=None
DUT_JOULES_PER_KELVIN=None
DUT_JOULES_PER_KILOGRAM_CELSIUS=None
DUT_KELVIN=None
DUT_KELVIN_DIFFERENCE=None
DUT_KILOAMPERES=None
DUT_KILOCALORIES=None
DUT_KILOCALORIES_PER_SECOND=None
DUT_KILOGRAMS_FORCE=None
DUT_KILOGRAMS_FORCE_PER_METER=None
DUT_KILOGRAMS_FORCE_PER_SQUARE_METER=None
DUT_KILOGRAMS_MASS=None
DUT_KILOGRAMS_MASS_PER_METER=None
DUT_KILOGRAMS_MASS_PER_SQUARE_METER=None
DUT_KILOGRAMS_PER_CUBIC_METER=None
DUT_KILOGRAM_FORCE_METERS=None
DUT_KILOGRAM_FORCE_METERS_PER_METER=None
DUT_KILOJOULES=None
DUT_KILOJOULES_PER_KELVIN=None
DUT_KILOMETERS_PER_HOUR=None
DUT_KILOMETERS_PER_SECOND_SQUARED=None
DUT_KILONEWTONS=None
DUT_KILONEWTONS_PER_CUBIC_METER=None
DUT_KILONEWTONS_PER_METER=None
DUT_KILONEWTONS_PER_SQUARE_CENTIMETER=None
DUT_KILONEWTONS_PER_SQUARE_METER=None
DUT_KILONEWTONS_PER_SQUARE_MILLIMETER=None
DUT_KILONEWTON_METERS=None
DUT_KILONEWTON_METERS_PER_DEGREE=None
DUT_KILONEWTON_METERS_PER_DEGREE_PER_METER=None
DUT_KILONEWTON_METERS_PER_METER=None
DUT_KILOPASCALS=None
DUT_KILOVOLTS=None
DUT_KILOVOLT_AMPERES=None
DUT_KILOWATTS=None
DUT_KILOWATT_HOURS=None
DUT_KIPS=None
DUT_KIPS_PER_CUBIC_FOOT=None
DUT_KIPS_PER_CUBIC_INCH=None
DUT_KIPS_PER_FOOT=None
DUT_KIPS_PER_INCH=None
DUT_KIPS_PER_SQUARE_FOOT=None
DUT_KIPS_PER_SQUARE_INCH=None
DUT_KIP_FEET=None
DUT_KIP_FEET_PER_DEGREE=None
DUT_KIP_FEET_PER_DEGREE_PER_FOOT=None
DUT_KIP_FEET_PER_FOOT=None
DUT_LITERS=None
DUT_LITERS_PER_MINUTE=None
DUT_LITERS_PER_SECOND=None
DUT_LITERS_PER_SECOND_CUBIC_METER=None
DUT_LITERS_PER_SECOND_KILOWATTS=None
DUT_LITERS_PER_SECOND_SQUARE_METER=None
DUT_LUMENS=None
DUT_LUMENS_PER_WATT=None
DUT_LUX=None
DUT_MEGANEWTONS=None
DUT_MEGANEWTONS_PER_METER=None
DUT_MEGANEWTONS_PER_SQUARE_METER=None
DUT_MEGANEWTON_METERS=None
DUT_MEGANEWTON_METERS_PER_METER=None
DUT_MEGAPASCALS=None
DUT_METERS=None
DUT_METERS_CENTIMETERS=None
DUT_METERS_PER_KILONEWTON=None
DUT_METERS_PER_SECOND=None
DUT_METERS_PER_SECOND_SQUARED=None
DUT_METERS_TO_THE_FOURTH_POWER=None
DUT_METERS_TO_THE_SIXTH_POWER=None
DUT_MICROINCHES_PER_INCH_FAHRENHEIT=None
DUT_MICROMETERS_PER_METER_CELSIUS=None
DUT_MILES_PER_HOUR=None
DUT_MILES_PER_SECOND_SQUARED=None
DUT_MILISECONDS=None
DUT_MILLIAMPERES=None
DUT_MILLIMETERS=None
DUT_MILLIMETERS_OF_MERCURY=None
DUT_MILLIMETERS_TO_THE_FOURTH_POWER=None
DUT_MILLIMETERS_TO_THE_SIXTH_POWER=None
DUT_MILLIVOLTS=None
DUT_MINUTES=None
DUT_NANOGRAMS_PER_PASCAL_SECOND_SQUARE_METER=None
DUT_NEWTONS=None
DUT_NEWTONS_PER_METER=None
DUT_NEWTONS_PER_SQUARE_METER=None
DUT_NEWTONS_PER_SQUARE_MILLIMETER=None
DUT_NEWTON_METERS=None
DUT_NEWTON_METERS_PER_METER=None
DUT_OHM_METERS=None
DUT_PASCALS=None
DUT_PASCALS_PER_METER=None
DUT_PASCAL_SECONDS=None
DUT_PERCENTAGE=None
DUT_PER_MILLE=None
DUT_POUNDS_FORCE=None
DUT_POUNDS_FORCE_PER_CUBIC_FOOT=None
DUT_POUNDS_FORCE_PER_FOOT=None
DUT_POUNDS_FORCE_PER_SQUARE_FOOT=None
DUT_POUNDS_FORCE_PER_SQUARE_INCH=None
DUT_POUNDS_MASS=None
DUT_POUNDS_MASS_PER_CUBIC_FOOT=None
DUT_POUNDS_MASS_PER_CUBIC_INCH=None
DUT_POUNDS_MASS_PER_FOOT=None
DUT_POUNDS_MASS_PER_FOOT_HOUR=None
DUT_POUNDS_MASS_PER_FOOT_SECOND=None
DUT_POUNDS_MASS_PER_SQUARE_FOOT=None
DUT_POUND_FORCE_FEET=None
DUT_POUND_FORCE_FEET_PER_FOOT=None
DUT_RADIANS=None
DUT_RADIANS_PER_SECOND=None
DUT_RANKINE=None
DUT_RANKINE_DIFFERENCE=None
DUT_RATIO_10=None
DUT_RATIO_12=None
DUT_RISE_OVER_10_FEET=None
DUT_RISE_OVER_120_INCHES=None
DUT_RISE_OVER_FOOT=None
DUT_RISE_OVER_INCHES=None
DUT_RISE_OVER_MMS=None
DUT_SECONDS=None
DUT_SLOPE_DEGREES=None
DUT_SQUARE_CENTIMETERS=None
DUT_SQUARE_CENTIMETERS_PER_METER=None
DUT_SQUARE_FEET=None
DUT_SQUARE_FEET_PER_FOOT=None
DUT_SQUARE_FEET_PER_KIP=None
DUT_SQUARE_FEET_PER_THOUSAND_BRITISH_THERMAL_UNITS_PER_HOUR=None
DUT_SQUARE_FEET_PER_TON_OF_REFRIGERATION=None
DUT_SQUARE_INCHES=None
DUT_SQUARE_INCHES_PER_FOOT=None
DUT_SQUARE_METERS=None
DUT_SQUARE_METERS_PER_KILONEWTON=None
DUT_SQUARE_METERS_PER_KILOWATTS=None
DUT_SQUARE_METERS_PER_METER=None
DUT_SQUARE_METER_KELVIN_PER_WATT=None
DUT_SQUARE_MILLIMETERS=None
DUT_SQUARE_MILLIMETERS_PER_METER=None
DUT_THERMS=None
DUT_TONNES_FORCE=None
DUT_TONNES_FORCE_PER_METER=None
DUT_TONNES_FORCE_PER_SQUARE_METER=None
DUT_TONNES_MASS=None
DUT_TONNE_FORCE_METERS=None
DUT_TONNE_FORCE_METERS_PER_METER=None
DUT_TON_OF_REFRIGERATION=None
DUT_UNDEFINED=None
DUT_USTONNES_FORCE=None
DUT_USTONNES_MASS=None
DUT_VOLTS=None
DUT_VOLT_AMPERES=None
DUT_WATTS=None
DUT_WATTS_PER_CUBIC_FOOT=None
DUT_WATTS_PER_CUBIC_METER=None
DUT_WATTS_PER_METER_KELVIN=None
DUT_WATTS_PER_SQUARE_FOOT=None
DUT_WATTS_PER_SQUARE_METER=None
DUT_WATTS_PER_SQUARE_METER_KELVIN=None
value__=None
| 57.081851 | 7,397 | 0.85611 | 2,665 | 16,040 | 4.537711 | 0.156848 | 0.143554 | 0.032746 | 0.032746 | 0.570826 | 0.298024 | 0.121971 | 0.069462 | 0.037542 | 0.017614 | 0 | 0.044706 | 0.072631 | 16,040 | 280 | 7,398 | 57.285714 | 0.768269 | 0.487718 | 0 | 0.0369 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.0369 | false | 0.0369 | 0 | 0 | 0.9631 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
c41dddcfcf85b0ecdfcbcff2719fc29558e4a966 | 1,192 | py | Python | todoapp/controller.py | vivekkr12/todo-app-flask-sqlalchemy | 48407219fe1d759e5d36b096cdf6bcb85441e56c | [
"Unlicense"
] | null | null | null | todoapp/controller.py | vivekkr12/todo-app-flask-sqlalchemy | 48407219fe1d759e5d36b096cdf6bcb85441e56c | [
"Unlicense"
] | null | null | null | todoapp/controller.py | vivekkr12/todo-app-flask-sqlalchemy | 48407219fe1d759e5d36b096cdf6bcb85441e56c | [
"Unlicense"
] | null | null | null | from flask import request
from todoapp import app, db
from todoapp.db_model import User, UserSchema
@app.route('/user', methods=['POST'])
def add_user():
user = User(**request.json)
db.session.add(user)
db.session.commit()
return UserSchema().jsonify(user)
@app.route('/user/<int:user_id>', methods=['GET'])
def get_user(user_id):
user = User.query.get(user_id)
return UserSchema().jsonify(user)
@app.route('/user', methods=['GET'])
def get_all_users():
all_users = User.query.all()
return UserSchema(many=True).jsonify(all_users)
@app.route('/user/<int:user_id>/list', methods=['POST'])
def create_list(user_id):
pass
@app.route('/user/<int:user_id>/list', methods=['GET'])
def get_user_all_lists(user_id):
pass
@app.route('/user/<int:user_id>/list/<int:list_id>', methods=['GET'])
def get_user_list(user_id, list_id):
pass
@app.route('/list/<int:list_id>/task', methods=['POST'])
def create_task(list_id):
pass
@app.route('/list/<int:list_id>/task', methods=['GET'])
def get_all_tasks_in_list(list_id):
pass
@app.route('/list/<int:list_id>/task/<int:task_id>', methods=['GET'])
def get_task(list_id, task_id):
pass
| 21.672727 | 69 | 0.680369 | 189 | 1,192 | 4.089947 | 0.185185 | 0.093144 | 0.093144 | 0.124191 | 0.542044 | 0.461837 | 0.39586 | 0.294955 | 0.244502 | 0.244502 | 0 | 0 | 0.125839 | 1,192 | 54 | 70 | 22.074074 | 0.741843 | 0 | 0 | 0.228571 | 0 | 0 | 0.193792 | 0.144295 | 0 | 0 | 0 | 0 | 0 | 1 | 0.257143 | false | 0.171429 | 0.085714 | 0 | 0.428571 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
c42083966d8cb0f10f9b75cebe249e01b64be89b | 467 | py | Python | terrascript/provider/Mongey/hellosign.py | mjuenema/python-terrascript | 6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d | [
"BSD-2-Clause"
] | 507 | 2017-07-26T02:58:38.000Z | 2022-01-21T12:35:13.000Z | terrascript/provider/Mongey/hellosign.py | mjuenema/python-terrascript | 6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d | [
"BSD-2-Clause"
] | 135 | 2017-07-20T12:01:59.000Z | 2021-10-04T22:25:40.000Z | terrascript/provider/Mongey/hellosign.py | mjuenema/python-terrascript | 6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d | [
"BSD-2-Clause"
] | 81 | 2018-02-20T17:55:28.000Z | 2022-01-31T07:08:40.000Z | # terrascript/provider/Mongey/hellosign.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:18:22 UTC)
import terrascript
class hellosign(terrascript.Provider):
""""""
__description__ = ""
__namespace__ = "Mongey"
__name__ = "hellosign"
__source__ = "https://github.com/Mongey/terraform-provider-hellosign"
__version__ = "0.0.2"
__published__ = "2021-02-08T22:16:56Z"
__tier__ = "community"
__all__ = ["hellosign"]
| 23.35 | 73 | 0.698073 | 51 | 467 | 5.764706 | 0.745098 | 0.129252 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.074359 | 0.164882 | 467 | 19 | 74 | 24.578947 | 0.679487 | 0.239829 | 0 | 0 | 1 | 0 | 0.323699 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.1 | 0 | 0.9 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
c4246014baf257efc76dc3d0d9141e1ae6bbbf0f | 642 | py | Python | vh-nginx/__init__.py | rEinve/ajenti-v | 7f3ef24198f91d7b7be42bbf0df36414d09172a4 | [
"MIT"
] | 150 | 2015-01-08T22:49:25.000Z | 2021-11-13T03:15:50.000Z | vh-nginx/__init__.py | rEinve/ajenti-v | 7f3ef24198f91d7b7be42bbf0df36414d09172a4 | [
"MIT"
] | 148 | 2015-01-07T03:53:16.000Z | 2021-10-03T16:13:57.000Z | vh-nginx/__init__.py | rEinve/ajenti-v | 7f3ef24198f91d7b7be42bbf0df36414d09172a4 | [
"MIT"
] | 91 | 2015-01-08T22:49:15.000Z | 2022-03-17T12:04:29.000Z | import ajenti
from ajenti.api import *
from ajenti.plugins import *
info = PluginInfo(
title='Ajenti VH - NGINX Support',
icon='globe',
dependencies=[
PluginDependency('vh'),
PluginDependency('services'),
#BinaryDependency('nginx'),
],
)
def init():
from ajenti.plugins.vh import destroyed_configs
destroyed_configs.append('nginx')
import nginx
import nginx_templates
from ajenti.plugins import manager
from ajenti.plugins.nginx.main import Nginx
#from ajenti.plugins.apache.main import Apache
manager.blacklist.append(Nginx)
#manager.blacklist.append(Apache)
| 22.137931 | 51 | 0.696262 | 71 | 642 | 6.253521 | 0.380282 | 0.135135 | 0.191441 | 0.103604 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.205607 | 642 | 28 | 52 | 22.928571 | 0.870588 | 0.160436 | 0 | 0 | 0 | 0 | 0.083955 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.052632 | false | 0 | 0.421053 | 0 | 0.473684 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
c42b84a261fc6c03ea62fbeea9084f311e17601b | 469 | py | Python | tests/initialisations/test_onoda2012pca.py | simonharris/pykmeans | 256e0c6c7284182aae9c10783cf50778af120514 | [
"MIT"
] | 1 | 2021-12-30T01:25:03.000Z | 2021-12-30T01:25:03.000Z | tests/initialisations/test_onoda2012pca.py | simonharris/pycluster | 4d47eb12a2bbaf1b05d7ccfd0cfc9ccf78ddf86d | [
"MIT"
] | 3 | 2020-11-12T12:36:00.000Z | 2021-06-18T12:46:59.000Z | tests/initialisations/test_onoda2012pca.py | simonharris/pycluster | 4d47eb12a2bbaf1b05d7ccfd0cfc9ccf78ddf86d | [
"MIT"
] | 1 | 2021-12-30T01:32:32.000Z | 2021-12-30T01:32:32.000Z | """
Tests for Onoda 2012 PCA initialisation algorithm
"""
import unittest
from datasets import testloader
from initialisations import onoda_pca as onoda
class OnodaPCATestSuite(unittest.TestCase):
"""Test suite for Onoda/PCA"""
def test_code_runs(self):
"""This needs more, but at least prove it runs"""
dataset = testloader.load_iris()
centroids = onoda.generate(dataset.data, 3)
self.assertEqual((3, 4), centroids.shape)
| 23.45 | 57 | 0.703625 | 59 | 469 | 5.525424 | 0.694915 | 0.04908 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018667 | 0.200426 | 469 | 19 | 58 | 24.684211 | 0.850667 | 0.251599 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | 1 | 0.125 | false | 0 | 0.375 | 0 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
c434715ab9a0b48dd3d6c07f33a9ee5cfc0f1d8f | 809 | py | Python | SMC/GEM5/gem5/src/mem/ethz_PIMIF.py | tanvirarafin/Brown-SMCSim | ff3d9334c1d5c8d6a00421848c0d51e50e6b67f8 | [
"MIT"
] | 10 | 2019-10-21T08:33:13.000Z | 2021-06-17T00:21:13.000Z | SMC/GEM5/gem5/src/mem/ethz_PIMIF.py | tanvirarafin/Brown-SMCSim | ff3d9334c1d5c8d6a00421848c0d51e50e6b67f8 | [
"MIT"
] | null | null | null | SMC/GEM5/gem5/src/mem/ethz_PIMIF.py | tanvirarafin/Brown-SMCSim | ff3d9334c1d5c8d6a00421848c0d51e50e6b67f8 | [
"MIT"
] | 6 | 2019-06-20T14:57:50.000Z | 2021-06-05T20:08:26.000Z | from m5.params import *
from m5.proxy import *
from MemObject import MemObject
# This is an interface module to attach the PIM to the memory interconnect
class ethz_PIMIF(MemObject):
type = 'ethz_PIMIF'
cxx_header = "mem/ethz_pim_if.hh"
slave = SlavePort('Slave port')
master = MasterPort('Master port')
system = Param.System(Parent.any, "System we belong to") # A pointer to the system is necessary for each master components
# Maybe I will delete these later
# Maybe I will delete these later
# Maybe I will delete these later
req_size = Param.Unsigned(16, "The number of requests to buffer")
resp_size = Param.Unsigned(16, "The number of responses to buffer")
delay = Param.Latency('0ns', "The latency")
ranges = VectorParam.AddrRange([AllMemory],
"Address ranges to pass through")
| 36.772727 | 123 | 0.744129 | 122 | 809 | 4.877049 | 0.565574 | 0.030252 | 0.05042 | 0.080672 | 0.231933 | 0.231933 | 0.231933 | 0.131092 | 0.131092 | 0.131092 | 0 | 0.010417 | 0.169345 | 809 | 21 | 124 | 38.52381 | 0.875 | 0.286774 | 0 | 0 | 0 | 0 | 0.309982 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.071429 | 0.214286 | 0 | 0.928571 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
c43b37c23acd217e1bdf098999d781500168a1f9 | 124 | py | Python | source/version.py | NathanDunfield/artexamscan | e3e082ad185d724bb040bf7f7a18f345652ae846 | [
"MIT"
] | null | null | null | source/version.py | NathanDunfield/artexamscan | e3e082ad185d724bb040bf7f7a18f345652ae846 | [
"MIT"
] | null | null | null | source/version.py | NathanDunfield/artexamscan | e3e082ad185d724bb040bf7f7a18f345652ae846 | [
"MIT"
] | null | null | null |
''' Provides one variable __version__.
Caution: All code in here will be executed by setup.py. '''
__version__ = '0.2.2'
| 17.714286 | 59 | 0.701613 | 19 | 124 | 4.157895 | 0.894737 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.029412 | 0.177419 | 124 | 6 | 60 | 20.666667 | 0.745098 | 0.733871 | 0 | 0 | 0 | 0 | 0.208333 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c43e0ebb15c510f46dd5e6be7b60c8179c34e167 | 716 | py | Python | ndiary1/models.py | naritotakizawa/django-narito-diary1 | aa0f258583d3766dd05c355a1306c18bf957b991 | [
"MIT"
] | 7 | 2019-11-09T06:17:45.000Z | 2020-12-16T00:56:10.000Z | ndiary1/models.py | naritotakizawa/django-narito-diary1 | aa0f258583d3766dd05c355a1306c18bf957b991 | [
"MIT"
] | null | null | null | ndiary1/models.py | naritotakizawa/django-narito-diary1 | aa0f258583d3766dd05c355a1306c18bf957b991 | [
"MIT"
] | null | null | null | from django.db import models
from django.utils import timezone
class Category(models.Model):
"""日記のカテゴリ"""
name = models.CharField('タイトル', max_length=255)
def __str__(self):
return self.name
class DiaryQuerySet(models.QuerySet):
def published(self):
return self.filter(created_at__lte=timezone.now())
class Diary(models.Model):
"""日記"""
title = models.CharField('タイトル', max_length=32)
text = models.TextField('本文')
category = models.ForeignKey(Category, on_delete=models.PROTECT, verbose_name='カテゴリ')
created_at = models.DateTimeField('作成日', default=timezone.now)
objects = DiaryQuerySet.as_manager()
def __str__(self):
return self.title
| 23.866667 | 89 | 0.694134 | 88 | 716 | 5.454545 | 0.545455 | 0.0625 | 0.0875 | 0.091667 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008518 | 0.180168 | 716 | 29 | 90 | 24.689655 | 0.809199 | 0.013966 | 0 | 0.117647 | 0 | 0 | 0.02446 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.176471 | false | 0 | 0.117647 | 0.176471 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
c448e72e15f52cd01d63f33fd90a693a023eff7b | 2,558 | py | Python | classy_vision/losses/classy_loss.py | jlin27/ClassyVision-1 | 113ddb0b66471eb84add9af53751d9067786a7f0 | [
"MIT"
] | 1 | 2021-04-09T08:32:22.000Z | 2021-04-09T08:32:22.000Z | classy_vision/losses/classy_loss.py | jlin27/ClassyVision-1 | 113ddb0b66471eb84add9af53751d9067786a7f0 | [
"MIT"
] | null | null | null | classy_vision/losses/classy_loss.py | jlin27/ClassyVision-1 | 113ddb0b66471eb84add9af53751d9067786a7f0 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Any, Dict
import torch.nn as nn
class ClassyLoss(nn.Module):
"""
Base class to calculate the loss during training.
This implementation of :class:`torch.nn.Module` allows building
the loss object from a configuration file.
"""
def __init__(self):
"""
Constructor for ClassyLoss.
"""
super(ClassyLoss, self).__init__()
@classmethod
def from_config(cls, config: Dict[str, Any]) -> "ClassyLoss":
"""Instantiates a ClassyLoss from a configuration.
Args:
config: A configuration for a ClassyLoss.
Returns:
A ClassyLoss instance.
"""
raise NotImplementedError()
def forward(self, output, target):
"""
Compute the loss for the provided sample.
Refer to :class:`torch.nn.Module` for more details.
"""
raise NotImplementedError
def get_optimizer_params(self, bn_weight_decay=False):
"""Gets optimizer params.
The default implementation is very simple. Most losses have no learned
parameters, so this is rarely needed.
"""
params = [
param for param in self.parameters(recurse=True) if param.requires_grad
]
return {"regularized_params": params, "unregularized_params": []}
def get_classy_state(self) -> Dict[str, Any]:
"""Get the state of the ClassyLoss.
The returned state is used for checkpointing. Note that most losses are
stateless and do not need to save any state.
Returns:
A state dictionary containing the state of the loss.
"""
return self.state_dict()
def set_classy_state(self, state: Dict[str, Any]) -> None:
"""Set the state of the ClassyLoss.
Args:
state_dict: The state dictionary. Must be the output of a call to
:func:`get_classy_state`.
This is used to load the state of the loss from a checkpoint. Note
that most losses are stateless and do not need to load any state.
"""
return self.load_state_dict(state)
def has_learned_parameters(self) -> bool:
"""Does this loss have learned parameters?"""
return any(
len(params) > 0 for (_, params) in self.get_optimizer_params().items()
)
| 30.094118 | 83 | 0.629789 | 322 | 2,558 | 4.906832 | 0.413043 | 0.022152 | 0.025316 | 0.032911 | 0.106329 | 0.055696 | 0.055696 | 0.055696 | 0.055696 | 0.055696 | 0 | 0.001099 | 0.288507 | 2,558 | 84 | 84 | 30.452381 | 0.867033 | 0.499609 | 0 | 0 | 0 | 0 | 0.047198 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.304348 | false | 0 | 0.086957 | 0 | 0.608696 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
c44aed32717b56759e32090e00aa476b72e0428d | 13,799 | py | Python | metatests/cloudcafe/compute/servers/models/test_servers.py | rcbops-qa/cloudcafe | d937f85496aadafbb94a330b9adb8ea18bee79ba | [
"Apache-2.0"
] | null | null | null | metatests/cloudcafe/compute/servers/models/test_servers.py | rcbops-qa/cloudcafe | d937f85496aadafbb94a330b9adb8ea18bee79ba | [
"Apache-2.0"
] | null | null | null | metatests/cloudcafe/compute/servers/models/test_servers.py | rcbops-qa/cloudcafe | d937f85496aadafbb94a330b9adb8ea18bee79ba | [
"Apache-2.0"
] | null | null | null | """
Copyright 2013 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import unittest
from cloudcafe.compute.common.types import ComputeTaskStates
from cloudcafe.compute.servers_api.models.servers import Server
class ServerDomainTest(object):
def test_server_disk_config(self):
self.assertEqual(self.server.disk_config, "AUTO")
def test_server_power_state(self):
self.assertEqual(self.server.power_state, 1)
def test_server_progress(self):
self.assertEqual(self.server.progress, 100)
def test_server_task_state(self):
self.assertEqual(self.server.task_state, ComputeTaskStates.NONE)
def test_server_vm_state(self):
self.assertEqual(self.server.vm_state, "active")
def test_server_id(self):
self.assertEqual(self.server.id, "5")
def test_server_name(self):
self.assertEqual(self.server.name, "testserver47476")
def test_tenant_id(self):
self.assertEqual(self.server.tenant_id, "660")
def test_server_status(self):
self.assertEqual(self.server.status, "ACTIVE")
def test_server_updated_time(self):
self.assertEqual(self.server.updated, "2012-12-03T19:04:06Z")
def test_host_id(self):
self.assertEqual(
self.server.host_id, "123")
def test_user_id(self):
self.assertEqual(self.server.user_id, "199835")
def test_server_created_time(self):
self.assertEqual(self.server.created, "2012-12-03T18:59:16Z")
def test_server_access_ips(self):
self.assertEqual(self.server.accessIPv4, "192.168.1.10")
self.assertEqual(self.server.accessIPv6,
"2001:11:7811:69:cf10:c02d:ff10:fa")
def test_server_addresses(self):
self.assertEqual(self.server.addresses.public.ipv4, "198.61.236.10")
self.assertEqual(self.server.addresses.public.addresses[0].version, 4)
self.assertEqual(self.server.addresses.public.ipv6,
"2001:11:7811:69:cf10:c02d:ff10:fa")
self.assertEqual(self.server.addresses.public.addresses[1].version, 6)
self.assertEqual(self.server.addresses.private.ipv4, "10.176.99.109")
self.assertEqual(
self.server.addresses.private.addresses[0].version, 4)
def test_server_flavor(self):
self.assertEqual(self.server.flavor.id, "2")
self.assertEqual(
self.server.flavor.links.bookmark,
"https://127.0.0.1/660/flavors/2")
def test_server_image(self):
self.assertEqual(self.server.image.id, "1")
self.assertEqual(
self.server.image.links.bookmark,
"https://127.0.0.1/660/images/1")
def test_server_links(self):
self.assertEqual(
self.server.links.self, "https://127.0.0.1/v2/660/servers/5")
self.assertEqual(
self.server.links.bookmark, "https://127.0.0.1/660/servers/5")
def test_server_metadata(self):
self.assertEqual(self.server.metadata.get('meta1'), "value1")
def test_server_keypair(self):
self.assertEqual(self.server.key_name, "ssh_key")
def test_server_instance_name(self):
self.assertEqual(self.server.instance_name, 'instance-test')
def test_hypervisor_hostname(self):
self.assertEqual(self.server.hypervisor_name, 'hyper-host')
def test_server_host(self):
self.assertEqual(self.server.host, 'host123')
class ServerFromVolumeDomainTest(object):
def test_server_image(self):
self.assertIsNone(self.server.image)
class ServerXMLDomainTest(unittest.TestCase, ServerDomainTest):
@classmethod
def setUpClass(cls):
docs_url = 'http://docs.openstack.org'
ext = 'compute/ext/extended_status'
cls.server_xml = \
"""
<server
xmlns:OS-DCF="{docs_url}/compute/ext/disk_config/api/v1.1"
xmlns:OS-EXT-STS="{docs_url}/{ext}/api/v1.1"
xmlns:OS-EXT-SRV-ATTR="{docs_url}/{ext}/api/v1.1"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns="{docs_url}/compute/api/v1.1"
status="ACTIVE" updated="2012-12-03T19:04:06Z"
hostId="123"
tenant_id="660"
name="testserver47476" created="2012-12-03T18:59:16Z"
userId="199835" tenantId="660" accessIPv4="192.168.1.10"
accessIPv6="2001:11:7811:69:cf10:c02d:ff10:fa"
progress="100" id="5" OS-EXT-STS:vm_state="active"
key_name="ssh_key"
OS-EXT-STS:task_state="None" OS-EXT-STS:power_state="1"
OS-DCF:diskConfig="AUTO"
OS-EXT-SRV-ATTR:instance_name="instance-test"
OS-EXT-SRV-ATTR:host="host123"
OS-EXT-SRV-ATTR:hypervisor_hostname="hyper-host">
<image id="1">
<atom:link href="https://127.0.0.1/660/images/1"
rel="bookmark"/>
</image>
<flavor id="2">
<atom:link href="https://127.0.0.1/660/flavors/2"
rel="bookmark"/>
</flavor>
<metadata>
<meta key="meta1">value1</meta>
</metadata>
<addresses>
<network id="public">
<ip version="4" addr="198.61.236.10"/>
<ip version="6" addr="2001:11:7811:69:cf10:c02d:ff10:fa"/>
</network>
<network id="private">
<ip version="4" addr="10.176.99.109"/>
</network>
</addresses>
<atom:link href="https://127.0.0.1/v2/660/servers/5" rel="self"/>
<atom:link href="https://127.0.0.1/660/servers/5" rel="bookmark"/>
</server>
""".format(docs_url=docs_url, ext=ext)
cls.server = Server.deserialize(cls.server_xml, 'xml')
class ServerJSONDomainTest(unittest.TestCase, ServerDomainTest):
@classmethod
def setUpClass(cls):
cls.server_json = \
"""
{
"server" : {
"status" : "ACTIVE",
"key_name" : "ssh_key",
"updated" : "2012-12-03T19:04:06Z",
"hostId" : "123",
"OS-EXT-SRV-ATTR:host" : "host123",
"addresses" : {
"public" : [
{
"version" : 4,
"addr" : "198.61.236.10"
},
{
"version" : 6,
"addr" : "2001:11:7811:69:cf10:c02d:ff10:fa"
}
],
"private" : [
{
"version" : 4,
"addr" : "10.176.99.109"
}
]
},
"links" : [
{
"href" : "https://127.0.0.1/v2/660/servers/5",
"rel" : "self"
},
{
"href" : "https://127.0.0.1/660/servers/5",
"rel" : "bookmark"
}
],
"image" : {
"id" : "1",
"links" : [
{
"href" : "https://127.0.0.1/660/images/1",
"rel" : "bookmark"
}
]
},
"OS-EXT-STS:task_state" : null,
"OS-EXT-STS:vm_state" : "active",
"OS-EXT-SRV-ATTR:instance_name" : "instance-test",
"OS-EXT-SRV-ATTR:hypervisor_hostname" : "hyper-host",
"flavor" : {
"id" : "2",
"links" : [
{
"href" : "https://127.0.0.1/660/flavors/2",
"rel" : "bookmark"
}
]
},
"id" : "5",
"user_id" : "199835",
"name" : "testserver47476",
"created" : "2012-12-03T18:59:16Z",
"tenant_id" : "660",
"OS-DCF:diskConfig" : "AUTO",
"accessIPv4" : "192.168.1.10",
"accessIPv6" : "2001:11:7811:69:cf10:c02d:ff10:fa",
"progress" : 100,
"OS-EXT-STS:power_state" : 1,
"metadata" : {
"meta1": "value1"
}
}
}
"""
cls.server = Server.deserialize(cls.server_json, 'json')
class ServerFromVolumeXMLDomainTest(unittest.TestCase,
ServerFromVolumeDomainTest):
@classmethod
def setUpClass(cls):
docs_url = 'http://docs.openstack.org'
ext = 'compute/ext/extended_status'
cls.server_xml = \
"""
<server
xmlns:OS-DCF="{docs_url}/compute/ext/disk_config/api/v1.1"
xmlns:OS-EXT-STS="{docs_url}/{ext}/api/v1.1"
xmlns:OS-EXT-SRV-ATTR="{docs_url}/{ext}/api/v1.1"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns="{docs_url}/compute/api/v1.1"
status="ACTIVE" updated="2012-12-03T19:04:06Z"
hostId="123"
tenant_id="660"
name="testserver47476" created="2012-12-03T18:59:16Z"
userId="199835" tenantId="660" accessIPv4="192.168.1.10"
accessIPv6="2001:11:7811:69:cf10:c02d:ff10:fa"
progress="100" id="5" OS-EXT-STS:vm_state="active"
key_name="ssh_key"
OS-EXT-STS:task_state="None" OS-EXT-STS:power_state="1"
OS-DCF:diskConfig="AUTO"
OS-EXT-SRV-ATTR:instance_name="instance-test"
OS-EXT-SRV-ATTR:host="host123"
OS-EXT-SRV-ATTR:hypervisor_hostname="hyper-host">
<image/>
<flavor id="2">
<atom:link href="https://127.0.0.1/660/flavors/2"
rel="bookmark"/>
</flavor>
<metadata>
<meta key="meta1">value1</meta>
</metadata>
<addresses>
<network id="public">
<ip version="4" addr="198.61.236.10"/>
<ip version="6" addr="2001:11:7811:69:cf10:c02d:ff10:fa"/>
</network>
<network id="private">
<ip version="4" addr="10.176.99.109"/>
</network>
</addresses>
<atom:link href="https://127.0.0.1/v2/660/servers/5" rel="self"/>
<atom:link href="https://127.0.0.1/660/servers/5" rel="bookmark"/>
</server>
""".format(docs_url=docs_url, ext=ext)
cls.server = Server.deserialize(cls.server_xml, 'xml')
class ServerFromVolumeJSONDomainTest(unittest.TestCase,
ServerFromVolumeDomainTest):
@classmethod
def setUpClass(cls):
cls.server_json = \
"""
{
"server" : {
"status" : "ACTIVE",
"key_name" : "ssh_key",
"updated" : "2012-12-03T19:04:06Z",
"hostId" : "123",
"OS-EXT-SRV-ATTR:host" : "host123",
"addresses" : {
"public" : [
{
"version" : 4,
"addr" : "198.61.236.10"
},
{
"version" : 6,
"addr" : "2001:11:7811:69:cf10:c02d:ff10:fa"
}
],
"private" : [
{
"version" : 4,
"addr" : "10.176.99.109"
}
]
},
"links" : [
{
"href" : "https://127.0.0.1/v2/660/servers/5",
"rel" : "self"
},
{
"href" : "https://127.0.0.1/660/servers/5",
"rel" : "bookmark"
}
],
"image" : "",
"OS-EXT-STS:task_state" : null,
"OS-EXT-STS:vm_state" : "active",
"OS-EXT-SRV-ATTR:instance_name" : "instance-test",
"OS-EXT-SRV-ATTR:hypervisor_hostname" : "hyper-host",
"flavor" : {
"id" : "2",
"links" : [
{
"href" : "https://127.0.0.1/660/flavors/2",
"rel" : "bookmark"
}
]
},
"id" : "5",
"user_id" : "199835",
"name" : "testserver47476",
"created" : "2012-12-03T18:59:16Z",
"tenant_id" : "660",
"OS-DCF:diskConfig" : "AUTO",
"accessIPv4" : "192.168.1.10",
"accessIPv6" : "2001:11:7811:69:cf10:c02d:ff10:fa",
"progress" : 100,
"OS-EXT-STS:power_state" : 1,
"metadata" : {
"meta1": "value1"
}
}
}
"""
cls.server = Server.deserialize(cls.server_json, 'json')
| 36.217848 | 78 | 0.489746 | 1,472 | 13,799 | 4.504076 | 0.139266 | 0.049774 | 0.091704 | 0.120664 | 0.77813 | 0.71267 | 0.613876 | 0.576772 | 0.55641 | 0.546154 | 0 | 0.099151 | 0.368505 | 13,799 | 380 | 79 | 36.313158 | 0.661694 | 0.039785 | 0 | 0.34 | 0 | 0 | 0.102684 | 0.025565 | 0 | 0 | 0 | 0 | 0.33 | 1 | 0.28 | false | 0 | 0.03 | 0 | 0.37 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c44e2b8a672436bc14e3e435ed0c2ffcac7e74ef | 3,097 | py | Python | tests/unit/processor/processor_resources.py | smehan/olelo | 993ecb4288ffe8c78fee4474333b31387ea3d403 | [
"BSD-3-Clause"
] | null | null | null | tests/unit/processor/processor_resources.py | smehan/olelo | 993ecb4288ffe8c78fee4474333b31387ea3d403 | [
"BSD-3-Clause"
] | null | null | null | tests/unit/processor/processor_resources.py | smehan/olelo | 993ecb4288ffe8c78fee4474333b31387ea3d403 | [
"BSD-3-Clause"
] | null | null | null |
# this is the content of the HTML file which might be better
# used as a simple open.read but we need to put in the bs4....
SRC_HTML = """
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Test Source HTML</title>
<style type="text/css">
a, body, div, span, td {font-family:Lucida Sans Unicode,Arial Unicode MS,Lucida Sans,Helvetica,Arial,sans-serif}
</style>
</head>
<body>
<div id="A">
<h2>A</h2>
<p>All nouns beginning with <span lang="HAW">a-</span> or <span lang="HAW">ā-</span> may be preceded by the article <span lang="HAW">ke</span>. Nouns beginning with <span lang="HAW">ʻa-</span> or <span lang="HAW">ʻā-</span> may be preceded by the article <span lang="HAW">ka</span>, unless otherwise stated.</p>
<div id="A.1">
<span lang="HAW">a </span>
<p><span>1.</span> <span>prep.</span> Of, acquired by. This <span lang="HAW">a</span> forms part of the possessives, as in <span lang="HAW">ka'u</span>, mine, and <span lang="HAW">kāna</span>, his. (<span>Gram. 9.6.1</span>.)<span lang="HAW">ʻUmi-a-Līloa</span>, <span lang="ENG"><span lang="HAW">ʻUmi</span>, [son] of <span lang="HAW">Līloa</span></span>. <span lang="HAW">Hale-a-ka-lā</span>, <span lang="ENG">house acquired [or used] by the sun [mountain name]</span>. (PPN <span lang="HAW">ʻa</span>.)</p>
<p><span>2.</span> <em>(Cap.)</em> <span>nvs.</span> Abbreviation of <span lang="HAW">ʻākau</span>, north, as in surveying reports.</p>
</div>
<div id="A.2">
<span lang="HAW">-a </span>
<p>Pas/imp. suffix. (<span>Gram. 6.6.3</span>.) (PPN <span lang="HAW">-a</span>.)</p>
</div>
<div id="A.15">
<span lang="HAW">ʻaʻa.ʻā </span>
<p><span>1.</span> Redup. of <span lang="HAW">ʻaʻā</span> 1; lava cave.</p>
<p><span>2.</span> Redup. of <span lang="HAW">ʻāʻā</span> 1.</p>
</div>
<div id="A.18">
<span lang="HAW">ʻaʻa.ahi </span>
<p><span>n.</span> Bag for carrying fire-making equipment (<span lang="HAW">ʻaʻa</span>, <span lang="ENG">bag</span>, and <span lang="HAW">ahi</span>, <span lang="ENG">fire</span>).</p>
</div>
<div id="A.1762">
<span lang="HAW">ʻā.wī.wī </span>
<p><span>vi.</span> To hurry; speedy, swift, quick, fast.</p>
</div>
</div>
</body>
</html>
"""
SRC_TEXT = """
Test Source HTML
a, body, div, span, td {font-family:Lucida Sans Unicode,Arial Unicode MS,Lucida Sans,Helvetica,Arial,sans-serif}
A
All nouns beginning with a- or ā- may be preceded by the article ke. Nouns beginning with ʻa- or ʻā- may be preceded by the article ka, unless otherwise stated.
a
1. prep. Of, acquired by. This a forms part of the possessives, as in ka'u, mine, and kāna, his. (Gram. 9.6.1.)ʻUmi-a-Līloa, ʻUmi, [son] of Līloa. Hale-a-ka-lā, house acquired [or used] by the sun [mountain name]. (PPN ʻa.)
2. (Cap.) nvs. Abbreviation of ʻākau, north, as in surveying reports.
-a
Pas/imp. suffix. (Gram. 6.6.3.) (PPN -a.)
ʻaʻa.ʻā
1. Redup. of ʻaʻā 1; lava cave.
2. Redup. of ʻāʻā 1.
ʻaʻa.ahi
n. Bag for carrying fire-making equipment (ʻaʻa, bag, and ahi, fire).
ʻā.wī.wī
vi. To hurry; speedy, swift, quick, fast.
""" | 36.869048 | 509 | 0.651921 | 567 | 3,097 | 3.557319 | 0.262787 | 0.115022 | 0.136341 | 0.029747 | 0.460585 | 0.36589 | 0.194348 | 0.165592 | 0.165592 | 0.126921 | 0 | 0.020401 | 0.12948 | 3,097 | 84 | 510 | 36.869048 | 0.727745 | 0.038424 | 0 | 0.175439 | 0 | 0.245614 | 0.98655 | 0.189644 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c455876bb23648a12098bcc1485d719866a36990 | 553 | py | Python | push2_python/classes.py | strean/push2-python | 0369dd3ef2f41f4cce0e6789f3fb329c0b3cfd15 | [
"MIT"
] | null | null | null | push2_python/classes.py | strean/push2-python | 0369dd3ef2f41f4cce0e6789f3fb329c0b3cfd15 | [
"MIT"
] | null | null | null | push2_python/classes.py | strean/push2-python | 0369dd3ef2f41f4cce0e6789f3fb329c0b3cfd15 | [
"MIT"
] | null | null | null | import weakref
class AbstractPush2Section(object):
"""Abstract class to be inherited when implementing the interfacing with specific sections
of Push2. It implements an init method which gets a reference to the main Push2 object and adds
a property method to get it de-referenced.
"""
main_push2_object = None
def __init__(self, main_push_object):
self.main_push_object = weakref.ref(main_push_object)
@property
def push(self):
return self.main_push_object() # Return de-refernced main Push2 object
| 30.722222 | 99 | 0.734177 | 77 | 553 | 5.090909 | 0.532468 | 0.081633 | 0.142857 | 0.137755 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011442 | 0.209765 | 553 | 17 | 100 | 32.529412 | 0.885584 | 0.479204 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.125 | 0.125 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
c46473033384752d7b1e4e17128a325f2275d20a | 1,789 | py | Python | tests/Test-eucaops-init.py | tbeckham/eutester | 1440187150ce284bd87147e71ac7f0fda194b4d9 | [
"BSD-2-Clause"
] | null | null | null | tests/Test-eucaops-init.py | tbeckham/eutester | 1440187150ce284bd87147e71ac7f0fda194b4d9 | [
"BSD-2-Clause"
] | null | null | null | tests/Test-eucaops-init.py | tbeckham/eutester | 1440187150ce284bd87147e71ac7f0fda194b4d9 | [
"BSD-2-Clause"
] | null | null | null | #!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2009-2011, Eucalyptus Systems, Inc.
# All rights reserved.
#
# Redistribution and use of this software in source and binary forms, with or
# without modification, are permitted provided that the following conditions
# are met:
#
# Redistributions of source code must retain the above
# copyright notice, this list of conditions and the
# following disclaimer.
#
# Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the
# following disclaimer in the documentation and/or other
# materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Author: Vic Iglesias vic.iglesias@eucalyptus.com
#
import unittest
from eucaops import Eucaops
class EucaopsTest(unittest.TestCase):
def setUp(self):
self.tester = Eucaops(download_creds=False)
def test_logger(self):
self.assertNotEqual(self.tester.logger, None)
if __name__ == "__main__":
unittest.main()
| 39.755556 | 77 | 0.766909 | 247 | 1,789 | 5.51417 | 0.566802 | 0.026432 | 0.013216 | 0.024963 | 0.135095 | 0.099853 | 0.099853 | 0.099853 | 0.099853 | 0.099853 | 0 | 0.005387 | 0.169927 | 1,789 | 44 | 78 | 40.659091 | 0.911785 | 0.803801 | 0 | 0 | 0 | 0 | 0.025157 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 1 | 0.222222 | false | 0 | 0.222222 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c4685b57a01848860075737f85d95bf6ead99506 | 574 | py | Python | 105_POO/bases.py | josuerojasq/netacad_python | 510c3a026f83e499144d91c00edc5045a8304a08 | [
"MIT"
] | null | null | null | 105_POO/bases.py | josuerojasq/netacad_python | 510c3a026f83e499144d91c00edc5045a8304a08 | [
"MIT"
] | null | null | null | 105_POO/bases.py | josuerojasq/netacad_python | 510c3a026f83e499144d91c00edc5045a8304a08 | [
"MIT"
] | null | null | null | #"__bases__" es una tupla, contiene clases (no nombres de clases)
# que son superclases directas para la clase.
#Nota: solo las clases tienen este atributo - los objetos no.
#Nota: una clase sin superclases explícitas apunta al objeto
# (una clase de Python predefinida) como su antecesor directo
class SuperUno:
pass
class SuperDos:
pass
class Sub(SuperUno, SuperDos):
pass
def printBases(cls):
print('( ', end='')
for x in cls.__bases__:
print(x.__name__, end=' ')
print(')')
printBases(SuperUno)
printBases(SuperDos)
printBases(Sub) | 22.076923 | 65 | 0.709059 | 77 | 574 | 5.12987 | 0.636364 | 0.040506 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.195122 | 574 | 26 | 66 | 22.076923 | 0.854978 | 0.5 | 0 | 0.214286 | 0 | 0 | 0.014134 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.071429 | false | 0.214286 | 0 | 0 | 0.285714 | 0.5 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 2 |
c469b0f517319c9837ce99f67e6f4b118618f8b7 | 2,563 | py | Python | sdk/apis/card_service.py | CLG0125/elemesdk | 344466398bad7cf026e082e47c77d3ca98621ef3 | [
"MIT"
] | null | null | null | sdk/apis/card_service.py | CLG0125/elemesdk | 344466398bad7cf026e082e47c77d3ca98621ef3 | [
"MIT"
] | null | null | null | sdk/apis/card_service.py | CLG0125/elemesdk | 344466398bad7cf026e082e47c77d3ca98621ef3 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# 商户会员卡服务
class CardService:
__client = None
def __init__(self, client):
self.__client = client
def upload_image(self, image_base_6_4):
"""
上传图片
:param imageBase64:上传图片
"""
return self.__client.call("eleme.card.uploadImage", {"imageBase64": image_base_6_4})
def create_template(self, template_info):
"""
创建模板
:param templateInfo:模板信息
"""
return self.__client.call("eleme.card.createTemplate", {"templateInfo": template_info})
def mget_template_info(self, template_id):
"""
查询模板信息
:param templateId:模板id列表
"""
return self.__client.call("eleme.card.mgetTemplateInfo", {"templateId": template_id})
def update_template(self, template_id, template_info):
"""
更新模板信息
:param templateId:模板id
:param templateInfo:模板更新信息
"""
return self.__client.call("eleme.card.updateTemplate", {"templateId": template_id, "templateInfo": template_info})
def mget_shop_ids_by_template_ids(self, template_id):
"""
查询模板应用的店铺
:param templateId:模板id列表
"""
return self.__client.call("eleme.card.mgetShopIdsByTemplateIds", {"templateId": template_id})
def apply_template(self, template_id, shop_ids):
"""
应用模板
:param templateId:模板id
:param shopIds:店铺列表
"""
return self.__client.call("eleme.card.applyTemplate", {"templateId": template_id, "shopIds": shop_ids})
def open_card(self, template_id, card_user_info, card_account_info):
"""
开卡
:param templateId:模板ID
:param cardUserInfo:会员用户信息
:param cardAccountInfo:会员账户信息
"""
return self.__client.call("eleme.card.openCard", {"templateId": template_id, "cardUserInfo": card_user_info, "cardAccountInfo": card_account_info})
def update_user_info(self, card_user_info, card_account_info):
"""
更新会员信息
:param cardUserInfo:用户基本信息
:param cardAccountInfo:用户账户信息
"""
return self.__client.call("eleme.card.updateUserInfo", {"cardUserInfo": card_user_info, "cardAccountInfo": card_account_info})
def get_user_by_token(self, user_token):
"""
根据userToken获取用户信息
:param userToken:userToken有效期10分钟。饿了么app上跳转到外部H5页面www.abc.com/aaa?userToken=aaabbbccc,aaabbbccc为userToken,用其作为该接口的入参获取到用户信息
"""
return self.__client.call("eleme.card.getUserByToken", {"userToken": user_token})
| 32.0375 | 155 | 0.644167 | 263 | 2,563 | 5.961977 | 0.296578 | 0.070153 | 0.091837 | 0.114796 | 0.339923 | 0.300383 | 0.13648 | 0.13648 | 0.13648 | 0 | 0 | 0.006167 | 0.240734 | 2,563 | 79 | 156 | 32.443038 | 0.799589 | 0.214592 | 0 | 0 | 0 | 0 | 0.225902 | 0.123004 | 0 | 0 | 0 | 0 | 0 | 1 | 0.454545 | false | 0 | 0 | 0 | 0.954545 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
c474d0b194666eee338e59d4dd147f4018fd4960 | 583 | py | Python | tcp_client.py | saintthor/tornado-guide-examples | 23cb302790c17ec72b070a2c52adce7dcedaea9b | [
"MIT"
] | 11 | 2016-12-06T03:13:11.000Z | 2019-03-27T14:39:29.000Z | tcp_client.py | saintthor/tornado-guide-examples | 23cb302790c17ec72b070a2c52adce7dcedaea9b | [
"MIT"
] | 1 | 2016-12-29T05:59:48.000Z | 2016-12-29T14:28:33.000Z | tcp_client.py | saintthor/tornado-guide-examples | 23cb302790c17ec72b070a2c52adce7dcedaea9b | [
"MIT"
] | 7 | 2017-06-29T08:38:49.000Z | 2019-07-24T01:56:00.000Z | # -*- coding: utf-8 -*-
"""
Created on Tue Sep 27 00:35:17 2016
@author: thor
"""
from tornado import ioloop, gen, iostream
from tornado.tcpclient import TCPClient
@gen.coroutine
def Trans():
stream = yield TCPClient().connect( 'localhost', 8760 )
try:
for msg in ( 'zzxxc', 'abcde', 'i feel lucky', 'over' ):
yield stream.write( msg )
back = yield stream.read_bytes( 20, partial = True )
print back
except iostream.StreamClosedError:
pass
if __name__ == '__main__':
ioloop.IOLoop.current().run_sync( Trans ) | 26.5 | 64 | 0.620926 | 72 | 583 | 4.888889 | 0.777778 | 0.0625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.043578 | 0.252144 | 583 | 22 | 65 | 26.5 | 0.763761 | 0.036021 | 0 | 0 | 0 | 0 | 0.085487 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.071429 | 0.142857 | null | null | 0.071429 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
c475a792e8a1a3128d4a20adcd1e5a4873f9938e | 3,314 | py | Python | py/sam3x8e/tester.py | segrids/arduino_due | f375020b81459eae9b325aa3646ff84efc2853e8 | [
"MIT"
] | 3 | 2021-08-20T16:03:37.000Z | 2022-03-23T20:23:30.000Z | py/sam3x8e/tester.py | segrids/testbench | f375020b81459eae9b325aa3646ff84efc2853e8 | [
"MIT"
] | null | null | null | py/sam3x8e/tester.py | segrids/testbench | f375020b81459eae9b325aa3646ff84efc2853e8 | [
"MIT"
] | null | null | null | """ MIT License
Copyright (c) 2021 by Frank Schuhmacher <frank.schuhmacher@segrids.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Author: Frank Schuhmacher
"""
from sys import stdout
import time
from ..hexen import *
from .. import uart
from ..apdu import Apdu
from .programmer import Programmer
def tester(port):
from .uart import Serial
serial = Serial(port)
return Tester(serial)
"""
class Tester()
Command interface to a sam3x8e target device.
The target device is assumed to run a command handler for APDU instruction classes
'L' (Loader) | loader.c
'T' (Tester) | tester.c
Extend methods of Programmer class by tests.
"""
class Tester(Programmer):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def blink(self):
"""Toggle pin B27 repeatedly."""
_, status = self.apdu.sendreceive(b'B', cla=b'T')
return status
def set_led(self, value):
_, status = self.apdu.sendreceive(b'l', bu8(value), cla=b'T')
assert status == 0x9000
def pc(self):
"""Read the address of the uart_send_uint8 function.
Useful to detect if program is executing in flash or RAM.
"""
res, status = self.apdu.sendreceive(b'W', b'', 4, cla=b'T')
assert status == 0x9000
return ub32(res)
### Test SPI slave commands (Attention: MOSI to MOSI, MISO to MISO)
def spi_open(self):
res, status = self.apdu.sendreceive(cla=b'T', ins=b'o', res_len=0)
assert status == 0x9000
def spi_send(self, data):
res, status = self.apdu.sendreceive(cla=b'T', ins=b'w', data=data, res_len=0)
assert status == 0x9000
def spi_receive(self, length):
res, status = self.apdu.sendreceive(cla=b'T', ins=b'r', res_len=length)
assert status == 0x9000
return res
### Test I2C slave commands
def i2c_open(self):
res, status = self.apdu.sendreceive(cla=b'T', ins=b'O', res_len=0)
assert status == 0x9000
def i2c_send(self, data):
res, status = self.apdu.sendreceive(cla=b'T', ins=b'W', data=data, res_len=0)
assert status == 0x9000
def i2c_receive(self, length):
res, status = self.apdu.sendreceive(cla=b'T', ins=b'R', res_len=length)
assert status == 0x9000
return res
| 30.685185 | 85 | 0.686783 | 492 | 3,314 | 4.575203 | 0.376016 | 0.039982 | 0.055975 | 0.099956 | 0.287428 | 0.251444 | 0.231008 | 0.231008 | 0.225677 | 0.225677 | 0 | 0.023516 | 0.21726 | 3,314 | 107 | 86 | 30.971963 | 0.844256 | 0.410682 | 0 | 0.232558 | 0 | 0 | 0.010876 | 0 | 0 | 0 | 0.029003 | 0 | 0.186047 | 1 | 0.255814 | false | 0 | 0.162791 | 0 | 0.55814 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
c477b1bbcaa2e82e21490fae6d38b3da02ba4d05 | 1,764 | py | Python | examples/basic.py | SamiAlsubhi/fastapi-jwt-auth | 83b6c798a11813494b885c4a17a1495c4e48cef6 | [
"MIT"
] | 357 | 2020-08-14T04:27:10.000Z | 2022-03-30T17:40:50.000Z | examples/basic.py | SamiAlsubhi/fastapi-jwt-auth | 83b6c798a11813494b885c4a17a1495c4e48cef6 | [
"MIT"
] | 73 | 2020-09-24T10:09:24.000Z | 2022-03-28T09:16:14.000Z | examples/basic.py | SamiAlsubhi/fastapi-jwt-auth | 83b6c798a11813494b885c4a17a1495c4e48cef6 | [
"MIT"
] | 64 | 2020-09-06T03:33:29.000Z | 2022-03-23T15:31:05.000Z | from fastapi import FastAPI, HTTPException, Depends, Request
from fastapi.responses import JSONResponse
from fastapi_jwt_auth import AuthJWT
from fastapi_jwt_auth.exceptions import AuthJWTException
from pydantic import BaseModel
app = FastAPI()
class User(BaseModel):
username: str
password: str
# in production you can use Settings management
# from pydantic to get secret key from .env
class Settings(BaseModel):
authjwt_secret_key: str = "secret"
# callback to get your configuration
@AuthJWT.load_config
def get_config():
return Settings()
# exception handler for authjwt
# in production, you can tweak performance using orjson response
@app.exception_handler(AuthJWTException)
def authjwt_exception_handler(request: Request, exc: AuthJWTException):
return JSONResponse(
status_code=exc.status_code,
content={"detail": exc.message}
)
# provide a method to create access tokens. The create_access_token()
# function is used to actually generate the token to use authorization
# later in endpoint protected
@app.post('/login')
def login(user: User, Authorize: AuthJWT = Depends()):
if user.username != "test" or user.password != "test":
raise HTTPException(status_code=401,detail="Bad username or password")
# subject identifier for who this token is for example id or username from database
access_token = Authorize.create_access_token(subject=user.username)
return {"access_token": access_token}
# protect endpoint with function jwt_required(), which requires
# a valid access token in the request headers to access.
@app.get('/user')
def user(Authorize: AuthJWT = Depends()):
Authorize.jwt_required()
current_user = Authorize.get_jwt_subject()
return {"user": current_user}
| 33.923077 | 87 | 0.762472 | 231 | 1,764 | 5.705628 | 0.411255 | 0.050076 | 0.021244 | 0.027314 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00202 | 0.158163 | 1,764 | 51 | 88 | 34.588235 | 0.885522 | 0.328231 | 0 | 0 | 0 | 0 | 0.060529 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.129032 | false | 0.096774 | 0.16129 | 0.064516 | 0.580645 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
c481febcee8d785aad7d35d8d70dddca23561238 | 5,933 | py | Python | chargify.py | numan/chargify-python | b8c77a43cf27500be01243a3a59a55b973ebebd0 | [
"MIT"
] | 1 | 2015-02-26T17:30:47.000Z | 2015-02-26T17:30:47.000Z | chargify.py | forgingdestiny/chargify-python | b8c77a43cf27500be01243a3a59a55b973ebebd0 | [
"MIT"
] | null | null | null | chargify.py | forgingdestiny/chargify-python | b8c77a43cf27500be01243a3a59a55b973ebebd0 | [
"MIT"
] | 1 | 2015-03-23T23:47:05.000Z | 2015-03-23T23:47:05.000Z | try:
import simplejson as json
except ImportError:
try:
import json
except ImportError:
raise EnvironmentError("You must have a JSON module installed such as simplejson")
import urllib
import urllib2
import base64
# Define all exceptions
# Corresponds to HTTP response codes specified here:
# http://support.chargify.com/faqs/api/api-user-guide
class ChargifyError(Exception):
def __init__(self, error_data=None, *a, **kw):
self.error_data = error_data or {}
super(ChargifyError, self).__init__(*a, **kw)
class ChargifyConnectionError(ChargifyError):pass
class ChargifyUnauthorizedError(ChargifyError):pass
class ChargifyForbiddenError(ChargifyError):pass
class ChargifyNotFoundError(ChargifyError):pass
class ChargifyUnprocessableEntityError(ChargifyError):pass
class ChargifyServerError(ChargifyError):pass
ERROR_CODES = {
201: False,
401: ChargifyUnauthorizedError,
403: ChargifyForbiddenError,
404: ChargifyNotFoundError,
422: ChargifyUnprocessableEntityError,
500: ChargifyServerError,
}
# Maps certain function names to HTTP verbs
VERBS = {
'create':'POST',
'read':'GET',
'update':'PUT',
'delete':'DELETE'
}
# A list of identifiers that should be extracted and placed into the url string if they are
# passed into the kwargs.
IDENTIFIERS = {
'customer_id':'customers',
'product_id':'products',
'subscription_id':'subscriptions',
'component_id':'components',
'handle':'handle',
'statement_id':'statements',
'product_family_id':'product_families',
'coupon_id':'coupons',
'transaction_id':'transactions',
'usage_id':'usages',
'migration_id':'migrations',
}
class ChargifyHttpClient(object):
"""
Extracted from the main Chargify class so it can be stubbed out during testing.
"""
def make_request(self, url, method, data, api_key):
"""
Actually responsible for making the HTTP request.
:param url: The URL to load.
:param method: The HTTP method to use.
:param data: Any POST data that should be included with the request.
"""
opener = urllib2.build_opener(urllib2.HTTPHandler)
request = urllib2.Request(url=url, data=data)
# Build header
request.get_method = lambda: method
request.add_header('Authorization', 'Basic %s' % base64.encodestring('%s:%s' % (api_key, 'x'))[:-1])
request.add_header('User-Agent', 'Chargify Python Client')
request.add_header('Accept', 'application/json')
request.add_header('Content-Type', 'application/json')
if data is None:
request.add_header('Content-Length','0')
# Make request and trap for HTTP errors
try:
response = opener.open(request)
except urllib2.HTTPError, e:
response = e
except urllib2.URLError, e:
raise ChargifyConnectionError(e)
result = response.read()
try:
data = json.loads(result)
except ValueError:
data = {'body': result} #Is not JSON
if response.code in ERROR_CODES and ERROR_CODES[response.code] is not False:
error_class = ERROR_CODES[e.code]
raise error_class(data)
return data
class Chargify(object):
"""
A client for the Chargify API.
"""
api_key = ''
sub_domain = ''
path = []
domain = 'https://%s.chargify.com/'
client = None
def __init__(self, api_key, sub_domain, path=None, client=None):
"""
:param api_key: The API key for your Chargify account.
:param sub_domain: The sub domain of your Chargify account.
:param path: The current path constructed for this request.
:param client: The HTTP client to use to make the request.
"""
self.api_key = api_key
self.sub_domain = sub_domain
self.path = path or []
self.client = client or ChargifyHttpClient()
def __getattr__(self, attr):
"""
Uses attribute chaining to help construct the url path of the request.
"""
try:
return object.__getattr__(self, attr)
except AttributeError:
return Chargify(self.api_key, self.sub_domain, self.path + [attr], self.client)
def construct_request(self, **kwargs):
"""
:param kwargs: The arguments passed into the request. Valid values are:
'customer_id', 'product_id', 'subscription_id', 'component_id', 'handle' will be extracted
and placed into the url. 'data' will be serialized into a JSON string and POSTed with
the request.
"""
path = self.path[:]
# Find the HTTP method if we were called with create(), update(), read(), or delete()
if path[-1] in VERBS.keys():
action = path.pop()
method = VERBS[action]
else:
method = 'GET'
# Extract certain kwargs and place them in the url instead
for identifier, name in IDENTIFIERS.items():
value = kwargs.pop(identifier, None)
if value:
path.insert(path.index(name)+1, str(value))
# Convert the data to a JSON string
data = kwargs.pop('data', None)
if data:
data = json.dumps(data)
# Build query string
get_params = kwargs.pop("get_params", {})
if method == 'GET' and (kwargs or get_params):
get_params.update(kwargs)
args = "?%s" % (urllib.urlencode(get_params, True))
else:
args = ''
# Build url
url = self.domain % self.sub_domain
url = url + '/'.join(path) + '.json' + args
return url, method, data
def __call__(self, **kwargs):
url, method, data = self.construct_request(**kwargs)
return self.client.make_request(url, method, data, self.api_key)
| 32.779006 | 108 | 0.631047 | 697 | 5,933 | 5.25538 | 0.324247 | 0.01638 | 0.03003 | 0.01092 | 0.037128 | 0.01638 | 0.01638 | 0 | 0 | 0 | 0 | 0.007334 | 0.264622 | 5,933 | 180 | 109 | 32.961111 | 0.832226 | 0.092028 | 0 | 0.078261 | 0 | 0 | 0.11814 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.052174 | 0.06087 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
6708fdaf981a8d9d57be0fb2d47c4abe1a60e995 | 2,281 | py | Python | service_catalog/models/tower_server.py | Sispheor/squest | f852fe7986521a9d8cd9fb5eb0b56aa15f22548c | [
"Apache-2.0"
] | 112 | 2021-04-21T08:52:55.000Z | 2022-03-01T15:09:19.000Z | service_catalog/models/tower_server.py | Sispheor/squest | f852fe7986521a9d8cd9fb5eb0b56aa15f22548c | [
"Apache-2.0"
] | 216 | 2021-04-21T09:06:47.000Z | 2022-03-30T14:21:28.000Z | service_catalog/models/tower_server.py | Sispheor/squest | f852fe7986521a9d8cd9fb5eb0b56aa15f22548c | [
"Apache-2.0"
] | 21 | 2021-04-20T13:53:54.000Z | 2022-03-30T21:43:04.000Z | from django.db import models
from towerlib import Tower
class TowerServer(models.Model):
name = models.CharField(max_length=100)
host = models.CharField(max_length=200, unique=True)
token = models.CharField(max_length=200)
secure = models.BooleanField(default=True)
ssl_verify = models.BooleanField(default=False)
def __str__(self):
return f"{self.name} ({self.host})"
def sync(self, job_template_id=None):
"""
Sync all job templates
:return:
"""
from .job_templates import JobTemplate as JobTemplateLocal
tower = self.get_tower_instance()
if job_template_id is None:
id_in_tower = []
for job_template_from_tower in tower.job_templates:
id_in_tower.append(job_template_from_tower.id)
self._update_job_template_from_tower(job_template_from_tower)
JobTemplateLocal.objects.filter(tower_server=self).exclude(tower_id__in=id_in_tower).delete()
else:
job_template = JobTemplateLocal.objects.get(id=job_template_id)
self._update_job_template_from_tower(tower.get_job_template_by_id(job_template.tower_id))
def get_tower_instance(self):
return Tower(self.host, None, None, secure=self.secure, ssl_verify=self.ssl_verify, token=self.token)
def _update_job_template_from_tower(self, job_template_from_tower):
from .job_templates import JobTemplate as JobTemplateLocal
job_template, _ = JobTemplateLocal.objects.get_or_create(tower_id=job_template_from_tower.id,
tower_server=self,
defaults={'name': job_template_from_tower.name})
# update data
job_template.name = job_template_from_tower.name
job_template.tower_job_template_data = job_template_from_tower._data
job_template.survey = job_template_from_tower.survey_spec
job_template.is_compliant = job_template.check_is_compliant()
job_template.save()
# update all operation that uses this template
from service_catalog.models import Operation
Operation.update_survey_after_job_template_update(job_template)
| 46.55102 | 113 | 0.684349 | 282 | 2,281 | 5.148936 | 0.255319 | 0.212121 | 0.123967 | 0.165289 | 0.287879 | 0.152893 | 0.114325 | 0 | 0 | 0 | 0 | 0.005214 | 0.243314 | 2,281 | 48 | 114 | 47.520833 | 0.836037 | 0.039018 | 0 | 0.055556 | 0 | 0 | 0.013432 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.138889 | 0.055556 | 0.472222 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
670ed2e889fb41814ac3b1ba0895dd7a7ec21beb | 36,049 | py | Python | Parse_SOM.py | timletz/materials_datascience_uw_somlab | f5d988bac823ee9212764bdb1bf6ba1526fa47e4 | [
"MIT"
] | 1 | 2022-03-30T20:42:16.000Z | 2022-03-30T20:42:16.000Z | Parse_SOM.py | crentb/materials_datascience_uw_somlab | f5d988bac823ee9212764bdb1bf6ba1526fa47e4 | [
"MIT"
] | null | null | null | Parse_SOM.py | crentb/materials_datascience_uw_somlab | f5d988bac823ee9212764bdb1bf6ba1526fa47e4 | [
"MIT"
] | 10 | 2019-04-21T17:19:00.000Z | 2022-03-30T20:41:44.000Z | import re
import pandas as pd
import numpy as np
COLUMN_NAMES = [
'Material family',
'Youngs modulus',
'Specific stiffness',
'Yield strength',
'Tensile strength',
'Specific strength',
'Elongation',
'Compressive strength',
'Flexural modulus',
'Flexural strength',
'Shear modulus',
'Bulk modulus',
'Poisson ratio',
'Shape factor',
'Hardness vickers',
'Elastic stored energy',
'Fatigue strength',
'Fracture toughness',
'Toughness',
'Ductility index',
'Melting point',
'Max service temp',
'Min service temp',
'Thermal conductivity',
'Specific heat capacity',
'Thermal expansion coefficient',
'Thermal shock resistance',
'Thermal distortion resistance',
'Latent heat of fusion',
'Electrical resistivity',
'Electrical conductivity',
'Galvanic potential',
'Mechanical loss coefficient',
]
BAD_PROPERTIES = [
'Elongation', # This is because there's over 600 bad properties in the dataset
'Hardness vickers',
# not worth saving
'Specific stiffness',
'Specific strength',
'Shape factor',
'Elastic stored energy',
'Toughness',
'Ductility index',
'Thermal shock resistance',
'Thermal distortion resistance',
# These properties are not actually real properties of the material
'Max service temp',
'Min service temp',
'Electrical resistivity',
# This really messes with our data selection
'Galvanic potential',
]
# These are materials with invalid values for one or more properties
# This entry is here because there's materials with higher, but valid values
# And I don't want to lose them
BAD_MATERIALS = [
"PEEK/IM carbon fiber, UD prepreg, UD lay-up"
]
def parsing_material_data(material_text, new_file):
with open(material_text, "r") as stuff_to_write:
with open(new_file, "w") as stuff_written:
in_thermal_properties = False
in_electrical_properties = False
in_mechanical_properties = False
in_impact_properties = False
for line in stuff_to_write:
if line.startswith("done"):
stuff_written.write(line)
elif "Mechanical properties" in line:
in_mechanical_properties = True
elif "Impact & fracture properties" in line:
in_mechanical_properties = False
in_impact_properties = True
elif "Thermal properties" in line:
in_thermal_properties = True
in_impact_properties = False
elif "Electrical properties" in line:
in_thermal_properties = False
in_electrical_properties = True
elif "Magnetic properties" in line:
in_electrical_properties = False
in_mechanical_properties = False
in_thermal_properties = False
in_impact_properties = False
elif "Mechanical loss coefficient" in line:
stuff_written.write(line)
elif line.startswith("Material family"):
stuff_written.write(line)
elif in_thermal_properties is True or in_electrical_properties is True or in_mechanical_properties is True or in_impact_properties is True:
stuff_written.write(line)
def parsing_refined_data(new_file):
material_name = []
material_family = []
young_modulus_values = []
specific_stiffness_values = []
yield_strength_values = []
tensile_strength_values = []
specific_strength_values = []
elongation_values = []
compressive_strength_values = []
flexural_modulus_values = []
flexural_strength_values = []
shear_modulus_values = []
bulk_modulus_values = []
poisson_ratio_values = []
shape_factor_values = []
hardness_vickers_values = []
elastic_stored_energy_values = []
fatigue_strength_values = []
fracture_toughness_values = []
toughness_values = []
ductility_index_values = []
melting_values = []
max_service_temp_values = []
min_service_temp_values = []
therm_cond_values = []
spec_heat_cap_values = []
therm_expan_coeff_values = []
therm_shock_resist_values = []
therm_dist_resist_values = []
latent_heat_fusion_values = []
elec_resist_values = []
elec_cond_values = []
galvanic_potential_values = []
mech_loss_coeff_values = []
with open(new_file, "r") as sample_info:
for line in sample_info:
if line.startswith("done"):
for line_item in range(2, len(line.split(' '))):
material_name.append((line.split(' ')[line_item].strip('" ,\t\n')))
elif line.startswith("Material family"):
for line_item in range(1, len(line.split(' ')) - 1):
material_family.append(line.split(' ')[line_item].strip(' ",\t\n'))
elif line.startswith("Young's modulus (10^6 psi)"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
young_modulus_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
young_modulus_values.append("Null")
else:
young_modulus_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Specific stiffness (lbf.ft/lb)"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
specific_stiffness_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
specific_stiffness_values.append("Null")
else:
specific_stiffness_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Yield strength (elastic limit) (ksi)"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
yield_strength_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
yield_strength_values.append("Null")
else:
yield_strength_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Tensile strength (ksi)"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
tensile_strength_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
tensile_strength_values.append("Null")
else:
tensile_strength_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Specific strength (lbf.ft/lb)"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
specific_strength_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
specific_strength_values.append("Null")
else:
specific_strength_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Elongation (% strain)"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
elongation_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
elongation_values.append("Null")
else:
elongation_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Compressive strength (ksi)"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
compressive_strength_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
compressive_strength_values.append("Null")
else:
compressive_strength_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Flexural modulus (10^6 psi)"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
flexural_modulus_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
flexural_modulus_values.append("Null")
else:
flexural_modulus_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Flexural strength (modulus of rupture) (ksi)"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
flexural_strength_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
flexural_strength_values.append("Null")
else:
flexural_strength_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Shear modulus (10^6 psi)"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
shear_modulus_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
shear_modulus_values.append("Null")
else:
shear_modulus_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Bulk modulus (10^6 psi)"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
bulk_modulus_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
bulk_modulus_values.append("Null")
else:
bulk_modulus_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Poisson's ratio"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
poisson_ratio_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
poisson_ratio_values.append("Null")
else:
poisson_ratio_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Shape factor"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
shape_factor_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
shape_factor_values.append("Null")
else:
shape_factor_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Hardness - Vickers (HV)"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
hardness_vickers_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
hardness_vickers_values.append("Null")
else:
hardness_vickers_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Elastic stored energy (springs) (ft.lbf/in^3)"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
elastic_stored_energy_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
elastic_stored_energy_values.append("Null")
else:
elastic_stored_energy_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Fatigue strength at 10^7 cycles (ksi)"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
fatigue_strength_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
fatigue_strength_values.append("Null")
else:
fatigue_strength_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Fracture toughness (ksi.in^0.5)"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
fracture_toughness_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
fracture_toughness_values.append("Null")
else:
fracture_toughness_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Toughness (G) (ft.lbf/in^2)"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
toughness_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
toughness_values.append("Null")
else:
toughness_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Ductility index (mil)"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
ductility_index_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
ductility_index_values.append("Null")
else:
ductility_index_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Melting"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
melting_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
melting_values.append("Null")
else:
melting_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Maximum service temperature"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
max_service_temp_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
max_service_temp_values.append("Null")
else:
max_service_temp_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Minimum service temperature"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
min_service_temp_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
min_service_temp_values.append("Null")
else:
min_service_temp_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Thermal conductivity"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
therm_cond_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
therm_cond_values.append("Null")
else:
therm_cond_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Specific heat capacity"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
spec_heat_cap_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
spec_heat_cap_values.append("Null")
else:
spec_heat_cap_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Thermal expansion coefficient"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
therm_expan_coeff_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
therm_expan_coeff_values.append("Null")
else:
therm_expan_coeff_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Thermal shock resistance"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
therm_shock_resist_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
therm_shock_resist_values.append("Null")
else:
therm_shock_resist_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Thermal distortion resistance"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
therm_dist_resist_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
therm_dist_resist_values.append("Null")
else:
therm_dist_resist_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Latent heat of fusion"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
latent_heat_fusion_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
latent_heat_fusion_values.append("Null")
else:
latent_heat_fusion_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Electrical resistivity"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
elec_resist_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
elec_resist_values.append("Null")
else:
elec_resist_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Electrical conductivity"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
elec_cond_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
elec_cond_values.append("Null")
else:
elec_cond_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Galvanic potential"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
galvanic_potential_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
galvanic_potential_values.append("Null")
else:
galvanic_potential_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
elif line.startswith("Mechanical loss coefficient"):
for line_item in range(1, (len(line.split(",")) - 1)):
if " - " in line.split(",")[line_item].strip(" "):
left_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[0]
right_of_dash = line.split(",")[line_item].strip(" ").split(" - ")[1]
average_of_dash = (float(left_of_dash) + float(right_of_dash)) / 2
mech_loss_coeff_values.append(round(average_of_dash, 6))
elif line.split(",")[line_item] is '':
mech_loss_coeff_values.append("Null")
else:
mech_loss_coeff_values.append(round(float(line.split(",")[line_item].strip(" ")), 6))
#Brinell Hardness, Dielectric Constant, Dielectric Strength, Dissipation Factor, excluded because lacking way too much data (>10 rows of materials non-existent)
null_extender = ["Null"] * 18
material_name.extend(null_extender)
material_family.extend(null_extender)
return(material_name, material_family, young_modulus_values, specific_stiffness_values, yield_strength_values,
tensile_strength_values, specific_strength_values, elongation_values, compressive_strength_values,
flexural_modulus_values, flexural_strength_values, shear_modulus_values, bulk_modulus_values,
poisson_ratio_values, shape_factor_values, hardness_vickers_values,
elastic_stored_energy_values, fatigue_strength_values, fracture_toughness_values, toughness_values,
ductility_index_values, melting_values, max_service_temp_values, min_service_temp_values,
therm_cond_values, spec_heat_cap_values, therm_expan_coeff_values, therm_shock_resist_values, therm_dist_resist_values,
latent_heat_fusion_values, elec_resist_values, elec_cond_values, galvanic_potential_values, mech_loss_coeff_values)
def null_invalid_properties(frame: pd.DataFrame):
# This drops elements in our dataset which have invalid values for any of the following properties
# found to contain a salvagable amount of invalid data
COLUMNS_TO_SCRUB = [
"Tensile strength",
"Compressive strength",
"Flexural modulus",
"Flexural strength",
"Bulk modulus",
"Elastic stored energy",
"Fatigue strength",
"Fracture toughness",
"Toughness",
"Thermal expansion coefficient",
]
for c in COLUMNS_TO_SCRUB:
# They're all some kind of number between 40k and 50k
# with bias towards repeating values
frame[c].mask(frame[c].gt(40000), inplace=True)
# Be gingerly with this column because there's larger entries with valid values
frame["Thermal shock resistance"].mask(frame["Thermal shock resistance"].eq(47650), inplace=True)
frame["Fracture toughness"].mask(frame["Fracture toughness"].gt(12000), inplace=True)
def properties_dataframe_from_file(path: str):
property_lists = parsing_refined_data(path)
frame = pd.DataFrame(index=property_lists[0], data={
k: v for (k, v) in zip(COLUMN_NAMES, property_lists[1:])
})
frame.replace("Null", np.nan, inplace=True)
null_invalid_properties(frame)
return frame
if __name__ == "__main__":
parsing_material_data("C:/Users/Everet/Documents/AMP_Project/Pres_3/Updated_PCM.csv", "C:/Users/Everet/Documents/AMP_Project/Pres_3/new_TEM.csv")
material_name, material_family, young_modulus_values, specific_stiffness_values, yield_strength_values, tensile_strength_values, specific_strength_values, elongation_values, compressive_strength_values, flexural_modulus_values, flexural_strength_values, shear_modulus_values, bulk_modulus_values, poisson_ratio_values, shape_factor_values, hardness_vickers_values, elastic_stored_energy_values, fatigue_strength_values, fracture_toughness_values, toughness_values, ductility_index_values, melting_values, max_service_temp_values, min_service_temp_values, therm_cond_values, spec_heat_cap_values, therm_expan_coeff_values, therm_shock_resist_values, therm_dist_resist_values, latent_heat_fusion_values, elec_resist_values, elec_cond_values, galvanic_potential_values, mech_loss_coeff_values = parsing_refined_data("C:/Users/Everet/Documents/AMP_Project/Pres_3/new_TEM.csv")
print(len(material_name), len(material_family), len(young_modulus_values), len(specific_stiffness_values), len(yield_strength_values), len(tensile_strength_values))
print(material_name[0])
print(material_family[0])
print(material_family[-4])
print(set(material_family))
#print(len(specific_strength_values), len(elongation_values), len(compressive_strength_values), len(flexural_modulus_values), len(flexural_strength_values))
#print(len(shear_modulus_values), len(bulk_modulus_values), len(poisson_ratio_values), len(shape_factor_values), len(hardness_vickers_values))
#print(len(elastic_stored_energy_values), len(fatigue_strength_values), len(fracture_toughness_values), len(toughness_values), len(ductility_index_values))
#print(len(melting_values), len(max_service_temp_values), len(min_service_temp_values), len(therm_cond_values), len(spec_heat_cap_values))
#print(len(therm_expan_coeff_values), len(therm_shock_resist_values), len(therm_dist_resist_values), len(latent_heat_fusion_values), len(elec_resist_values))
#print(len(elec_cond_values), len(galvanic_potential_values), len(mech_loss_coeff_values))
#33 properties total
| 64.144128 | 876 | 0.549974 | 4,025 | 36,049 | 4.630311 | 0.066832 | 0.084134 | 0.113001 | 0.147771 | 0.782315 | 0.721897 | 0.685464 | 0.678435 | 0.671997 | 0.663626 | 0 | 0.011266 | 0.305612 | 36,049 | 561 | 877 | 64.258467 | 0.733261 | 0.046742 | 0 | 0.513258 | 0 | 0 | 0.089159 | 0.005008 | 0 | 0 | 0 | 0 | 0 | 1 | 0.007576 | false | 0 | 0.005682 | 0 | 0.015152 | 0.00947 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
6717e4180d1e8ee347b61381ab9e2577fd23408e | 1,985 | py | Python | reentry/abcbackend.py | ltalirz/reentry | a48ee68b5e6ca4c0da768b7f5b62b61f24c8f15c | [
"MIT"
] | null | null | null | reentry/abcbackend.py | ltalirz/reentry | a48ee68b5e6ca4c0da768b7f5b62b61f24c8f15c | [
"MIT"
] | null | null | null | reentry/abcbackend.py | ltalirz/reentry | a48ee68b5e6ca4c0da768b7f5b62b61f24c8f15c | [
"MIT"
] | null | null | null | # -*- coding: utf8 -*-
from abc import ABCMeta, abstractmethod
class BackendInterface(object):
__metaclass__ = ABCMeta
"""
Backend interface
"""
def get_map(self, dist=None, group=None, name=None):
"""
get a map of entry points, filtered by
:param dist: distribution name
:param groups: single group name or sequence of group names
:param name: entry point name or sequence of names
The map is structured as follows::
map = {
'<group>': {
'<entrypoint name>: <EntryPoint instance>
...
},
...
},
"""
def iter_group(self, group):
"""
returns a list of entry points for the given group name
"""
def get_group_names(self):
"""
returns a list of group names
"""
def get_dist_names(self):
"""
returns a list of distribution names
"""
def get_dist_map(self, dist):
"""
returns a map {group:[entry_points, ...], ...} for the given dist name
"""
def write_pr_dist(self, dist):
"""
add a distribution, empty by default
"""
def write_st_dist(self, dist):
"""
add a distribution during it's installation
"""
def write_dist(self, distname):
"""
take a distribution's project name, add the distribution
"""
dist = self.pr_dist_from_name(distname)
self.write_pr_dist(dist)
def rm_dist(self, distname):
"""
removes a distribution completely
"""
def pr_dist_map(self, dist):
dname = dist.project_name
epmap = dist.get_entry_map()
return dname, epmap
def pr_dist_from_name(self, distname):
from pkg_resources import get_distribution
dist = get_distribution(distname)
return dist
| 24.506173 | 78 | 0.541058 | 219 | 1,985 | 4.744292 | 0.310502 | 0.038499 | 0.031761 | 0.040423 | 0.14052 | 0.098171 | 0 | 0 | 0 | 0 | 0 | 0.000793 | 0.364736 | 1,985 | 80 | 79 | 24.8125 | 0.823156 | 0.384383 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0.090909 | 0 | 0.772727 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
671d7c38bad213e61e88d680efa6ac298902a281 | 232 | py | Python | w/config/__init__.py | propername/w | bbf253b5f2428e4ee1580140dca15331b8355da2 | [
"CC0-1.0"
] | null | null | null | w/config/__init__.py | propername/w | bbf253b5f2428e4ee1580140dca15331b8355da2 | [
"CC0-1.0"
] | null | null | null | w/config/__init__.py | propername/w | bbf253b5f2428e4ee1580140dca15331b8355da2 | [
"CC0-1.0"
] | null | null | null | import os
from functools import partial
from w.lib import root, get, put, env, var
root = partial(root, os.path.abspath(__file__))
get = partial(get, root=root)
put = partial(put, root=root)
env = partial(env, get=get, root=root)
| 23.2 | 47 | 0.728448 | 39 | 232 | 4.230769 | 0.384615 | 0.145455 | 0.133333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142241 | 232 | 9 | 48 | 25.777778 | 0.829146 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.428571 | 0 | 0.428571 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
6722378a707aab0ca4b5ce0fa6f84e1a2c166a3c | 409 | py | Python | settings_files/gamess_fmo3.py | tommason14/monash2018 | 8fc2de97172130ed5d532deb6f5bcca39ef3a6e3 | [
"MIT"
] | 7 | 2020-06-05T01:55:09.000Z | 2021-12-20T19:32:36.000Z | settings_files/gamess_fmo3.py | tommason14/monash2018 | 8fc2de97172130ed5d532deb6f5bcca39ef3a6e3 | [
"MIT"
] | null | null | null | settings_files/gamess_fmo3.py | tommason14/monash2018 | 8fc2de97172130ed5d532deb6f5bcca39ef3a6e3 | [
"MIT"
] | 8 | 2020-06-06T10:03:17.000Z | 2022-03-18T14:47:33.000Z | from autochem import Settings
sett=Settings()
sett.input.contrl.runtyp='energy'
sett.input.basis.gbasis='cct'
sett.input.mp2.scsopo=1.64
sett.input.fmo.nbody=3
# trimer cutoffs giving < 2 kJ/mol error cf. full system
sett.input.fmo.ritrim='1.77,1.77,1.77,1.77'
| 40.9 | 56 | 0.486553 | 49 | 409 | 4.061224 | 0.632653 | 0.226131 | 0.060302 | 0.090452 | 0.060302 | 0.060302 | 0 | 0 | 0 | 0 | 0 | 0.075 | 0.413203 | 409 | 9 | 57 | 45.444444 | 0.754167 | 0.132029 | 0 | 0 | 0 | 0 | 0.07932 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.142857 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
67386775f635bb4de8f4754356c299b4f5bd2315 | 243 | py | Python | setup.py | kageurufu/cfddns-py | 114aa528efdf11ef24e8d1d64e31e8948edd99d9 | [
"MIT"
] | null | null | null | setup.py | kageurufu/cfddns-py | 114aa528efdf11ef24e8d1d64e31e8948edd99d9 | [
"MIT"
] | null | null | null | setup.py | kageurufu/cfddns-py | 114aa528efdf11ef24e8d1d64e31e8948edd99d9 | [
"MIT"
] | null | null | null | from setuptools import setup, find_packages
setup(
name="cfddns",
version="0.1",
packages=['cfddns'],
entry_points={
'console_scripts': ["cfddns = cfddns:main"],
},
install_requires=["cloudflare", "pyyaml"],
)
| 20.25 | 52 | 0.621399 | 25 | 243 | 5.88 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010417 | 0.209877 | 243 | 11 | 53 | 22.090909 | 0.755208 | 0 | 0 | 0 | 0 | 0 | 0.271605 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.1 | 0 | 0.1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
6739c107daf302855c39f9e4b73a58268ecf8122 | 24,374 | py | Python | test/test_common_config.py | jjfallete/cb-taxii-connector | 31b42c8ea46d14f2af63788a8ffada0c998bdb46 | [
"MIT"
] | 16 | 2015-09-21T18:22:00.000Z | 2021-11-04T11:16:12.000Z | test/test_common_config.py | jjfallete/cb-taxii-connector | 31b42c8ea46d14f2af63788a8ffada0c998bdb46 | [
"MIT"
] | 20 | 2016-02-09T20:44:35.000Z | 2022-03-28T20:48:09.000Z | test/test_common_config.py | jjfallete/cb-taxii-connector | 31b42c8ea46d14f2af63788a8ffada0c998bdb46 | [
"MIT"
] | 9 | 2015-09-28T08:12:23.000Z | 2022-03-28T20:09:12.000Z | # coding: utf-8
# Copyright © 2014-2020 VMware, Inc. All Rights Reserved.
################################################################################
from unittest import TestCase, mock
from cbopensource.utilities.common_config import BoolConfigOption, CertConfigOption, CommaDelimitedListConfigOption, \
CommonConfigException, IntConfigOption, PairedConfigOption, StringConfigOption
class TestConfig(TestCase):
def test_01a_boolean_valid(self):
"""
Ensure that simple BoolConfigOption works as expected.
"""
# set of tests and expected results
checks = [("True", True), ("TRUE", True), ("true", True),
("False", False), ("FALSE", False), ("false", False)
]
problems = []
for item in checks:
try:
config = {'check': item[0]}
test = BoolConfigOption("check").parse_from_dict(config)
if item[1] != test:
problems.append(f"Value `{item[0]}` did not convert to the expected `{item[1]}`")
except CommonConfigException as err:
problems.append(f"{err}")
assert len(problems) == 0, "There were problems seen:\n " + " \n".join(problems)
def test_01b_boolean_bogus(self):
"""
Ensure that bogus boolean values are caught.
"""
try:
config = {'check': "BOGUS"}
BoolConfigOption("check").parse_from_dict(config)
self.fail("Did not trap bogus value for boolean")
except CommonConfigException as err:
assert "Only case-insensitive values of 'true' or 'false'" in str(err)
def test_01c_boolean_missing(self):
"""
By default, boolean value are required.
"""
try:
config = {}
BoolConfigOption("check").parse_from_dict(config)
self.fail("Did not trap missing value for boolean")
except CommonConfigException as err:
assert "Configuration key 'check' is required" in str(err)
def test_01d_boolean_missing_not_required_default(self):
"""
Ensure that a specified default value is used if the parameter is not suppled.
"""
config = {}
test = BoolConfigOption("check", required=False).parse_from_dict(config)
self.assertIsNone(test)
def test_01e_boolean_missing_not_required_default_specified(self):
"""
Ensure that a specified default value is used if the parameter is not suppled.
"""
config = {}
test = BoolConfigOption("check", required=False, default=True).parse_from_dict(config)
self.assertTrue(test)
def test_02a_int(self):
"""
Ensure that simple IntConfigOption works as expected.
"""
config = {"check": "42"}
test = IntConfigOption("check").parse_from_dict(config)
self.assertEqual(test, 42)
def test_02b_int_bogus(self):
"""
Ensure that bogus int values are caught.
"""
try:
config = {'check': "BOGUS"}
IntConfigOption("check").parse_from_dict(config)
self.fail("Did not trap bogus value for int")
except CommonConfigException as err:
assert "Problem with configuration key 'check': invalid literal for int()" in str(err)
def test_02c_int_bogus_float(self):
"""
Ensure that bogus int values are caught.
"""
try:
config = {'check': "4.5"}
IntConfigOption("check").parse_from_dict(config)
self.fail("Did not trap bogus value for int")
except CommonConfigException as err:
assert "roblem with configuration key 'check': invalid literal for int()" in str(err)
def test_02d_int_missing(self):
"""
By default, int value are required.
"""
try:
config = {}
IntConfigOption("check").parse_from_dict(config)
self.fail("Did not trap missing value for int")
except CommonConfigException as err:
assert "Configuration key 'check' is required" in str(err)
def test_02e_int_missing_not_required_default(self):
"""
Ensure that a specified default value is used if the parameter is not suppled.
"""
config = {}
test = IntConfigOption("check", required=False).parse_from_dict(config)
self.assertIsNone(test)
def test_02f_int_missing_not_required_default_specified(self):
"""
Ensure that a specified default value is used if the parameter is not suppled.
"""
config = {}
test = IntConfigOption("check", required=False, default=42).parse_from_dict(config)
self.assertEqual(test, 42)
def test_02g_int_at_specified_min(self):
"""
Ensure that an int at the specified min is ok.
"""
config = {'check': '3'}
test = IntConfigOption("check", min_value=3).parse_from_dict(config)
self.assertEqual(test, 3)
def test_02h_int_outside_specified_min(self):
"""
Ensure that values outside the specified minimum are trapped.
"""
try:
config = {"check": "1"}
IntConfigOption("check", min_value=10).parse_from_dict(config)
self.fail("Did not trap outside value for int")
except CommonConfigException as err:
assert "'check' must be between 10 and 100" in str(err)
def test_02i_int_at_specified_max(self):
"""
Ensure that an int at the specified max is ok.
"""
config = {'check': '90'}
test = IntConfigOption("check", max_value=90).parse_from_dict(config)
self.assertEqual(test, 90)
def test_02j_int_outside_specified_max(self):
"""
Ensure that values outside the specified maximum are trapped.
"""
try:
config = {"check": "100"}
IntConfigOption("check", max_value=95).parse_from_dict(config)
self.fail("Did not trap outside value for int")
except CommonConfigException as err:
assert "'check' must be between 0 and 95 (got 100)" in str(err)
def test_03a_string(self):
"""
Ensure that simple StringConfigOption works as expected.
"""
config = {"check": "Okay"}
test = StringConfigOption("check").parse_from_dict(config)
self.assertEqual(test, "Okay")
def test_03b_string_missing(self):
"""
By default, string value are required.
"""
try:
config = {}
StringConfigOption("check").parse_from_dict(config)
self.fail("Did not trap missing value for str")
except CommonConfigException as err:
assert "Configuration key 'check' is required" in str(err)
def test_03c_string_missing_not_required_default(self):
"""
Ensure that a specified default value is used if the parameter is not suppled.
"""
config = {}
test = StringConfigOption("check", required=False).parse_from_dict(config)
self.assertIsNone(test)
def test_03d_string_missing_not_required_default_specified(self):
"""
Ensure that a specified default value is used if the parameter is not suppled.
"""
config = {}
test = StringConfigOption("check", required=False, default="Huh?").parse_from_dict(config)
self.assertEqual(test, "Huh?")
def test_03e_string_in_allowed_values(self):
"""
Ensure that allowed values are accepted (as is).
"""
config = {"check": "Alpha"}
test = StringConfigOption("check", allowed_values=["Alpha", "Beta", "Gamma"]).parse_from_dict(config)
self.assertEqual(test, "Alpha")
def test_03f_string_in_allowed_values_bad_case(self):
"""
Ensure that allowed values are accepted (as is).
"""
config = {"check": "ALPHA"}
try:
StringConfigOption("check", allowed_values=["Alpha", "Beta", "Gamma"]).parse_from_dict(config)
self.fail("Did not trap incorrect case value for str")
except CommonConfigException as err:
assert "Configuration key 'check' must be in allowed values" in str(err)
def test_03g_string_to_upper(self):
"""
Ensure that if to_upper=True, the resulting string is uppercased.
"""
config = {"check": "Alpha"}
test = StringConfigOption("check", to_upper=True).parse_from_dict(config)
self.assertEqual(test, "ALPHA")
def test_03h_string_hidden(self):
"""
Ensure that if hidden=True, the string
"""
config = {"check": "Alpha"}
test = StringConfigOption("check", to_upper=True).parse_from_dict(config)
self.assertEqual(test, "ALPHA")
def test_03i_string_at_min_size(self):
"""
Ensure that strings at a noted minimum size are ok
"""
config = {"check": "Alpha"}
test = StringConfigOption("check", min_len=5).parse_from_dict(config)
self.assertEqual(test, "Alpha")
def test_03j_string_below_minimum_size(self):
"""
Ensure that StringConfigOption below minimum size is trapped.
"""
config = {"check": "Alpha"}
try:
StringConfigOption("check", min_len=10).parse_from_dict(config)
self.fail("Did not trap size check")
except CommonConfigException as err:
assert "'check' - String length 5 does not meet minimum length of 10" in str(err)
def test_03k_string_at_maximum_size(self):
"""
Ensure that strings at a noted maximum size are ok
"""
config = {"check": "Alpha"}
test = StringConfigOption("check", max_len=5).parse_from_dict(config)
self.assertEqual(test, "Alpha")
def test_03l_string_above_maximum_size(self):
"""
Ensure that StringConfigOption above maximum size is trapped.
"""
config = {"check": "Alpha"}
try:
StringConfigOption("check", max_len=3).parse_from_dict(config)
self.fail("Did not trap size check")
except CommonConfigException as err:
assert "'check' - String length 5 exceeds maxmimum length of 3" in str(err)
def test_03m_string__max_and_min_specified_too_small(self):
"""
Ensure that StringConfigOption outside size scope maximum size is trapped and proper message returned
when both max and min are specified
"""
config = {"check": "Alpha"}
try:
StringConfigOption("check", min_len=6, max_len=10).parse_from_dict(config)
self.fail("Did not trap size check")
except CommonConfigException as err:
assert "'check' - String length 5 not in bounds 6 -> 10" in str(err)
def test_03n_string__max_and_min_specified_too_large(self):
"""
Ensure that StringConfigOption outside size scope maximum size is trapped and proper message returned
when both max and min are specified
"""
config = {"check": "Alpha"}
try:
StringConfigOption("check", min_len=1, max_len=3).parse_from_dict(config)
self.fail("Did not trap size check")
except CommonConfigException as err:
assert "'check' - String length 5 not in bounds 1 -> 3" in str(err)
def test_04a_paired(self):
"""
Ensure that PairedConfigOption works as expected with no problems.
"""
config = {"user": "alpha", "pass": "beta"}
check = PairedConfigOption(StringConfigOption('user', required=False), 'pass').parse_from_dict(config)
self.assertEqual(check, "alpha")
def test_04b_paired_missing_requirment(self):
"""
Ensure that PairedConfigOption traps problems when a requirement is missing.
"""
config = {"user": "alpha"}
try:
PairedConfigOption(StringConfigOption('user', required=False), 'pass').parse_from_dict(config)
self.fail("Did not trap missing requirment")
except CommonConfigException as err:
assert "'pass' is required when 'user' is specified" in str(err)
def test_04c_paired_requirement_empty_string(self):
"""
Ensure that PairedConfigOption works as expected with no problems if the requirement is specified with an
empty string (it has been defined)
"""
config = {"user": "alpha", "pass": ""}
check = PairedConfigOption(StringConfigOption('user', required=False), 'pass').parse_from_dict(config)
self.assertEqual(check, "alpha")
def test_04d_paired_requirement_empty_string_with_required_primary(self):
"""
Ensure that PairedConfigOption works as expected with no problems if the requirement is specified with an
empty string (it has been defined)
"""
config = {"user": "alpha", "pass": ""}
check = PairedConfigOption(StringConfigOption('user', required=True), 'pass').parse_from_dict(config)
self.assertEqual(check, "alpha")
def test_04e_paired_requirement_empty_string_with_required_primary(self):
"""
Ensure that PairedConfigOption works as expected with no problems if the requirement is specified with an
empty string (it has been defined)
"""
config = {"pass": "beta"}
check = PairedConfigOption(StringConfigOption('user', required=False), 'pass').parse_from_dict(config)
self.assertIsNone(check)
def test_05a_comma_delimited(self):
"""
Ensure that CommaDelimitedListConfigOption works as expected.
"""
config = {"check": "alpha, beta, gamma, delta"}
test = CommaDelimitedListConfigOption("check").parse_from_dict(config)
self.assertListEqual(test, ['alpha', 'beta', 'delta', 'gamma'])
def test_05b_comma_delimited_no_sort(self):
"""
Ensure that CommaDelimitedListConfigOption works as expected with sorting disabled.
"""
config = {"check": "alpha, beta, gamma, delta"}
test = CommaDelimitedListConfigOption("check", sort_list=False).parse_from_dict(config)
self.assertListEqual(test, ['alpha', 'beta', 'gamma', 'delta'])
def test_05c_comma_delimited_list_minimum_size(self):
"""
Ensure that CommaDelimitedListConfigOption minimum size is ok.
"""
config = {"check": "alpha, beta, gamma"}
test = CommaDelimitedListConfigOption("check", min_len=3).parse_from_dict(config)
self.assertListEqual(test, ['alpha', 'beta', 'gamma'])
def test_05d_comma_delimited_list_below_minimum_size(self):
"""
Ensure that CommaDelimitedListConfigOption below minimum size is trapped.
"""
config = {"check": "alpha, beta, gamma"}
try:
CommaDelimitedListConfigOption("check", min_len=4).parse_from_dict(config)
self.fail("Did not trap missing requirment")
except CommonConfigException as err:
assert "'check' - List length 3 does not meet minimum length of 4" in str(err)
def test_05e_comma_delimited_list_maximum_size(self):
"""
Ensure that CommaDelimitedListConfigOption maximum size is ok.
"""
config = {"check": "alpha, beta, gamma"}
test = CommaDelimitedListConfigOption("check", max_len=3).parse_from_dict(config)
self.assertListEqual(test, ['alpha', 'beta', 'gamma'])
def test_05f_comma_delimited_list_below_minimim_size(self):
"""
Ensure that CommaDelimitedListConfigOption over maximum size is trapped.
"""
config = {"check": "alpha, beta, gamma"}
try:
CommaDelimitedListConfigOption("check", max_len=2).parse_from_dict(config)
self.fail("Did not trap missing requirment")
except CommonConfigException as err:
assert "'check' - List length 3 exceeds maxmimum length of 2" in str(err)
def test_05f_comma_delimited_max_and_min_specified_too_small(self):
"""
Ensure that CommaDelimitedListConfigOption under minimum size is trapped, and proper message when
both sizes are specified.
"""
config = {"check": "alpha, beta, gamma, delta, eta"}
try:
CommaDelimitedListConfigOption("check", min_len=10, max_len=40).parse_from_dict(config)
self.fail("Did not trap missing requirment")
except CommonConfigException as err:
assert "'check' - List length 5 not in bounds 10 -> 40" in str(err)
def test_05g_comma_delimited_max_and_min_specified_too_large(self):
"""
Ensure that CommaDelimitedListConfigOption over maximum size is trapped, and proper message when
both sizes are specified.
"""
config = {"check": "alpha, beta, gamma, delta, eta"}
try:
CommaDelimitedListConfigOption("check", min_len=1, max_len=3).parse_from_dict(config)
self.fail("Did not trap missing requirment")
except CommonConfigException as err:
assert "'check' - List length 5 not in bounds 1 -> 3" in str(err)
def test_05h_comma_delimited_list_accepted_values(self):
"""
Ensure that CommaDelimitedListConfigOption accepted values work.
"""
accepted = ['alpha', 'beta', 'gamma', 'delta']
config = {"check": "alpha, beta, gamma"}
test = CommaDelimitedListConfigOption("check", accepted_values=accepted).parse_from_dict(config)
self.assertListEqual(test, ['alpha', 'beta', 'gamma'])
def test_05i_comma_delimited_list_accepted_values_bad_value(self):
"""
Ensure that CommaDelimitedListConfigOption over maximum size is trapped, and proper message when
both sizes are specified.
"""
accepted = ['alpha', 'beta', 'gamma', 'delta']
config = {"check": "alpha, beta, foobar"}
try:
CommaDelimitedListConfigOption("check", accepted_values=accepted).parse_from_dict(config)
self.fail("Did not trap bad entry")
except CommonConfigException as err:
assert "'check' - Acceptable values (case insensitive) are: ['alpha', 'beta', 'delta', 'gamma']" in str(err)
def test_05i_comma_delimited_validate_trim(self):
"""
Ensure that CommaDelimitedListConfigOption string entries are trimmed.
"""
config = {"check": " alpha, beta ,gamma "}
test = CommaDelimitedListConfigOption("check").parse_from_dict(config)
self.assertListEqual(test, ['alpha', 'beta', 'gamma'])
def test_05j_comma_delimited_to_upper(self):
"""
Ensure that CommaDelimitedListConfigOption with to_upper are properly uppercased.
"""
config = {"check": "alpha, beta, gamma"}
test = CommaDelimitedListConfigOption("check", to_upper=True).parse_from_dict(config)
self.assertListEqual(test, ['ALPHA', 'BETA', 'GAMMA'])
def test_05k_comma_delimited_list_unique(self):
"""
Ensure that CommaDelimitedListConfigOption unique setting is allowed.
"""
config = {"check": "alpha, beta, gamma"}
test = CommaDelimitedListConfigOption("check", unique=True).parse_from_dict(config)
self.assertListEqual(test, ['alpha', 'beta', 'gamma'])
def test_05l_comma_delimited_list_unique_with_duplicates(self):
"""
Ensure that CommaDelimitedListConfigOption with unique specified catches duplicates.
"""
config = {"check": "alpha, beta, alpha"}
try:
CommaDelimitedListConfigOption("check", unique=True).parse_from_dict(config)
self.fail("Did not trap bad entry")
except CommonConfigException as err:
assert "'check' - List entries must be unique" in str(err)
def test_06a_cert_unspecified(self):
"""
Ensure that CertConfigOption allows unspecified values.
"""
config = {}
test = CertConfigOption().parse_from_dict(config)
self.assertIsNone(test)
@mock.patch("cbopensource.driver.taxii_server_config.os.path.exists")
def test_06b_cert_only_cert_path_default_key(self, os_path_exists):
"""
Ensure that CertConfigOption with single source returns cert path.
"""
os_path_exists.return_value = True
config = {"cert": "/path/to/cert.pem"}
test = CertConfigOption().parse_from_dict(config)
self.assertEqual(test, "/path/to/cert.pem")
@mock.patch("cbopensource.driver.taxii_server_config.os.path.exists")
def test_06c_cert_only_cert_path_specified_key(self, os_path_exists):
"""
Ensure that CertConfigOption with single source returns cert path.
"""
os_path_exists.return_value = True
config = {"my-cert": "/path/to/cert.pem"}
test = CertConfigOption("my-cert").parse_from_dict(config)
self.assertEqual(test, "/path/to/cert.pem")
@mock.patch("os.path.exists")
def test_06d_cert_only_cert_path_not_exists(self, os_path_exists_mock):
"""
Ensure that CertConfigOption with single source returns cert path.
"""
config = {"cert": "./does-not-exist.pem"}
os_path_exists_mock.return_value = False
try:
CertConfigOption().parse_from_dict(config)
self.fail("Did not trap missing cert")
except CommonConfigException as err:
assert "'cert' path to cert+key pair does not exist" in str(err)
@mock.patch("cbopensource.driver.taxii_server_config.os.path.exists")
def test_06e_cert_both_paths_specified(self, os_path_exists):
"""
Ensure that CertConfigOption with multiple source returns cert and key path.
"""
os_path_exists.return_value = True
config = {"cert": "/path/to/cert.pem, /path/to/key.pem"}
test = CertConfigOption("cert").parse_from_dict(config)
self.assertTupleEqual(test, ("/path/to/cert.pem", "/path/to/key.pem"))
@mock.patch("os.path.exists")
def test_06f_cert_both_paths_specified_cert_missing(self, os_path_exists_mock):
"""
Ensure that CertConfigOption with both sources traps missing cert.
"""
config = {"cert": f"./does_not_exist.py, {__file__}"}
os_path_exists_mock.return_value = False
try:
CertConfigOption().parse_from_dict(config)
self.fail("Did not trap missing cert")
except CommonConfigException as err:
assert "'cert' cert path './does_not_exist.py' does not exist!" in str(err)
@mock.patch("os.path.exists")
def test_06g_cert_both_paths_specified_key_missing(self, os_path_exists_mock):
os_path_exists_mock.side_effect = [True, False]
"""
Ensure that CertConfigOption with both sources traps missing key.
"""
config = {"cert": f"{__file__}, ./does_not_exist.py"}
try:
CertConfigOption().parse_from_dict(config)
self.fail("Did not trap missing key")
except CommonConfigException as err:
assert "'cert' key path './does_not_exist.py' does not exist!" in str(err)
def test_06h_cert_empty_string(self):
"""
Ensure that CertConfigOption with empty string is detected.
"""
config = {"cert": ""}
try:
CertConfigOption().parse_from_dict(config)
self.fail("Did not trap missing cert")
except CommonConfigException as err:
assert "'cert' must be specified as the path to a .pem encoded" in str(err)
@mock.patch("cbopensource.driver.taxii_server_config.os.path.exists")
def test_06i_cert_three_entries(self, os_path_exists):
"""
Ensure that CertConfigOption with three cert entries.
"""
os_path_exists.return_value = True
config = {"cert": "/path/to/cert.pem, /path/to/key.pem, /path/to/cert.pem"}
try:
CertConfigOption().parse_from_dict(config)
self.fail("Did not trap missing cert")
except CommonConfigException as err:
assert "'cert' must be specified as the path to a .pem encoded" in str(err)
| 42.024138 | 120 | 0.633749 | 2,803 | 24,374 | 5.326436 | 0.103817 | 0.026725 | 0.049632 | 0.072539 | 0.793302 | 0.735298 | 0.70221 | 0.663764 | 0.620563 | 0.565506 | 0 | 0.01164 | 0.259785 | 24,374 | 579 | 121 | 42.096718 | 0.815819 | 0.170386 | 0 | 0.498499 | 0 | 0.006006 | 0.202385 | 0.013799 | 0 | 0 | 0 | 0 | 0.171171 | 1 | 0.171171 | false | 0.03003 | 0.006006 | 0 | 0.18018 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
673f075bf3797ab9d773d8f717ae2592b6488351 | 154 | py | Python | chapter16/example/example11.py | YordanIH/Intro_to_CS_w_Python | eebbb8efd7ef0d07be9bc45b6b1e8f20737ce01a | [
"MIT"
] | null | null | null | chapter16/example/example11.py | YordanIH/Intro_to_CS_w_Python | eebbb8efd7ef0d07be9bc45b6b1e8f20737ce01a | [
"MIT"
] | null | null | null | chapter16/example/example11.py | YordanIH/Intro_to_CS_w_Python | eebbb8efd7ef0d07be9bc45b6b1e8f20737ce01a | [
"MIT"
] | null | null | null | import tkinter
window = tkinter.Tk()
button = tkinter.Button(window, text='Hello', font=('Courier', 14, 'bold italic'))
button.pack()
window.mainloop()
| 19.25 | 82 | 0.707792 | 20 | 154 | 5.45 | 0.7 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014599 | 0.11039 | 154 | 7 | 83 | 22 | 0.781022 | 0 | 0 | 0 | 0 | 0 | 0.150327 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
675c4de5138fb27c799c70749082f84d86b3d109 | 589 | py | Python | pypro/base/tests/test_home.py | wosubtil/curso-django | 4673e71fbbec062c74dfaf866ff13b81383e3fcc | [
"MIT"
] | null | null | null | pypro/base/tests/test_home.py | wosubtil/curso-django | 4673e71fbbec062c74dfaf866ff13b81383e3fcc | [
"MIT"
] | 806 | 2020-09-18T11:26:48.000Z | 2022-03-31T00:43:46.000Z | pypro/base/tests/test_home.py | wosubtil/curso-django | 4673e71fbbec062c74dfaf866ff13b81383e3fcc | [
"MIT"
] | null | null | null | import pytest
# from django.test import Client
from django.urls import reverse
from pypro.django_assertions import assert_contains
@pytest.fixture
def resp(client, db):
response = client.get(reverse('base:home'))
return response
def test_status_code(resp):
assert resp.status_code == 200
def test_title(resp):
assert_contains(resp, '<title>Python Pro - Home</title>')
def test_home_link(resp):
assert_contains(resp, f'href="{reverse("base:home")}">Python Pro</a>')
def test_email_link(resp):
assert_contains(resp, 'href="mailto:contato@contato.com.br"')
| 21.035714 | 74 | 0.733447 | 85 | 589 | 4.929412 | 0.423529 | 0.133652 | 0.128878 | 0.157518 | 0.124105 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005906 | 0.137521 | 589 | 27 | 75 | 21.814815 | 0.818898 | 0.050934 | 0 | 0 | 0 | 0 | 0.217235 | 0.129264 | 0 | 0 | 0 | 0 | 0.333333 | 1 | 0.333333 | false | 0 | 0.2 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
676a0df6fcd1fa6fb9f5584a162e478171ebf985 | 734 | py | Python | tests/test_application.py | public-transport-quality-grades/backend | 4662747d6029698f9edecae3c1b86b39b991e969 | [
"MIT"
] | null | null | null | tests/test_application.py | public-transport-quality-grades/backend | 4662747d6029698f9edecae3c1b86b39b991e969 | [
"MIT"
] | null | null | null | tests/test_application.py | public-transport-quality-grades/backend | 4662747d6029698f9edecae3c1b86b39b991e969 | [
"MIT"
] | null | null | null | import pytest
from .context import backend
@pytest.fixture
def test_client():
return backend.app.test_client()
def test_available_days(test_client):
response = test_client.get('/api/typesOfDays')
assert response.status_code == 200
def test_available_gradings_filtered(test_client):
response = test_client.get('/api/gradings?typeOfDay=Saturday')
assert response.status_code == 200
def test_available_gradings_filtered_nonexistent(test_client):
response = test_client.get('/api/gradings?typeOfDay=Missing')
assert response.status_code == 404
def test_available_gradings_filtered_missing_argument(test_client):
response = test_client.get('/api/gradings')
assert response.status_code == 400
| 25.310345 | 67 | 0.776567 | 94 | 734 | 5.765957 | 0.319149 | 0.184502 | 0.118081 | 0.162362 | 0.605166 | 0.546125 | 0.546125 | 0.483395 | 0.405904 | 0.217712 | 0 | 0.01875 | 0.128065 | 734 | 28 | 68 | 26.214286 | 0.828125 | 0 | 0 | 0.117647 | 0 | 0 | 0.125341 | 0.085831 | 0 | 0 | 0 | 0 | 0.235294 | 1 | 0.294118 | false | 0 | 0.117647 | 0.058824 | 0.470588 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
676c3f18a10ad5708c3df0d1fa39a7726654caf0 | 266 | py | Python | 3_diena/saraksts_cipari.py | jk-prog-22/nodarbibas | 6a74a40f663a610064e4f909ef5e21295092a3b3 | [
"MIT"
] | null | null | null | 3_diena/saraksts_cipari.py | jk-prog-22/nodarbibas | 6a74a40f663a610064e4f909ef5e21295092a3b3 | [
"MIT"
] | null | null | null | 3_diena/saraksts_cipari.py | jk-prog-22/nodarbibas | 6a74a40f663a610064e4f909ef5e21295092a3b3 | [
"MIT"
] | null | null | null | skaitli = [1, 5, 3, 9, 7, 11, 4]
skaitli2 = [5, 8, 12, 77, 44, 13]
print(skaitli)
print(skaitli[4])
sajauts_saraksts = ["Maris", 1, 2, 3, "Liepa", ["burkani", 12]]
print(sajauts_saraksts)
skaitli_kopa = skaitli + skaitli2
skaitli_kopa.sort()
print(skaitli_kopa) | 19 | 63 | 0.665414 | 42 | 266 | 4.095238 | 0.547619 | 0.209302 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.115044 | 0.150376 | 266 | 14 | 64 | 19 | 0.646018 | 0 | 0 | 0 | 0 | 0 | 0.06367 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.444444 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
676fc4a39d5e1917b6a1abbec5ee45d31b2bc973 | 3,174 | py | Python | dj_request_correlation/middleware.py | cdcarter/dj-request-correlation | 025bbefcfc9216d2225789c3a726e610f52e2887 | [
"MIT"
] | null | null | null | dj_request_correlation/middleware.py | cdcarter/dj-request-correlation | 025bbefcfc9216d2225789c3a726e610f52e2887 | [
"MIT"
] | null | null | null | dj_request_correlation/middleware.py | cdcarter/dj-request-correlation | 025bbefcfc9216d2225789c3a726e610f52e2887 | [
"MIT"
] | null | null | null | """ most of dj-request-correlation is django MIDDLEWARE classes
we use "new" (its been this way for a looong time) style MIDDLEWARE
"""
import uuid
import logging
from typing import Callable
from django.conf import settings
from django.http.request import HttpRequest
from django.http.response import HttpResponse
from . import current_request_id
from .utils import ClassBasedMiddleware, logfmt
from .tracker import RequestTracker
request_id_header: str = getattr(settings, "REQUEST_ID_HEADER", "X-Request-Id")
def get_request_id(request: HttpRequest, default: Callable = None) -> str:
"""
Get the request ID from the configrued HTTP header, or generate one.
We attempt to take the header from the HTTP request, and if there isn't one,
generate one by calling `default`."""
# we need to turn the HTTP Header string into the nonsense that WSGI uses
# in order to retrieve the header from the django request META object.
meta_header = "HTTP_" + request_id_header.replace("-", "_").upper()
return request.META.get(meta_header, default())
class RequestIDMiddleware(ClassBasedMiddleware):
""" RequestIDMiddleware assigns a request ID to every HTTP request
as `request.request_id` for correlation across services and logs.
Defaults to configurations for Heroku's `X-Request-ID` correlation header,
which is probably the closest there is to a standard. Override the REQUEST_ID_HEADER
setting to specify a custom header.
The request ID is added to the HttpRequest object for other code to use and
be aware of it. It's also stored in a ContextVar for when you need to access the
current request id without passsing it around, like in the logger.
This should be your VERY first middleware, so that even if a request is denied by
the SecurityMiddleware, you can correlate it with the router logs."""
def __call__(self, request: HttpRequest) -> HttpResponse:
req_id = get_request_id(request, uuid.uuid4)
# set the request ID in a thread local ContextVar and the current request.
current_request_id.set(req_id)
request.request_id = req_id
# run the view and the rest of the middleware chain
response = super().__call__(request=request)
# include the request ID (in the same header) in the response
response[request_id_header] = req_id
return response
parent_logger = logging.getLogger("dj_request_correlation")
canonical_logger = logging.getLogger("dj_request_correlation.canonical")
class CanonicalLogLineMiddleware(ClassBasedMiddleware):
""" CanonicalLogLineMiddleware emits a (you guessed it) canonical log line for
every HTTP request, to the "dj_request_correlation.canonical" logger.
"""
# TODO: should_not_log view decorator? route decorator? somethin.
# TODO: what happens with various exceptions blah
def __call__(self, request: HttpRequest) -> HttpResponse:
with RequestTracker(request) as tracker:
response = super().__call__(request=request)
tracker.response = response
canonical_logger.info(logfmt(**tracker.log))
return response
| 38.240964 | 88 | 0.73913 | 434 | 3,174 | 5.278802 | 0.370968 | 0.07464 | 0.032737 | 0.037975 | 0.122654 | 0.080314 | 0.044522 | 0 | 0 | 0 | 0 | 0.000392 | 0.195967 | 3,174 | 82 | 89 | 38.707317 | 0.897335 | 0.50189 | 0 | 0.2 | 0 | 0 | 0.060322 | 0.036193 | 0 | 0 | 0 | 0.012195 | 0 | 1 | 0.1 | false | 0 | 0.3 | 0 | 0.566667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
677af694e2c54f38eb36c7297afc3c871e015363 | 5,186 | py | Python | agent/src/clacks/agent/objects/filter/basic.py | gonicus/clacks | da579f0acc4e48cf2e9451417ac6792282cf7ab6 | [
"ZPL-2.1"
] | 2 | 2015-01-26T07:15:19.000Z | 2015-11-09T13:42:11.000Z | agent/src/clacks/agent/objects/filter/basic.py | gonicus/clacks | da579f0acc4e48cf2e9451417ac6792282cf7ab6 | [
"ZPL-2.1"
] | null | null | null | agent/src/clacks/agent/objects/filter/basic.py | gonicus/clacks | da579f0acc4e48cf2e9451417ac6792282cf7ab6 | [
"ZPL-2.1"
] | null | null | null | # This file is part of the clacks framework.
#
# http://clacks-project.org
#
# Copyright:
# (C) 2010-2012 GONICUS GmbH, Germany, http://www.gonicus.de
#
# License:
# GPL-2: http://www.gnu.org/licenses/gpl-2.0.html
#
# See the LICENSE file in the project's top-level directory for details.
from clacks.agent.objects.filter import ElementFilter
from clacks.agent.objects import ObjectFactory
import time
import datetime
class Target(ElementFilter):
"""
This filter renames the attribute.
e.g.::
<FilterEntry>
<Filter>
<Name>Target</Name>
<Param>passwordMethod</Param>
</Filter>
</FilterEntry>
"""
def __init__(self, obj):
super(Target, self).__init__(obj)
def process(self, obj, key, valDict, new_key):
if key != new_key:
valDict[new_key] = valDict[key]
del(valDict[key])
return new_key, valDict
class SetBackends(ElementFilter):
"""
This filter allows to change the target backend of an attrbiute.
It also allows to specify a various amount of backends, see example below.
e.g.::
<FilterEntry>
<Filter>
<Name>SetBackends</Name>
<Param>LDAP</Param>
<Param>NULL</Param>
<Param>...</Param>
</Filter>
</FilterEntry>
"""
def __init__(self, obj):
super(SetBackends, self).__init__(obj)
def process(self, obj, key, valDict, *new_backends):
valDict[key]['backend'] = list(new_backends)
return key, valDict
class AddBackend(ElementFilter):
"""
Add another backend to the existing ones.
"""
def __init__(self, obj):
super(AddBackend, self).__init__(obj)
def process(self, obj, key, valDict, new_backend):
valDict[key]['backend'].append(new_backend)
return key, valDict
class SetValue(ElementFilter):
"""
This filter allows to change the value of an attrbiute.
e.g.::
<FilterEntry>
<Filter>
<Name>SetValue</Name>
<Param>Hallo mein name ist Peter</Param>
</Filter>
</FilterEntry>
"""
def __init__(self, obj):
super(SetValue, self).__init__(obj)
def process(self, obj, key, valDict, value):
f = ObjectFactory()
types = f.getAttributeTypes()
valDict[key]['value'] = types['String'].convert_to(valDict[key]['type'], [value])
return key, valDict
class Clear(ElementFilter):
"""
This filter clears the value of an attribute.
"""
def __init__(self, obj):
super(Clear, self).__init__(obj)
def process(self, obj, key, valDict):
f = ObjectFactory()
types = f.getAttributeTypes()
valDict[key]['value'] = types['String'].convert_to(valDict[key]['type'], [''])
return key, valDict
class IntegerToDatetime(ElementFilter):
"""
Converts an integer object into a datetime.datetime object..
e.g.:
>>> <FilterEntry>
>>> <Filter>
>>> <Name>IntegerToDatetime</Name>
>>> </Filter>
>>> </FilterEntry>
>>> ...
"""
def __init__(self, obj):
super(IntegerToDatetime, self).__init__(obj)
def process(self, obj, key, valDict):
valDict[key]['value'] = map(lambda x: datetime.datetime.fromtimestamp(x), valDict[key]['value'])
valDict[key]['backend_type'] = 'Timestamp'
return key, valDict
class DatetimeToInteger(ElementFilter):
"""
Converts a timestamp object into an integer value ...
e.g.:
>>> <FilterEntry>
>>> <Filter>
>>> <Name>DatetimeToInteger</Name>
>>> </Filter>
>>> </FilterEntry>
>>> ...
"""
def __init__(self, obj):
super(DatetimeToInteger, self).__init__(obj)
def process(self, obj, key, valDict):
valDict[key]['value'] = map(lambda x: int(time.mktime(x.timetuple())), valDict[key]['value'])
valDict[key]['backend_type'] = 'Integer'
return key, valDict
class StringToDatetime(ElementFilter):
"""
Converts a string object into a datetime.datetime object..
e.g.:
>>> <FilterEntry>
>>> <Filter>
>>> <Name>StringToDatetime</Name>
>>> <Param>%%Y-%%m-%%d</Param>
>>> </Filter>
>>> </FilterEntry>
>>> ...
"""
def __init__(self, obj):
super(StringToDatetime, self).__init__(obj)
def process(self, obj, key, valDict, fmt):
valDict[key]['value'] = map(lambda x: datetime.datetime.strptime(x, fmt), valDict[key]['value'])
valDict[key]['backend_type'] = 'Timestamp'
return key, valDict
class DatetimeToString(ElementFilter):
"""
Converts a timestamp object into an string value of the given format...
e.g.:
>>> <FilterEntry>
>>> <Filter>
>>> <Name>DatetimeToInteger</Name>
>>> <Param>%%Y-%%m-%%d</Param>
>>> </Filter>
>>> </FilterEntry>
>>> ...
"""
def __init__(self, obj):
super(DatetimeToString, self).__init__(obj)
def process(self, obj, key, valDict, fmt):
valDict[key]['value'] = map(lambda x: x.strftime(fmt), valDict[key]['value'])
valDict[key]['backend_type'] = 'String'
return key, valDict
| 25.93 | 104 | 0.598727 | 575 | 5,186 | 5.250435 | 0.224348 | 0.066247 | 0.049685 | 0.041736 | 0.544882 | 0.50944 | 0.50944 | 0.416032 | 0.32428 | 0.299106 | 0 | 0.002818 | 0.247397 | 5,186 | 199 | 105 | 26.060302 | 0.770689 | 0.347667 | 0 | 0.411765 | 0 | 0 | 0.053956 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.264706 | false | 0 | 0.058824 | 0 | 0.588235 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
677dda199e521c7899dd9584c72a377713b6f226 | 867 | py | Python | src/lect02.py | luchenhua/MIT-OCW-600 | f216a86579d379f2b04f883ade61d6db1473f4ea | [
"MIT"
] | null | null | null | src/lect02.py | luchenhua/MIT-OCW-600 | f216a86579d379f2b04f883ade61d6db1473f4ea | [
"MIT"
] | null | null | null | src/lect02.py | luchenhua/MIT-OCW-600 | f216a86579d379f2b04f883ade61d6db1473f4ea | [
"MIT"
] | null | null | null | from Tools.Scripts.treesync import raw_input
__author__ = 'luchenhua'
x = 3
x *= x
print(x)
y = raw_input('Enter a number: ')
print(type(y))
print(y)
y = float(raw_input('Enter a number: '))
print(type(y))
print(y)
print(y * y)
x = int(raw_input('Enter an integer: '))
if x % 2 == 0:
print('Even')
else:
print('Odd')
if x % 3 != 0:
print('And not divisible by 3')
x = int(raw_input('Enter x: '))
y = int(raw_input('Enter y: '))
z = int(raw_input('Enter z: '))
if x < y:
if x < z:
print('x is least')
else:
print('z is least')
else:
print('y is least')
if x < y:
if x < z:
print('x is least')
else:
print('z is least')
elif y < z:
print('y is least')
else:
print('z is least')
if x < y and x < z:
print('x is least')
elif y < z:
print('y is least')
else:
print('z is least')
| 16.055556 | 44 | 0.554787 | 154 | 867 | 3.051948 | 0.227273 | 0.148936 | 0.165957 | 0.170213 | 0.595745 | 0.5 | 0.482979 | 0.482979 | 0.482979 | 0.482979 | 0 | 0.009479 | 0.269896 | 867 | 53 | 45 | 16.358491 | 0.733017 | 0 | 0 | 0.590909 | 0 | 0 | 0.247982 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.022727 | 0 | 0.022727 | 0.431818 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
679037bc185ebf813b30fff75f2754118ca00794 | 3,095 | py | Python | django_cradmin/uicontainer/button.py | appressoas/django_cradmin | 0f8715afdfe1ad32e46033f442e622aecf6a4dec | [
"BSD-3-Clause"
] | 11 | 2015-07-05T16:57:58.000Z | 2020-11-24T16:58:19.000Z | django_cradmin/uicontainer/button.py | appressoas/django_cradmin | 0f8715afdfe1ad32e46033f442e622aecf6a4dec | [
"BSD-3-Clause"
] | 91 | 2015-01-08T22:38:13.000Z | 2022-02-10T10:25:27.000Z | django_cradmin/uicontainer/button.py | appressoas/django_cradmin | 0f8715afdfe1ad32e46033f442e622aecf6a4dec | [
"BSD-3-Clause"
] | 3 | 2016-12-07T12:19:24.000Z | 2018-10-03T14:04:18.000Z | from django_cradmin.uicontainer import convenience
class Button(convenience.AbstractWithOptionalEscapedText):
"""
Renders a ``<button type="button">`` with the default
style (using the ``button`` css class).
"""
def __init__(self, button_type=None, name=False, **kwargs):
self._overridden_button_type = button_type
self._overridden_name = name
super(Button, self).__init__(**kwargs)
def get_default_html_tag(self):
return 'button'
def get_default_button_type(self):
"""
Get the default value for the type attribute of the html element.
Defaults to ``"button"``.
"""
return 'button'
@property
def button_type(self):
"""
Get the value for the type attribute of the html element.
You should not override this. Override :meth:`.get_default_button_type` instead.
"""
return self._overridden_button_type or self.get_default_button_type()
def get_default_name(self):
"""
Get the default value for the name attribute of the html element.
Defaults to ``False``.
"""
return False
@property
def name(self):
"""
Get the value for the name attribute of the button html element.
You should not override this. Override :meth:`.get_default_name` instead.
"""
return self._overridden_name or self.get_default_name()
def get_html_element_attributes(self):
html_attributes = super(Button, self).get_html_element_attributes()
html_attributes['type'] = self.button_type
html_attributes['name'] = self.name
return html_attributes
def get_bem_block_or_element(self):
return 'button'
class ButtonPrimary(Button):
"""
Renders a ``<button type="button">`` with the primary
style (using the ``button button--primary`` css class).
"""
def get_default_bem_variant_list(self):
return ['primary']
class ButtonHistoryBack(Button):
"""
Renders a ``<button type="button">`` just like
:class:`.Button`, with ``onclick="history.back();return false;"``.
Typically used for cancel buttons where we just want to return
to the previous page.
"""
def get_html_element_attributes(self):
attributes = super(ButtonHistoryBack, self).get_html_element_attributes()
attributes['onclick'] = 'history.back();return false;'
return attributes
class Submit(Button):
"""
Renders a ``<button type="submit">`` with the default
style (using the ``button`` css class).
"""
def get_default_button_type(self):
return 'submit'
def get_default_test_css_class_suffixes_list(self):
return ['submit']
class SubmitPrimary(Submit):
"""
Renders a ``<button type="submit">`` with the primary
style (using the ``button button--primary`` css class).
"""
def get_default_bem_variant_list(self):
return ['primary']
def get_default_test_css_class_suffixes_list(self):
return ['submit-primary']
| 29.198113 | 88 | 0.652666 | 373 | 3,095 | 5.190349 | 0.19571 | 0.077479 | 0.053719 | 0.046488 | 0.561467 | 0.494318 | 0.409091 | 0.295971 | 0.295971 | 0.260331 | 0 | 0 | 0.240065 | 3,095 | 105 | 89 | 29.47619 | 0.823129 | 0.346365 | 0 | 0.348837 | 0 | 0 | 0.056267 | 0.011699 | 0 | 0 | 0 | 0 | 0 | 1 | 0.325581 | false | 0 | 0.023256 | 0.162791 | 0.767442 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
67905a73cb726486dc557182f31d253e9340c805 | 1,422 | py | Python | books/software-architecture-with-python/Chapter07-design-patterns/06-factory.py | phiratio/lpthw | a32240d4355fb331805d515f96e1d009914e5c47 | [
"MIT"
] | 1 | 2021-04-21T09:38:38.000Z | 2021-04-21T09:38:38.000Z | books/software-architecture-with-python/Chapter07-design-patterns/06-factory.py | phiratio/lpthw | a32240d4355fb331805d515f96e1d009914e5c47 | [
"MIT"
] | 34 | 2019-12-16T16:53:24.000Z | 2022-01-13T02:29:30.000Z | books/software-architecture-with-python/Chapter07-design-patterns/06-factory.py | phiratio/lpthw | a32240d4355fb331805d515f96e1d009914e5c47 | [
"MIT"
] | null | null | null | # Code Listing #6
"""
Implementation of the Factory/Factory Method Design Pattern
"""
from abc import ABCMeta, abstractmethod
class Employee(metaclass=ABCMeta):
""" An Employee class """
def __init__(self, name, age, gender):
self.name = name
self.age = age
self.gender = gender
@abstractmethod
def get_role(self):
pass
def __str__(self):
return "{} - {}, {} years old {}".format(self.__class__.__name__,
self.name,
self.age,
self.gender)
class Engineer(Employee):
""" An Engineer Employee """
def get_role(self):
return "engineering"
class Accountant(Employee):
""" An Accountant Employee """
def get_role(self):
return "accountant"
class Admin(Employee):
""" An Admin Employee """
def get_role(self):
return "administration"
class EmployeeFactory(object):
""" An Employee factory class """
@classmethod
def create(cls, name, *args):
""" Factory method for creating an Employee instance """
name = name.lower().strip()
if name == 'engineer':
return Engineer(*args)
if name == 'accountant':
return Accountant(*args)
if name == 'admin':
return Admin(*args)
| 21.223881 | 73 | 0.539381 | 138 | 1,422 | 5.413043 | 0.362319 | 0.032129 | 0.053548 | 0.074967 | 0.11245 | 0.11245 | 0 | 0 | 0 | 0 | 0 | 0.001082 | 0.350211 | 1,422 | 66 | 74 | 21.545455 | 0.807359 | 0.165963 | 0 | 0.121212 | 0 | 0 | 0.071993 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.212121 | false | 0.030303 | 0.030303 | 0.121212 | 0.606061 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
679a9492d42ac74cc97653a619c898c1044f7869 | 4,936 | py | Python | tests/test_DumpCreds.py | sc979/jenkins-attack-framework | ce0de8e2c014ccc42ae0f159e40f36415a86e9e3 | [
"MIT"
] | 451 | 2021-05-05T18:08:51.000Z | 2022-03-28T10:50:26.000Z | tests/test_DumpCreds.py | markyjackson-taulia/jenkins-attack-framework | 18da671312bff200ef07d537b7f7dc57605b8765 | [
"MIT"
] | null | null | null | tests/test_DumpCreds.py | markyjackson-taulia/jenkins-attack-framework | 18da671312bff200ef07d537b7f7dc57605b8765 | [
"MIT"
] | 49 | 2021-05-04T20:22:12.000Z | 2022-02-04T15:34:59.000Z | import unittest
import warnings
from libs.JAF.BaseCommandLineParser import BaseCommandLineParser
from libs.JAF.plugin_DumpCreds import DumpCreds, DumpCredsParser
from .configuration import (
server,
user_admin,
user_bad,
user_noaccess,
user_normal,
user_read_job_access,
user_read_no_job_access,
)
from .helpers import DummyWebServer, TestFramework
class DumpCredsTest(unittest.TestCase, TestFramework):
def setUp(self):
warnings.simplefilter("ignore", ResourceWarning)
self.testcommand = "DumpCreds"
self.TestParserClass = DumpCredsParser
self.TestClass = DumpCreds
def test_invalid_url(self):
"""Make sure that calling with invalid url fails gracefully"""
self.basic_test_harness(
["jaf.py", self.testcommand, "-s", "https://127.0.0.1:59321/", "-a", user_bad],
[r"- \w+: Invalid Credentials or unable to access Jenkins server."],
1,
)
def test_valid_url_bad_protocol(self):
"""Make sure that calling with valid url (that isn't Jenkins or right protocol) fails gracefully"""
with DummyWebServer():
self.basic_test_harness(
["jaf.py", self.testcommand, "-s", "https://127.0.0.1:59322/", "-a", user_bad],
[r"- \w+: Invalid Credentials or unable to access Jenkins server."],
1,
)
def test_valid_url_and_protocol(self):
"""Make sure that calling with valid url (that isn't Jenkins but right protocol) fails gracefully"""
with DummyWebServer():
self.basic_test_harness(
["jaf.py", self.testcommand, "-s", "http://127.0.0.1:59322/", "-a", user_bad],
[r"- \w+: Invalid Credentials or unable to access Jenkins server."],
1,
)
def test_valid_jenkins_invalid_creds(self):
"""Make sure that calling with valid jenkins (but bad creds) fails gracefully"""
self.basic_test_harness(
["jaf.py", self.testcommand, "-s", server, "-a", user_bad],
[r"- \w+: Invalid Credentials or unable to access Jenkins server."],
1,
)
def test_valid_jenkins_anonymous_creds(self):
"""Make sure that calling with valid jenkins (but no creds)"""
self.basic_test_harness(
["jaf.py", self.testcommand, "-s", server],
[r"- \w+: Invalid Credentials or unable to access Jenkins server."],
1,
)
def test_valid_jenkins_valid_unprivileged_creds(self):
"""Make sure that calling with valid jenkins (unprivileged creds) returns expected results"""
self.basic_test_harness(
["jaf.py", self.testcommand, "-s", server, "-a", user_noaccess],
[r"- \w+: Invalid Credentials or unable to access Jenkins server."],
1,
)
def test_valid_jenkins_valid_read_no_job_creds(self):
"""Make sure that calling with valid jenkins (read only [no job access] creds) returns expected results"""
self.basic_test_harness(
["jaf.py", self.testcommand, "-s", server, "-a", user_read_no_job_access],
[r"- \w+: Invalid Credentials or unable to access Jenkins server."],
1,
)
def test_valid_jenkins_valid_read_job_creds(self):
"""Make sure that calling with valid jenkins (read only [job access] creds) returns expected results"""
self.basic_test_harness(
["jaf.py", self.testcommand, "-s", server, "-a", user_read_job_access],
[r"- \w+: Invalid Credentials or unable to access Jenkins server."],
1,
)
def test_valid_jenkins_valid_normal_creds(self):
"""Make sure that calling with valid jenkins (normal creds) returns expected results"""
self.basic_test_harness(
["jaf.py", self.testcommand, "-s", server, "-a", user_normal],
[r"- \w+: Invalid Credentials or unable to access Jenkins server."],
1,
)
def test_valid_jenkins_valid_admin_creds(self):
"""Make sure that calling with valid jenkins (admin creds) returns expected results"""
self.basic_test_harness(["jaf.py", self.testcommand, "-s", server, "-a", user_admin])
class DumpCredsParserTest(unittest.TestCase, TestFramework):
def setUp(self):
self.testcommand = "DumpCreds"
self.TestClass = DumpCreds
self.TestParserClass = DumpCredsParser
def test_no_args(self):
"""Ensure that calling with no arguments results in help output and not an error"""
self.basic_test_harness(
["jaf.py", self.testcommand],
[
r"usage: jaf.py {0} \[-h\]".format(self.testcommand),
r"Jenkins Attack Framework",
r"positional arguments:",
],
)
if __name__ == "__main__":
unittest.main()
| 36.294118 | 114 | 0.620138 | 586 | 4,936 | 5.046075 | 0.167235 | 0.071018 | 0.0558 | 0.0744 | 0.71559 | 0.708488 | 0.671627 | 0.671627 | 0.658099 | 0.61346 | 0 | 0.011869 | 0.266005 | 4,936 | 135 | 115 | 36.562963 | 0.804306 | 0.183347 | 0 | 0.404255 | 0 | 0 | 0.209811 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.138298 | false | 0 | 0.06383 | 0 | 0.223404 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
679ccbd9b84a64991f101aa780a859d799a43f38 | 63 | py | Python | AfterImage/__init__.py | willnewton/Kitsune-py | 39f1eccd6e9c64e5962c8dae5603a2144003ad59 | [
"MIT"
] | null | null | null | AfterImage/__init__.py | willnewton/Kitsune-py | 39f1eccd6e9c64e5962c8dae5603a2144003ad59 | [
"MIT"
] | null | null | null | AfterImage/__init__.py | willnewton/Kitsune-py | 39f1eccd6e9c64e5962c8dae5603a2144003ad59 | [
"MIT"
] | null | null | null | __all__ = ["AfterImage", "FeatureExtractor", "netStat","setup"] | 63 | 63 | 0.714286 | 5 | 63 | 8.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.063492 | 63 | 1 | 63 | 63 | 0.694915 | 0 | 0 | 0 | 0 | 0 | 0.59375 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
679da708024a57bfd42125f231c7a57a003646ac | 3,273 | py | Python | ccn-lite-new/test/timeout/n-body/SimpleClient.py | luthramanisha/INetCEP-NFN | e1321e906160310c28fd4fccf41cafaf8e67b283 | [
"0BSD"
] | 3 | 2019-09-25T13:33:51.000Z | 2022-02-19T12:21:19.000Z | ccn-lite-new/test/timeout/n-body/SimpleClient.py | luthramanisha/INetCEP-NFN | e1321e906160310c28fd4fccf41cafaf8e67b283 | [
"0BSD"
] | null | null | null | ccn-lite-new/test/timeout/n-body/SimpleClient.py | luthramanisha/INetCEP-NFN | e1321e906160310c28fd4fccf41cafaf8e67b283 | [
"0BSD"
] | 2 | 2019-09-24T10:04:38.000Z | 2022-02-22T03:00:12.000Z | from KeepaliveRequest import *
#from Tkinter import *
from PIL import Image
import io
class SimpleClient():
def __init__(self):
ip = "127.0.0.1"
port = 9001
connectionInfo = pyndn.transport.udp_transport.UdpTransport.ConnectionInfo(ip, port)
transport = pyndn.transport.udp_transport.UdpTransport()
self.face = pyndn.face.Face(transport, connectionInfo)
self.pendingRequests = []
pass
def run(self):
self.sendSimulationRequest()
while self.hasPendingRequests():
print("Waiting...")
self.face.processEvents()
time.sleep(1)
print("Done.")
def sendSimulationRequest(self):
interest = pyndn.Interest(self.simulationName())
interest.setInterestLifetimeMilliseconds(1000)
request = KeepaliveRequest(self.face, interest, self.onIntermediateSimulationData, self.onSimulationData,
self.onSimulationTimeout)
self.sendRequest(request)
def sendRenderRequest(self):
interest = pyndn.Interest(self.renderName())
interest.setInterestLifetimeMilliseconds(5000)
request = KeepaliveRequest(self.face, interest, None, self.onRenderData, self.onRenderTimeout)
self.sendRequest(request)
def onSimulationData(self, request):
self.sendRenderRequest()
def onIntermediateSimulationData(self, request):
pass
def onSimulationTimeout(self, request):
pass
def onRenderData(self, request):
# file = open('/Users/Bazsi/Desktop/data3.png', 'w')
buf = request.data.getContent().toBytes()
# file.write(buf)
# file.close()
# renderer = NBodyRenderer()
# renderer.show()
# img = Image.frombytes('RGB', (500, 500), buf)
img = Image.open(io.BytesIO(buf))
img.show()
pass
def onRenderTimeout(self, request):
pass
def hasPendingRequests(self):
for request in self.pendingRequests:
if request.data is None and request.timeout is False:
return True
return False
def sendRequest(self, request):
self.pendingRequests.append(request)
request.send()
def simulationName(self):
name = pyndn.Name("/node/nodeD/nfn_service_NBody_SimulationService/")
name.append("(@x call 7 x '-d' 10 '-s' 100000 '-i' 1)")
name.append("NFN")
return name
def renderName(self):
simName = "call 7 /node/nodeD/nfn_service_NBody_SimulationService '-d' 10 '-s' 100000 '-i' 1"
name = pyndn.Name("/node/nodeD/nfn_service_NBody_RenderService/")
name.append("(@x call 6 x ({}) '-w' 500 '-h' 500)".format(simName))
name.append("NFN")
return name
# class NBodyRenderer:
# def __init__(self):
# self.master = Tk()
# self.canvas = Canvas(self.master, width=500, height=500, bg="black")
#
# def render(self, request):
# self.canvas.pack()
# image = ImageTk.PhotoImage(data=request.data.getContent().toBytes())
# self.canvas.create_image(10, 10, image=image, anchor=NW)
def main(argv):
client = SimpleClient()
client.run()
if __name__ == "__main__":
main(sys.argv)
| 31.471154 | 113 | 0.627559 | 341 | 3,273 | 5.941349 | 0.357771 | 0.038006 | 0.022211 | 0.026654 | 0.204344 | 0.078973 | 0.050346 | 0.036525 | 0 | 0 | 0 | 0.025777 | 0.253284 | 3,273 | 103 | 114 | 31.776699 | 0.803191 | 0.164681 | 0 | 0.164179 | 0 | 0 | 0.105592 | 0.051141 | 0 | 0 | 0 | 0 | 0 | 1 | 0.208955 | false | 0.074627 | 0.044776 | 0 | 0.328358 | 0.029851 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
67a30cf92e49b45a03da601798563ff44f59e66f | 688 | py | Python | mrq/exceptions.py | bpmbank/mrq | 12b0be3795164732da94d12240d9ed74f8b33601 | [
"MIT"
] | null | null | null | mrq/exceptions.py | bpmbank/mrq | 12b0be3795164732da94d12240d9ed74f8b33601 | [
"MIT"
] | null | null | null | mrq/exceptions.py | bpmbank/mrq | 12b0be3795164732da94d12240d9ed74f8b33601 | [
"MIT"
] | null | null | null | from gevent import GreenletExit
# Inherits from BaseException to avoid being caught when not intended.
class JobTimeoutException(BaseException):
pass
class CancelInterrupt(BaseException):
pass
# Inherits from BaseException to avoid being caught when not intended.
class RetryInterrupt(BaseException):
countdown = None
queue = None
def __str__(self):
return "<RetryInterrupt %s seconds, %s queue>" % (self.countdown, self.queue)
class StopRequested(GreenletExit):
""" Thrown in the mail greenlet to stop dequeuing jobs. """
pass
class JobInterrupt(GreenletExit):
""" Interrupts that stop a job in its execution, e.g. when responding to a SIGTERM. """
pass
| 22.933333 | 89 | 0.751453 | 84 | 688 | 6.107143 | 0.559524 | 0.046784 | 0.097466 | 0.105263 | 0.245614 | 0.245614 | 0.245614 | 0.245614 | 0.245614 | 0.245614 | 0 | 0 | 0.170058 | 688 | 29 | 90 | 23.724138 | 0.898424 | 0.395349 | 0 | 0.285714 | 0 | 0 | 0.09204 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.071429 | false | 0.285714 | 0.071429 | 0.071429 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
67a819e3dabaeecec3a0cedca137a18c5e3e3fbd | 1,002 | py | Python | kingfisher_scrapy/items.py | sgaseretto/kingfisher-collect | 6ad6968e5f99f363ceee838277c27dacaf9cd969 | [
"BSD-3-Clause"
] | null | null | null | kingfisher_scrapy/items.py | sgaseretto/kingfisher-collect | 6ad6968e5f99f363ceee838277c27dacaf9cd969 | [
"BSD-3-Clause"
] | null | null | null | kingfisher_scrapy/items.py | sgaseretto/kingfisher-collect | 6ad6968e5f99f363ceee838277c27dacaf9cd969 | [
"BSD-3-Clause"
] | 1 | 2021-02-19T12:47:47.000Z | 2021-02-19T12:47:47.000Z | # https://docs.scrapy.org/en/latest/topics/items.html
import scrapy
class KingfisherItem(scrapy.Item):
file_name = scrapy.Field()
url = scrapy.Field()
validate = True
class File(KingfisherItem):
data = scrapy.Field()
data_type = scrapy.Field()
encoding = scrapy.Field()
# If a file is split into file items, the file is stored to disk, but not sent to Kingfisher Process.
post_to_api = scrapy.Field()
# Added by the KingfisherFilesStore extension, for the KingfisherProcessAPI extension to read the file.
path = scrapy.Field()
files_store = scrapy.Field()
class FileItem(KingfisherItem):
number = scrapy.Field()
data = scrapy.Field()
data_type = scrapy.Field()
encoding = scrapy.Field()
class FileError(KingfisherItem):
errors = scrapy.Field()
class PluckedItem(scrapy.Item):
value = scrapy.Field()
class ReleaseDataItem(scrapy.Item):
data = scrapy.Field()
release_id = scrapy.Field()
ocid = scrapy.Field()
| 22.772727 | 107 | 0.692615 | 125 | 1,002 | 5.496 | 0.464 | 0.272198 | 0.093159 | 0.055313 | 0.154294 | 0.154294 | 0.154294 | 0.154294 | 0.154294 | 0.154294 | 0 | 0 | 0.199601 | 1,002 | 43 | 108 | 23.302326 | 0.856608 | 0.252495 | 0 | 0.28 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.04 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
67ae707a3ebf98f10ff3940a703956e3d672b19d | 597 | py | Python | indexer/migrations/0005_auto_20211019_2226.py | jikdo/ethplorer | 25d828743995036a5ba2a2e1d69fe4c166da741e | [
"MIT"
] | null | null | null | indexer/migrations/0005_auto_20211019_2226.py | jikdo/ethplorer | 25d828743995036a5ba2a2e1d69fe4c166da741e | [
"MIT"
] | null | null | null | indexer/migrations/0005_auto_20211019_2226.py | jikdo/ethplorer | 25d828743995036a5ba2a2e1d69fe4c166da741e | [
"MIT"
] | null | null | null | # Generated by Django 3.2.8 on 2021-10-19 22:26
from django.db import migrations
import indexer.custom_fields
class Migration(migrations.Migration):
dependencies = [
('indexer', '0004_alter_block_timestamp'),
]
operations = [
migrations.AlterField(
model_name='block',
name='difficulty',
field=indexer.custom_fields.BiggerIntegerField(),
),
migrations.AlterField(
model_name='block',
name='total_difficulty',
field=indexer.custom_fields.BiggerIntegerField(),
),
]
| 23.88 | 61 | 0.613065 | 57 | 597 | 6.263158 | 0.596491 | 0.109244 | 0.159664 | 0.162465 | 0.504202 | 0.504202 | 0 | 0 | 0 | 0 | 0 | 0.044393 | 0.283082 | 597 | 24 | 62 | 24.875 | 0.78972 | 0.075377 | 0 | 0.444444 | 1 | 0 | 0.125455 | 0.047273 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.111111 | 0 | 0.277778 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
67bc8db609fd96da6da09c111dfd9631126bcb93 | 22,488 | py | Python | pysnmp/MPLS-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 11 | 2021-02-02T16:27:16.000Z | 2021-08-31T06:22:49.000Z | pysnmp/MPLS-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 75 | 2021-02-24T17:30:31.000Z | 2021-12-08T00:01:18.000Z | pysnmp/MPLS-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 10 | 2019-04-30T05:51:36.000Z | 2022-02-16T03:33:41.000Z | #
# PySNMP MIB module MPLS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MPLS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:04:41 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint", "ConstraintsUnion")
jnxMibs, = mibBuilder.importSymbols("JUNIPER-SMI", "jnxMibs")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
MibIdentifier, TimeTicks, NotificationType, ObjectIdentity, ModuleIdentity, Bits, Integer32, MibScalar, MibTable, MibTableRow, MibTableColumn, Gauge32, Unsigned32, Counter32, iso, IpAddress, Counter64 = mibBuilder.importSymbols("SNMPv2-SMI", "MibIdentifier", "TimeTicks", "NotificationType", "ObjectIdentity", "ModuleIdentity", "Bits", "Integer32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Gauge32", "Unsigned32", "Counter32", "iso", "IpAddress", "Counter64")
TextualConvention, DisplayString, TimeStamp = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString", "TimeStamp")
mpls = ModuleIdentity((1, 3, 6, 1, 4, 1, 2636, 3, 2))
mpls.setRevisions(('2009-02-23 14:45',))
if mibBuilder.loadTexts: mpls.setLastUpdated('200902231445Z')
if mibBuilder.loadTexts: mpls.setOrganization('Juniper Networks, Inc.')
mplsInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 2636, 3, 2, 1))
mplsVersion = MibScalar((1, 3, 6, 1, 4, 1, 2636, 3, 2, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsVersion.setStatus('current')
mplsSignalingProto = MibScalar((1, 3, 6, 1, 4, 1, 2636, 3, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("none", 1), ("other", 2), ("rsvp", 3), ("ldp", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsSignalingProto.setStatus('current')
mplsConfiguredLsps = MibScalar((1, 3, 6, 1, 4, 1, 2636, 3, 2, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsConfiguredLsps.setStatus('current')
mplsActiveLsps = MibScalar((1, 3, 6, 1, 4, 1, 2636, 3, 2, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsActiveLsps.setStatus('current')
mplsTEInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 2636, 3, 2, 2))
mplsTEDistProtocol = MibScalar((1, 3, 6, 1, 4, 1, 2636, 3, 2, 2, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("none", 1), ("isis", 2), ("ospf", 3), ("isis-ospf", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsTEDistProtocol.setStatus('current')
mplsAdminGroupList = MibTable((1, 3, 6, 1, 4, 1, 2636, 3, 2, 2, 2), )
if mibBuilder.loadTexts: mplsAdminGroupList.setStatus('current')
mplsAdminGroup = MibTableRow((1, 3, 6, 1, 4, 1, 2636, 3, 2, 2, 2, 1), ).setIndexNames((0, "MPLS-MIB", "mplsAdminGroupNumber"))
if mibBuilder.loadTexts: mplsAdminGroup.setStatus('current')
mplsAdminGroupNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 2, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 31))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsAdminGroupNumber.setStatus('current')
mplsAdminGroupName = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 2, 2, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 16))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsAdminGroupName.setStatus('current')
mplsLspList = MibTable((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3), )
if mibBuilder.loadTexts: mplsLspList.setStatus('deprecated')
mplsLspEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1), ).setIndexNames((0, "MPLS-MIB", "mplsLspName"))
if mibBuilder.loadTexts: mplsLspEntry.setStatus('deprecated')
mplsLspName = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(32, 32)).setFixedLength(32)).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspName.setStatus('deprecated')
mplsLspState = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("unknown", 1), ("up", 2), ("down", 3), ("notInService", 4), ("backupActive", 5)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspState.setStatus('deprecated')
mplsLspOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspOctets.setStatus('deprecated')
mplsLspPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 4), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspPackets.setStatus('deprecated')
mplsLspAge = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 5), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspAge.setStatus('deprecated')
mplsLspTimeUp = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 6), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspTimeUp.setStatus('deprecated')
mplsLspPrimaryTimeUp = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 7), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspPrimaryTimeUp.setStatus('deprecated')
mplsLspTransitions = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspTransitions.setStatus('deprecated')
mplsLspLastTransition = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 9), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspLastTransition.setStatus('deprecated')
mplsLspPathChanges = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspPathChanges.setStatus('deprecated')
mplsLspLastPathChange = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 11), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspLastPathChange.setStatus('deprecated')
mplsLspConfiguredPaths = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 12), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspConfiguredPaths.setStatus('deprecated')
mplsLspStandbyPaths = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 13), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspStandbyPaths.setStatus('deprecated')
mplsLspOperationalPaths = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 14), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspOperationalPaths.setStatus('deprecated')
mplsLspFrom = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 15), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspFrom.setStatus('deprecated')
mplsLspTo = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 16), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspTo.setStatus('deprecated')
mplsPathName = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 17), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 16))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsPathName.setStatus('deprecated')
mplsPathType = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 18), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("other", 1), ("primary", 2), ("standby", 3), ("secondary", 4), ("bypass", 5)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsPathType.setStatus('deprecated')
mplsPathExplicitRoute = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 19), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 1024))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsPathExplicitRoute.setStatus('deprecated')
mplsPathRecordRoute = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 20), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 1024))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsPathRecordRoute.setStatus('deprecated')
mplsPathBandwidth = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 21), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsPathBandwidth.setStatus('deprecated')
mplsPathCOS = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 22), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 7), ValueRangeConstraint(255, 255), ))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsPathCOS.setStatus('deprecated')
mplsPathInclude = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 23), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsPathInclude.setStatus('deprecated')
mplsPathExclude = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 24), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsPathExclude.setStatus('deprecated')
mplsPathSetupPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 25), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsPathSetupPriority.setStatus('deprecated')
mplsPathHoldPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 26), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsPathHoldPriority.setStatus('deprecated')
mplsPathProperties = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 3, 1, 27), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 4, 8, 16, 32, 64))).clone(namedValues=NamedValues(("record-route", 1), ("adaptive", 2), ("cspf", 4), ("mergeable", 8), ("preemptable", 16), ("preemptive", 32), ("fast-reroute", 64)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsPathProperties.setStatus('deprecated')
mplsLspInfoList = MibTable((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5), )
if mibBuilder.loadTexts: mplsLspInfoList.setStatus('current')
mplsLspInfoEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1), ).setIndexNames((1, "MPLS-MIB", "mplsLspInfoName"))
if mibBuilder.loadTexts: mplsLspInfoEntry.setStatus('current')
mplsLspInfoName = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 64))).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: mplsLspInfoName.setStatus('current')
mplsLspInfoState = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("unknown", 1), ("up", 2), ("down", 3), ("notInService", 4), ("backupActive", 5)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspInfoState.setStatus('current')
mplsLspInfoOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspInfoOctets.setStatus('current')
mplsLspInfoPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 4), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspInfoPackets.setStatus('current')
mplsLspInfoAge = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 5), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspInfoAge.setStatus('current')
mplsLspInfoTimeUp = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 6), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspInfoTimeUp.setStatus('current')
mplsLspInfoPrimaryTimeUp = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 7), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspInfoPrimaryTimeUp.setStatus('current')
mplsLspInfoTransitions = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspInfoTransitions.setStatus('current')
mplsLspInfoLastTransition = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 9), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspInfoLastTransition.setStatus('current')
mplsLspInfoPathChanges = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspInfoPathChanges.setStatus('current')
mplsLspInfoLastPathChange = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 11), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspInfoLastPathChange.setStatus('current')
mplsLspInfoConfiguredPaths = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 12), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspInfoConfiguredPaths.setStatus('current')
mplsLspInfoStandbyPaths = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 13), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspInfoStandbyPaths.setStatus('current')
mplsLspInfoOperationalPaths = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 14), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspInfoOperationalPaths.setStatus('current')
mplsLspInfoFrom = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 15), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspInfoFrom.setStatus('current')
mplsLspInfoTo = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 16), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspInfoTo.setStatus('current')
mplsPathInfoName = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 17), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 16))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsPathInfoName.setStatus('current')
mplsPathInfoType = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 18), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("other", 1), ("primary", 2), ("standby", 3), ("secondary", 4), ("bypass", 5)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsPathInfoType.setStatus('current')
mplsPathInfoExplicitRoute = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 19), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 1024))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsPathInfoExplicitRoute.setStatus('current')
mplsPathInfoRecordRoute = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 20), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 1024))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsPathInfoRecordRoute.setStatus('current')
mplsPathInfoBandwidth = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 21), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsPathInfoBandwidth.setStatus('current')
mplsPathInfoCOS = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 22), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 7), ValueRangeConstraint(255, 255), ))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsPathInfoCOS.setStatus('current')
mplsPathInfoInclude = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 23), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsPathInfoInclude.setStatus('current')
mplsPathInfoExclude = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 24), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsPathInfoExclude.setStatus('current')
mplsPathInfoSetupPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 25), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsPathInfoSetupPriority.setStatus('current')
mplsPathInfoHoldPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 26), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsPathInfoHoldPriority.setStatus('current')
mplsPathInfoProperties = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 27), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 4, 8, 16, 32, 64))).clone(namedValues=NamedValues(("record-route", 1), ("adaptive", 2), ("cspf", 4), ("mergeable", 8), ("preemptable", 16), ("preemptive", 32), ("fast-reroute", 64)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsPathInfoProperties.setStatus('current')
mplsLspInfoAggrOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 28), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspInfoAggrOctets.setStatus('current')
mplsLspInfoAggrPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 29), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLspInfoAggrPackets.setStatus('current')
mplsPathInfoRecordRouteWithLabels = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 2, 5, 1, 30), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 1024))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsPathInfoRecordRouteWithLabels.setStatus('current')
mplsTraps = MibIdentifier((1, 3, 6, 1, 4, 1, 2636, 3, 2, 4))
mplsLspUp = NotificationType((1, 3, 6, 1, 4, 1, 2636, 3, 2, 4, 1)).setObjects(("MPLS-MIB", "mplsLspName"), ("MPLS-MIB", "mplsPathName"))
if mibBuilder.loadTexts: mplsLspUp.setStatus('deprecated')
mplsLspDown = NotificationType((1, 3, 6, 1, 4, 1, 2636, 3, 2, 4, 2)).setObjects(("MPLS-MIB", "mplsLspName"), ("MPLS-MIB", "mplsPathName"))
if mibBuilder.loadTexts: mplsLspDown.setStatus('deprecated')
mplsLspChange = NotificationType((1, 3, 6, 1, 4, 1, 2636, 3, 2, 4, 3)).setObjects(("MPLS-MIB", "mplsLspName"), ("MPLS-MIB", "mplsPathName"))
if mibBuilder.loadTexts: mplsLspChange.setStatus('deprecated')
mplsLspPathDown = NotificationType((1, 3, 6, 1, 4, 1, 2636, 3, 2, 4, 4)).setObjects(("MPLS-MIB", "mplsLspName"), ("MPLS-MIB", "mplsPathName"))
if mibBuilder.loadTexts: mplsLspPathDown.setStatus('deprecated')
mplsLspPathUp = NotificationType((1, 3, 6, 1, 4, 1, 2636, 3, 2, 4, 5)).setObjects(("MPLS-MIB", "mplsLspName"), ("MPLS-MIB", "mplsPathName"))
if mibBuilder.loadTexts: mplsLspPathUp.setStatus('deprecated')
mplsLspTraps = MibIdentifier((1, 3, 6, 1, 4, 1, 2636, 3, 2, 0))
mplsLspInfoUp = NotificationType((1, 3, 6, 1, 4, 1, 2636, 3, 2, 0, 1)).setObjects(("MPLS-MIB", "mplsLspInfoName"), ("MPLS-MIB", "mplsPathInfoName"))
if mibBuilder.loadTexts: mplsLspInfoUp.setStatus('current')
mplsLspInfoDown = NotificationType((1, 3, 6, 1, 4, 1, 2636, 3, 2, 0, 2)).setObjects(("MPLS-MIB", "mplsLspInfoName"), ("MPLS-MIB", "mplsPathInfoName"))
if mibBuilder.loadTexts: mplsLspInfoDown.setStatus('current')
mplsLspInfoChange = NotificationType((1, 3, 6, 1, 4, 1, 2636, 3, 2, 0, 3)).setObjects(("MPLS-MIB", "mplsLspInfoName"), ("MPLS-MIB", "mplsPathInfoName"))
if mibBuilder.loadTexts: mplsLspInfoChange.setStatus('current')
mplsLspInfoPathDown = NotificationType((1, 3, 6, 1, 4, 1, 2636, 3, 2, 0, 4)).setObjects(("MPLS-MIB", "mplsLspInfoName"), ("MPLS-MIB", "mplsPathInfoName"))
if mibBuilder.loadTexts: mplsLspInfoPathDown.setStatus('current')
mplsLspInfoPathUp = NotificationType((1, 3, 6, 1, 4, 1, 2636, 3, 2, 0, 5)).setObjects(("MPLS-MIB", "mplsLspInfoName"), ("MPLS-MIB", "mplsPathInfoName"))
if mibBuilder.loadTexts: mplsLspInfoPathUp.setStatus('current')
mibBuilder.exportSymbols("MPLS-MIB", mplsLspInfoPathUp=mplsLspInfoPathUp, mplsLspAge=mplsLspAge, mplsPathInfoProperties=mplsPathInfoProperties, mplsLspTransitions=mplsLspTransitions, mplsPathExclude=mplsPathExclude, mplsPathInfoType=mplsPathInfoType, mplsLspTraps=mplsLspTraps, mplsLspOperationalPaths=mplsLspOperationalPaths, mplsLspInfoAge=mplsLspInfoAge, mplsLspTo=mplsLspTo, mplsTEDistProtocol=mplsTEDistProtocol, mplsLspInfoAggrOctets=mplsLspInfoAggrOctets, mplsPathRecordRoute=mplsPathRecordRoute, mplsLspInfoStandbyPaths=mplsLspInfoStandbyPaths, mplsLspInfoChange=mplsLspInfoChange, mplsPathType=mplsPathType, mplsPathExplicitRoute=mplsPathExplicitRoute, mplsLspDown=mplsLspDown, mplsLspInfoPackets=mplsLspInfoPackets, mplsAdminGroupList=mplsAdminGroupList, mplsAdminGroupName=mplsAdminGroupName, mplsPathInclude=mplsPathInclude, mplsLspEntry=mplsLspEntry, mplsLspInfoLastPathChange=mplsLspInfoLastPathChange, mplsPathProperties=mplsPathProperties, mplsTEInfo=mplsTEInfo, mplsLspInfoDown=mplsLspInfoDown, mplsPathName=mplsPathName, mplsLspInfoTo=mplsLspInfoTo, mplsVersion=mplsVersion, mplsPathInfoExplicitRoute=mplsPathInfoExplicitRoute, mplsPathInfoHoldPriority=mplsPathInfoHoldPriority, mplsLspState=mplsLspState, mplsPathInfoRecordRouteWithLabels=mplsPathInfoRecordRouteWithLabels, mplsLspFrom=mplsLspFrom, mplsLspInfoTransitions=mplsLspInfoTransitions, mplsPathInfoRecordRoute=mplsPathInfoRecordRoute, mplsActiveLsps=mplsActiveLsps, mplsSignalingProto=mplsSignalingProto, mplsAdminGroupNumber=mplsAdminGroupNumber, mplsPathInfoBandwidth=mplsPathInfoBandwidth, mplsPathInfoExclude=mplsPathInfoExclude, mplsConfiguredLsps=mplsConfiguredLsps, mplsLspPathDown=mplsLspPathDown, mpls=mpls, mplsLspInfoList=mplsLspInfoList, mplsLspInfoState=mplsLspInfoState, mplsLspInfoPathChanges=mplsLspInfoPathChanges, mplsLspTimeUp=mplsLspTimeUp, mplsLspInfoAggrPackets=mplsLspInfoAggrPackets, mplsLspPathUp=mplsLspPathUp, mplsPathHoldPriority=mplsPathHoldPriority, mplsAdminGroup=mplsAdminGroup, mplsPathInfoCOS=mplsPathInfoCOS, mplsPathInfoSetupPriority=mplsPathInfoSetupPriority, mplsLspPrimaryTimeUp=mplsLspPrimaryTimeUp, mplsLspUp=mplsLspUp, mplsLspInfoPrimaryTimeUp=mplsLspInfoPrimaryTimeUp, mplsLspLastTransition=mplsLspLastTransition, mplsTraps=mplsTraps, mplsLspInfoPathDown=mplsLspInfoPathDown, mplsLspOctets=mplsLspOctets, mplsLspInfoConfiguredPaths=mplsLspInfoConfiguredPaths, mplsLspStandbyPaths=mplsLspStandbyPaths, mplsLspPackets=mplsLspPackets, mplsPathBandwidth=mplsPathBandwidth, mplsLspList=mplsLspList, mplsPathSetupPriority=mplsPathSetupPriority, mplsLspInfoFrom=mplsLspInfoFrom, mplsLspLastPathChange=mplsLspLastPathChange, mplsLspInfoName=mplsLspInfoName, mplsLspPathChanges=mplsLspPathChanges, PYSNMP_MODULE_ID=mpls, mplsLspInfoTimeUp=mplsLspInfoTimeUp, mplsLspInfoLastTransition=mplsLspInfoLastTransition, mplsLspInfoUp=mplsLspInfoUp, mplsLspConfiguredPaths=mplsLspConfiguredPaths, mplsPathInfoInclude=mplsPathInfoInclude, mplsLspInfoOctets=mplsLspInfoOctets, mplsLspInfoEntry=mplsLspInfoEntry, mplsInfo=mplsInfo, mplsLspInfoOperationalPaths=mplsLspInfoOperationalPaths, mplsPathCOS=mplsPathCOS, mplsLspChange=mplsLspChange, mplsLspName=mplsLspName, mplsPathInfoName=mplsPathInfoName)
| 122.217391 | 3,202 | 0.75756 | 2,551 | 22,488 | 6.677381 | 0.097217 | 0.010332 | 0.01497 | 0.01996 | 0.50951 | 0.487789 | 0.462193 | 0.462193 | 0.359223 | 0.358518 | 0 | 0.078765 | 0.082577 | 22,488 | 183 | 3,203 | 122.885246 | 0.746886 | 0.013785 | 0 | 0 | 0 | 0 | 0.113762 | 0.001985 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.011364 | 0.039773 | 0 | 0.039773 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
67c84b10a508ae545e1b64ccf164c8b6068592b6 | 296 | py | Python | sampleproject/sampleproject/urls.py | wintercircle/django-easy-select2 | 1ced19c5b46fe47e1cb4f7c4ee3266c2654d4060 | [
"MIT"
] | null | null | null | sampleproject/sampleproject/urls.py | wintercircle/django-easy-select2 | 1ced19c5b46fe47e1cb4f7c4ee3266c2654d4060 | [
"MIT"
] | null | null | null | sampleproject/sampleproject/urls.py | wintercircle/django-easy-select2 | 1ced19c5b46fe47e1cb4f7c4ee3266c2654d4060 | [
"MIT"
] | null | null | null | from django.conf.urls import include, url
from django.conf.urls.static import static
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = [
url(r'^admin/', admin.site.urls),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
| 26.909091 | 67 | 0.783784 | 42 | 296 | 5.452381 | 0.404762 | 0.174672 | 0.183406 | 0.157205 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.111486 | 296 | 10 | 68 | 29.6 | 0.870722 | 0 | 0 | 0 | 0 | 0 | 0.023649 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
67cc7035ac3b11926c14676304e797de81a16af9 | 445 | py | Python | animal.py | CraneJen/Python-Study-Srouce-code | ff4bbb5025a4bf8d4ebef587f31929ad2ea84f29 | [
"Apache-2.0"
] | null | null | null | animal.py | CraneJen/Python-Study-Srouce-code | ff4bbb5025a4bf8d4ebef587f31929ad2ea84f29 | [
"Apache-2.0"
] | null | null | null | animal.py | CraneJen/Python-Study-Srouce-code | ff4bbb5025a4bf8d4ebef587f31929ad2ea84f29 | [
"Apache-2.0"
] | null | null | null | class Animal(object):
def run(self):
print('Animal is running...')
def eat(self):
print('Animal is eating...')
class Dog(Animal):
def run(self):
print('Dog is running...')
class Cat(Animal):
def __init__(self):
self.name = 'Tom'
def __str__(self):
return self.name
def __len__(self):
return 100
dog = Dog()
dog.run()
dog.eat()
cat = Cat()
cat.run()
print(cat)
| 12.714286 | 37 | 0.552809 | 59 | 445 | 3.966102 | 0.338983 | 0.115385 | 0.08547 | 0.128205 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009494 | 0.289888 | 445 | 34 | 38 | 13.088235 | 0.731013 | 0 | 0 | 0.095238 | 0 | 0 | 0.132584 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0 | 0.095238 | 0.52381 | 0.190476 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
67dec107bcdcc5495e5790ab61aa396eed3779f5 | 576 | py | Python | DeepLearning/07 Tensorflow/constance.py | ToTo-Mo/Notebook | 4851c4d21d5206358796a24def459f107c4ce6dd | [
"Apache-2.0"
] | 4 | 2020-06-16T03:16:34.000Z | 2020-10-26T01:12:25.000Z | DeepLearning/07 Tensorflow/constance.py | ToTo-Mo/Notebook | 4851c4d21d5206358796a24def459f107c4ce6dd | [
"Apache-2.0"
] | null | null | null | DeepLearning/07 Tensorflow/constance.py | ToTo-Mo/Notebook | 4851c4d21d5206358796a24def459f107c4ce6dd | [
"Apache-2.0"
] | 1 | 2020-06-17T03:30:57.000Z | 2020-06-17T03:30:57.000Z | import tensorflow as tf
_1 = tf.zeros([2,3], tf.int32)
print(_1)
# [[0,0,0],[0,0,0]]
input_tensor = tf.constant([[1,2,3],[4,5,6]])
_2 = tf.zeros_like(input_tensor)
print(_2)
# [[0,0,0],[0,0,0]]
_3 = tf.ones([2,3], tf.int32)
print(_3)
_4 = tf.fill([2,3],7)
print(_4)
# [[7,7,7],[7,7,7]]
_5 = tf.linspace(10.0,13.0,4) # min, max, count
print(_5)
# [10.0, 11.0, 12.0, 13.0]
start, limit, delta = (1,10,2)
_6 = tf.range(start, limit, delta)
print(_6)
_7 = tf.range(limit)
print(_7)
# [0, 1, 2, 3, 4, 5]
# tf.random_normal()
# tf.random_uniform()
# tf.random_shuffle() | 16.941176 | 50 | 0.588542 | 122 | 576 | 2.614754 | 0.303279 | 0.062696 | 0.075235 | 0.075235 | 0.175549 | 0.037618 | 0 | 0 | 0 | 0 | 0 | 0.158537 | 0.145833 | 576 | 34 | 51 | 16.941176 | 0.489837 | 0.298611 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.058824 | 0 | 0.058824 | 0.411765 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
67e18936626532069d98f60bd9af70a80bf8bba1 | 2,199 | py | Python | PL-test.py | rehemafaith/password-locker | e32561599a75e08f3287c2df8eba755cbc186257 | [
"MIT"
] | null | null | null | PL-test.py | rehemafaith/password-locker | e32561599a75e08f3287c2df8eba755cbc186257 | [
"MIT"
] | null | null | null | PL-test.py | rehemafaith/password-locker | e32561599a75e08f3287c2df8eba755cbc186257 | [
"MIT"
] | null | null | null | import unittest
from cred import Credential
class TestUser(unittest.TestCase):
'''
Test class that defines tes cases for the Credential class behaviours.
Args:
unittest.TestCase: TestCase class that helps in creating test cases
'''
def setUp(self):
'''
Set up method to run before each test cases.
'''
self.new_cred = Credential("Rehema","0708212463","shalomneema",)
def tearDown(self):
'''
tearDown method that does clean up after each case has run.
'''
Credential.credential_list = []
def test_init(self):
'''
test_init test case to test if the object is initialized properly
'''
self.assertEqual(self.new_cred.username,"Rehema")
self.assertEqual(self.new_cred.phone_number,"0708212463")
self.assertEqual(self.new_cred.password,"shalomneema")
def test_save_credential(self):
'''
test_save_credentials test case to test if the credential
object is saved into the credential list
'''
self.new_cred.save_credential()
self.assertEqual(len(Credential.credential_list),1)
def test_save_multiple_credential(self):
'''
test_save_multiple_credential to check if we we can save
multiple contact
objects to our credential_list
'''
self.new_cred.save_credential()
test_credential= Credential("Rehema","0708212463","shalomneema")
test_credential.save_credential()
self.assertEqual(len(Credential.credential_list),2)
def delete_credential(self):
'''
delete_credential method deletes a saved contact from the contact_list
'''
Credential.credential_list.remove(self)
def test_find_credential_by_username(self):
'''
test to check if we can find a contact by username and
display information
'''
self.new_cred.save_credential()
test_credential =Credential("Rehema","0708212463","shalomneema")
test_credential.save_credential()
found_credential = Credential.find_by_username("Rehema")
self.assertEqual(found_credential.password,test_credential.password)
if __name__ == '__main__':
unittest.main()
| 28.558442 | 75 | 0.686676 | 262 | 2,199 | 5.557252 | 0.29771 | 0.033654 | 0.052885 | 0.076236 | 0.316621 | 0.263049 | 0.236951 | 0.210165 | 0.142857 | 0.142857 | 0 | 0.02459 | 0.223283 | 2,199 | 76 | 76 | 28.934211 | 0.827869 | 0.307412 | 0 | 0.241379 | 0 | 0 | 0.090639 | 0 | 0 | 0 | 0 | 0 | 0.206897 | 1 | 0.241379 | false | 0.068966 | 0.068966 | 0 | 0.344828 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
67e1b2ae69e0b349dfdd5fc812b59eabedd4f00c | 230 | py | Python | GameBot/src_py/capturer_mouse_pos.py | imakin/ProsesKiller | 2575a3516b4cfa245e1053876e61f0f222f214b2 | [
"MIT"
] | null | null | null | GameBot/src_py/capturer_mouse_pos.py | imakin/ProsesKiller | 2575a3516b4cfa245e1053876e61f0f222f214b2 | [
"MIT"
] | null | null | null | GameBot/src_py/capturer_mouse_pos.py | imakin/ProsesKiller | 2575a3516b4cfa245e1053876e61f0f222f214b2 | [
"MIT"
] | null | null | null | import time
from makinreusable.winfunction import *
import ImageGrab
while True:
pos = mouse_pos_get()
col = ImageGrab.grab().getpixel((int(pos[0]),int(pos[1])))
print("mouse pos:",pos,"color:",col)
time.sleep(1)
| 23 | 62 | 0.678261 | 33 | 230 | 4.666667 | 0.606061 | 0.103896 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015464 | 0.156522 | 230 | 9 | 63 | 25.555556 | 0.778351 | 0 | 0 | 0 | 0 | 0 | 0.069565 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.375 | 0 | 0.375 | 0.125 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
67f1cf46abf6fb7c50fe8fd8b6a11018ac30b1d8 | 516 | py | Python | Code/boot.py | cocoaswifty/ESP8266 | eb6d4111586ff2841077909ca4a07a997dc30176 | [
"MIT"
] | null | null | null | Code/boot.py | cocoaswifty/ESP8266 | eb6d4111586ff2841077909ca4a07a997dc30176 | [
"MIT"
] | null | null | null | Code/boot.py | cocoaswifty/ESP8266 | eb6d4111586ff2841077909ca4a07a997dc30176 | [
"MIT"
] | null | null | null | import machine
import uos
import webrepl
import gc
import esp
esp.osdebug(None) # 開啟除錯功能
# uos.dupterm(None, 1) # disable REPL on UART(0)
def connectAP(ssid, pwd):
import network
wlan = network.WLAN(network.STA_IF) # 設定成STA模式
if not wlan.isconnected():
wlan.active(True) # 啟用無線網路
wlan.connect(ssid, pwd)
while not wlan.isconnected(): # 等待,直到連線成功
pass
print('network config:', wlan.ifconfig())
connectAP('City free wifi', 'pwssword')
webrepl.start()
gc.collect()
| 19.846154 | 51 | 0.670543 | 69 | 516 | 5 | 0.637681 | 0.04058 | 0.104348 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004902 | 0.209302 | 516 | 25 | 52 | 20.64 | 0.840686 | 0.151163 | 0 | 0 | 0 | 0 | 0.085847 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.055556 | false | 0.055556 | 0.333333 | 0 | 0.388889 | 0.055556 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 2 |
db03aa0b3a0694aba5ffe7d6582d179d4a0c183e | 3,433 | py | Python | scripts/misc/config_rebuttal_3dlift_adr.py | clvrai/mopa-pd | ac55f568149d8e79c28326bcd9b63336ed065a61 | [
"MIT"
] | 6 | 2021-11-04T01:38:17.000Z | 2022-02-20T11:42:42.000Z | scripts/misc/config_rebuttal_3dlift_adr.py | clvrai/mopa-pd | ac55f568149d8e79c28326bcd9b63336ed065a61 | [
"MIT"
] | null | null | null | scripts/misc/config_rebuttal_3dlift_adr.py | clvrai/mopa-pd | ac55f568149d8e79c28326bcd9b63336ed065a61 | [
"MIT"
] | 2 | 2021-11-29T14:15:48.000Z | 2021-12-18T15:10:05.000Z | filename_prefix = 'Rebuttal-SawyerLift-ADR'
xlabel = 'Environment steps (3M)'
ylabel = "Average Discounted Rewards"
mopa_cutoff_step = 1000000
others_cutoff_step = 2000000
max_step = 3000000
max_y_axis_value = 110
legend = False
data_key = "train_ep/rew_discounted"
bc_y_value = 34.77
plot_labels = {
"Ours": [
'Rebuttal_Ours_Lift_1234_smart-river-671',
'Rebuttal_Ours_Lift_200_clean-cherry-673',
'Rebuttal_Ours_Lift_2320_clear-water-695',
'Rebuttal_Ours_Lift_500_vivid-lake-675',
'Rebuttal_Ours_Lift_1800_lilac-butterfly-676',
],
"Ours (w/o BC smoothing)": [
'Rebuttal_Ours(wo_bc_smoothing)_Lift_1234_sparkling-terrain-670',
'Rebuttal_Ours(wo_bc_smoothing)_Lift_200_toasty-pine-678',
'Rebuttal_Ours(wo_bc_smoothing)_Lift_2320_ethereal-deluge-692',
'Rebuttal_Ours(wo_bc_smoothing)_Lift_500_floral-water-679',
'Rebuttal_Ours(wo_bc_smoothing)_Lift_1800_youthful-microwave-674',
],
"CoL": [
'Rebuttal_CoL_MoPA_Lift_1234_stoic-fire-187',
'Rebuttal_CoL_MoPA_Lift_200_wandering-waterfall-188',
'Rebuttal_CoL_MoPA_Lift_2320_desert-flower-696',
'Rebuttal_CoL_MoPA_Lift_500_expert-brook-189',
'Rebuttal_CoL_MoPA_Lift_1800_usual-cloud-224',
],
"CoL(w BC smoothing)": [
'Rebuttal_CoL_Lift_1234_scarlet-yogurt-681',
'Rebuttal_CoL_Lift_200_lunar-sun-683',
'Rebuttal_CoL_Lift_2320_lyric-frog-689',
'Rebuttal_CoL_Lift_500_scarlet-eon-685',
'Rebuttal_CoL_Lift_1800_astral-night-671',
],
"MoPA Asym. SAC": [
'Rebuttal_MoPA-Asym._SAC_Lift_1234_rl.SawyerLiftObstacle-v0.08.21.07.52.Asymmetric-MoPA-SAC.0',
'Rebuttal_MoPA-Asym._SAC_Lift_200_rl.SawyerLiftObstacle-v0.08.22.01.30.Asymmetric-MoPA-SAC.0',
'Rebuttal_MoPA-Asym._SAC_Lift_2320_rl.SawyerLiftObstacle-v0.08.28.15.22.Asymmetric-MoPA-SAC.0',
'Rebuttal_MoPA-Asym._SAC_Lift_500_rl.SawyerLiftObstacle-v0.08.22.01.35.Asymmetric-MoPA-SAC.0',
'Rebuttal_MoPA-Asym._SAC_Lift_1800_rl.SawyerLiftObstacle-v0.08.30.07.28.Asymmetric-MoPA-SAC.0',
],
"Asym. SAC": [
'Rebuttal_Asym._SAC_Lift_1234_fast-bee-631',
'Rebuttal_Asym._SAC_Lift_200_swift-smoke-632',
'Rebuttal_Asym._SAC_Lift_500_visionary-dream-633',
'Rebuttal_Asym._SAC_Lift_2320_MyMachine_rural-valley-691',
'Rebuttal_Asym._SAC_Lift_1800_zany-wave-684',
],
}
# choosing Rebuttal_Asym._SAC_Assembly_200_comfy-violet-635 because it has 3m env. steps
line_labels = {
"BC-Visual": ['Rebuttal_Asym._SAC_Assembly_200_comfy-violet-635'],
}
line_colors = {
'Ours': 'C0',
'Ours (w/o BC smoothing)': 'C1',
'CoL': 'C2',
'CoL(w BC smoothing)': 'C3',
'MoPA Asym. SAC': 'C4',
'Asym. SAC': 'C5',
'BC-Visual': 'C6',
}
mopa_curve = {
"Ours": 'Rebuttal_MoPA_RL_Lift_2000_rl.SawyerLiftObstacle-v0.08.27.MoPA-SAC.2000',
"Ours (w/o BC smoothing)": 'Rebuttal_MoPA_RL_Lift_2000_rl.SawyerLiftObstacle-v0.08.27.MoPA-SAC.2000',
"CoL": 'Rebuttal_MoPA_RL_Lift_2000_rl.SawyerLiftObstacle-v0.08.27.MoPA-SAC.2000',
"CoL(w BC smoothing)": 'Rebuttal_MoPA_RL_Lift_2000_rl.SawyerLiftObstacle-v0.08.27.MoPA-SAC.2000',
}
# plot_labels = {
# "Ours": [],
# "Ours (w/o BC smoothing)": [],
# "CoL": [],
# "CoL(w BC smoothing)": [],
# "MoPA Asym. SAC": [],
# "Asym. SAC": [],
# }
# line_labels = {
# "BC-Visual": [],
# } | 36.521277 | 105 | 0.693854 | 487 | 3,433 | 4.488706 | 0.330595 | 0.05764 | 0.05032 | 0.098811 | 0.371912 | 0.334858 | 0.232388 | 0.232388 | 0.195791 | 0.120769 | 0 | 0.116498 | 0.16487 | 3,433 | 94 | 106 | 36.521277 | 0.645971 | 0.0836 | 0 | 0.083333 | 0 | 0.069444 | 0.71538 | 0.628271 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.