blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
616
content_id
stringlengths
40
40
detected_licenses
listlengths
0
112
license_type
stringclasses
2 values
repo_name
stringlengths
5
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
777 values
visit_date
timestamp[us]date
2015-08-06 10:31:46
2023-09-06 10:44:38
revision_date
timestamp[us]date
1970-01-01 02:38:32
2037-05-03 13:00:00
committer_date
timestamp[us]date
1970-01-01 02:38:32
2023-09-06 01:08:06
github_id
int64
4.92k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]date
2012-06-04 01:52:49
2023-09-14 21:59:50
gha_created_at
timestamp[us]date
2008-05-22 07:58:19
2023-08-21 12:35:19
gha_language
stringclasses
149 values
src_encoding
stringclasses
26 values
language
stringclasses
1 value
is_vendor
bool
2 classes
is_generated
bool
2 classes
length_bytes
int64
3
10.2M
extension
stringclasses
188 values
content
stringlengths
3
10.2M
authors
listlengths
1
1
author_id
stringlengths
1
132
c0b2e8faa338dca0df9b00fb60c53f05f3eda904
0fd974aa23da92b81d7a7a769d24563b49020023
/venom/rpc/resolver.py
1e6f479789501e06961c82e3d7a959c21179ca7e
[ "MIT" ]
permissive
lyschoening/venom
188b21c14092bfb39eed5b4911c64425e4497818
167967e7a8078a7227dc50dbc40df38e5dd6f520
refs/heads/master
2020-04-18T07:27:03.160796
2018-01-30T10:31:26
2018-01-30T10:31:26
null
0
0
null
null
null
null
UTF-8
Python
false
false
568
py
from abc import abstractmethod, ABCMeta from typing import TypeVar, Generic, Type T = TypeVar('_T') class Resolver(Generic[T], metaclass=ABCMeta): python: Type[T] = None async def __call__(self, service: 'venom.rpc.service.Service', request: 'venom.message.Message') -> T: return await self.resolve(service, request) @abstractmethod async def resolve(self, service: 'venom.rpc.service.Service', request: 'venom.message.Message') -> T: pass
[ "lars@lyschoening.de" ]
lars@lyschoening.de
e1bc9fe5632a807432c86b9ec2bf5a4116df296b
e7c2b9ef846f4159975b024ec2f9a535ce19de40
/setup.py
393ce848df845539658582c039428d375177ddd3
[ "MIT" ]
permissive
kellychenma/db_tools
c7f8af420d472d0d412d4bf9d1ec74f99a67d3d1
23d971af485a90176cfbfd2b2ed2d1f7c5b28f9b
refs/heads/master
2021-09-10T08:17:24.388278
2018-01-09T18:05:41
2018-01-09T18:05:41
116,858,439
0
0
null
2018-01-09T19:08:36
2018-01-09T19:08:36
null
UTF-8
Python
false
false
2,292
py
#!/usr/bin/env python # -*- coding: utf-8 -*- """The setup script.""" from setuptools import setup, find_packages import inspect from pathlib import Path HOME_DIR = Path(inspect.getfile(inspect.currentframe())).parent def filter_req_paths(paths, func): """Return list of filtered libs.""" if not isinstance(paths, list): raise ValueError("Paths must be a list of paths.") libs = set() junk = set(['\n']) for p in paths: with p.open(mode='r') as reqs: lines = set([line for line in reqs if func(line)]) libs.update(lines) return list(libs - junk) def is_pipable(line): """Filter for pipable reqs.""" if "# not_pipable" in line: return False elif line.startswith('#'): return False else: return True with open('README.rst') as readme_file: readme = readme_file.read() with open('HISTORY.rst') as history_file: history = history_file.read() requirements = filter_req_paths(paths=[HOME_DIR / "requirements.txt", HOME_DIR / "requirements.pip.txt"], func=is_pipable) setup_requirements = ["pytest-runner"] test_requirements = test_requirements = ["pytest"] setup( name='db_tools', version='0.0.2', description="A set of command line executable and script importable tools to aid the Snapper Lab in managing and combining RedCap, FreezerPro, and other databases.", long_description=readme + '\n\n' + history, author="Gus Dunn", author_email='w.gus.dunn@gmail.com', url='https://github.com/xguse/db_tools', packages=find_packages(include=['db_tools']), entry_points={ 'console_scripts': [ 'db_tools=db_tools.cli:main' ] }, include_package_data=True, install_requires=requirements, license="MIT license", zip_safe=False, keywords='db_tools', classifiers=[ 'Development Status :: 2 - Pre-Alpha', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Natural Language :: English', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', ], test_suite='tests', tests_require=test_requirements, setup_requires=setup_requirements, )
[ "w.gus.dunn@gmail.com" ]
w.gus.dunn@gmail.com
8b7d725bc372f8421c58f3057b859423be635101
bb33e6be8316f35decbb2b81badf2b6dcf7df515
/source/res/scripts/common/battle_results/battle_results_common.py
6059bd07ece39d858602b865fd355b2a3aacdee1
[]
no_license
StranikS-Scan/WorldOfTanks-Decompiled
999c9567de38c32c760ab72c21c00ea7bc20990c
d2fe9c195825ececc728e87a02983908b7ea9199
refs/heads/1.18
2023-08-25T17:39:27.718097
2022-09-22T06:49:44
2022-09-22T06:49:44
148,696,315
103
39
null
2022-09-14T17:50:03
2018-09-13T20:49:11
Python
UTF-8
Python
false
false
28,386
py
# Python bytecode 2.7 (decompiled from Python 2.7) # Embedded file name: scripts/common/battle_results/battle_results_common.py from battle_results_constants import BATTLE_RESULT_ENTRY_TYPE as ENTRY_TYPE from constants import FLAG_ACTION from DictPackers import DictPacker, MergeDictPacker, SimpleDictPacker, DeltaPacker, ValueReplayPacker, roundToInt from items.vehicles import VEHICLE_DEVICE_TYPE_NAMES, VEHICLE_TANKMAN_TYPE_NAMES from items.badges_common import BadgesCommon BATTLE_RESULTS = [('health', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_ALL), ('maxHealth', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_ALL), ('credits', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('xp', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('xp/attack', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('xp/assist', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('xp/other', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('xpPenalty', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('achievementCredits', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_ALL), ('achievementXP', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_ALL), ('achievementFreeXP', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_ALL), ('shots', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('directHits', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('directEnemyHits', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('directTeamHits', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('explosionHits', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('piercings', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('piercingEnemyHits', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('damageDealt', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('sniperDamageDealt', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('artilleryFortEquipDamageDealt', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('equipmentDamageDealt', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('damageAssistedRadio', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('damageAssistedTrack', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('damageAssistedStun', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('damageAssistedSmoke', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('damageAssistedInspire', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('stunNum', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('stunDuration', float, 0.0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('damageReceived', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('damageReceivedFromInvisibles', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('damageBlockedByArmor', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('directHitsReceived', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('noDamageDirectHitsReceived', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('explosionHitsReceived', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('piercingsReceived', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('tdamageDealt', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('tdestroyedModules', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('tkills', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('isTeamKiller', bool, False, None, 'max', ENTRY_TYPE.VEHICLE_ALL), ('capturePoints', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('capturingBase', None, None, None, 'any', ENTRY_TYPE.VEHICLE_ALL), ('droppedCapturePoints', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('mileage', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('lifeTime', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('killerID', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_ALL), ('achievements', list, [], None, 'extend', ENTRY_TYPE.VEHICLE_ALL), ('inBattleAchievements', list, [], None, 'extend', ENTRY_TYPE.VEHICLE_ALL), ('potentialDamageReceived', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('rolloutsCount', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('deathCount', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('flagActions', list, [0] * len(FLAG_ACTION.RANGE), None, 'sumInEachPos', ENTRY_TYPE.VEHICLE_ALL), ('soloFlagCapture', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('flagCapture', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('winPoints', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('resourceAbsorbed', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('stopRespawn', bool, False, None, 'max', ENTRY_TYPE.VEHICLE_ALL), ('numRecovered', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('vehicleNumCaptured', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('destructiblesNumDestroyed', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('destructiblesDamageDealt', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('destructiblesHits', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('destructibleDeaths', list, [], None, 'extend', ENTRY_TYPE.VEHICLE_ALL), ('numDefended', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('accountDBID', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_ALL), ('typeCompDescr', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_ALL), ('index', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_ALL), ('deathReason', int, -1, None, 'skip', ENTRY_TYPE.VEHICLE_ALL), ('team', int, 1, None, 'skip', ENTRY_TYPE.VEHICLE_ALL), ('kills', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('spotted', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('damaged', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('damagedHp', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('stunned', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_ALL), ('repair', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('freeXP', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('details', None, None, None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('creditsPenalty', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('creditsContributionIn', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('creditsContributionOut', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('originalCreditsToDraw', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('creditsToDraw', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('damageBeforeTeamWasDamaged', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('killsBeforeTeamWasDamaged', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('percentFromTotalTeamDamage', float, 0.0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('winAloneAgainstVehicleCount', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('percentFromSecondBestDamage', float, 0.0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('killedAndDamagedByAllSquadmates', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('damagedWhileMoving', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('damagedWhileEnemyMoving', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('committedSuicide', bool, False, None, 'max', ENTRY_TYPE.VEHICLE_SELF), ('crystal', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('eventCoin', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('bpcoin', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('piggyBank', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('eventCredits', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('eventXP', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('eventFreeXP', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('eventTMenXP', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('eventGold', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('eventCrystal', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('eventEventCoin', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('eventBpcoin', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('originalCredits', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('creditsReplay', str, '', ValueReplayPacker(), 'skip', ENTRY_TYPE.VEHICLE_SELF), ('originalXP', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('xpReplay', str, '', ValueReplayPacker(), 'skip', ENTRY_TYPE.VEHICLE_SELF), ('originalFreeXP', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('freeXPReplay', str, '', ValueReplayPacker(), 'skip', ENTRY_TYPE.VEHICLE_SELF), ('originalTMenXP', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('tmenXPReplay', str, '', ValueReplayPacker(), 'skip', ENTRY_TYPE.VEHICLE_SELF), ('tmenXP', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('originalGold', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('goldReplay', str, '', ValueReplayPacker(), 'skip', ENTRY_TYPE.VEHICLE_SELF), ('gold', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('originalCrystal', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('crystalReplay', str, '', ValueReplayPacker(), 'skip', ENTRY_TYPE.VEHICLE_SELF), ('originalEventCoin', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('originalBpcoin', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('eventCoinReplay', str, '', ValueReplayPacker(), 'skip', ENTRY_TYPE.VEHICLE_SELF), ('bpcoinReplay', str, '', ValueReplayPacker(), 'skip', ENTRY_TYPE.VEHICLE_SELF), ('factualXP', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('factualFreeXP', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('factualCredits', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('subtotalCredits', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('subtotalXP', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('subtotalFreeXP', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('subtotalTMenXP', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('subtotalGold', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('subtotalCrystal', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('subtotalEventCoin', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('subtotalBpcoin', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('eventCreditsList', list, [], None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('eventXPList', list, [], None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('eventFreeXPList', list, [], None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('eventTMenXPList', list, [], None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('eventGoldList', list, [], None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('eventCrystalList', list, [], None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('eventEventCoinList', list, [], None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('eventBpcoinList', list, [], None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('eventCreditsFactor100List', list, [], None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('eventXPFactor100List', list, [], None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('eventFreeXPFactor100List', list, [], None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('eventTMenXPFactor100List', list, [], None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('eventGoldFactor100List', list, [], None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('originalXPPenalty', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('originalCreditsPenalty', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('originalCreditsContributionIn', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('originalCreditsContributionOut', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('premiumVehicleXP', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('premiumVehicleXPFactor100', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('squadXP', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('squadXPFactor100', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('referral20XP', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('referral20XPFactor100', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('referral20Credits', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('referral20CreditsFactor100', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('premiumXPFactor100', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('premiumPlusXPFactor100', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('appliedPremiumXPFactor100', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('premiumTmenXPFactor100', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('premiumPlusTmenXPFactor100', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('appliedPremiumTmenXPFactor100', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('premiumCreditsFactor100', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('premiumPlusCreditsFactor100', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('appliedPremiumCreditsFactor100', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('premSquadCreditsFactor100', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('originalPremSquadCredits', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('premSquadCredits', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('dailyXPFactor10', int, 0, None, 'max', ENTRY_TYPE.VEHICLE_SELF), ('additionalXPFactor10', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('igrXPFactor10', int, 0, None, 'max', ENTRY_TYPE.VEHICLE_SELF), ('aogasFactor10', int, 0, None, 'max', ENTRY_TYPE.VEHICLE_SELF), ('refSystemXPFactor10', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('fairplayFactor10', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('orderCredits', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('orderXP', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('orderFreeXP', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('orderTMenXP', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('orderCreditsFactor100', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('orderXPFactor100', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('orderFreeXPFactor100', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('orderTMenXPFactor100', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('boosterCredits', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('boosterXP', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('boosterFreeXP', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('boosterTMenXP', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('boosterCreditsFactor100', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('boosterXPFactor100', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('boosterFreeXPFactor100', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('boosterTMenXPFactor100', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('playerRankXP', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('playerRankXPFactor100', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('isPremium', bool, False, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('premMask', int, 0, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('xpByTmen', list, [], None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('autoRepairCost', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('autoLoadCost', tuple, (0, 0), None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('autoEquipCost', tuple, (0, 0, 0), None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('autoEquipBoostersCost', tuple, (0, 0, 0), None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('prevMarkOfMastery', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('markOfMastery', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('dossierPopUps', list, [], None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('dossierLogRecords', list, [], None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('vehTypeLockTime', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('serviceProviderID', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('marksOnGun', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('movingAvgDamage', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('damageRating', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('battleNum', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('questsProgress', dict, {}, None, 'joinDicts', ENTRY_TYPE.VEHICLE_SELF), ('c11nProgress', dict, {}, None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('originalCreditsToDrawSquad', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('originalCreditsPenaltySquad', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('originalCreditsContributionInSquad', int, 0, None, 'skip', ENTRY_TYPE.VEHICLE_SELF), ('originalCreditsContributionOutSquad', int, 0, None, 'sum', ENTRY_TYPE.VEHICLE_SELF), ('avatarDamageDealt', int, 0, None, 'skip', ENTRY_TYPE.ACCOUNT_ALL), ('avatarKills', int, 0, None, 'skip', ENTRY_TYPE.ACCOUNT_ALL), ('avatarDamaged', int, 0, None, 'skip', ENTRY_TYPE.ACCOUNT_ALL), ('totalDamaged', int, 0, None, 'skip', ENTRY_TYPE.ACCOUNT_ALL), ('fairplayViolations', tuple, (0, 0, 0), None, 'skip', ENTRY_TYPE.ACCOUNT_ALL), ('badges', tuple, BadgesCommon.selectedBadgesEmpty(), None, 'skip', ENTRY_TYPE.ACCOUNT_ALL), ('rankChange', int, 0, None, 'skip', ENTRY_TYPE.ACCOUNT_SELF), ('avatarAmmo', list, [], None, 'skip', ENTRY_TYPE.ACCOUNT_SELF), ('avatarDamageEventList', set, set(), None, 'skip', ENTRY_TYPE.ACCOUNT_SELF), ('accountDBID', int, 0, None, 'any', ENTRY_TYPE.ACCOUNT_SELF), ('team', int, 1, None, 'skip', ENTRY_TYPE.ACCOUNT_SELF), ('clanDBID', int, 0, None, 'skip', ENTRY_TYPE.ACCOUNT_SELF), ('fortClanDBIDs', list, [], None, 'skip', ENTRY_TYPE.ACCOUNT_SELF), ('winnerIfDraw', int, 0, None, 'skip', ENTRY_TYPE.ACCOUNT_SELF), ('isPrematureLeave', bool, False, None, 'skip', ENTRY_TYPE.ACCOUNT_SELF), ('watchedBattleToTheEnd', bool, False, None, 'skip', ENTRY_TYPE.ACCOUNT_SELF), ('vseBattleResults', dict, {}, None, 'skip', ENTRY_TYPE.ACCOUNT_SELF), ('squadBonusInfo', None, None, None, 'skip', ENTRY_TYPE.ACCOUNT_SELF), ('progressiveReward', None, None, None, 'skip', ENTRY_TYPE.ACCOUNT_SELF), ('eligibleForCrystalRewards', bool, False, None, 'skip', ENTRY_TYPE.ACCOUNT_SELF), ('activeRents', dict, {}, None, 'skip', ENTRY_TYPE.ACCOUNT_SELF), ('recruitsIDs', list, [], None, 'skip', ENTRY_TYPE.ACCOUNT_SELF), ('recruiterID', int, 0, None, 'skip', ENTRY_TYPE.ACCOUNT_SELF), ('referralBonusVehicles', list, [], None, 'skip', ENTRY_TYPE.ACCOUNT_SELF), ('fareTeamXPPosition', int, 0, None, 'skip', ENTRY_TYPE.ACCOUNT_SELF), ('questsProgress', dict, {}, None, 'joinDicts', ENTRY_TYPE.ACCOUNT_SELF), ('PM2Progress', dict, {}, None, 'skip', ENTRY_TYPE.ACCOUNT_SELF), ('dogTags', dict, {}, None, 'skip', ENTRY_TYPE.ACCOUNT_SELF), ('eventCredits', int, 0, None, 'sum', ENTRY_TYPE.ACCOUNT_SELF), ('eventXP', int, 0, None, 'sum', ENTRY_TYPE.ACCOUNT_SELF), ('eventFreeXP', int, 0, None, 'sum', ENTRY_TYPE.ACCOUNT_SELF), ('eventTMenXP', int, 0, None, 'sum', ENTRY_TYPE.ACCOUNT_SELF), ('eventGold', int, 0, None, 'sum', ENTRY_TYPE.ACCOUNT_SELF), ('eventCrystal', int, 0, None, 'sum', ENTRY_TYPE.ACCOUNT_SELF), ('eventEventCoin', int, 0, None, 'sum', ENTRY_TYPE.ACCOUNT_SELF), ('eventBpcoin', int, 0, None, 'sum', ENTRY_TYPE.ACCOUNT_SELF), ('credits', int, 0, None, 'sum', ENTRY_TYPE.ACCOUNT_SELF), ('xp', int, 0, None, 'sum', ENTRY_TYPE.ACCOUNT_SELF), ('freeXP', int, 0, None, 'sum', ENTRY_TYPE.ACCOUNT_SELF), ('crystal', int, 0, None, 'sum', ENTRY_TYPE.ACCOUNT_SELF), ('name', str, '', None, 'skip', ENTRY_TYPE.PLAYER_INFO), ('realName', str, '', None, 'skip', ENTRY_TYPE.PLAYER_INFO), ('clanDBID', int, 0, None, 'skip', ENTRY_TYPE.PLAYER_INFO), ('clanAbbrev', str, '', None, 'skip', ENTRY_TYPE.PLAYER_INFO), ('prebattleID', int, 0, None, 'skip', ENTRY_TYPE.PLAYER_INFO), ('team', int, 1, None, 'skip', ENTRY_TYPE.PLAYER_INFO), ('igrType', int, 0, None, 'skip', ENTRY_TYPE.PLAYER_INFO), ('arenaTypeID', int, 0, None, 'skip', ENTRY_TYPE.COMMON), ('arenaCreateTime', int, 0, None, 'skip', ENTRY_TYPE.COMMON), ('winnerTeam', int, 0, None, 'skip', ENTRY_TYPE.COMMON), ('finishReason', int, 0, None, 'skip', ENTRY_TYPE.COMMON), ('gasAttackWinnerTeam', int, -1, None, 'skip', ENTRY_TYPE.COMMON), ('duration', int, 0, None, 'skip', ENTRY_TYPE.COMMON), ('bonusType', int, 0, None, 'skip', ENTRY_TYPE.COMMON), ('guiType', int, 0, None, 'skip', ENTRY_TYPE.COMMON), ('vehLockMode', int, 0, None, 'skip', ENTRY_TYPE.COMMON), ('division', None, None, None, 'skip', ENTRY_TYPE.COMMON), ('bots', dict, {}, None, 'skip', ENTRY_TYPE.COMMON), ('commonNumStarted', int, 0, None, 'skip', ENTRY_TYPE.COMMON), ('commonNumDestroyed', int, 0, None, 'skip', ENTRY_TYPE.COMMON), ('commonNumDefended', int, 0, None, 'skip', ENTRY_TYPE.COMMON), ('commonNumCaptured', int, 0, None, 'skip', ENTRY_TYPE.COMMON), ('accountCompDescr', dict, {}, None, 'skip', ENTRY_TYPE.COMMON), ('teamHealth', dict, {}, None, 'skip', ENTRY_TYPE.COMMON), ('canStun', bool, False, None, 'any', ENTRY_TYPE.SERVER), ('potentialDamageDealt', int, 0, None, 'sum', ENTRY_TYPE.SERVER), ('soloHitsAssisted', int, 0, None, 'sum', ENTRY_TYPE.SERVER), ('isEnemyBaseCaptured', bool, False, None, 'max', ENTRY_TYPE.SERVER), ('stucks', list, [], DeltaPacker(roundToInt), 'extend', ENTRY_TYPE.SERVER), ('autoAimedShots', int, 0, None, 'sum', ENTRY_TYPE.SERVER), ('presenceTime', int, 0, None, 'max', ENTRY_TYPE.SERVER), ('spotList', list, [], None, 'extend', ENTRY_TYPE.SERVER), ('ammo', list, [], None, 'skip', ENTRY_TYPE.SERVER), ('crewActivityFlags', list, [], None, 'skip', ENTRY_TYPE.SERVER), ('series', dict, {}, None, 'skip', ENTRY_TYPE.SERVER), ('tkillRating', float, 0.0, None, 'sum', ENTRY_TYPE.SERVER), ('thitPenalties', dict, {}, None, 'joinTHitPenalties', ENTRY_TYPE.SERVER), ('destroyedObjects', dict, {}, None, 'sumByEackKey', ENTRY_TYPE.SERVER), ('discloseShots', list, [], DeltaPacker(), 'extend', ENTRY_TYPE.SERVER), ('critsCount', int, 0, None, 'sum', ENTRY_TYPE.SERVER), ('aimerSeries', int, 0, None, 'max', ENTRY_TYPE.SERVER), ('observedByEnemyTime', int, -1, None, 'any', ENTRY_TYPE.SERVER), ('critsByType', dict, {}, DictPacker(('destroyed', dict, {}, SimpleDictPacker(int, VEHICLE_DEVICE_TYPE_NAMES), 'skip'), ('critical', dict, {}, SimpleDictPacker(int, VEHICLE_DEVICE_TYPE_NAMES), 'skip'), ('tankman', dict, {}, SimpleDictPacker(int, VEHICLE_TANKMAN_TYPE_NAMES), 'skip')), 'joinCritsByType', ENTRY_TYPE.SERVER), ('innerModuleCritCount', int, 0, None, 'sum', ENTRY_TYPE.SERVER), ('innerModuleDestrCount', int, 0, None, 'sum', ENTRY_TYPE.SERVER), ('isAnyOurCrittedInnerModules', int, 0, None, 'max', ENTRY_TYPE.SERVER), ('killsAssistedTrack', int, 0, None, 'sum', ENTRY_TYPE.SERVER), ('killsAssistedRadio', int, 0, None, 'sum', ENTRY_TYPE.SERVER), ('killsAssistedStun', int, 0, None, 'sum', ENTRY_TYPE.SERVER), ('damagedVehicleCntAssistedTrack', int, 0, None, 'sum', ENTRY_TYPE.SERVER), ('damagedVehicleCntAssistedRadio', int, 0, None, 'sum', ENTRY_TYPE.SERVER), ('damagedVehicleCntAssistedStun', int, 0, None, 'sum', ENTRY_TYPE.SERVER), ('isNotSpotted', bool, True, None, 'max', ENTRY_TYPE.SERVER), ('isAnyHitReceivedWhileCapturing', bool, False, None, 'max', ENTRY_TYPE.SERVER), ('damageAssistedRadioWhileInvisible', int, 0, None, 'sum', ENTRY_TYPE.SERVER), ('damageAssistedTrackWhileInvisible', int, 0, None, 'sum', ENTRY_TYPE.SERVER), ('damageAssistedStunWhileInvisible', int, 0, None, 'sum', ENTRY_TYPE.SERVER), ('damageEventList', dict, {}, None, 'joinTargetEventLists', ENTRY_TYPE.SERVER), ('stunEventList', dict, {}, None, 'joinTargetEventLists', ENTRY_TYPE.SERVER), ('assistEventList', dict, {}, None, 'joinTargetEventLists', ENTRY_TYPE.SERVER), ('damageFromEnemiesEventList', dict, {}, None, 'joinTargetEventLists', ENTRY_TYPE.SERVER), ('multiDamageEvents', dict, {}, None, 'joinDicts', ENTRY_TYPE.SERVER), ('multiStunEvents', dict, {}, None, 'joinDicts', ENTRY_TYPE.SERVER), ('inBattleMaxSniperSeries', int, 0, None, 'max', ENTRY_TYPE.SERVER), ('inBattleMaxKillingSeries', int, 0, None, 'max', ENTRY_TYPE.SERVER), ('inBattleMaxPiercingSeries', int, 0, None, 'max', ENTRY_TYPE.SERVER), ('firstDamageTime', int, 0, None, 'min', ENTRY_TYPE.SERVER), ('consumedAmmo', None, None, None, 'skip', ENTRY_TYPE.SERVER), ('ironShieldDamage', int, 0, None, 'sum', ENTRY_TYPE.SERVER), ('occupyingForceDestruction', bool, False, None, 'max', ENTRY_TYPE.SERVER), ('occupyingForceBasePoints', int, 0, None, 'sum', ENTRY_TYPE.SERVER), ('directEnemyHits', int, 0, None, 'sum', ENTRY_TYPE.SERVER), ('explosionEnemyHits', int, 0, None, 'sum', ENTRY_TYPE.SERVER), ('piercingEnemyHits', int, 0, None, 'sum', ENTRY_TYPE.SERVER), ('indirectEnemyHits', int, 0, None, 'sum', ENTRY_TYPE.SERVER), ('enemyHits', int, 0, None, 'sum', ENTRY_TYPE.SERVER), ('spottedBeforeWeBecameSpotted', int, 0, None, 'sum', ENTRY_TYPE.SERVER), ('spottedAndDamagedSPG', int, 0, None, 'sum', ENTRY_TYPE.SERVER), ('damageList', list, [], None, 'extend', ENTRY_TYPE.SERVER), ('killList', list, [], None, 'extend', ENTRY_TYPE.SERVER), ('vehLockTimeFactor', float, 0.0, None, 'skip', ENTRY_TYPE.SERVER), ('misc', dict, {}, None, 'any', ENTRY_TYPE.SERVER), ('vehsByClass', dict, {}, None, 'any', ENTRY_TYPE.SERVER), ('avatarAmmoEquipped', set, set(), None, 'skip', ENTRY_TYPE.SERVER), ('cybersportRatingDeltas', tuple, (0.0, 0.0), None, 'skip', ENTRY_TYPE.SERVER), ('vehRankRaised', int, 0, None, 'skip', ENTRY_TYPE.SERVER), ('eventGoldByEventID', dict, {}, None, 'skip', ENTRY_TYPE.SERVER), ('playerRank', int, 0, None, 'skip', ENTRY_TYPE.ACCOUNT_ALL), ('quickShellChangerUsageCount', int, 0, None, 'skip', ENTRY_TYPE.SERVER), ('goldBankGain', int, 0, None, 'skip', ENTRY_TYPE.ACCOUNT_SELF), ('setupsIndexes', dict, {}, None, 'any', ENTRY_TYPE.VEHICLE_SELF), ('startAmmo', list, [], None, 'skip', ENTRY_TYPE.SERVER), ('initialVehicleAmmo', list, [], None, 'skip', ENTRY_TYPE.SERVER), ('replayURL', str, '', None, 'skip', ENTRY_TYPE.ACCOUNT_SELF), ('currencies', dict, {}, MergeDictPacker(), 'joinByEachPacker', ENTRY_TYPE.VEHICLE_SELF)]
[ "StranikS_Scan@mail.ru" ]
StranikS_Scan@mail.ru
f0cd85159b59004ec11ee9273cf86f540fcbbe2b
72a146dad10c3330548f175643822e6cc2e2ccba
/ui/gfx/gfx.gyp
5b4410a16749b8f0b59e60148ab044098762e9f5
[ "BSD-3-Clause" ]
permissive
daotianya/browser-android-tabs
bb6772394c2138e2f3859a83ec6e0860d01a6161
44e83a97eb1c7775944a04144e161d99cbb7de5b
refs/heads/master
2020-06-10T18:07:58.392087
2016-12-07T15:37:13
2016-12-07T15:37:13
75,914,703
1
0
null
2016-12-08T07:37:51
2016-12-08T07:37:51
null
UTF-8
Python
false
false
18,299
gyp
# Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'variables': { 'chromium_code': 1, }, 'targets': [ { 'target_name': 'gfx_geometry', 'type': '<(component)', 'dependencies': [ '<(DEPTH)/base/base.gyp:base', ], 'includes': [ 'gfx_geometry.gypi', '../../build/android/increase_size_for_speed.gypi', ], }, { # GN version: //ui/gfx/geometry/mojo 'target_name': 'mojo_geometry_bindings_mojom', 'type': 'none', 'variables': { 'mojom_files': [ 'geometry/mojo/geometry.mojom', ], 'mojom_typemaps': [ 'geometry/mojo/geometry.typemap', ], 'use_new_wrapper_types': 'false', }, 'includes': [ '../../mojo/mojom_bindings_generator_explicit.gypi' ], }, { # GN version: //ui/gfx/geometry/mojo 'target_name': 'mojo_geometry_bindings', 'type': 'static_library', 'dependencies': [ 'mojo_geometry_bindings_mojom', '../../mojo/mojo_public.gyp:mojo_cpp_bindings', ], }, { 'target_name': 'gfx_range', 'type': '<(component)', 'dependencies': [ '<(DEPTH)/base/base.gyp:base', ], 'defines': [ 'GFX_RANGE_IMPLEMENTATION', ], 'sources': [ 'range/gfx_range_export.h', 'range/range.cc', 'range/range.h', 'range/range_f.cc', 'range/range_f.h', 'range/range_mac.mm', 'range/range_win.cc', ], 'conditions': [ ['OS=="win"', { # TODO(jschuh): C4267: http://crbug.com/167187 size_t -> int # C4324 is structure was padded due to __declspec(align()), which is # uninteresting. 'msvs_disabled_warnings': [ 4267, 4324 ], }], ] }, { 'target_name': 'gfx', 'type': '<(component)', 'dependencies': [ '<(DEPTH)/base/base.gyp:base', '<(DEPTH)/base/base.gyp:base_i18n', '<(DEPTH)/base/base.gyp:base_static', '<(DEPTH)/base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '<(DEPTH)/skia/skia.gyp:skia', '<(DEPTH)/third_party/harfbuzz-ng/harfbuzz.gyp:harfbuzz-ng', '<(DEPTH)/third_party/icu/icu.gyp:icui18n', '<(DEPTH)/third_party/icu/icu.gyp:icuuc', '<(DEPTH)/third_party/libpng/libpng.gyp:libpng', '<(DEPTH)//third_party/qcms/qcms.gyp:qcms', '<(DEPTH)/third_party/zlib/zlib.gyp:zlib', 'gfx_geometry', 'gfx_range', ], # text_elider.h includes ICU headers. 'export_dependent_settings': [ '<(DEPTH)/skia/skia.gyp:skia', '<(DEPTH)/third_party/icu/icu.gyp:icui18n', '<(DEPTH)/third_party/icu/icu.gyp:icuuc', ], 'defines': [ 'GFX_IMPLEMENTATION', ], 'include_dirs': [ '<(DEPTH)/third_party/icu/source/common', ], 'sources': [ 'android/device_display_info.cc', 'android/device_display_info.h', 'android/gfx_jni_registrar.cc', 'android/gfx_jni_registrar.h', 'android/java_bitmap.cc', 'android/java_bitmap.h', 'android/shared_device_display_info.cc', 'android/shared_device_display_info.h', 'android/view_configuration.cc', 'android/view_configuration.h', 'animation/animation.cc', 'animation/animation.h', 'animation/animation_container.cc', 'animation/animation_container.h', 'animation/animation_container_element.h', 'animation/animation_container_observer.h', 'animation/animation_delegate.h', 'animation/animation_mac.mm', 'animation/animation_win.cc', 'animation/linear_animation.cc', 'animation/linear_animation.h', 'animation/multi_animation.cc', 'animation/multi_animation.h', 'animation/slide_animation.cc', 'animation/slide_animation.h', 'animation/throb_animation.cc', 'animation/throb_animation.h', 'animation/tween.cc', 'animation/tween.h', 'blit.cc', 'blit.h', 'break_list.h', 'break_list.h', 'buffer_format_util.cc', 'buffer_format_util.h', 'canvas.cc', 'canvas.h', 'canvas_notimplemented.cc', 'canvas_paint_mac.h', 'canvas_paint_mac.mm', 'canvas_skia.cc', 'canvas_skia_paint.h', 'codec/jpeg_codec.cc', 'codec/jpeg_codec.h', 'codec/png_codec.cc', 'codec/png_codec.h', 'color_analysis.cc', 'color_analysis.h', 'color_palette.h', 'color_space.cc', 'color_space.h', 'color_transform.cc', 'color_transform.h', 'color_utils.cc', 'color_utils.h', 'favicon_size.cc', 'favicon_size.h', 'font.cc', 'font.h', 'font_fallback.h', 'font_fallback_linux.cc', 'font_fallback_linux.h', 'font_fallback_mac.mm', 'font_fallback_win.cc', 'font_fallback_win.h', 'font_list.cc', 'font_list.h', 'font_list_impl.cc', 'font_list_impl.h', 'font_render_params.cc', 'font_render_params.h', 'font_render_params_android.cc', 'font_render_params_linux.cc', 'font_render_params_mac.cc', 'font_render_params_win.cc', 'generic_shared_memory_id.cc', 'generic_shared_memory_id.h', 'gfx_export.h', 'gfx_paths.cc', 'gfx_paths.h', 'harfbuzz_font_skia.cc', 'harfbuzz_font_skia.h', 'image/canvas_image_source.cc', 'image/canvas_image_source.h', 'icc_profile.cc', 'icc_profile.h', 'icc_profile_mac.mm', 'icc_profile_win.cc', 'image/image.cc', 'image/image.h', 'image/image_family.cc', 'image/image_family.h', 'image/image_ios.mm', 'image/image_mac.mm', 'image/image_png_rep.cc', 'image/image_png_rep.h', 'image/image_skia.cc', 'image/image_skia.h', 'image/image_skia_operations.cc', 'image/image_skia_operations.h', 'image/image_skia_rep.cc', 'image/image_skia_rep.h', 'image/image_skia_source.cc', 'image/image_skia_source.h', 'image/image_skia_util_ios.h', 'image/image_skia_util_ios.mm', 'image/image_skia_util_mac.h', 'image/image_skia_util_mac.mm', 'image/image_util.cc', 'image/image_util.h', 'image/image_util_ios.mm', 'interpolated_transform.cc', 'interpolated_transform.h', 'ios/NSString+CrStringDrawing.h', 'ios/NSString+CrStringDrawing.mm', 'ios/uikit_util.h', 'ios/uikit_util.mm', 'linux_font_delegate.cc', 'linux_font_delegate.h', 'mac/coordinate_conversion.h', 'mac/coordinate_conversion.mm', 'mac/io_surface.cc', 'mac/io_surface.h', 'mac/nswindow_frame_controls.h', 'mac/nswindow_frame_controls.mm', 'mac/scoped_cocoa_disable_screen_updates.h', 'native_pixmap_handle_ozone.cc', 'native_pixmap_handle_ozone.h', 'native_widget_types.h', 'nine_image_painter.cc', 'nine_image_painter.h', 'overlay_transform.h', 'paint_throbber.cc', 'paint_throbber.h', 'path.cc', 'path.h', 'path_mac.h', 'path_mac.mm', 'path_win.cc', 'path_win.h', 'path_x11.cc', 'path_x11.h', 'platform_font.h', 'platform_font_android.cc', 'platform_font_ios.h', 'platform_font_ios.mm', 'platform_font_linux.cc', 'platform_font_linux.h', 'platform_font_mac.h', 'platform_font_mac.mm', 'platform_font_win.cc', 'platform_font_win.h', 'render_text.cc', 'render_text.h', 'render_text_harfbuzz.cc', 'render_text_harfbuzz.h', 'render_text_mac.h', 'render_text_mac.mm', 'scoped_canvas.cc', 'scoped_canvas.h', 'scoped_cg_context_save_gstate_mac.h', 'scoped_ns_graphics_context_save_gstate_mac.h', 'scoped_ns_graphics_context_save_gstate_mac.mm', 'scoped_ui_graphics_push_context_ios.h', 'scoped_ui_graphics_push_context_ios.mm', 'scrollbar_size.cc', 'scrollbar_size.h', 'selection_bound.cc', 'selection_bound.h', 'selection_model.cc', 'selection_model.h', 'sequential_id_generator.cc', 'sequential_id_generator.h', 'shadow_value.cc', 'shadow_value.h', 'skbitmap_operations.cc', 'skbitmap_operations.h', 'skia_util.cc', 'skia_util.h', 'swap_result.h', 'switches.cc', 'switches.h', 'text_constants.h', 'text_elider.cc', 'text_elider.h', 'text_utils.cc', 'text_utils.h', 'text_utils_android.cc', 'text_utils_ios.mm', 'text_utils_skia.cc', 'transform.cc', 'transform.h', 'transform_util.cc', 'transform_util.h', 'ui_gfx_exports.cc', 'utf16_indexing.cc', 'utf16_indexing.h', 'vsync_provider.h', 'win/direct_manipulation.cc', 'win/direct_manipulation.h', 'win/direct_write.cc', 'win/direct_write.h', 'win/hwnd_util.cc', 'win/hwnd_util.h', "win/physical_size.cc", "win/physical_size.h", 'win/rendering_window_manager.cc', 'win/rendering_window_manager.h', 'win/scoped_set_map_mode.h', 'win/singleton_hwnd.cc', 'win/singleton_hwnd.h', 'win/singleton_hwnd_observer.cc', 'win/singleton_hwnd_observer.h', 'win/text_analysis_source.cc', 'win/text_analysis_source.h', 'win/window_impl.cc', 'win/window_impl.h', ], 'includes': [ '../../build/android/increase_size_for_speed.gypi', ], 'conditions': [ ['OS=="ios"', { # Linkable dependents need to set the linker flag '-ObjC' in order to # use the categories in this target (e.g. NSString+CrStringDrawing.h). 'link_settings': { 'xcode_settings': {'OTHER_LDFLAGS': ['-ObjC']}, }, 'sources!': [ 'blit.cc', 'blit.h', 'canvas.cc', 'canvas.h', 'canvas_notimplemented.cc', 'canvas_paint_mac.h', 'canvas_paint_mac.mm', 'canvas_skia.cc', 'canvas_skia_paint.h', 'codec/jpeg_codec.cc', ], }, { 'sources':[ 'gpu_memory_buffer.cc', 'gpu_memory_buffer.h', ], 'dependencies': [ '<(libjpeg_gyp_path):libjpeg', ], }], # TODO(asvitkine): Switch all platforms to use canvas_skia.cc. # http://crbug.com/105550 ['use_canvas_skia==1', { 'sources!': [ 'canvas_notimplemented.cc', ], }, { # use_canvas_skia!=1 'sources!': [ 'canvas_skia.cc', ], }], ['OS=="win"', { 'sources': [ 'gdi_util.cc', 'gdi_util.h', 'icon_util.cc', 'icon_util.h', 'sys_color_change_listener.cc', 'sys_color_change_listener.h', ], # TODO(jschuh): C4267: http://crbug.com/167187 size_t -> int # C4324 is structure was padded due to __declspec(align()), which is # uninteresting. 'msvs_disabled_warnings': [ 4267, 4324 ], }], ['OS=="mac"', { 'link_settings': { 'libraries': [ '$(SDKROOT)/System/Library/Frameworks/IOSurface.framework', ], }, }], ['OS=="android"', { 'sources!': [ 'animation/throb_animation.cc', 'selection_model.cc', ], 'dependencies': [ 'gfx_jni_headers', '<(DEPTH)/base/base.gyp:base_java', ], 'link_settings': { 'libraries': [ '-landroid', '-ljnigraphics', ], }, }], ['chromeos==1', { # Chrome OS requires robust JPEG decoding for the login screen. 'sources': [ 'chromeos/codec/jpeg_codec_robust_slow.cc', 'chromeos/codec/jpeg_codec_robust_slow.h', ], 'dependencies': [ '<(libjpeg_ijg_gyp_path):libjpeg', ], }], ['use_aura==0 and toolkit_views==0', { 'sources!': [ 'nine_image_painter.cc', 'nine_image_painter.h', ], }], ['OS=="android" and use_aura==0', { 'sources!': [ 'path.cc', ], }], ['OS=="android" or OS=="ios"', { 'sources!': [ 'harfbuzz_font_skia.cc', 'harfbuzz_font_skia.h', 'render_text.cc', 'render_text.h', 'render_text_harfbuzz.cc', 'render_text_harfbuzz.h', 'text_utils_skia.cc', ], }, { # desktop platforms }], ['use_x11==1', { 'dependencies': [ '../../build/linux/system.gyp:x11', 'x/gfx_x11.gyp:gfx_x11', ], }], ['use_cairo==1', { 'dependencies': [ '<(DEPTH)/build/linux/system.gyp:pangocairo', ], }], ['desktop_linux==1 or chromeos==1', { 'dependencies': [ # font_render_params_linux.cc uses fontconfig '<(DEPTH)/build/linux/system.gyp:fontconfig', ], }], ], 'target_conditions': [ # Need 'target_conditions' to override default filename_rules to include # the file on iOS. ['OS == "ios"', { 'sources/': [ ['include', '^scoped_cg_context_save_gstate_mac\\.h$'], ], }], ], }, # Separate from gfx to limit the impact of the hard_dependency. { 'target_name': 'gfx_vector_icons', 'type': '<(component)', 'dependencies': [ '<(DEPTH)/base/base.gyp:base', '<(DEPTH)/base/base.gyp:base_i18n', '<(DEPTH)/skia/skia.gyp:skia', 'gfx', 'gfx_geometry', ], 'defines': [ 'GFX_IMPLEMENTATION', ], 'sources': [ 'paint_vector_icon.cc', 'paint_vector_icon.h', 'vector_icons_public.h', ], 'variables': { 'vector_icons_cc_file': '<(INTERMEDIATE_DIR)/ui/gfx/vector_icons.cc', 'vector_icons_h_file': '<(SHARED_INTERMEDIATE_DIR)/ui/gfx/vector_icons.h', }, 'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)', ], 'actions': [ { # GN version: //ui/gfx:aggregate_vector_icons 'action_name': 'aggregate_vector_icons', 'inputs': [ 'vector_icons/', ], 'outputs': [ '<(vector_icons_cc_file)', '<(vector_icons_h_file)', ], 'action': [ 'python', 'vector_icons/aggregate_vector_icons.py', '--working_directory=vector_icons/', '--output_cc=<(vector_icons_cc_file)', '--output_h=<(vector_icons_h_file)', ], 'message': 'Aggregating vector resources.', 'process_outputs_as_sources': 1, }, ], # Export a hard dependency because of generated header files. 'hard_dependency': 1, }, { 'target_name': 'gfx_test_support', 'type': 'static_library', 'sources': [ 'image/image_unittest_util.cc', 'image/image_unittest_util.h', 'image/image_unittest_util_ios.mm', 'image/image_unittest_util_mac.mm', 'test/fontconfig_util_linux.cc', 'test/fontconfig_util_linux.h', 'test/gfx_util.cc', 'test/gfx_util.h', 'test/ui_cocoa_test_helper.h', 'test/ui_cocoa_test_helper.mm', ], 'dependencies': [ '../../base/base.gyp:base', '../../skia/skia.gyp:skia', '../../testing/gtest.gyp:gtest', 'gfx', 'gfx_geometry', ], 'conditions': [ ['OS == "mac"', { 'link_settings': { 'libraries': [ '$(SDKROOT)/System/Library/Frameworks/AppKit.framework', ], }, }], ['OS=="ios"', { # The cocoa files don't apply to iOS. 'sources/': [ ['exclude', 'cocoa'] ], }], ['OS=="linux"', { 'dependencies': [ '../../build/linux/system.gyp:fontconfig', ], }], ], }, ], 'conditions': [ ['OS=="android"' , { 'targets': [ { 'target_name': 'gfx_jni_headers', 'type': 'none', 'sources': [ '../android/java/src/org/chromium/ui/gfx/BitmapHelper.java', '../android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java', '../android/java/src/org/chromium/ui/gfx/ViewConfigurationHelper.java', ], 'variables': { 'jni_gen_package': 'ui/gfx', }, 'includes': [ '../../build/jni_generator.gypi' ], }, ], }], ['disable_nacl!=1 and OS=="win" and target_arch=="ia32"', { 'targets': [ { 'target_name': 'gfx_geometry_win64', 'type': '<(component)', 'dependencies': [ '<(DEPTH)/base/base.gyp:base_win64', ], 'includes': [ 'gfx_geometry.gypi', ], 'defines': [ '<@(nacl_win64_defines)', ], 'configurations': { 'Common_Base': { 'msvs_target_platform': 'x64', }, }, }, ], }], ], }
[ "serg.zhukovsky@gmail.com" ]
serg.zhukovsky@gmail.com
a3b2d408518bb11b90aaba063943fb0caa56731f
ca7aa979e7059467e158830b76673f5b77a0f5a3
/Python_codes/p02239/s374795899.py
eb3b7249256f6b5886a4bce9720035bb327680f5
[]
no_license
Aasthaengg/IBMdataset
7abb6cbcc4fb03ef5ca68ac64ba460c4a64f8901
f33f1c5c3b16d0ea8d1f5a7d479ad288bb3f48d8
refs/heads/main
2023-04-22T10:22:44.763102
2021-05-13T17:27:22
2021-05-13T17:27:22
367,112,348
0
0
null
null
null
null
UTF-8
Python
false
false
594
py
#============================================================================= # Breadth First Search #============================================================================= import queue N=int(input()) Graph=[[] for _ in range(N+1)] dist=[-1 for _ in range(N+1)] for i in range(1,N+1): Graph[i]=list(map(int,input().split()))[2:] que=queue.Queue() que.put(1) dist[1]=0 while not que.empty(): v=que.get() for nv in Graph[v]: if dist[nv] != -1: continue dist[nv]=dist[v]+1 que.put(nv) for i in range(1,N+1): print(i,dist[i],sep=" ")
[ "66529651+Aastha2104@users.noreply.github.com" ]
66529651+Aastha2104@users.noreply.github.com
0edc58fbf257055980a8afbc37b213fd0c436e90
a8d55214bc9ff1f113f52dec0b26bbf6692e239b
/06/6.3/property_test3.py
12160271c4b30e13f794a83a0a39da718249f8e4
[]
no_license
wmm0165/crazy_python
e61ea186cd9120500b3235aed9afc62be5dc49bc
1266cc8ae1d3c3b91fe17b298de0686d1d93bb24
refs/heads/master
2022-03-24T03:31:57.205022
2019-12-23T10:13:22
2019-12-23T10:13:22
193,018,528
4
1
null
null
null
null
UTF-8
Python
false
false
776
py
# -*- coding: utf-8 -*- # @Time : 2019/8/19 14:14 # @Author : wangmengmeng # 使用@property修饰方法,使之成为属性 class Cell: # 使用@property修饰方法,相当于为该属性设置getter方法 @property def state(self): return self._state # 为state属性设置setter方法 @state.setter def state(self, value): if 'alive' in value.lower(): self._state = 'alive' else: self._state = 'dead' # 为is_dead属性设置getter方法 # 只有getter方法属性是只读属性 @property def is_dead(self): return not self._state.lower() == 'alive' c = Cell() # 修改state属性 c.state = 'Alive' # 访问state属性 print(c.state) # 访问is_dead属性 print(c.is_dead)
[ "wmm_0165@163.com" ]
wmm_0165@163.com
7172d06518cd011353d2ff89b60b6c63ebdf4531
14ca66a826cec8172f880c388375b3b55483cf37
/rplugin/python3/deoplete/source/deoppet.py
c5b08d030cb9d9cd4798763bab3b3703fadf8441
[ "MIT" ]
permissive
the-lazy-learner/deoppet.nvim
744abd06adb789c9b21035fdf552ac16bcca85df
16c6f272c694fd12fc288fc98d4b474e26aa1485
refs/heads/master
2021-07-03T22:43:04.506152
2017-09-24T08:55:16
2017-09-24T08:55:16
null
0
0
null
null
null
null
UTF-8
Python
false
false
779
py
#============================================================================= # FILE: deoppet.py # AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com> # License: MIT license #============================================================================= from .base import Base from deoppet.parser import Parser from deoppet.util import globruntime, debug class Source(Base): def __init__(self, vim): Base.__init__(self, vim) self.name = 'deoppet' self.mark = '[dp]' self.rank = 200 def gather_candidates(self, context): bvars = self.vim.current.buffer.vars if 'deoppet_snippets' not in bvars: return [] return [{'word': x['trigger']} for x in bvars['deoppet_snippets'].values()]
[ "Shougo.Matsu@gmail.com" ]
Shougo.Matsu@gmail.com
28727ec723317e30d74083841007539fff22cef1
e444f89f87b90f7946e3162e2c986c9d7f75b9b4
/src/annotation_pipeline.py
80122696be8453f60256d856e49281e846eaf4c6
[]
no_license
yuzhenpeng/comparativeAnnotator
f2a7bb846f1427f09cfa6429207ec483f9ada072
9062c58bb7d625b2b50eb07b23b01af6bf73e5e3
refs/heads/master
2020-09-11T21:52:40.544833
2016-07-26T20:28:10
2016-07-26T20:28:10
null
0
0
null
null
null
null
UTF-8
Python
false
false
4,895
py
""" This is the main driver script for comparativeAnnotator in transMap mode. """ import argparse import os from jobTree.scriptTree.target import Target from jobTree.scriptTree.stack import Stack import lib.sql_lib as sql_lib import lib.seq_lib as seq_lib from lib.general_lib import classes_in_module, mkdir_p import src.classifiers import src.alignment_classifiers import src.augustus_classifiers import src.attributes from src.build_tracks import database_wrapper __author__ = "Ian Fiddes" def parse_args(): """ Builds an argument parser for this run """ parent_parser = argparse.ArgumentParser() subparsers = parent_parser.add_subparsers(title="Modes", description="Execution Modes", dest="mode") tm_parser = subparsers.add_parser('transMap') ref_parser = subparsers.add_parser('reference') aug_parser = subparsers.add_parser('augustus') # common arguments for parser in [ref_parser, aug_parser, tm_parser]: parser.add_argument('--outDir', type=str, required=True) parser.add_argument('--refGenome', type=str, required=True) parser.add_argument('--refFasta', type=str, required=True) parser.add_argument('--sizes', required=True) parser.add_argument('--annotationGp', required=True) parser.add_argument('--gencodeAttributes', required=True) Stack.addJobTreeOptions(parser) # add jobTree options # transMap specific options for parser in [aug_parser, tm_parser]: parser.add_argument('--genome', required=True) parser.add_argument('--psl', required=True) parser.add_argument('--refPsl', required=True) parser.add_argument('--targetGp', required=True) parser.add_argument('--fasta', required=True) # Augustus specific options aug_parser.add_argument('--augustusGp', required=True) args = parent_parser.parse_args() assert args.mode in ["transMap", "reference", "augustus"] return args def run_ref_classifiers(args, target, tmp_dir): ref_classifiers = classes_in_module(src.classifiers) for classifier in ref_classifiers: target.addChildTarget(classifier(args.refFasta, args.annotationGp, args.refGenome, tmp_dir)) def run_tm_classifiers(args, target, tmp_dir): tm_classifiers = classes_in_module(src.alignment_classifiers) for classifier in tm_classifiers: target.addChildTarget(classifier(args.refFasta, args.annotationGp, args.refGenome, tmp_dir, args.genome, args.psl, args.refPsl, args.fasta, args.targetGp)) attributes = classes_in_module(src.attributes) for attribute in attributes: target.addChildTarget(attribute(args.refFasta, args.annotationGp, args.refGenome, tmp_dir, args.genome, args.psl, args.refPsl, args.fasta, args.targetGp, args.gencodeAttributes)) # in transMap mode we run the alignment-free classifiers on the target genome ref_classifiers = classes_in_module(src.classifiers) for classifier in ref_classifiers: target.addChildTarget(classifier(args.fasta, args.targetGp, args.genome, tmp_dir)) def run_aug_classifiers(args, target, tmp_dir): aug_classifiers = classes_in_module(src.augustus_classifiers) for classifier in aug_classifiers: target.addChildTarget(classifier(args.refFasta, args.annotationGp, args.refGenome, tmp_dir, args.genome, args.psl, args.refPsl, args.fasta, args.targetGp, args.augustusGp)) # in Augustus mode we run the alignment-free classifiers on augustus transcripts ref_classifiers = classes_in_module(src.classifiers) for classifier in ref_classifiers: target.addChildTarget(classifier(args.fasta, args.augustusGp, args.genome, tmp_dir)) def build_analyses(target, args): """ Wrapper function that will call all classifiers. Each classifier will dump its results to disk as a pickled dict. Calls database_wrapper to load these into a sqlite3 database. """ tmp_dir = target.getGlobalTempDir() if args.mode == "reference": run_ref_classifiers(args, target, tmp_dir) elif args.mode == "transMap": run_tm_classifiers(args, target, tmp_dir) elif args.mode == "augustus": run_aug_classifiers(args, target, tmp_dir) else: raise RuntimeError("Somehow your argparse object does not contain a valid mode.") # merge the resulting pickled files into sqlite databases and construct BED tracks target.setFollowOnTargetFn(database_wrapper, memory=8 * (1024 ** 3), args=[args, tmp_dir]) def main(): args = parse_args() i = Stack(Target.makeTargetFn(build_analyses, memory=8 * (1024 ** 3), args=[args])).startJobTree(args) if i != 0: raise RuntimeError("Got failed jobs") if __name__ == '__main__': from src.annotation_pipeline import * main()
[ "ian.t.fiddes@gmail.com" ]
ian.t.fiddes@gmail.com
4dd1389420bf38c36d3b56adf825aec0a6fbab0c
77a87e7b15d58b2d23bfdd9ed78b637bebfcc6eb
/.closet/jython.configurator.efr32.multiPhy/5.2.3.201904231805-1264/host_py_rm_studio_internal/host_py_rm_studio_internal_efr32xg12xfull/revA0/AGC.py
bfe98660a031dcd7fce3e6a4596c69ffe731abd3
[]
no_license
lenloe1/other-stuff
b06331a4f247f06066579472b296f1ae66f6bdaf
897069e0464b19f81b14488d463710c81bb7fda4
refs/heads/master
2021-05-19T13:41:04.509601
2020-03-31T20:52:38
2020-03-31T20:52:38
251,728,852
0
0
null
null
null
null
UTF-8
Python
false
false
4,156
py
# -*- coding: utf-8 -*- __all__ = [ 'RM_Peripheral_AGC' ] from .static import Base_RM_Peripheral from .AGC_register import * class RM_Peripheral_AGC(Base_RM_Peripheral): def __init__(self, rmio, label): self.__dict__['zz_frozen'] = False super(RM_Peripheral_AGC, self).__init__(rmio, label, 0x40087000, 'AGC', u"") self.STATUS0 = RM_Register_AGC_STATUS0(self.zz_rmio, self.zz_label) self.zz_rdict['STATUS0'] = self.STATUS0 self.STATUS1 = RM_Register_AGC_STATUS1(self.zz_rmio, self.zz_label) self.zz_rdict['STATUS1'] = self.STATUS1 self.RSSI = RM_Register_AGC_RSSI(self.zz_rmio, self.zz_label) self.zz_rdict['RSSI'] = self.RSSI self.FRAMERSSI = RM_Register_AGC_FRAMERSSI(self.zz_rmio, self.zz_label) self.zz_rdict['FRAMERSSI'] = self.FRAMERSSI self.CTRL0 = RM_Register_AGC_CTRL0(self.zz_rmio, self.zz_label) self.zz_rdict['CTRL0'] = self.CTRL0 self.CTRL1 = RM_Register_AGC_CTRL1(self.zz_rmio, self.zz_label) self.zz_rdict['CTRL1'] = self.CTRL1 self.CTRL2 = RM_Register_AGC_CTRL2(self.zz_rmio, self.zz_label) self.zz_rdict['CTRL2'] = self.CTRL2 self.RSSISTEPTHR = RM_Register_AGC_RSSISTEPTHR(self.zz_rmio, self.zz_label) self.zz_rdict['RSSISTEPTHR'] = self.RSSISTEPTHR self.IFPEAKDET = RM_Register_AGC_IFPEAKDET(self.zz_rmio, self.zz_label) self.zz_rdict['IFPEAKDET'] = self.IFPEAKDET self.MANGAIN = RM_Register_AGC_MANGAIN(self.zz_rmio, self.zz_label) self.zz_rdict['MANGAIN'] = self.MANGAIN self.RFPEAKDET = RM_Register_AGC_RFPEAKDET(self.zz_rmio, self.zz_label) self.zz_rdict['RFPEAKDET'] = self.RFPEAKDET self.IF = RM_Register_AGC_IF(self.zz_rmio, self.zz_label) self.zz_rdict['IF'] = self.IF self.IFS = RM_Register_AGC_IFS(self.zz_rmio, self.zz_label) self.zz_rdict['IFS'] = self.IFS self.IFC = RM_Register_AGC_IFC(self.zz_rmio, self.zz_label) self.zz_rdict['IFC'] = self.IFC self.IEN = RM_Register_AGC_IEN(self.zz_rmio, self.zz_label) self.zz_rdict['IEN'] = self.IEN self.CMD = RM_Register_AGC_CMD(self.zz_rmio, self.zz_label) self.zz_rdict['CMD'] = self.CMD self.GAINRANGE = RM_Register_AGC_GAINRANGE(self.zz_rmio, self.zz_label) self.zz_rdict['GAINRANGE'] = self.GAINRANGE self.GAININDEX = RM_Register_AGC_GAININDEX(self.zz_rmio, self.zz_label) self.zz_rdict['GAININDEX'] = self.GAININDEX self.SLICECODE = RM_Register_AGC_SLICECODE(self.zz_rmio, self.zz_label) self.zz_rdict['SLICECODE'] = self.SLICECODE self.ATTENCODE1 = RM_Register_AGC_ATTENCODE1(self.zz_rmio, self.zz_label) self.zz_rdict['ATTENCODE1'] = self.ATTENCODE1 self.ATTENCODE2 = RM_Register_AGC_ATTENCODE2(self.zz_rmio, self.zz_label) self.zz_rdict['ATTENCODE2'] = self.ATTENCODE2 self.ATTENCODE3 = RM_Register_AGC_ATTENCODE3(self.zz_rmio, self.zz_label) self.zz_rdict['ATTENCODE3'] = self.ATTENCODE3 self.GAINERROR1 = RM_Register_AGC_GAINERROR1(self.zz_rmio, self.zz_label) self.zz_rdict['GAINERROR1'] = self.GAINERROR1 self.GAINERROR2 = RM_Register_AGC_GAINERROR2(self.zz_rmio, self.zz_label) self.zz_rdict['GAINERROR2'] = self.GAINERROR2 self.GAINERROR3 = RM_Register_AGC_GAINERROR3(self.zz_rmio, self.zz_label) self.zz_rdict['GAINERROR3'] = self.GAINERROR3 self.MANUALCTRL = RM_Register_AGC_MANUALCTRL(self.zz_rmio, self.zz_label) self.zz_rdict['MANUALCTRL'] = self.MANUALCTRL self.GAINSTEPLIM = RM_Register_AGC_GAINSTEPLIM(self.zz_rmio, self.zz_label) self.zz_rdict['GAINSTEPLIM'] = self.GAINSTEPLIM self.LOOPDEL = RM_Register_AGC_LOOPDEL(self.zz_rmio, self.zz_label) self.zz_rdict['LOOPDEL'] = self.LOOPDEL self.MININDEX = RM_Register_AGC_MININDEX(self.zz_rmio, self.zz_label) self.zz_rdict['MININDEX'] = self.MININDEX self.LBT = RM_Register_AGC_LBT(self.zz_rmio, self.zz_label) self.zz_rdict['LBT'] = self.LBT self.__dict__['zz_frozen'] = True
[ "31710001+lenloe1@users.noreply.github.com" ]
31710001+lenloe1@users.noreply.github.com
22cf14559ea6a0510b53b1c811cb66c2c1c09e22
82b946da326148a3c1c1f687f96c0da165bb2c15
/sdk/python/pulumi_azure_native/customerinsights/get_relationship_link.py
1513ff29f5134b2bcd8fef7adb41bc356129811a
[ "Apache-2.0", "BSD-3-Clause" ]
permissive
morrell/pulumi-azure-native
3916e978382366607f3df0a669f24cb16293ff5e
cd3ba4b9cb08c5e1df7674c1c71695b80e443f08
refs/heads/master
2023-06-20T19:37:05.414924
2021-07-19T20:57:53
2021-07-19T20:57:53
387,815,163
0
0
Apache-2.0
2021-07-20T14:18:29
2021-07-20T14:18:28
null
UTF-8
Python
false
false
9,544
py
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from .. import _utilities from . import outputs __all__ = [ 'GetRelationshipLinkResult', 'AwaitableGetRelationshipLinkResult', 'get_relationship_link', ] @pulumi.output_type class GetRelationshipLinkResult: """ The relationship link resource format. """ def __init__(__self__, description=None, display_name=None, id=None, interaction_type=None, link_name=None, mappings=None, name=None, profile_property_references=None, provisioning_state=None, related_profile_property_references=None, relationship_guid_id=None, relationship_name=None, tenant_id=None, type=None): if description and not isinstance(description, dict): raise TypeError("Expected argument 'description' to be a dict") pulumi.set(__self__, "description", description) if display_name and not isinstance(display_name, dict): raise TypeError("Expected argument 'display_name' to be a dict") pulumi.set(__self__, "display_name", display_name) if id and not isinstance(id, str): raise TypeError("Expected argument 'id' to be a str") pulumi.set(__self__, "id", id) if interaction_type and not isinstance(interaction_type, str): raise TypeError("Expected argument 'interaction_type' to be a str") pulumi.set(__self__, "interaction_type", interaction_type) if link_name and not isinstance(link_name, str): raise TypeError("Expected argument 'link_name' to be a str") pulumi.set(__self__, "link_name", link_name) if mappings and not isinstance(mappings, list): raise TypeError("Expected argument 'mappings' to be a list") pulumi.set(__self__, "mappings", mappings) if name and not isinstance(name, str): raise TypeError("Expected argument 'name' to be a str") pulumi.set(__self__, "name", name) if profile_property_references and not isinstance(profile_property_references, list): raise TypeError("Expected argument 'profile_property_references' to be a list") pulumi.set(__self__, "profile_property_references", profile_property_references) if provisioning_state and not isinstance(provisioning_state, str): raise TypeError("Expected argument 'provisioning_state' to be a str") pulumi.set(__self__, "provisioning_state", provisioning_state) if related_profile_property_references and not isinstance(related_profile_property_references, list): raise TypeError("Expected argument 'related_profile_property_references' to be a list") pulumi.set(__self__, "related_profile_property_references", related_profile_property_references) if relationship_guid_id and not isinstance(relationship_guid_id, str): raise TypeError("Expected argument 'relationship_guid_id' to be a str") pulumi.set(__self__, "relationship_guid_id", relationship_guid_id) if relationship_name and not isinstance(relationship_name, str): raise TypeError("Expected argument 'relationship_name' to be a str") pulumi.set(__self__, "relationship_name", relationship_name) if tenant_id and not isinstance(tenant_id, str): raise TypeError("Expected argument 'tenant_id' to be a str") pulumi.set(__self__, "tenant_id", tenant_id) if type and not isinstance(type, str): raise TypeError("Expected argument 'type' to be a str") pulumi.set(__self__, "type", type) @property @pulumi.getter def description(self) -> Optional[Mapping[str, str]]: """ Localized descriptions for the Relationship Link. """ return pulumi.get(self, "description") @property @pulumi.getter(name="displayName") def display_name(self) -> Optional[Mapping[str, str]]: """ Localized display name for the Relationship Link. """ return pulumi.get(self, "display_name") @property @pulumi.getter def id(self) -> str: """ Resource ID. """ return pulumi.get(self, "id") @property @pulumi.getter(name="interactionType") def interaction_type(self) -> str: """ The InteractionType associated with the Relationship Link. """ return pulumi.get(self, "interaction_type") @property @pulumi.getter(name="linkName") def link_name(self) -> str: """ The name of the Relationship Link. """ return pulumi.get(self, "link_name") @property @pulumi.getter def mappings(self) -> Optional[Sequence['outputs.RelationshipLinkFieldMappingResponse']]: """ The mappings between Interaction and Relationship fields. """ return pulumi.get(self, "mappings") @property @pulumi.getter def name(self) -> str: """ Resource name. """ return pulumi.get(self, "name") @property @pulumi.getter(name="profilePropertyReferences") def profile_property_references(self) -> Sequence['outputs.ParticipantProfilePropertyReferenceResponse']: """ The property references for the Profile of the Relationship. """ return pulumi.get(self, "profile_property_references") @property @pulumi.getter(name="provisioningState") def provisioning_state(self) -> str: """ Provisioning state. """ return pulumi.get(self, "provisioning_state") @property @pulumi.getter(name="relatedProfilePropertyReferences") def related_profile_property_references(self) -> Sequence['outputs.ParticipantProfilePropertyReferenceResponse']: """ The property references for the Related Profile of the Relationship. """ return pulumi.get(self, "related_profile_property_references") @property @pulumi.getter(name="relationshipGuidId") def relationship_guid_id(self) -> str: """ The relationship guid id. """ return pulumi.get(self, "relationship_guid_id") @property @pulumi.getter(name="relationshipName") def relationship_name(self) -> str: """ The Relationship associated with the Link. """ return pulumi.get(self, "relationship_name") @property @pulumi.getter(name="tenantId") def tenant_id(self) -> str: """ The hub name. """ return pulumi.get(self, "tenant_id") @property @pulumi.getter def type(self) -> str: """ Resource type. """ return pulumi.get(self, "type") class AwaitableGetRelationshipLinkResult(GetRelationshipLinkResult): # pylint: disable=using-constant-test def __await__(self): if False: yield self return GetRelationshipLinkResult( description=self.description, display_name=self.display_name, id=self.id, interaction_type=self.interaction_type, link_name=self.link_name, mappings=self.mappings, name=self.name, profile_property_references=self.profile_property_references, provisioning_state=self.provisioning_state, related_profile_property_references=self.related_profile_property_references, relationship_guid_id=self.relationship_guid_id, relationship_name=self.relationship_name, tenant_id=self.tenant_id, type=self.type) def get_relationship_link(hub_name: Optional[str] = None, relationship_link_name: Optional[str] = None, resource_group_name: Optional[str] = None, opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetRelationshipLinkResult: """ The relationship link resource format. API Version: 2017-04-26. :param str hub_name: The name of the hub. :param str relationship_link_name: The name of the relationship link. :param str resource_group_name: The name of the resource group. """ __args__ = dict() __args__['hubName'] = hub_name __args__['relationshipLinkName'] = relationship_link_name __args__['resourceGroupName'] = resource_group_name if opts is None: opts = pulumi.InvokeOptions() if opts.version is None: opts.version = _utilities.get_version() __ret__ = pulumi.runtime.invoke('azure-native:customerinsights:getRelationshipLink', __args__, opts=opts, typ=GetRelationshipLinkResult).value return AwaitableGetRelationshipLinkResult( description=__ret__.description, display_name=__ret__.display_name, id=__ret__.id, interaction_type=__ret__.interaction_type, link_name=__ret__.link_name, mappings=__ret__.mappings, name=__ret__.name, profile_property_references=__ret__.profile_property_references, provisioning_state=__ret__.provisioning_state, related_profile_property_references=__ret__.related_profile_property_references, relationship_guid_id=__ret__.relationship_guid_id, relationship_name=__ret__.relationship_name, tenant_id=__ret__.tenant_id, type=__ret__.type)
[ "noreply@github.com" ]
morrell.noreply@github.com
ba1cfe34cdd0c72ad9925c1efba1ce9fe9481338
47434a10c598d2ea0e5faed4df29c755242c662e
/CodeForces/Team.py
98ef4fa008166998218eff68a571fbbd8c8334b1
[]
no_license
ShakilAhmmed/Problem_Solve
566b5a5370723932a50cf34c97ac9f229df8b511
6864958ee892ba0aa90f6788fc7b7c16baf41716
refs/heads/master
2021-06-22T19:41:07.624863
2021-03-07T16:10:25
2021-03-07T16:10:25
200,253,202
2
0
null
2020-06-16T19:52:43
2019-08-02T14:56:30
Python
UTF-8
Python
false
false
201
py
n = int(input()) count = 0 for _ in range(n): number = list(map(int, input().split())) one_count = number.count(1) zero_count = number.count(0) if one_count > zero_count: count += 1 print(count)
[ "shakilfci461@gmail.com" ]
shakilfci461@gmail.com
2b7199701eac80d3de6850b27032cfc6cc318aaa
eb9c3dac0dca0ecd184df14b1fda62e61cc8c7d7
/google/cloud/billing/budgets/v1beta1/billing-budgets-v1beta1-py/setup.py
cc3c039320dec24a399055373fd5bdd28b80a43c
[ "Apache-2.0" ]
permissive
Tryweirder/googleapis-gen
2e5daf46574c3af3d448f1177eaebe809100c346
45d8e9377379f9d1d4e166e80415a8c1737f284d
refs/heads/master
2023-04-05T06:30:04.726589
2021-04-13T23:35:20
2021-04-13T23:35:20
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,799
py
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # 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 io import os import setuptools # type: ignore version = '0.1.0' package_root = os.path.abspath(os.path.dirname(__file__)) readme_filename = os.path.join(package_root, 'README.rst') with io.open(readme_filename, encoding='utf-8') as readme_file: readme = readme_file.read() setuptools.setup( name='google-cloud-billing-budgets', version=version, long_description=readme, packages=setuptools.PEP420PackageFinder.find(), namespace_packages=('google', 'google.cloud', 'google.cloud.billing'), platforms='Posix; MacOS X; Windows', include_package_data=True, install_requires=( 'google-api-core[grpc] >= 1.22.2, < 2.0.0dev', 'libcst >= 0.2.5', 'proto-plus >= 1.15.0', ), python_requires='>=3.6', classifiers=[ 'Development Status :: 3 - Alpha', 'Intended Audience :: Developers', 'Operating System :: OS Independent', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Topic :: Internet', 'Topic :: Software Development :: Libraries :: Python Modules', ], zip_safe=False, )
[ "bazel-bot-development[bot]@users.noreply.github.com" ]
bazel-bot-development[bot]@users.noreply.github.com
dddd3601a393ce447cf447e14d2ad14a17af28b2
45ba55b4fbdaf1657fde92beaeba4f173265afcd
/tests/schema/test_lazy/type_a.py
65617b5f3b8844af612e367deb7490b69d790898
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
strawberry-graphql/strawberry
af96afd4edd1788c59e150597a12501fbc7bf444
6d86d1c08c1244e00535840d9d87925431bc6a1c
refs/heads/main
2023-08-30T03:34:12.929874
2023-08-24T12:01:09
2023-08-24T12:01:09
162,690,887
3,408
529
MIT
2023-09-14T21:49:44
2018-12-21T08:56:55
Python
UTF-8
Python
false
false
552
py
from typing import TYPE_CHECKING, List, Optional from typing_extensions import Annotated import strawberry if TYPE_CHECKING: from .type_b import TypeB TypeB_rel = TypeB TypeB_abs = TypeB else: TypeB_rel = Annotated["TypeB", strawberry.lazy(".type_b")] TypeB_abs = Annotated["TypeB", strawberry.lazy("tests.schema.test_lazy.type_b")] @strawberry.type class TypeA: list_of_b: Optional[List[TypeB_abs]] = None @strawberry.field def type_b(self) -> TypeB_rel: from .type_b import TypeB return TypeB()
[ "noreply@github.com" ]
strawberry-graphql.noreply@github.com
bcfa114770664cf17a450ca28a1a571355fb71cb
786027545626c24486753351d6e19093b261cd7d
/ghidra9.2.1_pyi/ghidra/util/table/mapper/AddressTableToAddressTableRowMapper.pyi
26072a368ad95ac4a06849d98672f2b4d0917da2
[ "MIT" ]
permissive
kohnakagawa/ghidra_scripts
51cede1874ef2b1fed901b802316449b4bf25661
5afed1234a7266c0624ec445133280993077c376
refs/heads/main
2023-03-25T08:25:16.842142
2021-03-18T13:31:40
2021-03-18T13:31:40
338,577,905
14
1
null
null
null
null
UTF-8
Python
false
false
1,880
pyi
import docking.widgets.table import ghidra.app.plugin.core.disassembler import ghidra.framework.plugintool import ghidra.program.model.address import ghidra.program.model.listing import ghidra.util.table import java.lang class AddressTableToAddressTableRowMapper(ghidra.util.table.ProgramLocationTableRowMapper): def __init__(self): ... def createMappedTableColumn(self, destinationColumn: docking.widgets.table.DynamicTableColumn) -> docking.widgets.table.DynamicTableColumn: """ Creates a table column that will create a table column that knows how to map the given <b>ROW_TYPE</b> to the type of the column passed in, the <b>EXPECTED_ROW_TYPE</b>. @param <COLUMN_TYPE> The column type of the given and created columns @param destinationColumn The existing column, which is based upon EXPECTED_ROW_TYPE, that we want to be able to use with the type we have, the ROW_TYPE. """ ... def equals(self, __a0: object) -> bool: ... def getClass(self) -> java.lang.Class: ... def getDestinationType(self) -> java.lang.Class: ... def getSourceType(self) -> java.lang.Class: ... def hashCode(self) -> int: ... @overload def map(self, rowObject: ghidra.app.plugin.core.disassembler.AddressTable, program: ghidra.program.model.listing.Program, serviceProvider: ghidra.framework.plugintool.ServiceProvider) -> ghidra.program.model.address.Address: ... @overload def map(self, __a0: object, __a1: object, __a2: ghidra.framework.plugintool.ServiceProvider) -> object: ... def notify(self) -> None: ... def notifyAll(self) -> None: ... def toString(self) -> unicode: ... @overload def wait(self) -> None: ... @overload def wait(self, __a0: long) -> None: ... @overload def wait(self, __a0: long, __a1: int) -> None: ...
[ "tsunekou1019@gmail.com" ]
tsunekou1019@gmail.com
c5ac32728ff60a79d336f27f03da40af850a984e
311dd683433891c6552e6bcbc383bb438ae0e7a9
/source/dataeditors.py
d7892016bd057986896058b0f628806fa810f2df
[]
no_license
HaBu108/TreeLine
4d6c489035e666b51ae1734d78f157b8777ce718
ce444d691c9c2ed71ebbbb800890ac30a0255ca3
refs/heads/master
2022-05-30T20:09:48.619012
2020-05-03T18:35:47
2020-05-03T18:35:47
null
0
0
null
null
null
null
UTF-8
Python
false
false
105,975
py
#!/usr/bin/env python3 #****************************************************************************** # dataeditors.py, provides classes for data editors in the data edit view # # TreeLine, an information storage program # Copyright (C) 2019, Douglas W. Bell # # This is free software; you can redistribute it and/or modify it under the # terms of the GNU General Public License, either Version 2 or any later # version. This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY. See the included LICENSE file for details. #****************************************************************************** import xml.sax.saxutils import os.path import sys import re import math import enum import datetime import subprocess from PyQt5.QtCore import (QDate, QDateTime, QPoint, QPointF, QRect, QSize, QTime, Qt, pyqtSignal) from PyQt5.QtGui import (QBrush, QFont, QFontMetrics, QPainter, QPainterPath, QPixmap, QPen, QTextCursor, QTextDocument, QValidator) from PyQt5.QtWidgets import (QAbstractItemView, QAbstractSpinBox, QAction, QApplication, QButtonGroup, QCalendarWidget, QCheckBox, QColorDialog, QComboBox, QDialog, QFileDialog, QHBoxLayout, QHeaderView, QLabel, QLineEdit, QMenu, QPushButton, QRadioButton, QScrollArea, QSizePolicy, QSpinBox, QTextEdit, QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget) import dataeditview import fieldformat import urltools import globalref import optiondefaults multipleSpaceRegEx = re.compile(r' {2,}') class PlainTextEditor(QTextEdit): """An editor widget for multi-line plain text fields. """ dragLinkEnabled = False contentsChanged = pyqtSignal(QWidget) editEnding = pyqtSignal(QWidget) keyPressed = pyqtSignal(QWidget) def __init__(self, parent=None): """Initialize the editor class. Arguments: parent -- the parent, if given """ super().__init__(parent) self.setAcceptRichText(False) self.setPalette(QApplication.palette()) self.setStyleSheet('QTextEdit {border: 2px solid palette(highlight)}') self.setTabChangesFocus(True) self.cursorPositionChanged.connect(self.updateActions) self.selectionChanged.connect(self.updateActions) self.allActions = parent.parent().allActions self.modified = False self.textChanged.connect(self.signalUpdate) def setContents(self, text): """Set the contents of the editor to text. Arguments: text - the new text contents for the editor """ self.blockSignals(True) self.setPlainText(text) self.blockSignals(False) def contents(self): """Return the editor text contents. """ return self.toPlainText() def hasSelectedText(self): """Return True if text is selected. """ return self.textCursor().hasSelection() def cursorPosTuple(self): """Return a tuple of the current cursor position and anchor (integers). """ cursor = self.textCursor() return (cursor.anchor(), cursor.position()) def setCursorPos(self, anchor, position): """Set the cursor to the given anchor and position. Arguments: anchor -- the cursor selection start integer position -- the cursor position or select end integer """ cursor = self.textCursor() cursor.setPosition(anchor) cursor.setPosition(position, QTextCursor.KeepAnchor) self.setTextCursor(cursor) # self.ensureCursorVisible() def setCursorPoint(self, point): """Set the cursor to the given point. Arguments: point -- the QPoint for the new cursor position """ self.setTextCursor(self.cursorForPosition(self.mapFromGlobal(point))) def resetCursor(self): """Set the cursor to end for tab-focus use. """ self.moveCursor(QTextCursor.End) def scrollPosition(self): """Return the current scrollbar position. """ return self.verticalScrollBar().value() def setScrollPosition(self, value): """Set the scrollbar position to value. Arguments: value -- the new scrollbar position """ self.verticalScrollBar().setValue(value) def signalUpdate(self): """Signal the delegate to update the model based on an editor change. """ self.modified = True self.contentsChanged.emit(self) def disableActions(self): """Reset action availability after focus is lost. """ self.allActions['EditCut'].setEnabled(True) self.allActions['EditCopy'].setEnabled(True) mime = QApplication.clipboard().mimeData() self.allActions['EditPaste'].setEnabled(len(mime.data('text/xml') or mime.data('text/plain')) > 0) def updateActions(self): """Set availability of context menu actions. """ hasSelection = self.textCursor().hasSelection() self.allActions['EditCut'].setEnabled(hasSelection) self.allActions['EditCopy'].setEnabled(hasSelection) mime = QApplication.clipboard().mimeData() self.allActions['EditPaste'].setEnabled(len(mime.data('text/plain')) > 0) def contextMenuEvent(self, event): """Override popup menu to add global actions. Arguments: event -- the menu event """ menu = QMenu(self) menu.addAction(self.allActions['FormatSelectAll']) menu.addSeparator() menu.addAction(self.allActions['EditCut']) menu.addAction(self.allActions['EditCopy']) menu.addAction(self.allActions['EditPaste']) menu.exec_(event.globalPos()) def focusInEvent(self, event): """Set availability and update format actions. Arguments: event -- the focus event """ super().focusInEvent(event) self.updateActions() def focusOutEvent(self, event): """Reset format actions on focus loss if not focusing a menu. Arguments: event -- the focus event """ super().focusOutEvent(event) if event.reason() != Qt.PopupFocusReason: self.disableActions() self.editEnding.emit(self) def hideEvent(self, event): """Reset format actions when the editor is hidden. Arguments: event -- the hide event """ self.disableActions() self.editEnding.emit(self) super().hideEvent(event) def keyPressEvent(self, event): """Emit a signal after every key press and handle page up/down. Needed to adjust scroll position in unlimited height editors. Arguments: event -- the key press event """ if (event.key() in (Qt.Key_PageUp, Qt.Key_PageDown) and not globalref.genOptions['EditorLimitHeight']): pos = self.cursorRect().center() if event.key() == Qt.Key_PageUp: pos.setY(pos.y() - self.parent().height()) if pos.y() < 0: pos.setY(0) else: pos.setY(pos.y() + self.parent().height()) if pos.y() > self.height(): pos.setY(self.height()) newCursor = self.cursorForPosition(pos) if event.modifiers() == Qt.ShiftModifier: cursor = self.textCursor() cursor.setPosition(newCursor.position(), QTextCursor.KeepAnchor) self.setTextCursor(cursor) else: self.setTextCursor(newCursor) event.accept() self.keyPressed.emit(self) return super().keyPressEvent(event) self.keyPressed.emit(self) class HtmlTextEditor(PlainTextEditor): """An editor for HTML fields, plain text with HTML insert commands. """ htmlFontSizes = ('small', '', 'large', 'x-large', 'xx-large') dragLinkEnabled = True inLinkSelectMode = pyqtSignal(bool) def __init__(self, parent=None): """Initialize the editor class. Arguments: parent -- the parent, if given """ super().__init__(parent) self.intLinkDialog = None self.nodeRef = None self.allActions['FormatBoldFont'].triggered.connect(self.setBoldFont) self.allActions['FormatItalicFont'].triggered.connect(self. setItalicFont) self.allActions['FormatUnderlineFont'].triggered.connect(self. setUnderlineFont) self.allActions['FormatFontSize'].parent().triggered.connect(self. setFontSize) self.allActions['FormatFontSize'].triggered.connect(self. showFontSizeMenu) self.allActions['FormatFontColor'].triggered.connect(self.setFontColor) self.allActions['FormatExtLink'].triggered.connect(self.setExtLink) self.allActions['FormatIntLink'].triggered.connect(self.setIntLink) def insertTagText(self, prefix, suffix): """Insert given tag text and maintain the original selection. Arguments: prefix -- the opening tag suffix -- the closing tag """ cursor = self.textCursor() start = cursor.selectionStart() end = cursor.selectionEnd() text = '{0}{1}{2}'.format(prefix, cursor.selectedText(), suffix) self.insertPlainText(text) cursor.setPosition(start + len(prefix)) cursor.setPosition(end + len(prefix), QTextCursor.KeepAnchor) self.setTextCursor(cursor) def setBoldFont(self, checked): """Insert tags for a bold font. Arguments: checked -- current toggle state of the control """ try: if self.hasFocus() and checked: self.insertTagText('<b>', '</b>') except RuntimeError: pass # avoid calling a deleted C++ editor object def setItalicFont(self, checked): """Insert tags for an italic font. Arguments: checked -- current toggle state of the control """ try: if self.hasFocus() and checked: self.insertTagText('<i>', '</i>') except RuntimeError: pass # avoid calling a deleted C++ editor object def setUnderlineFont(self, checked): """Insert tags for an underline font. Arguments: checked -- current toggle state of the control """ try: if self.hasFocus() and checked: self.insertTagText('<u>', '</u>') except RuntimeError: pass # avoid calling a deleted C++ editor object def setFontSize(self, action): """Set the font size of the selection or the current setting. Arguments: action -- the sub-menu action that was picked """ try: if self.hasFocus(): actions = self.allActions['FormatFontSize'].parent().actions() sizeNum = actions.index(action) size = HtmlTextEditor.htmlFontSizes[sizeNum] self.insertTagText('<span style="font-size:{0}">'.format(size), '</span>') except RuntimeError: pass # avoid calling a deleted C++ editor object def setFontColor(self): """Set the font color of the selection or the current setting. Prompt the user for a color using a dialog. """ try: if self.hasFocus(): charFormat = self.currentCharFormat() oldColor = charFormat.foreground().color() newColor = QColorDialog.getColor(oldColor, self) if newColor.isValid(): self.insertTagText('<span style="color:{0}">'. format(newColor.name()), '</span>') except RuntimeError: pass # avoid calling a deleted C++ editor object def setExtLink(self): """Add or modify an extrnal web link at the cursor. """ try: if self.hasFocus(): dialog = ExtLinkDialog(False, self) address, name = self.selectLink() if address.startswith('#'): address = name = '' dialog.setFromComponents(address, name) if dialog.exec_() == QDialog.Accepted: self.insertPlainText(dialog.htmlText()) except RuntimeError: pass # avoid calling a deleted C++ editor object def setIntLink(self): """Show dialog to add or modify an internal node link at the cursor. """ try: if self.hasFocus(): self.intLinkDialog = EmbedIntLinkDialog(self.nodeRef. treeStructureRef(), self) address, name = self.selectLink() if address.startswith('#'): address = address.lstrip('#') else: address = '' self.intLinkDialog.setFromComponents(address, name) self.intLinkDialog.finished.connect(self.insertInternalLink) self.intLinkDialog.show() self.inLinkSelectMode.emit(True) except RuntimeError: pass # avoid calling a deleted C++ editor object def insertInternalLink(self, resultCode): """Add or modify an internal node link based on dialog approval. Arguments: resultCode -- the result from the dialog (OK or cancel) """ if resultCode == QDialog.Accepted: self.insertPlainText(self.intLinkDialog.htmlText()) self.intLinkDialog = None self.inLinkSelectMode.emit(False) def setLinkFromNode(self, node): """Set the current internal link from a clicked node. Arguments: node -- the node to set the unique ID from """ if self.intLinkDialog: self.intLinkDialog.setFromNode(node) def selectLink(self): """Select the full link at the cursor, return link data. Any links at the cursor or partially selected are fully selected. Returns a tuple of the link address and name, or a tuple with empty strings if none are found. """ cursor = self.textCursor() anchor = cursor.anchor() position = cursor.position() for match in fieldformat.linkRegExp.finditer(self.toPlainText()): start = match.start() end = match.end() if start < anchor < end or start < position < end: address, name = match.groups() cursor.setPosition(start) cursor.setPosition(end, QTextCursor.KeepAnchor) self.setTextCursor(cursor) return (address, name) return ('', cursor.selectedText()) def addDroppedUrl(self, urlText): """Add the URL link that was dropped on this editor from the view. Arguments: urlText -- the text of the link """ name = urltools.shortName(urlText) text = '<a href="{0}">{1}</a>'.format(urlText, name) self.insertPlainText(text) def disableActions(self): """Set format actions to unavailable. """ super().disableActions() self.allActions['FormatBoldFont'].setEnabled(False) self.allActions['FormatItalicFont'].setEnabled(False) self.allActions['FormatUnderlineFont'].setEnabled(False) self.allActions['FormatFontSize'].parent().setEnabled(False) self.allActions['FormatFontColor'].setEnabled(False) self.allActions['FormatExtLink'].setEnabled(False) self.allActions['FormatIntLink'].setEnabled(False) def updateActions(self): """Set editor format actions to available and update toggle states. """ super().updateActions() boldFontAct = self.allActions['FormatBoldFont'] boldFontAct.setEnabled(True) boldFontAct.setChecked(False) italicAct = self.allActions['FormatItalicFont'] italicAct.setEnabled(True) italicAct.setChecked(False) underlineAct = self.allActions['FormatUnderlineFont'] underlineAct.setEnabled(True) underlineAct.setChecked(False) fontSizeSubMenu = self.allActions['FormatFontSize'].parent() fontSizeSubMenu.setEnabled(True) for action in fontSizeSubMenu.actions(): action.setChecked(False) self.allActions['FormatFontColor'].setEnabled(True) self.allActions['FormatExtLink'].setEnabled(True) self.allActions['FormatIntLink'].setEnabled(True) def showFontSizeMenu(self): """Show a context menu for font size at this edit box. """ if self.hasFocus(): rect = self.rect() pt = self.mapToGlobal(QPoint(rect.center().x(), rect.bottom())) self.allActions['FormatFontSize'].parent().popup(pt) def contextMenuEvent(self, event): """Override popup menu to add formatting and global actions. Arguments: event -- the menu event """ menu = QMenu(self) menu.addAction(self.allActions['FormatBoldFont']) menu.addAction(self.allActions['FormatItalicFont']) menu.addAction(self.allActions['FormatUnderlineFont']) menu.addSeparator() menu.addMenu(self.allActions['FormatFontSize'].parent()) menu.addAction(self.allActions['FormatFontColor']) menu.addSeparator() menu.addAction(self.allActions['FormatExtLink']) menu.addAction(self.allActions['FormatIntLink']) menu.addSeparator() menu.addAction(self.allActions['FormatSelectAll']) menu.addSeparator() menu.addAction(self.allActions['EditCut']) menu.addAction(self.allActions['EditCopy']) menu.addAction(self.allActions['EditPaste']) menu.exec_(event.globalPos()) def hideEvent(self, event): """Close the internal link dialog when the editor is hidden. Arguments: event -- the hide event """ if self.intLinkDialog: self.intLinkDialog.close() self.intLinkDialog = None super().hideEvent(event) class RichTextEditor(HtmlTextEditor): """An editor widget for multi-line wysiwyg rich text fields. """ fontPointSizes = [] def __init__(self, parent=None): """Initialize the editor class. Arguments: parent -- the parent, if given """ super().__init__(parent) self.setAcceptRichText(True) if not RichTextEditor.fontPointSizes: doc = QTextDocument() doc.setDefaultFont(self.font()) for sizeName in HtmlTextEditor.htmlFontSizes: if sizeName: doc.setHtml('<span style="font-size:{0}">text</span>'. format(sizeName)) pointSize = (QTextCursor(doc).charFormat().font(). pointSize()) else: pointSize = self.font().pointSize() RichTextEditor.fontPointSizes.append(pointSize) self.allActions['FormatClearFormat'].triggered.connect(self. setClearFormat) self.allActions['EditPastePlain'].triggered.connect(self.pastePlain) def setContents(self, text): """Set the contents of the editor to text. Arguments: text - the new text contents for the editor """ self.blockSignals(True) self.setHtml(text) self.blockSignals(False) def contents(self): """Return simplified HTML code for the editor contents. Replace Unicode line feeds with HTML breaks, escape <, >, &, and replace some rich formatting with HTML tags. """ doc = self.document() block = doc.begin() result = '' while block.isValid(): if result: result += '<br />' fragIter = block.begin() while not fragIter.atEnd(): text = xml.sax.saxutils.escape(fragIter.fragment().text()) text = text.replace('\u2028', '<br />') charFormat = fragIter.fragment().charFormat() if charFormat.fontWeight() >= QFont.Bold: text = '<b>{0}</b>'.format(text) if charFormat.fontItalic(): text = '<i>{0}</i>'.format(text) size = charFormat.font().pointSize() if size != self.font().pointSize(): closeSize = min((abs(size - i), i) for i in RichTextEditor.fontPointSizes)[1] sizeNum = RichTextEditor.fontPointSizes.index(closeSize) htmlSize = HtmlTextEditor.htmlFontSizes[sizeNum] if htmlSize: text = ('<span style="font-size:{0}">{1}</span>'. format(htmlSize, text)) if charFormat.anchorHref(): text = '<a href="{0}">{1}</a>'.format(charFormat. anchorHref(), text) else: # ignore underline and font color for links if charFormat.fontUnderline(): text = '<u>{0}</u>'.format(text) if (charFormat.foreground().color().name() != block.charFormat().foreground().color().name()): text = ('<span style="color:{0}">{1}</span>'. format(charFormat.foreground().color().name(), text)) result += text fragIter += 1 block = block.next() return result def setBoldFont(self, checked): """Set the selection or the current setting to a bold font. Arguments: checked -- current toggle state of the control """ try: if self.hasFocus(): if checked: self.setFontWeight(QFont.Bold) else: self.setFontWeight(QFont.Normal) except RuntimeError: pass # avoid calling a deleted C++ editor object def setItalicFont(self, checked): """Set the selection or the current setting to an italic font. Arguments: checked -- current toggle state of the control """ try: if self.hasFocus(): self.setFontItalic(checked) except RuntimeError: pass # avoid calling a deleted C++ editor object def setUnderlineFont(self, checked): """Set the selection or the current setting to an underlined font. Arguments: checked -- current toggle state of the control """ try: if self.hasFocus(): self.setFontUnderline(checked) except RuntimeError: pass # avoid calling a deleted C++ editor object def setFontSize(self, action): """Set the font size of the selection or the current setting. Arguments: action -- the sub-menu action that was picked """ try: if self.hasFocus(): actions = self.allActions['FormatFontSize'].parent().actions() sizeNum = actions.index(action) pointSize = RichTextEditor.fontPointSizes[sizeNum] charFormat = self.currentCharFormat() charFormat.setFontPointSize(pointSize) self.setCurrentCharFormat(charFormat) except RuntimeError: pass # avoid calling a deleted C++ editor object def setFontColor(self): """Set the font color of the selection or the current setting. Prompt the user for a color using a dialog. """ try: if self.hasFocus(): charFormat = self.currentCharFormat() oldColor = charFormat.foreground().color() newColor = QColorDialog.getColor(oldColor, self) if newColor.isValid(): charFormat.setForeground(QBrush(newColor)) self.setCurrentCharFormat(charFormat) except RuntimeError: pass # avoid calling a deleted C++ editor object def setClearFormat(self): """Clear the current or selected text formatting. """ try: if self.hasFocus(): self.setCurrentFont(self.font()) charFormat = self.currentCharFormat() charFormat.clearForeground() charFormat.setAnchor(False) charFormat.setAnchorHref('') self.setCurrentCharFormat(charFormat) except RuntimeError: pass # avoid calling a deleted C++ editor object def setExtLink(self): """Add or modify an extrnal web link at the cursor. """ try: if self.hasFocus(): dialog = ExtLinkDialog(False, self) address, name = self.selectLink() if address.startswith('#'): address = name = '' dialog.setFromComponents(address, name) if dialog.exec_() == QDialog.Accepted: if self.textCursor().hasSelection(): self.insertHtml(dialog.htmlText()) else: self.insertHtml(dialog.htmlText() + ' ') except RuntimeError: pass # avoid calling a deleted C++ editor object def insertInternalLink(self, resultCode): """Add or modify an internal node link based on dialog approval. Arguments: resultCode -- the result from the dialog (OK or cancel) """ if resultCode == QDialog.Accepted: if self.textCursor().hasSelection(): self.insertHtml(self.intLinkDialog.htmlText()) else: self.insertHtml(self.intLinkDialog.htmlText() + ' ') self.intLinkDialog = None self.inLinkSelectMode.emit(False) def selectLink(self): """Select the full link at the cursor, return link data. Any links at the cursor or partially selected are fully selected. Returns a tuple of the link address and name, or a tuple with empty strings if none are found. """ cursor = self.textCursor() if not cursor.hasSelection() and not cursor.charFormat().anchorHref(): return ('', '') selectText = cursor.selection().toPlainText() anchorCursor = QTextCursor(self.document()) anchorCursor.setPosition(cursor.anchor()) cursor.clearSelection() if cursor < anchorCursor: anchorCursor, cursor = cursor, anchorCursor position = cursor.position() address = name = '' if anchorCursor.charFormat().anchorHref(): fragIter = anchorCursor.block().begin() while not (fragIter.fragment().contains(anchorCursor.position()) or fragIter.fragment().contains(anchorCursor.position() - 1)): fragIter += 1 fragment = fragIter.fragment() anchorCursor.setPosition(fragment.position()) address = fragment.charFormat().anchorHref() name = fragment.text() if cursor.charFormat().anchorHref(): fragIter = cursor.block().begin() while not (fragIter.fragment().contains(cursor.position()) or fragIter.fragment().contains(cursor.position() - 1)): fragIter += 1 fragment = fragIter.fragment() position = fragment.position() + fragment.length() address = fragment.charFormat().anchorHref() name = fragment.text() if not name: name = selectText.split('\n')[0] cursor.setPosition(anchorCursor.position()) cursor.setPosition(position, QTextCursor.KeepAnchor) self.setTextCursor(cursor) return (address, name) def addDroppedUrl(self, urlText): """Add the URL link that was dropped on this editor from the view. Arguments: urlText -- the text of the link """ name = urltools.shortName(urlText) text = '<a href="{0}">{1}</a>'.format(urlText, name) if not self.textCursor().hasSelection(): text += ' ' self.insertHtml(text) def pastePlain(self): """Paste non-formatted text from the clipboard. """ text = QApplication.clipboard().mimeData().text() if text and self.hasFocus(): self.insertPlainText(text) def disableActions(self): """Set format actions to unavailable. """ super().disableActions() self.allActions['FormatClearFormat'].setEnabled(False) self.allActions['EditPastePlain'].setEnabled(False) def updateActions(self): """Set editor format actions to available and update toggle states. """ super().updateActions() self.allActions['FormatBoldFont'].setChecked(self.fontWeight() == QFont.Bold) self.allActions['FormatItalicFont'].setChecked(self.fontItalic()) self.allActions['FormatUnderlineFont'].setChecked(self.fontUnderline()) fontSizeSubMenu = self.allActions['FormatFontSize'].parent() pointSize = int(self.fontPointSize()) try: sizeNum = RichTextEditor.fontPointSizes.index(pointSize) except ValueError: sizeNum = 1 # default size fontSizeSubMenu.actions()[sizeNum].setChecked(True) self.allActions['FormatClearFormat'].setEnabled(True) mime = QApplication.clipboard().mimeData() self.allActions['EditPastePlain'].setEnabled(len(mime. data('text/plain')) > 0) def contextMenuEvent(self, event): """Override popup menu to add formatting and global actions. Arguments: event -- the menu event """ menu = QMenu(self) menu.addAction(self.allActions['FormatBoldFont']) menu.addAction(self.allActions['FormatItalicFont']) menu.addAction(self.allActions['FormatUnderlineFont']) menu.addSeparator() menu.addMenu(self.allActions['FormatFontSize'].parent()) menu.addAction(self.allActions['FormatFontColor']) menu.addSeparator() menu.addAction(self.allActions['FormatExtLink']) menu.addAction(self.allActions['FormatIntLink']) menu.addSeparator() menu.addAction(self.allActions['FormatSelectAll']) menu.addAction(self.allActions['FormatClearFormat']) menu.addSeparator() menu.addAction(self.allActions['EditCut']) menu.addAction(self.allActions['EditCopy']) menu.addAction(self.allActions['EditPaste']) menu.addAction(self.allActions['EditPastePlain']) menu.exec_(event.globalPos()) def mousePressEvent(self, event): """Handle ctrl + click to follow links. Arguments: event -- the mouse event """ if (event.button() == Qt.LeftButton and event.modifiers() == Qt.ControlModifier): cursor = self.cursorForPosition(event.pos()) address = cursor.charFormat().anchorHref() if address: if address.startswith('#'): editView = self.parent().parent() selectModel = editView.treeView.selectionModel() selectModel.selectNodeById(address[1:]) else: # check for relative path if urltools.isRelative(address): defaultPath = str(globalref.mainControl. defaultPathObj(True)) address = urltools.toAbsolute(address, defaultPath) openExtUrl(address) event.accept() else: super().mousePressEvent(event) class OneLineTextEditor(RichTextEditor): """An editor widget for single-line wysiwyg rich text fields. """ def __init__(self, parent=None): """Initialize the editor class. Arguments: parent -- the parent, if given """ super().__init__(parent) def insertFromMimeData(self, mimeSource): """Override to verify that only a single line is pasted or dropped. Arguments: mimeSource -- the mime source to be inserted """ super().insertFromMimeData(mimeSource) text = self.contents() if '<br />' in text: text = text.split('<br />', 1)[0] self.blockSignals(True) self.setHtml(text) self.blockSignals(False) self.moveCursor(QTextCursor.End) def keyPressEvent(self, event): """Customize handling of return and control keys. Arguments: event -- the key press event """ if event.key() not in (Qt.Key_Enter, Qt.Key_Return): super().keyPressEvent(event) class LineEditor(QLineEdit): """An editor widget for unformatted single-line fields. Used both stand-alone and as part of the combo box editor. """ dragLinkEnabled = False contentsChanged = pyqtSignal(QWidget) editEnding = pyqtSignal(QWidget) contextMenuPrep = pyqtSignal() def __init__(self, parent=None, subControl=False): """Initialize the editor class. Includes a colored triangle error flag for non-matching formats. Arguments: parent -- the parent, if given subcontrol -- true if used inside a combo box (no border or signal) """ super().__init__(parent) self.setPalette(QApplication.palette()) self.cursorPositionChanged.connect(self.updateActions) self.selectionChanged.connect(self.updateActions) try: self.allActions = parent.parent().allActions except AttributeError: # view is a level up if embedded in a combo self.allActions = parent.parent().parent().allActions self.modified = False self.errorFlag = False self.savedCursorPos = None self.extraMenuActions = [] if not subControl: self.setStyleSheet('QLineEdit {border: 2px solid ' 'palette(highlight)}') self.textEdited.connect(self.signalUpdate) def setContents(self, text): """Set the contents of the editor to text. Arguments: text - the new text contents for the editor """ self.setText(text) def contents(self): """Return the editor text contents. """ return self.text() def signalUpdate(self): """Signal the delegate to update the model based on an editor change. """ self.modified = True self.errorFlag = False self.contentsChanged.emit(self) def setErrorFlag(self): """Set the error flag to True and repaint the widget. """ self.errorFlag = True self.update() def cursorPosTuple(self): """Return a tuple of the current cursor position and anchor (integers). """ pos = start = self.cursorPosition() if self.hasSelectedText(): start = self.selectionStart() return (start, pos) def setCursorPos(self, anchor, position): """Set the cursor to the given anchor and position. Arguments: anchor -- the cursor selection start integer position -- the cursor position or select end integer """ if anchor == position: self.deselect() self.setCursorPosition(position) else: self.setSelection(anchor, position - anchor) def setCursorPoint(self, point): """Set the cursor to the given point. Arguments: point -- the QPoint for the new cursor position """ self.savedCursorPos = self.cursorPositionAt(self.mapFromGlobal(point)) self.setCursorPosition(self.savedCursorPos) def resetCursor(self): """Set the cursor to select all for tab-focus use. """ self.selectAll() def scrollPosition(self): """Return the current scrollbar position. """ return 0 def setScrollPosition(self, value): """Set the scrollbar position to value. No operation with single line editor. Arguments: value -- the new scrollbar position """ pass def paintEvent(self, event): """Add painting of the error flag to the paint event. Arguments: event -- the paint event """ super().paintEvent(event) if self.errorFlag: painter = QPainter(self) path = QPainterPath(QPointF(0, 0)) path.lineTo(0, 10) path.lineTo(10, 0) path.closeSubpath() painter.fillPath(path, QApplication.palette().highlight()) def disableActions(self): """Reset action availability after focus is lost. """ self.allActions['EditCut'].setEnabled(True) self.allActions['EditCopy'].setEnabled(True) mime = QApplication.clipboard().mimeData() self.allActions['EditPaste'].setEnabled(len(mime.data('text/xml') or mime.data('text/plain')) > 0) def updateActions(self): """Set availability of context menu actions. """ hasSelection = self.hasSelectedText() self.allActions['EditCut'].setEnabled(hasSelection) self.allActions['EditCopy'].setEnabled(hasSelection) mime = QApplication.clipboard().mimeData() self.allActions['EditPaste'].setEnabled(len(mime.data('text/plain')) > 0) def contextMenuEvent(self, event): """Override popup menu to add formatting actions. Arguments: event -- the menu event """ self.contextMenuPrep.emit() menu = QMenu(self) if self.extraMenuActions: for action in self.extraMenuActions: menu.addAction(action) menu.addSeparator() menu.addAction(self.allActions['FormatSelectAll']) menu.addSeparator() menu.addAction(self.allActions['EditCut']) menu.addAction(self.allActions['EditCopy']) menu.addAction(self.allActions['EditPaste']) menu.exec_(event.globalPos()) def focusInEvent(self, event): """Restore a saved cursor position for new editors. Arguments: event -- the focus event """ super().focusInEvent(event) if (event.reason() == Qt.OtherFocusReason and self.savedCursorPos != None): self.setCursorPosition(self.savedCursorPos) self.savedCursorPos = None self.updateActions() def focusOutEvent(self, event): """Reset format actions on focus loss if not focusing a menu. Arguments: event -- the focus event """ super().focusOutEvent(event) if event.reason() != Qt.PopupFocusReason: self.disableActions() self.editEnding.emit(self) def hideEvent(self, event): """Reset format actions when the editor is hidden. Arguments: event -- the hide event """ self.disableActions() self.editEnding.emit(self) super().hideEvent(event) class ReadOnlyEditor(LineEditor): """An editor widget that doesn't allow any edits. """ def __init__(self, parent=None): """Initialize the editor class. Includes a colored triangle error flag for non-matching formats. Arguments: parent -- the parent, if given """ super().__init__(parent, True) self.setReadOnly(True) self.setStyleSheet('QLineEdit {border: 2px solid palette(highlight); ' 'background-color: palette(button)}') class ComboEditor(QComboBox): """A general combo box editor widget. Uses the LineEditor class to paint the error flag. """ dragLinkEnabled = False contentsChanged = pyqtSignal(QWidget) editEnding = pyqtSignal(QWidget) def __init__(self, parent=None): """Initialize the editor class. The self.fieldRef and self.nodeRef must be set after creation. Arguments: parent -- the parent, if given """ super().__init__(parent) self.setPalette(QApplication.palette()) self.setStyleSheet('QComboBox {border: 2px solid palette(highlight)}') self.setEditable(True) self.setLineEdit(LineEditor(self, True)) self.listView = QTreeWidget() self.listView.setColumnCount(2) self.listView.header().hide() self.listView.setRootIsDecorated(False) self.listView.setSelectionBehavior(QAbstractItemView.SelectRows) self.listView.header().setSectionResizeMode(QHeaderView. ResizeToContents) self.setModel(self.listView.model()) self.setView(self.listView) self.setModelColumn(0) self.modified = False self.fieldRef = None self.nodeRef = None self.editTextChanged.connect(self.signalUpdate) self.lineEdit().editEnding.connect(self.signalEditEnd) def setContents(self, text): """Set the contents of the editor to text. Arguments: text - the new text contents for the editor """ self.blockSignals(True) self.setEditText(text) self.blockSignals(False) def contents(self): """Return the editor text contents. """ return self.currentText() def showPopup(self): """Load combo box with choices before showing it. """ self.listView.setColumnCount(self.fieldRef.numChoiceColumns) text = self.currentText() if self.fieldRef.autoAddChoices: self.fieldRef.clearChoices() for node in self.nodeRef.treeStructureRef().nodeDict.values(): if node.formatRef == self.nodeRef.formatRef: self.fieldRef.addChoice(node.data.get(self.fieldRef.name, '')) self.blockSignals(True) self.clear() if self.fieldRef.numChoiceColumns == 1: choices = self.fieldRef.comboChoices() self.addItems(choices) else: annotatedChoices = self.fieldRef.annotatedComboChoices(text) for choice, annot in annotatedChoices: QTreeWidgetItem(self.listView, [choice, annot]) choices = [choice for (choice, annot) in annotatedChoices] try: self.setCurrentIndex(choices.index(text)) except ValueError: self.setEditText(text) self.blockSignals(False) super().showPopup() def signalUpdate(self): """Signal the delegate to update the model based on an editor change. """ self.modified = True self.lineEdit().errorFlag = False self.contentsChanged.emit(self) def setErrorFlag(self): """Set the error flag to True and repaint the widget. """ self.lineEdit().errorFlag = True self.update() def hasSelectedText(self): """Return True if text is selected. """ return self.lineEdit().hasSelectedText() def selectAll(self): """Select all text in the line editor. """ self.lineEdit().selectAll() def cursorPosTuple(self): """Return a tuple of the current cursor position and anchor (integers). """ return self.lineEdit().cursorPosTuple() def setCursorPos(self, anchor, position): """Set the cursor to the given anchor and position. Arguments: anchor -- the cursor selection start integer position -- the cursor position or select end integer """ self.lineEdit().setCursorPos(anchor, position) def setCursorPoint(self, point): """Set the cursor to the given point. Arguments: point -- the QPoint for the new cursor position """ self.lineEdit().setCursorPoint(point) def resetCursor(self): """Set the cursor to select all for tab-focus use. """ self.lineEdit().selectAll() def scrollPosition(self): """Return the current scrollbar position. """ return 0 def setScrollPosition(self, value): """Set the scrollbar position to value. No operation with single line editor. Arguments: value -- the new scrollbar position """ pass def copy(self): """Copy text selected in the line editor. """ self.lineEdit().copy() def cut(self): """Cut text selected in the line editor. """ self.lineEdit().cut() def paste(self): """Paste from the clipboard into the line editor. """ self.lineEdit().paste() def signalEditEnd(self): """Emit editEnding signal based on line edit signal. """ self.editEnding.emit(self) class CombinationEditor(ComboEditor): """An editor widget for combination and auto-combination fields. Uses a combo box with a list of checkboxes in place of the list popup. """ def __init__(self, parent=None): """Initialize the editor class. Arguments: parent -- the parent, if given """ super().__init__(parent) self.checkBoxDialog = None def showPopup(self): """Override to show a popup entry widget in place of a list view. """ if self.fieldRef.autoAddChoices: self.fieldRef.clearChoices() for node in self.nodeRef.treeStructureRef().nodeDict.values(): if node.formatRef == self.nodeRef.formatRef: self.fieldRef.addChoice(node.data.get(self.fieldRef.name, '')) selectList = self.fieldRef.comboActiveChoices(self.currentText()) self.checkBoxDialog = CombinationDialog(self.fieldRef.comboChoices(), selectList, self) self.checkBoxDialog.setMinimumWidth(self.width()) self.checkBoxDialog.buttonChanged.connect(self.updateText) self.checkBoxDialog.show() pos = self.mapToGlobal(self.rect().bottomRight()) pos.setX(pos.x() - self.checkBoxDialog.width() + 1) screenBottom = (QApplication.desktop().screenGeometry(self). bottom()) if pos.y() + self.checkBoxDialog.height() > screenBottom: pos.setY(pos.y() - self.rect().height() - self.checkBoxDialog.height()) self.checkBoxDialog.move(pos) def hidePopup(self): """Override to hide the popup entry widget. """ if self.checkBoxDialog: self.checkBoxDialog.hide() super().hidePopup() def updateText(self): """Update the text based on a changed signal. """ if self.checkBoxDialog: self.setEditText(self.fieldRef.joinText(self.checkBoxDialog. selectList())) class CombinationDialog(QDialog): """A popup dialog box for combination and auto-combination fields. """ buttonChanged = pyqtSignal() def __init__(self, choiceList, selectList, parent=None): """Initialize the combination dialog. Arguments: choiceList -- a list of text choices selectList -- a lit of choices to preselect parent -- the parent, if given """ super().__init__(parent) self.setWindowFlags(Qt.Popup) topLayout = QVBoxLayout(self) topLayout.setContentsMargins(0, 0, 0, 0) scrollArea = QScrollArea() scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) topLayout.addWidget(scrollArea) innerWidget = QWidget() innerLayout = QVBoxLayout(innerWidget) selected = set(selectList) self.buttonGroup = QButtonGroup(self) self.buttonGroup.setExclusive(False) self.buttonGroup.buttonClicked.connect(self.buttonChanged) for text in choiceList: button = QCheckBox(text, innerWidget) if text in selected: button.setChecked(True) self.buttonGroup.addButton(button) innerLayout.addWidget(button) scrollArea.setWidget(innerWidget) buttons = self.buttonGroup.buttons() if buttons: buttons[0].setFocus() def selectList(self): """Return a list of currently checked text. """ result = [] for button in self.buttonGroup.buttons(): if button.isChecked(): result.append(button.text()) return result class DateEditor(ComboEditor): """An editor widget for date fields. Uses a combo box with a calendar widget in place of the list popup. """ def __init__(self, parent=None): """Initialize the editor class. Arguments: parent -- the parent, if given """ super().__init__(parent) self.calendar = None nowAction = QAction(_('Today\'s &Date'), self) nowAction.triggered.connect(self.setNow) self.lineEdit().extraMenuActions = [nowAction] def editorDate(self): """Return the date (as a QDate) set in the line editor. If none or invalid, return an invalid date. """ try: dateStr = self.fieldRef.storedText(self.currentText()) except ValueError: return QDate() return QDate.fromString(dateStr, Qt.ISODate) def showPopup(self): """Override to show a calendar widget in place of a list view. """ if not self.calendar: self.calendar = QCalendarWidget(self) self.calendar.setWindowFlags(Qt.Popup) weekStart = optiondefaults.daysOfWeek.index(globalref. genOptions['WeekStart']) self.calendar.setFirstDayOfWeek(weekStart + 1) self.calendar.setVerticalHeaderFormat(QCalendarWidget. NoVerticalHeader) self.calendar.clicked.connect(self.setDate) date = self.editorDate() if date.isValid(): self.calendar.setSelectedDate(date) self.calendar.show() pos = self.mapToGlobal(self.rect().bottomRight()) pos.setX(pos.x() - self.calendar.width()) screenBottom = (QApplication.desktop().screenGeometry(self). bottom()) if pos.y() + self.calendar.height() > screenBottom: pos.setY(pos.y() - self.rect().height() - self.calendar.height()) self.calendar.move(pos) def hidePopup(self): """Override to hide the calendar widget. """ if self.calendar: self.calendar.hide() super().hidePopup() def setDate(self, date): """Set the date based on a signal from the calendar popup. Arguments: date -- the QDate to be set """ dateStr = date.toString(Qt.ISODate) self.setEditText(self.fieldRef.formatEditorText(dateStr)) self.calendar.hide() def setNow(self): """Set to today's date. """ dateStr = QDate.currentDate().toString(Qt.ISODate) self.setEditText(self.fieldRef.formatEditorText(dateStr)) class TimeEditor(ComboEditor): """An editor widget for time fields. Adds a clock popup dialog and a "now" right-click menu action. """ def __init__(self, parent=None): """Initialize the editor class. Arguments: parent -- the parent, if given """ super().__init__(parent) self.dialog = None nowAction = QAction(_('Set to &Now'), self) nowAction.triggered.connect(self.setNow) self.lineEdit().extraMenuActions = [nowAction] def showPopup(self): """Override to show a popup entry widget in place of a list view. """ if not self.dialog: self.dialog = TimeDialog(self) self.dialog.contentsChanged.connect(self.setTime) self.dialog.show() pos = self.mapToGlobal(self.rect().bottomRight()) pos.setX(pos.x() - self.dialog.width() + 1) screenBottom = QApplication.desktop().screenGeometry(self).bottom() if pos.y() + self.dialog.height() > screenBottom: pos.setY(pos.y() - self.rect().height() - self.dialog.height()) self.dialog.move(pos) try: storedText = self.fieldRef.storedText(self.currentText()) except ValueError: storedText = '' if storedText: self.dialog.setTimeFromText(storedText) def hidePopup(self): """Override to hide the popup entry widget. """ if self.dialog: self.dialog.hide() super().hidePopup() def setTime(self): """Set the time fom the dialog. """ if self.dialog: timeStr = self.dialog.timeObject().isoformat() + '.000' self.setEditText(self.fieldRef.formatEditorText(timeStr)) def setNow(self): """Set to the current time. """ timeStr = QTime.currentTime().toString('hh:mm:ss.zzz') self.setEditText(self.fieldRef.formatEditorText(timeStr)) TimeElem = enum.Enum('TimeElem', 'hour minute second') class TimeDialog(QDialog): """A popup clock dialog for time editing. """ contentsChanged = pyqtSignal() def __init__(self, addCalendar=False, parent=None): """Initialize the dialog widgets. Arguments: parent -- the dialog's parent widget """ super().__init__(parent) self.focusElem = None self.setWindowFlags(Qt.Popup) horizLayout = QHBoxLayout(self) if addCalendar: self.calendar = QCalendarWidget() horizLayout.addWidget(self.calendar) weekStart = optiondefaults.daysOfWeek.index(globalref. genOptions['WeekStart']) self.calendar.setFirstDayOfWeek(weekStart + 1) self.calendar.setVerticalHeaderFormat(QCalendarWidget. NoVerticalHeader) self.calendar.clicked.connect(self.contentsChanged) vertLayout = QVBoxLayout() horizLayout.addLayout(vertLayout) upperLayout = QHBoxLayout() vertLayout.addLayout(upperLayout) upperLayout.addStretch(0) self.hourBox = TimeSpinBox(TimeElem.hour, 1, 12, False) upperLayout.addWidget(self.hourBox) self.hourBox.valueChanged.connect(self.signalUpdate) self.hourBox.focusChanged.connect(self.handleFocusChange) colon = QLabel('<b>:</b>') upperLayout.addWidget(colon) self.minuteBox = TimeSpinBox(TimeElem.minute, 0, 59, True) upperLayout.addWidget(self.minuteBox) self.minuteBox.valueChanged.connect(self.signalUpdate) self.minuteBox.focusChanged.connect(self.handleFocusChange) colon = QLabel('<b>:</b>') upperLayout.addWidget(colon) self.secondBox = TimeSpinBox(TimeElem.second, 0, 59, True) upperLayout.addWidget(self.secondBox) self.secondBox.valueChanged.connect(self.signalUpdate) self.secondBox.focusChanged.connect(self.handleFocusChange) self.amPmBox = AmPmSpinBox() upperLayout.addSpacing(4) upperLayout.addWidget(self.amPmBox) self.amPmBox.valueChanged.connect(self.signalUpdate) upperLayout.addStretch(0) lowerLayout = QHBoxLayout() vertLayout.addLayout(lowerLayout) self.clock = ClockWidget() lowerLayout.addWidget(self.clock, Qt.AlignCenter) self.clock.numClicked.connect(self.setFromClock) if addCalendar: self.calendar.setFocus() self.updateClock() else: self.hourBox.setFocus() self.hourBox.selectAll() def setTimeFromText(self, text): """Set the time dialog from a string. Arguments: text -- the time in ISO format """ time = (datetime.datetime. strptime(text, fieldformat.TimeField.isoFormat).time()) hour = time.hour if time.hour <= 12 else time.hour - 12 self.blockSignals(True) self.hourBox.setValue(hour) self.minuteBox.setValue(time.minute) self.secondBox.setValue(time.second) amPm = 'AM' if time.hour < 12 else 'PM' self.amPmBox.setValue(amPm) self.blockSignals(False) self.updateClock() def setDateFromText(self, text): """Set the date dialog from a string. Arguments: text -- the date in ISO format """ date = QDate.fromString(text, Qt.ISODate) if date.isValid(): self.calendar.setSelectedDate(date) def timeObject(self): """Return a datetime time object for the current dialog setting. """ hour = self.hourBox.value() if self.amPmBox.value == 'PM': if hour < 12: hour += 12 elif hour == 12: hour = 0 return datetime.time(hour, self.minuteBox.value(), self.secondBox.value()) def updateClock(self): """Update the clock based on the current time and focused widget. """ hands = [self.focusElem] if self.focusElem else [TimeElem.hour, TimeElem.minute, TimeElem.second] self.clock.setDisplay(self.timeObject(), hands) def handleFocusChange(self, elemType, isFocused): """Update clock based on focus changes. Arguments: elemType -- the TimeElem of the focus change isFocused -- True if focus is gained """ if isFocused: if elemType != self.focusElem: self.focusElem = elemType self.updateClock() elif elemType == self.focusElem: self.focusElem = None self.updateClock() def setFromClock(self, num): """Set the active spin box value from a clock click. Arguments: num -- the number clicked """ spinBox = getattr(self, self.focusElem.name + 'Box') spinBox.setValue(num) spinBox.selectAll() def signalUpdate(self): """Signal a time change and update the clock. """ self.updateClock() self.contentsChanged.emit() class TimeSpinBox(QSpinBox): """A spin box for time values with optional leading zero. """ focusChanged = pyqtSignal(TimeElem, bool) def __init__(self, elemType, minValue, maxValue, leadZero=True, parent=None): """Initialize the spin box. Arguments: elemType -- the TimeElem of this box minValue -- the minimum allowed value maxValue -- the maximum allowed value leadZero -- true if a leading zero used with single digit values parent -- the box's parent widget """ self.elemType = elemType self.leadZero = leadZero super().__init__(parent) self.setMinimum(minValue) self.setMaximum(maxValue) self.setWrapping(True) self.setAlignment(Qt.AlignRight) def textFromValue(self, value): """Override to optionally add leading zero. Arguments: value -- the int value to convert """ if self.leadZero and value < 10: return '0' + repr(value) return repr(value) def focusInEvent(self, event): """Emit a signal when focused. Arguments: event -- the focus event """ super().focusInEvent(event) self.focusChanged.emit(self.elemType, True) def focusOutEvent(self, event): """Emit a signal if focus is lost. Arguments: event -- the focus event """ super().focusOutEvent(event) self.focusChanged.emit(self.elemType, False) class AmPmSpinBox(QAbstractSpinBox): """A spin box for AM/PM values. """ valueChanged = pyqtSignal() def __init__(self, parent=None): """Initialize the spin box. Arguments: parent -- the box's parent widget """ super().__init__(parent) self.value = 'AM' self.setDisplay() def stepBy(self, steps): """Step the spin box to the alternate value. Arguments: steps -- number of steps (ignored) """ self.value = 'PM' if self.value == 'AM' else 'AM' self.setDisplay() def stepEnabled(self): """Return enabled to show that stepping is always enabled. """ return (QAbstractSpinBox.StepUpEnabled | QAbstractSpinBox.StepDownEnabled) def setValue(self, value): """Set to text value if valid. Arguments: value -- the text value to set """ if value in ('AM', 'PM'): self.value = value self.setDisplay() def setDisplay(self): """Update display to match value. """ self.lineEdit().setText(self.value) self.valueChanged.emit() if self.hasFocus(): self.selectAll() def validate(self, inputStr, pos): """Check if the input string is acceptable. Arguments: inputStr -- the string to check pos -- the pos in the string (ignored) """ inputStr = inputStr.upper() if inputStr in ('AM', 'A'): self.value = 'AM' self.setDisplay() return (QValidator.Acceptable, 'AM', 2) if inputStr in ('PM', 'P'): self.value = 'PM' self.setDisplay() return (QValidator.Acceptable, 'PM', 2) return (QValidator.Invalid, 'xx', 2) def sizeHint(self): """Set prefered size. """ return super().sizeHint() + QSize(QFontMetrics(self.font()). width('AM'), 0) def focusInEvent(self, event): """Set select all when focused. Arguments: event -- the focus event """ super().focusInEvent(event) self.selectAll() def focusOutEvent(self, event): """Remove selection if focus is lost. Arguments: event -- the focus event """ super().focusOutEvent(event) self.lineEdit().deselect() class ClockWidget(QWidget): """A widget showing a clickable clock face. """ radius = 80 margin = 10 handLengths = {TimeElem.hour: int(radius * 0.5), TimeElem.minute: int(radius * 0.9), TimeElem.second: int(radius * 0.95)} handWidths = {TimeElem.hour: 7, TimeElem.minute: 5, TimeElem.second: 2} divisor = {TimeElem.hour: 120, TimeElem.minute: 10, TimeElem.second: 1 / 6} numClicked = pyqtSignal(int) def __init__(self, parent=None): """Initialize the clock. Arguments: parent -- the dialog's parent widget """ super().__init__(parent) self.time = datetime.time() self.hands = [] self.highlightAngle = None self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.setMouseTracking(True) def setDisplay(self, time, hands): """Set the clock display. Arguments: time -- a datetime time value hands -- a list of TimeElem clock hands to show """ self.time = time self.hands = hands self.highlightAngle = None self.update() def paintEvent(self, event): """Paint the clock face. Arguments: event -- the paint event """ painter = QPainter(self) painter.save() painter.setBrush(QApplication.palette().base()) painter.setPen(Qt.NoPen) painter.drawEllipse(self.rect()) painter.translate(ClockWidget.radius + ClockWidget.margin, ClockWidget.radius + ClockWidget.margin) for timeElem in self.hands: painter.save() painter.setBrush(QApplication.palette().windowText()) painter.setPen(Qt.NoPen) seconds = (self.time.hour * 3600 + self.time.minute * 60 + self.time.second) angle = seconds / ClockWidget.divisor[timeElem] % 360 if len(self.hands) == 1: painter.setBrush(QApplication.palette().highlight()) if self.hands[0] == TimeElem.hour: angle = int(angle // 30 * 30) # truncate to whole hour else: angle = int(angle // 6 * 6) # truncate to whole min/sec painter.rotate(angle) points = (QPoint(0, -ClockWidget.handLengths[timeElem]), QPoint(ClockWidget.handWidths[timeElem], 8), QPoint(-ClockWidget.handWidths[timeElem], 8)) painter.drawConvexPolygon(*points) painter.restore() rect = QRect(0, 0, 20, 20) if len(self.hands) != 1 or self.hands[0] == TimeElem.hour: labels = [repr(num) for num in range(1, 13)] else: labels = ['{0:0>2}'.format(num) for num in range(5, 56, 5)] labels.append('00') for ang in range(30, 361, 30): rect.moveCenter(self.pointOnRadius(ang)) painter.setPen(QPen()) if len(self.hands) == 1 and (ang == angle or ang == self.highlightAngle): painter.setPen(QPen(QApplication.palette().highlight(), 1)) painter.drawText(rect, Qt.AlignCenter, labels.pop(0)) painter.restore() super().paintEvent(event) def sizeHint(self): """Set prefered size. """ width = (ClockWidget.radius + ClockWidget.margin) * 2 return QSize(width, width) def pointOnRadius(self, angle): """Return a QPoint on the radius at the given angle. Arguments: angle -- the angle in dgrees from vertical (clockwise) """ angle = math.radians(angle) x = round(ClockWidget.radius * math.sin(angle)) y = 0 - round(ClockWidget.radius * math.cos(angle)) return QPoint(x, y) def pointToPosition(self, point): """Return a position (1 to 12) based on a screen point. Return None if not on a position. Arguments: point -- a QPoint screen position """ x = point.x() - ClockWidget.radius - ClockWidget.margin y = point.y() - ClockWidget.radius - ClockWidget.margin radius = math.sqrt(x**2 + y**2) if (ClockWidget.radius - 2 * ClockWidget.margin <= radius <= ClockWidget.radius + 2 * ClockWidget.margin): angle = math.degrees(math.atan2(-x, y)) + 180 if angle % 30 <= 10 or angle % 30 >= 20: pos = round(angle / 30) if pos == 0: pos = 12 return pos return None def mousePressEvent(self, event): """Signal user clicks on clock numbers if in single hand mode. Arguments: event -- the mouse press event """ if len(self.hands) == 1 and event.button() == Qt.LeftButton: pos = self.pointToPosition(event.pos()) if pos: if self.hands[0] != TimeElem.hour: if pos == 12: pos = 0 pos *= 5 self.numClicked.emit(pos) super().mousePressEvent(event) def mouseMoveEvent(self, event): """Highlight clickable numbers if in single hand mode. Arguments: event -- the mouse move event """ if len(self.hands) == 1: pos = self.pointToPosition(event.pos()) if pos: self.highlightAngle = pos * 30 self.update() elif self.highlightAngle != None: self.highlightAngle = None self.update() super().mouseMoveEvent(event) class DateTimeEditor(ComboEditor): """An editor widget for DateTimeFields. Uses a combo box with a clandar widget in place of the list popup. """ def __init__(self, parent=None): """Initialize the editor class. Arguments: parent -- the parent, if given """ super().__init__(parent) self.dialog = None nowAction = QAction(_('Set to &Now'), self) nowAction.triggered.connect(self.setNow) self.lineEdit().extraMenuActions = [nowAction] def showPopup(self): """Override to show a popup entry widget in place of a list view. """ if not self.dialog: self.dialog = TimeDialog(True, self) self.dialog.contentsChanged.connect(self.setDateTime) self.dialog.show() pos = self.mapToGlobal(self.rect().bottomRight()) pos.setX(pos.x() - self.dialog.width() + 1) screenBottom = QApplication.desktop().screenGeometry(self).bottom() if pos.y() + self.dialog.height() > screenBottom: pos.setY(pos.y() - self.rect().height() - self.dialog.height()) self.dialog.move(pos) try: storedText = self.fieldRef.storedText(self.currentText()) except ValueError: storedText = '' if storedText: dateText, timeText = storedText.split(' ', 1) self.dialog.setDateFromText(dateText) self.dialog.setTimeFromText(timeText) def hidePopup(self): """Override to hide the popup entry widget. """ if self.dialog: self.dialog.hide() super().hidePopup() def setDateTime(self): """Set the date and time based on a signal from the dialog calendar. """ if self.dialog: dateStr = self.dialog.calendar.selectedDate().toString(Qt.ISODate) timeStr = self.dialog.timeObject().isoformat() + '.000' self.setEditText(self.fieldRef.formatEditorText(dateStr + ' ' + timeStr)) def setNow(self): """Set to the current date and time. """ dateTime = QDateTime.currentDateTime() dateTimeStr = dateTime.toString('yyyy-MM-dd HH:mm:ss.zzz') self.setEditText(self.fieldRef.formatEditorText(dateTimeStr)) class ExtLinkEditor(ComboEditor): """An editor widget for external link fields. Uses a combo box with a link entry box in place of the list popup. """ dragLinkEnabled = True def __init__(self, parent=None): """Initialize the editor class. Arguments: parent -- the parent, if given """ super().__init__(parent) self.setAcceptDrops(True) self.dialog = None openAction = QAction(_('&Open Link'), self) openAction.triggered.connect(self.openLink) folderAction = QAction(_('Open &Folder'), self) folderAction.triggered.connect(self.openFolder) self.lineEdit().extraMenuActions = [openAction, folderAction] self.lineEdit().contextMenuPrep.connect(self.updateActions) def showPopup(self): """Override to show a popup entry widget in place of a list view. """ if not self.dialog: self.dialog = ExtLinkDialog(True, self) self.dialog.contentsChanged.connect(self.setLink) self.dialog.show() pos = self.mapToGlobal(self.rect().bottomRight()) pos.setX(pos.x() - self.dialog.width() + 1) screenBottom = QApplication.desktop().screenGeometry(self).bottom() if pos.y() + self.dialog.height() > screenBottom: pos.setY(pos.y() - self.rect().height() - self.dialog.height()) self.dialog.move(pos) self.dialog.setFromEditor(self.currentText()) def hidePopup(self): """Override to hide the popup entry widget. """ if self.dialog: self.dialog.hide() super().hidePopup() def setLink(self): """Set the current link from the popup dialog. """ self.setEditText(self.dialog.editorText()) def openLink(self): """Open the link in a web browser. """ text = self.currentText() if text: nameMatch = fieldformat.linkSeparateNameRegExp.match(text) if nameMatch: address = nameMatch.group(1).strip() else: address = text.strip() if address: if urltools.isRelative(address): defaultPath = globalref.mainControl.defaultPathObj(True) address = urltools.toAbsolute(address, str(defaultPath)) openExtUrl(address) def openFolder(self): """Open the link in a file manager/explorer. """ text = self.currentText() if text: nameMatch = fieldformat.linkSeparateNameRegExp.match(text) if nameMatch: address = nameMatch.group(1).strip() else: address = text.strip() if address and urltools.extractScheme(address) in ('', 'file'): if urltools.isRelative(address): defaultPath = globalref.mainControl.defaultPathObj(True) address = urltools.toAbsolute(address, str(defaultPath)) address = os.path.dirname(address) openExtUrl(address) def updateActions(self): """Set availability of custom context menu actions. """ address = self.currentText() if address: nameMatch = fieldformat.linkSeparateNameRegExp.match(address) if nameMatch: address = nameMatch.group(1).strip() else: address = address.strip() openAction, folderAction = self.lineEdit().extraMenuActions openAction.setEnabled(len(address) > 0) folderAction.setEnabled(len(address) > 0 and urltools.extractScheme(address) in ('', 'file')) def addDroppedUrl(self, urlText): """Add the URL link that was dropped on this editor from the view. Arguments: urlText -- the text of the link """ self.setEditText(urlText) def dragEnterEvent(self, event): """Accept drags of files to this widget. Arguments: event -- the drag event object """ if event.mimeData().hasUrls(): event.accept() def dropEvent(self, event): """Open a file dropped onto this widget. Arguments: event -- the drop event object """ fileList = event.mimeData().urls() if fileList: self.setEditText(fileList[0].toLocalFile()) _extLinkSchemes = ('http://', 'https://', 'mailto:', 'file://') _extLinkSchemeDict = {proto.split(':', 1)[0]: proto for proto in _extLinkSchemes} class ExtLinkDialog(QDialog): """A popup or normal dialog box for external link editing. """ contentsChanged = pyqtSignal() def __init__(self, popupDialog=False, parent=None): """Initialize the dialog widgets. Arguments: popupDialog -- add OK and cancel buttons if False parent -- the dialog's parent widget """ super().__init__(parent) self.setWindowFlags(Qt.Dialog | Qt.WindowTitleHint | Qt.WindowCloseButtonHint) self.setWindowTitle(_('External Link')) vertLayout = QVBoxLayout(self) vertLayout.setSpacing(1) schemeLabel = QLabel(_('Scheme')) vertLayout.addWidget(schemeLabel) schemeLayout = QHBoxLayout() vertLayout.addLayout(schemeLayout) schemeLayout.setSpacing(8) self.schemeButtons = QButtonGroup(self) self.schemeButtonDict = {} for scheme in _extLinkSchemes: scheme = scheme.split(':', 1)[0] button = QRadioButton(scheme) self.schemeButtons.addButton(button) self.schemeButtonDict[scheme] = button schemeLayout.addWidget(button) self.schemeButtonDict['http'].setChecked(True) self.schemeButtons.buttonClicked.connect(self.updateScheme) vertLayout.addSpacing(8) self.browseButton = QPushButton(_('&Browse for File')) self.browseButton.setAutoDefault(False) self.browseButton.clicked.connect(self.fileBrowse) vertLayout.addWidget(self.browseButton) vertLayout.addSpacing(8) self.pathTypeLabel = QLabel(_('File Path Type')) vertLayout.addWidget(self.pathTypeLabel) pathTypeLayout = QHBoxLayout() vertLayout.addLayout(pathTypeLayout) pathTypeLayout.setSpacing(8) pathTypeButtons = QButtonGroup(self) self.absoluteButton = QRadioButton(_('Absolute')) pathTypeButtons.addButton(self.absoluteButton) pathTypeLayout.addWidget(self.absoluteButton) self.relativeButton = QRadioButton(_('Relative')) pathTypeButtons.addButton(self.relativeButton) pathTypeLayout.addWidget(self.relativeButton) self.absoluteButton.setChecked(True) pathTypeButtons.buttonClicked.connect(self.updatePathType) vertLayout.addSpacing(8) addressLabel = QLabel(_('Address')) vertLayout.addWidget(addressLabel) self.addressEdit = QLineEdit() self.addressEdit.textEdited.connect(self.checkAddress) vertLayout.addWidget(self.addressEdit) vertLayout.addSpacing(8) nameLabel = QLabel(_('Display Name')) vertLayout.addWidget(nameLabel) self.nameEdit = QLineEdit() self.nameEdit.textEdited.connect(self.contentsChanged) vertLayout.addWidget(self.nameEdit) if popupDialog: self.setWindowFlags(Qt.Popup) else: vertLayout.addSpacing(8) ctrlLayout = QHBoxLayout() vertLayout.addLayout(ctrlLayout) ctrlLayout.addStretch(0) okButton = QPushButton(_('&OK')) ctrlLayout.addWidget(okButton) okButton.clicked.connect(self.accept) cancelButton = QPushButton(_('&Cancel')) ctrlLayout.addWidget(cancelButton) cancelButton.clicked.connect(self.reject) self.addressEdit.setFocus() def setFromEditor(self, editorText): """Set the dialog contents from a string in editor format. Arguments: editorText -- string in "link [name]" format """ name = address = '' editorText = editorText.strip() if editorText: nameMatch = fieldformat.linkSeparateNameRegExp.match(editorText) if nameMatch: address, name = nameMatch.groups() address = address.strip() else: address = editorText name = urltools.shortName(address) self.setFromComponents(address, name) def setFromComponents(self, address, name): """Set the dialog contents from separate address and name. Arguments: address -- the link address, including the scheme prefix name -- the displayed name for the link """ scheme = urltools.extractScheme(address) if scheme not in _extLinkSchemeDict: if not scheme: address = urltools.replaceScheme('file', address) scheme = 'file' self.schemeButtonDict[scheme].setChecked(True) if address and urltools.isRelative(address): self.relativeButton.setChecked(True) else: self.absoluteButton.setChecked(True) self.addressEdit.setText(address) self.nameEdit.setText(name) self.updateFileControls() def editorText(self): """Return the dialog contents in data editor format ("link [name]"). """ address = self.currentAddress() if not address: return '' name = self.nameEdit.text().strip() if not name: name = urltools.shortName(address) return '{0} [{1}]'.format(address, name) def htmlText(self): """Return the dialog contents in HTML link format. """ address = self.currentAddress() if not address: return '' name = self.nameEdit.text().strip() if not name: name = urltools.shortName(address) return '<a href="{0}">{1}</a>'.format(address, name) def currentAddress(self): """Return current address with the selected scheme prefix. """ scheme = self.schemeButtons.checkedButton().text() address = self.addressEdit.text().strip() return urltools.replaceScheme(scheme, address) def checkAddress(self): """Update controls based on a change to the address field. Makes minimum changes to scheme and absolute controls, since the address may be incomplete. """ address = self.addressEdit.text().strip() scheme = urltools.extractScheme(address) if scheme in _extLinkSchemeDict: self.schemeButtonDict[scheme].setChecked(True) if scheme != 'file': self.absoluteButton.setChecked(True) self.updateFileControls() self.contentsChanged.emit() def updateScheme(self): """Update scheme in the address due to scheme button change. """ scheme = self.schemeButtons.checkedButton().text() address = self.addressEdit.text().strip() address = urltools.replaceScheme(scheme, address) self.addressEdit.setText(address) if urltools.isRelative(address): self.relativeButton.setChecked(True) else: self.absoluteButton.setChecked(True) self.updateFileControls() self.contentsChanged.emit() def updatePathType(self): """Update file path based on a change in the absolute/relative control. """ absolute = self.absoluteButton.isChecked() defaultPath = globalref.mainControl.defaultPathObj(True) address = self.addressEdit.text().strip() if absolute: address = urltools.toAbsolute(address, str(defaultPath)) else: address = urltools.toRelative(address, str(defaultPath)) self.addressEdit.setText(address) self.contentsChanged.emit() def updateFileControls(self): """Set file browse & type controls available based on current scheme. """ enable = self.schemeButtons.checkedButton().text() == 'file' self.browseButton.setEnabled(enable) self.pathTypeLabel.setEnabled(enable) self.absoluteButton.setEnabled(enable) self.relativeButton.setEnabled(enable) def fileBrowse(self): """Show dialog to browse for a file to be linked. Adjust based on absolute or relative path settings. """ refPath = str(globalref.mainControl.defaultPathObj(True)) defaultPath = refPath oldAddress = self.addressEdit.text().strip() oldScheme = urltools.extractScheme(oldAddress) if oldAddress and not oldScheme or oldScheme == 'file': if urltools.isRelative(oldAddress): oldAddress = urltools.toAbsolute(oldAddress, refPath) oldAddress = urltools.extractAddress(oldAddress) if os.access(oldAddress, os.F_OK): defaultPath = oldAddress address, selFltr = QFileDialog.getOpenFileName(self, _('TreeLine - External Link File'), defaultPath, globalref.fileFilters['all']) if address: if self.relativeButton.isChecked(): address = urltools.toRelative(address, refPath) self.setFromComponents(address, urltools.shortName(address)) self.show() self.contentsChanged.emit() class IntLinkEditor(ComboEditor): """An editor widget for internal link fields. Uses a combo box with a link select dialog in place of the list popup. """ inLinkSelectMode = pyqtSignal(bool) def __init__(self, parent=None): """Initialize the editor class. Arguments: parent -- the parent, if given """ super().__init__(parent) self.address = '' self.intLinkDialog = None self.setLineEdit(PartialLineEditor(self)) openAction = QAction(_('&Go to Target'), self) openAction.triggered.connect(self.openLink) clearAction = QAction(_('Clear &Link'), self) clearAction.triggered.connect(self.clearLink) self.lineEdit().extraMenuActions = [openAction, clearAction] def setContents(self, text): """Set the contents of the editor to text. Arguments: text - the new text contents for the editor """ super().setContents(text) if not text: self.lineEdit().staticLength = 0 self.address = '' return try: self.address, name = self.fieldRef.addressAndName(self.nodeRef. data.get(self.fieldRef.name, '')) except ValueError: self.address = '' self.address = self.address.lstrip('#') nameMatch = fieldformat.linkSeparateNameRegExp.match(text) if nameMatch: link = nameMatch.group(1) self.lineEdit().staticLength = len(link) + 1 else: self.lineEdit().staticLength = 0 def contents(self): """Return the editor contents in "address [name]" format. """ if not self.address: return self.currentText() nameMatch = fieldformat.linkSeparateNameRegExp.match(self. currentText()) if nameMatch: name = nameMatch.group(2) else: name = '' return '{0} [{1}]'.format(self.address, name.strip()) def clearLink(self): """Clear the contents of the editor. """ self.setContents('') self.signalUpdate() def showPopup(self): """Override to show a popup entry widget in place of a list view. """ if not self.intLinkDialog: self.intLinkDialog = IntLinkDialog(True, self) self.intLinkDialog.show() pos = self.mapToGlobal(self.rect().bottomRight()) pos.setX(pos.x() - self.intLinkDialog.width() + 1) screenBottom = (QApplication.desktop().screenGeometry(self). bottom()) if pos.y() + self.intLinkDialog.height() > screenBottom: pos.setY(pos.y() - self.rect().height() - self.intLinkDialog.height()) self.intLinkDialog.move(pos) self.inLinkSelectMode.emit(True) def hidePopup(self): """Override to hide the popup entry widget. """ if self.intLinkDialog: self.intLinkDialog.hide() self.inLinkSelectMode.emit(False) super().hidePopup() def setLinkFromNode(self, node): """Set the current link from a clicked node. Arguments: node -- the node to set the unique ID from """ self.hidePopup() self.address = node.uId linkTitle = node.title() nameMatch = fieldformat.linkSeparateNameRegExp.match(self. currentText()) if nameMatch: name = nameMatch.group(2) else: name = linkTitle self.setEditText('LinkTo: {0} [{1}]'.format(linkTitle, name)) self.lineEdit().staticLength = len(linkTitle) + 9 def openLink(self): """Open the link in a web browser. """ if self.address: editView = self.parent().parent() editView.treeView.selectionModel().selectNodeById(self.address) def setCursorPoint(self, point): """Set the cursor to the given point. Arguments: point -- the QPoint for the new cursor position """ self.lineEdit().setCursorPoint(point) self.lineEdit().fixSelection() class PartialLineEditor(LineEditor): """A line used in internal link combo editors. Only allows the name portion to be selected or editd. """ def __init__(self, parent=None): """Initialize the editor class. Arguments: parent -- the parent, if given """ super().__init__(parent, True) self.staticLength = 0 def fixSelection(self): """Fix the selection and cursor to not include static portion of text. """ cursorPos = self.cursorPosition() if -1 < self.selectionStart() < self.staticLength: endPos = self.selectionStart() + len(self.selectedText()) if endPos > self.staticLength: if cursorPos >= self.staticLength: self.setSelection(self.staticLength, endPos - self.staticLength) else: # reverse select to get cursor at selection start self.setSelection(endPos, self.staticLength - endPos) return self.deselect() if cursorPos < self.staticLength: self.setCursorPosition(self.staticLength) def selectAll(self): """Select all editable text. """ self.setSelection(self.staticLength, len(self.text())) def mouseReleaseEvent(self, event): """Fix selection if required after mouse release. Arguments: event -- the mouse release event """ super().mouseReleaseEvent(event) self.fixSelection() def keyPressEvent(self, event): """Avoid edits or cursor movements to the static portion of the text. Arguments: event -- the mouse release event """ if (event.key() == Qt.Key_Backspace and (self.cursorPosition() <= self.staticLength and not self.hasSelectedText())): return if event.key() in (Qt.Key_Left, Qt.Key_Home): super().keyPressEvent(event) self.fixSelection() return super().keyPressEvent(event) class IntLinkDialog(QDialog): """A popup dialog box for internal link editing. """ contentsChanged = pyqtSignal() def __init__(self, popupDialog=False, parent=None): """Initialize the dialog widgets. Arguments: popupDialog -- add OK and cancel buttons if False parent -- the dialog's parent widget """ super().__init__(parent) self.setWindowFlags(Qt.Dialog | Qt.FramelessWindowHint) layout = QVBoxLayout(self) label = QLabel(_('(Click link target in tree)')) layout.addWidget(label) class EmbedIntLinkDialog(QDialog): """A popup or normal dialog box for internal link editing. """ contentsChanged = pyqtSignal() targetClickDialogRef = None def __init__(self, structRef, parent=None): """Initialize the dialog widgets. Arguments: structRef -- a ref to the tree structure parent -- the dialog's parent widget """ super().__init__(parent) self.structRef = structRef self.address = '' self.setWindowFlags(Qt.Dialog | Qt.WindowTitleHint | Qt.WindowCloseButtonHint) self.setWindowTitle(_('Internal Link')) vertLayout = QVBoxLayout(self) vertLayout.setSpacing(1) self.linkLabel = QLabel() vertLayout.addWidget(self.linkLabel) infoLabel = QLabel(_('(Click link target in tree)')) vertLayout.addWidget(infoLabel) vertLayout.addSpacing(8) nameLabel = QLabel(_('Display Name')) vertLayout.addWidget(nameLabel) self.nameEdit = QLineEdit() self.nameEdit.textEdited.connect(self.contentsChanged) vertLayout.addWidget(self.nameEdit) vertLayout.addSpacing(8) ctrlLayout = QHBoxLayout() vertLayout.addLayout(ctrlLayout) ctrlLayout.addStretch(0) self.okButton = QPushButton(_('&OK')) ctrlLayout.addWidget(self.okButton) self.okButton.setDefault(True) self.okButton.clicked.connect(self.accept) cancelButton = QPushButton(_('&Cancel')) ctrlLayout.addWidget(cancelButton) cancelButton.clicked.connect(self.reject) def updateLinkText(self): """Update the link label using the current address. """ title = '' name = self.nameEdit.text().strip() if self.address: targetNode = self.structRef.nodeDict.get(self.address, None) if targetNode: title = targetNode.title() if not name: self.nameEdit.setText(title) self.linkLabel.setText('LinkTo: {0}'.format(title)) self.okButton.setEnabled(len(self.address) > 0) def setFromNode(self, node): """Set the dialog contents from a clicked node. Arguments: node -- the node to set the unique ID from """ self.address = node.uId self.updateLinkText() def setFromComponents(self, address, name): """Set the dialog contents from separate address and name. Arguments: address -- the link address, including the protocol prefix name -- the displayed name for the link """ self.address = address self.nameEdit.setText(name) self.updateLinkText() def htmlText(self): """Return the dialog contents in HTML link format. """ name = self.nameEdit.text().strip() if not name: name = _('link') return '<a href="#{0}">{1}</a>'.format(self.address, name) class PictureLinkEditor(ComboEditor): """An editor widget for picture link fields. Uses a combo box with a link entry box in place of the list popup. """ dragLinkEnabled = True def __init__(self, parent=None): """Initialize the editor class. Arguments: parent -- the parent, if given """ super().__init__(parent) self.dialog = None openAction = QAction(_('&Open Picture'), self) openAction.triggered.connect(self.openPicture) self.lineEdit().extraMenuActions = [openAction] def showPopup(self): """Override to show a popup entry widget in place of a list view. """ if not self.dialog: self.dialog = PictureLinkDialog(True, self) self.dialog.contentsChanged.connect(self.setLink) self.dialog.show() pos = self.mapToGlobal(self.rect().bottomRight()) pos.setX(pos.x() - self.dialog.width() + 1) screenBottom = (QApplication.desktop().screenGeometry(self). bottom()) if pos.y() + self.dialog.height() > screenBottom: pos.setY(pos.y() - self.rect().height() - self.dialog.height()) self.dialog.move(pos) self.dialog.setAddress(self.currentText()) def hidePopup(self): """Override to hide the popup entry widget. """ if self.dialog: self.dialog.hide() super().hidePopup() def setLink(self): """Set the current link from the popup dialog. """ self.setEditText(self.dialog.currentAddress()) def openPicture(self): """Open the link in a web browser. """ address = self.currentText() if address: if urltools.isRelative(address): defaultPath = globalref.mainControl.defaultPathObj(True) address = urltools.toAbsolute(address, str(defaultPath)) openExtUrl(address) def addDroppedUrl(self, urlText): """Add the URL link that was dropped on this editor from the view. Arguments: urlText -- the text of the link """ self.setEditText(urlText) class PictureLinkDialog(QDialog): """A popup or normal dialog box for picture link editing. """ thumbnailSize = QSize(250, 100) contentsChanged = pyqtSignal() def __init__(self, popupDialog=False, parent=None): """Initialize the dialog widgets. Arguments: popupDialog -- add OK and cancel buttons if False parent -- the dialog's parent widget """ super().__init__(parent) self.setWindowFlags(Qt.Dialog | Qt.WindowTitleHint | Qt.WindowCloseButtonHint) self.setWindowTitle(_('Picture Link')) self.setMinimumWidth(self.thumbnailSize.width()) vertLayout = QVBoxLayout(self) vertLayout.setSpacing(1) self.thumbnail = QLabel() pixmap = QPixmap(self.thumbnailSize) pixmap.fill() self.thumbnail.setPixmap(pixmap) vertLayout.addWidget(self.thumbnail, 0, Qt.AlignHCenter) vertLayout.addSpacing(8) self.browseButton = QPushButton(_('&Browse for File')) self.browseButton.setAutoDefault(False) self.browseButton.clicked.connect(self.fileBrowse) vertLayout.addWidget(self.browseButton) vertLayout.addSpacing(8) self.pathTypeLabel = QLabel(_('File Path Type')) vertLayout.addWidget(self.pathTypeLabel) pathTypeLayout = QHBoxLayout() vertLayout.addLayout(pathTypeLayout) pathTypeLayout.setSpacing(8) pathTypeButtons = QButtonGroup(self) self.absoluteButton = QRadioButton(_('Absolute')) pathTypeButtons.addButton(self.absoluteButton) pathTypeLayout.addWidget(self.absoluteButton) self.relativeButton = QRadioButton(_('Relative')) pathTypeButtons.addButton(self.relativeButton) pathTypeLayout.addWidget(self.relativeButton) self.absoluteButton.setChecked(True) pathTypeButtons.buttonClicked.connect(self.updatePathType) vertLayout.addSpacing(8) addressLabel = QLabel(_('Address')) vertLayout.addWidget(addressLabel) self.addressEdit = QLineEdit() self.addressEdit.textEdited.connect(self.checkAddress) vertLayout.addWidget(self.addressEdit) vertLayout.addSpacing(8) if popupDialog: self.setWindowFlags(Qt.Popup) else: vertLayout.addSpacing(8) ctrlLayout = QHBoxLayout() vertLayout.addLayout(ctrlLayout) ctrlLayout.addStretch(0) okButton = QPushButton(_('&OK')) ctrlLayout.addWidget(okButton) okButton.clicked.connect(self.accept) cancelButton = QPushButton(_('&Cancel')) ctrlLayout.addWidget(cancelButton) cancelButton.clicked.connect(self.reject) self.addressEdit.setFocus() def setAddress(self, address): """Set the dialog contents from a string in editor format. Arguments: address -- URL string for the address """ if address and urltools.isRelative(address): self.relativeButton.setChecked(True) else: self.absoluteButton.setChecked(True) self.addressEdit.setText(address) self.updateThumbnail() def setFromHtml(self, htmlStr): """Set the dialog contents from an HTML link. Arguments: htmlStr -- string in HTML link format """ linkMatch = imageRegExp.search(htmlStr) if linkMatch: address = linkMatch.group(1) self.setAddress(address.strip()) def htmlText(self): """Return the dialog contents in HTML link format. """ address = self.currentAddress() if not address: return '' return '<img src="{0}" />'.format(address) def currentAddress(self): """Return current address with the selected scheme prefix. """ return self.addressEdit.text().strip() def checkAddress(self): """Update absolute controls based on a change to the address field. """ address = self.addressEdit.text().strip() if address: if urltools.isRelative(address): self.relativeButton.setChecked(True) else: self.absoluteButton.setChecked(True) self.updateThumbnail() self.contentsChanged.emit() def updatePathType(self): """Update path based on a change in the absolute/relative control. """ absolute = self.absoluteButton.isChecked() defaultPath = globalref.mainControl.defaultPathObj(True) address = self.addressEdit.text().strip() if absolute: address = urltools.toAbsolute(address, str(defaultPath), False) else: address = urltools.toRelative(address, str(defaultPath)) self.addressEdit.setText(address) self.updateThumbnail() self.contentsChanged.emit() def updateThumbnail(self): """Update the thumbnail with an image from the current address. """ address = self.addressEdit.text().strip() if urltools.isRelative(address): refPath = str(globalref.mainControl.defaultPathObj(True)) address = urltools.toAbsolute(address, refPath, False) pixmap = QPixmap(address) if pixmap.isNull(): pixmap = QPixmap(self.thumbnailSize) pixmap.fill() else: pixmap = pixmap.scaled(self.thumbnailSize, Qt.KeepAspectRatio) self.thumbnail.setPixmap(pixmap) def fileBrowse(self): """Show dialog to browse for a file to be linked. Adjust based on absolute or relative path settings. """ refPath = str(globalref.mainControl.defaultPathObj(True)) defaultPath = refPath oldAddress = self.addressEdit.text().strip() if oldAddress: if urltools.isRelative(oldAddress): oldAddress = urltools.toAbsolute(oldAddress, refPath) oldAddress = urltools.extractAddress(oldAddress) if os.access(oldAddress, os.F_OK): defaultPath = oldAddress address, selFltr = QFileDialog.getOpenFileName(self, _('TreeLine - Picture File'), defaultPath, globalref.fileFilters['all']) if address: if self.relativeButton.isChecked(): address = urltools.toRelative(address, refPath) self.setAddress(address) self.updateThumbnail() self.show() self.contentsChanged.emit() #### Utility Functions #### def openExtUrl(path): """Open a web browser or a application for a directory or file. Arguments: path -- the path to open """ if sys.platform.startswith('win'): os.startfile(path) elif sys.platform.startswith('darwin'): subprocess.call(['open', path]) else: subprocess.call(['xdg-open', path])
[ "doug101@bellz.org" ]
doug101@bellz.org
05f20377365afcf412ba6b25092ca5d4eeca0364
5ddacf6285da77e8b6bc53cde3379471c631e827
/tests/databases/constructed_molecule/fixtures/constructed_molecule_mongo_db.py
c90e86673bda41cefd2525d316916ea0110c877d
[ "MIT" ]
permissive
sailfish009/stk
19db3d50742cd822bf9c06711103bd7e1954a79f
ebf876d5207032b76b9b10f7ca62060cc12c61f0
refs/heads/master
2022-11-09T20:59:03.222560
2020-06-30T12:37:02
2020-06-30T12:37:02
null
0
0
null
null
null
null
UTF-8
Python
false
false
4,133
py
import pytest import stk import rdkit.Chem.AllChem as rdkit from ...utilities import MockMongoClient from ..case_data import CaseData @pytest.fixture( params=( CaseData( database=stk.ConstructedMoleculeMongoDb( mongo_client=MockMongoClient(), lru_cache_size=0, ), molecule=stk.ConstructedMolecule( topology_graph=stk.polymer.Linear( building_blocks=( stk.BuildingBlock( smiles='BrCCBr', functional_groups=[stk.BromoFactory()], ), ), repeating_unit='A', num_repeating_units=2, ), ), key={ 'InChIKey': rdkit.MolToInchiKey(rdkit.MolFromSmiles( SMILES='BrCCCCBr' )), }, ), CaseData( database=stk.ConstructedMoleculeMongoDb( mongo_client=MockMongoClient(), lru_cache_size=128, ), molecule=stk.ConstructedMolecule( topology_graph=stk.polymer.Linear( building_blocks=( stk.BuildingBlock( smiles='BrCCBr', functional_groups=[stk.BromoFactory()], ), ), repeating_unit='A', num_repeating_units=2, ), ), key={ 'InChIKey': rdkit.MolToInchiKey(rdkit.MolFromSmiles( SMILES='BrCCCCBr' )), }, ), CaseData( database=stk.ConstructedMoleculeMongoDb( mongo_client=MockMongoClient(), jsonizer=stk.ConstructedMoleculeJsonizer( key_makers=( stk.MoleculeKeyMaker( key_name='SMILES', get_key=lambda molecule: rdkit.MolToSmiles( mol=molecule.to_rdkit_mol(), ) ), ), ), lru_cache_size=0, ), molecule=stk.ConstructedMolecule( topology_graph=stk.polymer.Linear( building_blocks=( stk.BuildingBlock( smiles='Br[C+2][C+2]Br', functional_groups=[stk.BromoFactory()], ), ), repeating_unit='A', num_repeating_units=2, ), ), key={'SMILES': 'Br[C+2][C+2][C+2][C+2]Br'}, ), CaseData( database=stk.ConstructedMoleculeMongoDb( mongo_client=MockMongoClient(), jsonizer=stk.ConstructedMoleculeJsonizer( key_makers=( stk.MoleculeKeyMaker( key_name='SMILES', get_key=lambda molecule: rdkit.MolToSmiles( mol=molecule.to_rdkit_mol(), ) ), ), ), lru_cache_size=128, ), molecule=stk.ConstructedMolecule( topology_graph=stk.polymer.Linear( building_blocks=( stk.BuildingBlock( smiles='Br[C+2][C+2]Br', functional_groups=[stk.BromoFactory()], ), ), repeating_unit='A', num_repeating_units=2, ), ), key={'SMILES': 'Br[C+2][C+2][C+2][C+2]Br'}, ), ), ) def constructed_molecule_mongo_db(request): return request.param
[ "noreply@github.com" ]
sailfish009.noreply@github.com
fdcb707c05e376905be9ed93946a5d310d84baee
72cdc45a345fe47c525468ff82ef8ce845d9f800
/Python/django_ajax/django_ajax_demo/app/models.py
43550226b816520409ecbb4bfcd875aa2a596345
[]
no_license
bopopescu/Coding-Dojo-assignments
474242e14371e729b5948602ffc0a9328f1e43cb
0598d7162b37d9472c6f1b82acc51d625ac871ca
refs/heads/master
2022-11-23T18:55:36.393073
2018-07-20T07:43:56
2018-07-20T07:43:56
281,670,452
0
0
null
2020-07-22T12:24:30
2020-07-22T12:24:30
null
UTF-8
Python
false
false
623
py
from django.db import models # Create your models here. class UserManger(models.Manager): def create_user(self,post_data): user = self.create( first_name=post_data['first_name'], last_name=post_data['last_name'], email=post_data['email'] ) return user class User(models.Model): first_name = models.CharField(max_length=200) last_name = models.CharField(max_length=200) email = models.CharField(max_length=200) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) obj = UserManger()
[ "gringojaimes20@gmail.com" ]
gringojaimes20@gmail.com
f417264a5d0f326fc886d8946aa423c41d6ca43d
b391498124fdcaef989bf3ebafffb0df43e3e07f
/pygccxml-0.8.2/pygccxml/declarations/__init__.py
d20bc68c942146a98b018dace9d923492136b659
[ "BSL-1.0" ]
permissive
glehmann/WrapITK-unstable
9a0dd9d387ecd59c9439465dcc32cca552e14576
402fc668f1f3c3dd57d0751a61efa3b1625d238b
refs/heads/master
2021-01-10T22:02:04.715926
2008-05-25T16:53:07
2008-05-25T16:53:07
3,272,767
0
0
null
null
null
null
UTF-8
Python
false
false
10,826
py
# Copyright 2004 Roman Yakovenko. # Distributed under the Boost Software License, Version 1.0. (See # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) """ contains classes that describe different C++ declarations """ from declaration import location_t from declaration import declaration_t from scopedef import scopedef_t from enumeration import enumeration_t from namespace import namespace_t from class_declaration import class_t from class_declaration import CLASS_TYPES from class_declaration import ACCESS_TYPES from class_declaration import hierarchy_info_t from class_declaration import class_declaration_t from typedef import typedef_t from cpptypes import type_t from cpptypes import dummy_type_t from cpptypes import unknown_t from cpptypes import fundamental_t from cpptypes import void_t from cpptypes import char_t from cpptypes import unsigned_char_t from cpptypes import wchar_t from cpptypes import short_int_t from cpptypes import short_unsigned_int_t from cpptypes import bool_t from cpptypes import int_t from cpptypes import unsigned_int_t from cpptypes import long_int_t from cpptypes import long_unsigned_int_t from cpptypes import long_long_int_t from cpptypes import long_long_unsigned_int_t from cpptypes import float_t from cpptypes import double_t from cpptypes import long_double_t from cpptypes import FUNDAMENTAL_TYPES from cpptypes import compound_t from cpptypes import volatile_t from cpptypes import const_t from cpptypes import pointer_t from cpptypes import reference_t from cpptypes import array_t from cpptypes import calldef_type_t from cpptypes import free_function_type_t from cpptypes import member_function_type_t from cpptypes import member_variable_type_t from cpptypes import declarated_t from cpptypes import type_qualifiers_t #java types from cpptypes import java_fundamental_t from cpptypes import jbyte_t from cpptypes import jshort_t from cpptypes import jint_t from cpptypes import jlong_t from cpptypes import jfloat_t from cpptypes import jdouble_t from cpptypes import jchar_t from cpptypes import jboolean_t from variable import variable_t from algorithm import full_name from algorithm import make_flatten from algorithm import apply_visitor from algorithm import declaration_path from algorithm import find_declaration from algorithm import match_declaration_t from algorithm import find_all_declarations from algorithm import find_first_declaration from algorithm import declaration_files from algorithm import visit_function_has_not_been_found_t from algorithm import get_global_namespace from calldef import VIRTUALITY_TYPES from calldef import FUNCTION_VIRTUALITY_TYPES from calldef import argument_t from calldef import calldef_t from calldef import member_calldef_t from calldef import free_calldef_t from calldef import operator_t from calldef import member_function_t from calldef import constructor_t from calldef import destructor_t from calldef import member_operator_t from calldef import casting_operator_t from calldef import free_function_t from calldef import free_operator_t from decl_visitor import decl_visitor_t from type_visitor import type_visitor_t from type_traits import decompose_type from type_traits import decompose_class from type_traits import is_enum from type_traits import enum_declaration from type_traits import enum_traits from type_traits import is_class from type_traits import class_traits from type_traits import is_class_declaration from type_traits import class_declaration_traits from type_traits import is_same from type_traits import is_void from type_traits import is_void_pointer from type_traits import is_const from type_traits import base_type from type_traits import is_array from type_traits import is_pointer from type_traits import is_volatile from type_traits import is_integral from type_traits import is_reference from type_traits import is_arithmetic from type_traits import is_fundamental from type_traits import is_floating_point from type_traits import is_base_and_derived from type_traits import is_convertible from type_traits import is_noncopyable from type_traits import is_std_string from type_traits import is_std_wstring from type_traits import is_unary_operator from type_traits import is_binary_operator from type_traits import array_size from type_traits import array_item_type from type_traits import remove_cv from type_traits import remove_const from type_traits import remove_alias from type_traits import remove_pointer from type_traits import remove_volatile from type_traits import remove_reference from type_traits import remove_declarated from type_traits import has_destructor from type_traits import has_public_less from type_traits import has_trivial_copy from type_traits import has_public_equal from type_traits import has_public_assign from type_traits import has_public_destructor from type_traits import has_public_constructor from type_traits import has_trivial_constructor from type_traits import find_trivial_constructor from type_traits import has_public_binary_operator from type_traits import has_any_non_copyconstructor from type_traits import smart_pointer_traits from container_traits import list_traits from container_traits import deque_traits from container_traits import queue_traits from container_traits import priority_queue from container_traits import vector_traits from container_traits import stack_traits from container_traits import map_traits from container_traits import multimap_traits from container_traits import hash_map_traits from container_traits import hash_multimap_traits from container_traits import set_traits from container_traits import hash_set_traits from container_traits import multiset_traits from container_traits import hash_multiset_traits from function_traits import is_same_function all_container_traits = \ [ list_traits , deque_traits , queue_traits , priority_queue , vector_traits , stack_traits , map_traits , multimap_traits , hash_map_traits , hash_multimap_traits , set_traits , hash_set_traits , multiset_traits , hash_multiset_traits ] """list, that contains all STD container traits classes""" import templates import call_invocation from filtering import filtering from decl_factory import decl_factory_t from matchers import matcher_base_t from matchers import or_matcher_t from matchers import and_matcher_t from matchers import not_matcher_t from matchers import declaration_matcher_t from matchers import calldef_matcher_t from matchers import namespace_matcher_t from matchers import variable_matcher_t from matchers import regex_matcher_t from matchers import access_type_matcher_t from matchers import operator_matcher_t from matchers import custom_matcher_t from matchers import virtuality_type_matcher_t #make matchers to look more like functors or_matcher = or_matcher_t """see L{or_matcher} for documentation""" and_matcher = and_matcher_t """see L{and_matcher} for documentation""" not_matcher = not_matcher_t """see L{not_matcher} for documentation""" declaration_matcher = declaration_matcher_t """see L{declaration_matcher} for documentation""" calldef_matcher = calldef_matcher_t """see L{calldef_matcher} for documentation""" namespace_matcher = namespace_matcher_t """see L{namespace_matcher} for documentation""" variable_matcher = variable_matcher_t """see L{variable_matcher} for documentation""" regex_matcher = regex_matcher_t """see L{regex_matcher} for documentation""" access_type_matcher = access_type_matcher_t """see L{access_type_matcher} for documentation""" operator_matcher = operator_matcher_t """see L{operator_matcher} for documentation""" custom_matcher = custom_matcher_t """see L{custom_matcher} for documentation""" virtuality_type_matcher = virtuality_type_matcher_t """see L{virtuality_type_matcher} for documentation""" from matcher import matcher from mdecl_wrapper import mdecl_wrapper_t from decl_printer import decl_printer_t from decl_printer import print_declarations import scopedef scopedef.scopedef_t._impl_all_decl_types = \ [ scopedef.scopedef_t , enumeration_t , namespace_t , class_t , class_declaration_t , typedef_t , variable_t , calldef_t , member_calldef_t , free_calldef_t , operator_t , member_function_t , constructor_t , destructor_t , member_operator_t , casting_operator_t , free_function_t , free_operator_t ] __impl_matchers = scopedef.scopedef_t._impl_matchers __impl_decl_types = scopedef.scopedef_t._impl_decl_types __impl_matchers[ scopedef.scopedef_t.decl ] = declaration_matcher_t __impl_matchers[ scopedef.scopedef_t.class_ ] = declaration_matcher_t __impl_decl_types[ scopedef.scopedef_t.class_ ] = class_t __impl_matchers[ scopedef.scopedef_t.variable ] = variable_matcher_t __impl_matchers[ scopedef.scopedef_t.calldef ] = calldef_matcher_t __impl_decl_types[ scopedef.scopedef_t.calldef ] = calldef_t __impl_matchers[ scopedef.scopedef_t.operator ] = operator_matcher_t __impl_decl_types[ scopedef.scopedef_t.operator ] = operator_t __impl_matchers[ scopedef.scopedef_t.member_function ] = calldef_matcher_t __impl_decl_types[ scopedef.scopedef_t.member_function ] = member_function_t __impl_matchers[ scopedef.scopedef_t.constructor ] = calldef_matcher_t __impl_decl_types[ scopedef.scopedef_t.constructor ] = constructor_t __impl_matchers[ scopedef.scopedef_t.member_operator ] = operator_matcher_t __impl_decl_types[ scopedef.scopedef_t.member_operator ] = member_operator_t __impl_matchers[ scopedef.scopedef_t.member_operator ] = operator_matcher_t __impl_decl_types[ scopedef.scopedef_t.member_operator ] = member_operator_t __impl_matchers[ scopedef.scopedef_t.casting_operator ] = calldef_matcher_t __impl_decl_types[ scopedef.scopedef_t.casting_operator ] = casting_operator_t __impl_matchers[ scopedef.scopedef_t.enumeration ] = declaration_matcher_t __impl_decl_types[ scopedef.scopedef_t.enumeration ] = enumeration_t __impl_matchers[ scopedef.scopedef_t.typedef ] = declaration_matcher_t __impl_decl_types[ scopedef.scopedef_t.typedef ] = typedef_t __impl_matchers[ namespace_t.namespace ] = namespace_matcher_t __impl_matchers[ namespace_t.free_function ] = calldef_matcher_t __impl_decl_types[ namespace_t.free_function ] = free_function_t __impl_matchers[ namespace_t.free_operator ] = operator_matcher_t __impl_decl_types[ namespace_t.free_operator ] = free_operator_t
[ "gaetan.lehmann@jouy.inra.fr" ]
gaetan.lehmann@jouy.inra.fr
cc0373e849553b1f4086a6c71139e59ff3612024
404bc40862b4d1a7a0b3af8f90a0352f5916f389
/marslab/bandset/__init__.py
b16b94948a38ba8a537a7c590afab03c6a35d8cc
[ "BSD-3-Clause" ]
permissive
MillionConcepts/marslab
4039d66f9acabb9257b52a430b9a4e6f929bba5d
8fec9765c5fc2af131535dde5bcebd9feb3eaddb
refs/heads/main
2023-07-05T23:18:04.617856
2023-05-30T20:42:22
2023-05-30T20:42:22
364,688,103
4
2
BSD-3-Clause
2022-06-26T02:54:34
2021-05-05T19:42:26
Python
UTF-8
Python
false
false
41
py
from .bandset import BandSet, ImageBands
[ "mstclair@millionconcepts.com" ]
mstclair@millionconcepts.com
fc82b5c45efce7854e15cb4d046d461ecc5666cf
bb33e6be8316f35decbb2b81badf2b6dcf7df515
/source/res/scripts/client/gui/impl/lobby/bootcamp/__init__.py
38949d143389770292fb8708159801207ba40edc
[]
no_license
StranikS-Scan/WorldOfTanks-Decompiled
999c9567de38c32c760ab72c21c00ea7bc20990c
d2fe9c195825ececc728e87a02983908b7ea9199
refs/heads/1.18
2023-08-25T17:39:27.718097
2022-09-22T06:49:44
2022-09-22T06:49:44
148,696,315
103
39
null
2022-09-14T17:50:03
2018-09-13T20:49:11
Python
UTF-8
Python
false
false
129
py
# Python bytecode 2.7 (decompiled from Python 2.7) # Embedded file name: scripts/client/gui/impl/lobby/bootcamp/__init__.py pass
[ "StranikS_Scan@mail.ru" ]
StranikS_Scan@mail.ru
a58c9664c1090042fa0befbe74e0e75dbfc6648b
211196c7d7f649a5295cbbad97003422a7049fc2
/iterateOverMessages.py
57d3360be2df99aa52c28e161cd320a89e677cbb
[]
no_license
AzisK/Jinbe-Music
38df261bfd334e1213dc6d96d393493a4da9517e
44761ebb8fe196c37fa10e83e2e4c873e70a5def
refs/heads/master
2021-01-20T07:05:29.061897
2017-10-05T06:11:47
2017-10-05T06:11:47
89,957,496
1
0
null
2017-10-05T06:11:48
2017-05-01T19:53:02
Python
UTF-8
Python
false
false
129
py
import mido from mido import MidiFile port = mido.open_output() for msg in MidiFile('1.mid').play(): port.send(msg)
[ "=" ]
=
e2cc4ee0baa6c4627c2423976a2c8e20afbbbdff
de24f83a5e3768a2638ebcf13cbe717e75740168
/moodledata/vpl_data/75/usersdata/161/36800/submittedfiles/maiormenor.py
f9360f4e08c5cf3b0813526c834f4c0b01124a8d
[]
no_license
rafaelperazzo/programacao-web
95643423a35c44613b0f64bed05bd34780fe2436
170dd5440afb9ee68a973f3de13a99aa4c735d79
refs/heads/master
2021-01-12T14:06:25.773146
2017-12-22T16:05:45
2017-12-22T16:05:45
69,566,344
0
0
null
null
null
null
UTF-8
Python
false
false
632
py
# -*- coding: utf-8 -*- import math a = int(input('Digite o número 1: ')) b = int(input('Digite o número 2: ')) c = int(input('Digite o número 3: ')) d = int(input('Digite o número 4: ')) e = int(input('Digite o número 5: ')) i=0 maior=0 menor=0 for i in range(5): if a>maior: a=maior elif b>maior: b=maior elif c>maior: c=maior elif d>maior: d=maior elif e>maoir: e=maior if a<menor: a=menor elif b<menor: b=menor elif c<menor: c=menor elif d<menor: d=menor elif e<menor: e=menor print(maior) print(menor)
[ "rafael.mota@ufca.edu.br" ]
rafael.mota@ufca.edu.br
18bf7102fedf76648c340210ef8685e944c4585d
53fab060fa262e5d5026e0807d93c75fb81e67b9
/backup/user_305/ch81_2019_06_04_13_12_29_235102.py
b71526d31810aaf20ab6e06453268454b3963ec7
[]
no_license
gabriellaec/desoft-analise-exercicios
b77c6999424c5ce7e44086a12589a0ad43d6adca
01940ab0897aa6005764fc220b900e4d6161d36b
refs/heads/main
2023-01-31T17:19:42.050628
2020-12-16T05:21:31
2020-12-16T05:21:31
306,735,108
0
0
null
null
null
null
UTF-8
Python
false
false
177
py
def interseccao_valores(dic1, dic2): lista = [] for v in dic1.values(): v.append(lista) for j in dic2.values(): j.append(lista) return lista
[ "you@example.com" ]
you@example.com
73363dfdd60b34c13e77255bab8d474bf348fb2e
ca7aa979e7059467e158830b76673f5b77a0f5a3
/Python_codes/p03387/s123688720.py
032de65d86c10d90a82ee7446afbbcc91437a494
[]
no_license
Aasthaengg/IBMdataset
7abb6cbcc4fb03ef5ca68ac64ba460c4a64f8901
f33f1c5c3b16d0ea8d1f5a7d479ad288bb3f48d8
refs/heads/main
2023-04-22T10:22:44.763102
2021-05-13T17:27:22
2021-05-13T17:27:22
367,112,348
0
0
null
null
null
null
UTF-8
Python
false
false
432
py
import sys a=list(map(int,input().split())) a.sort() ans=0 while True: if a[0]==a[1]==a[2]: print(ans) sys.exit() if a[0]<a[1]: a[0]+=2 ans+=1 a.sort() if a[0]==a[1]==a[2]: print(ans) sys.exit() if a[0]==a[1]: a[0]+=1 a[1]+=1 ans+=1 a.sort() if a[0]==a[1]==a[2]: print(ans) sys.exit()
[ "66529651+Aastha2104@users.noreply.github.com" ]
66529651+Aastha2104@users.noreply.github.com
6d166148963bb2dfef60da93fe81d806e80ba065
91d1a6968b90d9d461e9a2ece12b465486e3ccc2
/iot_write_f/audit-mitigation-actions-task_start.py
ccd58e9e6ce9fcde6370e203d0655d253cc36d40
[]
no_license
lxtxl/aws_cli
c31fc994c9a4296d6bac851e680d5adbf7e93481
aaf35df1b7509abf5601d3f09ff1fece482facda
refs/heads/master
2023-02-06T09:00:33.088379
2020-12-27T13:38:45
2020-12-27T13:38:45
318,686,394
0
0
null
null
null
null
UTF-8
Python
false
false
866
py
#!/usr/bin/python # -*- codding: utf-8 -*- import os import sys sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) from common.execute_command import write_parameter # url : https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-instances.html if __name__ == '__main__': """ cancel-audit-mitigation-actions-task : https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/cancel-audit-mitigation-actions-task.html describe-audit-mitigation-actions-task : https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/describe-audit-mitigation-actions-task.html list-audit-mitigation-actions-tasks : https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iot/list-audit-mitigation-actions-tasks.html """ write_parameter("iot", "start-audit-mitigation-actions-task")
[ "hcseo77@gmail.com" ]
hcseo77@gmail.com
1aeb26bdbe0be227bf7a86266767f07914dd78c8
f07a42f652f46106dee4749277d41c302e2b7406
/Data Set/bug-fixing-2/d1186c9d2fdc62fe1491d0820af12106d16a1fb6-<customize>-fix.py
4b77f7b3e1050c9ad0d1aaf9347f097791c87248
[]
no_license
wsgan001/PyFPattern
e0fe06341cc5d51b3ad0fe29b84098d140ed54d1
cc347e32745f99c0cd95e79a18ddacc4574d7faa
refs/heads/main
2023-08-25T23:48:26.112133
2021-10-23T14:11:22
2021-10-23T14:11:22
null
0
0
null
null
null
null
UTF-8
Python
false
false
3,333
py
def customize(self, dist=None): 'Customize Fortran compiler.\n\n This method gets Fortran compiler specific information from\n (i) class definition, (ii) environment, (iii) distutils config\n files, and (iv) command line (later overrides earlier).\n\n This method should be always called after constructing a\n compiler instance. But not in __init__ because Distribution\n instance is needed for (iii) and (iv).\n ' log.info(('customize %s' % self.__class__.__name__)) self._is_customised = True self.distutils_vars.use_distribution(dist) self.command_vars.use_distribution(dist) self.flag_vars.use_distribution(dist) self.update_executables() self.find_executables() noopt = self.distutils_vars.get('noopt', False) noarch = self.distutils_vars.get('noarch', noopt) debug = self.distutils_vars.get('debug', False) f77 = self.command_vars.compiler_f77 f90 = self.command_vars.compiler_f90 f77flags = [] f90flags = [] freeflags = [] fixflags = [] if f77: f77 = shlex.split(f77, posix=(os.name == 'posix')) f77flags = self.flag_vars.f77 if f90: f90 = shlex.split(f90, posix=(os.name == 'posix')) f90flags = self.flag_vars.f90 freeflags = self.flag_vars.free fix = self.command_vars.compiler_fix if fix: fix = shlex.split(fix, posix=(os.name == 'posix')) fixflags = (self.flag_vars.fix + f90flags) (oflags, aflags, dflags) = ([], [], []) def get_flags(tag, flags): flags.extend(getattr(self.flag_vars, tag)) this_get = getattr(self, ('get_flags_' + tag)) for (name, c, flagvar) in [('f77', f77, f77flags), ('f90', f90, f90flags), ('f90', fix, fixflags)]: t = ('%s_%s' % (tag, name)) if (c and (this_get is not getattr(self, ('get_flags_' + t)))): flagvar.extend(getattr(self.flag_vars, t)) if (not noopt): get_flags('opt', oflags) if (not noarch): get_flags('arch', aflags) if debug: get_flags('debug', dflags) fflags = (((self.flag_vars.flags + dflags) + oflags) + aflags) if f77: self.set_commands(compiler_f77=((f77 + f77flags) + fflags)) if f90: self.set_commands(compiler_f90=(((f90 + freeflags) + f90flags) + fflags)) if fix: self.set_commands(compiler_fix=((fix + fixflags) + fflags)) linker_so = self.linker_so if linker_so: linker_so_flags = self.flag_vars.linker_so if sys.platform.startswith('aix'): python_lib = get_python_lib(standard_lib=1) ld_so_aix = os.path.join(python_lib, 'config', 'ld_so_aix') python_exp = os.path.join(python_lib, 'config', 'python.exp') linker_so = (([ld_so_aix] + linker_so) + [('-bI:' + python_exp)]) self.set_commands(linker_so=(linker_so + linker_so_flags)) linker_exe = self.linker_exe if linker_exe: linker_exe_flags = self.flag_vars.linker_exe self.set_commands(linker_exe=(linker_exe + linker_exe_flags)) ar = self.command_vars.archiver if ar: arflags = self.flag_vars.ar self.set_commands(archiver=([ar] + arflags)) self.set_library_dirs(self.get_library_dirs()) self.set_libraries(self.get_libraries())
[ "dg1732004@smail.nju.edu.cn" ]
dg1732004@smail.nju.edu.cn
549d47061f0ed2277297102fa4fd01ff4432bf94
9b20743ec6cd28d749a4323dcbadb1a0cffb281b
/07_Machine_Learning_Mastery_with_Python/07/pca.py
2437e80daf68829e9200d38c5a0b646093a6a47b
[]
no_license
jggrimesdc-zz/MachineLearningExercises
6e1c7e1f95399e69bba95cdfe17c4f8d8c90d178
ee265f1c6029c91daff172b3e7c1a96177646bc5
refs/heads/master
2023-03-07T19:30:26.691659
2021-02-19T08:00:49
2021-02-19T08:00:49
null
0
0
null
null
null
null
UTF-8
Python
false
false
511
py
# Feature Extraction with PCA from pandas import read_csv from sklearn.decomposition import PCA # load data filename = 'pima-indians-diabetes.data.csv' names = ['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class'] dataframe = read_csv(filename, names=names) array = dataframe.values X = array[:, 0:8] Y = array[:, 8] # feature extraction pca = PCA(n_components=3) fit = pca.fit(X) # summarize components print("Explained Variance: %s" % fit.explained_variance_ratio_) print(fit.components_)
[ "jgrimes@jgrimes.tech" ]
jgrimes@jgrimes.tech
213431d95c159d4c1d5374f463d5a0b86a85ee8f
64bf39b96a014b5d3f69b3311430185c64a7ff0e
/intro-ansible/venv3/lib/python3.8/site-packages/ansible_test/_internal/sanity/yamllint.py
85a576d02d248df24fa0e8e1fcba6176467cd312
[ "MIT" ]
permissive
SimonFangCisco/dne-dna-code
7072eba7da0389e37507b7a2aa5f7d0c0735a220
2ea7d4f00212f502bc684ac257371ada73da1ca9
refs/heads/master
2023-03-10T23:10:31.392558
2021-02-25T15:04:36
2021-02-25T15:04:36
342,274,373
0
0
MIT
2021-02-25T14:39:22
2021-02-25T14:39:22
null
UTF-8
Python
false
false
3,780
py
"""Sanity test using yamllint.""" from __future__ import (absolute_import, division, print_function) __metaclass__ = type import json import os from .. import types as t from ..import ansible_util from ..sanity import ( SanitySingleVersion, SanityMessage, SanityFailure, SanitySkipped, SanitySuccess, SANITY_ROOT, ) from ..target import ( TestTarget, ) from ..util import ( SubprocessError, display, is_subdir, find_python, ) from ..util_common import ( run_command, ) from ..config import ( SanityConfig, ) from ..data import ( data_context, ) class YamllintTest(SanitySingleVersion): """Sanity test using yamllint.""" @property def error_code(self): # type: () -> t.Optional[str] """Error code for ansible-test matching the format used by the underlying test program, or None if the program does not use error codes.""" return 'ansible-test' def filter_targets(self, targets): # type: (t.List[TestTarget]) -> t.List[TestTarget] """Return the given list of test targets, filtered to include only those relevant for the test.""" yaml_targets = [target for target in targets if os.path.splitext(target.path)[1] in ('.yml', '.yaml')] for plugin_type, plugin_path in sorted(data_context().content.plugin_paths.items()): if plugin_type == 'module_utils': continue yaml_targets.extend([target for target in targets if os.path.splitext(target.path)[1] == '.py' and os.path.basename(target.path) != '__init__.py' and is_subdir(target.path, plugin_path)]) return yaml_targets def test(self, args, targets, python_version): """ :type args: SanityConfig :type targets: SanityTargets :type python_version: str :rtype: TestResult """ pyyaml_presence = ansible_util.check_pyyaml(args, python_version, quiet=True) if not pyyaml_presence['cloader']: display.warning("Skipping sanity test '%s' due to missing libyaml support in PyYAML." % self.name) return SanitySkipped(self.name) settings = self.load_processor(args) paths = [target.path for target in targets.include] python = find_python(python_version) results = self.test_paths(args, paths, python) results = settings.process_errors(results, paths) if results: return SanityFailure(self.name, messages=results) return SanitySuccess(self.name) @staticmethod def test_paths(args, paths, python): """ :type args: SanityConfig :type paths: list[str] :type python: str :rtype: list[SanityMessage] """ cmd = [ python, os.path.join(SANITY_ROOT, 'yamllint', 'yamllinter.py'), ] data = '\n'.join(paths) display.info(data, verbosity=4) try: stdout, stderr = run_command(args, cmd, data=data, capture=True) status = 0 except SubprocessError as ex: stdout = ex.stdout stderr = ex.stderr status = ex.status if stderr: raise SubprocessError(cmd=cmd, status=status, stderr=stderr, stdout=stdout) if args.explain: return [] results = json.loads(stdout)['messages'] results = [SanityMessage( code=r['code'], message=r['message'], path=r['path'], line=int(r['line']), column=int(r['column']), level=r['level'], ) for r in results] return results
[ "sifang@cisco.com" ]
sifang@cisco.com
5166ace3467b2a5e6d75c7af8ef4b3a1febc640f
53fab060fa262e5d5026e0807d93c75fb81e67b9
/backup/user_172/ch31_2020_03_25_10_56_13_081031.py
a097597aaf1f8510a42ff7f07a2c25674a655745
[]
no_license
gabriellaec/desoft-analise-exercicios
b77c6999424c5ce7e44086a12589a0ad43d6adca
01940ab0897aa6005764fc220b900e4d6161d36b
refs/heads/main
2023-01-31T17:19:42.050628
2020-12-16T05:21:31
2020-12-16T05:21:31
306,735,108
0
0
null
null
null
null
UTF-8
Python
false
false
203
py
y=3 def eh_primo (x): if x%2==0: return False while y<x: if x%y==0: y=y+2 return False else: return True
[ "you@example.com" ]
you@example.com
de1db29362fe6f49c59b95f74cea99eb115bf71a
e37ee26bd37e86277aa98db7a9938e7d043c1146
/setup.py
386175f2b9107f26e003609e3390ad4e1d9fa916
[ "BSD-2-Clause" ]
permissive
sjkingo/ticketus
f20e1e65a6e57706becb50371905c6d1f385bf71
90f2781af9418e9e2c6470ca50c9a6af9ce098ff
refs/heads/master
2021-05-16T02:58:02.070421
2018-03-05T00:36:24
2018-03-05T00:36:24
28,283,750
3
3
BSD-2-Clause
2018-03-05T00:34:57
2014-12-21T00:38:26
Python
UTF-8
Python
false
false
1,574
py
from setuptools import find_packages, setup from ticketus import __version__ as version setup( name='ticketus', version=version, license='BSD', author='Sam Kingston', author_email='sam@sjkwi.com.au', description='Ticketus is a simple, no-frills ticketing system for helpdesks.', url='https://github.com/sjkingo/ticketus', install_requires=[ 'Django >= 1.6.10', 'IMAPClient', 'django-grappelli', 'email-reply-parser', 'mistune', 'psycopg2', 'python-dateutil', ], zip_safe=False, include_package_data=True, packages=find_packages(exclude=['ticketus_settings']), classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Web Environment', 'Intended Audience :: Developers', 'Intended Audience :: End Users/Desktop', 'Intended Audience :: Information Technology', 'Intended Audience :: System Administrators', 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python', 'Topic :: Communications :: Email', 'Topic :: Software Development :: Bug Tracking', 'Topic :: System :: Systems Administration', ], scripts=[ 'import_scripts/ticketus_import_freshdesk', 'import_scripts/ticketus_import_github', 'bin_scripts/ticketus_mailgw_imap4', 'bin_scripts/ticketus-admin', ], )
[ "sam@sjkwi.com.au" ]
sam@sjkwi.com.au
bff50f96ee9ee9794dd94abc1b4c5dfc27f57ea1
747755833862b8e9d0f58ebc62879d6ef47c23c8
/python-master (5)/python-master/socket/udp/server.py
7d67bbdee63a778498fcb2254818529dc569f7bc
[]
no_license
tangsong41/stu_py
98a06730dbca6e158cf81c18d98fe1317c1ae512
d41507cd8dd9e8a54084872dfa15c36da443c02b
refs/heads/master
2022-12-11T23:53:57.530946
2019-01-15T18:29:19
2019-01-15T18:29:19
163,953,100
3
0
null
2022-12-07T23:24:01
2019-01-03T09:41:29
Jupyter Notebook
UTF-8
Python
false
false
351
py
# encoding: utf-8 __author__ = 'zhanghe' import socket port = 8081 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # 从指定的端口,从任何发送者,接收UDP数据 s.bind(('', port)) print('正在等待接入...') while True: # 接收一个数据 data, address = s.recvfrom(1024) print('Received:', data, 'from', address)
[ "369223985@qq.com" ]
369223985@qq.com
78c888a824bc7bea569faee6edd8aee03f11b48b
2fb0af0a30e3133ef4c5e649acd3f9911430062c
/src/toontown/shtiker/ShardPage.py
ee82d3f7f423effb7009bcefc5e96fd482075233
[]
no_license
Teku16/Toontown-Crystal-Master
4c01c0515f34a0e133441d2d1e9f9156ac267696
77a9345d52caa350ee0b1c7ad2b7461a3d6ed830
refs/heads/master
2020-05-20T06:02:58.106504
2015-07-25T07:23:59
2015-07-25T07:23:59
41,053,558
0
1
null
2015-08-19T18:51:11
2015-08-19T18:51:11
null
UTF-8
Python
false
false
28,317
py
from direct.directnotify import DirectNotifyGlobal from direct.gui.DirectGui import * from direct.task.Task import Task from pandac.PandaModules import * from toontown.distributed import ToontownDistrictStats from toontown.hood import ZoneUtil from toontown.shtiker import ShtikerPage from toontown.coghq import CogDisguiseGlobals from toontown.suit import SuitDNA from toontown.suit import Suit from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals from toontown.toontowngui import TTDialog ICON_COLORS = (Vec4(0.863, 0.776, 0.769, 1.0), Vec4(0.749, 0.776, 0.824, 1.0), Vec4(0.749, 0.769, 0.749, 1.0), Vec4(0.843, 0.745, 0.745, 1.0)) POP_COLORS = (Vec4(0.4, 0.4, 1.0, 1.0), Vec4(0.4, 1.0, 0.4, 1.0), Vec4(1.0, 0.4, 0.4, 1.0)) def compareShardTuples(a, b): if a[1] < b[1]: return -1 elif b[1] < a[1]: return 1 else: return 0 def setupInvasionMarkerAny(node): pass def setupInvasionMarker(node, invasionStatus): if node.find('**/*invasion-marker'): return markerNode = node.attachNewNode('invasion-marker') if invasionStatus == 5: setupInvasionMarkerAny(markerNode) return icons = loader.loadModel('phase_3/models/gui/cog_icons') if invasionStatus == 1: icon = icons.find('**/CorpIcon').copyTo(markerNode) elif invasionStatus == 2: icon = icons.find('**/LegalIcon').copyTo(markerNode) elif invasionStatus == 3: icon = icons.find('**/MoneyIcon').copyTo(markerNode) else: icon = icons.find('**/SalesIcon').copyTo(markerNode) icons.removeNode() icon.setColor(ICON_COLORS[invasionStatus - 1]) icon.setPos(0.50, 0, 0.0125) icon.setScale(0.0535) def removeInvasionMarker(node): markerNode = node.find('**/*invasion-marker') if not markerNode.isEmpty(): markerNode.removeNode() class ShardPage(ShtikerPage.ShtikerPage): notify = DirectNotifyGlobal.directNotify.newCategory('ShardPage') def __init__(self): ShtikerPage.ShtikerPage.__init__(self) self.shardButtonMap = {} self.shardButtons = [] self.scrollList = None self.currentBTP = None self.currentBTL = None self.currentBTR = None self.currentBTI = None self.currentO = None self.textRolloverColor = Vec4(1, 1, 0, 1) self.textDownColor = Vec4(0.5, 0.9, 1, 1) self.textDisabledColor = Vec4(0.4, 0.8, 0.4, 1) self.ShardInfoUpdateInterval = 5.0 self.lowPop = config.GetInt('shard-low-pop', 150) self.midPop = config.GetInt('shard-mid-pop', 300) self.highPop = -1 self.showPop = config.GetBool('show-population', 0) self.showTotalPop = config.GetBool('show-total-population', 0) self.noTeleport = config.GetBool('shard-page-disable', 0) self.shardGroups = None self.currentGroupJoined = None def load(self): main_text_scale = 0.06 title_text_scale = 0.12 self.title = DirectLabel(parent=self, relief=None, text=TTLocalizer.ShardPageTitle, text_scale=title_text_scale, textMayChange=0, pos=(0, 0, 0.6)) helpText_ycoord = 0.403 self.helpText = DirectLabel(parent=self, relief=None, text='', text_scale=main_text_scale, text_wordwrap=12, text_align=TextNode.ALeft, textMayChange=1, pos=(0.058, 0, helpText_ycoord)) shardPop_ycoord = helpText_ycoord - 0.523 totalPop_ycoord = shardPop_ycoord - 0.44 self.districtInfo = NodePath('Selected-Shard-Info') self.districtInfo.reparentTo(self) self.totalPopulationText = DirectLabel(parent=self.districtInfo, relief=None, text=TTLocalizer.ShardPagePopulationTotal % 1, text_scale=main_text_scale, text_wordwrap=8, textMayChange=1, text_align=TextNode.ACenter, pos=(0.4247, 0, totalPop_ycoord)) if self.showTotalPop: self.totalPopulationText.show() else: self.totalPopulationText.hide() self.gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui') self.listXorigin = -0.02 self.listFrameSizeX = 0.67 self.listZorigin = -0.96 self.listFrameSizeZ = 1.04 self.arrowButtonScale = 1.3 self.itemFrameXorigin = -0.247 self.itemFrameZorigin = 0.365 self.buttonXstart = self.itemFrameXorigin + 0.293 self.regenerateScrollList() scrollTitle = DirectFrame(parent=self.scrollList, text=TTLocalizer.ShardPageScrollTitle, text_scale=main_text_scale, text_align=TextNode.ACenter, relief=None, pos=(self.buttonXstart, 0, self.itemFrameZorigin + 0.127)) def firstLoadShard(self, buttonTuple): curShardTuples = base.cr.listActiveShards() curShardTuples.sort(compareShardTuples) actualShardId = base.localAvatar.defaultShard for i in xrange(len(curShardTuples)): shardId, name, pop, WVPop, invasionStatus = curShardTuples[i] if shardId == actualShardId: self.currentBTP = buttonTuple[0] self.currentBTL = buttonTuple[1] self.currentBTR = buttonTuple[2] self.currentBTI = buttonTuple[3] self.currentO = [pop, name, shardId] self.currentBTL['state'] = DGG.DISABLED self.currentBTR['state'] = DGG.DISABLED self.reloadRightBrain(pop, name, shardId, buttonTuple) def unload(self): self.gui.removeNode() del self.title self.scrollList.destroy() del self.scrollList del self.shardButtons taskMgr.remove('ShardPageUpdateTask-doLater') ShtikerPage.ShtikerPage.unload(self) def regenerateScrollList(self): selectedIndex = 0 if self.scrollList: selectedIndex = self.scrollList.getSelectedIndex() for button in self.shardButtons: button.detachNode() self.scrollList.destroy() self.scrollList = None self.scrollList = DirectScrolledList(parent=self, relief=None, pos=(-0.51, 0, 0), incButton_image=(self.gui.find('**/FndsLst_ScrollUp'), self.gui.find('**/FndsLst_ScrollDN'), self.gui.find('**/FndsLst_ScrollUp_Rllvr'), self.gui.find('**/FndsLst_ScrollUp')), incButton_relief=None, incButton_scale=(self.arrowButtonScale, self.arrowButtonScale, -self.arrowButtonScale), incButton_pos=(self.buttonXstart + 0.005, 0, self.itemFrameZorigin - 1.000), incButton_image3_color=Vec4(1, 1, 1, 0.2), decButton_image=(self.gui.find('**/FndsLst_ScrollUp'), self.gui.find('**/FndsLst_ScrollDN'), self.gui.find('**/FndsLst_ScrollUp_Rllvr'), self.gui.find('**/FndsLst_ScrollUp')), decButton_relief=None, decButton_scale=(self.arrowButtonScale, self.arrowButtonScale, self.arrowButtonScale), decButton_pos=(self.buttonXstart, 0.0025, self.itemFrameZorigin + 0.130), decButton_image3_color=Vec4(1, 1, 1, 0.2), itemFrame_pos=(self.itemFrameXorigin, 0, self.itemFrameZorigin), itemFrame_scale=1.0, itemFrame_relief=DGG.SUNKEN, itemFrame_frameSize=(self.listXorigin, self.listXorigin + self.listFrameSizeX, self.listZorigin, self.listZorigin + self.listFrameSizeZ), itemFrame_frameColor=(0.85, 0.95, 1, 1), itemFrame_borderWidth=(0.01, 0.01), numItemsVisible=15, forceHeight=0.065, items=self.shardButtons) self.scrollList.scrollTo(selectedIndex) def askForShardInfoUpdate(self, task = None): ToontownDistrictStats.refresh('shardInfoUpdated') taskMgr.doMethodLater(self.ShardInfoUpdateInterval, self.askForShardInfoUpdate, 'ShardPageUpdateTask-doLater') return Task.done def makeShardButton(self, shardId, shardName, shardPop): shardButtonParent = DirectFrame() shardButtonL = DirectButton(parent=shardButtonParent, relief=None, text=shardName, text_scale=0.06, text_align=TextNode.ALeft, text_fg=Vec4(0, 0, 0, 1), text3_fg=self.textDisabledColor, text1_bg=self.textDownColor, text2_bg=self.textRolloverColor, textMayChange=0, command=self.reloadRightBrain) popText = str(shardPop) if popText is None: popText = '' model = loader.loadModel('phase_3.5/models/gui/matching_game_gui') button = model.find('**/minnieCircle') shardButtonR = DirectButton(parent=shardButtonParent, relief=None, image=button, image_scale=(0.3, 1, 0.3), image2_scale=(0.35, 1, 0.35), image_color=self.getPopColor(shardPop), pos=(0.58, 0, 0.0125), text=popText, text_scale=0.06, text_align=TextNode.ARight, text_pos=(-0.14, -0.0165), text_fg=Vec4(0, 0, 0, 1), text3_fg=self.textDisabledColor, text1_bg=self.textRolloverColor, text2_bg=self.textRolloverColor, textMayChange=1, command=self.reloadRightBrain) model.removeNode() button.removeNode() invasionMarker = NodePath('InvasionMarker-%s' % shardId) invasionMarker.reparentTo(shardButtonParent) buttonTuple = (shardButtonParent, shardButtonR, shardButtonL, invasionMarker) shardButtonL['extraArgs'] = extraArgs=[shardPop, shardName, shardId, buttonTuple] shardButtonR['extraArgs'] = extraArgs=[shardPop, shardName, shardId, buttonTuple] return buttonTuple def makeGroupButton(self, groupId, groupType): groupPop = len(base.cr.groupManager.getGroupPlayers(groupId)) groupButtonParent = DirectFrame() groupButtonL = DirectButton(parent=groupButtonParent, relief=None, text=groupType, text_pos=(0.0, -0.0225), text_scale=0.06, text_align=TextNode.ALeft, text_fg=Vec4(0, 0, 0, 1), text3_fg=self.textDisabledColor, text1_bg=self.textDownColor, text2_bg=self.textRolloverColor, textMayChange=0, command=self.joinGroup) popText = str(groupPop) if popText is None: return model = loader.loadModel('phase_3.5/models/gui/matching_game_gui') button = model.find('**/minnieCircle') groupButtonR = DirectButton(parent=groupButtonParent, relief=None, image=button, image_scale=(0.3, 1, 0.3), image2_scale=(0.35, 1, 0.35), image_color=Vec4(0, 0.8, 0, 1), pos=(0.58, 0, -0.0125), text=popText, text_scale=0.055, text_align=TextNode.ACenter, text_pos=(-0.00575, -0.0125), text_fg=Vec4(0, 0, 0, 1), text3_fg=Vec4(0, 0, 0, 1), text1_bg=self.textRolloverColor, text2_bg=self.textRolloverColor, textMayChange=1) leaveButton = DirectButton(parent=groupButtonParent, relief=None, image=button, image_scale=(0.3, 1, 0.3), image2_scale=(0.35, 1, 0.35), image_color=Vec4(0, 0.8, 0, 1), pos=(0.50, 0, -0.0125), text='Leave', text_scale=0.055, text_align=TextNode.ACenter, text_pos=(-0.00575, -0.0125), text_fg=Vec4(0, 0, 0, 0), text2_fg=Vec4(0, 0, 0, 1), command=self.leaveGroup) leaveButton.hide() model.removeNode() button.removeNode() buttonTuple = (groupButtonParent, groupButtonR, groupButtonL, leaveButton) groupButtonL['extraArgs'] = [groupId, buttonTuple] leaveButton['extraArgs'] = [groupId, buttonTuple] return buttonTuple def removeRightBrain(self): self.districtInfo.find('**/*district-info').removeNode() def reloadRightBrain(self, shardPop, shardName, shardId, buttonTuple): self.currentRightBrain = (shardPop, shardName, shardId, buttonTuple) if self.districtInfo.find('**/*district-info'): self.removeRightBrain() if self.currentBTL: self.currentBTL['state'] = DGG.NORMAL if self.currentBTR: self.currentBTR['state'] = DGG.NORMAL popText = self.getPopText(shardPop) districtInfoNode = self.districtInfo.attachNewNode('district-info') self.districtStatusLabel = DirectLabel(parent=districtInfoNode, relief=None, pos=(0.4247, 0, 0.45), text=popText, text_scale=0.09, text_fg=Vec4(0, 0, 0, 1), textMayChange=1) pText = '%s Population: %s' % (shardName, str(shardPop)) self.populationStatusLabel = DirectLabel(parent=districtInfoNode, relief=None, pos=(0.4247, 0, 0.38), text=pText, text_scale=0.04, text_fg=Vec4(0, 0, 0, 1), textMayChange=1) tText = 'Teleport to\n%s' % shardName tImage = loader.loadModel('phase_4/models/gui/purchase_gui') tImage.setSz(1.35) self.shardTeleportButton = DirectButton(parent=districtInfoNode, relief=None, pos=(0.4247, 0, 0.25), image=(tImage.find('**/PurchScrn_BTN_UP'), tImage.find('**/PurchScrn_BTN_DN'), tImage.find('**/PurchScrn_BTN_RLVR')), text=tText, text_scale=0.065, text_pos=(0.0, 0.015), text_fg=Vec4(0, 0, 0, 1), textMayChange=1, command=self.choseShard, extraArgs=[shardId]) self.currentBTP = buttonTuple[0] self.currentBTL = buttonTuple[1] self.currentBTR = buttonTuple[2] self.currentBTI = buttonTuple[3] self.currentO = [shardPop, shardName, shardId] self.currentBTL['state'] = DGG.DISABLED self.currentBTR['state'] = DGG.DISABLED if shardId == self.getCurrentShardId(): self.shardTeleportButton['state'] = DGG.DISABLED if self.shardGroups is not None: for button in self.shardGroups: button.detachNode() self.shardGroups = [] for gid, gtype in base.cr.groupManager.id2type.items(): btuple = self.makeGroupButton(gid, gtype) if base.cr.groupManager.isInGroup(base.localAvatar.doId, gid): btuple[1]['state'] = DGG.DISABLED btuple[2]['state'] = DGG.DISABLED btuple[3].show() self.shardGroups.append(btuple[0]) self.districtGroups = DirectScrolledList(parent=districtInfoNode, relief=None, pos=(0.38, 0, -0.34), incButton_image=(self.gui.find('**/FndsLst_ScrollUp'), self.gui.find('**/FndsLst_ScrollDN'), self.gui.find('**/FndsLst_ScrollUp_Rllvr'), self.gui.find('**/FndsLst_ScrollUp')), incButton_relief=None, incButton_scale=(self.arrowButtonScale, self.arrowButtonScale, -self.arrowButtonScale), incButton_pos=(self.buttonXstart + 0.005, 0, -0.125), incButton_image3_color=Vec4(1, 1, 1, 0.2), decButton_image=(self.gui.find('**/FndsLst_ScrollUp'), self.gui.find('**/FndsLst_ScrollDN'), self.gui.find('**/FndsLst_ScrollUp_Rllvr'), self.gui.find('**/FndsLst_ScrollUp')), decButton_relief=None, decButton_scale=(self.arrowButtonScale, self.arrowButtonScale, self.arrowButtonScale), decButton_pos=(self.buttonXstart, 0.0025, 0.445), decButton_image3_color=Vec4(1, 1, 1, 0.2), itemFrame_pos=(self.itemFrameXorigin, 0, self.itemFrameZorigin), itemFrame_scale=1.0, itemFrame_relief=DGG.SUNKEN, itemFrame_frameSize=(self.listXorigin, (self.listXorigin + self.listFrameSizeX), self.listZorigin/2.1, (self.listZorigin + self.listFrameSizeZ)/2.1), itemFrame_frameColor=(0.85, 0.95, 1, 1), itemFrame_borderWidth=(0.01, 0.01), numItemsVisible=15, forceHeight=0.065, items=self.shardGroups) def joinGroup(self, groupId, buttonTuple): self.acceptOnce('confJoin', self.confirmJoinGroup, extraArgs=[groupId, buttonTuple]) self.joinDialog = TTDialog.TTGlobalDialog(message='Would you like to join this group?', doneEvent='confJoin', style=4) def rejectGroup(self, reason, suitType=0): self.acceptOnce('remRjD', self.doneReject) if reason == 1: self.rejectDialog = TTDialog.TTGlobalDialog(message='You need more suit parts!', doneEvent='remRjD', style=1) elif reason == 2: if suitType == 0: meritType = 'Stock Options' elif suitType == 1: meritType = 'Merits' elif suitType == 2: meritType = 'Cogbucks' elif suitType == 3: meritType = 'Notices' self.rejectDialog = TTDialog.TTGlobalDialog(message='You need more %s!'%meritType, doneEvent='remRjD', style=1) elif reason == 3: self.rejectDialog = TTDialog.TTGlobalDialog(message='That group is full!', doneEvent='remRjD', style=1) elif reason == 4: self.rejectDialog = TTDialog.TTGlobalDialog(message='You\'re already in a group!', doneEvent='remRjD', style=1) elif reason == 5: self.rejectDialog = TTDialog.TTGlobalDialog(message='You can\'t leave the district while you\'re in a group!', doneEvent='remRjD', style=1) def doneReject(self): self.rejectDialog.cleanup() del self.rejectDialog def confirmJoinGroup(self, groupId, buttonTuple): doneStatus = self.joinDialog.doneStatus self.joinDialog.cleanup() del self.joinDialog if doneStatus is not 'ok': return for gid in base.cr.groupManager.id2type.keys(): if base.cr.groupManager.isInGroup(base.localAvatar.doId, gid): self.rejectGroup(4) return #if len(base.cr.groupManager.getGroupPlayers(groupId)) >= 8: # self.rejectGroup(3) # return suitIdx = -1 gids = {10000:0, 11000:1, 12000:2, 13000:3} suitIdx = gids.get(groupId) if suitIdx is not None: merits = base.localAvatar.cogMerits[suitIdx] if CogDisguiseGlobals.getTotalMerits(base.localAvatar, suitIdx) > merits: self.rejectGroup(2, suitIdx) return parts = base.localAvatar.getCogParts() if not CogDisguiseGlobals.isSuitComplete(parts, suitIdx): self.rejectGroup(1) return base.cr.groupManager.d_addPlayerToGroup(groupId, base.localAvatar.doId) self.currentGroupJoined = groupId try: place = base.cr.playGame.getPlace() except: try: place = base.cr.playGame.hood.loader.place except: place = base.cr.playGame.hood.place place.requestTeleport(groupId, groupId, base.localAvatar.defaultShard, -1) def leaveGroup(self, groupId, buttonTuple): self.acceptOnce('confLeave', self.confirmLeaveGroup, extraArgs=[groupId, buttonTuple]) self.joinDialog = TTDialog.TTGlobalDialog(message='Are you sure you want to leave this group?', doneEvent='confLeave', style=4) def confirmLeaveGroup(self, groupId, buttonTuple): doneStatus = self.joinDialog.doneStatus self.joinDialog.cleanup() del self.joinDialog if doneStatus is not 'ok': return if not base.cr.groupManager.isInGroup(base.localAvatar.doId, groupId): return base.cr.groupManager.d_removePlayerFromGroup(groupId, base.localAvatar.doId) self.currentGroupJoined = None try: place = base.cr.playGame.getPlace() except: try: place = base.cr.playGame.hood.loader.place except: place = base.cr.playGame.hood.place hoodId = -1 gids = {10000:1000, 11000:5000, 12000:9000, 13000:3000} hoodId = gids.get(groupId) if hoodId is None: return place.requestTeleport(hoodId, hoodId, base.localAvatar.defaultShard, -1) def getPopColor(self, pop): if pop <= self.lowPop: newColor = POP_COLORS[0] elif pop <= self.midPop: newColor = POP_COLORS[1] else: newColor = POP_COLORS[2] return newColor def getPopText(self, pop): if pop <= self.lowPop: popText = TTLocalizer.ShardPageLow elif pop <= self.midPop: popText = TTLocalizer.ShardPageMed else: popText = TTLocalizer.ShardPageHigh return popText def getPopChoiceHandler(self, pop): if pop <= self.midPop: if self.noTeleport and not self.showPop: handler = self.shardChoiceReject else: handler = self.choseShard elif self.showPop: handler = self.choseShard else: if localAvatar.adminAccess >= 200: handler = self.choseShard else: handler = self.shardChoiceReject return handler def getCurrentZoneId(self): try: zoneId = base.cr.playGame.getPlace().getZoneId() except: zoneId = None return zoneId def getCurrentShardId(self): zoneId = self.getCurrentZoneId() if zoneId != None and ZoneUtil.isWelcomeValley(zoneId): return ToontownGlobals.WelcomeValleyToken else: return base.localAvatar.defaultShard def createSuitHead(self, suitName): suitDNA = SuitDNA.SuitDNA() suitDNA.newSuit(suitName) suit = Suit.Suit() suit.setDNA(suitDNA) headParts = suit.getHeadParts() head = hidden.attachNewNode('head') for part in headParts: copyPart = part.copyTo(head) copyPart.setDepthTest(1) copyPart.setDepthWrite(1) self.fitGeometry(head, fFlip=1) suit.delete() suit = None return head def updateScrollList(self): curShardTuples = base.cr.listActiveShards() curShardTuples.sort(compareShardTuples) currentShardId = self.getCurrentShardId() actualShardId = base.localAvatar.defaultShard actualShardName = None anyChanges = 0 totalPop = 0 totalWVPop = 0 currentMap = {} self.shardButtons = [] for i in xrange(len(curShardTuples)): shardId, name, pop, WVPop, invasionStatus = curShardTuples[i] if shardId == actualShardId: actualShardName = name totalPop += pop totalWVPop += WVPop currentMap[shardId] = 1 buttonTuple = self.shardButtonMap.get(shardId) if buttonTuple == None: buttonTuple = self.makeShardButton(shardId, name, pop) self.shardButtonMap[shardId] = buttonTuple anyChanges = 1 else: buttonTuple[1]['image_color'] = self.getPopColor(pop) buttonTuple[1]['text'] = str(pop) buttonTuple[1]['command'] = self.reloadRightBrain buttonTuple[1]['extraArgs'] = [pop, name, shardId, buttonTuple] buttonTuple[2]['command'] = self.reloadRightBrain buttonTuple[2]['extraArgs'] = [pop, name, shardId, buttonTuple] self.shardButtons.append(buttonTuple[0]) if invasionStatus: setupInvasionMarker(buttonTuple[3], invasionStatus) else: removeInvasionMarker(buttonTuple[3]) for shardId, buttonTuple in self.shardButtonMap.items(): if shardId not in currentMap: buttonTuple[3].removeNode() buttonTuple[0].destroy() del self.shardButtonMap[shardId] anyChanges = 1 if anyChanges: self.regenerateScrollList() self.totalPopulationText['text'] = TTLocalizer.ShardPagePopulationTotal % totalPop helpText = TTLocalizer.ShardPageHelpIntro if actualShardName: helpText += TTLocalizer.ShardPageHelpWhere % actualShardName if not self.book.safeMode: helpText += TTLocalizer.ShardPageHelpMove def enter(self): self.askForShardInfoUpdate() self.updateScrollList() currentShardId = self.getCurrentShardId() buttonTuple = self.shardButtonMap.get(currentShardId) if buttonTuple: i = self.shardButtons.index(buttonTuple[0]) self.scrollList.scrollTo(i, centered=1) self.firstLoadShard(buttonTuple) ShtikerPage.ShtikerPage.enter(self) self.accept('shardInfoUpdated', self.updateScrollList) def exit(self): for shardId, buttonTuple in self.shardButtonMap.items(): buttonTuple[1]['state'] = DGG.NORMAL buttonTuple[2]['state'] = DGG.NORMAL self.ignore('shardInfoUpdated') self.ignore('ShardPageConfirmDone') taskMgr.remove('ShardPageUpdateTask-doLater') ShtikerPage.ShtikerPage.exit(self) def shardChoiceReject(self, shardId): self.confirm = TTDialog.TTGlobalDialog(doneEvent='ShardPageConfirmDone', message=TTLocalizer.ShardPageChoiceReject, style=TTDialog.Acknowledge) self.confirm.show() self.accept('ShardPageConfirmDone', self.__handleConfirm) def __handleConfirm(self): self.ignore('ShardPageConfirmDone') self.confirm.cleanup() del self.confirm def choseShard(self, shardId): zoneId = self.getCurrentZoneId() canonicalHoodId = ZoneUtil.getCanonicalHoodId(base.localAvatar.lastHood) currentShardId = self.getCurrentShardId() if self.currentGroupJoined: self.rejectGroup(5) return if shardId == currentShardId: return elif shardId == base.localAvatar.defaultShard: self.doneStatus = {'mode': 'teleport', 'hood': canonicalHoodId} messenger.send(self.doneEvent) else: try: place = base.cr.playGame.getPlace() except: try: place = base.cr.playGame.hood.loader.place except: place = base.cr.playGame.hood.place place.requestTeleport(canonicalHoodId, canonicalHoodId, shardId, -1)
[ "vincentandrea15k@gmail.com" ]
vincentandrea15k@gmail.com
8f8eeb6fa9b019c75aec80c7fb15484d636c4535
179577ecdd7fda84ad970b3aad573a575fef56bc
/aulas/aula12.py
b78a3b884765a9cbb0cfe7ed5083bea5c718d61a
[]
no_license
Elvis-Lopes/Curso-em-video-Python
6c12fa17a5c38c722a7c8e9677f6d9596bc5653c
65f093975af9bd59c8aaa37606ba648b7ba1e1c4
refs/heads/master
2021-02-11T12:15:13.580496
2020-05-05T21:55:06
2020-05-05T21:55:06
244,490,886
1
0
null
null
null
null
UTF-8
Python
false
false
336
py
# exemplos de estrutura condicional aninhada nome = str(input('Qual é o seu nome: ')).strip().title() if nome == 'Elvis': print('Que nome bonito!') elif nome == 'Pedro' or nome == 'João' or nome =='Maria': print('Seu nome é bem popular no Brasil') else: print('Seu nome é bem normal.') print(f'Tenha um bom dia {nome}')
[ "elvislopes1996@hotmail.com" ]
elvislopes1996@hotmail.com
5bce78a403cb350f6070e28a089543acef7afb25
e5b8a5d93989dd53933c5cd417afa8b2a39ad307
/test/test_coupon_discount_items.py
45325446f7a44b5aa07fade379304c1d7922820d
[ "Apache-2.0" ]
permissive
gstingy/uc_python_api
f3586bfce9c962af2e8c1bc266ff25e0f1971278
9a0bd3f6e63f616586681518e44fe37c6bae2bba
refs/heads/master
2020-03-28T11:13:22.537641
2018-09-10T17:07:59
2018-09-10T17:07:59
148,190,066
0
0
null
null
null
null
UTF-8
Python
false
false
920
py
# coding: utf-8 """ UltraCart Rest API V2 UltraCart REST API Version 2 OpenAPI spec version: 2.0.0 Contact: support@ultracart.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import os import sys import unittest import ultracart from ultracart.rest import ApiException from ultracart.models.coupon_discount_items import CouponDiscountItems class TestCouponDiscountItems(unittest.TestCase): """ CouponDiscountItems unit test stubs """ def setUp(self): pass def tearDown(self): pass def testCouponDiscountItems(self): """ Test CouponDiscountItems """ # FIXME: construct object with mandatory attributes with example values #model = ultracart.models.coupon_discount_items.CouponDiscountItems() pass if __name__ == '__main__': unittest.main()
[ "perry@ultracart.com" ]
perry@ultracart.com
39edbec0f0e7116e1ede19dfa091fc16e782d559
b3e9a8963b9aca334b93b95bc340c379544e1046
/euler/14.py
086c339acb194f1b66a930b0f64d444e2daadef9
[]
no_license
protocol7/euler.py
86ea512c2c216968e6c260b19469c0c8d038feb7
e2a8e46a9b07e6d0b039a5496059f3bf73aa5441
refs/heads/master
2022-09-08T22:49:47.486631
2022-08-23T20:07:00
2022-08-23T20:07:00
169,478,759
0
0
null
null
null
null
UTF-8
Python
false
false
272
py
#!/usr/bin/env python3 def collatz(n): c = 1 while n != 1: if n % 2 == 0: n //= 2 else: n = 3 * n + 1 c += 1 return c assert 10 == collatz(13) assert 837799 == max([n for n in range(1, 1000000)], key=collatz)
[ "niklas@protocol7.com" ]
niklas@protocol7.com
139adedab62d240002e76a8278f5c9899697af38
d32bc79eb8631d6bc4ab20498631ba516db4d5f7
/152_maxProductArray.py
38fc25720cfdfefd0d9b48f8df23ab13c1c386d1
[]
no_license
Anirban2404/LeetCodePractice
059f382d17f71726ad2d734b9579f5bab2bba93c
786075e0f9f61cf062703bc0b41cc3191d77f033
refs/heads/master
2021-10-08T04:41:36.163328
2021-09-28T02:16:47
2021-09-28T02:16:47
164,513,056
1
0
null
null
null
null
UTF-8
Python
false
false
1,056
py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jan 7 22:41:52 2019 @author: anirban-mac """ """ Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product. Example 1: Input: [2,3,-2,4] Output: 6 Explanation: [2,3] has the largest product 6. Example 2: Input: [-2,0,-1] Output: 0 Explanation: The result cannot be 2, because [-2,-1] is not a subarray. """ class Solution: def maxProduct(self, nums): """ :type nums: List[int] :rtype: int """ if len(nums) == 0: return 0 localmin = localmax = maxproduct = nums[0] for x in nums[1:]: if x < 0: localmin, localmax = localmax, localmin localmax = max(x, localmax * x) localmin = min(x, localmin * x) maxproduct = max(maxproduct, localmax) print(localmax, localmin, maxproduct) return maxproduct nums = [2,3,-2,-6] print(Solution().maxProduct(nums))
[ "anirban-mac@Anirbans-MacBook-Pro.local" ]
anirban-mac@Anirbans-MacBook-Pro.local
4e238c78b6a39de8f4b38c09be8989c9b69bfe93
210ecd63113ce90c5f09bc2b09db3e80ff98117a
/AbletonLive9_RemoteScripts/Launch_Control_XL/ButtonElement.py
fe0744f2950ba1281db7c0754c69506a53640e9b
[]
no_license
ajasver/MidiScripts
86a765b8568657633305541c46ccc1fd1ea34501
f727a2e63c95a9c5e980a0738deb0049363ba536
refs/heads/master
2021-01-13T02:03:55.078132
2015-07-16T18:27:30
2015-07-16T18:27:30
38,516,112
4
1
null
null
null
null
UTF-8
Python
false
false
906
py
#Embedded file name: /Users/versonator/Jenkins/live/Binary/Core_Release_64_static/midi-remote-scripts/Launch_Control_XL/ButtonElement.py from _Framework.ButtonElement import ON_VALUE, OFF_VALUE, ButtonElement as ButtonElementBase class ButtonElement(ButtonElementBase): _on_value = None _off_value = None def reset(self): self._on_value = None self._off_value = None super(ButtonElement, self).reset() def set_on_off_values(self, on_value, off_value): self._on_value = on_value self._off_value = off_value def send_value(self, value, **k): if value is ON_VALUE and self._on_value is not None: self._skin[self._on_value].draw(self) elif value is OFF_VALUE and self._off_value is not None: self._skin[self._off_value].draw(self) else: super(ButtonElement, self).send_value(value, **k)
[ "admin@scoopler.com" ]
admin@scoopler.com
625a6b86a578dfc51f571f9570a5a87a0b9066de
3636c679001c9d9f75d54a0361052b243a97d2e4
/build/fbcode_builder_config.py
d1183c045603b57d389956411bbd7a03ba3f54d3
[ "MIT" ]
permissive
anvarov/mvfst
ebd8e259d5628ca9bc690bfea6f30b709b10e51d
b5713b9a2b4b98aa7fc0b0bcb110d70e2ea38254
refs/heads/master
2022-06-18T09:32:25.817789
2020-05-13T11:46:23
2020-05-13T11:46:23
263,613,627
1
0
MIT
2020-05-13T11:45:22
2020-05-13T11:45:21
null
UTF-8
Python
false
false
1,331
py
#!/usr/bin/env python # 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 __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals 'fbcode_builder steps to build & test mvfst' import specs.gmock as gmock import specs.fmt as fmt import specs.folly as folly import specs.fizz as fizz from shell_quoting import ShellQuoted def fbcode_builder_spec(builder): builder.add_option( 'mvfst/_build:cmake_defines', { 'BUILD_SHARED_LIBS': 'OFF', 'BUILD_TESTS': 'ON', } ) return { 'depends_on': [gmock, fmt, folly, fizz], 'steps': [ builder.fb_github_cmake_install('mvfst/_build', '..', 'facebookincubator'), builder.step( 'Run mvfst tests', [ builder.run( ShellQuoted('ctest --output-on-failure -j {n}') .format(n=builder.option('make_parallelism'), ) ) ] ), ] } config = { 'github_project': 'facebookincubator/mvfst', 'fbcode_builder_spec': fbcode_builder_spec, }
[ "facebook-github-bot@users.noreply.github.com" ]
facebook-github-bot@users.noreply.github.com
f2baf766729bd90e3d4c0be599f20e9a67aa3bd6
09e5cfe06e437989a2ccf2aeecb9c73eb998a36c
/modules/cctbx_project/mmtbx/secondary_structure/tst.py
531f585ee75ae352fe8b500ac95c17edbb39a128
[ "BSD-3-Clause", "BSD-3-Clause-LBNL" ]
permissive
jorgediazjr/dials-dev20191018
b81b19653624cee39207b7cefb8dfcb2e99b79eb
77d66c719b5746f37af51ad593e2941ed6fbba17
refs/heads/master
2020-08-21T02:48:54.719532
2020-01-25T01:41:37
2020-01-25T01:41:37
216,089,955
0
1
BSD-3-Clause
2020-01-25T01:41:39
2019-10-18T19:03:17
Python
UTF-8
Python
false
false
78,976
py
from __future__ import absolute_import, division, print_function from mmtbx.secondary_structure import sec_str_master_phil_str, manager from cctbx import geometry_restraints from iotbx import file_reader import iotbx.pdb.hierarchy import libtbx.load_env import iotbx.pdb.secondary_structure as ioss from libtbx.utils import null_out import os def exercise_protein(): pdb_file = libtbx.env.find_in_repositories( relative_path="phenix_regression/pdb/1ywf.pdb", test=os.path.isfile) pdb_file_h = libtbx.env.find_in_repositories( relative_path="phenix_regression/pdb/1ywf_h.pdb", test=os.path.isfile) if pdb_file is None : print("Skipping exercise(): input file not available.") return False if pdb_file_h is None : print("Skipping exercise(): input file not available.") return False run_ksdssp = True if (not libtbx.env.has_module(name="ksdssp")): print("Skipping KSDSSP tests: ksdssp module not available.") run_ksdssp = False log = null_out() import sys log = sys.stdout expected_distances = [2.9, 1.975] for k, file_name in enumerate([pdb_file, pdb_file_h]): pdb_in = file_reader.any_file(file_name, force_type="pdb").file_object pdb_hierarchy = pdb_in.hierarchy sec_str_from_pdb_file = pdb_in.input.extract_secondary_structure() m = manager(pdb_hierarchy=pdb_hierarchy, sec_str_from_pdb_file=sec_str_from_pdb_file) m.params.secondary_structure.protein.remove_outliers = False proxies, hb_angles = m.create_protein_hbond_proxies( annotation=None, log=log) print(proxies.size(), hb_angles.size()) assert proxies.size() == 109 assert hb_angles.size() == 294+27, hb_angles.size() # helix+sheet angles assert isinstance(proxies, geometry_restraints.shared_bond_simple_proxy) (frac_alpha, frac_beta) = m.calculate_structure_content() assert ("%.3f" % frac_alpha == "0.643") assert ("%.3f" % frac_beta == "0.075") # Make sure the hydrogen auto-detection override is working # Functionality is disabled # m.params.secondary_structure.protein.substitute_n_for_h = True # build_proxies = m.create_hbond_proxies( # log=log, # as_python_objects=True, # as_regular_bond_proxies=False) # proxies = build_proxies.proxies # atom_ids = [] # for i_seq in proxies[0].i_seqs : # atom_ids.append(pdb_hierarchy.atoms()[i_seq].id_str()) # print atom_ids # assert (atom_ids == ['pdb=" N ARG A 41 "', 'pdb=" O ASP A 37 "']) # assert (proxies[0].distance_ideal == 2.9) if (run_ksdssp): m = manager(pdb_hierarchy=pdb_hierarchy, sec_str_from_pdb_file=None) m.params.secondary_structure.protein.remove_outliers = False proxies, angle_p = m.create_protein_hbond_proxies( annotation=None, log=log) assert proxies.size() == 90 assert angle_p.size() == 243+18, angle_p.size() def exercise_sheet_ends(): pdb_in = iotbx.pdb.input(source_info=None, lines="""\ SHEET 1 A 3 ALA A 38 ALA A 44 0 SHEET 2 A 3 ALA A 76 ALA A 83 -1 N ALA A 83 O ALA A 38 SHEET 3 A 3 ALA A 95 ALA A 97 -1 N ALA A 97 O ALA A 76 ATOM 1 N ALA A 37 27.792 -1.121 13.875 1.00 20.00 N ATOM 2 CA ALA A 37 28.151 0.253 14.202 1.00 20.00 C ATOM 3 C ALA A 37 26.961 1.003 14.792 1.00 20.00 C ATOM 4 O ALA A 37 27.129 2.000 15.494 1.00 20.00 O ATOM 5 CB ALA A 37 28.674 0.973 12.969 1.00 20.00 C ATOM 6 N ALA A 38 25.758 0.515 14.502 1.00 20.00 N ATOM 7 CA ALA A 38 24.529 1.125 14.995 1.00 20.00 C ATOM 8 C ALA A 38 23.363 0.264 14.524 1.00 20.00 C ATOM 9 O ALA A 38 23.538 -0.687 13.756 1.00 20.00 O ATOM 10 N ALA A 39 22.168 0.611 14.996 1.00 20.00 N ATOM 11 CA ALA A 39 20.950 -0.103 14.648 1.00 20.00 C ATOM 12 C ALA A 39 19.925 0.874 14.089 1.00 20.00 C ATOM 13 O ALA A 39 19.845 2.028 14.517 1.00 20.00 O ATOM 14 CB ALA A 39 20.363 -0.841 15.859 1.00 20.00 C ATOM 15 N ALA A 40 19.142 0.396 13.127 1.00 20.00 N ATOM 16 CA ALA A 40 18.108 1.191 12.480 1.00 20.00 C ATOM 17 C ALA A 40 16.741 0.588 12.768 1.00 20.00 C ATOM 18 O ALA A 40 16.573 -0.635 12.745 1.00 20.00 O ATOM 19 CB ALA A 40 18.337 1.274 10.967 1.00 20.00 C ATOM 20 N ALA A 41 15.767 1.453 13.040 1.00 20.00 N ATOM 21 CA ALA A 41 14.401 1.043 13.338 1.00 20.00 C ATOM 22 C ALA A 41 13.470 1.644 12.296 1.00 20.00 C ATOM 23 O ALA A 41 13.452 2.865 12.106 1.00 20.00 O ATOM 24 CB ALA A 41 13.989 1.477 14.746 1.00 20.00 C ATOM 25 N ALA A 42 12.701 0.790 11.627 1.00 20.00 N ATOM 26 CA ALA A 42 11.760 1.215 10.599 1.00 20.00 C ATOM 27 C ALA A 42 10.357 1.223 11.194 1.00 20.00 C ATOM 28 O ALA A 42 9.857 0.180 11.630 1.00 20.00 O ATOM 29 N ALA A 43 9.727 2.394 11.209 1.00 20.00 N ATOM 30 CA ALA A 43 8.385 2.564 11.743 1.00 20.00 C ATOM 31 C ALA A 43 7.444 3.011 10.634 1.00 20.00 C ATOM 32 O ALA A 43 7.806 3.844 9.796 1.00 20.00 O ATOM 33 CB ALA A 43 8.367 3.583 12.887 1.00 20.00 C ATOM 34 N ALA A 44 6.235 2.453 10.633 1.00 20.00 N ATOM 35 CA ALA A 44 5.236 2.788 9.630 1.00 20.00 C ATOM 36 C ALA A 44 3.852 2.693 10.255 1.00 20.00 C ATOM 37 O ALA A 44 3.636 1.941 11.209 1.00 20.00 O ATOM 38 CB ALA A 44 5.332 1.870 8.406 1.00 20.00 C ATOM 39 N ALA A 45 2.919 3.463 9.705 1.00 20.00 N ATOM 40 CA ALA A 45 1.548 3.476 10.200 1.00 20.00 C ATOM 41 C ALA A 45 0.715 2.390 9.527 1.00 20.00 C ATOM 42 O ALA A 45 1.135 1.800 8.531 1.00 20.00 O ATOM 43 CB ALA A 45 0.917 4.842 9.979 1.00 20.00 C ATOM 44 N ALA A 74 -2.563 6.328 17.723 1.00 20.00 N ATOM 45 CA ALA A 74 -2.435 5.677 16.425 1.00 20.00 C ATOM 46 C ALA A 74 -1.470 4.499 16.498 1.00 20.00 C ATOM 47 O ALA A 74 -0.401 4.596 17.100 1.00 20.00 O ATOM 48 CB ALA A 74 -1.975 6.676 15.374 1.00 20.00 C ATOM 49 N ALA A 75 -1.856 3.385 15.882 1.00 20.00 N ATOM 50 CA ALA A 75 -1.023 2.191 15.881 1.00 20.00 C ATOM 51 C ALA A 75 0.069 2.303 14.825 1.00 20.00 C ATOM 52 O ALA A 75 -0.171 2.768 13.707 1.00 20.00 O ATOM 53 CB ALA A 75 -1.873 0.946 15.627 1.00 20.00 C ATOM 54 N ALA A 76 1.275 1.871 15.189 1.00 20.00 N ATOM 55 CA ALA A 76 2.411 1.917 14.283 1.00 20.00 C ATOM 56 C ALA A 76 3.331 0.742 14.576 1.00 20.00 C ATOM 57 O ALA A 76 3.469 0.314 15.726 1.00 20.00 O ATOM 58 CB ALA A 76 3.180 3.238 14.405 1.00 20.00 C ATOM 59 N ALA A 77 3.957 0.225 13.525 1.00 20.00 N ATOM 60 CA ALA A 77 4.871 -0.901 13.624 1.00 20.00 C ATOM 61 C ALA A 77 6.309 -0.431 13.446 1.00 20.00 C ATOM 62 O ALA A 77 6.578 0.615 12.849 1.00 20.00 O ATOM 63 CB ALA A 77 4.537 -1.975 12.583 1.00 20.00 C ATOM 64 N ALA A 78 7.237 -1.225 13.977 1.00 20.00 N ATOM 65 CA ALA A 78 8.654 -0.911 13.889 1.00 20.00 C ATOM 66 C ALA A 78 9.447 -2.207 13.806 1.00 20.00 C ATOM 67 O ALA A 78 8.994 -3.266 14.248 1.00 20.00 O ATOM 68 CB ALA A 78 9.122 -0.070 15.082 1.00 20.00 C ATOM 69 N ALA A 79 10.643 -2.108 13.230 1.00 20.00 N ATOM 70 CA ALA A 79 11.528 -3.254 13.071 1.00 20.00 C ATOM 71 C ALA A 79 12.965 -2.807 13.282 1.00 20.00 C ATOM 72 O ALA A 79 13.402 -1.815 12.692 1.00 20.00 O ATOM 73 CB ALA A 79 11.368 -3.894 11.687 1.00 20.00 C ATOM 74 N ALA A 80 13.693 -3.538 14.121 1.00 20.00 N ATOM 75 CA ALA A 80 15.083 -3.235 14.423 1.00 20.00 C ATOM 76 C ALA A 80 16.005 -4.091 13.566 1.00 20.00 C ATOM 77 O ALA A 80 15.755 -5.284 13.366 1.00 20.00 O ATOM 78 CB ALA A 80 15.383 -3.466 15.905 1.00 20.00 C ATOM 79 N ALA A 81 17.071 -3.475 13.060 1.00 20.00 N ATOM 80 CA ALA A 81 18.037 -4.171 12.222 1.00 20.00 C ATOM 81 C ALA A 81 19.414 -3.568 12.449 1.00 20.00 C ATOM 82 O ALA A 81 19.590 -2.353 12.320 1.00 20.00 O ATOM 83 CB ALA A 81 17.653 -4.084 10.741 1.00 20.00 C ATOM 84 N ALA A 82 20.381 -4.417 12.785 1.00 20.00 N ATOM 85 CA ALA A 82 21.741 -3.960 13.029 1.00 20.00 C ATOM 86 C ALA A 82 22.475 -3.742 11.713 1.00 20.00 C ATOM 87 O ALA A 82 22.392 -4.561 10.793 1.00 20.00 O ATOM 88 CB ALA A 82 22.499 -4.970 13.891 1.00 20.00 C ATOM 89 N ALA A 83 23.197 -2.628 11.628 1.00 20.00 N ATOM 90 CA ALA A 83 23.957 -2.270 10.443 1.00 20.00 C ATOM 91 C ALA A 83 25.415 -2.029 10.812 1.00 20.00 C ATOM 92 O ALA A 83 25.748 -1.734 11.963 1.00 20.00 O ATOM 93 CB ALA A 83 23.375 -1.024 9.761 1.00 20.00 C ATOM 94 N ALA A 84 26.284 -2.160 9.815 1.00 20.00 N ATOM 95 CA ALA A 84 27.714 -1.960 10.014 1.00 20.00 C ATOM 96 C ALA A 84 28.356 -1.340 8.778 1.00 20.00 C ATOM 97 O ALA A 84 27.800 -1.400 7.681 1.00 20.00 O ATOM 98 CB ALA A 84 28.391 -3.277 10.360 1.00 20.00 C ATOM 99 N ALA A 94 8.798 -7.831 13.977 1.00 20.00 N ATOM 100 CA ALA A 94 8.087 -6.560 13.921 1.00 20.00 C ATOM 101 C ALA A 94 7.265 -6.339 15.186 1.00 20.00 C ATOM 102 O ALA A 94 6.554 -7.235 15.641 1.00 20.00 O ATOM 103 CB ALA A 94 7.193 -6.507 12.691 1.00 20.00 C ATOM 104 N ALA A 95 7.368 -5.139 15.750 1.00 20.00 N ATOM 105 CA ALA A 95 6.649 -4.772 16.959 1.00 20.00 C ATOM 106 C ALA A 95 5.563 -3.754 16.637 1.00 20.00 C ATOM 107 O ALA A 95 5.679 -2.974 15.687 1.00 20.00 O ATOM 108 CB ALA A 95 7.601 -4.200 18.015 1.00 20.00 C ATOM 109 N ALA A 96 4.502 -3.771 17.439 1.00 20.00 N ATOM 110 CA ALA A 96 3.371 -2.869 17.277 1.00 20.00 C ATOM 111 C ALA A 96 3.194 -2.052 18.548 1.00 20.00 C ATOM 112 O ALA A 96 3.221 -2.603 19.654 1.00 20.00 O ATOM 113 CB ALA A 96 2.088 -3.642 16.958 1.00 20.00 C ATOM 114 N ALA A 97 3.014 -0.743 18.388 1.00 20.00 N ATOM 115 CA ALA A 97 2.831 0.162 19.512 1.00 20.00 C ATOM 116 C ALA A 97 1.807 1.223 19.144 1.00 20.00 C ATOM 117 O ALA A 97 1.829 1.760 18.033 1.00 20.00 O ATOM 118 CB ALA A 97 4.153 0.825 19.921 1.00 20.00 C ATOM 119 N ALA A 98 0.913 1.521 20.082 1.00 20.00 N ATOM 120 CA ALA A 98 -0.125 2.521 19.861 1.00 20.00 C ATOM 121 C ALA A 98 0.164 3.791 20.655 1.00 20.00 C ATOM 122 O ALA A 98 0.052 3.806 21.881 1.00 20.00 O ATOM 123 CB ALA A 98 -1.489 1.961 20.232 1.00 20.00 C TER END """) pdb_hierarchy = pdb_in.construct_hierarchy() pdb_hierarchy.atoms().reset_i_seq() ss_from_file = pdb_in.extract_secondary_structure() if not libtbx.env.has_module(name="ksdssp"): print("Skipping KSDSSP tests: ksdssp module not available.") return m = manager(pdb_hierarchy=pdb_hierarchy, sec_str_from_pdb_file=None) # m.params.secondary_structure.use_ksdssp = False m.params.secondary_structure.protein.remove_outliers = False log = open("exercise_sheet_ends.log", "w") proxies, hb_angles = m.create_protein_hbond_proxies(annotation=ss_from_file, log=log) log.close() # probably the determination of SS by ksdssp is not stable. assert proxies.size() == 12, proxies.size() assert hb_angles.size() == 27, hb_angles.size() def exercise_helix_bonding_pattern(): alpha_h1_simple = iotbx.pdb.hierarchy.input(pdb_string="""\ ATOM 1 N ALA 1 1.643 -2.366 -1.408 1.00 0.00 N ATOM 2 CA ALA 1 1.280 -3.608 -2.069 1.00 0.00 C ATOM 3 C ALA 1 -0.114 -3.466 -2.684 1.00 0.00 C ATOM 4 O ALA 1 -0.327 -3.827 -3.840 1.00 0.00 O ATOM 5 CB ALA 1 1.361 -4.762 -1.068 1.00 0.00 C ATOM 6 N ALA 2 -1.028 -2.938 -1.882 1.00 0.00 N ATOM 7 CA ALA 2 -2.395 -2.743 -2.332 1.00 0.00 C ATOM 8 C ALA 2 -2.396 -1.855 -3.579 1.00 0.00 C ATOM 9 O ALA 2 -3.059 -2.167 -4.567 1.00 0.00 O ATOM 10 CB ALA 2 -3.228 -2.150 -1.194 1.00 0.00 C ATOM 11 N ALA 3 -1.646 -0.767 -3.491 1.00 0.00 N ATOM 12 CA ALA 3 -1.551 0.168 -4.599 1.00 0.00 C ATOM 13 C ALA 3 -1.044 -0.568 -5.841 1.00 0.00 C ATOM 14 O ALA 3 -1.601 -0.419 -6.927 1.00 0.00 O ATOM 15 CB ALA 3 -0.646 1.337 -4.205 1.00 0.00 C ATOM 16 N ALA 4 0.008 -1.348 -5.639 1.00 0.00 N ATOM 17 CA ALA 4 0.597 -2.109 -6.728 1.00 0.00 C ATOM 18 C ALA 4 -0.466 -3.023 -7.340 1.00 0.00 C ATOM 19 O ALA 4 -0.611 -3.085 -8.559 1.00 0.00 O ATOM 20 CB ALA 4 1.808 -2.887 -6.211 1.00 0.00 C ATOM 21 N ALA 5 -1.184 -3.711 -6.463 1.00 0.00 N ATOM 22 CA ALA 5 -2.231 -4.619 -6.901 1.00 0.00 C ATOM 23 C ALA 5 -3.253 -3.847 -7.737 1.00 0.00 C ATOM 24 O ALA 5 -3.647 -4.296 -8.813 1.00 0.00 O ATOM 25 CB ALA 5 -2.864 -5.294 -5.683 1.00 0.00 C ATOM 26 N ALA 6 -3.654 -2.699 -7.211 1.00 0.00 N ATOM 27 CA ALA 6 -4.623 -1.860 -7.896 1.00 0.00 C ATOM 28 C ALA 6 -4.090 -1.499 -9.284 1.00 0.00 C ATOM 29 O ALA 6 -4.809 -1.602 -10.276 1.00 0.00 O ATOM 30 CB ALA 6 -4.919 -0.623 -7.045 1.00 0.00 C ATOM 31 N ALA 7 -2.831 -1.084 -9.309 1.00 0.00 N ATOM 32 CA ALA 7 -2.192 -0.708 -10.559 1.00 0.00 C ATOM 33 C ALA 7 -2.243 -1.890 -11.529 1.00 0.00 C ATOM 34 O ALA 7 -2.600 -1.727 -12.695 1.00 0.00 O ATOM 35 CB ALA 7 -0.761 -0.243 -10.281 1.00 0.00 C ATOM 36 N ALA 8 -1.881 -3.055 -11.012 1.00 0.00 N ATOM 37 CA ALA 8 -1.882 -4.264 -11.817 1.00 0.00 C ATOM 38 C ALA 8 -3.285 -4.496 -12.382 1.00 0.00 C ATOM 39 O ALA 8 -3.442 -4.772 -13.570 1.00 0.00 O ATOM 40 CB ALA 8 -1.391 -5.441 -10.972 1.00 0.00 C ATOM 41 N ALA 9 -4.269 -4.376 -11.503 1.00 0.00 N ATOM 42 CA ALA 9 -5.653 -4.568 -11.898 1.00 0.00 C ATOM 43 C ALA 9 -6.000 -3.590 -13.022 1.00 0.00 C ATOM 44 O ALA 9 -6.590 -3.978 -14.029 1.00 0.00 O ATOM 45 CB ALA 9 -6.561 -4.400 -10.678 1.00 0.00 C ATOM 46 N ALA 10 -5.617 -2.338 -12.812 1.00 0.00 N ATOM 47 CA ALA 10 -5.879 -1.301 -13.795 1.00 0.00 C ATOM 48 C ALA 10 -5.242 -1.695 -15.130 1.00 0.00 C ATOM 49 O ALA 10 -5.880 -1.605 -16.177 1.00 0.00 O ATOM 50 CB ALA 10 -5.358 0.040 -13.274 1.00 0.00 C TER """) alpha_h1_1ac = iotbx.pdb.hierarchy.input(pdb_string="""\ ATOM 1 N AALA 1 1.643 -2.366 -1.408 0.50 0.00 N ATOM 2 CA AALA 1 1.280 -3.608 -2.069 0.50 0.00 C ATOM 3 C AALA 1 -0.114 -3.466 -2.684 0.50 0.00 C ATOM 4 O AALA 1 -0.327 -3.827 -3.840 0.50 0.00 O ATOM 5 CB AALA 1 1.361 -4.762 -1.068 0.50 0.00 C ATOM 6 N BALA 1 1.743 -2.366 -1.408 0.50 0.00 N ATOM 7 CA BALA 1 1.380 -3.608 -2.069 0.50 0.00 C ATOM 8 C BALA 1 -0.014 -3.466 -2.684 0.50 0.00 C ATOM 9 O BALA 1 -0.227 -3.827 -3.840 0.50 0.00 O ATOM 10 CB BALA 1 1.461 -4.762 -1.068 0.50 0.00 C ATOM 11 N ALA 2 -1.028 -2.938 -1.882 1.00 0.00 N ATOM 12 CA ALA 2 -2.395 -2.743 -2.332 1.00 0.00 C ATOM 13 C ALA 2 -2.396 -1.855 -3.579 1.00 0.00 C ATOM 14 O ALA 2 -3.059 -2.167 -4.567 1.00 0.00 O ATOM 15 CB ALA 2 -3.228 -2.150 -1.194 1.00 0.00 C ATOM 16 N ALA 3 -1.646 -0.767 -3.491 1.00 0.00 N ATOM 17 CA ALA 3 -1.551 0.168 -4.599 1.00 0.00 C ATOM 18 C ALA 3 -1.044 -0.568 -5.841 1.00 0.00 C ATOM 19 O ALA 3 -1.601 -0.419 -6.927 1.00 0.00 O ATOM 20 CB ALA 3 -0.646 1.337 -4.205 1.00 0.00 C ATOM 21 N ALA 4 0.008 -1.348 -5.639 1.00 0.00 N ATOM 22 CA ALA 4 0.597 -2.109 -6.728 1.00 0.00 C ATOM 23 C ALA 4 -0.466 -3.023 -7.340 1.00 0.00 C ATOM 24 O ALA 4 -0.611 -3.085 -8.559 1.00 0.00 O ATOM 25 CB ALA 4 1.808 -2.887 -6.211 1.00 0.00 C ATOM 26 N ALA 5 -1.184 -3.711 -6.463 1.00 0.00 N ATOM 27 CA ALA 5 -2.231 -4.619 -6.901 1.00 0.00 C ATOM 28 C ALA 5 -3.253 -3.847 -7.737 1.00 0.00 C ATOM 29 O ALA 5 -3.647 -4.296 -8.813 1.00 0.00 O ATOM 30 CB ALA 5 -2.864 -5.294 -5.683 1.00 0.00 C ATOM 31 N ALA 6 -3.654 -2.699 -7.211 1.00 0.00 N ATOM 32 CA ALA 6 -4.623 -1.860 -7.896 1.00 0.00 C ATOM 33 C ALA 6 -4.090 -1.499 -9.284 1.00 0.00 C ATOM 34 O ALA 6 -4.809 -1.602 -10.276 1.00 0.00 O ATOM 35 CB ALA 6 -4.919 -0.623 -7.045 1.00 0.00 C ATOM 36 N ALA 7 -2.831 -1.084 -9.309 1.00 0.00 N ATOM 37 CA ALA 7 -2.192 -0.708 -10.559 1.00 0.00 C ATOM 38 C ALA 7 -2.243 -1.890 -11.529 1.00 0.00 C ATOM 39 O ALA 7 -2.600 -1.727 -12.695 1.00 0.00 O ATOM 40 CB ALA 7 -0.761 -0.243 -10.281 1.00 0.00 C ATOM 41 N ALA 8 -1.881 -3.055 -11.012 1.00 0.00 N ATOM 42 CA ALA 8 -1.882 -4.264 -11.817 1.00 0.00 C ATOM 43 C ALA 8 -3.285 -4.496 -12.382 1.00 0.00 C ATOM 44 O ALA 8 -3.442 -4.772 -13.570 1.00 0.00 O ATOM 45 CB ALA 8 -1.391 -5.441 -10.972 1.00 0.00 C ATOM 46 N ALA 9 -4.269 -4.376 -11.503 1.00 0.00 N ATOM 47 CA ALA 9 -5.653 -4.568 -11.898 1.00 0.00 C ATOM 48 C ALA 9 -6.000 -3.590 -13.022 1.00 0.00 C ATOM 49 O ALA 9 -6.590 -3.978 -14.029 1.00 0.00 O ATOM 50 CB ALA 9 -6.561 -4.400 -10.678 1.00 0.00 C ATOM 51 N ALA 10 -5.617 -2.338 -12.812 1.00 0.00 N ATOM 52 CA ALA 10 -5.879 -1.301 -13.795 1.00 0.00 C ATOM 53 C ALA 10 -5.242 -1.695 -15.130 1.00 0.00 C ATOM 54 O ALA 10 -5.880 -1.605 -16.177 1.00 0.00 O ATOM 55 CB ALA 10 -5.358 0.040 -13.274 1.00 0.00 C TER 56 ALA 10 END """) alpha_h1_1_10ac = iotbx.pdb.hierarchy.input(pdb_string="""\ ATOM 1 N AALA 1 1.643 -2.366 -1.408 0.50 0.00 N ATOM 2 CA AALA 1 1.280 -3.608 -2.069 0.50 0.00 C ATOM 3 C AALA 1 -0.114 -3.466 -2.684 0.50 0.00 C ATOM 4 O AALA 1 -0.327 -3.827 -3.840 0.50 0.00 O ATOM 5 CB AALA 1 1.361 -4.762 -1.068 0.50 0.00 C ATOM 6 N BALA 1 1.743 -2.366 -1.408 0.50 0.00 N ATOM 7 CA BALA 1 1.380 -3.608 -2.069 0.50 0.00 C ATOM 8 C BALA 1 -0.014 -3.466 -2.684 0.50 0.00 C ATOM 9 O BALA 1 -0.227 -3.827 -3.840 0.50 0.00 O ATOM 10 CB BALA 1 1.461 -4.762 -1.068 0.50 0.00 C ATOM 11 N ALA 2 -1.028 -2.938 -1.882 1.00 0.00 N ATOM 12 CA ALA 2 -2.395 -2.743 -2.332 1.00 0.00 C ATOM 13 C ALA 2 -2.396 -1.855 -3.579 1.00 0.00 C ATOM 14 O ALA 2 -3.059 -2.167 -4.567 1.00 0.00 O ATOM 15 CB ALA 2 -3.228 -2.150 -1.194 1.00 0.00 C ATOM 16 N ALA 3 -1.646 -0.767 -3.491 1.00 0.00 N ATOM 17 CA ALA 3 -1.551 0.168 -4.599 1.00 0.00 C ATOM 18 C ALA 3 -1.044 -0.568 -5.841 1.00 0.00 C ATOM 19 O ALA 3 -1.601 -0.419 -6.927 1.00 0.00 O ATOM 20 CB ALA 3 -0.646 1.337 -4.205 1.00 0.00 C ATOM 21 N ALA 4 0.008 -1.348 -5.639 1.00 0.00 N ATOM 22 CA ALA 4 0.597 -2.109 -6.728 1.00 0.00 C ATOM 23 C ALA 4 -0.466 -3.023 -7.340 1.00 0.00 C ATOM 24 O ALA 4 -0.611 -3.085 -8.559 1.00 0.00 O ATOM 25 CB ALA 4 1.808 -2.887 -6.211 1.00 0.00 C ATOM 26 N ALA 5 -1.184 -3.711 -6.463 1.00 0.00 N ATOM 27 CA ALA 5 -2.231 -4.619 -6.901 1.00 0.00 C ATOM 28 C ALA 5 -3.253 -3.847 -7.737 1.00 0.00 C ATOM 29 O ALA 5 -3.647 -4.296 -8.813 1.00 0.00 O ATOM 30 CB ALA 5 -2.864 -5.294 -5.683 1.00 0.00 C ATOM 31 N ALA 6 -3.654 -2.699 -7.211 1.00 0.00 N ATOM 32 CA ALA 6 -4.623 -1.860 -7.896 1.00 0.00 C ATOM 33 C ALA 6 -4.090 -1.499 -9.284 1.00 0.00 C ATOM 34 O ALA 6 -4.809 -1.602 -10.276 1.00 0.00 O ATOM 35 CB ALA 6 -4.919 -0.623 -7.045 1.00 0.00 C ATOM 36 N ALA 7 -2.831 -1.084 -9.309 1.00 0.00 N ATOM 37 CA ALA 7 -2.192 -0.708 -10.559 1.00 0.00 C ATOM 38 C ALA 7 -2.243 -1.890 -11.529 1.00 0.00 C ATOM 39 O ALA 7 -2.600 -1.727 -12.695 1.00 0.00 O ATOM 40 CB ALA 7 -0.761 -0.243 -10.281 1.00 0.00 C ATOM 41 N ALA 8 -1.881 -3.055 -11.012 1.00 0.00 N ATOM 42 CA ALA 8 -1.882 -4.264 -11.817 1.00 0.00 C ATOM 43 C ALA 8 -3.285 -4.496 -12.382 1.00 0.00 C ATOM 44 O ALA 8 -3.442 -4.772 -13.570 1.00 0.00 O ATOM 45 CB ALA 8 -1.391 -5.441 -10.972 1.00 0.00 C ATOM 46 N ALA 9 -4.269 -4.376 -11.503 1.00 0.00 N ATOM 47 CA ALA 9 -5.653 -4.568 -11.898 1.00 0.00 C ATOM 48 C ALA 9 -6.000 -3.590 -13.022 1.00 0.00 C ATOM 49 O ALA 9 -6.590 -3.978 -14.029 1.00 0.00 O ATOM 50 CB ALA 9 -6.561 -4.400 -10.678 1.00 0.00 C ATOM 51 N AALA 10 -5.617 -2.338 -12.812 0.50 0.00 N ATOM 52 CA AALA 10 -5.879 -1.301 -13.795 0.50 0.00 C ATOM 53 C AALA 10 -5.242 -1.695 -15.130 0.50 0.00 C ATOM 54 O AALA 10 -5.880 -1.605 -16.177 0.50 0.00 O ATOM 55 CB AALA 10 -5.358 0.040 -13.274 0.50 0.00 C ATOM 57 N BALA 10 -5.517 -2.338 -12.812 0.50 0.00 N ATOM 58 CA BALA 10 -5.779 -1.301 -13.795 0.50 0.00 C ATOM 59 C BALA 10 -5.142 -1.695 -15.130 0.50 0.00 C ATOM 60 O BALA 10 -5.780 -1.605 -16.177 0.50 0.00 O ATOM 61 CB BALA 10 -5.258 0.040 -13.274 0.50 0.00 C END """) alpha_h1_1_5_10ac = iotbx.pdb.hierarchy.input(pdb_string="""\ ATOM 1 N AALA 1 1.643 -2.366 -1.408 0.50 0.00 N ATOM 2 CA AALA 1 1.280 -3.608 -2.069 0.50 0.00 C ATOM 3 C AALA 1 -0.114 -3.466 -2.684 0.50 0.00 C ATOM 4 O AALA 1 -0.327 -3.827 -3.840 0.50 0.00 O ATOM 5 CB AALA 1 1.361 -4.762 -1.068 0.50 0.00 C ATOM 6 N BALA 1 1.743 -2.366 -1.408 0.50 0.00 N ATOM 7 CA BALA 1 1.380 -3.608 -2.069 0.50 0.00 C ATOM 8 C BALA 1 -0.014 -3.466 -2.684 0.50 0.00 C ATOM 9 O BALA 1 -0.227 -3.827 -3.840 0.50 0.00 O ATOM 10 CB BALA 1 1.461 -4.762 -1.068 0.50 0.00 C ATOM 11 N ALA 2 -1.028 -2.938 -1.882 1.00 0.00 N ATOM 12 CA ALA 2 -2.395 -2.743 -2.332 1.00 0.00 C ATOM 13 C ALA 2 -2.396 -1.855 -3.579 1.00 0.00 C ATOM 14 O ALA 2 -3.059 -2.167 -4.567 1.00 0.00 O ATOM 15 CB ALA 2 -3.228 -2.150 -1.194 1.00 0.00 C ATOM 16 N ALA 3 -1.646 -0.767 -3.491 1.00 0.00 N ATOM 17 CA ALA 3 -1.551 0.168 -4.599 1.00 0.00 C ATOM 18 C ALA 3 -1.044 -0.568 -5.841 1.00 0.00 C ATOM 19 O ALA 3 -1.601 -0.419 -6.927 1.00 0.00 O ATOM 20 CB ALA 3 -0.646 1.337 -4.205 1.00 0.00 C ATOM 21 N ALA 4 0.008 -1.348 -5.639 1.00 0.00 N ATOM 22 CA ALA 4 0.597 -2.109 -6.728 1.00 0.00 C ATOM 23 C ALA 4 -0.466 -3.023 -7.340 1.00 0.00 C ATOM 24 O ALA 4 -0.611 -3.085 -8.559 1.00 0.00 O ATOM 25 CB ALA 4 1.808 -2.887 -6.211 1.00 0.00 C ATOM 26 N AALA 5 -1.184 -3.711 -6.463 0.50 0.00 N ATOM 27 CA AALA 5 -2.231 -4.619 -6.901 0.50 0.00 C ATOM 28 C AALA 5 -3.253 -3.847 -7.737 0.50 0.00 C ATOM 29 O AALA 5 -3.647 -4.296 -8.813 0.50 0.00 O ATOM 30 CB AALA 5 -2.864 -5.294 -5.683 0.50 0.00 C ATOM 31 N BALA 5 -1.084 -3.711 -6.463 0.50 0.00 N ATOM 32 CA BALA 5 -2.131 -4.619 -6.901 0.50 0.00 C ATOM 33 C BALA 5 -3.153 -3.847 -7.737 0.50 0.00 C ATOM 34 O BALA 5 -3.547 -4.296 -8.813 0.50 0.00 O ATOM 35 CB BALA 5 -2.764 -5.294 -5.683 0.50 0.00 C ATOM 36 N ALA 6 -3.654 -2.699 -7.211 1.00 0.00 N ATOM 37 CA ALA 6 -4.623 -1.860 -7.896 1.00 0.00 C ATOM 38 C ALA 6 -4.090 -1.499 -9.284 1.00 0.00 C ATOM 39 O ALA 6 -4.809 -1.602 -10.276 1.00 0.00 O ATOM 40 CB ALA 6 -4.919 -0.623 -7.045 1.00 0.00 C ATOM 41 N ALA 7 -2.831 -1.084 -9.309 1.00 0.00 N ATOM 42 CA ALA 7 -2.192 -0.708 -10.559 1.00 0.00 C ATOM 43 C ALA 7 -2.243 -1.890 -11.529 1.00 0.00 C ATOM 44 O ALA 7 -2.600 -1.727 -12.695 1.00 0.00 O ATOM 45 CB ALA 7 -0.761 -0.243 -10.281 1.00 0.00 C ATOM 46 N ALA 8 -1.881 -3.055 -11.012 1.00 0.00 N ATOM 47 CA ALA 8 -1.882 -4.264 -11.817 1.00 0.00 C ATOM 48 C ALA 8 -3.285 -4.496 -12.382 1.00 0.00 C ATOM 49 O ALA 8 -3.442 -4.772 -13.570 1.00 0.00 O ATOM 50 CB ALA 8 -1.391 -5.441 -10.972 1.00 0.00 C ATOM 51 N ALA 9 -4.269 -4.376 -11.503 1.00 0.00 N ATOM 52 CA ALA 9 -5.653 -4.568 -11.898 1.00 0.00 C ATOM 53 C ALA 9 -6.000 -3.590 -13.022 1.00 0.00 C ATOM 54 O ALA 9 -6.590 -3.978 -14.029 1.00 0.00 O ATOM 55 CB ALA 9 -6.561 -4.400 -10.678 1.00 0.00 C ATOM 56 N AALA 10 -5.617 -2.338 -12.812 0.50 0.00 N ATOM 57 CA AALA 10 -5.879 -1.301 -13.795 0.50 0.00 C ATOM 58 C AALA 10 -5.242 -1.695 -15.130 0.50 0.00 C ATOM 59 O AALA 10 -5.880 -1.605 -16.177 0.50 0.00 O ATOM 60 CB AALA 10 -5.358 0.040 -13.274 0.50 0.00 C ATOM 62 N BALA 10 -5.517 -2.338 -12.812 0.50 0.00 N ATOM 63 CA BALA 10 -5.779 -1.301 -13.795 0.50 0.00 C ATOM 64 C BALA 10 -5.142 -1.695 -15.130 0.50 0.00 C ATOM 65 O BALA 10 -5.780 -1.605 -16.177 0.50 0.00 O ATOM 66 CB BALA 10 -5.258 0.040 -13.274 0.50 0.00 C END """) alpha_h1_1_5_10ac_insertions = iotbx.pdb.hierarchy.input(pdb_string="""\ ATOM 1 N AALA 1 1.643 -2.366 -1.408 0.50 0.00 N ATOM 2 CA AALA 1 1.280 -3.608 -2.069 0.50 0.00 C ATOM 3 C AALA 1 -0.114 -3.466 -2.684 0.50 0.00 C ATOM 4 O AALA 1 -0.327 -3.827 -3.840 0.50 0.00 O ATOM 5 CB AALA 1 1.361 -4.762 -1.068 0.50 0.00 C ATOM 6 N BALA 1 1.743 -2.366 -1.408 0.50 0.00 N ATOM 7 CA BALA 1 1.380 -3.608 -2.069 0.50 0.00 C ATOM 8 C BALA 1 -0.014 -3.466 -2.684 0.50 0.00 C ATOM 9 O BALA 1 -0.227 -3.827 -3.840 0.50 0.00 O ATOM 10 CB BALA 1 1.461 -4.762 -1.068 0.50 0.00 C ATOM 11 N ALA 2 -1.028 -2.938 -1.882 1.00 0.00 N ATOM 12 CA ALA 2 -2.395 -2.743 -2.332 1.00 0.00 C ATOM 13 C ALA 2 -2.396 -1.855 -3.579 1.00 0.00 C ATOM 14 O ALA 2 -3.059 -2.167 -4.567 1.00 0.00 O ATOM 15 CB ALA 2 -3.228 -2.150 -1.194 1.00 0.00 C ATOM 16 N ALA 2A -1.646 -0.767 -3.491 1.00 0.00 N ATOM 17 CA ALA 2A -1.551 0.168 -4.599 1.00 0.00 C ATOM 18 C ALA 2A -1.044 -0.568 -5.841 1.00 0.00 C ATOM 19 O ALA 2A -1.601 -0.419 -6.927 1.00 0.00 O ATOM 20 CB ALA 2A -0.646 1.337 -4.205 1.00 0.00 C ATOM 21 N ALA 2B 0.008 -1.348 -5.639 1.00 0.00 N ATOM 22 CA ALA 2B 0.597 -2.109 -6.728 1.00 0.00 C ATOM 23 C ALA 2B -0.466 -3.023 -7.340 1.00 0.00 C ATOM 24 O ALA 2B -0.611 -3.085 -8.559 1.00 0.00 O ATOM 25 CB ALA 2B 1.808 -2.887 -6.211 1.00 0.00 C ATOM 26 N AALA 2C -1.184 -3.711 -6.463 0.50 0.00 N ATOM 27 CA AALA 2C -2.231 -4.619 -6.901 0.50 0.00 C ATOM 28 C AALA 2C -3.253 -3.847 -7.737 0.50 0.00 C ATOM 29 O AALA 2C -3.647 -4.296 -8.813 0.50 0.00 O ATOM 30 CB AALA 2C -2.864 -5.294 -5.683 0.50 0.00 C ATOM 31 N BALA 2C -1.084 -3.711 -6.463 0.50 0.00 N ATOM 32 CA BALA 2C -2.131 -4.619 -6.901 0.50 0.00 C ATOM 33 C BALA 2C -3.153 -3.847 -7.737 0.50 0.00 C ATOM 34 O BALA 2C -3.547 -4.296 -8.813 0.50 0.00 O ATOM 35 CB BALA 2C -2.764 -5.294 -5.683 0.50 0.00 C ATOM 36 N ALA 2D -3.654 -2.699 -7.211 1.00 0.00 N ATOM 37 CA ALA 2D -4.623 -1.860 -7.896 1.00 0.00 C ATOM 38 C ALA 2D -4.090 -1.499 -9.284 1.00 0.00 C ATOM 39 O ALA 2D -4.809 -1.602 -10.276 1.00 0.00 O ATOM 40 CB ALA 2D -4.919 -0.623 -7.045 1.00 0.00 C ATOM 41 N ALA 3 -2.831 -1.084 -9.309 1.00 0.00 N ATOM 42 CA ALA 3 -2.192 -0.708 -10.559 1.00 0.00 C ATOM 43 C ALA 3 -2.243 -1.890 -11.529 1.00 0.00 C ATOM 44 O ALA 3 -2.600 -1.727 -12.695 1.00 0.00 O ATOM 45 CB ALA 3 -0.761 -0.243 -10.281 1.00 0.00 C ATOM 46 N ALA 4 -1.881 -3.055 -11.012 1.00 0.00 N ATOM 47 CA ALA 4 -1.882 -4.264 -11.817 1.00 0.00 C ATOM 48 C ALA 4 -3.285 -4.496 -12.382 1.00 0.00 C ATOM 49 O ALA 4 -3.442 -4.772 -13.570 1.00 0.00 O ATOM 50 CB ALA 4 -1.391 -5.441 -10.972 1.00 0.00 C ATOM 51 N ALA 5 -4.269 -4.376 -11.503 1.00 0.00 N ATOM 52 CA ALA 5 -5.653 -4.568 -11.898 1.00 0.00 C ATOM 53 C ALA 5 -6.000 -3.590 -13.022 1.00 0.00 C ATOM 54 O ALA 5 -6.590 -3.978 -14.029 1.00 0.00 O ATOM 55 CB ALA 5 -6.561 -4.400 -10.678 1.00 0.00 C ATOM 56 N AALA 6 -5.617 -2.338 -12.812 0.50 0.00 N ATOM 57 CA AALA 6 -5.879 -1.301 -13.795 0.50 0.00 C ATOM 58 C AALA 6 -5.242 -1.695 -15.130 0.50 0.00 C ATOM 59 O AALA 6 -5.880 -1.605 -16.177 0.50 0.00 O ATOM 60 CB AALA 6 -5.358 0.040 -13.274 0.50 0.00 C ATOM 62 N BALA 6 -5.517 -2.338 -12.812 0.50 0.00 N ATOM 63 CA BALA 6 -5.779 -1.301 -13.795 0.50 0.00 C ATOM 64 C BALA 6 -5.142 -1.695 -15.130 0.50 0.00 C ATOM 65 O BALA 6 -5.780 -1.605 -16.177 0.50 0.00 O ATOM 66 CB BALA 6 -5.258 0.040 -13.274 0.50 0.00 C END """) alpha_annot_1 = """\ HELIX 1 1 ALA 1 ALA 10 1 10 """ alpha_annot_2 = """\ HELIX 1 1 ALA 2 ALA 5 1 10 """ log = null_out() n_hbonds = [] n_hangles = [] for pdb_inp, recs in [ (alpha_h1_simple, alpha_annot_1), (alpha_h1_1ac, alpha_annot_1), (alpha_h1_1_10ac, alpha_annot_1), (alpha_h1_1_5_10ac, alpha_annot_1), (alpha_h1_1_5_10ac_insertions, alpha_annot_1), (alpha_h1_1_5_10ac_insertions, alpha_annot_2), ]: ioss_annotation = ioss.annotation.from_records(records = recs.split('\n')) ann = ioss_annotation.as_restraint_groups(prefix_scope="secondary_structure") defpars = iotbx.phil.parse(sec_str_master_phil_str) custom_pars = defpars.fetch(iotbx.phil.parse(ann)) custom_pars_ex = custom_pars.extract() ss_manager = manager( pdb_inp.hierarchy, sec_str_from_pdb_file=None, params=custom_pars_ex.secondary_structure, verbose=-1) proxies_for_grm, angle_p = ss_manager.create_protein_hbond_proxies( annotation= None, log = log) pdb_inp.hierarchy.write_pdb_file(file_name="alpha_h1_1_5_10ac.pdb") # print proxies_for_grm.as_pymol_dashes(pdb_inp.hierarchy) # print angle_p.as_pymol_dashes(pdb_hierarchy=pdb_inp.hierarchy) # print "hbonds, hangles:", proxies_for_grm.size(), angle_p.size() # STOP() n_hbonds.append(proxies_for_grm.size()) n_hangles.append(angle_p.size()) print(n_hbonds, n_hangles) assert n_hbonds == [ 6, 7, 8, 9, 9, 5] assert n_hangles == [18, 21, 24, 28, 28, 16] def exercise_sheets_bonding_pattern(): pdb_apar_input = iotbx.pdb.hierarchy.input(pdb_string = """\ SCRYST1 46.460 46.460 193.210 90.00 90.00 120.00 P 31 2 1 SCALE1 0.021524 0.012427 0.000000 0.00000 SCALE2 0.000000 0.024854 0.000000 0.00000 SCALE3 0.000000 0.000000 0.005176 0.00000 ATOM 1 N GLY A 1 28.066 -23.487 2.817 1.00 16.21 N ATOM 2 CA GLY A 1 27.219 -22.652 1.936 1.00 13.03 C ATOM 3 C GLY A 1 27.859 -21.336 1.546 1.00 9.56 C ATOM 4 O GLY A 1 28.868 -20.882 2.096 1.00 12.48 O ATOM 5 N TYR A 2 27.208 -20.701 0.590 1.00 7.29 N ATOM 6 CA TYR A 2 27.617 -19.424 0.052 1.00 7.96 C ATOM 7 C TYR A 2 26.483 -18.436 0.263 1.00 6.87 C ATOM 8 O TYR A 2 25.303 -18.771 0.249 1.00 6.97 O ATOM 9 CB TYR A 2 27.861 -19.541 -1.451 1.00 7.90 C ATOM 10 CG TYR A 2 28.902 -20.556 -1.857 1.00 9.09 C ATOM 11 CD1 TYR A 2 30.255 -20.336 -1.592 1.00 11.43 C ATOM 12 CD2 TYR A 2 28.566 -21.697 -2.545 1.00 10.59 C ATOM 13 CE1 TYR A 2 31.227 -21.244 -1.987 1.00 13.93 C ATOM 14 CE2 TYR A 2 29.518 -22.630 -2.915 1.00 11.76 C ATOM 15 CZ TYR A 2 30.847 -22.395 -2.659 1.00 13.67 C ATOM 16 OH TYR A 2 31.792 -23.309 -3.059 1.00 18.26 O ATOM 17 N SER A 3 26.854 -17.177 0.412 1.00 6.66 N ATOM 18 CA SER A 3 25.899 -16.083 0.383 0.53 6.83 C ATOM 20 C SER A 3 26.500 -14.946 -0.440 1.00 5.61 C ATOM 21 O SER A 3 27.729 -14.822 -0.565 1.00 8.14 O ATOM 22 CB SER A 3 25.569 -15.634 1.795 0.53 7.38 C ATOM 24 OG SER A 3 26.740 -15.136 2.390 0.53 9.79 O ATOM 26 N CYS A 4 25.627 -14.135 -0.995 1.00 5.11 N ATOM 27 CA CYS A 4 26.070 -13.062 -1.865 1.00 5.65 C ATOM 28 C CYS A 4 25.043 -11.934 -1.798 1.00 4.54 C ATOM 29 O CYS A 4 23.856 -12.180 -1.528 1.00 5.60 O ATOM 30 CB CYS A 4 26.253 -13.557 -3.295 1.00 7.00 C ATOM 31 SG CYS A 4 24.806 -14.269 -4.119 1.00 8.88 S ATOM 32 N ARG A 5 25.486 -10.691 -2.002 1.00 4.69 N ATOM 33 CA ARG A 5 24.558 -9.545 -2.064 1.00 4.87 C ATOM 34 C ARG A 5 25.196 -8.395 -2.796 1.00 4.57 C ATOM 35 O ARG A 5 26.416 -8.238 -2.793 1.00 5.50 O ATOM 36 CB ARG A 5 24.061 -9.108 -0.700 1.00 6.43 C ATOM 37 CG ARG A 5 25.121 -8.566 0.219 1.00 6.96 C ATOM 38 CD ARG A 5 24.461 -8.032 1.494 1.00 7.25 C ATOM 39 NE ARG A 5 25.452 -7.547 2.440 1.00 7.63 N ATOM 40 CZ ARG A 5 26.107 -8.341 3.280 1.00 9.10 C ATOM 41 NH1 ARG A 5 25.867 -9.642 3.297 1.00 9.68 N ATOM 42 NH2 ARG A 5 26.974 -7.836 4.146 1.00 10.30 N ATOM 43 N ALA A 6 24.325 -7.563 -3.358 1.00 4.39 N ATOM 44 CA ALA A 6 24.723 -6.362 -4.067 1.00 4.73 C ATOM 45 C ALA A 6 23.693 -5.275 -3.769 1.00 4.15 C ATOM 46 O ALA A 6 22.482 -5.458 -3.987 1.00 4.96 O ATOM 47 CB ALA A 6 24.831 -6.626 -5.558 1.00 5.96 C ATOM 48 N VAL A 7 24.165 -4.139 -3.284 1.00 4.97 N ATOM 49 CA VAL A 7 23.374 -2.917 -3.085 1.00 4.42 C ATOM 50 C VAL A 7 23.482 -2.046 -4.325 1.00 4.45 C ATOM 51 O VAL A 7 24.589 -1.663 -4.717 1.00 5.55 O ATOM 52 CB VAL A 7 23.830 -2.159 -1.806 1.00 5.09 C ATOM 53 CG1 VAL A 7 23.111 -0.842 -1.686 1.00 5.65 C ATOM 54 CG2 VAL A 7 23.612 -2.998 -0.570 1.00 6.88 C ATOM 204 N MET A 31 18.177 -3.966 -4.656 1.00 4.72 N ATOM 205 CA MET A 31 18.833 -4.887 -3.744 1.00 5.29 C ATOM 206 C MET A 31 18.765 -6.294 -4.322 1.00 4.60 C ATOM 207 O MET A 31 17.661 -6.738 -4.657 1.00 4.98 O ATOM 208 CB MET A 31 18.097 -4.868 -2.387 1.00 6.39 C ATOM 209 CG MET A 31 18.723 -5.755 -1.334 1.00 8.61 C ATOM 210 SD MET A 31 20.248 -5.074 -0.655 1.00 11.04 S ATOM 211 CE MET A 31 21.358 -6.427 -0.777 1.00 8.94 C ATOM 212 N ALA A 32 19.899 -6.986 -4.412 1.00 3.90 N ATOM 213 CA ALA A 32 19.934 -8.380 -4.864 1.00 3.55 C ATOM 214 C ALA A 32 20.720 -9.194 -3.858 1.00 3.90 C ATOM 215 O ALA A 32 21.762 -8.763 -3.393 1.00 5.01 O ATOM 216 CB ALA A 32 20.552 -8.500 -6.255 1.00 4.55 C ATOM 217 N SER A 33 20.230 -10.407 -3.567 1.00 4.02 N ATOM 218 CA SER A 33 20.980 -11.288 -2.645 1.00 3.79 C ATOM 219 C SER A 33 20.591 -12.727 -2.850 1.00 4.33 C ATOM 220 O SER A 33 19.532 -13.045 -3.412 1.00 4.84 O ATOM 221 CB SER A 33 20.830 -10.880 -1.167 1.00 4.55 C ATOM 222 OG SER A 33 19.498 -11.105 -0.710 1.00 5.25 O ATOM 223 N GLY A 34 21.415 -13.600 -2.283 1.00 4.96 N ATOM 224 CA GLY A 34 21.104 -14.997 -2.335 1.00 4.50 C ATOM 225 C GLY A 34 21.914 -15.837 -1.397 1.00 4.64 C ATOM 226 O GLY A 34 22.836 -15.343 -0.732 1.00 4.96 O ATOM 227 N THR A 35 21.521 -17.105 -1.329 1.00 4.35 N ATOM 228 CA THR A 35 22.277 -18.138 -0.654 1.00 4.02 C ATOM 229 C THR A 35 22.226 -19.392 -1.495 1.00 4.55 C ATOM 230 O THR A 35 21.221 -19.652 -2.170 1.00 4.35 O ATOM 231 CB THR A 35 21.715 -18.436 0.762 1.00 5.12 C ATOM 232 OG1 THR A 35 20.356 -18.929 0.668 1.00 5.51 O ATOM 233 CG2 THR A 35 21.733 -17.222 1.670 1.00 5.97 C ATOM 234 N SER A 36 23.294 -20.178 -1.426 1.00 4.63 N ATOM 235 CA SER A 36 23.402 -21.406 -2.221 1.00 4.58 C ATOM 236 C SER A 36 24.387 -22.368 -1.553 1.00 5.05 C ATOM 237 O SER A 36 24.929 -22.095 -0.497 1.00 6.22 O ATOM 238 CB SER A 36 23.881 -21.071 -3.639 1.00 5.69 C ATOM 239 OG SER A 36 25.213 -20.561 -3.633 1.00 7.12 O """) pdb_par_input = iotbx.pdb.hierarchy.input(pdb_string = """\ CRYST1 46.460 46.460 193.210 90.00 90.00 120.00 P 31 2 1 SCALE1 0.021524 0.012427 0.000000 0.00000 SCALE2 0.000000 0.024854 0.000000 0.00000 SCALE3 0.000000 0.000000 0.005176 0.00000 ATOM 67 N ALA A 15 5.011 -5.031 -8.967 1.00 5.73 N ATOM 68 CA ALA A 15 4.943 -6.455 -9.287 1.00 6.16 C ATOM 69 C ALA A 15 5.610 -7.252 -8.166 1.00 6.39 C ATOM 70 O ALA A 15 6.751 -7.007 -7.857 1.00 9.87 O ATOM 71 CB ALA A 15 5.684 -6.739 -10.604 1.00 7.46 C ATOM 72 N THR A 16 4.929 -8.263 -7.636 1.00 5.49 N ATOM 73 C THR A 16 5.316 -10.600 -7.084 1.00 5.07 C ATOM 74 O THR A 16 4.214 -11.002 -7.422 1.00 6.51 O ATOM 75 CA THR A 16 5.513 -9.172 -6.657 1.00 5.70 C ATOM 76 CB THR A 16 4.864 -9.001 -5.276 1.00 8.31 C ATOM 77 N GLY A 17 6.393 -11.375 -7.067 1.00 4.56 N ATOM 78 CA GLY A 17 6.325 -12.770 -7.439 1.00 4.26 C ATOM 79 C GLY A 17 7.219 -13.654 -6.621 1.00 4.41 C ATOM 80 O GLY A 17 8.263 -13.233 -6.114 1.00 5.01 O ATOM 81 N SER A 18 6.827 -14.921 -6.561 1.00 4.24 N ATOM 82 CA SER A 18 7.657 -15.945 -5.959 1.00 4.02 C ATOM 83 C SER A 18 7.539 -17.244 -6.724 1.00 3.64 C ATOM 84 O SER A 18 6.482 -17.526 -7.331 1.00 4.07 O ATOM 85 CB SER A 18 7.335 -16.157 -4.481 1.00 5.86 C ATOM 86 N ALA A 19 8.573 -18.049 -6.627 1.00 3.19 N ATOM 87 CA ALA A 19 8.578 -19.414 -7.195 1.00 3.31 C ATOM 88 C ALA A 19 9.370 -20.307 -6.238 1.00 3.20 C ATOM 89 O ALA A 19 10.484 -19.956 -5.817 1.00 4.21 O ATOM 90 CB ALA A 19 9.235 -19.415 -8.574 1.00 3.85 C ATOM 91 N THR A 20 8.825 -21.476 -5.940 1.00 3.77 N ATOM 92 CA THR A 20 9.478 -22.432 -5.047 1.00 3.70 C ATOM 93 C THR A 20 9.444 -23.827 -5.640 1.00 3.56 C ATOM 94 O THR A 20 8.383 -24.281 -6.108 1.00 4.14 O ATOM 95 CB THR A 20 8.787 -22.430 -3.673 1.00 4.76 C ATOM 96 N THR A 21 10.560 -24.542 -5.569 1.00 4.00 N ATOM 97 CA THR A 21 10.597 -25.962 -5.876 1.00 4.05 C ATOM 98 C THR A 21 10.984 -26.770 -4.636 1.00 4.53 C ATOM 99 O THR A 21 11.770 -26.361 -3.802 1.00 5.04 O ATOM 100 CB THR A 21 11.488 -26.293 -7.083 1.00 4.38 C ATOM 189 N GLN A 40 0.280 -6.099 -9.049 1.00 6.35 N ATOM 190 CA GLN A 40 0.087 -7.454 -9.580 1.00 6.35 C ATOM 191 C GLN A 40 0.964 -8.417 -8.788 1.00 6.09 C ATOM 192 O GLN A 40 2.080 -8.093 -8.393 1.00 6.87 O ATOM 193 CB GLN A 40 0.461 -7.523 -11.060 1.00 7.52 C ATOM 194 N THR A 41 0.419 -9.596 -8.544 1.00 6.66 N ATOM 195 CA THR A 41 1.108 -10.640 -7.800 1.00 6.93 C ATOM 196 C THR A 41 0.932 -12.005 -8.414 1.00 6.82 C ATOM 197 O THR A 41 -0.069 -12.258 -9.104 1.00 8.79 O ATOM 198 CB THR A 41 0.633 -10.636 -6.352 1.00 10.84 C ATOM 199 N ALA A 42 1.951 -12.847 -8.263 1.00 6.44 N ATOM 200 CA ALA A 42 1.923 -14.209 -8.797 1.00 6.59 C ATOM 201 C ALA A 42 2.829 -15.117 -7.992 1.00 5.51 C ATOM 202 O ALA A 42 3.835 -14.684 -7.420 1.00 5.94 O ATOM 203 CB ALA A 42 2.327 -14.218 -10.264 1.00 9.02 C ATOM 204 N LYS A 43 2.479 -16.398 -7.978 1.00 6.26 N ATOM 205 CA LYS A 43 3.247 -17.395 -7.256 1.00 6.48 C ATOM 206 C LYS A 43 3.186 -18.741 -7.955 1.00 5.78 C ATOM 207 O LYS A 43 2.206 -19.041 -8.623 1.00 9.40 O ATOM 208 CB LYS A 43 2.727 -17.535 -5.836 1.00 8.81 C ATOM 209 N SER A 44 4.243 -19.534 -7.818 1.00 4.43 N ATOM 210 CA SER A 44 4.241 -20.890 -8.325 1.00 4.28 C ATOM 211 C SER A 44 4.998 -21.811 -7.358 1.00 4.09 C ATOM 212 O SER A 44 5.865 -21.377 -6.584 1.00 4.53 O ATOM 213 CB SER A 44 4.831 -20.949 -9.731 1.00 5.33 C ATOM 214 N PHE A 45 4.660 -23.091 -7.444 1.00 4.39 N ATOM 215 CA PHE A 45 5.198 -24.135 -6.576 1.00 4.44 C ATOM 216 C PHE A 45 5.222 -25.415 -7.389 1.00 4.16 C ATOM 217 O PHE A 45 4.183 -25.754 -7.979 1.00 5.11 O ATOM 218 CB PHE A 45 4.254 -24.281 -5.370 1.00 5.22 C ATOM 219 N ALA A 46 6.347 -26.119 -7.403 1.00 3.62 N ATOM 220 CA ALA A 46 6.443 -27.338 -8.202 1.00 3.99 C ATOM 221 C ALA A 46 7.579 -28.205 -7.717 1.00 4.57 C ATOM 222 O ALA A 46 8.479 -27.750 -7.000 1.00 4.79 O ATOM 223 CB ALA A 46 6.607 -27.026 -9.678 1.00 4.52 C TER END """) pdb_par_ac_input = iotbx.pdb.hierarchy.input(pdb_string = """\ CRYST1 46.460 46.460 193.210 90.00 90.00 120.00 P 31 2 1 SCALE1 0.021524 0.012427 0.000000 0.00000 SCALE2 0.000000 0.024854 0.000000 0.00000 SCALE3 0.000000 0.000000 0.005176 0.00000 ATOM 1 N AALA A 15 5.011 -5.031 -8.967 0.50 5.73 N ATOM 2 CA AALA A 15 4.943 -6.455 -9.287 0.50 6.16 C ATOM 3 C AALA A 15 5.610 -7.252 -8.166 0.50 6.39 C ATOM 4 O AALA A 15 6.751 -7.007 -7.857 0.50 9.87 O ATOM 5 CB AALA A 15 5.684 -6.739 -10.604 0.50 7.46 C ATOM 6 N BALA A 15 5.111 -5.031 -8.967 0.50 5.73 N ATOM 7 CA BALA A 15 5.043 -6.455 -9.287 0.50 6.16 C ATOM 8 C BALA A 15 5.710 -7.252 -8.166 0.50 6.39 C ATOM 9 O BALA A 15 6.851 -7.007 -7.857 0.50 9.87 O ATOM 10 CB BALA A 15 5.784 -6.739 -10.604 0.50 7.46 C ATOM 11 N ATHR A 16 4.929 -8.263 -7.636 0.50 5.49 N ATOM 12 C ATHR A 16 5.316 -10.600 -7.084 0.50 5.07 C ATOM 13 O ATHR A 16 4.214 -11.002 -7.422 0.50 6.51 O ATOM 14 CA ATHR A 16 5.513 -9.172 -6.657 0.50 5.70 C ATOM 15 CB ATHR A 16 4.864 -9.001 -5.276 0.50 8.31 C ATOM 16 N BTHR A 16 5.029 -8.263 -7.636 0.50 5.49 N ATOM 17 C BTHR A 16 5.416 -10.600 -7.084 0.50 5.07 C ATOM 18 O BTHR A 16 4.314 -11.002 -7.422 0.50 6.51 O ATOM 19 CA BTHR A 16 5.613 -9.172 -6.657 0.50 5.70 C ATOM 20 CB BTHR A 16 4.964 -9.001 -5.276 0.50 8.31 C ATOM 21 N GLY A 17 6.393 -11.375 -7.067 1.00 4.56 N ATOM 22 CA GLY A 17 6.325 -12.770 -7.439 1.00 4.26 C ATOM 23 C GLY A 17 7.219 -13.654 -6.621 1.00 4.41 C ATOM 24 O GLY A 17 8.263 -13.233 -6.114 1.00 5.01 O ATOM 25 N SER A 18 6.827 -14.921 -6.561 1.00 4.24 N ATOM 26 CA SER A 18 7.657 -15.945 -5.959 1.00 4.02 C ATOM 27 C SER A 18 7.539 -17.244 -6.724 1.00 3.64 C ATOM 28 O SER A 18 6.482 -17.526 -7.331 1.00 4.07 O ATOM 29 CB SER A 18 7.335 -16.157 -4.481 1.00 5.86 C ATOM 30 N ALA A 19 8.573 -18.049 -6.627 1.00 3.19 N ATOM 31 CA ALA A 19 8.578 -19.414 -7.195 1.00 3.31 C ATOM 32 C ALA A 19 9.370 -20.307 -6.238 1.00 3.20 C ATOM 33 O ALA A 19 10.484 -19.956 -5.817 1.00 4.21 O ATOM 34 CB ALA A 19 9.235 -19.415 -8.574 1.00 3.85 C ATOM 35 N THR A 20 8.825 -21.476 -5.940 1.00 3.77 N ATOM 36 CA THR A 20 9.478 -22.432 -5.047 1.00 3.70 C ATOM 37 C THR A 20 9.444 -23.827 -5.640 1.00 3.56 C ATOM 38 O THR A 20 8.383 -24.281 -6.108 1.00 4.14 O ATOM 39 CB THR A 20 8.787 -22.430 -3.673 1.00 4.76 C ATOM 40 N THR A 21 10.560 -24.542 -5.569 1.00 4.00 N ATOM 41 CA THR A 21 10.597 -25.962 -5.876 1.00 4.05 C ATOM 42 C THR A 21 10.984 -26.770 -4.636 1.00 4.53 C ATOM 43 O THR A 21 11.770 -26.361 -3.802 1.00 5.04 O ATOM 44 CB THR A 21 11.488 -26.293 -7.083 1.00 4.38 C ATOM 45 N GLN A 40 0.280 -6.099 -9.049 1.00 6.35 N ATOM 46 CA GLN A 40 0.087 -7.454 -9.580 1.00 6.35 C ATOM 47 C GLN A 40 0.964 -8.417 -8.788 1.00 6.09 C ATOM 48 O GLN A 40 2.080 -8.093 -8.393 1.00 6.87 O ATOM 49 CB GLN A 40 0.461 -7.523 -11.060 1.00 7.52 C ATOM 50 N THR A 41 0.419 -9.596 -8.544 1.00 6.66 N ATOM 51 CA THR A 41 1.108 -10.640 -7.800 1.00 6.93 C ATOM 52 C THR A 41 0.932 -12.005 -8.414 1.00 6.82 C ATOM 53 O THR A 41 -0.069 -12.258 -9.104 1.00 8.79 O ATOM 54 CB THR A 41 0.633 -10.636 -6.352 1.00 10.84 C ATOM 55 N ALA A 42 1.951 -12.847 -8.263 1.00 6.44 N ATOM 56 CA ALA A 42 1.923 -14.209 -8.797 1.00 6.59 C ATOM 57 C ALA A 42 2.829 -15.117 -7.992 1.00 5.51 C ATOM 58 O ALA A 42 3.835 -14.684 -7.420 1.00 5.94 O ATOM 59 CB ALA A 42 2.327 -14.218 -10.264 1.00 9.02 C ATOM 60 N LYS A 43 2.479 -16.398 -7.978 1.00 6.26 N ATOM 61 CA LYS A 43 3.247 -17.395 -7.256 1.00 6.48 C ATOM 62 C LYS A 43 3.186 -18.741 -7.955 1.00 5.78 C ATOM 63 O LYS A 43 2.206 -19.041 -8.623 1.00 9.40 O ATOM 64 CB LYS A 43 2.727 -17.535 -5.836 1.00 8.81 C ATOM 65 N SER A 44 4.243 -19.534 -7.818 1.00 4.43 N ATOM 66 CA SER A 44 4.241 -20.890 -8.325 1.00 4.28 C ATOM 67 C SER A 44 4.998 -21.811 -7.358 1.00 4.09 C ATOM 68 O SER A 44 5.865 -21.377 -6.584 1.00 4.53 O ATOM 69 CB SER A 44 4.831 -20.949 -9.731 1.00 5.33 C ATOM 70 N PHE A 45 4.660 -23.091 -7.444 1.00 4.39 N ATOM 71 CA PHE A 45 5.198 -24.135 -6.576 1.00 4.44 C ATOM 72 C PHE A 45 5.222 -25.415 -7.389 1.00 4.16 C ATOM 73 O PHE A 45 4.183 -25.754 -7.979 1.00 5.11 O ATOM 74 CB PHE A 45 4.254 -24.281 -5.370 1.00 5.22 C ATOM 75 N ALA A 46 6.347 -26.119 -7.403 1.00 3.62 N ATOM 76 CA ALA A 46 6.443 -27.338 -8.202 1.00 3.99 C ATOM 77 C ALA A 46 7.579 -28.205 -7.717 1.00 4.57 C ATOM 78 O ALA A 46 8.479 -27.750 -7.000 1.00 4.79 O ATOM 79 CB ALA A 46 6.607 -27.026 -9.678 1.00 4.52 C TER 80 ALA A 46 END """) pdb_apar2_input = iotbx.pdb.hierarchy.input(pdb_string = """\ CRYST1 172.640 172.640 172.640 90.00 90.00 90.00 P 1 ATOM 2094 C ASP N 271 109.854 129.638 88.152 1.00 0.00 C ATOM 2095 CA ASP N 271 108.849 130.718 87.818 1.00 0.00 C ATOM 2096 CB ASP N 271 109.517 131.848 87.048 1.00 0.00 C ATOM 2097 CG ASP N 271 108.534 132.901 86.590 1.00 0.00 C ATOM 2098 N ASP N 271 108.279 131.208 89.060 1.00 0.00 N ATOM 2099 O ASP N 271 110.669 129.804 89.047 1.00 0.00 O ATOM 2100 OD1 ASP N 271 107.322 132.611 86.550 1.00 0.00 O ATOM 2101 OD2 ASP N 271 108.973 134.031 86.298 1.00 0.00 O ATOM 2102 C LYS N 272 111.760 127.262 86.697 1.00 0.00 C ATOM 2103 CA LYS N 272 110.671 127.408 87.746 1.00 0.00 C ATOM 2104 CB LYS N 272 109.854 126.123 87.810 1.00 0.00 C ATOM 2105 CD LYS N 272 108.904 126.401 90.106 1.00 0.00 C ATOM 2106 CE LYS N 272 107.623 126.322 90.905 1.00 0.00 C ATOM 2107 CG LYS N 272 108.611 126.182 88.660 1.00 0.00 C ATOM 2108 N LYS N 272 109.816 128.535 87.424 1.00 0.00 N ATOM 2109 NZ LYS N 272 107.845 126.530 92.350 1.00 0.00 N ATOM 2110 O LYS N 272 111.665 126.402 85.830 1.00 0.00 O ATOM 2111 C ILE N 273 114.616 126.730 85.969 1.00 0.00 C ATOM 2112 CA ILE N 273 113.831 127.992 85.732 1.00 0.00 C ATOM 2113 CB ILE N 273 114.800 129.181 85.738 1.00 0.00 C ATOM 2114 CD1 ILE N 273 116.646 130.274 87.071 1.00 0.00 C ATOM 2115 CG1 ILE N 273 115.554 129.250 87.064 1.00 0.00 C ATOM 2116 CG2 ILE N 273 114.064 130.470 85.480 1.00 0.00 C ATOM 2117 N ILE N 273 112.790 128.090 86.749 1.00 0.00 N ATOM 2118 O ILE N 273 114.607 126.208 87.067 1.00 0.00 O ATOM 2119 C SER N 274 117.460 125.414 84.290 1.00 0.00 C ATOM 2120 CA SER N 274 116.236 125.152 85.140 1.00 0.00 C ATOM 2121 CB SER N 274 115.642 123.795 84.795 1.00 0.00 C ATOM 2122 N SER N 274 115.266 126.216 84.935 1.00 0.00 N ATOM 2123 O SER N 274 117.336 125.793 83.133 1.00 0.00 O ATOM 2124 OG SER N 274 115.345 123.724 83.415 1.00 0.00 O ATOM 2125 C PHE N 275 120.234 124.460 83.057 1.00 0.00 C ATOM 2126 CA PHE N 275 119.856 125.505 84.086 1.00 0.00 C ATOM 2127 CB PHE N 275 121.036 125.723 85.016 1.00 0.00 C ATOM 2128 CD1 PHE N 275 120.424 128.127 85.038 1.00 0.00 C ATOM 2129 CD2 PHE N 275 121.668 127.271 86.864 1.00 0.00 C ATOM 2130 CE1 PHE N 275 120.431 129.366 85.608 1.00 0.00 C ATOM 2131 CE2 PHE N 275 121.671 128.508 87.443 1.00 0.00 C ATOM 2132 CG PHE N 275 121.048 127.068 85.652 1.00 0.00 C ATOM 2133 CZ PHE N 275 121.052 129.559 86.815 1.00 0.00 C ATOM 2134 N PHE N 275 118.643 125.218 84.853 1.00 0.00 N ATOM 2135 O PHE N 275 119.942 123.279 83.207 1.00 0.00 O ATOM 2136 C ALA N 276 122.598 123.230 81.591 1.00 0.00 C ATOM 2137 CA ALA N 276 121.463 124.047 80.996 1.00 0.00 C ATOM 2138 CB ALA N 276 121.959 124.853 79.811 1.00 0.00 C ATOM 2139 N ALA N 276 120.896 124.925 82.004 1.00 0.00 N ATOM 2140 O ALA N 276 123.300 123.693 82.488 1.00 0.00 O ATOM 2141 C GLY N 277 123.870 120.733 82.942 1.00 0.00 C ATOM 2142 CA GLY N 277 123.899 121.188 81.499 1.00 0.00 C ATOM 2143 N GLY N 277 122.761 122.003 81.113 1.00 0.00 N ATOM 2144 O GLY N 277 123.935 119.542 83.232 1.00 0.00 O ATOM 2145 C VAL N 278 122.701 120.500 85.709 1.00 0.00 C ATOM 2146 CA VAL N 278 123.826 121.425 85.269 1.00 0.00 C ATOM 2147 CB VAL N 278 123.748 122.729 86.052 1.00 0.00 C ATOM 2148 CG1 VAL N 278 123.758 122.461 87.531 1.00 0.00 C ATOM 2149 CG2 VAL N 278 124.889 123.634 85.653 1.00 0.00 C ATOM 2150 N VAL N 278 123.766 121.693 83.847 1.00 0.00 N ATOM 2151 O VAL N 278 121.576 120.625 85.240 1.00 0.00 O ATOM 2152 C LYS N 279 122.293 118.200 88.623 1.00 0.00 C ATOM 2153 CA LYS N 279 122.266 118.434 87.093 1.00 0.00 C ATOM 2154 CB LYS N 279 122.696 117.173 86.350 1.00 0.00 C ATOM 2155 CD LYS N 279 122.717 115.904 84.174 1.00 0.00 C ATOM 2156 CE LYS N 279 121.718 114.856 84.636 1.00 0.00 C ATOM 2157 CG LYS N 279 122.463 117.242 84.850 1.00 0.00 C ATOM 2158 N LYS N 279 123.053 119.597 86.639 1.00 0.00 N ATOM 2159 NZ LYS N 279 121.960 113.522 84.020 1.00 0.00 N ATOM 2160 O LYS N 279 123.105 118.821 89.310 1.00 0.00 O ATOM 2161 C PHE N 280 122.110 115.862 91.064 1.00 0.00 C ATOM 2162 CA PHE N 280 121.227 117.043 90.584 1.00 0.00 C ATOM 2163 CB PHE N 280 119.768 116.778 90.931 1.00 0.00 C ATOM 2164 CD1 PHE N 280 118.146 118.596 91.497 1.00 0.00 C ATOM 2165 CD2 PHE N 280 118.685 118.230 89.208 1.00 0.00 C ATOM 2166 CE1 PHE N 280 117.295 119.619 91.132 1.00 0.00 C ATOM 2167 CE2 PHE N 280 117.837 119.253 88.835 1.00 0.00 C ATOM 2168 CG PHE N 280 118.845 117.889 90.538 1.00 0.00 C ATOM 2169 CZ PHE N 280 117.141 119.950 89.799 1.00 0.00 C ATOM 2170 N PHE N 280 121.378 117.359 89.139 1.00 0.00 N ATOM 2171 O PHE N 280 122.105 114.774 90.467 1.00 0.00 O ATOM 2602 C ALA N 339 120.464 128.840 79.943 1.00 0.00 C ATOM 2603 CA ALA N 339 121.554 129.338 79.013 1.00 0.00 C ATOM 2604 CB ALA N 339 121.199 129.029 77.578 1.00 0.00 C ATOM 2605 N ALA N 339 122.841 128.757 79.352 1.00 0.00 N ATOM 2606 O ALA N 339 120.396 127.658 80.263 1.00 0.00 O ATOM 2607 C VAL N 340 117.492 128.599 80.322 1.00 0.00 C ATOM 2608 CA VAL N 340 118.447 129.411 81.169 1.00 0.00 C ATOM 2609 CB VAL N 340 117.734 130.666 81.702 1.00 0.00 C ATOM 2610 CG1 VAL N 340 116.444 130.309 82.399 1.00 0.00 C ATOM 2611 CG2 VAL N 340 118.643 131.413 82.642 1.00 0.00 C ATOM 2612 N VAL N 340 119.609 129.757 80.376 1.00 0.00 N ATOM 2613 O VAL N 340 117.373 128.821 79.119 1.00 0.00 O ATOM 2614 C ASN N 341 114.499 127.022 81.166 1.00 0.00 C ATOM 2615 CA ASN N 341 115.761 126.908 80.322 1.00 0.00 C ATOM 2616 CB ASN N 341 116.146 125.449 80.130 1.00 0.00 C ATOM 2617 CG ASN N 341 115.213 124.731 79.202 1.00 0.00 C ATOM 2618 N ASN N 341 116.838 127.636 80.954 1.00 0.00 N ATOM 2619 ND2 ASN N 341 114.996 123.450 79.455 1.00 0.00 N ATOM 2620 O ASN N 341 114.354 126.315 82.161 1.00 0.00 O ATOM 2621 OD1 ASN N 341 114.676 125.323 78.268 1.00 0.00 O ATOM 2622 C ILE N 342 111.425 126.940 81.377 1.00 0.00 C ATOM 2623 CA ILE N 342 112.363 128.130 81.513 1.00 0.00 C ATOM 2624 CB ILE N 342 111.639 129.408 81.044 1.00 0.00 C ATOM 2625 CD1 ILE N 342 111.812 131.926 81.022 1.00 0.00 C ATOM 2626 CG1 ILE N 342 112.389 130.643 81.531 1.00 0.00 C ATOM 2627 CG2 ILE N 342 110.218 129.459 81.550 1.00 0.00 C ATOM 2628 N ILE N 342 113.615 127.943 80.794 1.00 0.00 N ATOM 2629 O ILE N 342 111.219 126.417 80.289 1.00 0.00 O ATOM 2630 C LEU N 343 108.457 125.498 82.528 1.00 0.00 C ATOM 2631 CA LEU N 343 109.977 125.339 82.513 1.00 0.00 C ATOM 2632 CB LEU N 343 110.373 124.459 83.691 1.00 0.00 C ATOM 2633 CD1 LEU N 343 112.060 123.086 84.901 1.00 0.00 C ATOM 2634 CD2 LEU N 343 111.765 122.813 82.425 1.00 0.00 C ATOM 2635 CG LEU N 343 111.736 123.787 83.591 1.00 0.00 C ATOM 2636 N LEU N 343 110.810 126.539 82.484 1.00 0.00 N ATOM 2637 O LEU N 343 107.761 124.516 82.764 1.00 0.00 O END """) s_apar_records1 = """\ SHEET 1 A 2 TYR A 2 VAL A 7 0 SHEET 2 A 2 MET A 31 SER A 36 -1 O ALA A 36 N ALA A 2 """ s_apar_records2 = """\ SHEET 1 A 2 TYR A 2 VAL A 7 0 SHEET 2 A 2 MET A 31 SER A 36 -1 O ALA A 32 N ALA A 6 """ s_par_records1 = """\ SHEET 1 B 2 ALA A 15 THR A 21 0 SHEET 2 B 2 GLN A 40 ALA A 46 1 O GLN A 40 N THR A 16 """ s_par_records2 = """\ SHEET 1 B 2 ALA A 15 THR A 21 0 SHEET 2 B 2 GLN A 40 ALA A 46 1 O GLN A 44 N THR A 20 """ s_par_records3 = """\ SHEET 1 B 2 ALA A 15 THR A 21 0 SHEET 2 B 2 GLN A 40 ALA A 46 1 N GLN A 42 O THR A 16 """ s_par_records4 = """\ SHEET 1 B 2 ALA A 15 THR A 21 0 SHEET 2 B 2 GLN A 40 ALA A 46 1 N GLN A 46 O THR A 20 """ s_par_records5 = """\ SHEET 1 B 2 GLN A 40 ALA A 46 0 SHEET 2 B 2 ALA A 15 THR A 21 1 O THR A 20 N ALA A 46 """ s_par_records6 = """\ SHEET 1 B 2 GLN A 40 ALA A 46 0 SHEET 2 B 2 ALA A 15 THR A 21 1 N THR A 20 O ALA A 44 """ s_par_records7 = """\ SHEET 1 B 2 GLN A 40 ALA A 46 0 SHEET 2 B 2 ALA A 15 THR A 21 1 N THR A 16 O GLN A 40 """ s_par_records8 = """\ SHEET 1 B 2 GLN A 40 ALA A 46 0 SHEET 2 B 2 ALA A 15 THR A 21 1 O THR A 16 N ALA A 42 """ s_apar_records3 = """\ SHEET 1 D 2 LYS N 272 LYS N 279 0 SHEET 2 D 2 VAL N 340 ILE N 342 -1 N ASN N 341 O SER N 274 """ s_par_records9 = """\ SHEET 1 B 2 SER A 44 ALA A 46 0 SHEET 2 B 2 ALA A 15 THR A 21 1 N THR A 20 O SER A 44 """ s_par_records10 = """\ SHEET 1 B 2 GLN A 40 ALA A 46 0 SHEET 2 B 2 SER A 18 THR A 21 1 N THR A 20 O SER A 44 """ s_par_records11 = """\ SHEET 1 B 2 GLN A 40 ALA A 46 0 SHEET 2 B 2 ALA A 19 THR A 21 1 N THR A 20 O SER A 44 """ s_par_records12 = """\ SHEET 1 B 2 GLN A 40 ALA A 46 0 SHEET 2 B 2 THR A 20 THR A 21 1 O THR A 20 N ALA A 46 """ log = null_out() # defpars = sec_str_master_phil n_hbonds = [] n_hangles = [] for pdb_inp, recs in [ (pdb_apar_input, s_apar_records1), (pdb_apar_input, s_apar_records2), (pdb_par_input, s_par_records1), (pdb_par_input, s_par_records2), (pdb_par_input, s_par_records3), (pdb_par_input, s_par_records4), (pdb_par_input, s_par_records5), (pdb_par_input, s_par_records6), (pdb_par_input, s_par_records7), (pdb_par_input, s_par_records8), (pdb_apar2_input, s_apar_records3), (pdb_par_input, s_par_records9), (pdb_par_input, s_par_records10), (pdb_par_input, s_par_records11), (pdb_par_input, s_par_records12), (pdb_par_ac_input, s_par_records1), # 8 hbonds ]: ioss_annotation = ioss.annotation.from_records(records = recs.split('\n')) ann = ioss_annotation.as_restraint_groups(prefix_scope="secondary_structure") defpars = iotbx.phil.parse(sec_str_master_phil_str) custom_pars = defpars.fetch(iotbx.phil.parse(ann)) custom_pars_ex = custom_pars.extract() ss_manager = manager( pdb_inp.hierarchy, sec_str_from_pdb_file=None, params=custom_pars_ex.secondary_structure, verbose=-1) proxies_for_grm, h_angles = ss_manager.create_protein_hbond_proxies( annotation= None, log = log) # print proxies_for_grm.size() n_hbonds.append(proxies_for_grm.size()) n_hangles.append(h_angles.size()) print(n_hbonds, n_hangles) assert n_hbonds == [6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 3, 4, 2, 2, 8] assert n_hangles ==[15, 15, 18, 18, 18, 18, 18, 18, 18, 18, 6, 6, 9, 6, 3, 24] def exercise_segid(): if (not libtbx.env.has_module(name="ksdssp")): print("KSDSSP not available, skipping exercise_segid()") return pdb_par_segid_input = iotbx.pdb.hierarchy.input(pdb_string = """\ CRYST1 46.460 46.460 193.210 90.00 90.00 120.00 P 31 2 1 SCALE1 0.021524 0.012427 0.000000 0.00000 SCALE2 0.000000 0.024854 0.000000 0.00000 SCALE3 0.000000 0.000000 0.005176 0.00000 ATOM 67 N ALA A 15 5.011 -5.031 -8.967 1.00 5.73 N ATOM 68 CA ALA A 15 4.943 -6.455 -9.287 1.00 6.16 C ATOM 69 C ALA A 15 5.610 -7.252 -8.166 1.00 6.39 C ATOM 70 O ALA A 15 6.751 -7.007 -7.857 1.00 9.87 O ATOM 71 CB ALA A 15 5.684 -6.739 -10.604 1.00 7.46 C ATOM 72 N THR A 16 4.929 -8.263 -7.636 1.00 5.49 N ATOM 73 C THR A 16 5.316 -10.600 -7.084 1.00 5.07 C ATOM 74 O THR A 16 4.214 -11.002 -7.422 1.00 6.51 O ATOM 75 CA THR A 16 5.513 -9.172 -6.657 1.00 5.70 C ATOM 76 CB THR A 16 4.864 -9.001 -5.276 1.00 8.31 C ATOM 77 N GLY A 17 6.393 -11.375 -7.067 1.00 4.56 N ATOM 78 CA GLY A 17 6.325 -12.770 -7.439 1.00 4.26 C ATOM 79 C GLY A 17 7.219 -13.654 -6.621 1.00 4.41 C ATOM 80 O GLY A 17 8.263 -13.233 -6.114 1.00 5.01 O ATOM 81 N SER A 18 6.827 -14.921 -6.561 1.00 4.24 N ATOM 82 CA SER A 18 7.657 -15.945 -5.959 1.00 4.02 C ATOM 83 C SER A 18 7.539 -17.244 -6.724 1.00 3.64 C ATOM 84 O SER A 18 6.482 -17.526 -7.331 1.00 4.07 O ATOM 85 CB SER A 18 7.335 -16.157 -4.481 1.00 5.86 C ATOM 86 N ALA A 19 8.573 -18.049 -6.627 1.00 3.19 N ATOM 87 CA ALA A 19 8.578 -19.414 -7.195 1.00 3.31 C ATOM 88 C ALA A 19 9.370 -20.307 -6.238 1.00 3.20 C ATOM 89 O ALA A 19 10.484 -19.956 -5.817 1.00 4.21 O ATOM 90 CB ALA A 19 9.235 -19.415 -8.574 1.00 3.85 seg C ATOM 91 N THR A 20 8.825 -21.476 -5.940 1.00 3.77 seg N ATOM 92 CA THR A 20 9.478 -22.432 -5.047 1.00 3.70 seg C ATOM 93 C THR A 20 9.444 -23.827 -5.640 1.00 3.56 seg C ATOM 94 O THR A 20 8.383 -24.281 -6.108 1.00 4.14 seg O ATOM 95 CB THR A 20 8.787 -22.430 -3.673 1.00 4.76 seg C ATOM 96 N THR A 21 10.560 -24.542 -5.569 1.00 4.00 seg N ATOM 97 CA THR A 21 10.597 -25.962 -5.876 1.00 4.05 seg C ATOM 98 C THR A 21 10.984 -26.770 -4.636 1.00 4.53 seg C ATOM 99 O THR A 21 11.770 -26.361 -3.802 1.00 5.04 seg O ATOM 100 CB THR A 21 11.488 -26.293 -7.083 1.00 4.38 seg C ATOM 189 N GLN A 40 0.280 -6.099 -9.049 1.00 6.35 seg N ATOM 190 CA GLN A 40 0.087 -7.454 -9.580 1.00 6.35 seg C ATOM 191 C GLN A 40 0.964 -8.417 -8.788 1.00 6.09 seg C ATOM 192 O GLN A 40 2.080 -8.093 -8.393 1.00 6.87 seg O ATOM 193 CB GLN A 40 0.461 -7.523 -11.060 1.00 7.52 seg C ATOM 194 N THR A 41 0.419 -9.596 -8.544 1.00 6.66 seg N ATOM 195 CA THR A 41 1.108 -10.640 -7.800 1.00 6.93 seg C ATOM 196 C THR A 41 0.932 -12.005 -8.414 1.00 6.82 seg C ATOM 197 O THR A 41 -0.069 -12.258 -9.104 1.00 8.79 seg O ATOM 198 CB THR A 41 0.633 -10.636 -6.352 1.00 10.84 seg C ATOM 199 N ALA A 42 1.951 -12.847 -8.263 1.00 6.44 seg N ATOM 200 CA ALA A 42 1.923 -14.209 -8.797 1.00 6.59 seg C ATOM 201 C ALA A 42 2.829 -15.117 -7.992 1.00 5.51 seg C ATOM 202 O ALA A 42 3.835 -14.684 -7.420 1.00 5.94 seg O ATOM 203 CB ALA A 42 2.327 -14.218 -10.264 1.00 9.02 seg C ATOM 204 N LYS A 43 2.479 -16.398 -7.978 1.00 6.26 seg N ATOM 205 CA LYS A 43 3.247 -17.395 -7.256 1.00 6.48 seg C ATOM 206 C LYS A 43 3.186 -18.741 -7.955 1.00 5.78 seg C ATOM 207 O LYS A 43 2.206 -19.041 -8.623 1.00 9.40 seg O ATOM 208 CB LYS A 43 2.727 -17.535 -5.836 1.00 8.81 seg C ATOM 209 N SER A 44 4.243 -19.534 -7.818 1.00 4.43 seg N ATOM 210 CA SER A 44 4.241 -20.890 -8.325 1.00 4.28 seg C ATOM 211 C SER A 44 4.998 -21.811 -7.358 1.00 4.09 seg C ATOM 212 O SER A 44 5.865 -21.377 -6.584 1.00 4.53 seg O ATOM 213 CB SER A 44 4.831 -20.949 -9.731 1.00 5.33 seg C ATOM 214 N PHE A 45 4.660 -23.091 -7.444 1.00 4.39 seg N ATOM 215 CA PHE A 45 5.198 -24.135 -6.576 1.00 4.44 seg C ATOM 216 C PHE A 45 5.222 -25.415 -7.389 1.00 4.16 seg C ATOM 217 O PHE A 45 4.183 -25.754 -7.979 1.00 5.11 seg O ATOM 218 CB PHE A 45 4.254 -24.281 -5.370 1.00 5.22 seg C ATOM 219 N ALA A 46 6.347 -26.119 -7.403 1.00 3.62 seg N ATOM 220 CA ALA A 46 6.443 -27.338 -8.202 1.00 3.99 seg C ATOM 221 C ALA A 46 7.579 -28.205 -7.717 1.00 4.57 seg C ATOM 222 O ALA A 46 8.479 -27.750 -7.000 1.00 4.79 seg O ATOM 223 CB ALA A 46 6.607 -27.026 -9.678 1.00 4.52 seg C TER END """) log = null_out() defpars = iotbx.phil.parse(sec_str_master_phil_str) custom_pars = defpars.extract() custom_pars.secondary_structure.enabled=True # custom_pars = defpars.fetch(iotbx.phil.parse("secondary_structure_restraints=True")) ss_manager = manager( pdb_par_segid_input.hierarchy, sec_str_from_pdb_file=None, params=custom_pars.secondary_structure, verbose=-1) ss_manager.initialize() proxies_for_grm, h_angles = ss_manager.create_protein_hbond_proxies( annotation = None, log = log) assert proxies_for_grm.size() == 4 assert h_angles.size() == 12 def exercise_phil_generation(): log = null_out() defpars = sec_str_master_phil.fetch() if __name__ == "__main__" : exercise_protein() exercise_sheet_ends() exercise_helix_bonding_pattern() exercise_sheets_bonding_pattern() # exercise_segid() # appeared to be nonvalid test... now when we don't ignore # segid in SS, we cannot construct SHEET situated in two different segids... print("OK")
[ "jorge7soccer@gmail.com" ]
jorge7soccer@gmail.com
a0b669ed46c14af32a2247e902baa46765a173b6
c47b68a858e01d5fe51661a8ded5138652d3082e
/src/exploration/businees_cases/prdicting_hiring.py
7df6f68f3af533048d5e6e5dc147841479515439
[]
no_license
RitGlv/Practice_Makes_perfect
d2d50efbf810b41d0648f27d02b5710c14c3fcae
3dcb7ff876e58ade64faed0fa5523cba7461cf8d
refs/heads/master
2021-03-13T03:51:43.142777
2017-06-05T07:32:47
2017-06-05T07:32:47
91,500,946
0
0
null
null
null
null
UTF-8
Python
false
false
129
py
import pandas as pd from sklearn.linear_model import LogisticRegression import sys sys.path.insert(0, '../../') import featurize
[ "johndoe@example.com" ]
johndoe@example.com
37fa900821ba826c4e1fdb9d424671d44d8c8280
46fe894c4a8e14727bd085c5834a2acfbe5cd41f
/blogproject/urls.py
a3fd92bc1bfdbc87607115ccf80d146a61b27b18
[]
no_license
PriyaRamya11/React-Django-Blog-Backend
6970ac443d0f44d5d16ea0738f16546eb50879a9
491629fac3cf5d6fae0a3f59b7a47e353ed9407c
refs/heads/master
2023-04-27T20:26:13.818306
2021-05-05T11:27:13
2021-05-05T11:27:13
null
0
0
null
null
null
null
UTF-8
Python
false
false
582
py
from django.shortcuts import render from django.contrib import admin from django.urls import path from django.urls.conf import include from rest_framework.response import Response from rest_framework.decorators import api_view from django.conf.urls.static import static from django.conf import settings # url patterns of the entire project urlpatterns = [ path('admin/', admin.site.urls), path('api/', include('accounts.urls')), # blog url configuration path('api/blog/', include('blog.urls')) ]+static(settings.MEDIA_URL, document_root = settings.MEDIA_ROOT)
[ "kumar.ankit383@gmail.com" ]
kumar.ankit383@gmail.com
8061be7dbac8f6e43df70f6a483d6d89690445f2
52a3beeb07ad326115084a47a9e698efbaec054b
/manila/api/contrib/services.py
607903fef8b780fbb6222f72ce62af1c9d0d53a4
[]
no_license
bopopescu/sample_scripts
3dade0710ecdc8f9251dc60164747830f8de6877
f9edce63c0a4d636f672702153662bd77bfd400d
refs/heads/master
2022-11-17T19:19:34.210886
2018-06-11T04:14:27
2018-06-11T04:14:27
282,088,840
0
0
null
2020-07-24T00:57:31
2020-07-24T00:57:31
null
UTF-8
Python
false
false
3,444
py
# Copyright 2012 IBM Corp. # All Rights Reserved. # # 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. from oslo_log import log import webob.exc from manila.api import extensions from manila import db from manila import exception from manila import utils LOG = log.getLogger(__name__) authorize = extensions.extension_authorizer('share', 'services') class ServiceController(object): def index(self, req): """Return a list of all running services.""" context = req.environ['manila.context'] authorize(context) all_services = db.service_get_all(context) services = [] for service in all_services: service = { 'id': service['id'], 'binary': service['binary'], 'host': service['host'], 'zone': service['availability_zone']['name'], 'status': 'disabled' if service['disabled'] else 'enabled', 'state': 'up' if utils.service_is_up(service) else 'down', 'updated_at': service['updated_at'], } services.append(service) search_opts = [ 'host', 'binary', 'zone', 'state', 'status', ] for search_opt in search_opts: value = '' if search_opt in req.GET: value = req.GET[search_opt] services = [s for s in services if s[search_opt] == value] if len(services) == 0: break return {'services': services} def update(self, req, id, body): """Enable/Disable scheduling for a service.""" context = req.environ['manila.context'] authorize(context) if id == "enable": disabled = False elif id == "disable": disabled = True else: raise webob.exc.HTTPNotFound("Unknown action") try: host = body['host'] binary = body['binary'] except (TypeError, KeyError): raise webob.exc.HTTPBadRequest() try: svc = db.service_get_by_args(context, host, binary) if not svc: raise webob.exc.HTTPNotFound('Unknown service') db.service_update(context, svc['id'], {'disabled': disabled}) except exception.ServiceNotFound: raise webob.exc.HTTPNotFound("service not found") return {'host': host, 'binary': binary, 'disabled': disabled} class Services(extensions.ExtensionDescriptor): """Services support.""" name = "Services" alias = "os-services" updated = "2012-10-28T00:00:00-00:00" def get_resources(self): resources = [] resource = extensions.ResourceExtension('os-services', ServiceController()) resources.append(resource) return resources
[ "Suhaib.Chishti@exponential.com" ]
Suhaib.Chishti@exponential.com
8463c8c53648a7ad7c984f04467593a429195089
43459d0a1b5c8d1b631ef3edb91b6a7bb1b26078
/venv/Lib/site-packages/npx/_isin.py
0e1d06123de282476de66018f3bbaa87bfe74931
[]
no_license
titusowuor30/dj_rest_jwt_auth_api
2ee5046b043d34d88c0fad344d9bb6525513ee90
ee33e33ed2f5852d5882cbc7b694e7ca9be7e7da
refs/heads/master
2023-07-16T21:42:08.820624
2021-08-28T07:50:47
2021-08-28T07:50:47
400,724,458
1
0
null
null
null
null
UTF-8
Python
false
false
808
py
import numpy as np import numpy.typing as npt def isin_rows(a: npt.ArrayLike, b: npt.ArrayLike): a = np.asarray(a) b = np.asarray(b) if not np.issubdtype(a.dtype, np.integer): raise ValueError(f"Input array must be integer type, got {a.dtype}.") if not np.issubdtype(b.dtype, np.integer): raise ValueError(f"Input array must be integer type, got {b.dtype}.") a = a.reshape(a.shape[0], np.prod(a.shape[1:], dtype=int)) b = b.reshape(b.shape[0], np.prod(b.shape[1:], dtype=int)) a_view = np.ascontiguousarray(a).view( np.dtype((np.void, a.dtype.itemsize * a.shape[1])) ) b_view = np.ascontiguousarray(b).view( np.dtype((np.void, b.dtype.itemsize * b.shape[1])) ) out = np.isin(a_view, b_view) return out.reshape(a.shape[0])
[ "titusowuor30@gmail.com" ]
titusowuor30@gmail.com
f10d82d87ec02eb5ee78e0ebf6c735f5ed119466
4252102a1946b2ba06d3fa914891ec7f73570287
/pylearn2/optimization/test_linear_cg.py
e82e497ee222a16178c381ee0164f0fb565e9b2a
[]
no_license
lpigou/chalearn2014
21d487f314c4836dd1631943e20f7ab908226771
73b99cdbdb609fecff3cf85e500c1f1bfd589930
refs/heads/master
2020-05-17T00:08:11.764642
2014-09-24T14:42:00
2014-09-24T14:42:00
24,418,815
2
3
null
null
null
null
UTF-8
Python
false
false
1,261
py
import theano from theano import tensor, config import numpy import linear_cg import warnings from pylearn2.testing.skip import skip_if_no_scipy try: import scipy.linalg except ImportError: warnings.warn("Could not import scipy.linalg") import time def test_linear_cg(): rng = numpy.random.RandomState([1,2,3]) n = 5 M = rng.randn(2*n,n) M = numpy.dot(M.T,M).astype(config.floatX) b = rng.randn(n).astype(config.floatX) c = rng.randn(1).astype(config.floatX)[0] x = theano.tensor.vector('x') f = 0.5 * tensor.dot(x,tensor.dot(M,x)) - tensor.dot(b,x) + c sol = linear_cg.linear_cg(f,[x]) fn_sol = theano.function([x], sol) start = time.time() sol = fn_sol( rng.randn(n).astype(config.floatX))[0] my_lcg = time.time() -start eval_f = theano.function([x],f) cgf = eval_f(sol) print "conjugate gradient's value of f:", str(cgf), 'time (s)', my_lcg skip_if_no_scipy() spf = eval_f( scipy.linalg.solve(M,b) ) print "scipy.linalg.solve's value of f: "+str(spf) abs_diff = abs(cgf - spf) if not (abs_diff < 1e-5): raise AssertionError("Expected abs_diff < 1e-5, got abs_diff of " + str(abs_diff)) if __name__ == '__main__': test_linear_cg()
[ "lionelpigou@gmail.com" ]
lionelpigou@gmail.com
4af9aaf42d7bc296c64d1dd79d632048cc5126bf
26f8a8782a03693905a2d1eef69a5b9f37a07cce
/test/test_destiny_destiny_item_type.py
371104552534d46e48c0251fd4f89eb10524e339
[]
no_license
roscroft/openapi3-swagger
60975db806095fe9eba6d9d800b96f2feee99a5b
d1c659c7f301dcfee97ab30ba9db0f2506f4e95d
refs/heads/master
2021-06-27T13:20:53.767130
2017-08-31T17:09:40
2017-08-31T17:09:40
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,119
py
# coding: utf-8 """ Bungie.Net API These endpoints constitute the functionality exposed by Bungie.net, both for more traditional website functionality and for connectivity to Bungie video games and their related functionality. OpenAPI spec version: 2.0.0 Contact: support@bungie.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import os import sys import unittest import swagger_client from swagger_client.rest import ApiException from swagger_client.models.destiny_destiny_item_type import DestinyDestinyItemType class TestDestinyDestinyItemType(unittest.TestCase): """ DestinyDestinyItemType unit test stubs """ def setUp(self): pass def tearDown(self): pass def testDestinyDestinyItemType(self): """ Test DestinyDestinyItemType """ # FIXME: construct object with mandatory attributes with example values #model = swagger_client.models.destiny_destiny_item_type.DestinyDestinyItemType() pass if __name__ == '__main__': unittest.main()
[ "adherrling@gmail.com" ]
adherrling@gmail.com
ee940c77343f60e39daed05d2f53ca1ce16cc5ba
6b2a8dd202fdce77c971c412717e305e1caaac51
/solutions_6404600001200128_1/Python/Alen/caseA.py
3f71933f6070b75b35a50b9393416fc77c08e182
[]
no_license
alexandraback/datacollection
0bc67a9ace00abbc843f4912562f3a064992e0e9
076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf
refs/heads/master
2021-01-24T18:27:24.417992
2017-05-23T09:23:38
2017-05-23T09:23:38
84,313,442
2
4
null
null
null
null
UTF-8
Python
false
false
1,583
py
#!/usr/bin/env python # encoding: utf-8 def way1(samples): if len(samples) < 2: return 0 min_pieces = 0 last_pieces = samples[0] for s in samples[1:]: if s < last_pieces: min_pieces += last_pieces - s last_pieces = s return min_pieces def way2(samples): if len(samples) < 2: return 0 last_pieces = samples[0] max_eaten_pieces = 0 for s in samples[1:]: if s < last_pieces: max_eaten_pieces = max(max_eaten_pieces, last_pieces - s) last_pieces = s min_pieces = 0 last_pieces = samples[0] for s in samples[1:]: if s < last_pieces: min_pieces += min(max(max_eaten_pieces, last_pieces - s), last_pieces) else: min_pieces += min(max_eaten_pieces, last_pieces) last_pieces = s return min_pieces def run(inputFile, outputFile): fp = open(inputFile, 'r') fw = open(outputFile, 'w') caseIndex = 0 count = -1 sampleCount = 0 for line in fp: if (caseIndex == 0): count = int(line) caseIndex += 1 elif sampleCount == 0: sampleCount = int(line) else: samples_strs = line.split(' ') samples = [int(s) for s in samples_strs] fw.write("Case #%d: %d %d\n" % (caseIndex, way1(samples), way2(samples))) caseIndex += 1 count -= 1 sampleCount = 0 if (count == 0): break fp.close() fw.close() if __name__ == "__main__": run("in", "out")
[ "eewestman@gmail.com" ]
eewestman@gmail.com
78da60a4d142b5f6f724959fb430c94449b06674
de24f83a5e3768a2638ebcf13cbe717e75740168
/moodledata/vpl_data/429/usersdata/310/107206/submittedfiles/jogoDaVelha.py
78481b58610ef63879d65bf7ebf7d7ab7d63160b
[]
no_license
rafaelperazzo/programacao-web
95643423a35c44613b0f64bed05bd34780fe2436
170dd5440afb9ee68a973f3de13a99aa4c735d79
refs/heads/master
2021-01-12T14:06:25.773146
2017-12-22T16:05:45
2017-12-22T16:05:45
69,566,344
0
0
null
null
null
null
UTF-8
Python
false
false
1,926
py
# -*- coding: utf-8 -*- from jogoDaVelha_BIB import * # COLOQUE SEU PROGRAMA A PARTIR DAQUI jgnov = 'S' while jgnov == 'S' or jgnov == 's' or jgnov == 'SIM' or jgnov == 'sim': print('Bem vindo ao JogoDaVelha do grupo D [Anderson Bezerra, Caio César, Laura, Juan]') nome = input('\nQual o seu nome (ou apelido)? ') jogador = 2 smbH = 0 smbH = solicitaSimbolodoHumano(smbH) if smbH == ' X ': smbPC = ' O ' else: smbPC = ' X ' jogador = sorteioPrimeiraJogada(jogador, nome) tabuleiro = [ [' ',' ',' '], [' ',' ',' '], [' ',' ',' '] ] som = 0 while True: if jogador == 1: while True: JogadaHumana(smbH,tabuleiro, nome) break if verificaVencedor(smbH, tabuleiro, som): if verificaVencedor(smbH, tabuleiro, som) == 20: mostraTabuleiro(tabuleiro) print ('\nDeu Velha') break else: mostraTabuleiro(tabuleiro) print('\nVencedor: %s'%nome) break jogador = 0 else: tabuleiro = JogadaComputador(smbPC,tabuleiro) if verificaVencedor(smbPC, tabuleiro, som): if verificaVencedor(smbPC, tabuleiro, som) == 20: mostraTabuleiro(tabuleiro) print ('\nDeu Velha') break else: mostraTabuleiro(tabuleiro) print ('\nVencedor: Computador') break jogador = 1 jgnov = input('\nCaso queira jogar novamente, digite s ou sim: ') if jgnov == 'S' or jgnov == 's' or jgnov == 'SIM' or jgnov == 'sim': os.system('clear')
[ "rafael.mota@ufca.edu.br" ]
rafael.mota@ufca.edu.br
43ba8431d79ecc5a112551746e9e34f7d85e7c9c
cb415e8914a4432466b984c2d9cfd3bc66165c6c
/tensorflow_asr/models/transducer.py
d5d865a462736bb0f0433ff7735cc862dbe194a2
[ "Apache-2.0" ]
permissive
enormous-system/TensorFlowASR
d319505d27cf55dd1893299e088980434181d932
dbe95e7a121db9d9c1c30357e584bfbab65e8538
refs/heads/main
2023-02-03T01:45:20.025702
2020-12-20T11:34:40
2020-12-20T11:34:40
null
0
0
null
null
null
null
UTF-8
Python
false
false
29,241
py
# Copyright 2020 Huy Le Nguyen (@usimarit) # # 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. """ https://arxiv.org/pdf/1811.06621.pdf """ import collections from typing import Optional import tensorflow as tf from . import Model from ..utils.utils import get_rnn, shape_list from ..featurizers.speech_featurizers import SpeechFeaturizer from ..featurizers.text_featurizers import TextFeaturizer from .layers.embedding import Embedding Hypothesis = collections.namedtuple( "Hypothesis", ("index", "prediction", "states") ) BeamHypothesis = collections.namedtuple( "BeamHypothesis", ("score", "indices", "prediction", "states") ) class TransducerPrediction(tf.keras.Model): def __init__(self, vocabulary_size: int, embed_dim: int, embed_dropout: float = 0, num_rnns: int = 1, rnn_units: int = 512, rnn_type: str = "lstm", rnn_implementation: int = 2, layer_norm: bool = True, projection_units: int = 0, kernel_regularizer=None, bias_regularizer=None, name="transducer_prediction", **kwargs): super(TransducerPrediction, self).__init__(name=name, **kwargs) self.embed = Embedding(vocabulary_size, embed_dim, regularizer=kernel_regularizer, name=f"{name}_embedding") self.do = tf.keras.layers.Dropout(embed_dropout, name=f"{name}_dropout") # Initialize rnn layers RNN = get_rnn(rnn_type) self.rnns = [] for i in range(num_rnns): rnn = RNN( units=rnn_units, return_sequences=True, name=f"{name}_lstm_{i}", return_state=True, implementation=rnn_implementation, kernel_regularizer=kernel_regularizer, bias_regularizer=bias_regularizer ) if layer_norm: ln = tf.keras.layers.LayerNormalization(name=f"{name}_ln_{i}") else: ln = None if projection_units > 0: projection = tf.keras.layers.Dense( projection_units, name=f"{name}_projection_{i}", kernel_regularizer=kernel_regularizer, bias_regularizer=bias_regularizer ) else: projection = None self.rnns.append({"rnn": rnn, "ln": ln, "projection": projection}) def get_initial_state(self): """Get zeros states Returns: tf.Tensor: states having shape [num_rnns, 1 or 2, B, P] """ states = [] for rnn in self.rnns: states.append( tf.stack( rnn["rnn"].get_initial_state( tf.zeros([1, 1, 1], dtype=tf.float32) ), axis=0 ) ) return tf.stack(states, axis=0) def call(self, inputs, training=False, **kwargs): # inputs has shape [B, U] # use tf.gather_nd instead of tf.gather for tflite conversion outputs, prediction_length = inputs outputs = self.embed(outputs, training=training) outputs = self.do(outputs, training=training) for rnn in self.rnns: mask = tf.sequence_mask(prediction_length) outputs = rnn["rnn"](outputs, training=training, mask=mask) outputs = outputs[0] if rnn["ln"] is not None: outputs = rnn["ln"](outputs, training=training) if rnn["projection"] is not None: outputs = rnn["projection"](outputs, training=training) return outputs def recognize(self, inputs, states): """Recognize function for prediction network Args: inputs (tf.Tensor): shape [1, 1] states (tf.Tensor): shape [num_lstms, 2, B, P] Returns: tf.Tensor: outputs with shape [1, 1, P] tf.Tensor: new states with shape [num_lstms, 2, 1, P] """ outputs = self.embed(inputs, training=False) outputs = self.do(outputs, training=False) new_states = [] for i, rnn in enumerate(self.rnns): outputs = rnn["rnn"](outputs, training=False, initial_state=tf.unstack(states[i], axis=0)) new_states.append(tf.stack(outputs[1:])) outputs = outputs[0] if rnn["ln"] is not None: outputs = rnn["ln"](outputs, training=False) if rnn["projection"] is not None: outputs = rnn["projection"](outputs, training=False) return outputs, tf.stack(new_states, axis=0) def get_config(self): conf = self.embed.get_config() conf.update(self.do.get_config()) for rnn in self.rnns: conf.update(rnn["rnn"].get_config()) if rnn["ln"] is not None: conf.update(rnn["ln"].get_config()) if rnn["projection"] is not None: conf.update(rnn["projection"].get_config()) return conf class TransducerJoint(tf.keras.Model): def __init__(self, vocabulary_size: int, joint_dim: int = 1024, kernel_regularizer=None, bias_regularizer=None, name="tranducer_joint", **kwargs): super(TransducerJoint, self).__init__(name=name, **kwargs) self.ffn_enc = tf.keras.layers.Dense( joint_dim, name=f"{name}_enc", kernel_regularizer=kernel_regularizer, bias_regularizer=bias_regularizer ) self.ffn_pred = tf.keras.layers.Dense( joint_dim, use_bias=False, name=f"{name}_pred", kernel_regularizer=kernel_regularizer ) self.ffn_out = tf.keras.layers.Dense( vocabulary_size, name=f"{name}_vocab", kernel_regularizer=kernel_regularizer, bias_regularizer=bias_regularizer ) def call(self, inputs, training=False, **kwargs): # enc has shape [B, T, E] # pred has shape [B, U, P] enc_out, pred_out = inputs enc_out = self.ffn_enc(enc_out, training=training) # [B, T, E] => [B, T, V] pred_out = self.ffn_pred(pred_out, training=training) # [B, U, P] => [B, U, V] enc_out = tf.expand_dims(enc_out, axis=2) pred_out = tf.expand_dims(pred_out, axis=1) outputs = tf.nn.tanh(enc_out + pred_out) # => [B, T, U, V] outputs = self.ffn_out(outputs, training=training) return outputs def get_config(self): conf = self.ffn_enc.get_config() conf.update(self.ffn_pred.get_config()) conf.update(self.ffn_out.get_config()) return conf class Transducer(Model): """ Transducer Model Warper """ def __init__(self, encoder: tf.keras.Model, vocabulary_size: int, embed_dim: int = 512, embed_dropout: float = 0, num_rnns: int = 1, rnn_units: int = 320, rnn_type: str = "lstm", rnn_implementation: int = 2, layer_norm: bool = True, projection_units: int = 0, joint_dim: int = 1024, kernel_regularizer=None, bias_regularizer=None, name="transducer", **kwargs): super(Transducer, self).__init__(name=name, **kwargs) self.encoder = encoder self.predict_net = TransducerPrediction( vocabulary_size=vocabulary_size, embed_dim=embed_dim, embed_dropout=embed_dropout, num_rnns=num_rnns, rnn_units=rnn_units, rnn_type=rnn_type, rnn_implementation=rnn_implementation, layer_norm=layer_norm, projection_units=projection_units, kernel_regularizer=kernel_regularizer, bias_regularizer=bias_regularizer, name=f"{name}_prediction" ) self.joint_net = TransducerJoint( vocabulary_size=vocabulary_size, joint_dim=joint_dim, kernel_regularizer=kernel_regularizer, bias_regularizer=bias_regularizer, name=f"{name}_joint" ) def _build(self, input_shape): inputs = tf.keras.Input(shape=input_shape, dtype=tf.float32) input_length = tf.keras.Input(shape=[], dtype=tf.int32) pred = tf.keras.Input(shape=[None], dtype=tf.int32) pred_length = tf.keras.Input(shape=[], dtype=tf.int32) self([inputs, input_length, pred, pred_length], training=False) def summary(self, line_length=None, **kwargs): self.predict_net.summary(line_length=line_length, **kwargs) self.joint_net.summary(line_length=line_length, **kwargs) super(Transducer, self).summary(line_length=line_length, **kwargs) def add_featurizers(self, speech_featurizer: SpeechFeaturizer, text_featurizer: TextFeaturizer): """ Function to add featurizer to model to convert to end2end tflite Args: speech_featurizer: SpeechFeaturizer instance text_featurizer: TextFeaturizer instance scorer: external language model scorer """ self.speech_featurizer = speech_featurizer self.text_featurizer = text_featurizer def call(self, inputs, training=False, **kwargs): """ Transducer Model call function Args: features: audio features in shape [B, T, F, C] input_length: features time length in shape [B] prediction: predicted sequence of ids, in shape [B, U] prediction_length: predicted sequence of ids length in shape [B] training: python boolean **kwargs: sth else Returns: `logits` with shape [B, T, U, vocab] """ features, _, prediction, prediction_length = inputs enc = self.encoder(features, training=training, **kwargs) pred = self.predict_net([prediction, prediction_length], training=training, **kwargs) outputs = self.joint_net([enc, pred], training=training, **kwargs) return outputs def encoder_inference(self, features: tf.Tensor, input_length: Optional[tf.Tensor] = None, with_batch: Optional[bool] = False): """Infer function for encoder (or encoders) Args: features (tf.Tensor): features with shape [T, F, C] input_length (tf.Tensor): optional features length with shape [] with_batch (bool): indicates whether the features included batch dim or not Returns: tf.Tensor: output of encoders with shape [T, E] """ with tf.name_scope(f"{self.name}_encoder"): if with_batch: return self.encoder(features, training=False) outputs = tf.expand_dims(features, axis=0) outputs = self.encoder(outputs, training=False) return tf.squeeze(outputs, axis=0) def decoder_inference(self, encoded: tf.Tensor, predicted: tf.Tensor, states: tf.Tensor): """Infer function for decoder Args: encoded (tf.Tensor): output of encoder at each time step => shape [E] predicted (tf.Tensor): last character index of predicted sequence => shape [] states (nested lists of tf.Tensor): states returned by rnn layers Returns: (ytu, new_states) """ with tf.name_scope(f"{self.name}_decoder"): encoded = tf.reshape(encoded, [1, 1, -1]) # [E] => [1, 1, E] predicted = tf.reshape(predicted, [1, 1]) # [] => [1, 1] y, new_states = self.predict_net.recognize(predicted, states) # [1, 1, P], states ytu = tf.nn.log_softmax(self.joint_net([encoded, y], training=False)) # [1, 1, V] ytu = tf.squeeze(ytu, axis=None) # [1, 1, V] => [V] return ytu, new_states def get_config(self): conf = self.encoder.get_config() conf.update(self.predict_net.get_config()) conf.update(self.joint_net.get_config()) return conf # -------------------------------- GREEDY ------------------------------------- @tf.function def recognize(self, features: tf.Tensor, input_length: tf.Tensor, parallel_iterations: int = 10, swap_memory: bool = True): """ RNN Transducer Greedy decoding Args: features (tf.Tensor): a batch of extracted features input_length (tf.Tensor): a batch of extracted features length Returns: tf.Tensor: a batch of decoded transcripts """ encoded = self.encoder_inference(features, input_length, with_batch=True) return self.__perform_greedy_batch(encoded, input_length, parallel_iterations=parallel_iterations, swap_memory=swap_memory) def recognize_tflite(self, signal, predicted, states): """ Function to convert to tflite using greedy decoding (default streaming mode) Args: signal: tf.Tensor with shape [None] indicating a single audio signal predicted: last predicted character with shape [] states: lastest rnn states with shape [num_rnns, 1 or 2, 1, P] Return: transcript: tf.Tensor of Unicode Code Points with shape [None] and dtype tf.int32 predicted: last predicted character with shape [] states: lastest rnn states with shape [num_rnns, 1 or 2, 1, P] """ features = self.speech_featurizer.tf_extract(signal) encoded = self.encoder_inference(features) hypothesis = self.__perform_greedy(encoded, tf.shape(encoded)[0], predicted, states) transcript = self.text_featurizer.indices2upoints(hypothesis.prediction) return ( transcript, hypothesis.prediction[-1], hypothesis.states ) def __perform_greedy_batch(self, encoded: tf.Tensor, encoded_length: tf.Tensor, parallel_iterations: int = 10, swap_memory: bool = False): total = tf.shape(encoded)[0] batch = tf.constant(0, dtype=tf.int32) decoded = tf.TensorArray( dtype=tf.string, size=total, dynamic_size=False, clear_after_read=False, element_shape=tf.TensorShape([]) ) def condition(batch, total, encoded, encoded_length, decoded): return tf.less(batch, total) def body(batch, total, encoded, encoded_length, decoded): hypothesis = self.__perform_greedy( encoded=encoded[batch], encoded_length=encoded_length[batch], predicted=tf.constant(self.text_featurizer.blank, dtype=tf.int32), states=self.predict_net.get_initial_state(), parallel_iterations=parallel_iterations, swap_memory=swap_memory ) transcripts = self.text_featurizer.iextract(tf.expand_dims(hypothesis.prediction, axis=0)) decoded = decoded.write(batch, tf.squeeze(transcripts)) return batch + 1, total, encoded, encoded_length, decoded batch, total, _, _, decoded = tf.while_loop( condition, body, loop_vars=(batch, total, encoded, encoded_length, decoded), parallel_iterations=parallel_iterations, swap_memory=True, ) return decoded.stack() def __perform_greedy(self, encoded: tf.Tensor, encoded_length: tf.Tensor, predicted: tf.Tensor, states: tf.Tensor, parallel_iterations: int = 10, swap_memory: bool = False): with tf.name_scope(f"{self.name}_greedy"): time = tf.constant(0, dtype=tf.int32) total = encoded_length hypothesis = Hypothesis( index=tf.constant(0, dtype=tf.int32), prediction=tf.ones([total + 1], dtype=tf.int32) * self.text_featurizer.blank, states=states ) def condition(time, total, encoded, hypothesis): return tf.less(time, total) def body(time, total, encoded, hypothesis): predicted = tf.gather_nd(hypothesis.prediction, tf.expand_dims(hypothesis.index, axis=-1)) ytu, new_states = self.decoder_inference( # avoid using [index] in tflite encoded=tf.gather_nd(encoded, tf.expand_dims(time, axis=-1)), predicted=predicted, states=hypothesis.states ) new_predicted = tf.argmax(ytu, axis=-1, output_type=tf.int32) # => argmax [] index, new_predicted, new_states = tf.cond( tf.equal(new_predicted, self.text_featurizer.blank), true_fn=lambda: (hypothesis.index, predicted, hypothesis.states), false_fn=lambda: (hypothesis.index + 1, new_predicted, new_states) ) hypothesis = Hypothesis( index=index, prediction=tf.tensor_scatter_nd_update( hypothesis.prediction, indices=tf.reshape(index, [1, 1]), updates=tf.expand_dims(new_predicted, axis=-1) ), states=new_states ) return time + 1, total, encoded, hypothesis time, total, encoded, hypothesis = tf.while_loop( condition, body, loop_vars=(time, total, encoded, hypothesis), parallel_iterations=parallel_iterations, swap_memory=swap_memory ) return hypothesis # -------------------------------- BEAM SEARCH ------------------------------------- @tf.function def recognize_beam(self, features: tf.Tensor, input_length: tf.Tensor, lm: bool = False, parallel_iterations: int = 10, swap_memory: bool = True): """ RNN Transducer Beam Search Args: features (tf.Tensor): a batch of padded extracted features lm (bool, optional): whether to use language model. Defaults to False. Returns: tf.Tensor: a batch of decoded transcripts """ encoded = self.encoder_inference(features, input_length, with_batch=True) return self.__perform_beam_search_batch(encoded, input_length, lm, parallel_iterations=parallel_iterations, swap_memory=swap_memory) def __perform_beam_search_batch(self, encoded: tf.Tensor, encoded_length: tf.Tensor, lm: bool = False, parallel_iterations: int = 10, swap_memory: bool = False): total = tf.shape(encoded)[0] batch = tf.constant(0, dtype=tf.int32) decoded = tf.TensorArray( dtype=tf.string, size=total, dynamic_size=False, clear_after_read=False, element_shape=tf.TensorShape([]) ) def condition(batch, total, encoded, encoded_length, decoded): return tf.less(batch, total) def body(batch, total, encoded, encoded_length, decoded): hypothesis = self.__perform_beam_search(encoded[batch], encoded_length[batch], lm, parallel_iterations=parallel_iterations, swap_memory=swap_memory) transcripts = self.text_featurizer.iextract(tf.expand_dims(hypothesis.prediction, axis=0)) decoded = decoded.write(batch, tf.squeeze(transcripts)) return batch + 1, total, encoded, encoded_length, decoded batch, total, _, _, decoded = tf.while_loop( condition, body, loop_vars=(batch, total, encoded, encoded_length, decoded), parallel_iterations=parallel_iterations, swap_memory=True, ) return decoded.stack() def __perform_beam_search(self, encoded: tf.Tensor, encoded_length: tf.Tensor, lm: bool = False, parallel_iterations: int = 10, swap_memory: bool = False): with tf.device("/CPU:0"), tf.name_scope(f"{self.name}_beam_search"): beam_width = tf.cond( tf.less(self.text_featurizer.decoder_config.beam_width, self.text_featurizer.num_classes), true_fn=lambda: self.text_featurizer.decoder_config.beam_width, false_fn=lambda: self.text_featurizer.num_classes - 1 ) total = encoded_length def initialize_beam(dynamic=False): return BeamHypothesis( score=tf.TensorArray( dtype=tf.float32, size=beam_width if not dynamic else 0, dynamic_size=dynamic, element_shape=tf.TensorShape([]), clear_after_read=False ), indices=tf.TensorArray( dtype=tf.int32, size=beam_width if not dynamic else 0, dynamic_size=dynamic, element_shape=tf.TensorShape([]), clear_after_read=False ), prediction=tf.TensorArray( dtype=tf.string, size=beam_width if not dynamic else 0, dynamic_size=dynamic, element_shape=tf.TensorShape([]), clear_after_read=False ), states=tf.TensorArray( dtype=tf.float32, size=beam_width if not dynamic else 0, dynamic_size=dynamic, element_shape=tf.TensorShape(shape_list(self.predict_net.get_initial_state())), clear_after_read=False ), ) B = initialize_beam() B = BeamHypothesis( score=B.score.write(0, 0.0), indices=B.indices.write(0, self.text_featurizer.blank), prediction=B.prediction.write(0, ''), states=B.states.write(0, self.predict_net.get_initial_state()) ) def condition(time, total, B): return tf.less(time, total) def body(time, total, B): A = initialize_beam(dynamic=True) A = BeamHypothesis( score=A.score.unstack(B.score.stack()), indices=A.indices.unstack(B.indices.stack()), prediction=A.prediction.unstack(B.prediction.stack()), states=A.states.unstack(B.states.stack()), ) A_i = tf.constant(0, tf.int32) B = initialize_beam() encoded_t = tf.gather_nd(encoded, tf.expand_dims(time, axis=-1)) def beam_condition(beam, beam_width, A, A_i, B): return tf.less(beam, beam_width) def beam_body(beam, beam_width, A, A_i, B): y_hat_score, y_hat_score_index = tf.math.top_k(A.score.stack(), k=1) y_hat_score = y_hat_score[0] y_hat_index = tf.gather_nd(A.indices.stack(), y_hat_score_index) y_hat_prediction = tf.gather_nd(A.prediction.stack(), y_hat_score_index) y_hat_states = tf.gather_nd(A.states.stack(), y_hat_score_index) ytu, new_states = self.decoder_inference(encoded=encoded_t, predicted=y_hat_index, states=y_hat_states) def predict_condition(pred, A, A_i, B): return tf.less(pred, self.text_featurizer.num_classes) def predict_body(pred, A, A_i, B): new_score = y_hat_score + tf.gather_nd(ytu, tf.expand_dims(pred, axis=-1)) b_score, b_indices, b_prediction, b_states, \ a_score, a_indices, a_prediction, a_states, A_i = tf.cond( tf.equal(pred, self.text_featurizer.blank), true_fn=lambda: ( B.score.write(beam, new_score), B.indices.write(beam, y_hat_index), B.prediction.write(beam, y_hat_prediction), B.states.write(beam, y_hat_states), A.score, A.indices, A.prediction, A.states, A_i, ), false_fn=lambda: ( B.score, B.indices, B.prediction, B.states, A.score.write(A_i, new_score), A.indices.write(A_i, pred), A.prediction.write(A_i, tf.strings.reduce_join( [y_hat_prediction, tf.strings.format("{}", pred)], separator=" ")), A.states.write(A_i, new_states), A_i + 1 ) ) B = BeamHypothesis(score=b_score, indices=b_indices, prediction=b_prediction, states=b_states) A = BeamHypothesis(score=a_score, indices=a_indices, prediction=a_prediction, states=a_states) return pred + 1, A, A_i, B _, A, A_i, B = tf.while_loop( predict_condition, predict_body, loop_vars=(0, A, A_i, B), parallel_iterations=parallel_iterations, swap_memory=swap_memory ) return beam + 1, beam_width, A, A_i, B _, _, A, A_i, B = tf.while_loop( beam_condition, beam_body, loop_vars=(0, beam_width, A, A_i, B), parallel_iterations=parallel_iterations, swap_memory=swap_memory ) return time + 1, total, B _, _, B = tf.while_loop( condition, body, loop_vars=(0, total, B), parallel_iterations=parallel_iterations, swap_memory=swap_memory ) scores = B.score.stack() if self.text_featurizer.decoder_config.norm_score: prediction_lengths = tf.strings.length(B.prediction.stack(), unit="UTF8_CHAR") scores /= tf.cast(prediction_lengths, dtype=scores.dtype) y_hat_score, y_hat_score_index = tf.math.top_k(scores, k=1) y_hat_score = y_hat_score[0] y_hat_index = tf.gather_nd(B.indices.stack(), y_hat_score_index) y_hat_prediction = tf.gather_nd(B.prediction.stack(), y_hat_score_index) y_hat_states = tf.gather_nd(B.states.stack(), y_hat_score_index) return Hypothesis( index=y_hat_index, prediction=tf.strings.to_number(tf.strings.split(y_hat_prediction), out_type=tf.int32), states=y_hat_states ) # -------------------------------- TFLITE ------------------------------------- def make_tflite_function(self, greedy: bool = True): return tf.function( self.recognize_tflite, input_signature=[ tf.TensorSpec([None], dtype=tf.float32), tf.TensorSpec([], dtype=tf.int32), tf.TensorSpec(self.predict_net.get_initial_state().get_shape(), dtype=tf.float32) ] )
[ "nlhuy.cs.16@gmail.com" ]
nlhuy.cs.16@gmail.com
b6cffd9814a17ffbaf39dbadfae773d76b70a95c
4a74ec1b7e299540b924bce4928537a51fc00ff5
/day24_day30/day24/순열(재귀).py
3c9c552c654e3a3b99bbd69727a4723460368c48
[]
no_license
yeonlang/algorithm
ef74b2592818495f29f6de5f44f81ccf307efa59
ab788658bb781773c489cac8c6e8d2bea48fda07
refs/heads/master
2020-04-22T20:25:46.243355
2019-05-08T15:17:45
2019-05-08T15:17:45
170,641,144
0
0
null
null
null
null
UTF-8
Python
false
false
364
py
def BTK(choice): global result if choice==len(data): print(result) return for i in range(len(data)): if not visited[i]: visited[i]=1 result[choice]=data[i] BTK(choice+1) result[choice]=0 visited[i]=0 data=[1,2,3,4,5] visited=[0]*len(data) result=[0]*len(data) BTK(0)
[ "naspy001@gmail.com" ]
naspy001@gmail.com
c564613dceef1e4497ad550d35685d6132fe2e18
3b5d1a53af8d2f4094005f342403eabc7af9c980
/battle_module/__init__.py
4ef490bf509cfc0552e244879896a37730e094ec
[ "MIT" ]
permissive
alentoghostflame/StupidAlentoBot
daa828be3d47b24d3e13d500155a6a0d2019f724
c024bfb79a9ecb0d9fda5ddc4e361a0cb878baba
refs/heads/master
2021-06-30T17:50:14.997416
2021-06-08T03:54:24
2021-06-08T03:54:24
237,541,303
2
0
null
null
null
null
UTF-8
Python
false
false
46
py
from battle_module.battle import BattleModule
[ "alexanderschoenhofen@gmail.com" ]
alexanderschoenhofen@gmail.com
aa9a09bc595ade1419abb2183ac8589ae774764a
3da69696601b2b3ad7bc1285a5f0343c7eafea80
/lc900.py
8e3d98a41900bffeb2f868bebe4485df35b009d6
[]
no_license
GeorgyZhou/Leetcode-Problem
ee586463a2e4e75c910c095bdc057f1be70b5c1b
d6fac85a94a7188e93d4e202e67b6485562d12bd
refs/heads/master
2021-06-30T15:58:04.698200
2020-12-18T22:55:49
2020-12-18T22:55:49
66,054,365
0
0
null
null
null
null
UTF-8
Python
false
false
826
py
class RLEIterator(object): def __init__(self, A): """ :type A: List[int] """ self.seq = [] for i in range(0, len(A), 2): if A[i] == 0: continue self.seq.append([A[i], A[i+1]]) self.seq.reverse() def next(self, n): """ :type n: int :rtype: int """ last_num = -1 while self.seq and n >= self.seq[-1][0]: n -= self.seq[-1][0] last_num = self.seq[-1][1] self.seq.pop() if n > 0 and self.seq: self.seq[-1][0] -= n n = 0 last_num = self.seq[-1][1] return last_num if n == 0 else -1 # Your RLEIterator object will be instantiated and called as such: # obj = RLEIterator(A) # param_1 = obj.next(n)
[ "michaelchouqj@gmail.com" ]
michaelchouqj@gmail.com
64288c71f6d3d6f5bf17652ffa72615f6ef91492
6b95f96e00e77f78f0919c10b2c90f116c0b295d
/TelstraTPN/models/inline_response20018.py
f94f3428cc14125628e5e80c0129635b20cc6fa9
[]
no_license
telstra/Programmable-Network-SDK-python
0522b54dcba48e16837c6c58b16dabde83b477d5
d1c19c0383af53a5f09a6f5046da466ae6e1d97a
refs/heads/master
2021-09-19T17:09:06.831233
2018-07-30T03:22:26
2018-07-30T03:22:26
113,531,312
3
1
null
2018-07-30T03:22:27
2017-12-08T04:23:15
Python
UTF-8
Python
false
false
4,253
py
# coding: utf-8 """ Telstra Programmable Network API Telstra Programmable Network is a self-provisioning platform that allows its users to create on-demand connectivity services between multiple end-points and add various network functions to those services. Programmable Network enables to connectivity to a global ecosystem of networking services as well as public and private cloud services. Once you are connected to the platform on one or more POPs (points of presence), you can start creating those services based on the use case that you want to accomplish. The Programmable Network API is available to all customers who have registered to use the Programmable Network. To register, please contact your account representative. # noqa: E501 OpenAPI spec version: 2.4.2 Contact: pnapi-support@team.telstra.com Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six class InlineResponse20018(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ openapi_types = { 'dps': 'dict(str, float)', 'metric': 'str' } attribute_map = { 'dps': 'dps', 'metric': 'metric' } def __init__(self, dps=None, metric=None): # noqa: E501 """InlineResponse20018 - a model defined in OpenAPI""" # noqa: E501 self._dps = None self._metric = None self.discriminator = None if dps is not None: self.dps = dps if metric is not None: self.metric = metric @property def dps(self): """Gets the dps of this InlineResponse20018. # noqa: E501 :return: The dps of this InlineResponse20018. # noqa: E501 :rtype: dict(str, float) """ return self._dps @dps.setter def dps(self, dps): """Sets the dps of this InlineResponse20018. :param dps: The dps of this InlineResponse20018. # noqa: E501 :type: dict(str, float) """ self._dps = dps @property def metric(self): """Gets the metric of this InlineResponse20018. # noqa: E501 :return: The metric of this InlineResponse20018. # noqa: E501 :rtype: str """ return self._metric @metric.setter def metric(self, metric): """Sets the metric of this InlineResponse20018. :param metric: The metric of this InlineResponse20018. # noqa: E501 :type: str """ self._metric = metric def to_dict(self): """Returns the model properties as a dict""" result = {} for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value return result def to_str(self): """Returns the string representation of the model""" return pprint.pformat(self.to_dict()) def __repr__(self): """For `print` and `pprint`""" return self.to_str() def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, InlineResponse20018): return False return self.__dict__ == other.__dict__ def __ne__(self, other): """Returns true if both objects are not equal""" return not self == other
[ "steven@developersteve.com" ]
steven@developersteve.com
166eab8540b5b91e7244c1de451def223de53995
9b126e00ea5187ea7a1006815b3346a407b43bb7
/wsmonitor/__main__.py
404edaa01349e5ed4d32fea012a169854517a1e7
[]
no_license
mk1012/wsmonitor
b741c0482d0622a3ec9a07cacbf59efc97e25468
6e096d0584c9b63919f07cea2cf39fbe09458a59
refs/heads/master
2022-12-01T01:23:33.780147
2020-08-13T10:51:28
2020-08-13T10:51:28
273,063,467
1
1
null
null
null
null
UTF-8
Python
false
false
84
py
import logging from wsmonitor.cli import cli if __name__ == "__main__": cli()
[ "mark@weinreuter.org" ]
mark@weinreuter.org
d7bcf7c5dacf1719df9427cbec737517decf12bd
6de4c9c36ab2ecdb099aef0050f1afdd30fe2b3f
/app/email.py
fec1d7e3314c60e8e5981438e1d0a1c34fbf167b
[]
no_license
wadi-1000/Pitches
b4f2ba8db2d6e18c75f3dbcf4475155abdaf30df
6aff3af294b38674fbd45fffdb07cf32b67ccb6e
refs/heads/master
2023-07-14T23:25:22.812954
2021-08-25T09:23:21
2021-08-25T09:23:21
395,655,737
0
0
null
null
null
null
UTF-8
Python
false
false
387
py
from flask_mail import Message from flask import render_template from . import mail def mail_message(subject,template,to,**kwargs): sender_email = 'joykiranga@gamil.com' email = Message(subject, sender=sender_email, recipients=[to]) email.body= render_template(template + ".txt",**kwargs) email.html = render_template(template + ".html",**kwargs) mail.send(email)
[ "joy.kiranga@student.moringaschool@gmail.com" ]
joy.kiranga@student.moringaschool@gmail.com
6b5c8a12d04375293740f160e7cff38d6c442850
b2135e3fc77666f043f0fbafd0d88ed9865d5b4f
/7183 Python Basics/13 Chapter 2.5 - About loop conditions/01 Consuming lists/87646_07_code.py
ed93d186b4adf84e544c07eb5ee57d309cad638f
[]
no_license
Felienne/spea
164d05e9fbba82c7b7df8d00295f7157054f9248
ecb06c66aaf6a2dced3f141ca415be9efb7dbff5
refs/heads/master
2020-03-17T17:35:27.302219
2018-05-17T10:14:49
2018-05-17T10:14:49
133,794,299
0
0
null
null
null
null
UTF-8
Python
false
false
217
py
# Finish the loop so all elements are printed. Note: there are different ways of doing this! In the nest step you can try multiple ways. list = [2, 6, 8, 12, 19, 5] while ___: item = list.pop() print(item)
[ "felienne@gmail.com" ]
felienne@gmail.com
79bbf1803c6fdec266bdee054b03ed8a0b300bba
056b57a594289cab88b73889c55059376dab5655
/filter_app/migrations/0006_auto_20151215_0614.py
020b19cb8103a59a136d3f4d06d1eaa23b284baf
[]
no_license
dentemm/filter_project
05b9c19975c1d50bacc78bbcc3c9ef8b95f61f65
ac0a7ce1254f17db16f12ee5eb639d00f8713a35
refs/heads/master
2020-12-29T02:32:38.535747
2017-01-09T06:53:55
2017-01-09T06:53:55
43,113,731
0
0
null
null
null
null
UTF-8
Python
false
false
618
py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('filter_app', '0005_module_extra_info'), ] operations = [ migrations.AddField( model_name='module', name='recommended_filter', field=models.ForeignKey(related_name='+', to='filter_app.Filter', null=True), ), migrations.AlterField( model_name='module', name='extra_info', field=models.TextField(null=True, blank=True), ), ]
[ "tim.claes@me.com" ]
tim.claes@me.com
6b502908108a91d453d96034677fc8642e70ff3c
1d44bfac26793f034a77916cb211bf44a774e1ef
/CIFAR-100/another_mixed_net.py
24312a86dba5e512321b848846ca366ae4f9c0d0
[]
no_license
VCharatsidis/Unsupervised-Clustering
d9f81603cc35c9f3087c1ad7d721cd3bfa7de9b3
b060caa315f0c066410da9580e64d6db0222f2a8
refs/heads/master
2021-07-08T21:27:12.145711
2021-01-18T17:50:12
2021-01-18T17:50:12
224,744,216
1
0
null
null
null
null
UTF-8
Python
false
false
5,173
py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import torch.nn as nn import torch class AnotherMixed(nn.Module): """ This class implements a Multi-layer Perceptron in PyTorch. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward. """ def __init__(self, n_channels, EMBEDING_SIZE, classes): """ Initializes MLP object. Args: n_inputs: number of inputs. n_hidden: list of ints, specifies the number of units in each linear layer. If the list is empty, the MLP will not have any linear layers, and the model will simply perform a multinomial logistic regression. n_classes: number of classes of the classification problem. This number is required in order to specify the output dimensions of the MLP """ super(AnotherMixed, self).__init__() self.conv = nn.Sequential( nn.Conv2d(n_channels, 64, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.MaxPool2d(kernel_size=2, stride=2, padding=1), nn.Conv2d(64, 128, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.BatchNorm2d(128), nn.MaxPool2d(kernel_size=2, stride=2, padding=1), nn.Conv2d(128, 256, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.BatchNorm2d(256), nn.MaxPool2d(kernel_size=2, stride=2, padding=1), # nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.BatchNorm2d(512), nn.MaxPool2d(kernel_size=2, stride=2, padding=1), nn.Conv2d(512, 1024, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.BatchNorm2d(1024), nn.MaxPool2d(kernel_size=2, stride=2, padding=1), ) conv_size = 4096 self.brain = nn.Sequential( nn.Linear(conv_size, 4096), nn.ReLU(), nn.BatchNorm1d(4096), nn.Linear(4096, EMBEDING_SIZE) ) self.classification_conv = nn.Sequential( nn.Conv2d(n_channels, 64, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.MaxPool2d(kernel_size=2, stride=2, padding=1), nn.Conv2d(64, 128, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.BatchNorm2d(128), nn.MaxPool2d(kernel_size=2, stride=2, padding=1), nn.Conv2d(128, 256, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.BatchNorm2d(256), nn.MaxPool2d(kernel_size=2, stride=2, padding=1), # nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), # nn.ReLU(), # nn.BatchNorm2d(512), # nn.MaxPool2d(kernel_size=2, stride=2, padding=1), ) self.classification = nn.Sequential( # nn.Linear(conv_size, 4096), # nn.ReLU(), # nn.BatchNorm1d(4096), nn.Linear(6400, classes), nn.Softmax(dim=1) ) self.sigmoid = nn.Sequential( nn.Sigmoid() ) self.penalty_conv = nn.Sequential( nn.Conv2d(n_channels, 64, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.MaxPool2d(kernel_size=2, stride=2, padding=1), nn.Conv2d(64, 128, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.BatchNorm2d(128), nn.MaxPool2d(kernel_size=2, stride=2, padding=1), nn.Conv2d(128, 256, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.BatchNorm2d(256), nn.MaxPool2d(kernel_size=2, stride=2, padding=1), # nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), # nn.ReLU(), # nn.BatchNorm2d(512), # nn.MaxPool2d(kernel_size=2, stride=2, padding=1), ) self.penalty_classifier = nn.Sequential( nn.Linear(6400, classes), nn.Softmax(dim=1) ) self.sigmoid = nn.Sequential( nn.Sigmoid() ) def forward(self, x): """ Performs forward pass of the input. Here an input tensor x is transformed through several layer transformations. Args: x: input to the network Returns: out: outputs of the network """ conv = self.conv(x) encoding = torch.flatten(conv, 1) class_conv = self.classification_conv(x) class_encoding = torch.flatten(class_conv, 1) classification = self.classification(class_encoding) pen_conv = self.penalty_conv(x) penalty_encoding = torch.flatten(pen_conv, 1) penalty_classification = self.penalty_classifier(penalty_encoding) logits = self.brain(encoding) binaries = self.sigmoid(logits) return encoding, classification, penalty_classification, binaries
[ "charatsidisvasileios@gmail.com" ]
charatsidisvasileios@gmail.com
354b59baffdbb9741441fd2bfd75671d6d48f582
ca7aa979e7059467e158830b76673f5b77a0f5a3
/Python_codes/p02677/s277279155.py
417c2e83e3ec17dc233cfcc99d01d21a875cdd90
[]
no_license
Aasthaengg/IBMdataset
7abb6cbcc4fb03ef5ca68ac64ba460c4a64f8901
f33f1c5c3b16d0ea8d1f5a7d479ad288bb3f48d8
refs/heads/main
2023-04-22T10:22:44.763102
2021-05-13T17:27:22
2021-05-13T17:27:22
367,112,348
0
0
null
null
null
null
UTF-8
Python
false
false
205
py
import math a, b, h, m = map(int, input().split()) angle = ((h * 60 + m) / 720 - m / 60) * math.pi * 2 # 角度(ラジアン) ans = math.sqrt(a*a + b*b - 2*a*b*math.cos(angle)) # 余弦定理 print(ans)
[ "66529651+Aastha2104@users.noreply.github.com" ]
66529651+Aastha2104@users.noreply.github.com
fbcc5d633a59b210d64ed1f5d1123b66fbd1ffc7
8dc26aa9afcfeb943306c30b5e4800be36524e32
/src/ch15/practise/Point1.py
7fafff09565d670b064b0df04b7cd79ad18781b4
[]
no_license
MITZHANG/ThinkPython
5ce75a78ae811c6229269d34d5e819803fde8799
b68d01df66124a9d6d10bcde61ca324c1a1592d8
refs/heads/master
2022-05-07T10:46:27.006351
2018-12-02T03:26:47
2018-12-02T03:26:47
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,557
py
"""This module contains a code example related to Think Python, 2nd Edition by Allen Downey http://thinkpython2.com Copyright 2015 Allen Downey License: http://creativecommons.org/licenses/by/4.0/ """ class Point: """Represents a point in 2-D space. attributes: x, y """ def print_point(p): """Print a Point object in human-readable format.""" print('(%g, %g)' % (p.x, p.y)) class Rectangle: """Represents a rectangle. attributes: width, height, corner. """ def find_center(rect): """Returns a Point at the center of a Rectangle. rect: Rectangle returns: new Point """ p = Point() p.x = rect.corner.x + rect.width/2.0 p.y = rect.corner.y + rect.height/2.0 return p def grow_rectangle(rect, dwidth, dheight): """Modifies the Rectangle by adding to its width and height. rect: Rectangle object. dwidth: change in width (can be negative). dheight: change in height (can be negative). """ rect.width += dwidth rect.height += dheight def main(): blank = Point() blank.x = 3 blank.y = 4 print('blank', end=' ') print_point(blank) box = Rectangle() box.width = 100.0 box.height = 200.0 box.corner = Point() box.corner.x = 0.0 box.corner.y = 0.0 center = find_center(box) print('center', end=' ') print_point(center) print(box.width) print(box.height) print('grow') grow_rectangle(box, 50, 100) print(box.width) print(box.height) if __name__ == '__main__': main()
[ "huruifeng1202@163.com" ]
huruifeng1202@163.com
55adc70658d75b1258437b04056420d0dd722bd3
951fc0da7384b961726999e5451a10e2783462c4
/script.module.exodusscrapers/lib/exodusscrapers/sources_placenta/en_placenta-1.7.8/to_be_fixed/needsfixing/movie4uch.py
9fe22b01e7d14100e698e0cfbb4ea3d96376cde4
[ "Beerware" ]
permissive
vphuc81/MyRepository
eaf7b8531b2362f0e0de997a67b889bc114cd7c2
9bf8aca6de07fcd91bcec573f438f29e520eb87a
refs/heads/master
2022-01-02T15:07:35.821826
2021-12-24T05:57:58
2021-12-24T05:57:58
37,680,232
6
10
null
null
null
null
UTF-8
Python
false
false
4,343
py
# -*- coding: UTF-8 -*- ####################################################################### # ---------------------------------------------------------------------------- # "THE BEER-WARE LICENSE" (Revision 42): # @Daddy_Blamo wrote this file. As long as you retain this notice you # can do whatever you want with this stuff. If we meet some day, and you think # this stuff is worth it, you can buy me a beer in return. - Muad'Dib # ---------------------------------------------------------------------------- ####################################################################### # Addon Name: Exodus # Addon id: plugin.video.exodus # Addon Provider: Exodus import re,urlparse,urllib from resources.lib.modules import cleantitle from resources.lib.modules import client from resources.lib.modules import cache from resources.lib.modules import dom_parser2 from resources.lib.modules import source_utils class source: def __init__(self): self.priority = 1 self.language = ['en'] self.domains = ['movie4u.ch'] self.base_link = 'https://movie4u.live/' self.search_link = '/?s=%s' def movie(self, imdb, title, localtitle, aliases, year): try: clean_title = cleantitle.geturl(title) search_url = urlparse.urljoin(self.base_link, self.search_link % clean_title.replace('-', '+')) r = client.request(search_url) r = client.parseDOM(r, 'div', {'class': 'result-item'}) r = [(dom_parser2.parse_dom(i, 'a', req='href')[0], client.parseDOM(i, 'img', ret='alt')[0], dom_parser2.parse_dom(i, 'span', attrs={'class': 'year'})) for i in r] r = [(i[0].attrs['href'], i[1], i[2][0].content) for i in r if (cleantitle.get(i[1]) == cleantitle.get(title) and i[2][0].content == year)] url = r[0][0] return url except Exception: return def tvshow(self, imdb, tvdb, tvshowtitle, localtvshowtitle, aliases, year): try: clean_title = cleantitle.geturl(tvshowtitle) search_url = urlparse.urljoin(self.base_link, self.search_link % clean_title.replace('-', '+')) r = client.request(search_url) r = client.parseDOM(r, 'div', {'class': 'result-item'}) r = [(dom_parser2.parse_dom(i, 'a', req='href')[0], client.parseDOM(i, 'img', ret='alt')[0], dom_parser2.parse_dom(i, 'span', attrs={'class': 'year'})) for i in r] r = [(i[0].attrs['href'], i[1], i[2][0].content) for i in r if (cleantitle.get(i[1]) == cleantitle.get(tvshowtitle) and i[2][0].content == year)] url = source_utils.strip_domain(r[0][0]) return url except: return def episode(self, url, imdb, tvdb, title, premiered, season, episode): try: if not url: return t = url.split('/')[2] url = self.base_link + '/episodes/%s-%dx%d' % (t, int(season), int(episode)) return url except: return def sources(self, url, hostDict, hostprDict): try: sources = [] r = client.request(url) try: data = client.parseDOM(r, 'div', attrs={'class': 'playex'}) data = [client.parseDOM(i, 'iframe', ret='src') for i in data if i] try: for url in data[0]: quality, info = source_utils.get_release_quality(url, None) valid, host = source_utils.is_host_valid(url,hostDict) if not valid: continue host = host.encode('utf-8') sources.append({ 'source': host, 'quality': quality, 'language': 'en', 'url': url.replace('\/', '/'), 'direct': False, 'debridonly': False }) except: pass except: pass return sources except Exception: return def resolve(self, url): return url
[ "vinhphuc_81@yahoo.com" ]
vinhphuc_81@yahoo.com
888965d5675a8f7fddf51e681409041dbeba44d1
5390d79dad71ad0d9ff9d0777435dcaf4aad16b3
/chapter_08/person.py
5d69f944211008757fc2ea9a8bfa43496fbfa767
[]
no_license
JasperMi/python_learning
19770d79cce900d968cec76dac11e45a3df9c34c
8111d0d12e4608484864dddb597522c6c60b54e8
refs/heads/master
2020-11-26T08:57:02.983869
2020-03-11T10:14:55
2020-03-11T10:14:55
218,935,548
0
0
null
null
null
null
UTF-8
Python
false
false
296
py
def build_person(first_name, last_name, age=''): """返回一个字典,其中包含有关一个人的信息""" person = {'first': first_name, 'last': last_name} if age: person['age'] = age return person musician = build_person('jimi', 'hendrix', age=27) print(musician)
[ "darmi19@163.com" ]
darmi19@163.com
69dc833fbd6f66e9bb74f8674acfcdcded16f069
07c6f13115eba392ae9d0f1b8916e862907dfa0c
/backend/home/migrations/0005_auto_20200824_0822.py
a35246626bbd4baa31a37a6f385a216127901486
[]
no_license
crowdbotics-apps/mobile-24-aug-dev-9264
5ac37888b870f21c5b662be7971ed31fb320afb6
74df25211a9fba244fe377b1595f4239445e69d5
refs/heads/master
2022-12-05T07:28:19.060867
2020-08-24T10:59:05
2020-08-24T10:59:05
289,830,708
0
0
null
null
null
null
UTF-8
Python
false
false
467
py
# Generated by Django 2.2.15 on 2020-08-24 08:22 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("home", "0004_auto_20200824_0723"), ] operations = [ migrations.RemoveField(model_name="customtext", name="title",), migrations.AddField( model_name="customtext", name="df", field=models.CharField(blank=True, max_length=150), ), ]
[ "team@crowdbotics.com" ]
team@crowdbotics.com
1b808a6ba74a02d33f7d1f10c324f04b8ca5ecd6
cc5156902315a9ff0af3cc323992d3a6606a0bb1
/cyclic sort/find the first k missing positive numbers.py
e500548815b920ce3a447a89dcb0eeb7623ba404
[ "MIT" ]
permissive
smksevov/Grokking-the-coding-interview
8ad6f7b11ac0c3f2a08c580a5d542b3745e9ad0b
0ae68fb1c86ff595a82af68f7a6a6fdfe37e97a7
refs/heads/main
2023-06-30T03:07:39.054942
2021-08-05T08:25:31
2021-08-05T08:25:31
515,096,499
1
0
MIT
2022-07-18T08:26:16
2022-07-18T08:26:15
null
UTF-8
Python
false
false
1,174
py
# Given an unsorted array containing numbers and a number ‘k’, # find the first ‘k’ missing positive numbers in the array. # Example: # Input: [3, -1, 4, 5, 5], k=3 # Output: [1, 2, 6] # Explanation: The smallest missing positive numbers are 1, 2 and 6. # O(N + K) space:O(1) def find_first_k_missing_positive_number(arr, k): i = 0 while i < len(arr): j = arr[i] - 1 if arr[i] > 0 and arr[i] <= len(arr) and arr[i] != arr[j]: arr[i], arr[j] = arr[j], arr[i] else: i += 1 missing_number = [] extra_number = [] for i in range(len(arr)): if k == 0: break if arr[i] != i + 1: missing_number.append(i + 1) extra_number.append(arr[i]) k -= 1 add_length = len(arr) while k > 0: add_length += 1 if add_length not in extra_number: missing_number.append(add_length) k -= 1 return missing_number print(find_first_k_missing_positive_number([3, -1, 4, 5, 5], 3)) print(find_first_k_missing_positive_number([2, 3, 4], 3)) print(find_first_k_missing_positive_number([-2, -3, 4], 2))
[ "394104840@qq.com" ]
394104840@qq.com
b48e2095b08d287ca5bbe8003a8471badaefb42a
f891828ffe9c8501d276560c8c52d319f284056f
/404_left_leave_sum_e/root_count.py
296baac2fa8e5b3a9061ab1decfbadbecdce1b9c
[]
no_license
chao-shi/lclc
1b852ab61fef4072039c61f68e951ab2072708bf
2722c0deafcd094ce64140a9a837b4027d29ed6f
refs/heads/master
2021-06-14T22:07:54.120375
2019-09-02T23:13:59
2019-09-02T23:13:59
110,387,039
0
0
null
null
null
null
UTF-8
Python
false
false
673
py
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def sumOfLeftLeaves(self, root): """ :type root: TreeNode :rtype: int """ def recur(root, isLeftChild): if not root: return 0 elif root.left == None and root.right == None and isLeftChild: return root.val else: return recur(root.left, True) + recur(root.right, False) return recur(root, True) # One-node tree count as left leave
[ "chao.shi@hpe.com" ]
chao.shi@hpe.com
d21e444dda8f2494714cce197620fdaed2200cfa
69ef637ffa5739c368bc3a2da935f084203b56b6
/exercises/en/exc_hockey_players.py
49593545ec710f208fe69f7a3b10496dbbd14ab5
[ "MIT" ]
permissive
betatim/MCL-DSCI-011-programming-in-python
3e03734abb5af49b3dfc0b127e65b3573911afb0
b51f43a6bb1bedf0db028613d48d6566309ec44a
refs/heads/master
2022-11-08T06:03:56.190181
2020-06-25T16:20:30
2020-06-25T16:20:30
275,013,051
0
0
MIT
2020-06-25T20:53:13
2020-06-25T20:53:12
null
UTF-8
Python
false
false
101
py
import pandas as pd # The database hockey_players = pd.read_csv('data/canucks.csv') hockey_players
[ "hayleyfboyce@hotmail.com" ]
hayleyfboyce@hotmail.com
1cb47536871779d20749b551985661412d2fcd3c
c2471dcf74c5fd1ccf56d19ce856cf7e7e396b80
/chap11/3.py
eb193de9c867a2242585a4330664c3af97d2b47c
[]
no_license
oc0de/pythonEpi
eaeef2cf748e6834375be6bc710132b572fc2934
fb7b9e06bb39023e881de1a3d370807b955b5cc0
refs/heads/master
2021-06-18T05:33:19.518652
2017-07-07T04:34:52
2017-07-07T04:34:52
73,049,450
0
0
null
null
null
null
UTF-8
Python
false
false
341
py
from heapq import * def sortAlmostSortedArray(s, k): minHeap = [] for i in range(k): heappush(minHeap, s[i]) idx = k while idx < len(s): heappush(minHeap, s[idx]) print heappop(minHeap) idx += 1 while minHeap: print heappop(minHeap) sortAlmostSortedArray([3,-1,2,6,5,4,8],2)
[ "valizade@mail.gvsu.edu" ]
valizade@mail.gvsu.edu
17a20ec8bc36206daef719d8707bb6582bb67886
2c2bef621c173e8beba2917924d9b08bfb8c0eaf
/Options_Math/Matrix_Math_Python.py
ce1e1c4214eec679d55a92116d9d42b887be8315
[]
no_license
Bhaney44/Options
d7c4d6aed57a0bbbff9731d912dfc764bbef512f
8c265c33d111d530f5de329732f27585c4b750a4
refs/heads/master
2022-11-25T13:54:51.655061
2020-07-31T22:52:26
2020-07-31T22:52:26
273,760,601
1
0
null
null
null
null
UTF-8
Python
false
false
1,655
py
#Matrix Math import numpy as np #matrix arrays x = np.array([1,5,2]) y = np.array([7,4,1]) #addition x + y array([8, 9, 3]) #multiplication x * y array([ 7, 20, 2]) #substraction x - y array([-6, 1, 1]) #division x / y array([0, 1, 2]) #Modulus - absolute value or a constant ratio x % y array([1, 1, 0]) #Vector Addition and Subtraction x = np.array([3,2]) y = np.array([5,1]) z = x + y z array([8, 3]) #Scalar Product and Dot Product x = np.array([1,2,3]) y = np.array([-7,8,9]) np.dot(x,y) 36 dot = np.dot(x,y) x_modulus = np.sqrt((x*x).sum()) y_modulus = np.sqrt((y*y).sum()) # cosine of angle between x and y cos_angle = dot / x_modulus / y_modulus angle = np.arccos(cos_angle) angle 0.80823378901082499 # angle in degrees angle * 360 / 2 / np.pi 46.308384970187326 #Matrix class x = np.array( ((2,3), (3, 5)) ) y = np.array( ((1,2), (5, -1)) ) x * y array([[ 2, 6], [15, -5]]) x = np.matrix( ((2,3), (3, 5)) ) y = np.matrix( ((1,2), (5, -1)) ) x * y matrix([[17, 1], [28, 1]]) #Matrix product x = np.array( ((2,3), (3, 5)) ) >>> y = np.matrix( ((1,2), (5, -1)) ) >>> np.dot(x,y) matrix([[17, 1], [28, 1]]) np.mat(x) * np.mat(y) matrix([[17, 1], [28, 1]]) #Practical Application NumPersons = np.array([[100,175,210],[90,160,150],[200,50,100],[120,0,310]]) Price_per_100_g = np.array([2.98,3.90,1.99]) Price_in_Cent = np.dot(NumPersons,Price_per_100_g) Price_in_Euro = Price_in_Cent / np.array([100,100,100,100]) Price_in_Euro array([ 13.984, 11.907, 9.9, 9.745]) #Cross Product x = np.array([0,0,1]) y = np.array([0,1,0]) np.cross(x,y) array([-1, 0, 0]) np.cross(y,x) array([1, 0, 0])
[ "noreply@github.com" ]
Bhaney44.noreply@github.com
5a056c350dcd29d87aa97c0915bf6385c065f2b0
50e2bf921351b62cdb9b64ce79e081c0513343e2
/src/main.py
2bbdc2b21d587f0290e6d0f81690f93d8decf811
[ "MIT" ]
permissive
mattjoswald/smart-thermostat
b16d7fc3b61fb9416f462df33aa319b6a6c92175
4942ccfad9e0ad1206a84a8b271565d48335bbce
refs/heads/master
2020-12-02T13:06:48.627060
2019-12-26T06:16:19
2019-12-26T06:16:19
231,015,646
0
0
MIT
2019-12-31T03:01:04
2019-12-31T03:01:03
null
UTF-8
Python
false
false
745
py
'Smart thermostat project main module' from cpx.sensor import Sensor from cpx.timingknob import TimingKnob from cpx.heaterrelay import HeaterRelay from cpx.buttons import Buttons from cpx.display import Display from thermocontroller import ThermoController TEMP_CHANGE_INCREMENT = 0.1 DEFAULT_DESIRED_TEMP = 21.0 BUTTON_REPEAT_DELAY_SECS = 0.3 buttons = Buttons(BUTTON_REPEAT_DELAY_SECS) buttons.on_change( lambda button_index: controller.change_desired_temp((-1, 1)[button_index] * TEMP_CHANGE_INCREMENT)) display = Display(TEMP_CHANGE_INCREMENT) controller = ThermoController( Sensor(), TimingKnob(), HeaterRelay(), display, DEFAULT_DESIRED_TEMP) while True: controller.update() buttons.update() display.update()
[ "daveb@davebsoft.com" ]
daveb@davebsoft.com
44b88f8ceaf6586d2b0d0016961321a743780bac
30dc32fd39cf71c76fc24d53b68a8393adcac149
/OWDTestToolkit/apps/Email/__main.py
ff3f949da55fe151c72c0d1071d39d3f8773e2df
[]
no_license
carlosmartineztoral/OWD_TEST_TOOLKIT
448caefdc95bc3e54aad97df0bff7046ffb37be1
50768f79488735eba8355824f5aa3686a71d560a
refs/heads/master
2021-01-15T17:14:03.614981
2013-06-11T12:48:18
2013-06-11T12:48:18
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,458
py
from OWDTestToolkit.global_imports import * import deleteEmail ,\ emailIsInFolder ,\ goto_folder_from_list ,\ openMailFolder ,\ openMsg ,\ remove_accounts_and_restart ,\ send_new_email ,\ sendTheMessage ,\ setupAccount ,\ switchAccount ,\ waitForDone class Email ( deleteEmail.main, emailIsInFolder.main, goto_folder_from_list.main, openMailFolder.main, openMsg.main, remove_accounts_and_restart.main, send_new_email.main, sendTheMessage.main, setupAccount.main, switchAccount.main, waitForDone.main): def __init__(self, p_parent): self.apps = p_parent.apps self.data_layer = p_parent.data_layer self.parent = p_parent self.marionette = p_parent.marionette self.UTILS = p_parent.UTILS def launch(self): # # Launch the app. # self.apps.kill_all() self.app = self.apps.launch(self.__class__.__name__) self.UTILS.waitForNotElements(DOM.GLOBAL.loading_overlay, self.__class__.__name__ + " app - loading overlay")
[ "roy.collings@sogeti.com" ]
roy.collings@sogeti.com
e8af622b6a1fcc7d31f00df00cfbdb2d4905bf1a
f68732bc40a7a90c3a1082e4b3a4154518acafbb
/script/dbus/sessionBus/audioSink/011_sinkSetVolumeNotPlay.py
874cbce8daddd6329480c8c5bdb73a95deb648c6
[]
no_license
lizhouquan1017/dbus_demo
94238a2307e44dabde9f4a4dd0cf8ec217260867
af8442845e722b258a095e9a1afec9dddfb175bf
refs/heads/master
2023-02-11T19:46:27.884936
2021-01-08T05:27:18
2021-01-08T05:27:18
327,162,635
0
0
null
null
null
null
UTF-8
Python
false
false
953
py
# -*- coding: utf-8 -*- # **************************************************** # @Test Case ID: 011_sinkSetVolumeNotPlay # @Test Description: 设置音量大小 # @Test Condition: # @Test Step: 1.设置音量大小,不播放声音反馈; # # @Test Result: 1.检查设置成功; # @Test Remark: # @Author: ut000511 # ***************************************************** import pytest from frame.base import OSBase from aw.dbus.sessionBus import audioSink class TestCase(OSBase): def setUp(self): self.Step("预制条件1:获取参数") self.value = 0.5 @pytest.mark.public def test_step(self): self.Step("步骤1:设置音量大小,不播放声音反馈") audioSink.sinkSetVolume(self.value, False) self.CheckPoint("检查点1:检查设置成功") audioSink.checkSetVolume(self.value) def tearDown(self): self.Step("收尾:无")
[ "lizhouquan@uniontech.com" ]
lizhouquan@uniontech.com
427b3c825edd8de722ada05971ee97d2bcad81f0
d775cdfb84e09909ebfdbef6f827c13b3921e0c4
/example/tornado_period_server.py
822aba54f47efd4b5357c0f99909128abcaa7e02
[]
no_license
land-pack/sscan
28e114e87a4c4131177f08ded7198ad8059ab779
f68b3c124ddba073194d4e8a0b1b52a1f37030b2
refs/heads/master
2020-03-18T13:33:19.243078
2018-05-30T02:40:22
2018-05-30T02:40:22
134,791,660
0
0
null
null
null
null
UTF-8
Python
false
false
820
py
from socket import socket from socket import AF_INET, SOCK_DGRAM, SOL_SOCKET, SO_REUSEADDR, SO_BROADCAST import tornado.ioloop import tornado.web def attentionPlease(): """ Get self host information and then broadcast it out. """ cs = socket(AF_INET, SOCK_DGRAM) cs.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) cs.setsockopt(SOL_SOCKET, SO_BROADCAST, 1) cs.sendto('This is a test', ('255.255.255.255', 54545)) class MainHandler(tornado.web.RequestHandler): def get(self): self.write("Hello, world") def make_app(): return tornado.web.Application([ (r"/", MainHandler), ]) if __name__ == "__main__": app = make_app() app.listen(8888) tornado.ioloop.PeriodicCallback(attentionPlease, 1000 * 5).start() tornado.ioloop.IOLoop.current().start()
[ "landpack@sina.com" ]
landpack@sina.com
890cae19c80a3e5432fefc026d58191a9fe0af2b
833ef1cc5cbd5cf76da144d10d393e30976d9185
/froide/publicbody/migrations/0001_initial.py
79b00e5a70b896c51a1eafd3ef7fc4eee7c2ac0b
[ "MIT" ]
permissive
okfde/froide
d022407ec30bf018e6ca587ae9df0b73a8625edf
16e3c69b333fc82cb1e52378fc003ddf071152a7
refs/heads/main
2023-08-31T08:02:23.343743
2023-08-29T07:01:03
2023-08-29T07:01:03
1,700,944
230
48
MIT
2023-09-13T09:10:40
2011-05-04T12:20:51
Python
UTF-8
Python
false
false
15,410
py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import django.db.models.deletion import django.db.models.manager import django.utils.timezone from django.conf import settings from django.db import migrations, models import parler import taggit.managers import froide.publicbody.models class Migration(migrations.Migration): dependencies = [ ("sites", "0001_initial"), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name="FoiLaw", fields=[ ( "id", models.AutoField( verbose_name="ID", serialize=False, auto_created=True, primary_key=True, ), ), ("name", models.CharField(max_length=255, verbose_name="Name")), ("slug", models.SlugField(max_length=255, verbose_name="Slug")), ( "description", models.TextField(verbose_name="Description", blank=True), ), ( "long_description", models.TextField(verbose_name="Website Text", blank=True), ), ( "created", models.DateField( null=True, verbose_name="Creation Date", blank=True ), ), ( "updated", models.DateField( null=True, verbose_name="Updated Date", blank=True ), ), ( "request_note", models.TextField(verbose_name="request note", blank=True), ), ("meta", models.BooleanField(default=False, verbose_name="Meta Law")), ( "letter_start", models.TextField(verbose_name="Start of Letter", blank=True), ), ( "letter_end", models.TextField(verbose_name="End of Letter", blank=True), ), ( "priority", models.SmallIntegerField(default=3, verbose_name="Priority"), ), ( "url", models.CharField(max_length=255, verbose_name="URL", blank=True), ), ( "max_response_time", models.IntegerField( default=30, null=True, verbose_name="Maximal Response Time", blank=True, ), ), ( "max_response_time_unit", models.CharField( default=b"day", max_length=32, verbose_name="Unit of Response Time", blank=True, choices=[ (b"day", "Day(s)"), (b"working_day", "Working Day(s)"), (b"month_de", "Month(s) (DE)"), ], ), ), ( "refusal_reasons", models.TextField( verbose_name="Possible Refusal Reasons, one per line, e.g \xa7X.Y: Privacy Concerns", blank=True, ), ), ( "email_only", models.BooleanField(default=False, verbose_name="E-Mail only"), ), ( "combined", models.ManyToManyField( to="publicbody.FoiLaw", verbose_name="Combined Laws", blank=True ), ), ], options={ "verbose_name": "Freedom of Information Law", "verbose_name_plural": "Freedom of Information Laws", }, bases=(parler.models.TranslatableModelMixin, models.Model), ), migrations.CreateModel( name="Jurisdiction", fields=[ ( "id", models.AutoField( verbose_name="ID", serialize=False, auto_created=True, primary_key=True, ), ), ("name", models.CharField(max_length=255, verbose_name="Name")), ("slug", models.SlugField(max_length=255, verbose_name="Slug")), ( "description", models.TextField(verbose_name="Description", blank=True), ), ("hidden", models.BooleanField(default=False, verbose_name="Hidden")), ("rank", models.SmallIntegerField(default=1)), ], options={ "verbose_name": "Jurisdiction", "verbose_name_plural": "Jurisdictions", }, ), migrations.CreateModel( name="PublicBody", fields=[ ( "id", models.AutoField( verbose_name="ID", serialize=False, auto_created=True, primary_key=True, ), ), ("name", models.CharField(max_length=255, verbose_name="Name")), ( "other_names", models.TextField( default=b"", verbose_name="Other names", blank=True ), ), ("slug", models.SlugField(max_length=255, verbose_name="Slug")), ( "description", models.TextField(verbose_name="Description", blank=True), ), ( "url", models.URLField( max_length=500, null=True, verbose_name="URL", blank=True ), ), ("depth", models.SmallIntegerField(default=0)), ( "classification", models.CharField( max_length=255, verbose_name="Classification", blank=True ), ), ( "classification_slug", models.SlugField( max_length=255, verbose_name="Classification Slug", blank=True ), ), ( "email", models.EmailField( max_length=254, null=True, verbose_name="Email", blank=True ), ), ("contact", models.TextField(verbose_name="Contact", blank=True)), ("address", models.TextField(verbose_name="Address", blank=True)), ( "website_dump", models.TextField( null=True, verbose_name="Website Dump", blank=True ), ), ( "request_note", models.TextField(verbose_name="request note", blank=True), ), ( "created_at", models.DateTimeField( default=django.utils.timezone.now, verbose_name="Created at" ), ), ( "updated_at", models.DateTimeField( default=django.utils.timezone.now, verbose_name="Updated at" ), ), ( "confirmed", models.BooleanField(default=True, verbose_name="confirmed"), ), ( "number_of_requests", models.IntegerField(default=0, verbose_name="Number of requests"), ), ( "_created_by", models.ForeignKey( related_name="public_body_creators", on_delete=django.db.models.deletion.SET_NULL, default=1, blank=True, to=settings.AUTH_USER_MODEL, null=True, verbose_name="Created by", ), ), ( "_updated_by", models.ForeignKey( related_name="public_body_updaters", on_delete=django.db.models.deletion.SET_NULL, default=1, blank=True, to=settings.AUTH_USER_MODEL, null=True, verbose_name="Updated by", ), ), ( "jurisdiction", models.ForeignKey( on_delete=django.db.models.deletion.SET_NULL, verbose_name="Jurisdiction", blank=True, to="publicbody.Jurisdiction", null=True, ), ), ( "laws", models.ManyToManyField( to="publicbody.FoiLaw", verbose_name="Freedom of Information Laws", ), ), ( "parent", models.ForeignKey( related_name="children", on_delete=django.db.models.deletion.SET_NULL, default=None, blank=True, to="publicbody.PublicBody", null=True, ), ), ( "root", models.ForeignKey( related_name="descendants", on_delete=django.db.models.deletion.SET_NULL, default=None, blank=True, to="publicbody.PublicBody", null=True, ), ), ( "site", models.ForeignKey( on_delete=django.db.models.deletion.SET_NULL, default=1, verbose_name="Site", to="sites.Site", null=True, ), ), ], options={ "ordering": ("name",), "verbose_name": "Public Body", "verbose_name_plural": "Public Bodies", }, managers=[ ("non_filtered_objects", django.db.models.manager.Manager()), ("published", froide.publicbody.models.PublicBodyManager()), ], ), migrations.CreateModel( name="PublicBodyTag", fields=[ ( "id", models.AutoField( verbose_name="ID", serialize=False, auto_created=True, primary_key=True, ), ), ( "name", models.CharField(unique=True, max_length=100, verbose_name="Name"), ), ( "slug", models.SlugField(unique=True, max_length=100, verbose_name="Slug"), ), ( "is_topic", models.BooleanField(default=False, verbose_name="as topic"), ), ("rank", models.SmallIntegerField(default=0, verbose_name="rank")), ], options={ "verbose_name": "Public Body Tag", "verbose_name_plural": "Public Body Tags", }, ), migrations.CreateModel( name="TaggedPublicBody", fields=[ ( "id", models.AutoField( verbose_name="ID", serialize=False, auto_created=True, primary_key=True, ), ), ( "content_object", models.ForeignKey( to="publicbody.PublicBody", on_delete=django.db.models.deletion.CASCADE, ), ), ( "tag", models.ForeignKey( related_name="publicbodies", to="publicbody.PublicBodyTag", on_delete=django.db.models.deletion.CASCADE, ), ), ], options={ "verbose_name": "Tagged Public Body", "verbose_name_plural": "Tagged Public Bodies", }, ), migrations.AddField( model_name="publicbody", name="tags", field=taggit.managers.TaggableManager( to="publicbody.PublicBodyTag", through="publicbody.TaggedPublicBody", blank=True, help_text="A comma-separated list of tags.", verbose_name="Tags", ), ), migrations.AddField( model_name="foilaw", name="jurisdiction", field=models.ForeignKey( on_delete=django.db.models.deletion.SET_NULL, verbose_name="Jurisdiction", blank=True, to="publicbody.Jurisdiction", null=True, ), ), migrations.AddField( model_name="foilaw", name="mediator", field=models.ForeignKey( related_name="mediating_laws", on_delete=django.db.models.deletion.SET_NULL, default=None, blank=True, to="publicbody.PublicBody", null=True, verbose_name="Mediator", ), ), migrations.AddField( model_name="foilaw", name="site", field=models.ForeignKey( on_delete=django.db.models.deletion.SET_NULL, default=1, verbose_name="Site", to="sites.Site", null=True, ), ), ]
[ "mail@stefanwehrmeyer.com" ]
mail@stefanwehrmeyer.com
6a9c731ec3f178280fea0968e582e1e28db041bc
fa93e53a9eee6cb476b8998d62067fce2fbcea13
/build/play_motion/catkin_generated/pkg.develspace.context.pc.py
446b10b7da92a6a54200af7d1784053b527689fa
[]
no_license
oyetripathi/ROS_conclusion_project
2947ee2f575ddf05480dabc69cf8af3c2df53f73
01e71350437d57d8112b6cec298f89fc8291fb5f
refs/heads/master
2023-06-30T00:38:29.711137
2021-08-05T09:17:54
2021-08-05T09:17:54
392,716,311
0
1
null
null
null
null
UTF-8
Python
false
false
691
py
# generated from catkin/cmake/template/pkg.context.pc.in CATKIN_PACKAGE_PREFIX = "" PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/sandeepan/tiago_public_ws/src/play_motion/play_motion/include".split(';') if "/home/sandeepan/tiago_public_ws/src/play_motion/play_motion/include" != "" else [] PROJECT_CATKIN_DEPENDS = "actionlib;control_msgs;controller_manager_msgs;play_motion_msgs;moveit_ros_planning_interface;roscpp;sensor_msgs".replace(';', ' ') PKG_CONFIG_LIBRARIES_WITH_PREFIX = "-lplay_motion_helpers".split(';') if "-lplay_motion_helpers" != "" else [] PROJECT_NAME = "play_motion" PROJECT_SPACE_DIR = "/home/sandeepan/tiago_public_ws/devel/.private/play_motion" PROJECT_VERSION = "0.4.8"
[ "sandeepan.ghosh.ece20@itbhu.ac.in" ]
sandeepan.ghosh.ece20@itbhu.ac.in
3afe908391e9c27bf9f3d9152db25e5c2f300855
e9112befb28183ed05418dfc0132240247fe5b09
/stims/BartlettEdgeJoe.py
92abd5157328da72513683e440ced2e7b0a102b9
[]
no_license
msarvestani/passive-stim-with-eye-tracking
ea801f54786ce3912a699d95b3ace684dc68d155
9dad3a3ee1a0c1930757765c428ffe9c44492a07
refs/heads/main
2023-04-21T05:54:15.716593
2021-05-10T05:10:04
2021-05-10T05:10:04
365,922,867
0
0
null
null
null
null
UTF-8
Python
false
false
12,281
py
#Hartley subspace_Kuo """ This is for reverse correaltion experiment with Hartley subspace %% Seq file name is on line 190 """ from __future__ import division # so that 1/3=0.333 instead of 1/3=0 from psychopy import visual, core, data, event, logging, sound, gui, filters, monitors from psychopy.constants import * # things like STARTED, FINISHED import numpy as np # whole numpy lib is available, prepend 'np.' from numpy import sin, cos, tan, log, log10, pi, average, sqrt, std, deg2rad, rad2deg, linspace, asarray from numpy.random import random, randint, normal, shuffle import pylab, math, random, numpy, time, imp, sys import os, random # handy system and path functions sys.path.append("../triggers") #path to trigger classes from os import path from array import array import csv print "initialized" #---------- Monitor Properties ----------## mon= monitors.Monitor('stim2') #gets the calibration for stimMonitor mon.setDistance(20) # ---------- Stimulus Parameters ---------- ## timepertrial = 1 # Duration for tiral, stimulus and ISI # 26s for single trial stitime = 0.5 ISItime = 0.5 Trinumber = 80 #repeat #Run all the stims this many times Imasize = [814, 814] # size of image by pix centerPoint = [113,150] changeDirectionTimeAt = .25 degPerFrame = .01 direc = 90 # Set the random sequence items = range(1,181) #For 512 images random.shuffle(items) # randomize the sequence cc=-1 # Store info about the experiment session expName1 = u'trials' # from the Builder filename that created this script expInfo = {u'session': u'001', u'participant': u''} expInfo['date'] = data.getDateStr() # add a simple timestamp expInfo['expName'] = expName1 #Triggering type #Can be any of: # "NoTrigger" - no triggering; stim will run freely # "SerialDaqOut" - Triggering by serial port. Stim codes are written to the MCC DAQ. # "OutOnly" - no input trigger, but does all output (to CED) and logging # "DaqIntrinsicTrigger" - waits for stimcodes on the MCC DAQ and displays the appropriate stim ID #<<<<<<< HEAD I don't know what is it? triggerType = 'OutOnly' #'NoTrigge' serialPortName = 'COM1' # ignored if triggerType is "None" adjustDurationToMatch2P=0 #Experiment logging parameters########## dataPath='y:/' animalName='F1642_2014-05-14'; logFilePath =dataPath+animalName+'\\'+animalName+'.txt' #including filepath #======= #triggerType = 'OutOnly' #serialPortName = 'COM1' # ignored if triggerType is "None" #adjustDurationToMatch2P=True # #dataPath='G:/Data' #>>>>>>> 5a32817238385507c65f3723f961d93640bd44f6 #animalName='FXXXX_2014-05-05'; #logFilePath =dataPath+animalName+'\\'+animalName+'.txt' #including filepath #Experiment logging parameters########## # Setup files for saving if not os.path.isdir('C:/Users/fitzlab1/Documents/psychopy/Dan/kuo/data'): os.makedirs('C:/Users/fitzlab1/Documents/psychopy/Dan/kuo/data') # if this fails (e.g. permissions) we will get error filename = 'C:/Users/fitzlab1/Documents/psychopy/Dan/kuo/data' + os.path.sep + '%s_%s' %(expInfo['participant'], expInfo['date']) logFile = logging.LogFile(filename+'.log', level=logging.EXP) logging.console.setLevel(logging.WARNING) # this outputs to the screen, not a file # An ExperimentHandler thisExp = data.ExperimentHandler(name=expName1, version='', extraInfo=expInfo, runtimeInfo=None, originPath=None, savePickle=True, saveWideText=True, dataFileName=filename) # ---------- Stimulus code begins here ---------- # stimCodeName=path.dirname(path.realpath(__file__))+'\\'+path.basename(__file__) # Setup the Window win = visual.Window(size=[1000, 1000], monitor=mon, fullscr=True, screen=1, allowGUI=True, allowStencil=False, color=[0,0,0], colorSpace=u'rgb', waitBlanking=True) # store frame rate of monitor if we can measure it successfully expInfo['frameRate']=win.getActualFrameRate() if expInfo['frameRate']!=None: frameDur = 1.0/round(expInfo['frameRate']) else: frameDur = 1.0/60.0 # couldn't get a reliable measure so guess #win.setGamma(.479) #print myWin.gamma print "made window, setting up triggers" #Set up the trigger behavior trigger = None if triggerType == 'NoTrigger': import noTrigger trigger = noTrigger.noTrigger(None) elif triggerType == 'SerialDaqOut' or triggerType == 'OutOnly': import serialTriggerDaqOut print 'Imported trigger serialTriggerDaqOut' trigger = serialTriggerDaqOut.serialTriggerDaqOut(serialPortName) if triggerType == 'OutOnly': trigger.readSer=False #Record a bunch of serial triggers and fit the stim duration to an exact multiple of the trigger time if adjustDurationToMatch2P: stimDuration = trigger.extendStimDurationToFrameEnd(stimDuration) # determine the Next experiment file name expName=trigger.getNextExpName([dataPath,animalName]) print "Trial name: ",expName # store the stimulus data and prepare the directory #trigger.preTrialLogging([dataPath,animalName,expName,stimCodeName,orientations,logFilePath]) elif triggerType=="DaqIntrinsicTrigger": import daqIntrinsicTrigger trigger = daqIntrinsicTrigger.daqIntrinsicTrigger(None) else: print "Unknown trigger type", triggerType #print stimDuration #changeDirectionTimeAt = stimDuration * changeDirectionAt barTexture = numpy.ones([256,256,3]); flipStim = visual.PatchStim(win=win,tex=barTexture,mask='none',units='pix',pos=centerPoint,size=(814,814)) #flipStim.setAutoDraw(True)#up left, this is pos in y, neg in x clrctr=1; print "made stimulus ensemble" initialDelay=3 clock=core.Clock() if initialDelay>0: print" waiting "+str(initialDelay)+ " seconds before starting stim to acquire a baseline." flipStim.setContrast(1) while clock.getTime()<initialDelay: win.flip() clock.reset() # Initialize components for Routine "trial" trialClock = core.Clock() print "\n", ";-)", "stims will be run for",str(Trinumber),"trials." ISI = core.StaticPeriod(win=win, screenHz=expInfo['frameRate'], name='ISI') image = visual.ImageStim(win=win, name='image',units=u'pix', image='sin', mask=None, ori=0, pos=centerPoint, size=Imasize, color=[1,1,1], colorSpace=u'rgb', opacity=1, texRes=128, interpolate=True, depth=-1.0) # Create some handy timers globalClock = core.Clock() # to track the time since experiment started routineTimer = core.CountdownTimer() # to track time remaining of each (non-slip) routine # set up handler to look after randomisation of conditions etc trials = data.TrialHandler(nReps=Trinumber, method=u'random', extraInfo=expInfo, originPath=None, trialList=data.importConditions(u'condition4.xlsx'), seed=None, name='trials') # nReps*Conditions will be the time of repeats thisExp.addLoop(trials) # add the loop to the experiment thisTrial = trials.trialList[0] # so we can initialise stimuli with some values # abbreviate parameter names if possible (e.g. rgb=thisTrial.rgb) a=[] if thisTrial != None: for paramName in thisTrial.keys(): exec(paramName + '= thisTrial.' + paramName) for thisTrial in trials: currentLoop = trials #modified by Kuo on 5/12 !! image.setPos(centerPoint) trialClock.reset() #trigger.waitForSerial(); # Gordan 5/12 trigger.preStim(1) #flipStim.setAutoDraw(True) #didn't do the flip contrast change like: flipStim.setColor((0,0,0),colorSpace='rgb') flipStim.setContrast(1) cc = cc+1 # sequence begins here if cc > 179: random.shuffle(items) cc=cc%180 # abbreviate parameter names if possible (e.g. rgb = thisTrial.rgb) if thisTrial != None: for paramName in thisTrial.keys(): exec(paramName + '= thisTrial.' + paramName) #------Prepare to start Routine "trial"------- t = 0 #trialClock.reset() # clock 5/12 frameN = -1 routineTimer.add(timepertrial) # update component parameters for each repeat aa=items[cc] print aa # 5/14 # 5/14 output stimulus sequence to excel a.extend([[aa]]) fl = open('WNJoeSeq.csv', 'w') writer = csv.writer(fl) # writer.writerow(['label1']) #if needed for values in a: writer.writerow(values) #Iname='C:/Users/fitzlab1/Documents/psychopy/Joe/exp/tiffDir_GaussWN/wn'+str(1)+'_' +'{:04.0f}'.format(aa)+ '.tif' Iname='C:/Users/fitzlab1/Documents/psychopy/Joe/exp/bartlett_edge4_comb/a'+'{:04.0f}'.format(aa)+ '.tif' #Iname = 'C:/Users/fitzlab1/Documents/psychopy/Gordon/episodicStims/WaveletStims/tiffDir_GaussWN/wn'+str(1)+'_' + '{:04.0f}'.format(aa)+ '.tif' image.setImage(Iname) # keep track of which components have finished trialComponents = [] trialComponents.append(ISI) trialComponents.append(image) for thisComponent in trialComponents: if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED #-------Start Routine "trial"------- continueRoutine = True while continueRoutine and routineTimer.getTime() > 0: # get current time t = trialClock.getTime() frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *image* updates if t < stitime and image.status == NOT_STARTED: # keep track of start time/frame for later image.tStart = t # underestimates by a little under one frame image.frameNStart = frameN # exact frame index #image.setAutoDraw(True) if t>changeDirectionTimeAt: image.setPos([degPerFrame*math.degrees(math.cos(math.radians(direc-180))),degPerFrame*math.degrees(math.sin(math.radians(direc-180)))],'+', 'deg') else: # present stimulus for this trial image.setPos([degPerFrame*math.degrees(math.cos(math.radians(direc))),degPerFrame*math.degrees(math.sin(math.radians(direc)))],'+', 'deg') image.draw() elif image.status == STARTED and t >= (0.0 + stitime): image.setAutoDraw(False) # *ISI* period if t >= stitime and ISI.status == NOT_STARTED: # keep track of start time/frame for later ISI.tStart = t # underestimates by a little under one frame ISI.frameNStart = frameN # exact frame index ISItime = timepertrial - t # 5/9 ISI.start(ISItime) flipStim.setPos([image.pos]) flipStim.draw() elif ISI.status == STARTED: #one frame should pass before updating params and completing ISI.complete() #finish the static period # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine routineTimer.reset() # if we abort early the non-slip timer needs reset break continueRoutine = False # will revert to True if at least one component still running for thisComponent in trialComponents: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished flipStim.setContrast(0) # check for quit (the [Esc] key) if event.getKeys(["escape"]): core.quit() # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen trigger.preFlip(None) win.flip() trigger.postFlip(None) #-------Ending Routine "trial"------- for thisComponent in trialComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.nextEntry() trigger.postStim(None) # completed 512 repeats of 'trials' # trigger.wrapUp([logFilePath, expName]) print 'Finished all stimuli.' # get names of stimulus parameters if trials.trialList in ([], [None], None): params = [] else: params = trials.trialList[0].keys() # save data for this loop trials.saveAsExcel(filename + 'trials'+ '.xlsx', sheetName='trials', stimOut=params, dataOut=['n','all_mean','all_std', 'all_raw']) #[params, items] win.close() core.quit()
[ "naroom@gmail.com" ]
naroom@gmail.com
7e1625f57fe84fe7dd1f3b22951765a30e604e33
f576f0ea3725d54bd2551883901b25b863fe6688
/eng/tox/run_verifytypes.py
762ada2b77e747b7aacca4898f734320a7d6892e
[ "LicenseRef-scancode-generic-cla", "MIT", "LGPL-2.1-or-later" ]
permissive
Azure/azure-sdk-for-python
02e3838e53a33d8ba27e9bcc22bd84e790e4ca7c
c2ca191e736bb06bfbbbc9493e8325763ba990bb
refs/heads/main
2023-09-06T09:30:13.135012
2023-09-06T01:08:06
2023-09-06T01:08:06
4,127,088
4,046
2,755
MIT
2023-09-14T21:48:49
2012-04-24T16:46:12
Python
UTF-8
Python
false
false
5,930
py
#!/usr/bin/env python # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- # This script is used to execute verifytypes within a tox environment. It additionally installs # the package from main and compares its type completeness score with # that of the current code. If type completeness worsens from the code in main, the check fails. import typing import pathlib import subprocess import json import argparse import os import logging import sys import tempfile from ci_tools.environment_exclusions import is_check_enabled, is_typing_ignored from ci_tools.variables import in_ci logging.getLogger().setLevel(logging.INFO) root_dir = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", "..")) def install_from_main(setup_path: str) -> None: path = pathlib.Path(setup_path) subdirectory = path.relative_to(root_dir) cwd = os.getcwd() with tempfile.TemporaryDirectory() as temp_dir_name: os.chdir(temp_dir_name) try: subprocess.check_call(['git', 'init'], stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT) subprocess.check_call( ['git', 'clone', '--no-checkout', 'https://github.com/Azure/azure-sdk-for-python.git', '--depth', '1'], stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT ) os.chdir("azure-sdk-for-python") subprocess.check_call(['git', 'sparse-checkout', 'init', '--cone'], stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT) subprocess.check_call(['git', 'sparse-checkout', 'set', subdirectory], stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT) subprocess.check_call(['git', 'checkout', 'main'], stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT) if not os.path.exists(os.path.join(os.getcwd(), subdirectory)): # code is not checked into main yet, nothing to compare exit(0) os.chdir(subdirectory) command = [ sys.executable, "-m", "pip", "install", ".", "--force-reinstall" ] subprocess.check_call(command, stdout=subprocess.DEVNULL) finally: os.chdir(cwd) # allow temp dir to be deleted def get_type_complete_score(commands: typing.List[str], check_pytyped: bool = False) -> float: try: response = subprocess.run( commands, check=True, capture_output=True, ) except subprocess.CalledProcessError as e: if e.returncode != 1: logging.info( f"Running verifytypes failed: {e.stderr}. See https://aka.ms/python/typing-guide for information." ) exit(1) report = json.loads(e.output) if check_pytyped: pytyped_present = report["typeCompleteness"].get("pyTypedPath", None) if not pytyped_present: print( f"No py.typed file was found. See aka.ms/python/typing-guide for information." ) exit(1) return report["typeCompleteness"]["completenessScore"] # library scores 100% report = json.loads(response.stdout) return report["typeCompleteness"]["completenessScore"] if __name__ == "__main__": parser = argparse.ArgumentParser( description="Run pyright verifytypes against target folder. " ) parser.add_argument( "-t", "--target", dest="target_package", help="The target package directory on disk. The target module passed to run pyright will be <target_package>/azure.", required=True, ) args = parser.parse_args() package_name = os.path.basename(os.path.abspath(args.target_package)) module = package_name.replace("-", ".") setup_path = os.path.abspath(args.target_package) if in_ci(): if not is_check_enabled(args.target_package, "verifytypes") or is_typing_ignored(package_name): logging.info( f"{package_name} opts-out of verifytypes check. See https://aka.ms/python/typing-guide for information." ) exit(0) commands = [ sys.executable, "-m", "pyright", "--verifytypes", module, "--ignoreexternal", "--outputjson", ] # get type completeness score from current code score_from_current = get_type_complete_score(commands, check_pytyped=True) # show output try: subprocess.check_call(commands[:-1]) except subprocess.CalledProcessError: pass # we don't fail on verifytypes, only if type completeness score worsens from main # get type completeness score from main logging.info( "Getting the type completeness score from the code in main..." ) install_from_main(setup_path) score_from_main = get_type_complete_score(commands) score_from_main_rounded = round(score_from_main * 100, 1) score_from_current_rounded = round(score_from_current * 100, 1) print("\n-----Type completeness score comparison-----\n") print(f"Score in main: {score_from_main_rounded}%") # Give a 5% buffer for type completeness score to decrease if score_from_current_rounded < score_from_main_rounded - 5: print( f"\nERROR: The type completeness score of {package_name} has significantly decreased compared to the score in main. " f"See the above output for areas to improve. See https://aka.ms/python/typing-guide for information." ) exit(1)
[ "noreply@github.com" ]
Azure.noreply@github.com
d49151be7fd79310dd4e2645a3988f2e57d4e242
2ecf5a1fa16226052b9c7bbd607fd9df50d0df7f
/24.py
4cc150d7784cff5733cc81afb44760e197fadc7e
[]
no_license
samrithasudhagar/guvi
288421b091460fc9e4e5d89d50b716450da30ca3
f30706270acca5cf25eaf325c2c0f193636470b9
refs/heads/master
2020-04-15T04:58:42.881053
2019-02-02T15:05:36
2019-02-02T15:05:36
164,404,341
0
2
null
null
null
null
UTF-8
Python
false
false
127
py
s="" n=int(input()) l=list(map(int,input().split())) l.sort() for i in range(0,len(l)): s=s+str(l[i])+" " print(s.strip()) #i
[ "noreply@github.com" ]
samrithasudhagar.noreply@github.com
8aa9c06ffa56b65332bf3a4596300d836a9c88be
b0e22deb519ec621b5f866bb15d15d597e6e75d4
/ciscoisesdk/models/validators/v3_0_0/jsd_ab203a1dd0015924bf2005a84ae85477.py
9f0a8fd4323e48dcbd27985f5b7127c2d7ea108e
[ "MIT" ]
permissive
oianson/ciscoisesdk
49ed9cd785a8e463cac4c5de3b1f3ff19e362871
c8fe9d80416048dd0ff2241209c4f78ab78c1a4a
refs/heads/main
2023-07-31T20:08:29.027482
2021-07-09T15:16:04
2021-07-09T15:16:04
385,743,799
0
0
MIT
2021-07-13T21:52:18
2021-07-13T21:52:18
null
UTF-8
Python
false
false
2,516
py
# -*- coding: utf-8 -*- """Identity Services Engine bulkRequestForIPToSGTMapping data model. Copyright (c) 2021 Cisco and/or its affiliates. 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. """ from __future__ import ( absolute_import, division, print_function, unicode_literals, ) import fastjsonschema import json from ciscoisesdk.exceptions import MalformedRequest from builtins import * class JSONSchemaValidatorAb203A1DD0015924Bf2005A84Ae85477(object): """bulkRequestForIPToSGTMapping request schema definition.""" def __init__(self): super(JSONSchemaValidatorAb203A1DD0015924Bf2005A84Ae85477, self).__init__() self._validator = fastjsonschema.compile(json.loads( '''{ "$schema": "http://json-schema.org/draft-04/schema#", "properties": { "SGMappingBulkRequest": { "properties": { "operationType": { "type": "string" }, "resourceMediaType": { "type": "string" } }, "type": "object" } }, "type": "object" }'''.replace("\n" + ' ' * 16, '') )) def validate(self, request): try: self._validator(request) except fastjsonschema.exceptions.JsonSchemaException as e: raise MalformedRequest( '{} is invalid. Reason: {}'.format(request, e.message) )
[ "wastorga@altus.co.cr" ]
wastorga@altus.co.cr
cd645756f1ac5b85b1c2c540d0a54907e4b6abc6
487ce91881032c1de16e35ed8bc187d6034205f7
/codes/CodeJamCrawler/CJ/16_0_1_aniketshah_counting_sheep.py
b23af25099e5a94affe671bb50162a7d3a36c0f6
[]
no_license
DaHuO/Supergraph
9cd26d8c5a081803015d93cf5f2674009e92ef7e
c88059dc66297af577ad2b8afa4e0ac0ad622915
refs/heads/master
2021-06-14T16:07:52.405091
2016-08-21T13:39:13
2016-08-21T13:39:13
49,829,508
2
0
null
2021-03-19T21:55:46
2016-01-17T18:23:00
Python
UTF-8
Python
false
false
699
py
def countingSheep(startNumber): if startNumber == 0: return "INSOMNIA" numbersSeen = set([]) i = 0 number = 0 while (len(numbersSeen) < 10): i = i + 1 number = startNumber * i for d in str(number): numbersSeen.add(d) return number readFile = open("A-large.in") writeFile = open("A-large.out", "a") numberOfTestCases = -1 caseNumber = 1 for line in readFile.readlines(): if(numberOfTestCases == -1): numberOfTestCases = int(line) continue writeFile.write("Case #" + str(caseNumber) + ": " + str(countingSheep(int(line))) + "\n") caseNumber = caseNumber + 1 readFile.close() writeFile.close()
[ "[dhuo@tcd.ie]" ]
[dhuo@tcd.ie]
c6d4934ea3a2820d247f639becd1a94b8cc5068b
d308fffe3db53b034132fb1ea6242a509f966630
/pirates/piratesgui/RadioButton.py
9682de9337946e58656d2cbcef9c94eb1e501eb5
[ "BSD-3-Clause" ]
permissive
rasheelprogrammer/pirates
83caac204965b77a1b9c630426588faa01a13391
6ca1e7d571c670b0d976f65e608235707b5737e3
refs/heads/master
2020-03-18T20:03:28.687123
2018-05-28T18:05:25
2018-05-28T18:05:25
135,193,362
3
2
null
null
null
null
UTF-8
Python
false
false
2,175
py
# uncompyle6 version 3.2.0 # Python bytecode 2.4 (62061) # Decompiled from: Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] # Embedded file name: pirates.piratesgui.RadioButton from pandac.PandaModules import * from direct.gui.DirectButton import * class RadioButton(DirectButton): __module__ = __name__ def __init__(self, parent=None, **kw): gui_main = loader.loadModel('models/gui/gui_main') icon_sphere = gui_main.find('**/icon_sphere') icon_torus = gui_main.find('**/icon_torus') icon_torus_over = gui_main.find('**/icon_torus_over') gui_main.removeNode() optiondefs = ( ('geom', None, None), ('checkedGeom', icon_sphere, None), ('image', (icon_torus, icon_torus, icon_torus_over, icon_torus), None), ('geom_color', VBase4(1, 1, 1, 1), None), ('image_scale', 1.4, None), ('variable', [], None), ('value', [], None), ('others', [], None), ('relief', None, None), ('isChecked', False, None)) self.defineoptions(kw, optiondefs) DirectButton.__init__(self, parent) self.initialiseoptions(RadioButton) needToCheck = True if len(self['value']) == len(self['variable']) != 0: for i in range(len(self['value'])): if self['variable'][i] != self['value'][i]: needToCheck = False break if needToCheck: self.check(False) return def commandFunc(self, event): self.check() def check(self, fCommand=True): if len(self['value']) == len(self['variable']) != 0: for i in range(len(self['value'])): self['variable'][i] = self['value'][i] self['isChecked'] = True self['geom'] = self['checkedGeom'] for other in self['others']: if other != self: other.uncheck() if fCommand and self['command']: apply(self['command'], [self['value']] + self['extraArgs']) def setOthers(self, others): self['others'] = others def uncheck(self): self['isChecked'] = False self['geom'] = None return
[ "33942724+itsyaboyrocket@users.noreply.github.com" ]
33942724+itsyaboyrocket@users.noreply.github.com
6a5974222c1f21fd29a28373a56179bd00333e3f
cb8c62659f9509bbc01237a09cf8730b57f4a84f
/Dcc/plugin.py
4a6c21ee8bb1c8df680fb88a8add5af49aa94430
[]
no_license
stepnem/supybot-plugins
5bd795319036ab21cd81b00a23e0c1f712876d3e
6838f7ae22ad1905272cf7e003fb803e637c87d8
refs/heads/master
2021-01-01T18:49:44.478383
2012-01-05T04:14:24
2012-01-05T04:14:24
281,407
8
4
null
2016-11-01T20:15:17
2009-08-18T21:55:56
Python
UTF-8
Python
false
false
7,407
py
### # Copyright (c) 2005, Ali Afshar # All rights reserved. # # Redistribution and use 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. # * Neither the name of the author of this software nor the name of # contributors to this software may be used to endorse or promote products # derived from this software without specific prior written consent. # # 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. ### # Supybot imports import supybot.ircdb as ircdb import supybot.utils as utils from supybot.commands import * import supybot.ircmsgs as ircmsgs import supybot.plugins as plugins import supybot.ircutils as ircutils import supybot.callbacks as callbacks # Twisted imports from twisted.protocols import basic import twisted.internet.reactor as reactor import twisted.internet.protocol as protocol # System imports import sys import socket import struct # Carriage return characters CR = chr(015) NL = chr(012) LF = NL # aspn cookbook def numToDottedQuad(n): "convert long int to dotted quad string" return socket.inet_ntoa(struct.pack('>L',n)) # Plugin class Dcc(callbacks.Plugin): """ A plugin to allow users to connect with Dcc. To use, load the plugin, and initiate a dcc request. There are no configuration variables, but to control which users connect, use the Dcc capability.""" def __init__(self, irc): callbacks.Plugin.__init__(self, irc) self.irc = irc self.factory = SupyDccFactory(self) self.hostmasks = {} self.connections = {} def outFilter(self, irc, msg): """ Checks messages for those sent via Dcc and routes them. """ if msg.inReplyTo: if msg.inReplyTo.fromDcc: # a dcc message con = msg.inReplyTo.fromDcc # send the reply via dcc, and return None con.sendReply(msg.args[1]) return None else: # otherwise pass the message on return msg else: # otherwise pass the message on return msg def exit(self, irc, msg, args): """[takes no arguments] Exit a Dcc session. This command can only be called from Dcc, and not from standard IRC """ if msg.fromDcc: connection = msg.fromDcc connection.close() else: irc.reply('"exit" may only be called from DCC.') exit = wrap(exit, []) def die(self): """ Shut down all the connections. """ for hostport in self.connections: self.connections[hostport].close() self.connections = {} self.hostmasks = {} def _connectDcc(self, host, port): """ Connect to a DCC connection. """ reactor.connectTCP(host, port, self.factory) def _dccRequest(self, hostmask, command): """ Handle a DCC request. """ args = command.split() if args[1].startswith('CHAT'): try: port = int(args.pop()) host = numToDottedQuad(int(args.pop())) self._dccChatRequest(hostmask, host, port) except ValueError: self.log.debug('Bad DCC request: %s', command.strip()) def _dccChatRequest(self, hostmask, host, port): """ Handle a Dcc chat request. """ if self._isDccCapable(hostmask): self.hostmasks[(host, port)] = hostmask self._connectDcc(host, port) else: self.log.debug('Failed connection attempt, incapable %s.', hostmask) def _isDccCapable(self, hostmask): """ Check if the user is DCC capable. """ return ircdb.checkCapability(hostmask, 'Dcc') def _lineReceived(self, connection, host, port, line): """ Handle a line received over DCC. """ if (host, port) in self.hostmasks: hm = self.hostmasks[(host, port)] cmd = line.strip() to = self.irc.nick m = ircmsgs.privmsg(to, cmd, hm) m.tag('fromDcc', connection) self.irc.feedMsg(m) def doPrivmsg(self, irc, msg): """ Check whether a privmsg is a DCC request. """ text = msg.args[1].strip('\x01') if text.startswith('DCC'): self._dccRequest(msg.prefix, text) class SupyDccChat(basic.LineReceiver): """ Basic line protocol """ def __init__(self, cb): self.cb = cb self.delimiter = CR + NL self.rbuffer = "" def connectionMade(self): """ Called when the connection has been made. """ t, self.host, self.port = self.transport.getPeer() self.cb.connections[(self.host, self.port)] = self self.transport.write('Connected to Supybot Dcc interface.\r\n') def connectionLost(self, reason): """ Called when the connection has been lost, or closed. """ del self.cb.connections[(self.host, self.port)] del self.cb.hostmasks[(self.host, self.port)] def dataReceived(self, data): """ Called when data is received. """ self.rbuffer = self.rbuffer + data lines = self.rbuffer.split(LF) # Put the (possibly empty) element after the last LF back in the # buffer self.rbuffer = lines.pop() for line in lines: if line[-1] == CR: line = line[:-1] self.lineReceived(line) def lineReceived(self, line): """ Called on the receipt of each line. """ self.cb._lineReceived(self, self.host, self.port, line) def sendReply(self, reply): """ Send a reply. """ self.transport.write('%s\r\n' % reply) def close(self): self.sendReply('* Closing connection down.') self.transport.loseConnection() class SupyDccFactory(protocol.ClientFactory): """ Client connector factory for Dcc """ def __init__(self, cb): self.cb = cb self.protocol = SupyDccChat def buildProtocol(self, addr): """ Called to create an instance of the protocol. """ p = self.protocol(self.cb) p.factory = self return p Class = Dcc # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
[ "stepnem@gmail.com" ]
stepnem@gmail.com
76075941bd7e467d44995643e233f13eca483d18
e3d969e2c9e4b57f4f7d58af5e44a00aa8fb15d3
/0124 Binary Tree Maximum Path Sum.py
3772643dcebbd0d82ff8dd51ecb723631c33f535
[ "MIT" ]
permissive
kevin-fang/leetcode
2744ff01e791db6f60edf946ef71451fae92ef6f
3958f888b30bb3e29916880ecec49b3870a0bea3
refs/heads/master
2022-12-15T07:50:01.056016
2020-09-10T03:47:53
2020-09-10T03:47:53
294,296,037
3
0
MIT
2020-09-10T03:47:39
2020-09-10T03:47:38
null
UTF-8
Python
false
false
698
py
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def helper(self, node): if node is None: return 0 left_max = self.helper(node.left) right_max = self.helper(node.right) cur_max = max(left_max, right_max, left_max+right_max, 0) + node.val self.ans = max(self.ans, cur_max) return max(left_max, right_max, 0)+node.val def maxPathSum(self, root: TreeNode) -> int: self.ans = root.val self.helper(root) return self.ans
[ "mdabedincs@gmail.com" ]
mdabedincs@gmail.com
76c44d082a1396dc33c4de1d490dadcfe2324b0c
01733042e84a768b77f64ec24118d0242b2f13b8
/ixnetwork_restpy/testplatform/sessions/ixnetwork/vport/protocolstack/secondaryrange_81692aa5df84128fe35b5eed6353333f.py
1e8ee8ef4487fa313f230a968199ca7d37a16c96
[ "MIT" ]
permissive
slieberth/ixnetwork_restpy
e95673905854bc57e56177911cb3853c7e4c5e26
23eeb24b21568a23d3f31bbd72814ff55eb1af44
refs/heads/master
2023-01-04T06:57:17.513612
2020-10-16T22:30:55
2020-10-16T22:30:55
311,959,027
0
0
NOASSERTION
2020-11-11T12:15:34
2020-11-11T12:06:00
null
UTF-8
Python
false
false
57,132
py
# MIT LICENSE # # Copyright 1997 - 2020 by IXIA Keysight # # 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. from ixnetwork_restpy.base import Base from ixnetwork_restpy.files import Files class SecondaryRange(Base): """ The SecondaryRange class encapsulates a list of secondaryRange resources that are managed by the user. A list of resources can be retrieved from the server using the SecondaryRange.find() method. The list can be managed by using the SecondaryRange.add() and SecondaryRange.remove() methods. """ __slots__ = () _SDM_NAME = 'secondaryRange' _SDM_ATT_MAP = { } def __init__(self, parent): super(SecondaryRange, self).__init__(parent) @property def FcoeFwdVnPortRange(self): """ Returns ------- - obj(ixnetwork_restpy.testplatform.sessions.ixnetwork.vport.protocolstack.fcoefwdvnportrange_6548b86ff56cfd5f2d4db3fa3098b1ff.FcoeFwdVnPortRange): An instance of the FcoeFwdVnPortRange class Raises ------ - ServerError: The server has encountered an uncategorized error condition """ from ixnetwork_restpy.testplatform.sessions.ixnetwork.vport.protocolstack.fcoefwdvnportrange_6548b86ff56cfd5f2d4db3fa3098b1ff import FcoeFwdVnPortRange return FcoeFwdVnPortRange(self)._select() def add(self): """Adds a new secondaryRange resource on the server and adds it to the container. Returns ------- - self: This instance with all currently retrieved secondaryRange resources using find and the newly added secondaryRange resources available through an iterator or index Raises ------ - ServerError: The server has encountered an uncategorized error condition """ return self._create(self._map_locals(self._SDM_ATT_MAP, locals())) def remove(self): """Deletes all the contained secondaryRange resources in this instance from the server. Raises ------ - NotFoundError: The requested resource does not exist on the server - ServerError: The server has encountered an uncategorized error condition """ self._delete() def find(self): """Finds and retrieves secondaryRange resources from the server. All named parameters are evaluated on the server using regex. The named parameters can be used to selectively retrieve secondaryRange resources from the server. To retrieve an exact match ensure the parameter value starts with ^ and ends with $ By default the find method takes no parameters and will retrieve all secondaryRange resources from the server. Returns ------- - self: This instance with matching secondaryRange resources retrieved from the server available through an iterator or index Raises ------ - ServerError: The server has encountered an uncategorized error condition """ return self._select(self._map_locals(self._SDM_ATT_MAP, locals())) def read(self, href): """Retrieves a single instance of secondaryRange data from the server. Args ---- - href (str): An href to the instance to be retrieved Returns ------- - self: This instance with the secondaryRange resources from the server available through an iterator or index Raises ------ - NotFoundError: The requested resource does not exist on the server - ServerError: The server has encountered an uncategorized error condition """ return self._read(href) def CustomProtocolStack(self, *args, **kwargs): """Executes the customProtocolStack operation on the server. Create custom protocol stack under /vport/protocolStack customProtocolStack(Arg2=list, Arg3=enum) ----------------------------------------- - Arg2 (list(str)): List of plugin types to be added in the new custom stack - Arg3 (str(kAppend | kMerge | kOverwrite)): Append, merge or overwrite existing protocol stack Raises ------ - NotFoundError: The requested resource does not exist on the server - ServerError: The server has encountered an uncategorized error condition """ payload = { "Arg1": self } for i in range(len(args)): payload['Arg%s' % (i + 2)] = args[i] for item in kwargs.items(): payload[item[0]] = item[1] return self._execute('customProtocolStack', payload=payload, response_object=None) def DisableProtocolStack(self, *args, **kwargs): """Executes the disableProtocolStack operation on the server. Disable a protocol under protocolStack using the class name disableProtocolStack(Arg2=string)string --------------------------------------- - Arg2 (str): Protocol class name to disable - Returns str: Status of the exec Raises ------ - NotFoundError: The requested resource does not exist on the server - ServerError: The server has encountered an uncategorized error condition """ payload = { "Arg1": self.href } for i in range(len(args)): payload['Arg%s' % (i + 2)] = args[i] for item in kwargs.items(): payload[item[0]] = item[1] return self._execute('disableProtocolStack', payload=payload, response_object=None) def EnableProtocolStack(self, *args, **kwargs): """Executes the enableProtocolStack operation on the server. Enable a protocol under protocolStack using the class name enableProtocolStack(Arg2=string)string -------------------------------------- - Arg2 (str): Protocol class name to enable - Returns str: Status of the exec Raises ------ - NotFoundError: The requested resource does not exist on the server - ServerError: The server has encountered an uncategorized error condition """ payload = { "Arg1": self.href } for i in range(len(args)): payload['Arg%s' % (i + 2)] = args[i] for item in kwargs.items(): payload[item[0]] = item[1] return self._execute('enableProtocolStack', payload=payload, response_object=None) def FcoeFwdStart(self, *args, **kwargs): """Executes the fcoeFwdStart operation on the server. Activate FCoE sessions for selected ranges The IxNetwork model allows for multiple method Signatures with the same name while python does not. fcoeFwdStart(Arg2=enum) ----------------------- - Arg2 (str(async | sync)): kArray[kObjref=/vport/protocolStack/ethernet/fcoeFwdEndpoint,/vport/protocolStack/ethernet/fcoeFwdEndpoint/range,/vport/protocolStack/ethernet/fcoeFwdEndpoint/secondaryRange] Raises ------ - NotFoundError: The requested resource does not exist on the server - ServerError: The server has encountered an uncategorized error condition """ payload = { "Arg1": self } for i in range(len(args)): payload['Arg%s' % (i + 2)] = args[i] for item in kwargs.items(): payload[item[0]] = item[1] return self._execute('fcoeFwdStart', payload=payload, response_object=None) def FcoeFwdStop(self, *args, **kwargs): """Executes the fcoeFwdStop operation on the server. Deactivate FCoE sessions for selected ranges The IxNetwork model allows for multiple method Signatures with the same name while python does not. fcoeFwdStop(Arg2=enum) ---------------------- - Arg2 (str(async | sync)): kArray[kObjref=/vport/protocolStack/ethernet/fcoeFwdEndpoint,/vport/protocolStack/ethernet/fcoeFwdEndpoint/range,/vport/protocolStack/ethernet/fcoeFwdEndpoint/secondaryRange] Raises ------ - NotFoundError: The requested resource does not exist on the server - ServerError: The server has encountered an uncategorized error condition """ payload = { "Arg1": self } for i in range(len(args)): payload['Arg%s' % (i + 2)] = args[i] for item in kwargs.items(): payload[item[0]] = item[1] return self._execute('fcoeFwdStop', payload=payload, response_object=None) def Start(self, *args, **kwargs): """Executes the start operation on the server. Negotiate sessions for all protocols on all ranges belonging to selected plugins The IxNetwork model allows for multiple method Signatures with the same name while python does not. start(Arg2=enum) ---------------- - Arg2 (str(async | sync)): kArray[kObjref=/vport/protocolStack/atm,/vport/protocolStack/atm/dhcpEndpoint,/vport/protocolStack/atm/dhcpEndpoint/ancp,/vport/protocolStack/atm/dhcpEndpoint/range,/vport/protocolStack/atm/dhcpEndpoint/range/ancpRange,/vport/protocolStack/atm/dhcpServerEndpoint,/vport/protocolStack/atm/dhcpServerEndpoint/range,/vport/protocolStack/atm/emulatedRouter,/vport/protocolStack/atm/emulatedRouter/dhcpEndpoint,/vport/protocolStack/atm/emulatedRouter/dhcpEndpoint/ancp,/vport/protocolStack/atm/emulatedRouter/dhcpEndpoint/range,/vport/protocolStack/atm/emulatedRouter/dhcpEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/dhcpEndpoint/range/ancpRange,/vport/protocolStack/atm/emulatedRouter/dhcpServerEndpoint,/vport/protocolStack/atm/emulatedRouter/dhcpServerEndpoint/range,/vport/protocolStack/atm/emulatedRouter/dhcpServerEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/ip,/vport/protocolStack/atm/emulatedRouter/ip/ancp,/vport/protocolStack/atm/emulatedRouter/ip/egtpPcrfEndpoint,/vport/protocolStack/atm/emulatedRouter/ip/egtpPcrfEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpPcrfEndpoint/range/ancpRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpPcrfEndpoint/range/twampControlRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpPcrfS5S8SgwEndpoint,/vport/protocolStack/atm/emulatedRouter/ip/egtpPcrfS5S8SgwEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpPcrfS5S8SgwEndpoint/range/ancpRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpPcrfS5S8SgwEndpoint/range/twampControlRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpS5S8PgwEndpoint,/vport/protocolStack/atm/emulatedRouter/ip/egtpS5S8PgwEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpS5S8PgwEndpoint/range/ancpRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpS5S8PgwEndpoint/range/twampControlRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpS5S8SgwEndpoint,/vport/protocolStack/atm/emulatedRouter/ip/egtpS5S8SgwEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpS5S8SgwEndpoint/range/ancpRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpS5S8SgwEndpoint/range/twampControlRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpSgwEndpoint,/vport/protocolStack/atm/emulatedRouter/ip/egtpSgwEndpoint/range,/vport/protocolStack/atm/emulatedRouter/ip/egtpSgwEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpSgwEndpoint/range/ancpRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpSgwEndpoint/range/twampControlRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpUeS5S8SgwEndpoint,/vport/protocolStack/atm/emulatedRouter/ip/egtpUeS5S8SgwEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpUeS5S8SgwEndpoint/range/ancpRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpUeS5S8SgwEndpoint/range/twampControlRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tp,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLacEndpoint,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range/ancpRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range/twampControlRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range/ancpRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range/twampControlRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tpEndpoint,/vport/protocolStack/atm/emulatedRouter/ip/l2tpEndpoint/range,/vport/protocolStack/atm/emulatedRouter/ip/l2tpEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tpEndpoint/range/ancpRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tpEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tpEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tpEndpoint/range/twampControlRange,/vport/protocolStack/atm/emulatedRouter/ip/smDnsEndpoint,/vport/protocolStack/atm/emulatedRouter/ip/smDnsEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/ip/smDnsEndpoint/range/ancpRange,/vport/protocolStack/atm/emulatedRouter/ip/smDnsEndpoint/range/twampControlRange,/vport/protocolStack/atm/emulatedRouter/ip/twampClient,/vport/protocolStack/atm/emulatedRouter/ip/twampServer,/vport/protocolStack/atm/emulatedRouter/ipEndpoint,/vport/protocolStack/atm/emulatedRouter/ipEndpoint/ancp,/vport/protocolStack/atm/emulatedRouter/ipEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/ipEndpoint/range/ancpRange,/vport/protocolStack/atm/emulatedRouter/ipEndpoint/range/twampControlRange,/vport/protocolStack/atm/emulatedRouter/ipEndpoint/twampClient,/vport/protocolStack/atm/emulatedRouter/ipEndpoint/twampServer,/vport/protocolStack/atm/emulatedRouterEndpoint,/vport/protocolStack/atm/emulatedRouterEndpoint/range/amtRange,/vport/protocolStack/atm/ip,/vport/protocolStack/atm/ip/ancp,/vport/protocolStack/atm/ip/egtpPcrfEndpoint,/vport/protocolStack/atm/ip/egtpPcrfEndpoint/range/amtRange,/vport/protocolStack/atm/ip/egtpPcrfEndpoint/range/ancpRange,/vport/protocolStack/atm/ip/egtpPcrfEndpoint/range/twampControlRange,/vport/protocolStack/atm/ip/egtpPcrfS5S8SgwEndpoint,/vport/protocolStack/atm/ip/egtpPcrfS5S8SgwEndpoint/range/amtRange,/vport/protocolStack/atm/ip/egtpPcrfS5S8SgwEndpoint/range/ancpRange,/vport/protocolStack/atm/ip/egtpPcrfS5S8SgwEndpoint/range/twampControlRange,/vport/protocolStack/atm/ip/egtpS5S8PgwEndpoint,/vport/protocolStack/atm/ip/egtpS5S8PgwEndpoint/range/amtRange,/vport/protocolStack/atm/ip/egtpS5S8PgwEndpoint/range/ancpRange,/vport/protocolStack/atm/ip/egtpS5S8PgwEndpoint/range/twampControlRange,/vport/protocolStack/atm/ip/egtpS5S8SgwEndpoint,/vport/protocolStack/atm/ip/egtpS5S8SgwEndpoint/range/amtRange,/vport/protocolStack/atm/ip/egtpS5S8SgwEndpoint/range/ancpRange,/vport/protocolStack/atm/ip/egtpS5S8SgwEndpoint/range/twampControlRange,/vport/protocolStack/atm/ip/egtpSgwEndpoint,/vport/protocolStack/atm/ip/egtpSgwEndpoint/range,/vport/protocolStack/atm/ip/egtpSgwEndpoint/range/amtRange,/vport/protocolStack/atm/ip/egtpSgwEndpoint/range/ancpRange,/vport/protocolStack/atm/ip/egtpSgwEndpoint/range/twampControlRange,/vport/protocolStack/atm/ip/egtpUeS5S8SgwEndpoint,/vport/protocolStack/atm/ip/egtpUeS5S8SgwEndpoint/range/amtRange,/vport/protocolStack/atm/ip/egtpUeS5S8SgwEndpoint/range/ancpRange,/vport/protocolStack/atm/ip/egtpUeS5S8SgwEndpoint/range/twampControlRange,/vport/protocolStack/atm/ip/l2tp,/vport/protocolStack/atm/ip/l2tp/dhcpoLacEndpoint,/vport/protocolStack/atm/ip/l2tp/dhcpoLacEndpoint/range,/vport/protocolStack/atm/ip/l2tp/dhcpoLacEndpoint/range,/vport/protocolStack/atm/ip/l2tp/dhcpoLacEndpoint/range/amtRange,/vport/protocolStack/atm/ip/l2tp/dhcpoLacEndpoint/range/ancpRange,/vport/protocolStack/atm/ip/l2tp/dhcpoLacEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/atm/ip/l2tp/dhcpoLacEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/atm/ip/l2tp/dhcpoLacEndpoint/range/twampControlRange,/vport/protocolStack/atm/ip/l2tp/dhcpoLnsEndpoint,/vport/protocolStack/atm/ip/l2tp/dhcpoLnsEndpoint/range,/vport/protocolStack/atm/ip/l2tp/dhcpoLnsEndpoint/range,/vport/protocolStack/atm/ip/l2tp/dhcpoLnsEndpoint/range/amtRange,/vport/protocolStack/atm/ip/l2tp/dhcpoLnsEndpoint/range/ancpRange,/vport/protocolStack/atm/ip/l2tp/dhcpoLnsEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/atm/ip/l2tp/dhcpoLnsEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/atm/ip/l2tp/dhcpoLnsEndpoint/range/twampControlRange,/vport/protocolStack/atm/ip/l2tpEndpoint,/vport/protocolStack/atm/ip/l2tpEndpoint/range,/vport/protocolStack/atm/ip/l2tpEndpoint/range/amtRange,/vport/protocolStack/atm/ip/l2tpEndpoint/range/ancpRange,/vport/protocolStack/atm/ip/l2tpEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/atm/ip/l2tpEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/atm/ip/l2tpEndpoint/range/twampControlRange,/vport/protocolStack/atm/ip/smDnsEndpoint,/vport/protocolStack/atm/ip/smDnsEndpoint/range/amtRange,/vport/protocolStack/atm/ip/smDnsEndpoint/range/ancpRange,/vport/protocolStack/atm/ip/smDnsEndpoint/range/twampControlRange,/vport/protocolStack/atm/ip/twampClient,/vport/protocolStack/atm/ip/twampServer,/vport/protocolStack/atm/ipEndpoint,/vport/protocolStack/atm/ipEndpoint/ancp,/vport/protocolStack/atm/ipEndpoint/range/amtRange,/vport/protocolStack/atm/ipEndpoint/range/ancpRange,/vport/protocolStack/atm/ipEndpoint/range/twampControlRange,/vport/protocolStack/atm/ipEndpoint/twampClient,/vport/protocolStack/atm/ipEndpoint/twampServer,/vport/protocolStack/atm/pppox,/vport/protocolStack/atm/pppox/ancp,/vport/protocolStack/atm/pppox/dhcpoPppClientEndpoint,/vport/protocolStack/atm/pppox/dhcpoPppClientEndpoint/range,/vport/protocolStack/atm/pppox/dhcpoPppClientEndpoint/range,/vport/protocolStack/atm/pppox/dhcpoPppClientEndpoint/range/ancpRange,/vport/protocolStack/atm/pppox/dhcpoPppClientEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/atm/pppox/dhcpoPppClientEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/atm/pppox/dhcpoPppServerEndpoint,/vport/protocolStack/atm/pppox/dhcpoPppServerEndpoint/range,/vport/protocolStack/atm/pppox/dhcpoPppServerEndpoint/range,/vport/protocolStack/atm/pppox/dhcpoPppServerEndpoint/range/ancpRange,/vport/protocolStack/atm/pppox/dhcpoPppServerEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/atm/pppox/dhcpoPppServerEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/atm/pppoxEndpoint,/vport/protocolStack/atm/pppoxEndpoint/ancp,/vport/protocolStack/atm/pppoxEndpoint/range,/vport/protocolStack/atm/pppoxEndpoint/range/ancpRange,/vport/protocolStack/atm/pppoxEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/atm/pppoxEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/ethernet,/vport/protocolStack/ethernet/dcbxEndpoint,/vport/protocolStack/ethernet/dcbxEndpoint/range,/vport/protocolStack/ethernet/dhcpEndpoint,/vport/protocolStack/ethernet/dhcpEndpoint/ancp,/vport/protocolStack/ethernet/dhcpEndpoint/range,/vport/protocolStack/ethernet/dhcpEndpoint/range/ancpRange,/vport/protocolStack/ethernet/dhcpServerEndpoint,/vport/protocolStack/ethernet/dhcpServerEndpoint/range,/vport/protocolStack/ethernet/emulatedRouter,/vport/protocolStack/ethernet/emulatedRouter/dhcpEndpoint,/vport/protocolStack/ethernet/emulatedRouter/dhcpEndpoint/ancp,/vport/protocolStack/ethernet/emulatedRouter/dhcpEndpoint/range,/vport/protocolStack/ethernet/emulatedRouter/dhcpEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/dhcpEndpoint/range/ancpRange,/vport/protocolStack/ethernet/emulatedRouter/dhcpServerEndpoint,/vport/protocolStack/ethernet/emulatedRouter/dhcpServerEndpoint/range,/vport/protocolStack/ethernet/emulatedRouter/dhcpServerEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/ip,/vport/protocolStack/ethernet/emulatedRouter/ip/ancp,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpPcrfEndpoint,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpPcrfEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpPcrfEndpoint/range/ancpRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpPcrfEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpPcrfS5S8SgwEndpoint,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpPcrfS5S8SgwEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpPcrfS5S8SgwEndpoint/range/ancpRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpPcrfS5S8SgwEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpS5S8PgwEndpoint,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpS5S8PgwEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpS5S8PgwEndpoint/range/ancpRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpS5S8PgwEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpS5S8SgwEndpoint,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpS5S8SgwEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpS5S8SgwEndpoint/range/ancpRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpS5S8SgwEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpSgwEndpoint,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpSgwEndpoint/range,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpSgwEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpSgwEndpoint/range/ancpRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpSgwEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpUeS5S8SgwEndpoint,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpUeS5S8SgwEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpUeS5S8SgwEndpoint/range/ancpRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpUeS5S8SgwEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLacEndpoint,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range/ancpRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range/ancpRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tpEndpoint,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tpEndpoint/range,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tpEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tpEndpoint/range/ancpRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tpEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tpEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tpEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/emulatedRouter/ip/smDnsEndpoint,/vport/protocolStack/ethernet/emulatedRouter/ip/smDnsEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/ip/smDnsEndpoint/range/ancpRange,/vport/protocolStack/ethernet/emulatedRouter/ip/smDnsEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/emulatedRouter/ip/twampClient,/vport/protocolStack/ethernet/emulatedRouter/ip/twampServer,/vport/protocolStack/ethernet/emulatedRouter/ipEndpoint,/vport/protocolStack/ethernet/emulatedRouter/ipEndpoint/ancp,/vport/protocolStack/ethernet/emulatedRouter/ipEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/ipEndpoint/range/ancpRange,/vport/protocolStack/ethernet/emulatedRouter/ipEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/emulatedRouter/ipEndpoint/twampClient,/vport/protocolStack/ethernet/emulatedRouter/ipEndpoint/twampServer,/vport/protocolStack/ethernet/emulatedRouterEndpoint,/vport/protocolStack/ethernet/emulatedRouterEndpoint/range/amtRange,/vport/protocolStack/ethernet/esmc,/vport/protocolStack/ethernet/fcoeClientEndpoint,/vport/protocolStack/ethernet/fcoeClientEndpoint/range,/vport/protocolStack/ethernet/fcoeClientEndpoint/range,/vport/protocolStack/ethernet/fcoeClientEndpoint/range/fcoeClientFdiscRange,/vport/protocolStack/ethernet/fcoeClientEndpoint/range/fcoeClientFlogiRange,/vport/protocolStack/ethernet/fcoeFwdEndpoint,/vport/protocolStack/ethernet/fcoeFwdEndpoint/range,/vport/protocolStack/ethernet/fcoeFwdEndpoint/secondaryRange,/vport/protocolStack/ethernet/ip,/vport/protocolStack/ethernet/ip/ancp,/vport/protocolStack/ethernet/ip/egtpPcrfEndpoint,/vport/protocolStack/ethernet/ip/egtpPcrfEndpoint/range/amtRange,/vport/protocolStack/ethernet/ip/egtpPcrfEndpoint/range/ancpRange,/vport/protocolStack/ethernet/ip/egtpPcrfEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/ip/egtpPcrfS5S8SgwEndpoint,/vport/protocolStack/ethernet/ip/egtpPcrfS5S8SgwEndpoint/range/amtRange,/vport/protocolStack/ethernet/ip/egtpPcrfS5S8SgwEndpoint/range/ancpRange,/vport/protocolStack/ethernet/ip/egtpPcrfS5S8SgwEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/ip/egtpS5S8PgwEndpoint,/vport/protocolStack/ethernet/ip/egtpS5S8PgwEndpoint/range/amtRange,/vport/protocolStack/ethernet/ip/egtpS5S8PgwEndpoint/range/ancpRange,/vport/protocolStack/ethernet/ip/egtpS5S8PgwEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/ip/egtpS5S8SgwEndpoint,/vport/protocolStack/ethernet/ip/egtpS5S8SgwEndpoint/range/amtRange,/vport/protocolStack/ethernet/ip/egtpS5S8SgwEndpoint/range/ancpRange,/vport/protocolStack/ethernet/ip/egtpS5S8SgwEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/ip/egtpSgwEndpoint,/vport/protocolStack/ethernet/ip/egtpSgwEndpoint/range,/vport/protocolStack/ethernet/ip/egtpSgwEndpoint/range/amtRange,/vport/protocolStack/ethernet/ip/egtpSgwEndpoint/range/ancpRange,/vport/protocolStack/ethernet/ip/egtpSgwEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/ip/egtpUeS5S8SgwEndpoint,/vport/protocolStack/ethernet/ip/egtpUeS5S8SgwEndpoint/range/amtRange,/vport/protocolStack/ethernet/ip/egtpUeS5S8SgwEndpoint/range/ancpRange,/vport/protocolStack/ethernet/ip/egtpUeS5S8SgwEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/ip/l2tp,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLacEndpoint,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLacEndpoint/range,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLacEndpoint/range,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLacEndpoint/range/amtRange,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLacEndpoint/range/ancpRange,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLacEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLacEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLacEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLnsEndpoint,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLnsEndpoint/range,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLnsEndpoint/range,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLnsEndpoint/range/amtRange,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLnsEndpoint/range/ancpRange,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLnsEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLnsEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLnsEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/ip/l2tpEndpoint,/vport/protocolStack/ethernet/ip/l2tpEndpoint/range,/vport/protocolStack/ethernet/ip/l2tpEndpoint/range/amtRange,/vport/protocolStack/ethernet/ip/l2tpEndpoint/range/ancpRange,/vport/protocolStack/ethernet/ip/l2tpEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/ethernet/ip/l2tpEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/ethernet/ip/l2tpEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/ip/smDnsEndpoint,/vport/protocolStack/ethernet/ip/smDnsEndpoint/range/amtRange,/vport/protocolStack/ethernet/ip/smDnsEndpoint/range/ancpRange,/vport/protocolStack/ethernet/ip/smDnsEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/ip/twampClient,/vport/protocolStack/ethernet/ip/twampServer,/vport/protocolStack/ethernet/ipEndpoint,/vport/protocolStack/ethernet/ipEndpoint/ancp,/vport/protocolStack/ethernet/ipEndpoint/range/amtRange,/vport/protocolStack/ethernet/ipEndpoint/range/ancpRange,/vport/protocolStack/ethernet/ipEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/ipEndpoint/twampClient,/vport/protocolStack/ethernet/ipEndpoint/twampServer,/vport/protocolStack/ethernet/pppox,/vport/protocolStack/ethernet/pppox/ancp,/vport/protocolStack/ethernet/pppox/dhcpoPppClientEndpoint,/vport/protocolStack/ethernet/pppox/dhcpoPppClientEndpoint/range,/vport/protocolStack/ethernet/pppox/dhcpoPppClientEndpoint/range,/vport/protocolStack/ethernet/pppox/dhcpoPppClientEndpoint/range/ancpRange,/vport/protocolStack/ethernet/pppox/dhcpoPppClientEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/ethernet/pppox/dhcpoPppClientEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/ethernet/pppox/dhcpoPppServerEndpoint,/vport/protocolStack/ethernet/pppox/dhcpoPppServerEndpoint/range,/vport/protocolStack/ethernet/pppox/dhcpoPppServerEndpoint/range,/vport/protocolStack/ethernet/pppox/dhcpoPppServerEndpoint/range/ancpRange,/vport/protocolStack/ethernet/pppox/dhcpoPppServerEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/ethernet/pppox/dhcpoPppServerEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/ethernet/pppoxEndpoint,/vport/protocolStack/ethernet/pppoxEndpoint/ancp,/vport/protocolStack/ethernet/pppoxEndpoint/range,/vport/protocolStack/ethernet/pppoxEndpoint/range/ancpRange,/vport/protocolStack/ethernet/pppoxEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/ethernet/pppoxEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/ethernet/vepaEndpoint,/vport/protocolStack/ethernet/vepaEndpoint/range,/vport/protocolStack/ethernetEndpoint,/vport/protocolStack/ethernetEndpoint/esmc,/vport/protocolStack/fcClientEndpoint,/vport/protocolStack/fcClientEndpoint/range,/vport/protocolStack/fcClientEndpoint/range,/vport/protocolStack/fcClientEndpoint/range/fcClientFdiscRange,/vport/protocolStack/fcClientEndpoint/range/fcClientFlogiRange,/vport/protocolStack/fcFportFwdEndpoint,/vport/protocolStack/fcFportFwdEndpoint/range,/vport/protocolStack/fcFportFwdEndpoint/secondaryRange] Raises ------ - NotFoundError: The requested resource does not exist on the server - ServerError: The server has encountered an uncategorized error condition """ payload = { "Arg1": self } for i in range(len(args)): payload['Arg%s' % (i + 2)] = args[i] for item in kwargs.items(): payload[item[0]] = item[1] return self._execute('start', payload=payload, response_object=None) def Stop(self, *args, **kwargs): """Executes the stop operation on the server. Teardown sessions for all protocols on all ranges belonging to selected plugins The IxNetwork model allows for multiple method Signatures with the same name while python does not. stop(Arg2=enum) --------------- - Arg2 (str(async | sync)): kArray[kObjref=/vport/protocolStack/atm,/vport/protocolStack/atm/dhcpEndpoint,/vport/protocolStack/atm/dhcpEndpoint/ancp,/vport/protocolStack/atm/dhcpEndpoint/range,/vport/protocolStack/atm/dhcpEndpoint/range/ancpRange,/vport/protocolStack/atm/dhcpServerEndpoint,/vport/protocolStack/atm/dhcpServerEndpoint/range,/vport/protocolStack/atm/emulatedRouter,/vport/protocolStack/atm/emulatedRouter/dhcpEndpoint,/vport/protocolStack/atm/emulatedRouter/dhcpEndpoint/ancp,/vport/protocolStack/atm/emulatedRouter/dhcpEndpoint/range,/vport/protocolStack/atm/emulatedRouter/dhcpEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/dhcpEndpoint/range/ancpRange,/vport/protocolStack/atm/emulatedRouter/dhcpServerEndpoint,/vport/protocolStack/atm/emulatedRouter/dhcpServerEndpoint/range,/vport/protocolStack/atm/emulatedRouter/dhcpServerEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/ip,/vport/protocolStack/atm/emulatedRouter/ip/ancp,/vport/protocolStack/atm/emulatedRouter/ip/egtpPcrfEndpoint,/vport/protocolStack/atm/emulatedRouter/ip/egtpPcrfEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpPcrfEndpoint/range/ancpRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpPcrfEndpoint/range/twampControlRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpPcrfS5S8SgwEndpoint,/vport/protocolStack/atm/emulatedRouter/ip/egtpPcrfS5S8SgwEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpPcrfS5S8SgwEndpoint/range/ancpRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpPcrfS5S8SgwEndpoint/range/twampControlRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpS5S8PgwEndpoint,/vport/protocolStack/atm/emulatedRouter/ip/egtpS5S8PgwEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpS5S8PgwEndpoint/range/ancpRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpS5S8PgwEndpoint/range/twampControlRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpS5S8SgwEndpoint,/vport/protocolStack/atm/emulatedRouter/ip/egtpS5S8SgwEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpS5S8SgwEndpoint/range/ancpRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpS5S8SgwEndpoint/range/twampControlRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpSgwEndpoint,/vport/protocolStack/atm/emulatedRouter/ip/egtpSgwEndpoint/range,/vport/protocolStack/atm/emulatedRouter/ip/egtpSgwEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpSgwEndpoint/range/ancpRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpSgwEndpoint/range/twampControlRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpUeS5S8SgwEndpoint,/vport/protocolStack/atm/emulatedRouter/ip/egtpUeS5S8SgwEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpUeS5S8SgwEndpoint/range/ancpRange,/vport/protocolStack/atm/emulatedRouter/ip/egtpUeS5S8SgwEndpoint/range/twampControlRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tp,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLacEndpoint,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range/ancpRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range/twampControlRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range/ancpRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range/twampControlRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tpEndpoint,/vport/protocolStack/atm/emulatedRouter/ip/l2tpEndpoint/range,/vport/protocolStack/atm/emulatedRouter/ip/l2tpEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tpEndpoint/range/ancpRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tpEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tpEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/atm/emulatedRouter/ip/l2tpEndpoint/range/twampControlRange,/vport/protocolStack/atm/emulatedRouter/ip/smDnsEndpoint,/vport/protocolStack/atm/emulatedRouter/ip/smDnsEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/ip/smDnsEndpoint/range/ancpRange,/vport/protocolStack/atm/emulatedRouter/ip/smDnsEndpoint/range/twampControlRange,/vport/protocolStack/atm/emulatedRouter/ip/twampClient,/vport/protocolStack/atm/emulatedRouter/ip/twampServer,/vport/protocolStack/atm/emulatedRouter/ipEndpoint,/vport/protocolStack/atm/emulatedRouter/ipEndpoint/ancp,/vport/protocolStack/atm/emulatedRouter/ipEndpoint/range/amtRange,/vport/protocolStack/atm/emulatedRouter/ipEndpoint/range/ancpRange,/vport/protocolStack/atm/emulatedRouter/ipEndpoint/range/twampControlRange,/vport/protocolStack/atm/emulatedRouter/ipEndpoint/twampClient,/vport/protocolStack/atm/emulatedRouter/ipEndpoint/twampServer,/vport/protocolStack/atm/emulatedRouterEndpoint,/vport/protocolStack/atm/emulatedRouterEndpoint/range/amtRange,/vport/protocolStack/atm/ip,/vport/protocolStack/atm/ip/ancp,/vport/protocolStack/atm/ip/egtpPcrfEndpoint,/vport/protocolStack/atm/ip/egtpPcrfEndpoint/range/amtRange,/vport/protocolStack/atm/ip/egtpPcrfEndpoint/range/ancpRange,/vport/protocolStack/atm/ip/egtpPcrfEndpoint/range/twampControlRange,/vport/protocolStack/atm/ip/egtpPcrfS5S8SgwEndpoint,/vport/protocolStack/atm/ip/egtpPcrfS5S8SgwEndpoint/range/amtRange,/vport/protocolStack/atm/ip/egtpPcrfS5S8SgwEndpoint/range/ancpRange,/vport/protocolStack/atm/ip/egtpPcrfS5S8SgwEndpoint/range/twampControlRange,/vport/protocolStack/atm/ip/egtpS5S8PgwEndpoint,/vport/protocolStack/atm/ip/egtpS5S8PgwEndpoint/range/amtRange,/vport/protocolStack/atm/ip/egtpS5S8PgwEndpoint/range/ancpRange,/vport/protocolStack/atm/ip/egtpS5S8PgwEndpoint/range/twampControlRange,/vport/protocolStack/atm/ip/egtpS5S8SgwEndpoint,/vport/protocolStack/atm/ip/egtpS5S8SgwEndpoint/range/amtRange,/vport/protocolStack/atm/ip/egtpS5S8SgwEndpoint/range/ancpRange,/vport/protocolStack/atm/ip/egtpS5S8SgwEndpoint/range/twampControlRange,/vport/protocolStack/atm/ip/egtpSgwEndpoint,/vport/protocolStack/atm/ip/egtpSgwEndpoint/range,/vport/protocolStack/atm/ip/egtpSgwEndpoint/range/amtRange,/vport/protocolStack/atm/ip/egtpSgwEndpoint/range/ancpRange,/vport/protocolStack/atm/ip/egtpSgwEndpoint/range/twampControlRange,/vport/protocolStack/atm/ip/egtpUeS5S8SgwEndpoint,/vport/protocolStack/atm/ip/egtpUeS5S8SgwEndpoint/range/amtRange,/vport/protocolStack/atm/ip/egtpUeS5S8SgwEndpoint/range/ancpRange,/vport/protocolStack/atm/ip/egtpUeS5S8SgwEndpoint/range/twampControlRange,/vport/protocolStack/atm/ip/l2tp,/vport/protocolStack/atm/ip/l2tp/dhcpoLacEndpoint,/vport/protocolStack/atm/ip/l2tp/dhcpoLacEndpoint/range,/vport/protocolStack/atm/ip/l2tp/dhcpoLacEndpoint/range,/vport/protocolStack/atm/ip/l2tp/dhcpoLacEndpoint/range/amtRange,/vport/protocolStack/atm/ip/l2tp/dhcpoLacEndpoint/range/ancpRange,/vport/protocolStack/atm/ip/l2tp/dhcpoLacEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/atm/ip/l2tp/dhcpoLacEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/atm/ip/l2tp/dhcpoLacEndpoint/range/twampControlRange,/vport/protocolStack/atm/ip/l2tp/dhcpoLnsEndpoint,/vport/protocolStack/atm/ip/l2tp/dhcpoLnsEndpoint/range,/vport/protocolStack/atm/ip/l2tp/dhcpoLnsEndpoint/range,/vport/protocolStack/atm/ip/l2tp/dhcpoLnsEndpoint/range/amtRange,/vport/protocolStack/atm/ip/l2tp/dhcpoLnsEndpoint/range/ancpRange,/vport/protocolStack/atm/ip/l2tp/dhcpoLnsEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/atm/ip/l2tp/dhcpoLnsEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/atm/ip/l2tp/dhcpoLnsEndpoint/range/twampControlRange,/vport/protocolStack/atm/ip/l2tpEndpoint,/vport/protocolStack/atm/ip/l2tpEndpoint/range,/vport/protocolStack/atm/ip/l2tpEndpoint/range/amtRange,/vport/protocolStack/atm/ip/l2tpEndpoint/range/ancpRange,/vport/protocolStack/atm/ip/l2tpEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/atm/ip/l2tpEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/atm/ip/l2tpEndpoint/range/twampControlRange,/vport/protocolStack/atm/ip/smDnsEndpoint,/vport/protocolStack/atm/ip/smDnsEndpoint/range/amtRange,/vport/protocolStack/atm/ip/smDnsEndpoint/range/ancpRange,/vport/protocolStack/atm/ip/smDnsEndpoint/range/twampControlRange,/vport/protocolStack/atm/ip/twampClient,/vport/protocolStack/atm/ip/twampServer,/vport/protocolStack/atm/ipEndpoint,/vport/protocolStack/atm/ipEndpoint/ancp,/vport/protocolStack/atm/ipEndpoint/range/amtRange,/vport/protocolStack/atm/ipEndpoint/range/ancpRange,/vport/protocolStack/atm/ipEndpoint/range/twampControlRange,/vport/protocolStack/atm/ipEndpoint/twampClient,/vport/protocolStack/atm/ipEndpoint/twampServer,/vport/protocolStack/atm/pppox,/vport/protocolStack/atm/pppox/ancp,/vport/protocolStack/atm/pppox/dhcpoPppClientEndpoint,/vport/protocolStack/atm/pppox/dhcpoPppClientEndpoint/range,/vport/protocolStack/atm/pppox/dhcpoPppClientEndpoint/range,/vport/protocolStack/atm/pppox/dhcpoPppClientEndpoint/range/ancpRange,/vport/protocolStack/atm/pppox/dhcpoPppClientEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/atm/pppox/dhcpoPppClientEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/atm/pppox/dhcpoPppServerEndpoint,/vport/protocolStack/atm/pppox/dhcpoPppServerEndpoint/range,/vport/protocolStack/atm/pppox/dhcpoPppServerEndpoint/range,/vport/protocolStack/atm/pppox/dhcpoPppServerEndpoint/range/ancpRange,/vport/protocolStack/atm/pppox/dhcpoPppServerEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/atm/pppox/dhcpoPppServerEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/atm/pppoxEndpoint,/vport/protocolStack/atm/pppoxEndpoint/ancp,/vport/protocolStack/atm/pppoxEndpoint/range,/vport/protocolStack/atm/pppoxEndpoint/range/ancpRange,/vport/protocolStack/atm/pppoxEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/atm/pppoxEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/ethernet,/vport/protocolStack/ethernet/dcbxEndpoint,/vport/protocolStack/ethernet/dcbxEndpoint/range,/vport/protocolStack/ethernet/dhcpEndpoint,/vport/protocolStack/ethernet/dhcpEndpoint/ancp,/vport/protocolStack/ethernet/dhcpEndpoint/range,/vport/protocolStack/ethernet/dhcpEndpoint/range/ancpRange,/vport/protocolStack/ethernet/dhcpServerEndpoint,/vport/protocolStack/ethernet/dhcpServerEndpoint/range,/vport/protocolStack/ethernet/emulatedRouter,/vport/protocolStack/ethernet/emulatedRouter/dhcpEndpoint,/vport/protocolStack/ethernet/emulatedRouter/dhcpEndpoint/ancp,/vport/protocolStack/ethernet/emulatedRouter/dhcpEndpoint/range,/vport/protocolStack/ethernet/emulatedRouter/dhcpEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/dhcpEndpoint/range/ancpRange,/vport/protocolStack/ethernet/emulatedRouter/dhcpServerEndpoint,/vport/protocolStack/ethernet/emulatedRouter/dhcpServerEndpoint/range,/vport/protocolStack/ethernet/emulatedRouter/dhcpServerEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/ip,/vport/protocolStack/ethernet/emulatedRouter/ip/ancp,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpPcrfEndpoint,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpPcrfEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpPcrfEndpoint/range/ancpRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpPcrfEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpPcrfS5S8SgwEndpoint,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpPcrfS5S8SgwEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpPcrfS5S8SgwEndpoint/range/ancpRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpPcrfS5S8SgwEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpS5S8PgwEndpoint,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpS5S8PgwEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpS5S8PgwEndpoint/range/ancpRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpS5S8PgwEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpS5S8SgwEndpoint,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpS5S8SgwEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpS5S8SgwEndpoint/range/ancpRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpS5S8SgwEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpSgwEndpoint,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpSgwEndpoint/range,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpSgwEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpSgwEndpoint/range/ancpRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpSgwEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpUeS5S8SgwEndpoint,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpUeS5S8SgwEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpUeS5S8SgwEndpoint/range/ancpRange,/vport/protocolStack/ethernet/emulatedRouter/ip/egtpUeS5S8SgwEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLacEndpoint,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range/ancpRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLacEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range/ancpRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tp/dhcpoLnsEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tpEndpoint,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tpEndpoint/range,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tpEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tpEndpoint/range/ancpRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tpEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tpEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/ethernet/emulatedRouter/ip/l2tpEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/emulatedRouter/ip/smDnsEndpoint,/vport/protocolStack/ethernet/emulatedRouter/ip/smDnsEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/ip/smDnsEndpoint/range/ancpRange,/vport/protocolStack/ethernet/emulatedRouter/ip/smDnsEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/emulatedRouter/ip/twampClient,/vport/protocolStack/ethernet/emulatedRouter/ip/twampServer,/vport/protocolStack/ethernet/emulatedRouter/ipEndpoint,/vport/protocolStack/ethernet/emulatedRouter/ipEndpoint/ancp,/vport/protocolStack/ethernet/emulatedRouter/ipEndpoint/range/amtRange,/vport/protocolStack/ethernet/emulatedRouter/ipEndpoint/range/ancpRange,/vport/protocolStack/ethernet/emulatedRouter/ipEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/emulatedRouter/ipEndpoint/twampClient,/vport/protocolStack/ethernet/emulatedRouter/ipEndpoint/twampServer,/vport/protocolStack/ethernet/emulatedRouterEndpoint,/vport/protocolStack/ethernet/emulatedRouterEndpoint/range/amtRange,/vport/protocolStack/ethernet/esmc,/vport/protocolStack/ethernet/fcoeClientEndpoint,/vport/protocolStack/ethernet/fcoeClientEndpoint/range,/vport/protocolStack/ethernet/fcoeClientEndpoint/range,/vport/protocolStack/ethernet/fcoeClientEndpoint/range/fcoeClientFdiscRange,/vport/protocolStack/ethernet/fcoeClientEndpoint/range/fcoeClientFlogiRange,/vport/protocolStack/ethernet/fcoeFwdEndpoint,/vport/protocolStack/ethernet/fcoeFwdEndpoint/range,/vport/protocolStack/ethernet/fcoeFwdEndpoint/secondaryRange,/vport/protocolStack/ethernet/ip,/vport/protocolStack/ethernet/ip/ancp,/vport/protocolStack/ethernet/ip/egtpPcrfEndpoint,/vport/protocolStack/ethernet/ip/egtpPcrfEndpoint/range/amtRange,/vport/protocolStack/ethernet/ip/egtpPcrfEndpoint/range/ancpRange,/vport/protocolStack/ethernet/ip/egtpPcrfEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/ip/egtpPcrfS5S8SgwEndpoint,/vport/protocolStack/ethernet/ip/egtpPcrfS5S8SgwEndpoint/range/amtRange,/vport/protocolStack/ethernet/ip/egtpPcrfS5S8SgwEndpoint/range/ancpRange,/vport/protocolStack/ethernet/ip/egtpPcrfS5S8SgwEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/ip/egtpS5S8PgwEndpoint,/vport/protocolStack/ethernet/ip/egtpS5S8PgwEndpoint/range/amtRange,/vport/protocolStack/ethernet/ip/egtpS5S8PgwEndpoint/range/ancpRange,/vport/protocolStack/ethernet/ip/egtpS5S8PgwEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/ip/egtpS5S8SgwEndpoint,/vport/protocolStack/ethernet/ip/egtpS5S8SgwEndpoint/range/amtRange,/vport/protocolStack/ethernet/ip/egtpS5S8SgwEndpoint/range/ancpRange,/vport/protocolStack/ethernet/ip/egtpS5S8SgwEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/ip/egtpSgwEndpoint,/vport/protocolStack/ethernet/ip/egtpSgwEndpoint/range,/vport/protocolStack/ethernet/ip/egtpSgwEndpoint/range/amtRange,/vport/protocolStack/ethernet/ip/egtpSgwEndpoint/range/ancpRange,/vport/protocolStack/ethernet/ip/egtpSgwEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/ip/egtpUeS5S8SgwEndpoint,/vport/protocolStack/ethernet/ip/egtpUeS5S8SgwEndpoint/range/amtRange,/vport/protocolStack/ethernet/ip/egtpUeS5S8SgwEndpoint/range/ancpRange,/vport/protocolStack/ethernet/ip/egtpUeS5S8SgwEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/ip/l2tp,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLacEndpoint,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLacEndpoint/range,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLacEndpoint/range,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLacEndpoint/range/amtRange,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLacEndpoint/range/ancpRange,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLacEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLacEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLacEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLnsEndpoint,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLnsEndpoint/range,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLnsEndpoint/range,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLnsEndpoint/range/amtRange,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLnsEndpoint/range/ancpRange,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLnsEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLnsEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/ethernet/ip/l2tp/dhcpoLnsEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/ip/l2tpEndpoint,/vport/protocolStack/ethernet/ip/l2tpEndpoint/range,/vport/protocolStack/ethernet/ip/l2tpEndpoint/range/amtRange,/vport/protocolStack/ethernet/ip/l2tpEndpoint/range/ancpRange,/vport/protocolStack/ethernet/ip/l2tpEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/ethernet/ip/l2tpEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/ethernet/ip/l2tpEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/ip/smDnsEndpoint,/vport/protocolStack/ethernet/ip/smDnsEndpoint/range/amtRange,/vport/protocolStack/ethernet/ip/smDnsEndpoint/range/ancpRange,/vport/protocolStack/ethernet/ip/smDnsEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/ip/twampClient,/vport/protocolStack/ethernet/ip/twampServer,/vport/protocolStack/ethernet/ipEndpoint,/vport/protocolStack/ethernet/ipEndpoint/ancp,/vport/protocolStack/ethernet/ipEndpoint/range/amtRange,/vport/protocolStack/ethernet/ipEndpoint/range/ancpRange,/vport/protocolStack/ethernet/ipEndpoint/range/twampControlRange,/vport/protocolStack/ethernet/ipEndpoint/twampClient,/vport/protocolStack/ethernet/ipEndpoint/twampServer,/vport/protocolStack/ethernet/pppox,/vport/protocolStack/ethernet/pppox/ancp,/vport/protocolStack/ethernet/pppox/dhcpoPppClientEndpoint,/vport/protocolStack/ethernet/pppox/dhcpoPppClientEndpoint/range,/vport/protocolStack/ethernet/pppox/dhcpoPppClientEndpoint/range,/vport/protocolStack/ethernet/pppox/dhcpoPppClientEndpoint/range/ancpRange,/vport/protocolStack/ethernet/pppox/dhcpoPppClientEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/ethernet/pppox/dhcpoPppClientEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/ethernet/pppox/dhcpoPppServerEndpoint,/vport/protocolStack/ethernet/pppox/dhcpoPppServerEndpoint/range,/vport/protocolStack/ethernet/pppox/dhcpoPppServerEndpoint/range,/vport/protocolStack/ethernet/pppox/dhcpoPppServerEndpoint/range/ancpRange,/vport/protocolStack/ethernet/pppox/dhcpoPppServerEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/ethernet/pppox/dhcpoPppServerEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/ethernet/pppoxEndpoint,/vport/protocolStack/ethernet/pppoxEndpoint/ancp,/vport/protocolStack/ethernet/pppoxEndpoint/range,/vport/protocolStack/ethernet/pppoxEndpoint/range/ancpRange,/vport/protocolStack/ethernet/pppoxEndpoint/range/dhcpv6PdClientRange,/vport/protocolStack/ethernet/pppoxEndpoint/range/dhcpv6ServerRange,/vport/protocolStack/ethernet/vepaEndpoint,/vport/protocolStack/ethernet/vepaEndpoint/range,/vport/protocolStack/ethernetEndpoint,/vport/protocolStack/ethernetEndpoint/esmc,/vport/protocolStack/fcClientEndpoint,/vport/protocolStack/fcClientEndpoint/range,/vport/protocolStack/fcClientEndpoint/range,/vport/protocolStack/fcClientEndpoint/range/fcClientFdiscRange,/vport/protocolStack/fcClientEndpoint/range/fcClientFlogiRange,/vport/protocolStack/fcFportFwdEndpoint,/vport/protocolStack/fcFportFwdEndpoint/range,/vport/protocolStack/fcFportFwdEndpoint/secondaryRange] Raises ------ - NotFoundError: The requested resource does not exist on the server - ServerError: The server has encountered an uncategorized error condition """ payload = { "Arg1": self } for i in range(len(args)): payload['Arg%s' % (i + 2)] = args[i] for item in kwargs.items(): payload[item[0]] = item[1] return self._execute('stop', payload=payload, response_object=None)
[ "andy.balogh@keysight.com" ]
andy.balogh@keysight.com
7075a0a9fe98a746e96222a704367de7151ff994
255e19ddc1bcde0d3d4fe70e01cec9bb724979c9
/all-gists/1325168/snippet.py
28eec836542399a12c1ef4027f7db0df6443778c
[ "MIT" ]
permissive
gistable/gistable
26c1e909928ec463026811f69b61619b62f14721
665d39a2bd82543d5196555f0801ef8fd4a3ee48
refs/heads/master
2023-02-17T21:33:55.558398
2023-02-11T18:20:10
2023-02-11T18:20:10
119,861,038
76
19
null
2020-07-26T03:14:55
2018-02-01T16:19:24
Python
UTF-8
Python
false
false
986
py
import requests import json class ClickyApi(object): """ A simple Python interface for the Clicky web analytics api. Relies on the Requests library - python-requests.org Usage: YOUR_CLICKY_SITE_ID = '12345' YOUR_CLICKY_SITE_KEY = 'qwerty' clicky = ClickyApi(YOUR_CLICKY_SITE_ID, YOUR_CLICKY_SITE_KEY) clicky.stats({ 'type': 'pages', 'date': 'today' }) """ api_endpoint = 'http://api.getclicky.com/api/stats/4' output_format = 'json' site_id = '' site_key = '' def __init__(self, site_id, site_key, app=''): self.site_id = site_id self.site_key = site_key self.app = app def stats(self, params={}): params.update({ 'site_id': self.site_id, 'sitekey': self.site_key, 'output': self.output_format, 'app': self.app }) r = requests.get(self.api_endpoint, params=params) return json.loads(r.content)
[ "gistshub@gmail.com" ]
gistshub@gmail.com
149d6fa9b596c90e0ae82587e4ffc555cd25f416
9743d5fd24822f79c156ad112229e25adb9ed6f6
/xai/brain/wordbase/verbs/_index.py
dbb4bd9fd48d9c62bf796bf622299c21d088a604
[ "MIT" ]
permissive
cash2one/xai
de7adad1758f50dd6786bf0111e71a903f039b64
e76f12c9f4dcf3ac1c7c08b0cc8844c0b0a104b6
refs/heads/master
2021-01-19T12:33:54.964379
2017-01-28T02:00:50
2017-01-28T02:00:50
null
0
0
null
null
null
null
UTF-8
Python
false
false
430
py
#calss header class _INDEX(): def __init__(self,): self.name = "INDEX" self.definitions = [u'to prepare an index for a book or collection, or arrange it in an index: ', u'to change a system of numbers according to each other or a fixed standard: '] self.parents = [] self.childen = [] self.properties = [] self.jsondata = {} self.specie = 'verbs' def run(self, obj1 = [], obj2 = []): return self.jsondata
[ "xingwang1991@gmail.com" ]
xingwang1991@gmail.com
8252567d9a62b4688bd1e0d9909847736b2f41e4
02338bb8111fc1aa88e830ac09a11664720eb2d4
/tmp/azure_rm_diagnosticsettingscategory.py
81e867b980ec07f78f416b811e20a8757ce96ad7
[]
no_license
Fred-sun/fred_yaml
a49977b0e8505c7447df23dd80c7fef1be70e6bc
295ca4cd2b59b8d2758f06eb7fd79920327ea524
refs/heads/master
2023-04-28T05:51:56.599488
2023-04-25T13:52:10
2023-04-25T13:52:10
131,376,340
0
1
null
2020-07-06T14:22:46
2018-04-28T05:34:49
TSQL
UTF-8
Python
false
false
6,634
py
#!/usr/bin/python # # Copyright (c) 2020 GuopengLin, (@t-glin) # # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = ''' --- module: azure_rm_diagnosticsettingscategory version_added: '2.9' short_description: Manage Azure DiagnosticSettingsCategory instance. description: - 'Create, update and delete instance of Azure DiagnosticSettingsCategory.' options: resource_uri: description: - The identifier of the resource. required: true type: str name: description: - The name of the diagnostic setting. required: true type: str state: description: - Assert the state of the DiagnosticSettingsCategory. - >- Use C(present) to create or update an DiagnosticSettingsCategory and C(absent) to delete it. default: present choices: - absent - present extends_documentation_fragment: - azure author: - GuopengLin (@t-glin) ''' EXAMPLES = ''' ''' RETURN = ''' id: description: - Azure resource Id returned: always type: str sample: null name: description: - Azure resource name returned: always type: str sample: null type: description: - Azure resource type returned: always type: str sample: null category_type: description: - The type of the diagnostic settings category. returned: always type: sealed-choice sample: null ''' import time import json import re from ansible.module_utils.azure_rm_common_ext import AzureRMModuleBaseExt from copy import deepcopy try: from msrestazure.azure_exceptions import CloudError from azure.mgmt.monitor import MonitorClient from msrestazure.azure_operation import AzureOperationPoller from msrest.polling import LROPoller except ImportError: # This is handled in azure_rm_common pass class Actions: NoAction, Create, Update, Delete = range(4) class AzureRMDiagnosticSettingsCategory(AzureRMModuleBaseExt): def __init__(self): self.module_arg_spec = dict( resource_uri=dict( type='str', required=True ), name=dict( type='str', required=True ), state=dict( type='str', default='present', choices=['present', 'absent'] ) ) self.resource_uri = None self.name = None self.body = {} self.results = dict(changed=False) self.mgmt_client = None self.state = None self.to_do = Actions.NoAction super(AzureRMDiagnosticSettingsCategory, self).__init__(derived_arg_spec=self.module_arg_spec, supports_check_mode=True, supports_tags=True) def exec_module(self, **kwargs): for key in list(self.module_arg_spec.keys()): if hasattr(self, key): setattr(self, key, kwargs[key]) elif kwargs[key] is not None: self.body[key] = kwargs[key] self.inflate_parameters(self.module_arg_spec, self.body, 0) old_response = None response = None self.mgmt_client = self.get_mgmt_svc_client(MonitorClient, base_url=self._cloud_environment.endpoints.resource_manager, api_version='2017-05-01-preview') old_response = self.get_resource() if not old_response: if self.state == 'present': self.to_do = Actions.Create else: if self.state == 'absent': self.to_do = Actions.Delete else: modifiers = {} self.create_compare_modifiers(self.module_arg_spec, '', modifiers) self.results['modifiers'] = modifiers self.results['compare'] = [] if not self.default_compare(modifiers, self.body, old_response, '', self.results): self.to_do = Actions.Update if (self.to_do == Actions.Create) or (self.to_do == Actions.Update): self.results['changed'] = True if self.check_mode: return self.results response = self.create_update_resource() elif self.to_do == Actions.Delete: self.results['changed'] = True if self.check_mode: return self.results self.delete_resource() else: self.results['changed'] = False response = old_response return self.results def create_update_resource(self): try: if self.to_do == Actions.Create: response = self.mgmt_client.diagnostic_settings_category.create() else: response = self.mgmt_client.diagnostic_settings_category.update() if isinstance(response, AzureOperationPoller) or isinstance(response, LROPoller): response = self.get_poller_result(response) except CloudError as exc: self.log('Error attempting to create the DiagnosticSettingsCategory instance.') self.fail('Error creating the DiagnosticSettingsCategory instance: {0}'.format(str(exc))) return response.as_dict() def delete_resource(self): try: response = self.mgmt_client.diagnostic_settings_category.delete() except CloudError as e: self.log('Error attempting to delete the DiagnosticSettingsCategory instance.') self.fail('Error deleting the DiagnosticSettingsCategory instance: {0}'.format(str(e))) return True def get_resource(self): try: response = self.mgmt_client.diagnostic_settings_category.get(resource_uri=self.resource_uri, name=self.name) except CloudError as e: return False return response.as_dict() def main(): AzureRMDiagnosticSettingsCategory() if __name__ == '__main__': main()
[ "xiuxi.sun@qq.com" ]
xiuxi.sun@qq.com
9222db26105e569fbad307f258bb1299d5225365
663c108dca9c4a30b7dfdc825a8f147ba873da52
/venv/functions/25VariableLengthArgv.py
b5824e86a2958cb40b1f05bc9bf98f85d3963f09
[]
no_license
ksrntheja/08-Python-Core
54c5a1e6e42548c10914f747ef64e61335e5f428
b5fe25eead8a0fcbab0757b118d15eba09b891ba
refs/heads/master
2022-10-02T04:11:07.845269
2020-06-02T15:23:18
2020-06-02T15:23:18
261,644,116
0
0
null
null
null
null
UTF-8
Python
false
false
506
py
def f01(*n, x): print('x :', x, type(x)) print('n :', n, type(n)) # f01(1) # Traceback (most recent call last): # File "/Code/venv/functions/25VariableLengthArgv.py", line <>, in <module> # f01(1) # TypeError: f01() missing 1 required keyword-only argument: 'x' # f01(1, 2) # TypeError: f01() missing 1 required keyword-only argument: 'x' # f01(1, 2, 3) # TypeError: f01() missing 1 required keyword-only argument: 'x' f01() # TypeError: f01() missing 1 required keyword-only argument: 'x'
[ "srntkolla@gmail.com" ]
srntkolla@gmail.com
7751ad4bdeec9135090e42680ec1598b9710257c
9844294a93eef781f8cc2473abb0046f8a416966
/xpdan/tests/test_io.py
e98861be36cd90a551663017f2f9d0ac133f5b9c
[]
no_license
sbillinge/xpdAn
b5decca72d1539e10a6920df5c75cc0374486687
0fc91ea7a26e505ff65e58b08b17b145f3e8e7d8
refs/heads/master
2021-01-01T18:49:49.964014
2017-07-26T15:42:18
2017-07-26T15:42:18
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,091
py
############################################################################## # # xpdan by Billinge Group # Simon J. L. Billinge sb2896@columbia.edu # (c) 2016 trustees of Columbia University in the City of # New York. # All rights reserved # # File coded by: Christopher J. Wright # # See AUTHORS.txt for a list of people who contributed. # See LICENSE.txt for license information. # ############################################################################## import numpy as np import os from xpdan.io import fit2d_save, read_fit2d_msk from numpy.testing import assert_array_equal def test_save_output_fit2d(mk_glbl): filename = os.path.join(mk_glbl['base_dir'], "function_values") msk = np.random.random_integers( 0, 1, (np.random.random_integers(0, 200), np.random.random_integers(0, 200))).astype(bool) fit2d_save(msk, filename, dir_path=None) msk2 = read_fit2d_msk(filename+'.msk') assert_array_equal(msk2, msk) os.remove(filename+'.msk')
[ "cjwright4242@gmail.com" ]
cjwright4242@gmail.com
c308f33845f5ac2ca3beaf0b4d9efb85dad9b9c6
fd83af9e6348eddae2f4bfeeb1760048763e857b
/OsSearch/src/search_files.py
ca688ca06b42139934e87294770f837ac754d35b
[]
no_license
rduvalwa5/NewPythonOsLevel
6f41f4c4934a0f3a016b435acbc4bbc5e2d057c5
44a434ace6a21ea27dfffd14a4b1f55931907673
refs/heads/master
2020-04-13T01:18:38.451607
2019-03-08T05:26:12
2019-03-08T05:26:12
162,870,765
0
0
null
null
null
null
UTF-8
Python
false
false
6,108
py
''' Created on Jul 16, 2016 purpose search for files @author: rduvalwa2 ''' import glob import os from os.path import join, getsize import string class find_file: def __init__(self): self.allFoundFiles = [] self.constrainedFiles = [] self.allDirectories = [] self.artist = [] def find(self,myFile, path = '.'): for root, dirs, files in os.walk(path): print(dirs) for name in files: foundFile = {} if name == myFile: file_info = os.stat(join(root, name)) # foundFile['Dir'] = dirs foundFile['file_size'] = file_info.st_size foundFile['file_access_time'] = file_info.st_atime foundFile['file_path'] = os.path.abspath(path) foundFile['name'] = name self.allFoundFiles.append(foundFile) def findAll(self,path = '.'): for root, dirs, files in os.walk(path): print(dirs) for name in files: foundFile = {} file_info = os.stat(join(root, name)) # foundFile['Dir'] = dirs foundFile['file_size'] = file_info.st_size foundFile['file_access_time'] = file_info.st_atime foundFile['file_path'] = os.path.abspath(path) foundFile['name'] = name self.allFoundFiles.append(foundFile) def findConstrained(self,myConstraint, path = '.'): # dirCount = 0 for root, dirs, files in os.walk(path): self.allDirectories = dirs print('directories ',dirs) # print('files ',files) for name in files: if myConstraint in name: foundFile = {} file_info = os.stat(join(root, name)) # foundFile['Dir'] = dirs foundFile['file_path'] = os.path.abspath(path) foundFile['name'] = name self.constrainedFiles.append(foundFile) # dirCount = dirCount + 1 def find_file(self,myFile, path = '.'): self.find(myFile, path) if self.allFoundFiles != []: return self.allFoundFiles else: return myFile + " Not found" def find_fileAll(self,path = '.'): self.findAll(path) if self.allFoundFiles != []: return self.allFoundFiles else: return "No Files found" def find_fileConstraint(self,constraint,path = os.path.abspath('.')): self.findConstrained(constraint, path) if self.constrainedFiles != []: return self.constrainedFiles else: return "No Files found" def all_files(self,constr,path = os.path.abspath('./')): if len(constr) == 1: if constr[0] == '*': # print("find_fileAll") return self.find_fileAll(path) if len(constr) > 1: if constr[0] == '*': # print("all_files find_fileConstraint") constraint = constr[1:] # print('constraint ', constraint) return self.find_fileConstraint(constraint, path) else: return self.find_file(constr,path) else: return "Input makes no sense" def get_directories(self, path = os.path.abspath('./')): for root, dirs, files in os.walk(path): if dirs != []: self.allDirectories.append(dirs) return self.allDirectories def get_roots(self, path = os.path.abspath('./')): for root, dirs, files in os.walk(path): if root != []: self.artist.append(root) return self.artist def get_count(self, result): if isinstance(result,str): return(result) else: return len(result) def printResult(self,result): print("**************") if isinstance(result,str): print(result) else: print(self.get_count(result)) for item in result: print(item) if __name__ == "__main__": ''' print("F1_____") f1 = find_file() result = f1.all_files('*','../') f1.printResult(result) print("F2_____") f2 = find_file() result2 = f2.all_files('*.py','./') f2.printResult(result2) print("F3_____") f3 = find_file() result3 = f3.all_files('test_file.txt','../') f3.printResult(result3) print("F4_____") f4 = find_file() result4 = f4.all_files('*.jpg','../../') print("result is ", result4) f4.printResult(result4) print("F5_____") f5 = find_file() result5 = f5.all_files('*test','../../') f5.printResult(result5) print(len(result5)) ''' songPath = '/Users/rduvalwa2/Music/iTunes/iTunes Music/Music' allSongNames = [] print("F6_____") f6 = find_file() result6 = f6.all_files('*.m4p',songPath) for name in result6: allSongNames.append(name['name']) # f6.printResult(result5) print(len(result6)) for item in allSongNames: print(item) fdir = find_file() result6 = f6.all_files('*.m4p',songPath) di = f6.get_directories(songPath) print(len(di)) for directory in di: print(directory) rot = f6.get_roots(songPath) print(rot) ''' f7 = find_file() result7 = f7.all_files('*.m4a',songPath) # print(result7) print(len(result7)) for name in result7: print(os.path.abspath(songPath + '/' + name['name'])) # allSongNames.append(name[name]) f8 = find_file() result8 = f8.all_files('*.m4p','/Users/rduvalwa2/Music/iTunes/iTunes Music/Music') print(len(result8)) for name in result8: allSongNames.append(name['name']) ''' print(len(allSongNames))
[ "rduvalwa5@hotmail.com" ]
rduvalwa5@hotmail.com
854b0ae1add69f394aaa72b8c9bce2cc76f4601c
288a00d2ab34cba6c389b8c2444455aee55a8a95
/tests/data23/recipe-302262.py
a3a3ff5f7bf6d86259b10c3c2216689e4f7f3c66
[ "BSD-2-Clause" ]
permissive
JohannesBuchner/pystrict3
ffd77b7bbc378bd4d8f21b5c6bd69a0d64a52ddb
18b0dd369082422f9bf0f89c72e7acb53a49849c
refs/heads/master
2023-08-14T06:37:37.954880
2023-07-13T11:16:38
2023-07-13T11:16:38
268,571,175
1
1
null
null
null
null
UTF-8
Python
false
false
4,727
py
# -*- coding: iso-8859-1 -*- """ Handling of arguments: options, arguments, file(s) content iterator For small scripts that: - read some command line options - read some command line positional arguments - iterate over all lines of some files given on the command line, or stdin if none given - give usage message if positional arguments are missing - give usage message if input files are missing and stdin is not redirected """ __author__ = 'Peter Kleiweg' __version__ = '0.2' __date__ = '2004/08/28' import os, sys, getopt class Args: """ Perform common tasks on command line arguments Instance data: progname (string) -- name of program opt (dictionary) -- options with values infile (string) -- name of current file being processed lineno (int) -- line number of last line read in current file linesum (int) -- total of lines read """ def __init__(self, usage='Usage: %(progname)s [opt...] [file...]'): "init, usage string: embed program name as %(progname)s" self.progname = os.path.basename(sys.argv[0]) self.opt = {} self.infile = None self.lineno = 0 self.linesum = 0 self._argv = sys.argv[1:] self._usage = usage def __iter__(self): "iterator: set-up" if self._argv: self.infile = self._argv.pop(0) self._in = open(self.infile, 'r') self._stdin = False else: if sys.stdin.isatty(): self.usage() # Doesn't return self.infile = '<stdin>' self._in = sys.stdin self._stdin = True return self def __next__(self): "iterator: get next line, possibly from next file" while True: line = self._in.readline() if line: self.lineno += 1 self.linesum += 1 return line if self._stdin: break self._in.close() try: self.infile = self._argv.pop(0) except IndexError: break self.lineno = 0 self._in = open(self.infile, 'r') self.lineno = -1 self.infile = None raise StopIteration def getopt(self, shortopts, longopts=[]): "get options and merge into dict 'opt'" try: options, self._argv = getopt.getopt(self._argv, shortopts, longopts) except getopt.GetoptError: self.usage() self.opt.update(dict(options)) def shift(self): "pop first of remaining arguments (shift)" try: return self._argv.pop(0) except IndexError: self.usage() def pop(self): "pop last of remaining arguments" try: return self._argv.pop() except IndexError: self.usage() def warning(self, text): "print warning message to stderr, possibly with filename and lineno" if self.lineno > 0: print('%s:%i: warning: %s' % (self.infile, self.lineno, text), file=sys.stderr) else: print('\nWarning %s: %s\n' % (self.progname, text), file=sys.stderr) def error(self, text): "print error message to stderr, possibly with filename and lineno, and exit" if self.lineno > 0: print('%s:%i: %s' % (self.infile, self.lineno, text), file=sys.stderr) else: print('\nError %s: %s\n' % (self.progname, text), file=sys.stderr) sys.exit(1) def usage(self): "print usage message, and exit" print(file=sys.stderr) print(self._usage % {'progname': self.progname}, file=sys.stderr) print(file=sys.stderr) sys.exit(1) if __name__ == '__main__': a = Args('Usage: %(progname)s [-a value] [-b value] [-c] word [file...]') a.opt['-a'] = 'option a' # set some default option values a.opt['-b'] = 'option b' # a.getopt('a:b:c') # get user supplied option values word = a.shift() # get the first of the remaining arguments # use a.pop() to get the last instead for line in a: # iterate over the contents of all remaining arguments (file names) if a.lineno == 1: print('starting new file:', a.infile) a.warning(line.rstrip()) print('Options:', a.opt) print('Word:', word) print('Total number of lines:', a.linesum) print('Command line:', sys.argv) # unchanged a.warning('warn 1') # print a warning a.error('error') # print an error message and exit a.warning('warn 2') # this won't show
[ "johannes.buchner.acad@gmx.com" ]
johannes.buchner.acad@gmx.com
13bc41ea13c609620e4b5eccc6962fa2e0a7aa90
a0500eec8e656301d3e71f4ea240ddabd2994107
/student/forms.py
e718c658f3efffcd83b3d15cb3e17a47e5b6889d
[]
no_license
abhinavsharma629/Stalk-Site
bc80aaf7ecc91f7b09e64173b351101a41253adf
37564018543dfb2d0e439a4ee6933477958fca48
refs/heads/master
2020-04-19T13:08:28.544661
2019-01-30T23:50:26
2019-01-30T23:50:26
168,210,403
7
0
null
null
null
null
UTF-8
Python
false
false
1,018
py
from django import forms from .models import StudentData class StudentSubmit(forms.ModelForm): er_no=forms.CharField(widget=forms.TextInput(attrs={'class':'form-group'}),required=True,max_length=100) name=forms.CharField(widget=forms.TextInput(),required=True,max_length=150) college_name=forms.CharField(widget=forms.TextInput(),required=True,max_length=250) codeforces=forms.CharField(widget=forms.TextInput(),required=False,max_length=100) codechef=forms.CharField(widget=forms.TextInput(),required=True,max_length=100) spoj=forms.CharField(widget=forms.TextInput(),required=False,max_length=100) hackerrank=forms.CharField(widget=forms.TextInput(),required=False,max_length=100) hackerearth=forms.CharField(widget=forms.TextInput(),required=False,max_length=100) github=forms.CharField(widget=forms.TextInput(), required=False, max_length=100) class Meta: model= StudentData fields=['er_no','name','college_name','codeforces', 'codechef','spoj','hackerrank','hackerearth', 'github']
[ "abhinavsharma629@gmail.com" ]
abhinavsharma629@gmail.com
0e02b9d97b66a81201874125f05af122a2bdf46f
761a3c37621b2daae06d9fe29c93e4d9a8bf5a95
/policy/networks/fixed_actor_network.py
a269867bb588716baf82eb8a034559e15f03d784
[]
no_license
matthewzhang1998/ecco
486dd37e3b2038b0d3f4d9f40de094f64b6a0679
b25b6d6d4d815e716c19aa53010e70583fbe5686
refs/heads/master
2020-03-26T19:36:55.511529
2018-09-17T04:53:52
2018-09-17T04:53:52
145,275,328
0
0
null
null
null
null
UTF-8
Python
false
false
257
py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Aug 14 14:21:09 2018 @author: matthewszhang """ from policy.networks import base_network class network(base_network.base_network): def __init__(self, *args, **kwargs): pass
[ "matthew.zhang@mail.utoronto.ca" ]
matthew.zhang@mail.utoronto.ca
08cc8c36414dd20264de228d3d5dcfd383d028a7
1524720d6480ad0a51b6fd8ff709587455bf4c5d
/tums/trunk/release/Pages/Users/Bulk.py
17ed9a01c5c7ecb5af3ad4857c9109ac0b574b75
[]
no_license
calston/tums
2bd6d3cac5232d2ccb7e9becfc649e302a310eab
b93e3e957ff1da5b020075574942913c8822d12a
refs/heads/master
2020-07-12T03:46:43.639800
2018-05-12T10:54:54
2018-05-12T10:54:54
null
0
0
null
null
null
null
UTF-8
Python
false
false
8,347
py
from nevow import rend, loaders, tags from twisted.application import service, internet, strports from twisted.web import server, static from twisted.python import failure from nevow import inevow, rend, appserver, static, guard, url, loaders, stan from nevow.taglibrary import tabbedPane import Tree, Settings, LDAP, formal, ldap, os, random, sha from Core import PageHelpers, Utils, confparse, WebUtils import copy, time from Pages import VPN # Import the VPN module for making certs from Pages.Users import Add, Edit, Group, Delete, Base alpha = "LLPETUMS" class bulkUsers(Base.Page): def form_addForm(self, data): form = formal.Form(self.submitForm) form.addField('upload', formal.File(), formal.FileUploadWidget, label = "Upload file") form.addAction(self.submitForm) return form def submitForm(self, ctx, form, data): adder = Add.addPage(self.avatarId,self.db, Settings.defaultDomain) editor = Edit.editPage(self.avatarId, self.db, Settings.defaultDomain) deleter = Delete.deletePage(self.avatarId, self.db) groupSwitcher = Group.editGroups(self.avatarId, self.db) print data['upload'] # My crufty CSV parser. type, fdata,name = data['upload'] sepchar = None logs = [] lineno = 0 for l in fdata: lineno+= 1 # Clean it up l = l.strip('\n').strip() # continue if we don't have anything left if not l: continue # Figure out the separation character, we accept a few to play nice if not sepchar: sepChars = [",",";",":","\t"] sepcnt, char = (0, None) # Find the most occurances for i in sepChars: if l.count(i) > sepcnt: char = i sepchar = char print "Using sepchar ", repr(sepchar) prefields = l.split(sepchar) # Clean the fields # [type, uid, name, surname, password, perm1, perm2, groups ->] fields = ["A", "", "", "", "", "", ""] off = 0 for i,n in enumerate(prefields): st = n.strip(' ').strip("'").strip('"') if i == 0: if st not in ["A", "U", "D"]: off += 1 if len(fields) > (i+off): fields[i+off] = st else: if st: fields.append(st) action = fields[0] email = fields[5].lower() web = fields[6].lower() groups = fields[7:] groups.append('Domain Users') if email in ["yes", "true", "1"]: email = True else: email = False if web in ["yes", "true", "1"]: web = True else: web = False submitData = { 'userSettings.uid': unicode(fields[1].split('@')[0]), 'userPermissions.employeeType': web, 'userPermissions.tumsUser': None, 'userSettings.userPassword': fields[4] or "%s100" % fields[2], 'mailSettings.vacation': None, 'userPermissions.tumsAdmin': False, 'userPermissions.accountStatus': email, 'userSettings.sn': unicode(fields[3]), 'userSettings.givenName': unicode(fields[2]), 'userAccess.ftpEnabled': None, 'userAccess.ftpGlobal': None, 'userAccess.vpnEnabled': None, 'userPermissions.copyto': None } for i in range(10): submitData['mailSettings.mailAlternateAddress%s' % i] = u"" submitData['mailSettings.mailForwardingAddress%s' % i] = u"" # Figure out the domain if '@' in fields[1]: domain = fields[1].split('@')[-1] else: domain = Settings.defaultDomain print action, domain, submitData['userSettings.uid'], groups if action == "A" or action == "U": if action == "A": adder.domain = domain try: adder.submitForm(ctx, None, submitData) except: pass if action == "U": try: editor.domain = domain editor.cid = submitData['userSettings.uid'].encode("ascii", "replace") editor.submitForm(ctx, None, submitData) except: logs.append("Unable to modify '%s' on line %s. Check that the user exists" % ( submitData['userSettings.uid'].encode("ascii", "replace"), lineno) ) continue # If it's actualy a Samba domain.. if domain == Settings.defaultDomain: try: # Assemble a mapping with spaces stripped groupDict = {} for i in groups: groupDict[i.replace(' ', '')] = True groupSwitcher.domain = domain groupSwitcher.cid = submitData['userSettings.uid'].encode("ascii", "replace") # Update the permissions groupSwitcher.submitForm(ctx, None, groupDict) except: logs.append("Unable to modify memberships for '%s' on line %s. Check that the user exists" % ( submitData['userSettings.uid'].encode("ascii", "replace"), lineno) ) continue elif action == "D": deleter.locateChild(ctx, [domain, submitData['userSettings.uid']]) else: logs.append("Unable to understand command '%s' on line %s" % (action, lineno)) print logs return url.root.child('Users') def render_editContent(self, ctx, data): return ctx.tag[ tags.h3["Bulk edit"], tags.directive('form addForm'), tags.div(id="helpbulk")[ tags.p[""" This page allows you to upload a CSV file with bulk editing commands. To create a bulk editing file please follow this column format. The first column must have one of A, D or U to show Add, Delete or Update. The username should follow this then first name, last name, password, email permission (blank for none), browsing permission, and then group memberships should follow. """, tags.br,tags.br, "For example:",tags.br, tags.pre[ "A, steven.jones, Steven, Jones, sjones3, yes, , Staff, Accounting\n", "U, bobb.stevens, Bobb, Stevens, bobbcat, yes, yes, Staff, HR\n" ], tags.br, "This will create the user steve.jones with the Staff and Accounting groups, " " the password 'sjones3', and give him email access. It will then update", " bobb.stevens to match the given permissions, password and groups. Spaces near", " commas will be removed as well as quotations, and TUMS will attempt to match various positive", " responses for the boolean permissions ('1', 'true' or 'yes').", " For deletion only the user name is required and any other columns will be ignored.", tags.br, "If the first column does not contain any of A, D or U then a new user will be assumed.", " If the columns end after the surname then the default permissions will be assumed.", " If the password column is not present it will be set to the first name with '100' appended", " for example 'Steven100'.", ] ] ]
[ "junwin@gmail.com" ]
junwin@gmail.com
dbbe212390f1fa211ad11556a684327f80674fe8
366d50ddb1ae1c20f2e8bcbc1b6cde58996ac24a
/Python-02网络数据采集/Reference/chapter6-数据读取/2-getUtf8Text.py
d76ea93faa287090d1058be700deefa0793c77f0
[]
no_license
luilui163/PythonBook
fe7796ca26842f07d3baa5d754f79cda5fd2b18f
f81585479fb3859dfd818fccd43a64e50f6f81dc
refs/heads/master
2020-04-06T12:59:10.949209
2017-11-09T10:43:36
2017-11-09T10:43:36
null
0
0
null
null
null
null
UTF-8
Python
false
false
726
py
# 使用BeautifulSoup模块对txt格式文本进行UTF-8编码再提取 # 解决:Python把文本读成ASCII编码格式,而浏览器把文本读成 ISO-8859-1 编码格式 from urllib.request import urlopen from bs4 import BeautifulSoup # 使用BeautifulSoup获取网页源代码 html = urlopen("http://en.wikipedia.org/wiki/Python_(programming_language)") bsObj = BeautifulSoup(html, "lxml") content = bsObj.find("div", {"id": "mw-content-text"}).get_text() # bsObj.find():寻找第一个符合条件的div;.get_text():获取当前标签的内容 content = bytes(content, "UTF-8") # 对标签内容用utf-8格式转换成bytes content = content.decode("UTF-8") # 对bytes内容用utf-8格式编码 print(content)
[ "lafitehhq@126.com" ]
lafitehhq@126.com
e0b09cdc02c1147f7eebd503a05959609d961462
fab15f0e35d3196b9e486d1d3e4f42b22f326817
/scripts/ugm/52_create_curation.py
73348c37c05695f765891d9bb8382f70a2424de0
[]
no_license
nakamura196/genji
4511c9d297b97697cad87f570085ac865ca0f750
e1079ad2839772fca4c93657d96e6bee14957b68
refs/heads/master
2022-06-03T01:18:37.789217
2020-05-01T11:44:44
2020-05-01T11:44:44
194,894,216
0
0
null
2019-08-28T23:44:12
2019-07-02T15:56:09
CSS
UTF-8
Python
false
false
2,515
py
import pandas as pd from rdflib import URIRef, BNode, Literal, Graph from rdflib.namespace import RDF, RDFS, FOAF, XSD from rdflib import Namespace import numpy as np import math import sys import argparse import json import urllib.request import os import csv import glob import requests import csv map = {} label_map = { "https://nakamura196.github.io/genji/ugm/ndl/manifest/3437686.json": "校異源氏物語", "https://nakamura196.github.io/genji/ugm/utokyo/manifest/01.json": "東大本", "https://nakamura196.github.io/genji/ugm/kyushu/manifest/01.json": "九大本(古活字版)", "https://nakamura196.github.io/genji/ugm/kyushu2/manifest/01.json": "九大本(無跋無刊記整版本)" } with open('curation_merged.csv', 'r') as f: reader = csv.reader(f) header = next(reader) # ヘッダーを読み飛ばしたい時 for row in reader: manifest = row[0] member_id = row[1] label = row[2] line_id = row[3] sort = row[4] if manifest not in map: map[manifest] = {} map[manifest][sort] = { "label": label, "line_id": line_id, "member_id": member_id } selections = [] for manifest in map: members = [] for sort in sorted(map[manifest]): obj = map[manifest][sort] member = { "@id": obj["member_id"], "@type": "sc:Canvas", "label": obj["label"] } members.append(member) if "line_id" in obj and obj["line_id"] != "": member["line_id"] = obj["line_id"] selection = { "@id": "http://mp.ex.nii.ac.jp/api/curation/json/9ab5cac5-78e6-41b8-9d8f-ab00f57d7b64/range1", "@type": "sc:Range", "label": "Manual curation by IIIF Curation Viewer", "members": members, "within": { "@id": manifest, "@type": "sc:Manifest", "label": label_map[manifest] } } selections.append(selection) curation_data = { "@context": [ "http://iiif.io/api/presentation/2/context.json", "http://codh.rois.ac.jp/iiif/curation/1/context.json" ], "@type": "cr:Curation", "@id": "http://mp.ex.nii.ac.jp/api/curation/json/9ab5cac5-78e6-41b8-9d8f-ab00f57d7b64", "label": "Curating list", "selections": selections } fw2 = open("curation.json", 'w') json.dump(curation_data, fw2, ensure_ascii=False, indent=4, sort_keys=True, separators=(',', ': '))
[ "na.kamura.1263@gmail.com" ]
na.kamura.1263@gmail.com
b1b319ea7e1a3d520dec06505878bcb419be66fd
35429631806692df957bd74a77e5c97db7d5db1e
/05_Themenmodellierung/project.py
10cbef9bdc4818d3982ef4ad3a87f94bd1b66503
[ "MIT" ]
permissive
felixdittrich92/NLP
f135f4390a3d76676dbd28fda11fad49c68ae8a5
1097d43dd1c99762b6a909a876a765bc79245471
refs/heads/master
2020-10-01T14:32:14.389080
2020-09-18T11:33:23
2020-09-18T11:33:23
227,556,715
0
0
null
null
null
null
UTF-8
Python
false
false
683
py
import pandas as pd from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.decomposition import NMF questions = pd.read_csv('./TextFiles/quora_questions.csv') print(questions.head()) tfidf = TfidfVectorizer(max_df=0.95, min_df=2, stop_words='english') dtm = tfidf.fit_transform(questions['Question']) nmf = NMF(n_components=20, random_state=42) nmf.fit(dtm) for index, topic in enumerate(nmf.components_): print(f'Die TOP-15 Wörter für das Thema #{index}') print([tfidf.get_feature_names()[i] for i in topic.argsort()[-15:]]) print('\n') topic_results = nmf.transform(dtm) questions['Topic'] = topic_results.argmax(axis=1) print(questions.head())
[ "felixdittrich92@gmail.com" ]
felixdittrich92@gmail.com
e941491f6ee750b1d448382918e1e2807a6dd007
b53e3d57d31a47a98d87141e44a5f8940ee15bca
/src/programy/utils/license/keys.py
65a5dc3d00fa025f122135206e067f668429418a
[ "MIT" ]
permissive
Chrissimple/program-y
52177fcc17e75fb97ab3993a4652bcbe7906bd58
80d80f0783120c2341e6fc57e7716bbbf28a8b3f
refs/heads/master
2020-03-29T13:20:08.162177
2018-09-26T19:09:20
2018-09-26T19:09:20
149,952,995
1
0
null
2018-09-23T06:11:04
2018-09-23T06:11:04
null
UTF-8
Python
false
false
3,057
py
""" Copyright (c) 2016-17 Keith Sterling http://www.keithsterling.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. """ import logging class LicenseKeys(object): def __init__(self): self._keys = {} def add_key(self, name, value): if name in self._keys: if logging.getLogger().isEnabledFor(logging.WARNING): logging.warning("License key [%s], already exists", name) self._keys[name] = value def has_key(self, name): return bool(name in self._keys) def get_key(self, name): if name in self._keys: return self._keys[name] else: raise ValueError("No license key named [%s]"%name) def load_license_key_data(self, license_key_data): lines = license_key_data.split('\n') for line in lines: self._process_license_key_line(line) def load_license_key_file(self, license_key_filename): try: if logging.getLogger().isEnabledFor(logging.INFO): logging.info("Loading license key file: [%s]", license_key_filename) with open(license_key_filename, "r", encoding="utf-8") as license_file: for line in license_file: self._process_license_key_line(line) except Exception: if logging.getLogger().isEnabledFor(logging.ERROR): logging.error("Invalid license key file [%s]", license_key_filename) def _process_license_key_line(self, line): line = line.strip() if line: if line.startswith('#') is False: splits = line.split("=") if len(splits) > 1: key_name = splits[0].strip() # If key has = signs in it, then combine all elements past the first key = "".join(splits[1:]).strip() self._keys[key_name] = key else: if logging.getLogger().isEnabledFor(logging.WARNING): logging.warning("Invalid license key [%s]", line)
[ "keith@keithsterling.com" ]
keith@keithsterling.com
fe30adbedfb9ded1a2bbaa6ae520a3830eb00f32
dfcb65de02953afaac24cc926ee32fcdede1ac21
/src/pyrin/utils/custom_print.py
589ac02c3990c2630664b441e021a3eab0f9f5b6
[ "BSD-3-Clause" ]
permissive
mononobi/pyrin
031d0c38da945b76b07ea100554ffc7f8081b05e
9d4776498225de4f3d16a4600b5b19212abe8562
refs/heads/master
2023-08-31T03:56:44.700142
2023-08-20T22:20:06
2023-08-20T22:20:06
185,481,041
20
8
null
null
null
null
UTF-8
Python
false
false
2,928
py
# -*- coding: utf-8 -*- """ utils custom_print module. """ import colorama import pyrin.application.services as application_services def print_colorful(value, color, force=False): """ prints the given value into stdout using the given color. if the application has been started in scripting mode it does not print the value. :param object value: value to be printed. :param int color: color of text to be printed. it should be from `colorama.Fore` colors. :param bool force: forces the printing, even if application has been started in scripting mode. defaults to False if not provided. """ if force is True or application_services.is_scripting_mode() is False: try: if not isinstance(value, str): value = str(value) colorama.init(autoreset=True) print(str(color) + value) finally: colorama.deinit() def print_warning(value, force=False): """ prints the given value into stdout as a warning. if the application has been started in scripting mode it does not print the value. :param object value: value to be printed. :param bool force: forces the printing, even if application has been started in scripting mode. defaults to False if not provided. """ print_colorful(value, colorama.Fore.YELLOW, force) def print_error(value, force=False): """ prints the given value into stdout as an error. if the application has been started in scripting mode it does not print the value. :param object value: value to be printed. :param bool force: forces the printing, even if application has been started in scripting mode. defaults to False if not provided. """ print_colorful(value, colorama.Fore.RED, force) def print_info(value, force=False): """ prints the given value into stdout as an info. if the application has been started in scripting mode it does not print the value. :param object value: value to be printed. :param bool force: forces the printing, even if application has been started in scripting mode. defaults to False if not provided. """ print_colorful(value, colorama.Fore.BLUE, force) def print_default(value, force=False): """ prints the given value into stdout with default color. if the application has been started in scripting mode it does not print the value. :param object value: value to be printed. :param bool force: forces the printing, even if application has been started in scripting mode. defaults to False if not provided. """ print_colorful(value, colorama.Fore.RESET, force)
[ "mohamadnobakht@gmail.com" ]
mohamadnobakht@gmail.com
a04e9f18fb32c8d4bac7255f10399e78f854df1c
54e3397609cc31b9142d483a29a9a3854800a620
/create/factoryMethod2.py
6b56640fb0915d08428d7528383759fbf17c12b3
[]
no_license
qiangayz/DesignPatterns
1ac2ee51e2a176910bc19520dcb6ebb9914e0a36
527a0ffe59e5fd980ba6b4387d422d6c96fe1623
refs/heads/master
2020-03-23T22:34:21.040915
2018-07-24T16:10:22
2018-07-24T16:10:22
142,183,151
0
0
null
null
null
null
UTF-8
Python
false
false
3,958
py
# _*_coding:utf-8_*_ ''' 工厂方法模式是简单工厂模式的衍生,解决了许多简单工厂模式的问题。 首先完全实现‘开-闭 原则’,实现了可扩展。其次更复杂的层次结构,可以应用于产品结果复杂的场合。    工厂方法模式的对简单工厂模式进行了抽象。有一个抽象的Factory类(可以是抽象类和接口),这个类将不在负责具体的产品生产, 而是只制定一些规范(接口作用),具体的生产工作由其子类去完成。在这个模式中,工厂类和产品类往往可以依次对应。即一个抽象工厂对应一个抽象产品,一个具体工厂对应一个具体产品,这个具体的工厂就负责生产对应的产品。    工厂方法模式(Factory Method pattern)是最典型的模板方法模式(Templete Method pattern)应用。 ''' class AbstractSchool(object): name = '' addr = '' principal = '' def enroll(self, name, course): pass def info(self): pass class AbstractCourse(object): def __init__(self, name, time_range, study_type, fee): self.name = name self.time_range = time_range self.study_type = study_type self.fee = fee def enroll_test(self): ''' 参加这门课程前需要进行的测试 :return: ''' print("课程[%s]测试中..." % self.name) def print_course_outline(self): '''打印课程大纲''' pass class LinuxOPSCourse(AbstractCourse): ''' 运维课程 ''' def print_course_outline(self): outline = ''' Linux 基础 Linux 基本服务使用 Linux 高级服务篇 Linux Shell编程 ''' print(outline) def enroll_test(self): print("不用测试,是个人就能学...") class PythonCourse(AbstractCourse): '''python自动化开发课程''' def print_course_outline(self): outline = ''' python 介绍 python 基础语法 python 函数式编程 python 面向对象 python 网络编程 python web开发基础 ''' print(outline) def enroll_test(self): print("-------python入学测试-------") print("-------500道题答完了-------") print("-------通过了-------") class BJSchool(AbstractSchool): name = "北京校区" def create_course(self, course_type): if course_type == 'py_ops': course = PythonCourse("Python自动化开发", 7, '面授', 11000) elif course_type == 'linux': course = LinuxOPSCourse("Linux运维课程", 5, '面授', 12800) return course def enroll(self, name, course): print("开始为新学员[%s]办入学手续... " % name) print("帮学员[%s]注册课程[%s]..." % (name, course)) course.enroll_test() def info(self): print("------[%s]-----" % self.name) class SHSchool(AbstractSchool): name = "上海分校" def create_course(self, course_type): if course_type == 'py_ops': course = PythonCourse("Python自动化开发", 8, '在线', 6500) elif course_type == 'linux': course = LinuxOPSCourse("Linux运维课程", 6, '在线', 8000) return course def enroll(self, name, course): print("开始为新学员[%s]办入学手续... " % name) print("帮学员[%s]注册课程[%s]..." % (name, course)) # course.level_test() def info(self): print("--------[%s]-----" % self.name) school1 = BJSchool() school2 = SHSchool() school1.info() c1 = school1.create_course("py_ops") school1.enroll("张三", c1) school2.info() c2 = school1.create_course("py_ops") school2.enroll("李四", c2)
[ "38162672+qiangayz@users.noreply.github.com" ]
38162672+qiangayz@users.noreply.github.com
9eb0ce9317af236a41710606aefb2a38f642d2bc
8e5ed445e05274dd013f443d9d506695fa08ad9f
/dat/gui/cellcontainer.py
b23efa815047f362820feed65e52a39a4863ce63
[]
no_license
afcarl/DAT
5c2237f4b3745d3b47df27a91eab469cfadd9da9
1272b630326b05bca27746993fe2d32479a7353c
refs/heads/master
2020-06-22T05:49:54.135615
2015-09-16T14:10:41
2015-09-16T14:10:41
null
0
0
null
null
null
null
UTF-8
Python
false
false
23,335
py
import warnings from PyQt4 import QtCore, QtGui from dat import MIMETYPE_DAT_VARIABLE, MIMETYPE_DAT_PLOT, DATRecipe, \ RecipeParameterValue from dat.gui import get_icon from dat.gui import typecast_dialog from dat.global_data import GlobalManager from dat.operations import apply_operation, get_typecast_operations from dat.utils import deferrable_via_qt from dat.vistrail_data import VistrailManager from dat import vistrails_interface from dat.gui.overlays import PlotPromptOverlay, VariableDropEmptyCell, \ PlotDroppingOverlay, VariableDroppingOverlay from vistrails.core.application import get_vistrails_application from vistrails.packages.spreadsheet.spreadsheet_cell import QCellContainer, \ CellContainerInterface class DATCellContainer(CellContainerInterface, QtGui.QWidget): """Cell container used in the spreadsheet. This is created by the spreadsheet for each cell, thus allowing us to tap into its behavior. It adds an overlay feature to the spreadsheet's cells and handles drops of variables and plots. """ def __new__(cls, *args, **kwargs): # Special case: if we are not on a DAT sheet, use VisTrails's container # class if VistrailManager() is None: return QCellContainer(*args, **kwargs) else: return super(DATCellContainer, cls).__new__(cls, *args, **kwargs) def __init__(self, cellInfo=None, widget=None, error=None, parent=None): # Parent constructors CellContainerInterface.__init__(self, cellInfo) QtGui.QWidget.__init__(self, parent) self.setAcceptDrops(True) # Attributes self._parameters = dict() # param name -> [RecipeParameterValue] self._plot = None # dat.vistrails_interface:Plot self._execute_pending = False self._parameter_hovered = None self._insert_pos = None # Notifications app = get_vistrails_application() app.register_notification( 'dat_new_variable', self._variable_added) app.register_notification( 'dat_removed_variable', self._variable_removed) app.register_notification( 'dragging_to_overlays', self._set_dragging) self._controller = app.get_controller() # Overlay self._overlay = None self._overlay_scrollarea = QtGui.QScrollArea(self) self._overlay_scrollarea.setObjectName('overlay_scrollarea') self._overlay_scrollarea.setStyleSheet( 'QScrollArea#overlay_scrollarea {' ' background-color: transparent;' '}' 'Overlay {' ' background-color: transparent;' '}') self._overlay_scrollarea.setWidgetResizable(True) # Toolbar self._container_toolbar = QtGui.QToolBar(self) self._container_toolbar.layout().setMargin(0) self._container_toolbar.hide() self._show_action = QtGui.QAction( get_icon('show_overlay.png'), "Show overlay", self) self.connect(self._show_action, QtCore.SIGNAL('triggered()'), self.show_overlay) self._show_action_enabled = False self._hide_action = QtGui.QAction( get_icon('hide_overlay.png'), "Hide overlay", self) self.connect(self._hide_action, QtCore.SIGNAL('triggered()'), lambda: self._set_overlay(None)) self._hide_action_enabled = False # Error icon self._error_icon = QtGui.QLabel(self) self._error_icon.setPixmap(get_icon('error.png').pixmap(24, 24)) self._set_error(error) # Setup cell if widget is not None: self.setWidget(widget) else: self.contentsUpdated() def containerToolBar(self): if self._plot: return self._container_toolbar else: return None def _set_toolbar_buttons(self, button): display_hide = button is False display_show = button is not False self._show_action.setEnabled(button is not None) if display_hide != self._hide_action_enabled: if not display_hide: self._container_toolbar.removeAction(self._hide_action) else: self._container_toolbar.addAction(self._hide_action) self._hide_action_enabled = display_hide if display_show != self._show_action_enabled: if not display_show: self._container_toolbar.removeAction(self._show_action) elif self._hide_action_enabled: self._container_toolbar.insertAction(self._hide_action, self._show_action) else: self._container_toolbar.addAction(self._show_action) self._show_action_enabled = display_show def setCellInfo(self, cellInfo): super(DATCellContainer, self).setCellInfo(cellInfo) if cellInfo is None: # We were removed from the spreadsheet app = get_vistrails_application() app.unregister_notification( 'dat_new_variable', self._variable_added) app.unregister_notification( 'dat_removed_variable', self._variable_removed) app.unregister_notification( 'dragging_to_overlays', self._set_dragging) def _set_dragging(self, dragging): """This is a hack to avoid an issue with Qt's mouse event propagation. If we don't set TransparentForMouseEvents on the overlay, when the drag enters, the overlay will receive the mouse event and propagate it to us. Thus it is on the call stack and we can't replace it with another overlay... It would cause a segmentation fault on Mac OS. """ self._overlay_scrollarea.setAttribute( QtCore.Qt.WA_TransparentForMouseEvents, dragging) def _variable_added(self, controller, varname, renamed_from=None): if (renamed_from is None or controller != self._controller or self._plot is None): return if any( (param.type == RecipeParameterValue.VARIABLE and param.variable.name == varname) for params in self._parameters.itervalues() for param in params): self._overlay.update() def _variable_removed(self, controller, varname, renamed_to=None): if (renamed_to is not None or controller != self._controller or self._plot is None): return if any( (param.type == RecipeParameterValue.VARIABLE and param.variable.name == varname) for params in self._parameters.itervalues() for param in params): # A variable was removed! # Two cases here: if self.widget() is not None: # If this cell already contains a result, we'll just turn # into a dumb VisTrails cell, as the DAT recipe doesn't # exist anymore self._plot = None self._parameters = dict() else: # If this cell didn't already contain a result, we just # remove the associated parameters # The user will just have to drop something else to_remove = [] for param, values in self._parameters.iteritems(): for i, value in enumerate(values): if (value.type == RecipeParameterValue.VARIABLE and value.variable.name == varname): to_remove.append((param, i)) for param, i in to_remove: del self._parameters[param][i] for param in set(param for param, i in to_remove): if not self._parameters[param]: del self._parameters[param] self._set_overlay(None) def setWidget(self, widget): """Changes the current widget in the cell. This is called by the spreadsheet to put or remove a visualization in this cell. """ if widget != self.containedWidget: if self.containedWidget: self.containedWidget.setParent(None) self.containedWidget.deleteLater() self.toolBar = None if widget: widget.setParent(self) widget.show() self.containedWidget = widget if widget is None: return widget.raise_() self._set_toolbar_buttons(True) self.contentsUpdated() def takeWidget(self): widget = self.containedWidget if widget is not None: widget.setParent(None) self.containedWidget = None self.toolBar = None return widget def get_pipeline(self): vistraildata = VistrailManager(self._controller) if vistraildata is None: return None if self.widget() is not None: # Get pipeline info from VisTrails pipelineInfo = self.cellInfo.tab.getCellPipelineInfo( self.cellInfo.row, self.cellInfo.column) version = pipelineInfo[0]['version'] return vistraildata.get_pipeline( version, infer_for_cell=self.cellInfo) else: # Get pipeline info from DAT: we might be building something here return vistraildata.get_pipeline(self.cellInfo) def contentsUpdated(self): """Notifies that this cell's pipeline changed. This is called directly from the spreadsheet when a new visualization was set, but the cell widget was reused because it had the same type. The pipeline version still changed, so we need to update the overlay anyway. It is also called by setWidget() here. """ pipeline = self.get_pipeline() if pipeline is not None: self._plot = pipeline.recipe.plot parameters = pipeline.recipe.parameters self._parameters = {param: list(values) for param, values in parameters.iteritems()} else: self._plot = None self._parameters = dict() self._set_overlay(None) def _set_overlay(self, overlay_class, **kwargs): if overlay_class is None: # Default overlay if self._plot is not None and self.has_error(): self._set_overlay(VariableDroppingOverlay, overlayed=False) self._set_toolbar_buttons(None) self._error_icon.raise_() return elif self.widget() is None and self._plot is not None: self._set_overlay(VariableDroppingOverlay, overlayed=False) return elif self.widget() is None: self._set_overlay(PlotPromptOverlay, overlayed=False) return if self._overlay is not None: self._overlay.setParent(None) self._overlay.deleteLater() if overlay_class is None: self._overlay = None self._overlay_scrollarea.lower() if self._plot is not None: self._set_toolbar_buttons(True) else: self._set_toolbar_buttons(None) # Now that we are done with the overlay, we can go on with a # deferred execution if self._execute_pending: self.update_pipeline() self._execute_pending = False else: self._overlay = overlay_class(self, **kwargs) self._overlay_scrollarea.setWidget(self._overlay) self._overlay.show() self._overlay_scrollarea.raise_() self.do_layout() self._set_toolbar_buttons(None) def show_overlay(self): """Shows the overlay from the button in the toolbar. It will remain shown until something gets dragged or the other button is clicked. """ if self._plot is None: # Shouldn't happen warnings.warn("show_overlay() while cell is empty!") return self._set_overlay(VariableDroppingOverlay, overlayed=False) self._set_toolbar_buttons(False) def _set_error(self, error): self._error = error if self.has_error(): self._error_icon.setToolTip(error) self._error_icon.show() self._error_icon.raise_() self._set_toolbar_buttons(None) else: self._error_icon.hide() self._set_overlay(None) def has_error(self): return (self._error is not None and self._error is not vistrails_interface.MISSING_PARAMS) def resizeEvent(self, event): """Reacts to a resize by laying out the overlay and buttons. """ super(DATCellContainer, self).resizeEvent(event) self.do_layout() def do_layout(self): if self.containedWidget is not None: self.containedWidget.setGeometry( 4, 4, self.width() - 8, self.height() - 8) self._overlay_scrollarea.setGeometry( 4, 4, self.width() - 8, self.height() - 8) self._error_icon.setGeometry(self.width() - 24, 0, 24, 24) def dragEnterEvent(self, event): mimeData = event.mimeData() if mimeData.hasFormat(MIMETYPE_DAT_VARIABLE): if VistrailManager(self._controller).get_variable( str(mimeData.data(MIMETYPE_DAT_VARIABLE))) is None: # I can't think of another case for this than someone dragging # a variable from another instance of DAT event.ignore() return # If this doesn't fail, we would still use the variable with # the same name from this instance, not import the variable # from the other instance if self._plot is None: # We should ignore the drop here. That would make sense, and # display the correct mouse pointer # We can't though, because Qt would stop sending drag and drop # events # We still refuse the QDropEvent when the drop happens self._set_overlay(VariableDropEmptyCell, mimeData=mimeData) else: self._set_overlay(VariableDroppingOverlay, mimeData=mimeData) elif mimeData.hasFormat(MIMETYPE_DAT_PLOT): try: plot = str(mimeData.data(MIMETYPE_DAT_PLOT)) plot = plot.split(',') if len(plot) != 2: raise KeyError plot = GlobalManager.get_plot(*plot) except KeyError: # I can't think of another case for this than someone dragging # a plot from another instance of DAT event.ignore() return # If the plot is available, this operation should work as # expected else: self._set_overlay(PlotDroppingOverlay, mimeData=mimeData) else: event.ignore() return event.accept() def dragMoveEvent(self, event): mimeData = event.mimeData() if (mimeData.hasFormat(MIMETYPE_DAT_VARIABLE) or mimeData.hasFormat(MIMETYPE_DAT_PLOT)): event.setDropAction(QtCore.Qt.CopyAction) event.accept() self._overlay.set_mouse_position(event.pos().x(), event.pos().y()) else: event.ignore() def dragLeaveEvent(self, event): self._set_overlay(None) def dropEvent(self, event): mimeData = event.mimeData() if mimeData.hasFormat(MIMETYPE_DAT_VARIABLE): if self._plot is not None and self._parameter_hovered is not None: event.accept() port_name = self._plot.ports[self._parameter_hovered].name varname = str(mimeData.data(MIMETYPE_DAT_VARIABLE)) # Here we keep the old values around, and we revert if # update_pipeline() returns False old_values = self._parameters.get(port_name) if old_values is not None: old_values = list(old_values) # Try to update values = self._parameters.setdefault(port_name, []) if values and values[0].type == RecipeParameterValue.CONSTANT: # The overlay shouldn't allow this warnings.warn("a variable was dropped on a port where a " "constant is set") event.ignore() return variable = (VistrailManager(self._controller) .get_variable(varname)) param = RecipeParameterValue(variable=variable) if self._insert_pos < len(values): values[self._insert_pos] = param else: values.append(param) if not self.update_pipeline(): # This is wrong somehow (ex: typecasting failed) # Revert to previous values if old_values is None: del self._parameters[port_name] else: self._parameters[port_name] = old_values else: event.ignore() elif mimeData.hasFormat(MIMETYPE_DAT_PLOT): event.accept() plotname = str(mimeData.data(MIMETYPE_DAT_PLOT)) plotname = plotname.split(',') if len(plotname) == 2: self._plot = GlobalManager.get_plot(*plotname) self._parameters = dict() self._parameter_hovered = None self.update_pipeline() else: event.ignore() self._set_overlay(None) def remove_parameter(self, port_name, num): """Clear a parameter. Called from the overlay when a 'remove' button is clicked. """ if self._plot is not None: values = self._parameters[port_name] del values[num] if not values: del self._parameters[port_name] self.update_pipeline() self._set_overlay(None) def change_constant(self, port_name, value): constant = self._parameters.get(port_name) if constant and constant[0].type != RecipeParameterValue.CONSTANT: # The overlay shouldn't do this warnings.warn("change_constant() on port where variables are set") return False elif constant is not None: constant = constant[0] if value is None: del self._parameters[port_name] return True elif constant.constant == value: return False self._parameters[port_name] = [ RecipeParameterValue(constant=value)] if self.widget() is not None: self._execute_pending = True else: self.update_pipeline(False, defer=True) return True def _cancel_pending(self): """Cancels the pending execution. Reset the cell's recipe to whatever pipeline is already in it. """ self.contentsUpdated() @deferrable_via_qt(bool) def update_pipeline(self, force_reexec=False): """Updates the recipe and execute the workflow if enough ports are set. """ # Look this recipe up in the VistrailData vistraildata = VistrailManager(self._controller) recipe = DATRecipe(self._plot, self._parameters) # Try to get an existing pipeline for this cell pipeline = self.get_pipeline() try: # No pipeline: build one if pipeline is None: pipeline = vistrails_interface.create_pipeline( self._controller, recipe, self.cellInfo.row, self.cellInfo.column, vistraildata.sheetname_var(self.cellInfo.tab), typecast=self._typecast) recipe = pipeline.recipe new_params_it = recipe.parameters.iteritems() self._parameters = {param: list(values) for param, values in new_params_it} vistraildata.created_pipeline(self.cellInfo, pipeline) # Pipeline with a different content: update it elif pipeline.recipe != recipe: try: pipeline = vistrails_interface.update_pipeline( self._controller, pipeline, recipe, typecast=self._typecast) except vistrails_interface.UpdateError, e: warnings.warn("Could not update pipeline, creating new " "one:\n" "%s" % e) pipeline = vistrails_interface.create_pipeline( self._controller, recipe, self.cellInfo.row, self.cellInfo.column, vistraildata.sheetname_var(self.cellInfo.tab), typecast=self._typecast) recipe = pipeline.recipe new_params_it = recipe.parameters.iteritems() self._parameters = {param: list(values) for param, values in new_params_it} vistraildata.created_pipeline(self.cellInfo, pipeline) # Nothing changed elif not force_reexec: return True # Clear pending flag as we're about to execute self._execute_pending = False # Execute the new pipeline if possible error = vistrails_interface.try_execute( self._controller, pipeline) if (error is vistrails_interface.MISSING_PARAMS and self.widget() is not None): # Clear the cell self.cellInfo.tab.deleteCell(self.cellInfo.row, self.cellInfo.column) # Set error status self._set_error(error) return True except vistrails_interface.CancelExecution: return False def _typecast(self, controller, variable, source_descriptor, expected_descriptor): typecasts = get_typecast_operations( source_descriptor, expected_descriptor) choice = typecast_dialog.choose_operation( typecasts, source_descriptor, expected_descriptor, self) return apply_operation(controller, choice, [variable]), choice
[ "remirampin@gmail.com" ]
remirampin@gmail.com
986ae54cc208bb5b8f14735de120a47266e6fe9f
9c5f36b72323090b9f0254938923a04b436fd3be
/scripts/test_image_contrast.py
81fd44194ba9ab7620bb56b92c03da263360a07a
[]
no_license
mdlaskey/IL_ROS_HSR
7c7233905e6a1fc8388661236bade3862da0fc90
d12f8397249acea4fae71d12c74074314a8a005e
refs/heads/master
2021-01-20T18:30:11.815581
2018-04-07T01:14:41
2018-04-07T01:14:41
90,918,344
2
1
null
null
null
null
UTF-8
Python
false
false
1,392
py
import numpy as np import cPickle as pickle import matplotlib.pyplot as plt import IPython import sys sys.path.append('/home/autolab/Workspaces/michael_working/yolo_tensorflow/') import configs.config_bed as cfg import cv2 if __name__ == "__main__": #-----Reading the image----------------------------------------------------- img = cv2.imread(cfg.IMAGE_PATH+'frame_0.png', 1) cv2.imshow("img",img) cv2.waitKey(30) #-----Converting image to LAB Color model----------------------------------- lab= cv2.cvtColor(img, cv2.COLOR_BGR2LAB) # cv2.imshow("lab",lab) # cv2.waitKey(30) #-----Splitting the LAB image to different channels------------------------- l, a, b = cv2.split(lab) # cv2.imshow('l_channel', l) # cv2.waitKey(30) # cv2.imshow('a_channel', a) # cv2.waitKey(30) # cv2.imshow('b_channel', b) # cv2.waitKey(30) #-----Applying CLAHE to L-channel------------------------------------------- clahe = cv2.createCLAHE(clipLimit=3.0, tileGridSize=(8,8)) cl = clahe.apply(l) # cv2.imshow('CLAHE output', cl) # cv2.waitKey(30) #-----Merge the CLAHE enhanced L-channel with the a and b channel----------- limg = cv2.merge((cl,a,b)) # cv2.imshow('limg', limg) # cv2.waitKey(30) #-----Converting image from LAB Color model to RGB model-------------------- final = cv2.cvtColor(limg, cv2.COLOR_LAB2BGR) cv2.imshow('final', final) cv2.waitKey(30) IPython.embed()
[ "mdlaskey@umich.edu" ]
mdlaskey@umich.edu