hexsha
string
size
int64
ext
string
lang
string
max_stars_repo_path
string
max_stars_repo_name
string
max_stars_repo_head_hexsha
string
max_stars_repo_licenses
list
max_stars_count
int64
max_stars_repo_stars_event_min_datetime
string
max_stars_repo_stars_event_max_datetime
string
max_issues_repo_path
string
max_issues_repo_name
string
max_issues_repo_head_hexsha
string
max_issues_repo_licenses
list
max_issues_count
int64
max_issues_repo_issues_event_min_datetime
string
max_issues_repo_issues_event_max_datetime
string
max_forks_repo_path
string
max_forks_repo_name
string
max_forks_repo_head_hexsha
string
max_forks_repo_licenses
list
max_forks_count
int64
max_forks_repo_forks_event_min_datetime
string
max_forks_repo_forks_event_max_datetime
string
content
string
avg_line_length
float64
max_line_length
int64
alphanum_fraction
float64
qsc_code_num_words_quality_signal
int64
qsc_code_num_chars_quality_signal
float64
qsc_code_mean_word_length_quality_signal
float64
qsc_code_frac_words_unique_quality_signal
float64
qsc_code_frac_chars_top_2grams_quality_signal
float64
qsc_code_frac_chars_top_3grams_quality_signal
float64
qsc_code_frac_chars_top_4grams_quality_signal
float64
qsc_code_frac_chars_dupe_5grams_quality_signal
float64
qsc_code_frac_chars_dupe_6grams_quality_signal
float64
qsc_code_frac_chars_dupe_7grams_quality_signal
float64
qsc_code_frac_chars_dupe_8grams_quality_signal
float64
qsc_code_frac_chars_dupe_9grams_quality_signal
float64
qsc_code_frac_chars_dupe_10grams_quality_signal
float64
qsc_code_frac_chars_replacement_symbols_quality_signal
float64
qsc_code_frac_chars_digital_quality_signal
float64
qsc_code_frac_chars_whitespace_quality_signal
float64
qsc_code_size_file_byte_quality_signal
float64
qsc_code_num_lines_quality_signal
float64
qsc_code_num_chars_line_max_quality_signal
float64
qsc_code_num_chars_line_mean_quality_signal
float64
qsc_code_frac_chars_alphabet_quality_signal
float64
qsc_code_frac_chars_comments_quality_signal
float64
qsc_code_cate_xml_start_quality_signal
float64
qsc_code_frac_lines_dupe_lines_quality_signal
float64
qsc_code_cate_autogen_quality_signal
float64
qsc_code_frac_lines_long_string_quality_signal
float64
qsc_code_frac_chars_string_length_quality_signal
float64
qsc_code_frac_chars_long_word_length_quality_signal
float64
qsc_code_frac_lines_string_concat_quality_signal
float64
qsc_code_cate_encoded_data_quality_signal
float64
qsc_code_frac_chars_hex_words_quality_signal
float64
qsc_code_frac_lines_prompt_comments_quality_signal
float64
qsc_code_frac_lines_assert_quality_signal
float64
qsc_codepython_cate_ast_quality_signal
float64
qsc_codepython_frac_lines_func_ratio_quality_signal
float64
qsc_codepython_cate_var_zero_quality_signal
bool
qsc_codepython_frac_lines_pass_quality_signal
float64
qsc_codepython_frac_lines_import_quality_signal
float64
qsc_codepython_frac_lines_simplefunc_quality_signal
float64
qsc_codepython_score_lines_no_logic_quality_signal
float64
qsc_codepython_frac_lines_print_quality_signal
float64
qsc_code_num_words
int64
qsc_code_num_chars
int64
qsc_code_mean_word_length
int64
qsc_code_frac_words_unique
null
qsc_code_frac_chars_top_2grams
int64
qsc_code_frac_chars_top_3grams
int64
qsc_code_frac_chars_top_4grams
int64
qsc_code_frac_chars_dupe_5grams
int64
qsc_code_frac_chars_dupe_6grams
int64
qsc_code_frac_chars_dupe_7grams
int64
qsc_code_frac_chars_dupe_8grams
int64
qsc_code_frac_chars_dupe_9grams
int64
qsc_code_frac_chars_dupe_10grams
int64
qsc_code_frac_chars_replacement_symbols
int64
qsc_code_frac_chars_digital
int64
qsc_code_frac_chars_whitespace
int64
qsc_code_size_file_byte
int64
qsc_code_num_lines
int64
qsc_code_num_chars_line_max
int64
qsc_code_num_chars_line_mean
int64
qsc_code_frac_chars_alphabet
int64
qsc_code_frac_chars_comments
int64
qsc_code_cate_xml_start
int64
qsc_code_frac_lines_dupe_lines
int64
qsc_code_cate_autogen
int64
qsc_code_frac_lines_long_string
int64
qsc_code_frac_chars_string_length
int64
qsc_code_frac_chars_long_word_length
int64
qsc_code_frac_lines_string_concat
null
qsc_code_cate_encoded_data
int64
qsc_code_frac_chars_hex_words
int64
qsc_code_frac_lines_prompt_comments
int64
qsc_code_frac_lines_assert
int64
qsc_codepython_cate_ast
int64
qsc_codepython_frac_lines_func_ratio
int64
qsc_codepython_cate_var_zero
int64
qsc_codepython_frac_lines_pass
int64
qsc_codepython_frac_lines_import
int64
qsc_codepython_frac_lines_simplefunc
int64
qsc_codepython_score_lines_no_logic
int64
qsc_codepython_frac_lines_print
int64
effective
string
hits
int64
a2593397a5dab50cf3ce4ebdeeb3fbf05818b971
293
py
Python
melisa/models/message/__init__.py
MelisaDev/melisa
53fee10d8c1bf4dd716bc90096c16f096e11bfbf
[ "MIT" ]
5
2022-03-11T19:51:28.000Z
2022-03-13T16:28:58.000Z
melisa/models/message/__init__.py
MelisaDev/melisa
53fee10d8c1bf4dd716bc90096c16f096e11bfbf
[ "MIT" ]
2
2022-03-19T18:09:39.000Z
2022-03-23T12:18:49.000Z
melisa/models/message/__init__.py
MelisaDev/melisa
53fee10d8c1bf4dd716bc90096c16f096e11bfbf
[ "MIT" ]
1
2022-03-23T07:30:04.000Z
2022-03-23T07:30:04.000Z
# Copyright MelisaDev 2022 - Present # Full MIT License can be found in `LICENSE.txt` at the project root. from .message import ( MessageType, MessageActivityType, MessageFlags, AllowedMentions, Message, ) from .embed import * from .colors import * from .file import File
20.928571
69
0.720137
35
293
6.028571
0.742857
0.094787
0
0
0
0
0
0
0
0
0
0.017316
0.211604
293
13
70
22.538462
0.896104
0.348123
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.4
0
0.4
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
2
a266a99828415a4179445fc45dbb2fde8a4a3ec8
92
py
Python
pyavsong/__init__.py
alenwl/pyavsong
516bada8dde0af1015da3e5eea5e0df584648713
[ "MIT" ]
null
null
null
pyavsong/__init__.py
alenwl/pyavsong
516bada8dde0af1015da3e5eea5e0df584648713
[ "MIT" ]
null
null
null
pyavsong/__init__.py
alenwl/pyavsong
516bada8dde0af1015da3e5eea5e0df584648713
[ "MIT" ]
null
null
null
""" Top-level package for Python AvSong. """ __app_name__ = "pyavsong" __version__ = "0.1"
13.142857
36
0.684783
12
92
4.5
1
0
0
0
0
0
0
0
0
0
0
0.025641
0.152174
92
6
37
15.333333
0.666667
0.391304
0
0
0
0
0.229167
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
a2777089666b88e120707ffa39156273c4c865bd
690
py
Python
setup.py
BorisTheBrave/axaxaxas
3973e7dbdc6e57f44d9a039b53e6791c8f036ee8
[ "MIT" ]
null
null
null
setup.py
BorisTheBrave/axaxaxas
3973e7dbdc6e57f44d9a039b53e6791c8f036ee8
[ "MIT" ]
null
null
null
setup.py
BorisTheBrave/axaxaxas
3973e7dbdc6e57f44d9a039b53e6791c8f036ee8
[ "MIT" ]
null
null
null
from setuptools import setup setup( name='axaxaxas', version="1.0.0", description="A simple to use Earley Parser", long_description="""Axaxaxas is a full Earley Parser with an emphasis on ease of use and customization. Earley parsers are a type of chart parser with robust support for ambiguous syntax.""", author="Adam Newgas", license="MIT", classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'Topic :: Text Processing :: General', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 3.3', ], keywords='earley parser natural language', packages=["axaxaxas"], )
31.363636
107
0.662319
83
690
5.493976
0.746988
0.078947
0
0
0
0
0
0
0
0
0
0.011152
0.22029
690
21
108
32.857143
0.836431
0
0
0
0
0
0.632801
0
0
0
0
0
0
1
0
true
0
0.052632
0
0.052632
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
a2792d47fcc95e82d666e653c40eba22d8d2a427
923
py
Python
simplemooc/accounts/urls.py
jorgerodriguesdev/appcursossimplesdjango
6832fda506199e124617a1f569123d139af49c04
[ "MIT" ]
1
2020-10-12T03:08:33.000Z
2020-10-12T03:08:33.000Z
accounts/urls.py
jorgerodriguesdev/appcursossimplesdjango
6832fda506199e124617a1f569123d139af49c04
[ "MIT" ]
null
null
null
accounts/urls.py
jorgerodriguesdev/appcursossimplesdjango
6832fda506199e124617a1f569123d139af49c04
[ "MIT" ]
1
2020-10-12T03:08:34.000Z
2020-10-12T03:08:34.000Z
from django.conf.urls import patterns, include, url urlpatterns = patterns('', url(r'^$', 'simplemooc.accounts.views.dashboard', name='dashboard'), url(r'^entrar/$', 'django.contrib.auth.views.login', {'template_name': 'accounts/login.html'}, name='login'), url(r'^sair/$', 'django.contrib.auth.views.logout', {'next_page': 'core:home'}, name='logout'), url(r'^cadastre-se/$', 'simplemooc.accounts.views.register', name='register'), url(r'^nova-senha/$', 'simplemooc.accounts.views.password_reset', name='password_reset'), url(r'^confirmar-nova-senha/(?P<key>\w+)/$', 'simplemooc.accounts.views.password_reset_confirm', name='password_reset_confirm'), url(r'^editar/$', 'simplemooc.accounts.views.edit', name='edit'), url(r'^editar-senha/$', 'simplemooc.accounts.views.edit_password', name='edit_password'), )
43.952381
71
0.633803
108
923
5.324074
0.37963
0.055652
0.24
0.076522
0.125217
0
0
0
0
0
0
0
0.163597
923
21
72
43.952381
0.744819
0
0
0
0
0
0.568182
0.375541
0
0
0
0
0
1
0
false
0.3
0.05
0
0.05
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
a28eb7416e0c6306d859f0a16442e92c5472d123
421
py
Python
setup.py
BigDaMa/error-generator
7d8949fc8fb00b6285c7c220dbda7451dc152e44
[ "Apache-2.0" ]
2
2018-11-11T07:52:51.000Z
2019-06-19T05:44:55.000Z
setup.py
BigDaMa/error-generator
7d8949fc8fb00b6285c7c220dbda7451dc152e44
[ "Apache-2.0" ]
5
2018-07-20T15:08:23.000Z
2018-11-21T13:18:01.000Z
setup.py
BigDaMa/error-generator
7d8949fc8fb00b6285c7c220dbda7451dc152e44
[ "Apache-2.0" ]
1
2020-11-25T15:16:16.000Z
2020-11-25T15:16:16.000Z
from setuptools import setup, find_packages setup(name='errorgenerator', version='0.2', description='Package to generate highly realistic errors', license="TU-Berlin", author='Milad Abbaszadeh', author_email='milad.abbaszadeh94@gmail.com', packages=find_packages(), url="https://github.com/BigDaMa/error-generator", install_requires=['pandas','numpy','chainer'] )
30.071429
64
0.67696
46
421
6.108696
0.847826
0.085409
0
0
0
0
0
0
0
0
0
0.011662
0.185273
421
13
65
32.384615
0.80758
0
0
0
1
0
0.411905
0.066667
0
0
0
0
0
1
0
true
0
0.090909
0
0.090909
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
a28f9c23dee47130264c9eae2c392bd4c2a3043f
1,205
py
Python
checks/checks.py
AstonishBot/Astonish
8d79a556a9421a59e0ce594e42d27a4e4d91c9c0
[ "MIT" ]
null
null
null
checks/checks.py
AstonishBot/Astonish
8d79a556a9421a59e0ce594e42d27a4e4d91c9c0
[ "MIT" ]
null
null
null
checks/checks.py
AstonishBot/Astonish
8d79a556a9421a59e0ce594e42d27a4e4d91c9c0
[ "MIT" ]
null
null
null
import discord from discord.ext import commands class NSFWOnly(commands.CheckFailure): pass class OwnerOnly(commands.CheckFailure): pass class PatronOnly(commands.CheckFailure): pass class NeedsAccount(commands.CheckFailure): pass def nsfw(): async def predicate(ctx): if type(ctx.channel) == discord.channel.DMChannel: raise NSFWOnly() elif ctx.channel.is_nsfw(): return True else: raise NSFWOnly() return commands.check(predicate) def owner(): async def predicate(ctx): if ctx.author.id in ctx.bot.whitelist: return True else: raise OwnerOnly() return commands.check(predicate) def patron(): async def predicate(ctx): if ctx.author.id in ctx.bot.patrons: return True else: raise PatronOnly() return commands.check(predicate) def account(): async def predicate(ctx): if ( await ctx.bot.db.fetchval(f"SELECT * FROM users WHERE id = {ctx.author.id}") ) is not None: return True else: raise NeedsAccount() return commands.check(predicate)
19.126984
88
0.609129
135
1,205
5.42963
0.340741
0.109141
0.130969
0.109141
0.298772
0.111869
0.111869
0.111869
0.111869
0.111869
0
0
0.302905
1,205
62
89
19.435484
0.872619
0
0
0.52381
0
0
0.038174
0
0
0
0
0
0
1
0.095238
true
0.095238
0.047619
0
0.428571
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
2
a29ae20ed68cc4047ffaa89cbce18b04801a6f1d
246
py
Python
app/models/admin.py
chetat/market-research
8eac059f91ea41b8b885d1f2bbe14029292bf61c
[ "MIT" ]
null
null
null
app/models/admin.py
chetat/market-research
8eac059f91ea41b8b885d1f2bbe14029292bf61c
[ "MIT" ]
null
null
null
app/models/admin.py
chetat/market-research
8eac059f91ea41b8b885d1f2bbe14029292bf61c
[ "MIT" ]
1
2021-03-15T19:24:38.000Z
2021-03-15T19:24:38.000Z
from .. import db class TrackingScript(db.Model): __tablename__ = "tracking_script" id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(50), nullable=False) script = db.Column(db.String(150), nullable=False)
27.333333
54
0.703252
34
246
4.911765
0.617647
0.143713
0.179641
0.191617
0
0
0
0
0
0
0
0.024155
0.158537
246
8
55
30.75
0.782609
0
0
0
0
0
0.060976
0
0
0
0
0
0
1
0
false
0
0.166667
0
1
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
a29fd53673325c7cbe03afc77d93aaf96212f79d
145
py
Python
openapi_to_markdown/__init__.py
smatsumt/openapi_to_markdown
c4053bc523182d6e2a913f9f3b6a3ed4d80ca3cc
[ "MIT" ]
null
null
null
openapi_to_markdown/__init__.py
smatsumt/openapi_to_markdown
c4053bc523182d6e2a913f9f3b6a3ed4d80ca3cc
[ "MIT" ]
null
null
null
openapi_to_markdown/__init__.py
smatsumt/openapi_to_markdown
c4053bc523182d6e2a913f9f3b6a3ed4d80ca3cc
[ "MIT" ]
null
null
null
"""Top-level package for openapi-to-markdown.""" __author__ = """Shinji Matsumoto""" __email__ = 'shinji.mtsmt@gmail.com' __version__ = '0.1.0'
24.166667
48
0.703448
19
145
4.736842
0.894737
0
0
0
0
0
0
0
0
0
0
0.023077
0.103448
145
5
49
29
0.669231
0.289655
0
0
0
0
0.443299
0.226804
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
a2ae4f17308f634f12ab0d89d8ea1ba9c3c8b49c
81,770
py
Python
src/amd/compiler/aco_opcodes.py
pundiramit/external-mesa3d
c342483c57fa185ff67bd5ab7d82cb884e42684e
[ "MIT" ]
null
null
null
src/amd/compiler/aco_opcodes.py
pundiramit/external-mesa3d
c342483c57fa185ff67bd5ab7d82cb884e42684e
[ "MIT" ]
null
null
null
src/amd/compiler/aco_opcodes.py
pundiramit/external-mesa3d
c342483c57fa185ff67bd5ab7d82cb884e42684e
[ "MIT" ]
null
null
null
# # Copyright (c) 2018 Valve Corporation # # 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 (including the next # paragraph) 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. # # Authors: # Daniel Schuermann (daniel.schuermann@campus.tu-berlin.de) # Class that represents all the information we have about the opcode # NOTE: this must be kept in sync with aco_op_info import sys from enum import Enum class Format(Enum): PSEUDO = 0 SOP1 = 1 SOP2 = 2 SOPK = 3 SOPP = 4 SOPC = 5 SMEM = 6 DS = 8 MTBUF = 9 MUBUF = 10 MIMG = 11 EXP = 12 FLAT = 13 GLOBAL = 14 SCRATCH = 15 PSEUDO_BRANCH = 16 PSEUDO_BARRIER = 17 PSEUDO_REDUCTION = 18 VOP3P = 19 VOP1 = 1 << 8 VOP2 = 1 << 9 VOPC = 1 << 10 VOP3 = 1 << 11 VINTRP = 1 << 12 DPP = 1 << 13 SDWA = 1 << 14 def get_builder_fields(self): if self == Format.SOPK: return [('uint16_t', 'imm', None)] elif self == Format.SOPP: return [('uint32_t', 'block', '-1'), ('uint32_t', 'imm', '0')] elif self == Format.SMEM: return [('memory_sync_info', 'sync', 'memory_sync_info()'), ('bool', 'glc', 'false'), ('bool', 'dlc', 'false'), ('bool', 'nv', 'false')] elif self == Format.DS: return [('int16_t', 'offset0', '0'), ('int8_t', 'offset1', '0'), ('bool', 'gds', 'false')] elif self == Format.MTBUF: return [('unsigned', 'dfmt', None), ('unsigned', 'nfmt', None), ('unsigned', 'offset', None), ('bool', 'offen', None), ('bool', 'idxen', 'false'), ('bool', 'disable_wqm', 'false'), ('bool', 'glc', 'false'), ('bool', 'dlc', 'false'), ('bool', 'slc', 'false'), ('bool', 'tfe', 'false')] elif self == Format.MUBUF: return [('unsigned', 'offset', None), ('bool', 'offen', None), ('bool', 'swizzled', 'false'), ('bool', 'idxen', 'false'), ('bool', 'addr64', 'false'), ('bool', 'disable_wqm', 'false'), ('bool', 'glc', 'false'), ('bool', 'dlc', 'false'), ('bool', 'slc', 'false'), ('bool', 'tfe', 'false'), ('bool', 'lds', 'false')] elif self == Format.MIMG: return [('unsigned', 'dmask', '0xF'), ('bool', 'da', 'false'), ('bool', 'unrm', 'true'), ('bool', 'disable_wqm', 'false'), ('bool', 'glc', 'false'), ('bool', 'dlc', 'false'), ('bool', 'slc', 'false'), ('bool', 'tfe', 'false'), ('bool', 'lwe', 'false'), ('bool', 'r128_a16', 'false', 'r128'), ('bool', 'd16', 'false')] return [('unsigned', 'attribute', None), ('unsigned', 'component', None)] elif self == Format.EXP: return [('unsigned', 'enabled_mask', None), ('unsigned', 'dest', None), ('bool', 'compr', 'false', 'compressed'), ('bool', 'done', 'false'), ('bool', 'vm', 'false', 'valid_mask')] elif self == Format.PSEUDO_BRANCH: return [('uint32_t', 'target0', '0', 'target[0]'), ('uint32_t', 'target1', '0', 'target[1]')] elif self == Format.PSEUDO_REDUCTION: return [('ReduceOp', 'op', None, 'reduce_op'), ('unsigned', 'cluster_size', '0')] elif self == Format.PSEUDO_BARRIER: return [('memory_sync_info', 'sync', None), ('sync_scope', 'exec_scope', 'scope_invocation')] elif self == Format.VINTRP: return [('unsigned', 'attribute', None), ('unsigned', 'component', None)] elif self == Format.DPP: return [('uint16_t', 'dpp_ctrl', None), ('uint8_t', 'row_mask', '0xF'), ('uint8_t', 'bank_mask', '0xF'), ('bool', 'bound_ctrl', 'true')] elif self == Format.VOP3P: return [('uint8_t', 'opsel_lo', None), ('uint8_t', 'opsel_hi', None)] elif self in [Format.FLAT, Format.GLOBAL, Format.SCRATCH]: return [('uint16_t', 'offset', 0), ('memory_sync_info', 'sync', 'memory_sync_info()'), ('bool', 'glc', 'false'), ('bool', 'slc', 'false'), ('bool', 'lds', 'false'), ('bool', 'nv', 'false')] else: return [] def get_builder_field_names(self): return [f[1] for f in self.get_builder_fields()] def get_builder_field_dests(self): return [(f[3] if len(f) >= 4 else f[1]) for f in self.get_builder_fields()] def get_builder_field_decls(self): return [('%s %s=%s' % (f[0], f[1], f[2]) if f[2] != None else '%s %s' % (f[0], f[1])) for f in self.get_builder_fields()] def get_builder_initialization(self, num_operands): res = '' if self == Format.SDWA: for i in range(min(num_operands, 2)): res += 'instr->sel[{0}] = op{0}.op.bytes() == 2 ? sdwa_uword : (op{0}.op.bytes() == 1 ? sdwa_ubyte : sdwa_udword);\n'.format(i) res += 'instr->dst_sel = def0.bytes() == 2 ? sdwa_uword : (def0.bytes() == 1 ? sdwa_ubyte : sdwa_udword);\n' res += 'instr->dst_preserve = true;' return res class Opcode(object): """Class that represents all the information we have about the opcode NOTE: this must be kept in sync with aco_op_info """ def __init__(self, name, opcode_gfx7, opcode_gfx9, opcode_gfx10, format, input_mod, output_mod, is_atomic): """Parameters: - name is the name of the opcode (prepend nir_op_ for the enum name) - all types are strings that get nir_type_ prepended to them - input_types is a list of types - algebraic_properties is a space-seperated string, where nir_op_is_ is prepended before each entry - const_expr is an expression or series of statements that computes the constant value of the opcode given the constant values of its inputs. """ assert isinstance(name, str) assert isinstance(opcode_gfx7, int) assert isinstance(opcode_gfx9, int) assert isinstance(opcode_gfx10, int) assert isinstance(format, Format) assert isinstance(input_mod, bool) assert isinstance(output_mod, bool) self.name = name self.opcode_gfx7 = opcode_gfx7 self.opcode_gfx9 = opcode_gfx9 self.opcode_gfx10 = opcode_gfx10 self.input_mod = "1" if input_mod else "0" self.output_mod = "1" if output_mod else "0" self.is_atomic = "1" if is_atomic else "0" self.format = format parts = name.replace('_e64', '').rsplit('_', 2) op_dtype = parts[-1] def_dtype = parts[-2] if len(parts) > 1 else parts[-1] def_dtype_sizes = {'{}{}'.format(prefix, size) : size for prefix in 'biuf' for size in [64, 32, 24, 16]} op_dtype_sizes = {k:v for k, v in def_dtype_sizes.items()} # inline constants are 32-bit for 16-bit integer/typeless instructions: https://reviews.llvm.org/D81841 op_dtype_sizes['b16'] = 32 op_dtype_sizes['i16'] = 32 op_dtype_sizes['u16'] = 32 # If we can't tell the definition size and the operand size, default to # 32. Some opcodes can have a larger definition size, but # get_subdword_definition_info() handles that. self.operand_size = op_dtype_sizes.get(op_dtype, 32) self.definition_size = def_dtype_sizes.get(def_dtype, self.operand_size) # exceptions for operands: if 'sad_' in name: self.operand_size = 0 elif name in ['v_mad_u64_u32', 'v_mad_i64_i32']: self.operand_size = 0 elif self.operand_size == 24: self.operand_size = 32 elif op_dtype == 'u8' or op_dtype == 'i8': self.operand_size = 32 elif name in ['v_cvt_f32_ubyte0', 'v_cvt_f32_ubyte1', 'v_cvt_f32_ubyte2', 'v_cvt_f32_ubyte3']: self.operand_size = 32 # exceptions for definitions: if 'sad_' in name: self.definition_size = 0 elif '_pk' in name: self.definition_size = 32 # global dictionary of opcodes opcodes = {} def opcode(name, opcode_gfx7 = -1, opcode_gfx9 = -1, opcode_gfx10 = -1, format = Format.PSEUDO, input_mod = False, output_mod = False, is_atomic = False): assert name not in opcodes opcodes[name] = Opcode(name, opcode_gfx7, opcode_gfx9, opcode_gfx10, format, input_mod, output_mod, is_atomic) opcode("exp", 0, 0, 0, format = Format.EXP) opcode("p_parallelcopy") opcode("p_startpgm") opcode("p_phi") opcode("p_linear_phi") opcode("p_as_uniform") opcode("p_unit_test") opcode("p_create_vector") opcode("p_extract_vector") opcode("p_split_vector") # start/end the parts where we can use exec based instructions # implicitly opcode("p_logical_start") opcode("p_logical_end") # e.g. subgroupMin() in SPIR-V opcode("p_reduce", format=Format.PSEUDO_REDUCTION) # e.g. subgroupInclusiveMin() opcode("p_inclusive_scan", format=Format.PSEUDO_REDUCTION) # e.g. subgroupExclusiveMin() opcode("p_exclusive_scan", format=Format.PSEUDO_REDUCTION) opcode("p_branch", format=Format.PSEUDO_BRANCH) opcode("p_cbranch", format=Format.PSEUDO_BRANCH) opcode("p_cbranch_z", format=Format.PSEUDO_BRANCH) opcode("p_cbranch_nz", format=Format.PSEUDO_BRANCH) opcode("p_barrier", format=Format.PSEUDO_BARRIER) opcode("p_spill") opcode("p_reload") # start/end linear vgprs opcode("p_start_linear_vgpr") opcode("p_end_linear_vgpr") opcode("p_wqm") opcode("p_discard_if") opcode("p_demote_to_helper") opcode("p_is_helper") opcode("p_exit_early_if") # simulates proper bpermute behavior when it's unsupported, eg. GFX10 wave64 opcode("p_bpermute") # SOP2 instructions: 2 scalar inputs, 1 scalar output (+optional scc) SOP2 = { # GFX6, GFX7, GFX8, GFX9, GFX10, name (0x00, 0x00, 0x00, 0x00, 0x00, "s_add_u32"), (0x01, 0x01, 0x01, 0x01, 0x01, "s_sub_u32"), (0x02, 0x02, 0x02, 0x02, 0x02, "s_add_i32"), (0x03, 0x03, 0x03, 0x03, 0x03, "s_sub_i32"), (0x04, 0x04, 0x04, 0x04, 0x04, "s_addc_u32"), (0x05, 0x05, 0x05, 0x05, 0x05, "s_subb_u32"), (0x06, 0x06, 0x06, 0x06, 0x06, "s_min_i32"), (0x07, 0x07, 0x07, 0x07, 0x07, "s_min_u32"), (0x08, 0x08, 0x08, 0x08, 0x08, "s_max_i32"), (0x09, 0x09, 0x09, 0x09, 0x09, "s_max_u32"), (0x0a, 0x0a, 0x0a, 0x0a, 0x0a, "s_cselect_b32"), (0x0b, 0x0b, 0x0b, 0x0b, 0x0b, "s_cselect_b64"), (0x0e, 0x0e, 0x0c, 0x0c, 0x0e, "s_and_b32"), (0x0f, 0x0f, 0x0d, 0x0d, 0x0f, "s_and_b64"), (0x10, 0x10, 0x0e, 0x0e, 0x10, "s_or_b32"), (0x11, 0x11, 0x0f, 0x0f, 0x11, "s_or_b64"), (0x12, 0x12, 0x10, 0x10, 0x12, "s_xor_b32"), (0x13, 0x13, 0x11, 0x11, 0x13, "s_xor_b64"), (0x14, 0x14, 0x12, 0x12, 0x14, "s_andn2_b32"), (0x15, 0x15, 0x13, 0x13, 0x15, "s_andn2_b64"), (0x16, 0x16, 0x14, 0x14, 0x16, "s_orn2_b32"), (0x17, 0x17, 0x15, 0x15, 0x17, "s_orn2_b64"), (0x18, 0x18, 0x16, 0x16, 0x18, "s_nand_b32"), (0x19, 0x19, 0x17, 0x17, 0x19, "s_nand_b64"), (0x1a, 0x1a, 0x18, 0x18, 0x1a, "s_nor_b32"), (0x1b, 0x1b, 0x19, 0x19, 0x1b, "s_nor_b64"), (0x1c, 0x1c, 0x1a, 0x1a, 0x1c, "s_xnor_b32"), (0x1d, 0x1d, 0x1b, 0x1b, 0x1d, "s_xnor_b64"), (0x1e, 0x1e, 0x1c, 0x1c, 0x1e, "s_lshl_b32"), (0x1f, 0x1f, 0x1d, 0x1d, 0x1f, "s_lshl_b64"), (0x20, 0x20, 0x1e, 0x1e, 0x20, "s_lshr_b32"), (0x21, 0x21, 0x1f, 0x1f, 0x21, "s_lshr_b64"), (0x22, 0x22, 0x20, 0x20, 0x22, "s_ashr_i32"), (0x23, 0x23, 0x21, 0x21, 0x23, "s_ashr_i64"), (0x24, 0x24, 0x22, 0x22, 0x24, "s_bfm_b32"), (0x25, 0x25, 0x23, 0x23, 0x25, "s_bfm_b64"), (0x26, 0x26, 0x24, 0x24, 0x26, "s_mul_i32"), (0x27, 0x27, 0x25, 0x25, 0x27, "s_bfe_u32"), (0x28, 0x28, 0x26, 0x26, 0x28, "s_bfe_i32"), (0x29, 0x29, 0x27, 0x27, 0x29, "s_bfe_u64"), (0x2a, 0x2a, 0x28, 0x28, 0x2a, "s_bfe_i64"), (0x2b, 0x2b, 0x29, 0x29, -1, "s_cbranch_g_fork"), (0x2c, 0x2c, 0x2a, 0x2a, 0x2c, "s_absdiff_i32"), ( -1, -1, 0x2b, 0x2b, -1, "s_rfe_restore_b64"), ( -1, -1, -1, 0x2e, 0x2e, "s_lshl1_add_u32"), ( -1, -1, -1, 0x2f, 0x2f, "s_lshl2_add_u32"), ( -1, -1, -1, 0x30, 0x30, "s_lshl3_add_u32"), ( -1, -1, -1, 0x31, 0x31, "s_lshl4_add_u32"), ( -1, -1, -1, 0x32, 0x32, "s_pack_ll_b32_b16"), ( -1, -1, -1, 0x33, 0x33, "s_pack_lh_b32_b16"), ( -1, -1, -1, 0x34, 0x34, "s_pack_hh_b32_b16"), ( -1, -1, -1, 0x2c, 0x35, "s_mul_hi_u32"), ( -1, -1, -1, 0x2d, 0x36, "s_mul_hi_i32"), } for (gfx6, gfx7, gfx8, gfx9, gfx10, name) in SOP2: opcode(name, gfx7, gfx9, gfx10, Format.SOP2) # SOPK instructions: 0 input (+ imm), 1 output + optional scc SOPK = { # GFX6, GFX7, GFX8, GFX9, GFX10, name (0x00, 0x00, 0x00, 0x00, 0x00, "s_movk_i32"), ( -1, -1, -1, -1, 0x01, "s_version"), # GFX10+ (0x02, 0x02, 0x01, 0x01, 0x02, "s_cmovk_i32"), # GFX8_GFX9 (0x03, 0x03, 0x02, 0x02, 0x03, "s_cmpk_eq_i32"), (0x04, 0x04, 0x03, 0x03, 0x04, "s_cmpk_lg_i32"), (0x05, 0x05, 0x04, 0x04, 0x05, "s_cmpk_gt_i32"), (0x06, 0x06, 0x05, 0x05, 0x06, "s_cmpk_ge_i32"), (0x07, 0x07, 0x06, 0x06, 0x07, "s_cmpk_lt_i32"), (0x08, 0x08, 0x07, 0x07, 0x08, "s_cmpk_le_i32"), (0x09, 0x09, 0x08, 0x08, 0x09, "s_cmpk_eq_u32"), (0x0a, 0x0a, 0x09, 0x09, 0x0a, "s_cmpk_lg_u32"), (0x0b, 0x0b, 0x0a, 0x0a, 0x0b, "s_cmpk_gt_u32"), (0x0c, 0x0c, 0x0b, 0x0b, 0x0c, "s_cmpk_ge_u32"), (0x0d, 0x0d, 0x0c, 0x0c, 0x0d, "s_cmpk_lt_u32"), (0x0e, 0x0e, 0x0d, 0x0d, 0x0e, "s_cmpk_le_u32"), (0x0f, 0x0f, 0x0e, 0x0e, 0x0f, "s_addk_i32"), (0x10, 0x10, 0x0f, 0x0f, 0x10, "s_mulk_i32"), (0x11, 0x11, 0x10, 0x10, -1, "s_cbranch_i_fork"), (0x12, 0x12, 0x11, 0x11, 0x12, "s_getreg_b32"), (0x13, 0x13, 0x12, 0x12, 0x13, "s_setreg_b32"), (0x15, 0x15, 0x14, 0x14, 0x15, "s_setreg_imm32_b32"), # requires 32bit literal ( -1, -1, 0x15, 0x15, 0x16, "s_call_b64"), ( -1, -1, -1, -1, 0x17, "s_waitcnt_vscnt"), ( -1, -1, -1, -1, 0x18, "s_waitcnt_vmcnt"), ( -1, -1, -1, -1, 0x19, "s_waitcnt_expcnt"), ( -1, -1, -1, -1, 0x1a, "s_waitcnt_lgkmcnt"), ( -1, -1, -1, -1, 0x1b, "s_subvector_loop_begin"), ( -1, -1, -1, -1, 0x1c, "s_subvector_loop_end"), } for (gfx6, gfx7, gfx8, gfx9, gfx10, name) in SOPK: opcode(name, gfx7, gfx9, gfx10, Format.SOPK) # SOP1 instructions: 1 input, 1 output (+optional SCC) SOP1 = { # GFX6, GFX7, GFX8, GFX9, GFX10, name (0x03, 0x03, 0x00, 0x00, 0x03, "s_mov_b32"), (0x04, 0x04, 0x01, 0x01, 0x04, "s_mov_b64"), (0x05, 0x05, 0x02, 0x02, 0x05, "s_cmov_b32"), (0x06, 0x06, 0x03, 0x03, 0x06, "s_cmov_b64"), (0x07, 0x07, 0x04, 0x04, 0x07, "s_not_b32"), (0x08, 0x08, 0x05, 0x05, 0x08, "s_not_b64"), (0x09, 0x09, 0x06, 0x06, 0x09, "s_wqm_b32"), (0x0a, 0x0a, 0x07, 0x07, 0x0a, "s_wqm_b64"), (0x0b, 0x0b, 0x08, 0x08, 0x0b, "s_brev_b32"), (0x0c, 0x0c, 0x09, 0x09, 0x0c, "s_brev_b64"), (0x0d, 0x0d, 0x0a, 0x0a, 0x0d, "s_bcnt0_i32_b32"), (0x0e, 0x0e, 0x0b, 0x0b, 0x0e, "s_bcnt0_i32_b64"), (0x0f, 0x0f, 0x0c, 0x0c, 0x0f, "s_bcnt1_i32_b32"), (0x10, 0x10, 0x0d, 0x0d, 0x10, "s_bcnt1_i32_b64"), (0x11, 0x11, 0x0e, 0x0e, 0x11, "s_ff0_i32_b32"), (0x12, 0x12, 0x0f, 0x0f, 0x12, "s_ff0_i32_b64"), (0x13, 0x13, 0x10, 0x10, 0x13, "s_ff1_i32_b32"), (0x14, 0x14, 0x11, 0x11, 0x14, "s_ff1_i32_b64"), (0x15, 0x15, 0x12, 0x12, 0x15, "s_flbit_i32_b32"), (0x16, 0x16, 0x13, 0x13, 0x16, "s_flbit_i32_b64"), (0x17, 0x17, 0x14, 0x14, 0x17, "s_flbit_i32"), (0x18, 0x18, 0x15, 0x15, 0x18, "s_flbit_i32_i64"), (0x19, 0x19, 0x16, 0x16, 0x19, "s_sext_i32_i8"), (0x1a, 0x1a, 0x17, 0x17, 0x1a, "s_sext_i32_i16"), (0x1b, 0x1b, 0x18, 0x18, 0x1b, "s_bitset0_b32"), (0x1c, 0x1c, 0x19, 0x19, 0x1c, "s_bitset0_b64"), (0x1d, 0x1d, 0x1a, 0x1a, 0x1d, "s_bitset1_b32"), (0x1e, 0x1e, 0x1b, 0x1b, 0x1e, "s_bitset1_b64"), (0x1f, 0x1f, 0x1c, 0x1c, 0x1f, "s_getpc_b64"), (0x20, 0x20, 0x1d, 0x1d, 0x20, "s_setpc_b64"), (0x21, 0x21, 0x1e, 0x1e, 0x21, "s_swappc_b64"), (0x22, 0x22, 0x1f, 0x1f, 0x22, "s_rfe_b64"), (0x24, 0x24, 0x20, 0x20, 0x24, "s_and_saveexec_b64"), (0x25, 0x25, 0x21, 0x21, 0x25, "s_or_saveexec_b64"), (0x26, 0x26, 0x22, 0x22, 0x26, "s_xor_saveexec_b64"), (0x27, 0x27, 0x23, 0x23, 0x27, "s_andn2_saveexec_b64"), (0x28, 0x28, 0x24, 0x24, 0x28, "s_orn2_saveexec_b64"), (0x29, 0x29, 0x25, 0x25, 0x29, "s_nand_saveexec_b64"), (0x2a, 0x2a, 0x26, 0x26, 0x2a, "s_nor_saveexec_b64"), (0x2b, 0x2b, 0x27, 0x27, 0x2b, "s_xnor_saveexec_b64"), (0x2c, 0x2c, 0x28, 0x28, 0x2c, "s_quadmask_b32"), (0x2d, 0x2d, 0x29, 0x29, 0x2d, "s_quadmask_b64"), (0x2e, 0x2e, 0x2a, 0x2a, 0x2e, "s_movrels_b32"), (0x2f, 0x2f, 0x2b, 0x2b, 0x2f, "s_movrels_b64"), (0x30, 0x30, 0x2c, 0x2c, 0x30, "s_movreld_b32"), (0x31, 0x31, 0x2d, 0x2d, 0x31, "s_movreld_b64"), (0x32, 0x32, 0x2e, 0x2e, -1, "s_cbranch_join"), (0x34, 0x34, 0x30, 0x30, 0x34, "s_abs_i32"), (0x35, 0x35, -1, -1, 0x35, "s_mov_fed_b32"), ( -1, -1, 0x32, 0x32, -1, "s_set_gpr_idx_idx"), ( -1, -1, -1, 0x33, 0x37, "s_andn1_saveexec_b64"), ( -1, -1, -1, 0x34, 0x38, "s_orn1_saveexec_b64"), ( -1, -1, -1, 0x35, 0x39, "s_andn1_wrexec_b64"), ( -1, -1, -1, 0x36, 0x3a, "s_andn2_wrexec_b64"), ( -1, -1, -1, 0x37, 0x3b, "s_bitreplicate_b64_b32"), ( -1, -1, -1, -1, 0x3c, "s_and_saveexec_b32"), ( -1, -1, -1, -1, 0x3d, "s_or_saveexec_b32"), ( -1, -1, -1, -1, 0x3e, "s_xor_saveexec_b32"), ( -1, -1, -1, -1, 0x3f, "s_andn2_saveexec_b32"), ( -1, -1, -1, -1, 0x40, "s_orn2_saveexec_b32"), ( -1, -1, -1, -1, 0x41, "s_nand_saveexec_b32"), ( -1, -1, -1, -1, 0x42, "s_nor_saveexec_b32"), ( -1, -1, -1, -1, 0x43, "s_xnor_saveexec_b32"), ( -1, -1, -1, -1, 0x44, "s_andn1_saveexec_b32"), ( -1, -1, -1, -1, 0x45, "s_orn1_saveexec_b32"), ( -1, -1, -1, -1, 0x46, "s_andn1_wrexec_b32"), ( -1, -1, -1, -1, 0x47, "s_andn2_wrexec_b32"), ( -1, -1, -1, -1, 0x49, "s_movrelsd_2_b32"), # actually a pseudo-instruction. it's lowered to SALU during assembly though, so it's useful to identify it as a SOP1. ( -1, -1, -1, -1, -1, "p_constaddr"), } for (gfx6, gfx7, gfx8, gfx9, gfx10, name) in SOP1: opcode(name, gfx7, gfx9, gfx10, Format.SOP1) # SOPC instructions: 2 inputs and 0 outputs (+SCC) SOPC = { # GFX6, GFX7, GFX8, GFX9, GFX10, name (0x00, 0x00, 0x00, 0x00, 0x00, "s_cmp_eq_i32"), (0x01, 0x01, 0x01, 0x01, 0x01, "s_cmp_lg_i32"), (0x02, 0x02, 0x02, 0x02, 0x02, "s_cmp_gt_i32"), (0x03, 0x03, 0x03, 0x03, 0x03, "s_cmp_ge_i32"), (0x04, 0x04, 0x04, 0x04, 0x04, "s_cmp_lt_i32"), (0x05, 0x05, 0x05, 0x05, 0x05, "s_cmp_le_i32"), (0x06, 0x06, 0x06, 0x06, 0x06, "s_cmp_eq_u32"), (0x07, 0x07, 0x07, 0x07, 0x07, "s_cmp_lg_u32"), (0x08, 0x08, 0x08, 0x08, 0x08, "s_cmp_gt_u32"), (0x09, 0x09, 0x09, 0x09, 0x09, "s_cmp_ge_u32"), (0x0a, 0x0a, 0x0a, 0x0a, 0x0a, "s_cmp_lt_u32"), (0x0b, 0x0b, 0x0b, 0x0b, 0x0b, "s_cmp_le_u32"), (0x0c, 0x0c, 0x0c, 0x0c, 0x0c, "s_bitcmp0_b32"), (0x0d, 0x0d, 0x0d, 0x0d, 0x0d, "s_bitcmp1_b32"), (0x0e, 0x0e, 0x0e, 0x0e, 0x0e, "s_bitcmp0_b64"), (0x0f, 0x0f, 0x0f, 0x0f, 0x0f, "s_bitcmp1_b64"), (0x10, 0x10, 0x10, 0x10, -1, "s_setvskip"), ( -1, -1, 0x11, 0x11, -1, "s_set_gpr_idx_on"), ( -1, -1, 0x12, 0x12, 0x12, "s_cmp_eq_u64"), ( -1, -1, 0x13, 0x13, 0x13, "s_cmp_lg_u64"), } for (gfx6, gfx7, gfx8, gfx9, gfx10, name) in SOPC: opcode(name, gfx7, gfx9, gfx10, Format.SOPC) # SOPP instructions: 0 inputs (+optional scc/vcc), 0 outputs SOPP = { # GFX6, GFX7, GFX8, GFX9, GFX10, name (0x00, 0x00, 0x00, 0x00, 0x00, "s_nop"), (0x01, 0x01, 0x01, 0x01, 0x01, "s_endpgm"), (0x02, 0x02, 0x02, 0x02, 0x02, "s_branch"), ( -1, -1, 0x03, 0x03, 0x03, "s_wakeup"), (0x04, 0x04, 0x04, 0x04, 0x04, "s_cbranch_scc0"), (0x05, 0x05, 0x05, 0x05, 0x05, "s_cbranch_scc1"), (0x06, 0x06, 0x06, 0x06, 0x06, "s_cbranch_vccz"), (0x07, 0x07, 0x07, 0x07, 0x07, "s_cbranch_vccnz"), (0x08, 0x08, 0x08, 0x08, 0x08, "s_cbranch_execz"), (0x09, 0x09, 0x09, 0x09, 0x09, "s_cbranch_execnz"), (0x0a, 0x0a, 0x0a, 0x0a, 0x0a, "s_barrier"), ( -1, 0x0b, 0x0b, 0x0b, 0x0b, "s_setkill"), (0x0c, 0x0c, 0x0c, 0x0c, 0x0c, "s_waitcnt"), (0x0d, 0x0d, 0x0d, 0x0d, 0x0d, "s_sethalt"), (0x0e, 0x0e, 0x0e, 0x0e, 0x0e, "s_sleep"), (0x0f, 0x0f, 0x0f, 0x0f, 0x0f, "s_setprio"), (0x10, 0x10, 0x10, 0x10, 0x10, "s_sendmsg"), (0x11, 0x11, 0x11, 0x11, 0x11, "s_sendmsghalt"), (0x12, 0x12, 0x12, 0x12, 0x12, "s_trap"), (0x13, 0x13, 0x13, 0x13, 0x13, "s_icache_inv"), (0x14, 0x14, 0x14, 0x14, 0x14, "s_incperflevel"), (0x15, 0x15, 0x15, 0x15, 0x15, "s_decperflevel"), (0x16, 0x16, 0x16, 0x16, 0x16, "s_ttracedata"), ( -1, 0x17, 0x17, 0x17, 0x17, "s_cbranch_cdbgsys"), ( -1, 0x18, 0x18, 0x18, 0x18, "s_cbranch_cdbguser"), ( -1, 0x19, 0x19, 0x19, 0x19, "s_cbranch_cdbgsys_or_user"), ( -1, 0x1a, 0x1a, 0x1a, 0x1a, "s_cbranch_cdbgsys_and_user"), ( -1, -1, 0x1b, 0x1b, 0x1b, "s_endpgm_saved"), ( -1, -1, 0x1c, 0x1c, -1, "s_set_gpr_idx_off"), ( -1, -1, 0x1d, 0x1d, -1, "s_set_gpr_idx_mode"), ( -1, -1, -1, 0x1e, 0x1e, "s_endpgm_ordered_ps_done"), ( -1, -1, -1, -1, 0x1f, "s_code_end"), ( -1, -1, -1, -1, 0x20, "s_inst_prefetch"), ( -1, -1, -1, -1, 0x21, "s_clause"), ( -1, -1, -1, -1, 0x22, "s_wait_idle"), ( -1, -1, -1, -1, 0x23, "s_waitcnt_depctr"), ( -1, -1, -1, -1, 0x24, "s_round_mode"), ( -1, -1, -1, -1, 0x25, "s_denorm_mode"), ( -1, -1, -1, -1, 0x26, "s_ttracedata_imm"), } for (gfx6, gfx7, gfx8, gfx9, gfx10, name) in SOPP: opcode(name, gfx7, gfx9, gfx10, Format.SOPP) # SMEM instructions: sbase input (2 sgpr), potentially 2 offset inputs, 1 sdata input/output # Unlike GFX10, GFX10.3 does not have SMEM store, atomic or scratch instructions SMEM = { # GFX6, GFX7, GFX8, GFX9, GFX10, name (0x00, 0x00, 0x00, 0x00, 0x00, "s_load_dword"), (0x01, 0x01, 0x01, 0x01, 0x01, "s_load_dwordx2"), (0x02, 0x02, 0x02, 0x02, 0x02, "s_load_dwordx4"), (0x03, 0x03, 0x03, 0x03, 0x03, "s_load_dwordx8"), (0x04, 0x04, 0x04, 0x04, 0x04, "s_load_dwordx16"), ( -1, -1, -1, 0x05, 0x05, "s_scratch_load_dword"), ( -1, -1, -1, 0x06, 0x06, "s_scratch_load_dwordx2"), ( -1, -1, -1, 0x07, 0x07, "s_scratch_load_dwordx4"), (0x08, 0x08, 0x08, 0x08, 0x08, "s_buffer_load_dword"), (0x09, 0x09, 0x09, 0x09, 0x09, "s_buffer_load_dwordx2"), (0x0a, 0x0a, 0x0a, 0x0a, 0x0a, "s_buffer_load_dwordx4"), (0x0b, 0x0b, 0x0b, 0x0b, 0x0b, "s_buffer_load_dwordx8"), (0x0c, 0x0c, 0x0c, 0x0c, 0x0c, "s_buffer_load_dwordx16"), ( -1, -1, 0x10, 0x10, 0x10, "s_store_dword"), ( -1, -1, 0x11, 0x11, 0x11, "s_store_dwordx2"), ( -1, -1, 0x12, 0x12, 0x12, "s_store_dwordx4"), ( -1, -1, -1, 0x15, 0x15, "s_scratch_store_dword"), ( -1, -1, -1, 0x16, 0x16, "s_scratch_store_dwordx2"), ( -1, -1, -1, 0x17, 0x17, "s_scratch_store_dwordx4"), ( -1, -1, 0x18, 0x18, 0x18, "s_buffer_store_dword"), ( -1, -1, 0x19, 0x19, 0x19, "s_buffer_store_dwordx2"), ( -1, -1, 0x1a, 0x1a, 0x1a, "s_buffer_store_dwordx4"), ( -1, -1, 0x1f, 0x1f, 0x1f, "s_gl1_inv"), (0x1f, 0x1f, 0x20, 0x20, 0x20, "s_dcache_inv"), ( -1, -1, 0x21, 0x21, 0x21, "s_dcache_wb"), ( -1, 0x1d, 0x22, 0x22, -1, "s_dcache_inv_vol"), ( -1, -1, 0x23, 0x23, -1, "s_dcache_wb_vol"), (0x1e, 0x1e, 0x24, 0x24, 0x24, "s_memtime"), #GFX6-GFX10 ( -1, -1, 0x25, 0x25, 0x25, "s_memrealtime"), ( -1, -1, 0x26, 0x26, 0x26, "s_atc_probe"), ( -1, -1, 0x27, 0x27, 0x27, "s_atc_probe_buffer"), ( -1, -1, -1, 0x28, 0x28, "s_dcache_discard"), ( -1, -1, -1, 0x29, 0x29, "s_dcache_discard_x2"), ( -1, -1, -1, -1, 0x2a, "s_get_waveid_in_workgroup"), ( -1, -1, -1, 0x40, 0x40, "s_buffer_atomic_swap"), ( -1, -1, -1, 0x41, 0x41, "s_buffer_atomic_cmpswap"), ( -1, -1, -1, 0x42, 0x42, "s_buffer_atomic_add"), ( -1, -1, -1, 0x43, 0x43, "s_buffer_atomic_sub"), ( -1, -1, -1, 0x44, 0x44, "s_buffer_atomic_smin"), ( -1, -1, -1, 0x45, 0x45, "s_buffer_atomic_umin"), ( -1, -1, -1, 0x46, 0x46, "s_buffer_atomic_smax"), ( -1, -1, -1, 0x47, 0x47, "s_buffer_atomic_umax"), ( -1, -1, -1, 0x48, 0x48, "s_buffer_atomic_and"), ( -1, -1, -1, 0x49, 0x49, "s_buffer_atomic_or"), ( -1, -1, -1, 0x4a, 0x4a, "s_buffer_atomic_xor"), ( -1, -1, -1, 0x4b, 0x4b, "s_buffer_atomic_inc"), ( -1, -1, -1, 0x4c, 0x4c, "s_buffer_atomic_dec"), ( -1, -1, -1, 0x60, 0x60, "s_buffer_atomic_swap_x2"), ( -1, -1, -1, 0x61, 0x61, "s_buffer_atomic_cmpswap_x2"), ( -1, -1, -1, 0x62, 0x62, "s_buffer_atomic_add_x2"), ( -1, -1, -1, 0x63, 0x63, "s_buffer_atomic_sub_x2"), ( -1, -1, -1, 0x64, 0x64, "s_buffer_atomic_smin_x2"), ( -1, -1, -1, 0x65, 0x65, "s_buffer_atomic_umin_x2"), ( -1, -1, -1, 0x66, 0x66, "s_buffer_atomic_smax_x2"), ( -1, -1, -1, 0x67, 0x67, "s_buffer_atomic_umax_x2"), ( -1, -1, -1, 0x68, 0x68, "s_buffer_atomic_and_x2"), ( -1, -1, -1, 0x69, 0x69, "s_buffer_atomic_or_x2"), ( -1, -1, -1, 0x6a, 0x6a, "s_buffer_atomic_xor_x2"), ( -1, -1, -1, 0x6b, 0x6b, "s_buffer_atomic_inc_x2"), ( -1, -1, -1, 0x6c, 0x6c, "s_buffer_atomic_dec_x2"), ( -1, -1, -1, 0x80, 0x80, "s_atomic_swap"), ( -1, -1, -1, 0x81, 0x81, "s_atomic_cmpswap"), ( -1, -1, -1, 0x82, 0x82, "s_atomic_add"), ( -1, -1, -1, 0x83, 0x83, "s_atomic_sub"), ( -1, -1, -1, 0x84, 0x84, "s_atomic_smin"), ( -1, -1, -1, 0x85, 0x85, "s_atomic_umin"), ( -1, -1, -1, 0x86, 0x86, "s_atomic_smax"), ( -1, -1, -1, 0x87, 0x87, "s_atomic_umax"), ( -1, -1, -1, 0x88, 0x88, "s_atomic_and"), ( -1, -1, -1, 0x89, 0x89, "s_atomic_or"), ( -1, -1, -1, 0x8a, 0x8a, "s_atomic_xor"), ( -1, -1, -1, 0x8b, 0x8b, "s_atomic_inc"), ( -1, -1, -1, 0x8c, 0x8c, "s_atomic_dec"), ( -1, -1, -1, 0xa0, 0xa0, "s_atomic_swap_x2"), ( -1, -1, -1, 0xa1, 0xa1, "s_atomic_cmpswap_x2"), ( -1, -1, -1, 0xa2, 0xa2, "s_atomic_add_x2"), ( -1, -1, -1, 0xa3, 0xa3, "s_atomic_sub_x2"), ( -1, -1, -1, 0xa4, 0xa4, "s_atomic_smin_x2"), ( -1, -1, -1, 0xa5, 0xa5, "s_atomic_umin_x2"), ( -1, -1, -1, 0xa6, 0xa6, "s_atomic_smax_x2"), ( -1, -1, -1, 0xa7, 0xa7, "s_atomic_umax_x2"), ( -1, -1, -1, 0xa8, 0xa8, "s_atomic_and_x2"), ( -1, -1, -1, 0xa9, 0xa9, "s_atomic_or_x2"), ( -1, -1, -1, 0xaa, 0xaa, "s_atomic_xor_x2"), ( -1, -1, -1, 0xab, 0xab, "s_atomic_inc_x2"), ( -1, -1, -1, 0xac, 0xac, "s_atomic_dec_x2"), } for (gfx6, gfx7, gfx8, gfx9, gfx10, name) in SMEM: opcode(name, gfx7, gfx9, gfx10, Format.SMEM, is_atomic = "atomic" in name) # VOP2 instructions: 2 inputs, 1 output (+ optional vcc) # TODO: misses some GFX6_7 opcodes which were shifted to VOP3 in GFX8 VOP2 = { # GFX6, GFX7, GFX8, GFX9, GFX10, name, input/output modifiers (0x01, 0x01, -1, -1, -1, "v_readlane_b32", False), (0x02, 0x02, -1, -1, -1, "v_writelane_b32", False), (0x03, 0x03, 0x01, 0x01, 0x03, "v_add_f32", True), (0x04, 0x04, 0x02, 0x02, 0x04, "v_sub_f32", True), (0x05, 0x05, 0x03, 0x03, 0x05, "v_subrev_f32", True), (0x06, 0x06, -1, -1, 0x06, "v_mac_legacy_f32", True), (0x07, 0x07, 0x04, 0x04, 0x07, "v_mul_legacy_f32", True), (0x08, 0x08, 0x05, 0x05, 0x08, "v_mul_f32", True), (0x09, 0x09, 0x06, 0x06, 0x09, "v_mul_i32_i24", False), (0x0a, 0x0a, 0x07, 0x07, 0x0a, "v_mul_hi_i32_i24", False), (0x0b, 0x0b, 0x08, 0x08, 0x0b, "v_mul_u32_u24", False), (0x0c, 0x0c, 0x09, 0x09, 0x0c, "v_mul_hi_u32_u24", False), (0x0d, 0x0d, -1, -1, -1, "v_min_legacy_f32", True), (0x0e, 0x0e, -1, -1, -1, "v_max_legacy_f32", True), (0x0f, 0x0f, 0x0a, 0x0a, 0x0f, "v_min_f32", True), (0x10, 0x10, 0x0b, 0x0b, 0x10, "v_max_f32", True), (0x11, 0x11, 0x0c, 0x0c, 0x11, "v_min_i32", False), (0x12, 0x12, 0x0d, 0x0d, 0x12, "v_max_i32", False), (0x13, 0x13, 0x0e, 0x0e, 0x13, "v_min_u32", False), (0x14, 0x14, 0x0f, 0x0f, 0x14, "v_max_u32", False), (0x15, 0x15, -1, -1, -1, "v_lshr_b32", False), (0x16, 0x16, 0x10, 0x10, 0x16, "v_lshrrev_b32", False), (0x17, 0x17, -1, -1, -1, "v_ashr_i32", False), (0x18, 0x18, 0x11, 0x11, 0x18, "v_ashrrev_i32", False), (0x19, 0x19, -1, -1, -1, "v_lshl_b32", False), (0x1a, 0x1a, 0x12, 0x12, 0x1a, "v_lshlrev_b32", False), (0x1b, 0x1b, 0x13, 0x13, 0x1b, "v_and_b32", False), (0x1c, 0x1c, 0x14, 0x14, 0x1c, "v_or_b32", False), (0x1d, 0x1d, 0x15, 0x15, 0x1d, "v_xor_b32", False), ( -1, -1, -1, -1, 0x1e, "v_xnor_b32", False), (0x1f, 0x1f, 0x16, 0x16, 0x1f, "v_mac_f32", True), (0x20, 0x20, 0x17, 0x17, 0x20, "v_madmk_f32", False), (0x21, 0x21, 0x18, 0x18, 0x21, "v_madak_f32", False), (0x24, 0x24, -1, -1, -1, "v_mbcnt_hi_u32_b32", False), (0x25, 0x25, 0x19, 0x19, -1, "v_add_co_u32", False), # VOP3B only in RDNA (0x26, 0x26, 0x1a, 0x1a, -1, "v_sub_co_u32", False), # VOP3B only in RDNA (0x27, 0x27, 0x1b, 0x1b, -1, "v_subrev_co_u32", False), # VOP3B only in RDNA (0x28, 0x28, 0x1c, 0x1c, 0x28, "v_addc_co_u32", False), # v_add_co_ci_u32 in RDNA (0x29, 0x29, 0x1d, 0x1d, 0x29, "v_subb_co_u32", False), # v_sub_co_ci_u32 in RDNA (0x2a, 0x2a, 0x1e, 0x1e, 0x2a, "v_subbrev_co_u32", False), # v_subrev_co_ci_u32 in RDNA ( -1, -1, -1, -1, 0x2b, "v_fmac_f32", True), ( -1, -1, -1, -1, 0x2c, "v_fmamk_f32", True), ( -1, -1, -1, -1, 0x2d, "v_fmaak_f32", True), (0x2f, 0x2f, -1, -1, 0x2f, "v_cvt_pkrtz_f16_f32", True), ( -1, -1, 0x1f, 0x1f, 0x32, "v_add_f16", True), ( -1, -1, 0x20, 0x20, 0x33, "v_sub_f16", True), ( -1, -1, 0x21, 0x21, 0x34, "v_subrev_f16", True), ( -1, -1, 0x22, 0x22, 0x35, "v_mul_f16", True), ( -1, -1, 0x23, 0x23, -1, "v_mac_f16", True), ( -1, -1, 0x24, 0x24, -1, "v_madmk_f16", False), ( -1, -1, 0x25, 0x25, -1, "v_madak_f16", False), ( -1, -1, 0x26, 0x26, -1, "v_add_u16", False), ( -1, -1, 0x27, 0x27, -1, "v_sub_u16", False), ( -1, -1, 0x28, 0x28, -1, "v_subrev_u16", False), ( -1, -1, 0x29, 0x29, -1, "v_mul_lo_u16", False), ( -1, -1, 0x2a, 0x2a, -1, "v_lshlrev_b16", False), ( -1, -1, 0x2b, 0x2b, -1, "v_lshrrev_b16", False), ( -1, -1, 0x2c, 0x2c, -1, "v_ashrrev_i16", False), ( -1, -1, 0x2d, 0x2d, 0x39, "v_max_f16", True), ( -1, -1, 0x2e, 0x2e, 0x3a, "v_min_f16", True), ( -1, -1, 0x2f, 0x2f, -1, "v_max_u16", False), ( -1, -1, 0x30, 0x30, -1, "v_max_i16", False), ( -1, -1, 0x31, 0x31, -1, "v_min_u16", False), ( -1, -1, 0x32, 0x32, -1, "v_min_i16", False), ( -1, -1, 0x33, 0x33, 0x3b, "v_ldexp_f16", False), ( -1, -1, -1, 0x34, 0x25, "v_add_u32", False), # use v_add_co_u32 on GFX8, called v_add_nc_u32 in RDNA ( -1, -1, -1, 0x35, 0x26, "v_sub_u32", False), # use v_sub_co_u32 on GFX8, called v_sub_nc_u32 in RDNA ( -1, -1, -1, 0x36, 0x27, "v_subrev_u32", False), # use v_subrev_co_u32 on GFX8, called v_subrev_nc_u32 in RDNA ( -1, -1, -1, -1, 0x36, "v_fmac_f16", False), ( -1, -1, -1, -1, 0x37, "v_fmamk_f16", False), ( -1, -1, -1, -1, 0x38, "v_fmaak_f16", False), ( -1, -1, -1, -1, 0x3c, "v_pk_fmac_f16", False), } for (gfx6, gfx7, gfx8, gfx9, gfx10, name, modifiers) in VOP2: opcode(name, gfx7, gfx9, gfx10, Format.VOP2, modifiers, modifiers) if True: # v_cndmask_b32 can use input modifiers but not output modifiers (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (0x00, 0x00, 0x00, 0x00, 0x01, "v_cndmask_b32") opcode(name, gfx7, gfx9, gfx10, Format.VOP2, True, False) # VOP1 instructions: instructions with 1 input and 1 output VOP1 = { # GFX6, GFX7, GFX8, GFX9, GFX10, name, input_modifiers, output_modifiers (0x00, 0x00, 0x00, 0x00, 0x00, "v_nop", False, False), (0x01, 0x01, 0x01, 0x01, 0x01, "v_mov_b32", False, False), (0x02, 0x02, 0x02, 0x02, 0x02, "v_readfirstlane_b32", False, False), (0x03, 0x03, 0x03, 0x03, 0x03, "v_cvt_i32_f64", True, False), (0x04, 0x04, 0x04, 0x04, 0x04, "v_cvt_f64_i32", False, True), (0x05, 0x05, 0x05, 0x05, 0x05, "v_cvt_f32_i32", False, True), (0x06, 0x06, 0x06, 0x06, 0x06, "v_cvt_f32_u32", False, True), (0x07, 0x07, 0x07, 0x07, 0x07, "v_cvt_u32_f32", True, False), (0x08, 0x08, 0x08, 0x08, 0x08, "v_cvt_i32_f32", True, False), (0x09, 0x09, -1, -1, 0x09, "v_mov_fed_b32", True, False), # LLVM mentions it for GFX8_9 (0x0a, 0x0a, 0x0a, 0x0a, 0x0a, "v_cvt_f16_f32", True, True), ( -1, -1, -1, -1, -1, "p_cvt_f16_f32_rtne", True, True), (0x0b, 0x0b, 0x0b, 0x0b, 0x0b, "v_cvt_f32_f16", True, True), (0x0c, 0x0c, 0x0c, 0x0c, 0x0c, "v_cvt_rpi_i32_f32", True, False), (0x0d, 0x0d, 0x0d, 0x0d, 0x0d, "v_cvt_flr_i32_f32", True, False), (0x0e, 0x0e, 0x0e, 0x0e, 0x0e, "v_cvt_off_f32_i4", False, True), (0x0f, 0x0f, 0x0f, 0x0f, 0x0f, "v_cvt_f32_f64", True, True), (0x10, 0x10, 0x10, 0x10, 0x10, "v_cvt_f64_f32", True, True), (0x11, 0x11, 0x11, 0x11, 0x11, "v_cvt_f32_ubyte0", False, True), (0x12, 0x12, 0x12, 0x12, 0x12, "v_cvt_f32_ubyte1", False, True), (0x13, 0x13, 0x13, 0x13, 0x13, "v_cvt_f32_ubyte2", False, True), (0x14, 0x14, 0x14, 0x14, 0x14, "v_cvt_f32_ubyte3", False, True), (0x15, 0x15, 0x15, 0x15, 0x15, "v_cvt_u32_f64", True, False), (0x16, 0x16, 0x16, 0x16, 0x16, "v_cvt_f64_u32", False, True), ( -1, 0x17, 0x17, 0x17, 0x17, "v_trunc_f64", True, True), ( -1, 0x18, 0x18, 0x18, 0x18, "v_ceil_f64", True, True), ( -1, 0x19, 0x19, 0x19, 0x19, "v_rndne_f64", True, True), ( -1, 0x1a, 0x1a, 0x1a, 0x1a, "v_floor_f64", True, True), ( -1, -1, -1, -1, 0x1b, "v_pipeflush", False, False), (0x20, 0x20, 0x1b, 0x1b, 0x20, "v_fract_f32", True, True), (0x21, 0x21, 0x1c, 0x1c, 0x21, "v_trunc_f32", True, True), (0x22, 0x22, 0x1d, 0x1d, 0x22, "v_ceil_f32", True, True), (0x23, 0x23, 0x1e, 0x1e, 0x23, "v_rndne_f32", True, True), (0x24, 0x24, 0x1f, 0x1f, 0x24, "v_floor_f32", True, True), (0x25, 0x25, 0x20, 0x20, 0x25, "v_exp_f32", True, True), (0x26, 0x26, -1, -1, -1, "v_log_clamp_f32", True, True), (0x27, 0x27, 0x21, 0x21, 0x27, "v_log_f32", True, True), (0x28, 0x28, -1, -1, -1, "v_rcp_clamp_f32", True, True), (0x29, 0x29, -1, -1, -1, "v_rcp_legacy_f32", True, True), (0x2a, 0x2a, 0x22, 0x22, 0x2a, "v_rcp_f32", True, True), (0x2b, 0x2b, 0x23, 0x23, 0x2b, "v_rcp_iflag_f32", True, True), (0x2c, 0x2c, -1, -1, -1, "v_rsq_clamp_f32", True, True), (0x2d, 0x2d, -1, -1, -1, "v_rsq_legacy_f32", True, True), (0x2e, 0x2e, 0x24, 0x24, 0x2e, "v_rsq_f32", True, True), (0x2f, 0x2f, 0x25, 0x25, 0x2f, "v_rcp_f64", True, True), (0x30, 0x30, -1, -1, -1, "v_rcp_clamp_f64", True, True), (0x31, 0x31, 0x26, 0x26, 0x31, "v_rsq_f64", True, True), (0x32, 0x32, -1, -1, -1, "v_rsq_clamp_f64", True, True), (0x33, 0x33, 0x27, 0x27, 0x33, "v_sqrt_f32", True, True), (0x34, 0x34, 0x28, 0x28, 0x34, "v_sqrt_f64", True, True), (0x35, 0x35, 0x29, 0x29, 0x35, "v_sin_f32", True, True), (0x36, 0x36, 0x2a, 0x2a, 0x36, "v_cos_f32", True, True), (0x37, 0x37, 0x2b, 0x2b, 0x37, "v_not_b32", False, False), (0x38, 0x38, 0x2c, 0x2c, 0x38, "v_bfrev_b32", False, False), (0x39, 0x39, 0x2d, 0x2d, 0x39, "v_ffbh_u32", False, False), (0x3a, 0x3a, 0x2e, 0x2e, 0x3a, "v_ffbl_b32", False, False), (0x3b, 0x3b, 0x2f, 0x2f, 0x3b, "v_ffbh_i32", False, False), (0x3c, 0x3c, 0x30, 0x30, 0x3c, "v_frexp_exp_i32_f64", True, False), (0x3d, 0x3d, 0x31, 0x31, 0x3d, "v_frexp_mant_f64", True, False), (0x3e, 0x3e, 0x32, 0x32, 0x3e, "v_fract_f64", True, True), (0x3f, 0x3f, 0x33, 0x33, 0x3f, "v_frexp_exp_i32_f32", True, False), (0x40, 0x40, 0x34, 0x34, 0x40, "v_frexp_mant_f32", True, False), (0x41, 0x41, 0x35, 0x35, 0x41, "v_clrexcp", False, False), (0x42, 0x42, 0x36, -1, 0x42, "v_movreld_b32", False, False), (0x43, 0x43, 0x37, -1, 0x43, "v_movrels_b32", False, False), (0x44, 0x44, 0x38, -1, 0x44, "v_movrelsd_b32", False, False), ( -1, -1, -1, -1, 0x48, "v_movrelsd_2_b32", False, False), ( -1, -1, -1, 0x37, -1, "v_screen_partition_4se_b32", False, False), ( -1, -1, 0x39, 0x39, 0x50, "v_cvt_f16_u16", False, True), ( -1, -1, 0x3a, 0x3a, 0x51, "v_cvt_f16_i16", False, True), ( -1, -1, 0x3b, 0x3b, 0x52, "v_cvt_u16_f16", True, False), ( -1, -1, 0x3c, 0x3c, 0x53, "v_cvt_i16_f16", True, False), ( -1, -1, 0x3d, 0x3d, 0x54, "v_rcp_f16", True, True), ( -1, -1, 0x3e, 0x3e, 0x55, "v_sqrt_f16", True, True), ( -1, -1, 0x3f, 0x3f, 0x56, "v_rsq_f16", True, True), ( -1, -1, 0x40, 0x40, 0x57, "v_log_f16", True, True), ( -1, -1, 0x41, 0x41, 0x58, "v_exp_f16", True, True), ( -1, -1, 0x42, 0x42, 0x59, "v_frexp_mant_f16", True, False), ( -1, -1, 0x43, 0x43, 0x5a, "v_frexp_exp_i16_f16", True, False), ( -1, -1, 0x44, 0x44, 0x5b, "v_floor_f16", True, True), ( -1, -1, 0x45, 0x45, 0x5c, "v_ceil_f16", True, True), ( -1, -1, 0x46, 0x46, 0x5d, "v_trunc_f16", True, True), ( -1, -1, 0x47, 0x47, 0x5e, "v_rndne_f16", True, True), ( -1, -1, 0x48, 0x48, 0x5f, "v_fract_f16", True, True), ( -1, -1, 0x49, 0x49, 0x60, "v_sin_f16", True, True), ( -1, -1, 0x4a, 0x4a, 0x61, "v_cos_f16", True, True), ( -1, 0x46, 0x4b, 0x4b, -1, "v_exp_legacy_f32", True, True), ( -1, 0x45, 0x4c, 0x4c, -1, "v_log_legacy_f32", True, True), ( -1, -1, -1, 0x4f, 0x62, "v_sat_pk_u8_i16", False, False), ( -1, -1, -1, 0x4d, 0x63, "v_cvt_norm_i16_f16", True, False), ( -1, -1, -1, 0x4e, 0x64, "v_cvt_norm_u16_f16", True, False), ( -1, -1, -1, 0x51, 0x65, "v_swap_b32", False, False), ( -1, -1, -1, -1, 0x68, "v_swaprel_b32", False, False), } for (gfx6, gfx7, gfx8, gfx9, gfx10, name, in_mod, out_mod) in VOP1: opcode(name, gfx7, gfx9, gfx10, Format.VOP1, in_mod, out_mod) # VOPC instructions: VOPC_CLASS = { (0x88, 0x88, 0x10, 0x10, 0x88, "v_cmp_class_f32"), ( -1, -1, 0x14, 0x14, 0x8f, "v_cmp_class_f16"), (0x98, 0x98, 0x11, 0x11, 0x98, "v_cmpx_class_f32"), ( -1, -1, 0x15, 0x15, 0x9f, "v_cmpx_class_f16"), (0xa8, 0xa8, 0x12, 0x12, 0xa8, "v_cmp_class_f64"), (0xb8, 0xb8, 0x13, 0x13, 0xb8, "v_cmpx_class_f64"), } for (gfx6, gfx7, gfx8, gfx9, gfx10, name) in VOPC_CLASS: opcode(name, gfx7, gfx9, gfx10, Format.VOPC, True, False) COMPF = ["f", "lt", "eq", "le", "gt", "lg", "ge", "o", "u", "nge", "nlg", "ngt", "nle", "neq", "nlt", "tru"] for i in range(8): (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (-1, -1, 0x20+i, 0x20+i, 0xc8+i, "v_cmp_"+COMPF[i]+"_f16") opcode(name, gfx7, gfx9, gfx10, Format.VOPC, True, False) (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (-1, -1, 0x30+i, 0x30+i, 0xd8+i, "v_cmpx_"+COMPF[i]+"_f16") opcode(name, gfx7, gfx9, gfx10, Format.VOPC, True, False) (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (-1, -1, 0x28+i, 0x28+i, 0xe8+i, "v_cmp_"+COMPF[i+8]+"_f16") opcode(name, gfx7, gfx9, gfx10, Format.VOPC, True, False) (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (-1, -1, 0x38+i, 0x38+i, 0xf8+i, "v_cmpx_"+COMPF[i+8]+"_f16") opcode(name, gfx7, gfx9, gfx10, Format.VOPC, True, False) for i in range(16): (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (0x00+i, 0x00+i, 0x40+i, 0x40+i, 0x00+i, "v_cmp_"+COMPF[i]+"_f32") opcode(name, gfx7, gfx9, gfx10, Format.VOPC, True, False) (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (0x10+i, 0x10+i, 0x50+i, 0x50+i, 0x10+i, "v_cmpx_"+COMPF[i]+"_f32") opcode(name, gfx7, gfx9, gfx10, Format.VOPC, True, False) (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (0x20+i, 0x20+i, 0x60+i, 0x60+i, 0x20+i, "v_cmp_"+COMPF[i]+"_f64") opcode(name, gfx7, gfx9, gfx10, Format.VOPC, True, False) (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (0x30+i, 0x30+i, 0x70+i, 0x70+i, 0x30+i, "v_cmpx_"+COMPF[i]+"_f64") opcode(name, gfx7, gfx9, gfx10, Format.VOPC, True, False) # GFX_6_7 (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (0x40+i, 0x40+i, -1, -1, -1, "v_cmps_"+COMPF[i]+"_f32") (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (0x50+i, 0x50+i, -1, -1, -1, "v_cmpsx_"+COMPF[i]+"_f32") (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (0x60+i, 0x60+i, -1, -1, -1, "v_cmps_"+COMPF[i]+"_f64") (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (0x70+i, 0x70+i, -1, -1, -1, "v_cmpsx_"+COMPF[i]+"_f64") COMPI = ["f", "lt", "eq", "le", "gt", "lg", "ge", "tru"] # GFX_8_9 for i in [0,7]: # only 0 and 7 (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (-1, -1, 0xa0+i, 0xa0+i, -1, "v_cmp_"+COMPI[i]+"_i16") opcode(name, gfx7, gfx9, gfx10, Format.VOPC) (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (-1, -1, 0xb0+i, 0xb0+i, -1, "v_cmpx_"+COMPI[i]+"_i16") opcode(name, gfx7, gfx9, gfx10, Format.VOPC) (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (-1, -1, 0xa8+i, 0xa8+i, -1, "v_cmp_"+COMPI[i]+"_u16") opcode(name, gfx7, gfx9, gfx10, Format.VOPC) (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (-1, -1, 0xb8+i, 0xb8+i, -1, "v_cmpx_"+COMPI[i]+"_u16") opcode(name, gfx7, gfx9, gfx10, Format.VOPC) for i in range(1, 7): # [1..6] (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (-1, -1, 0xa0+i, 0xa0+i, 0x88+i, "v_cmp_"+COMPI[i]+"_i16") opcode(name, gfx7, gfx9, gfx10, Format.VOPC) (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (-1, -1, 0xb0+i, 0xb0+i, 0x98+i, "v_cmpx_"+COMPI[i]+"_i16") opcode(name, gfx7, gfx9, gfx10, Format.VOPC) (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (-1, -1, 0xa8+i, 0xa8+i, 0xa8+i, "v_cmp_"+COMPI[i]+"_u16") opcode(name, gfx7, gfx9, gfx10, Format.VOPC) (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (-1, -1, 0xb8+i, 0xb8+i, 0xb8+i, "v_cmpx_"+COMPI[i]+"_u16") opcode(name, gfx7, gfx9, gfx10, Format.VOPC) for i in range(8): (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (0x80+i, 0x80+i, 0xc0+i, 0xc0+i, 0x80+i, "v_cmp_"+COMPI[i]+"_i32") opcode(name, gfx7, gfx9, gfx10, Format.VOPC) (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (0x90+i, 0x90+i, 0xd0+i, 0xd0+i, 0x90+i, "v_cmpx_"+COMPI[i]+"_i32") opcode(name, gfx7, gfx9, gfx10, Format.VOPC) (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (0xa0+i, 0xa0+i, 0xe0+i, 0xe0+i, 0xa0+i, "v_cmp_"+COMPI[i]+"_i64") opcode(name, gfx7, gfx9, gfx10, Format.VOPC) (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (0xb0+i, 0xb0+i, 0xf0+i, 0xf0+i, 0xb0+i, "v_cmpx_"+COMPI[i]+"_i64") opcode(name, gfx7, gfx9, gfx10, Format.VOPC) (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (0xc0+i, 0xc0+i, 0xc8+i, 0xc8+i, 0xc0+i, "v_cmp_"+COMPI[i]+"_u32") opcode(name, gfx7, gfx9, gfx10, Format.VOPC) (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (0xd0+i, 0xd0+i, 0xd8+i, 0xd8+i, 0xd0+i, "v_cmpx_"+COMPI[i]+"_u32") opcode(name, gfx7, gfx9, gfx10, Format.VOPC) (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (0xe0+i, 0xe0+i, 0xe8+i, 0xe8+i, 0xe0+i, "v_cmp_"+COMPI[i]+"_u64") opcode(name, gfx7, gfx9, gfx10, Format.VOPC) (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (0xf0+i, 0xf0+i, 0xf8+i, 0xf8+i, 0xf0+i, "v_cmpx_"+COMPI[i]+"_u64") opcode(name, gfx7, gfx9, gfx10, Format.VOPC) # VOPP instructions: packed 16bit instructions - 1 or 2 inputs and 1 output VOPP = { # opcode, name, input/output modifiers (0x00, "v_pk_mad_i16", False), (0x01, "v_pk_mul_lo_u16", False), (0x02, "v_pk_add_i16", False), (0x03, "v_pk_sub_i16", False), (0x04, "v_pk_lshlrev_b16", False), (0x05, "v_pk_lshrrev_b16", False), (0x06, "v_pk_ashrrev_i16", False), (0x07, "v_pk_max_i16", False), (0x08, "v_pk_min_i16", False), (0x09, "v_pk_mad_u16", False), (0x0a, "v_pk_add_u16", False), (0x0b, "v_pk_sub_u16", False), (0x0c, "v_pk_max_u16", False), (0x0d, "v_pk_min_u16", False), (0x0e, "v_pk_fma_f16", True), (0x0f, "v_pk_add_f16", True), (0x10, "v_pk_mul_f16", True), (0x11, "v_pk_min_f16", True), (0x12, "v_pk_max_f16", True), (0x20, "v_fma_mix_f32", True), # v_mad_mix_f32 in VEGA ISA, v_fma_mix_f32 in RDNA ISA (0x21, "v_fma_mixlo_f16", True), # v_mad_mixlo_f16 in VEGA ISA, v_fma_mixlo_f16 in RDNA ISA (0x22, "v_fma_mixhi_f16", True), # v_mad_mixhi_f16 in VEGA ISA, v_fma_mixhi_f16 in RDNA ISA } # note that these are only supported on gfx9+ so we'll need to distinguish between gfx8 and gfx9 here # (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (-1, -1, -1, code, code, name) for (code, name, modifiers) in VOPP: opcode(name, -1, code, code, Format.VOP3P, modifiers, modifiers) # VINTERP instructions: VINTRP = { (0x00, "v_interp_p1_f32"), (0x01, "v_interp_p2_f32"), (0x02, "v_interp_mov_f32"), } # (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (code, code, code, code, code, name) for (code, name) in VINTRP: opcode(name, code, code, code, Format.VINTRP) # VOP3 instructions: 3 inputs, 1 output # VOP3b instructions: have a unique scalar output, e.g. VOP2 with vcc out VOP3 = { (0x140, 0x140, 0x1c0, 0x1c0, 0x140, "v_mad_legacy_f32", True, True), # GFX6-GFX10 (0x141, 0x141, 0x1c1, 0x1c1, 0x141, "v_mad_f32", True, True), (0x142, 0x142, 0x1c2, 0x1c2, 0x142, "v_mad_i32_i24", False, False), (0x143, 0x143, 0x1c3, 0x1c3, 0x143, "v_mad_u32_u24", False, False), (0x144, 0x144, 0x1c4, 0x1c4, 0x144, "v_cubeid_f32", True, True), (0x145, 0x145, 0x1c5, 0x1c5, 0x145, "v_cubesc_f32", True, True), (0x146, 0x146, 0x1c6, 0x1c6, 0x146, "v_cubetc_f32", True, True), (0x147, 0x147, 0x1c7, 0x1c7, 0x147, "v_cubema_f32", True, True), (0x148, 0x148, 0x1c8, 0x1c8, 0x148, "v_bfe_u32", False, False), (0x149, 0x149, 0x1c9, 0x1c9, 0x149, "v_bfe_i32", False, False), (0x14a, 0x14a, 0x1ca, 0x1ca, 0x14a, "v_bfi_b32", False, False), (0x14b, 0x14b, 0x1cb, 0x1cb, 0x14b, "v_fma_f32", True, True), (0x14c, 0x14c, 0x1cc, 0x1cc, 0x14c, "v_fma_f64", True, True), (0x14d, 0x14d, 0x1cd, 0x1cd, 0x14d, "v_lerp_u8", False, False), (0x14e, 0x14e, 0x1ce, 0x1ce, 0x14e, "v_alignbit_b32", False, False), (0x14f, 0x14f, 0x1cf, 0x1cf, 0x14f, "v_alignbyte_b32", False, False), (0x150, 0x150, -1, -1, 0x150, "v_mullit_f32", True, True), (0x151, 0x151, 0x1d0, 0x1d0, 0x151, "v_min3_f32", True, True), (0x152, 0x152, 0x1d1, 0x1d1, 0x152, "v_min3_i32", False, False), (0x153, 0x153, 0x1d2, 0x1d2, 0x153, "v_min3_u32", False, False), (0x154, 0x154, 0x1d3, 0x1d3, 0x154, "v_max3_f32", True, True), (0x155, 0x155, 0x1d4, 0x1d4, 0x155, "v_max3_i32", False, False), (0x156, 0x156, 0x1d5, 0x1d5, 0x156, "v_max3_u32", False, False), (0x157, 0x157, 0x1d6, 0x1d6, 0x157, "v_med3_f32", True, True), (0x158, 0x158, 0x1d7, 0x1d7, 0x158, "v_med3_i32", False, False), (0x159, 0x159, 0x1d8, 0x1d8, 0x159, "v_med3_u32", False, False), (0x15a, 0x15a, 0x1d9, 0x1d9, 0x15a, "v_sad_u8", False, False), (0x15b, 0x15b, 0x1da, 0x1da, 0x15b, "v_sad_hi_u8", False, False), (0x15c, 0x15c, 0x1db, 0x1db, 0x15c, "v_sad_u16", False, False), (0x15d, 0x15d, 0x1dc, 0x1dc, 0x15d, "v_sad_u32", False, False), (0x15e, 0x15e, 0x1dd, 0x1dd, 0x15e, "v_cvt_pk_u8_f32", True, False), (0x15f, 0x15f, 0x1de, 0x1de, 0x15f, "v_div_fixup_f32", True, True), (0x160, 0x160, 0x1df, 0x1df, 0x160, "v_div_fixup_f64", True, True), (0x161, 0x161, -1, -1, -1, "v_lshl_b64", False, False), (0x162, 0x162, -1, -1, -1, "v_lshr_b64", False, False), (0x163, 0x163, -1, -1, -1, "v_ashr_i64", False, False), (0x164, 0x164, 0x280, 0x280, 0x164, "v_add_f64", True, True), (0x165, 0x165, 0x281, 0x281, 0x165, "v_mul_f64", True, True), (0x166, 0x166, 0x282, 0x282, 0x166, "v_min_f64", True, True), (0x167, 0x167, 0x283, 0x283, 0x167, "v_max_f64", True, True), (0x168, 0x168, 0x284, 0x284, 0x168, "v_ldexp_f64", False, True), # src1 can take input modifiers (0x169, 0x169, 0x285, 0x285, 0x169, "v_mul_lo_u32", False, False), (0x16a, 0x16a, 0x286, 0x286, 0x16a, "v_mul_hi_u32", False, False), (0x16b, 0x16b, 0x285, 0x285, 0x16b, "v_mul_lo_i32", False, False), # identical to v_mul_lo_u32 (0x16c, 0x16c, 0x287, 0x287, 0x16c, "v_mul_hi_i32", False, False), (0x16d, 0x16d, 0x1e0, 0x1e0, 0x16d, "v_div_scale_f32", True, True), # writes to VCC (0x16e, 0x16e, 0x1e1, 0x1e1, 0x16e, "v_div_scale_f64", True, True), # writes to VCC (0x16f, 0x16f, 0x1e2, 0x1e2, 0x16f, "v_div_fmas_f32", True, True), # takes VCC input (0x170, 0x170, 0x1e3, 0x1e3, 0x170, "v_div_fmas_f64", True, True), # takes VCC input (0x171, 0x171, 0x1e4, 0x1e4, 0x171, "v_msad_u8", False, False), (0x172, 0x172, 0x1e5, 0x1e5, 0x172, "v_qsad_pk_u16_u8", False, False), (0x172, -1, -1, -1, -1, "v_qsad_u8", False, False), # what's the difference? (0x173, 0x173, 0x1e6, 0x1e6, 0x173, "v_mqsad_pk_u16_u8", False, False), (0x173, -1, -1, -1, -1, "v_mqsad_u8", False, False), # what's the difference? (0x174, 0x174, 0x292, 0x292, 0x174, "v_trig_preop_f64", False, False), ( -1, 0x175, 0x1e7, 0x1e7, 0x175, "v_mqsad_u32_u8", False, False), ( -1, 0x176, 0x1e8, 0x1e8, 0x176, "v_mad_u64_u32", False, False), ( -1, 0x177, 0x1e9, 0x1e9, 0x177, "v_mad_i64_i32", False, False), ( -1, -1, 0x1ea, 0x1ea, -1, "v_mad_legacy_f16", True, True), ( -1, -1, 0x1eb, 0x1eb, -1, "v_mad_legacy_u16", False, False), ( -1, -1, 0x1ec, 0x1ec, -1, "v_mad_legacy_i16", False, False), ( -1, -1, 0x1ed, 0x1ed, 0x344, "v_perm_b32", False, False), ( -1, -1, 0x1ee, 0x1ee, -1, "v_fma_legacy_f16", True, True), ( -1, -1, 0x1ef, 0x1ef, -1, "v_div_fixup_legacy_f16", True, True), (0x12c, 0x12c, 0x1f0, 0x1f0, -1, "v_cvt_pkaccum_u8_f32", True, False), ( -1, -1, -1, 0x1f1, 0x373, "v_mad_u32_u16", False, False), ( -1, -1, -1, 0x1f2, 0x375, "v_mad_i32_i16", False, False), ( -1, -1, -1, 0x1f3, 0x345, "v_xad_u32", False, False), ( -1, -1, -1, 0x1f4, 0x351, "v_min3_f16", True, True), ( -1, -1, -1, 0x1f5, 0x352, "v_min3_i16", False, False), ( -1, -1, -1, 0x1f6, 0x353, "v_min3_u16", False, False), ( -1, -1, -1, 0x1f7, 0x354, "v_max3_f16", True, True), ( -1, -1, -1, 0x1f8, 0x355, "v_max3_i16", False, False), ( -1, -1, -1, 0x1f9, 0x356, "v_max3_u16", False, False), ( -1, -1, -1, 0x1fa, 0x357, "v_med3_f16", True, True), ( -1, -1, -1, 0x1fb, 0x358, "v_med3_i16", False, False), ( -1, -1, -1, 0x1fc, 0x359, "v_med3_u16", False, False), ( -1, -1, -1, 0x1fd, 0x346, "v_lshl_add_u32", False, False), ( -1, -1, -1, 0x1fe, 0x347, "v_add_lshl_u32", False, False), ( -1, -1, -1, 0x1ff, 0x36d, "v_add3_u32", False, False), ( -1, -1, -1, 0x200, 0x36f, "v_lshl_or_b32", False, False), ( -1, -1, -1, 0x201, 0x371, "v_and_or_b32", False, False), ( -1, -1, -1, 0x202, 0x372, "v_or3_b32", False, False), ( -1, -1, -1, 0x203, -1, "v_mad_f16", True, True), ( -1, -1, -1, 0x204, 0x340, "v_mad_u16", False, False), ( -1, -1, -1, 0x205, 0x35e, "v_mad_i16", False, False), ( -1, -1, -1, 0x206, 0x34b, "v_fma_f16", True, True), ( -1, -1, -1, 0x207, 0x35f, "v_div_fixup_f16", True, True), ( -1, -1, 0x274, 0x274, 0x342, "v_interp_p1ll_f16", True, True), ( -1, -1, 0x275, 0x275, 0x343, "v_interp_p1lv_f16", True, True), ( -1, -1, 0x276, 0x276, -1, "v_interp_p2_legacy_f16", True, True), ( -1, -1, -1, 0x277, 0x35a, "v_interp_p2_f16", True, True), (0x12b, 0x12b, 0x288, 0x288, 0x362, "v_ldexp_f32", False, True), ( -1, -1, 0x289, 0x289, 0x360, "v_readlane_b32_e64", False, False), ( -1, -1, 0x28a, 0x28a, 0x361, "v_writelane_b32_e64", False, False), (0x122, 0x122, 0x28b, 0x28b, 0x364, "v_bcnt_u32_b32", False, False), (0x123, 0x123, 0x28c, 0x28c, 0x365, "v_mbcnt_lo_u32_b32", False, False), ( -1, -1, 0x28d, 0x28d, 0x366, "v_mbcnt_hi_u32_b32_e64", False, False), ( -1, -1, 0x28f, 0x28f, 0x2ff, "v_lshlrev_b64", False, False), ( -1, -1, 0x290, 0x290, 0x300, "v_lshrrev_b64", False, False), ( -1, -1, 0x291, 0x291, 0x301, "v_ashrrev_i64", False, False), (0x11e, 0x11e, 0x293, 0x293, 0x363, "v_bfm_b32", False, False), (0x12d, 0x12d, 0x294, 0x294, 0x368, "v_cvt_pknorm_i16_f32", True, False), (0x12e, 0x12e, 0x295, 0x295, 0x369, "v_cvt_pknorm_u16_f32", True, False), (0x12f, 0x12f, 0x296, 0x296, 0x12f, "v_cvt_pkrtz_f16_f32_e64", True, False), # GFX6_7_10 is VOP2 with opcode 0x02f (0x130, 0x130, 0x297, 0x297, 0x36a, "v_cvt_pk_u16_u32", False, False), (0x131, 0x131, 0x298, 0x298, 0x36b, "v_cvt_pk_i16_i32", False, False), ( -1, -1, -1, 0x299, 0x312, "v_cvt_pknorm_i16_f16", True, False), ( -1, -1, -1, 0x29a, 0x313, "v_cvt_pknorm_u16_f16", True, False), ( -1, -1, -1, 0x29c, 0x37f, "v_add_i32", False, False), ( -1, -1, -1, 0x29d, 0x376, "v_sub_i32", False, False), ( -1, -1, -1, 0x29e, 0x30d, "v_add_i16", False, False), ( -1, -1, -1, 0x29f, 0x30e, "v_sub_i16", False, False), ( -1, -1, -1, 0x2a0, 0x311, "v_pack_b32_f16", True, False), ( -1, -1, -1, -1, 0x178, "v_xor3_b32", False, False), ( -1, -1, -1, -1, 0x377, "v_permlane16_b32", False, False), ( -1, -1, -1, -1, 0x378, "v_permlanex16_b32", False, False), ( -1, -1, -1, -1, 0x30f, "v_add_co_u32_e64", False, False), ( -1, -1, -1, -1, 0x310, "v_sub_co_u32_e64", False, False), ( -1, -1, -1, -1, 0x319, "v_subrev_co_u32_e64", False, False), ( -1, -1, -1, -1, 0x303, "v_add_u16_e64", False, False), ( -1, -1, -1, -1, 0x304, "v_sub_u16_e64", False, False), ( -1, -1, -1, -1, 0x305, "v_mul_lo_u16_e64", False, False), ( -1, -1, -1, -1, 0x309, "v_max_u16_e64", False, False), ( -1, -1, -1, -1, 0x30a, "v_max_i16_e64", False, False), ( -1, -1, -1, -1, 0x30b, "v_min_u16_e64", False, False), ( -1, -1, -1, -1, 0x30c, "v_min_i16_e64", False, False), ( -1, -1, -1, -1, 0x307, "v_lshrrev_b16_e64", False, False), ( -1, -1, -1, -1, 0x308, "v_ashrrev_i16_e64", False, False), ( -1, -1, -1, -1, 0x314, "v_lshlrev_b16_e64", False, False), ( -1, -1, -1, -1, 0x140, "v_fma_legacy_f32", True, True), #GFX10.3+ } for (gfx6, gfx7, gfx8, gfx9, gfx10, name, in_mod, out_mod) in VOP3: opcode(name, gfx7, gfx9, gfx10, Format.VOP3, in_mod, out_mod) # DS instructions: 3 inputs (1 addr, 2 data), 1 output DS = { (0x00, 0x00, 0x00, 0x00, 0x00, "ds_add_u32"), (0x01, 0x01, 0x01, 0x01, 0x01, "ds_sub_u32"), (0x02, 0x02, 0x02, 0x02, 0x02, "ds_rsub_u32"), (0x03, 0x03, 0x03, 0x03, 0x03, "ds_inc_u32"), (0x04, 0x04, 0x04, 0x04, 0x04, "ds_dec_u32"), (0x05, 0x05, 0x05, 0x05, 0x05, "ds_min_i32"), (0x06, 0x06, 0x06, 0x06, 0x06, "ds_max_i32"), (0x07, 0x07, 0x07, 0x07, 0x07, "ds_min_u32"), (0x08, 0x08, 0x08, 0x08, 0x08, "ds_max_u32"), (0x09, 0x09, 0x09, 0x09, 0x09, "ds_and_b32"), (0x0a, 0x0a, 0x0a, 0x0a, 0x0a, "ds_or_b32"), (0x0b, 0x0b, 0x0b, 0x0b, 0x0b, "ds_xor_b32"), (0x0c, 0x0c, 0x0c, 0x0c, 0x0c, "ds_mskor_b32"), (0x0d, 0x0d, 0x0d, 0x0d, 0x0d, "ds_write_b32"), (0x0e, 0x0e, 0x0e, 0x0e, 0x0e, "ds_write2_b32"), (0x0f, 0x0f, 0x0f, 0x0f, 0x0f, "ds_write2st64_b32"), (0x10, 0x10, 0x10, 0x10, 0x10, "ds_cmpst_b32"), (0x11, 0x11, 0x11, 0x11, 0x11, "ds_cmpst_f32"), (0x12, 0x12, 0x12, 0x12, 0x12, "ds_min_f32"), (0x13, 0x13, 0x13, 0x13, 0x13, "ds_max_f32"), ( -1, 0x14, 0x14, 0x14, 0x14, "ds_nop"), ( -1, -1, 0x15, 0x15, 0x15, "ds_add_f32"), ( -1, -1, 0x1d, 0x1d, 0xb0, "ds_write_addtid_b32"), (0x1e, 0x1e, 0x1e, 0x1e, 0x1e, "ds_write_b8"), (0x1f, 0x1f, 0x1f, 0x1f, 0x1f, "ds_write_b16"), (0x20, 0x20, 0x20, 0x20, 0x20, "ds_add_rtn_u32"), (0x21, 0x21, 0x21, 0x21, 0x21, "ds_sub_rtn_u32"), (0x22, 0x22, 0x22, 0x22, 0x22, "ds_rsub_rtn_u32"), (0x23, 0x23, 0x23, 0x23, 0x23, "ds_inc_rtn_u32"), (0x24, 0x24, 0x24, 0x24, 0x24, "ds_dec_rtn_u32"), (0x25, 0x25, 0x25, 0x25, 0x25, "ds_min_rtn_i32"), (0x26, 0x26, 0x26, 0x26, 0x26, "ds_max_rtn_i32"), (0x27, 0x27, 0x27, 0x27, 0x27, "ds_min_rtn_u32"), (0x28, 0x28, 0x28, 0x28, 0x28, "ds_max_rtn_u32"), (0x29, 0x29, 0x29, 0x29, 0x29, "ds_and_rtn_b32"), (0x2a, 0x2a, 0x2a, 0x2a, 0x2a, "ds_or_rtn_b32"), (0x2b, 0x2b, 0x2b, 0x2b, 0x2b, "ds_xor_rtn_b32"), (0x2c, 0x2c, 0x2c, 0x2c, 0x2c, "ds_mskor_rtn_b32"), (0x2d, 0x2d, 0x2d, 0x2d, 0x2d, "ds_wrxchg_rtn_b32"), (0x2e, 0x2e, 0x2e, 0x2e, 0x2e, "ds_wrxchg2_rtn_b32"), (0x2f, 0x2f, 0x2f, 0x2f, 0x2f, "ds_wrxchg2st64_rtn_b32"), (0x30, 0x30, 0x30, 0x30, 0x30, "ds_cmpst_rtn_b32"), (0x31, 0x31, 0x31, 0x31, 0x31, "ds_cmpst_rtn_f32"), (0x32, 0x32, 0x32, 0x32, 0x32, "ds_min_rtn_f32"), (0x33, 0x33, 0x33, 0x33, 0x33, "ds_max_rtn_f32"), ( -1, 0x34, 0x34, 0x34, 0x34, "ds_wrap_rtn_b32"), ( -1, -1, 0x35, 0x35, 0x55, "ds_add_rtn_f32"), (0x36, 0x36, 0x36, 0x36, 0x36, "ds_read_b32"), (0x37, 0x37, 0x37, 0x37, 0x37, "ds_read2_b32"), (0x38, 0x38, 0x38, 0x38, 0x38, "ds_read2st64_b32"), (0x39, 0x39, 0x39, 0x39, 0x39, "ds_read_i8"), (0x3a, 0x3a, 0x3a, 0x3a, 0x3a, "ds_read_u8"), (0x3b, 0x3b, 0x3b, 0x3b, 0x3b, "ds_read_i16"), (0x3c, 0x3c, 0x3c, 0x3c, 0x3c, "ds_read_u16"), (0x35, 0x35, 0x3d, 0x3d, 0x35, "ds_swizzle_b32"), #data1 & offset, no addr/data2 ( -1, -1, 0x3e, 0x3e, 0xb2, "ds_permute_b32"), ( -1, -1, 0x3f, 0x3f, 0xb3, "ds_bpermute_b32"), (0x40, 0x40, 0x40, 0x40, 0x40, "ds_add_u64"), (0x41, 0x41, 0x41, 0x41, 0x41, "ds_sub_u64"), (0x42, 0x42, 0x42, 0x42, 0x42, "ds_rsub_u64"), (0x43, 0x43, 0x43, 0x43, 0x43, "ds_inc_u64"), (0x44, 0x44, 0x44, 0x44, 0x44, "ds_dec_u64"), (0x45, 0x45, 0x45, 0x45, 0x45, "ds_min_i64"), (0x46, 0x46, 0x46, 0x46, 0x46, "ds_max_i64"), (0x47, 0x47, 0x47, 0x47, 0x47, "ds_min_u64"), (0x48, 0x48, 0x48, 0x48, 0x48, "ds_max_u64"), (0x49, 0x49, 0x49, 0x49, 0x49, "ds_and_b64"), (0x4a, 0x4a, 0x4a, 0x4a, 0x4a, "ds_or_b64"), (0x4b, 0x4b, 0x4b, 0x4b, 0x4b, "ds_xor_b64"), (0x4c, 0x4c, 0x4c, 0x4c, 0x4c, "ds_mskor_b64"), (0x4d, 0x4d, 0x4d, 0x4d, 0x4d, "ds_write_b64"), (0x4e, 0x4e, 0x4e, 0x4e, 0x4e, "ds_write2_b64"), (0x4f, 0x4f, 0x4f, 0x4f, 0x4f, "ds_write2st64_b64"), (0x50, 0x50, 0x50, 0x50, 0x50, "ds_cmpst_b64"), (0x51, 0x51, 0x51, 0x51, 0x51, "ds_cmpst_f64"), (0x52, 0x52, 0x52, 0x52, 0x52, "ds_min_f64"), (0x53, 0x53, 0x53, 0x53, 0x53, "ds_max_f64"), ( -1, -1, 0x54, 0x54, 0xa0, "ds_write_b8_d16_hi"), ( -1, -1, 0x55, 0x55, 0xa1, "ds_write_b16_d16_hi"), ( -1, -1, 0x56, 0x56, 0xa2, "ds_read_u8_d16"), ( -1, -1, 0x57, 0x57, 0xa3, "ds_read_u8_d16_hi"), ( -1, -1, 0x58, 0x58, 0xa4, "ds_read_i8_d16"), ( -1, -1, 0x59, 0x59, 0xa5, "ds_read_i8_d16_hi"), ( -1, -1, 0x5a, 0x5a, 0xa6, "ds_read_u16_d16"), ( -1, -1, 0x5b, 0x5b, 0xa7, "ds_read_u16_d16_hi"), (0x60, 0x60, 0x60, 0x60, 0x60, "ds_add_rtn_u64"), (0x61, 0x61, 0x61, 0x61, 0x61, "ds_sub_rtn_u64"), (0x62, 0x62, 0x62, 0x62, 0x62, "ds_rsub_rtn_u64"), (0x63, 0x63, 0x63, 0x63, 0x63, "ds_inc_rtn_u64"), (0x64, 0x64, 0x64, 0x64, 0x64, "ds_dec_rtn_u64"), (0x65, 0x65, 0x65, 0x65, 0x65, "ds_min_rtn_i64"), (0x66, 0x66, 0x66, 0x66, 0x66, "ds_max_rtn_i64"), (0x67, 0x67, 0x67, 0x67, 0x67, "ds_min_rtn_u64"), (0x68, 0x68, 0x68, 0x68, 0x68, "ds_max_rtn_u64"), (0x69, 0x69, 0x69, 0x69, 0x69, "ds_and_rtn_b64"), (0x6a, 0x6a, 0x6a, 0x6a, 0x6a, "ds_or_rtn_b64"), (0x6b, 0x6b, 0x6b, 0x6b, 0x6b, "ds_xor_rtn_b64"), (0x6c, 0x6c, 0x6c, 0x6c, 0x6c, "ds_mskor_rtn_b64"), (0x6d, 0x6d, 0x6d, 0x6d, 0x6d, "ds_wrxchg_rtn_b64"), (0x6e, 0x6e, 0x6e, 0x6e, 0x6e, "ds_wrxchg2_rtn_b64"), (0x6f, 0x6f, 0x6f, 0x6f, 0x6f, "ds_wrxchg2st64_rtn_b64"), (0x70, 0x70, 0x70, 0x70, 0x70, "ds_cmpst_rtn_b64"), (0x71, 0x71, 0x71, 0x71, 0x71, "ds_cmpst_rtn_f64"), (0x72, 0x72, 0x72, 0x72, 0x72, "ds_min_rtn_f64"), (0x73, 0x73, 0x73, 0x73, 0x73, "ds_max_rtn_f64"), (0x76, 0x76, 0x76, 0x76, 0x76, "ds_read_b64"), (0x77, 0x77, 0x77, 0x77, 0x77, "ds_read2_b64"), (0x78, 0x78, 0x78, 0x78, 0x78, "ds_read2st64_b64"), ( -1, 0x7e, 0x7e, 0x7e, 0x7e, "ds_condxchg32_rtn_b64"), (0x80, 0x80, 0x80, 0x80, 0x80, "ds_add_src2_u32"), (0x81, 0x81, 0x81, 0x81, 0x81, "ds_sub_src2_u32"), (0x82, 0x82, 0x82, 0x82, 0x82, "ds_rsub_src2_u32"), (0x83, 0x83, 0x83, 0x83, 0x83, "ds_inc_src2_u32"), (0x84, 0x84, 0x84, 0x84, 0x84, "ds_dec_src2_u32"), (0x85, 0x85, 0x85, 0x85, 0x85, "ds_min_src2_i32"), (0x86, 0x86, 0x86, 0x86, 0x86, "ds_max_src2_i32"), (0x87, 0x87, 0x87, 0x87, 0x87, "ds_min_src2_u32"), (0x88, 0x88, 0x88, 0x88, 0x88, "ds_max_src2_u32"), (0x89, 0x89, 0x89, 0x89, 0x89, "ds_and_src2_b32"), (0x8a, 0x8a, 0x8a, 0x8a, 0x8a, "ds_or_src2_b32"), (0x8b, 0x8b, 0x8b, 0x8b, 0x8b, "ds_xor_src2_b32"), (0x8d, 0x8d, 0x8d, 0x8d, 0x8d, "ds_write_src2_b32"), (0x92, 0x92, 0x92, 0x92, 0x92, "ds_min_src2_f32"), (0x93, 0x93, 0x93, 0x93, 0x93, "ds_max_src2_f32"), ( -1, -1, 0x95, 0x95, 0x95, "ds_add_src2_f32"), ( -1, 0x18, 0x98, 0x98, 0x18, "ds_gws_sema_release_all"), (0x19, 0x19, 0x99, 0x99, 0x19, "ds_gws_init"), (0x1a, 0x1a, 0x9a, 0x9a, 0x1a, "ds_gws_sema_v"), (0x1b, 0x1b, 0x9b, 0x9b, 0x1b, "ds_gws_sema_br"), (0x1c, 0x1c, 0x9c, 0x9c, 0x1c, "ds_gws_sema_p"), (0x1d, 0x1d, 0x9d, 0x9d, 0x1d, "ds_gws_barrier"), ( -1, -1, 0xb6, 0xb6, 0xb1, "ds_read_addtid_b32"), (0x3d, 0x3d, 0xbd, 0xbd, 0x3d, "ds_consume"), (0x3e, 0x3e, 0xbe, 0xbe, 0x3e, "ds_append"), (0x3f, 0x3f, 0xbf, 0xbf, 0x3f, "ds_ordered_count"), (0xc0, 0xc0, 0xc0, 0xc0, 0xc0, "ds_add_src2_u64"), (0xc1, 0xc1, 0xc1, 0xc1, 0xc1, "ds_sub_src2_u64"), (0xc2, 0xc2, 0xc2, 0xc2, 0xc2, "ds_rsub_src2_u64"), (0xc3, 0xc3, 0xc3, 0xc3, 0xc3, "ds_inc_src2_u64"), (0xc4, 0xc4, 0xc4, 0xc4, 0xc4, "ds_dec_src2_u64"), (0xc5, 0xc5, 0xc5, 0xc5, 0xc5, "ds_min_src2_i64"), (0xc6, 0xc6, 0xc6, 0xc6, 0xc6, "ds_max_src2_i64"), (0xc7, 0xc7, 0xc7, 0xc7, 0xc7, "ds_min_src2_u64"), (0xc8, 0xc8, 0xc8, 0xc8, 0xc8, "ds_max_src2_u64"), (0xc9, 0xc9, 0xc9, 0xc9, 0xc9, "ds_and_src2_b64"), (0xca, 0xca, 0xca, 0xca, 0xca, "ds_or_src2_b64"), (0xcb, 0xcb, 0xcb, 0xcb, 0xcb, "ds_xor_src2_b64"), (0xcd, 0xcd, 0xcd, 0xcd, 0xcd, "ds_write_src2_b64"), (0xd2, 0xd2, 0xd2, 0xd2, 0xd2, "ds_min_src2_f64"), (0xd3, 0xd3, 0xd3, 0xd3, 0xd3, "ds_max_src2_f64"), ( -1, 0xde, 0xde, 0xde, 0xde, "ds_write_b96"), ( -1, 0xdf, 0xdf, 0xdf, 0xdf, "ds_write_b128"), ( -1, 0xfd, 0xfd, -1, -1, "ds_condxchg32_rtn_b128"), ( -1, 0xfe, 0xfe, 0xfe, 0xfe, "ds_read_b96"), ( -1, 0xff, 0xff, 0xff, 0xff, "ds_read_b128"), } for (gfx6, gfx7, gfx8, gfx9, gfx10, name) in DS: opcode(name, gfx7, gfx9, gfx10, Format.DS) # MUBUF instructions: MUBUF = { (0x00, 0x00, 0x00, 0x00, 0x00, "buffer_load_format_x"), (0x01, 0x01, 0x01, 0x01, 0x01, "buffer_load_format_xy"), (0x02, 0x02, 0x02, 0x02, 0x02, "buffer_load_format_xyz"), (0x03, 0x03, 0x03, 0x03, 0x03, "buffer_load_format_xyzw"), (0x04, 0x04, 0x04, 0x04, 0x04, "buffer_store_format_x"), (0x05, 0x05, 0x05, 0x05, 0x05, "buffer_store_format_xy"), (0x06, 0x06, 0x06, 0x06, 0x06, "buffer_store_format_xyz"), (0x07, 0x07, 0x07, 0x07, 0x07, "buffer_store_format_xyzw"), ( -1, -1, 0x08, 0x08, 0x80, "buffer_load_format_d16_x"), ( -1, -1, 0x09, 0x09, 0x81, "buffer_load_format_d16_xy"), ( -1, -1, 0x0a, 0x0a, 0x82, "buffer_load_format_d16_xyz"), ( -1, -1, 0x0b, 0x0b, 0x83, "buffer_load_format_d16_xyzw"), ( -1, -1, 0x0c, 0x0c, 0x84, "buffer_store_format_d16_x"), ( -1, -1, 0x0d, 0x0d, 0x85, "buffer_store_format_d16_xy"), ( -1, -1, 0x0e, 0x0e, 0x86, "buffer_store_format_d16_xyz"), ( -1, -1, 0x0f, 0x0f, 0x87, "buffer_store_format_d16_xyzw"), (0x08, 0x08, 0x10, 0x10, 0x08, "buffer_load_ubyte"), (0x09, 0x09, 0x11, 0x11, 0x09, "buffer_load_sbyte"), (0x0a, 0x0a, 0x12, 0x12, 0x0a, "buffer_load_ushort"), (0x0b, 0x0b, 0x13, 0x13, 0x0b, "buffer_load_sshort"), (0x0c, 0x0c, 0x14, 0x14, 0x0c, "buffer_load_dword"), (0x0d, 0x0d, 0x15, 0x15, 0x0d, "buffer_load_dwordx2"), ( -1, 0x0f, 0x16, 0x16, 0x0f, "buffer_load_dwordx3"), (0x0f, 0x0e, 0x17, 0x17, 0x0e, "buffer_load_dwordx4"), (0x18, 0x18, 0x18, 0x18, 0x18, "buffer_store_byte"), ( -1, -1, -1, 0x19, 0x19, "buffer_store_byte_d16_hi"), (0x1a, 0x1a, 0x1a, 0x1a, 0x1a, "buffer_store_short"), ( -1, -1, -1, 0x1b, 0x1b, "buffer_store_short_d16_hi"), (0x1c, 0x1c, 0x1c, 0x1c, 0x1c, "buffer_store_dword"), (0x1d, 0x1d, 0x1d, 0x1d, 0x1d, "buffer_store_dwordx2"), ( -1, 0x1f, 0x1e, 0x1e, 0x1f, "buffer_store_dwordx3"), (0x1e, 0x1e, 0x1f, 0x1f, 0x1e, "buffer_store_dwordx4"), ( -1, -1, -1, 0x20, 0x20, "buffer_load_ubyte_d16"), ( -1, -1, -1, 0x21, 0x21, "buffer_load_ubyte_d16_hi"), ( -1, -1, -1, 0x22, 0x22, "buffer_load_sbyte_d16"), ( -1, -1, -1, 0x23, 0x23, "buffer_load_sbyte_d16_hi"), ( -1, -1, -1, 0x24, 0x24, "buffer_load_short_d16"), ( -1, -1, -1, 0x25, 0x25, "buffer_load_short_d16_hi"), ( -1, -1, -1, 0x26, 0x26, "buffer_load_format_d16_hi_x"), ( -1, -1, -1, 0x27, 0x27, "buffer_store_format_d16_hi_x"), ( -1, -1, 0x3d, 0x3d, -1, "buffer_store_lds_dword"), (0x71, 0x71, 0x3e, 0x3e, -1, "buffer_wbinvl1"), (0x70, 0x70, 0x3f, 0x3f, -1, "buffer_wbinvl1_vol"), (0x30, 0x30, 0x40, 0x40, 0x30, "buffer_atomic_swap"), (0x31, 0x31, 0x41, 0x41, 0x31, "buffer_atomic_cmpswap"), (0x32, 0x32, 0x42, 0x42, 0x32, "buffer_atomic_add"), (0x33, 0x33, 0x43, 0x43, 0x33, "buffer_atomic_sub"), (0x34, -1, -1, -1, -1, "buffer_atomic_rsub"), (0x35, 0x35, 0x44, 0x44, 0x35, "buffer_atomic_smin"), (0x36, 0x36, 0x45, 0x45, 0x36, "buffer_atomic_umin"), (0x37, 0x37, 0x46, 0x46, 0x37, "buffer_atomic_smax"), (0x38, 0x38, 0x47, 0x47, 0x38, "buffer_atomic_umax"), (0x39, 0x39, 0x48, 0x48, 0x39, "buffer_atomic_and"), (0x3a, 0x3a, 0x49, 0x49, 0x3a, "buffer_atomic_or"), (0x3b, 0x3b, 0x4a, 0x4a, 0x3b, "buffer_atomic_xor"), (0x3c, 0x3c, 0x4b, 0x4b, 0x3c, "buffer_atomic_inc"), (0x3d, 0x3d, 0x4c, 0x4c, 0x3d, "buffer_atomic_dec"), (0x3e, 0x3e, -1, -1, 0x3e, "buffer_atomic_fcmpswap"), (0x3f, 0x3f, -1, -1, 0x3f, "buffer_atomic_fmin"), (0x40, 0x40, -1, -1, 0x40, "buffer_atomic_fmax"), (0x50, 0x50, 0x60, 0x60, 0x50, "buffer_atomic_swap_x2"), (0x51, 0x51, 0x61, 0x61, 0x51, "buffer_atomic_cmpswap_x2"), (0x52, 0x52, 0x62, 0x62, 0x52, "buffer_atomic_add_x2"), (0x53, 0x53, 0x63, 0x63, 0x53, "buffer_atomic_sub_x2"), (0x54, -1, -1, -1, -1, "buffer_atomic_rsub_x2"), (0x55, 0x55, 0x64, 0x64, 0x55, "buffer_atomic_smin_x2"), (0x56, 0x56, 0x65, 0x65, 0x56, "buffer_atomic_umin_x2"), (0x57, 0x57, 0x66, 0x66, 0x57, "buffer_atomic_smax_x2"), (0x58, 0x58, 0x67, 0x67, 0x58, "buffer_atomic_umax_x2"), (0x59, 0x59, 0x68, 0x68, 0x59, "buffer_atomic_and_x2"), (0x5a, 0x5a, 0x69, 0x69, 0x5a, "buffer_atomic_or_x2"), (0x5b, 0x5b, 0x6a, 0x6a, 0x5b, "buffer_atomic_xor_x2"), (0x5c, 0x5c, 0x6b, 0x6b, 0x5c, "buffer_atomic_inc_x2"), (0x5d, 0x5d, 0x6c, 0x6c, 0x5d, "buffer_atomic_dec_x2"), (0x5e, 0x5e, -1, -1, 0x5e, "buffer_atomic_fcmpswap_x2"), (0x5f, 0x5f, -1, -1, 0x5f, "buffer_atomic_fmin_x2"), (0x60, 0x60, -1, -1, 0x60, "buffer_atomic_fmax_x2"), ( -1, -1, -1, -1, 0x71, "buffer_gl0_inv"), ( -1, -1, -1, -1, 0x72, "buffer_gl1_inv"), ( -1, -1, -1, -1, 0x34, "buffer_atomic_csub"), #GFX10.3+. seems glc must be set } for (gfx6, gfx7, gfx8, gfx9, gfx10, name) in MUBUF: opcode(name, gfx7, gfx9, gfx10, Format.MUBUF, is_atomic = "atomic" in name) MTBUF = { (0x00, 0x00, 0x00, 0x00, 0x00, "tbuffer_load_format_x"), (0x01, 0x01, 0x01, 0x01, 0x01, "tbuffer_load_format_xy"), (0x02, 0x02, 0x02, 0x02, 0x02, "tbuffer_load_format_xyz"), (0x03, 0x03, 0x03, 0x03, 0x03, "tbuffer_load_format_xyzw"), (0x04, 0x04, 0x04, 0x04, 0x04, "tbuffer_store_format_x"), (0x05, 0x05, 0x05, 0x05, 0x05, "tbuffer_store_format_xy"), (0x06, 0x06, 0x06, 0x06, 0x06, "tbuffer_store_format_xyz"), (0x07, 0x07, 0x07, 0x07, 0x07, "tbuffer_store_format_xyzw"), ( -1, -1, 0x08, 0x08, 0x08, "tbuffer_load_format_d16_x"), ( -1, -1, 0x09, 0x09, 0x09, "tbuffer_load_format_d16_xy"), ( -1, -1, 0x0a, 0x0a, 0x0a, "tbuffer_load_format_d16_xyz"), ( -1, -1, 0x0b, 0x0b, 0x0b, "tbuffer_load_format_d16_xyzw"), ( -1, -1, 0x0c, 0x0c, 0x0c, "tbuffer_store_format_d16_x"), ( -1, -1, 0x0d, 0x0d, 0x0d, "tbuffer_store_format_d16_xy"), ( -1, -1, 0x0e, 0x0e, 0x0e, "tbuffer_store_format_d16_xyz"), ( -1, -1, 0x0f, 0x0f, 0x0f, "tbuffer_store_format_d16_xyzw"), } for (gfx6, gfx7, gfx8, gfx9, gfx10, name) in MTBUF: opcode(name, gfx7, gfx9, gfx10, Format.MTBUF) IMAGE = { (0x00, "image_load"), (0x01, "image_load_mip"), (0x02, "image_load_pck"), (0x03, "image_load_pck_sgn"), (0x04, "image_load_mip_pck"), (0x05, "image_load_mip_pck_sgn"), (0x08, "image_store"), (0x09, "image_store_mip"), (0x0a, "image_store_pck"), (0x0b, "image_store_mip_pck"), (0x0e, "image_get_resinfo"), (0x60, "image_get_lod"), } # (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (code, code, code, code, code, name) for (code, name) in IMAGE: opcode(name, code, code, code, Format.MIMG) opcode("image_msaa_load", -1, -1, 0x80, Format.MIMG) #GFX10.3+ IMAGE_ATOMIC = { (0x0f, 0x0f, 0x10, "image_atomic_swap"), (0x10, 0x10, 0x11, "image_atomic_cmpswap"), (0x11, 0x11, 0x12, "image_atomic_add"), (0x12, 0x12, 0x13, "image_atomic_sub"), (0x13, -1, -1, "image_atomic_rsub"), (0x14, 0x14, 0x14, "image_atomic_smin"), (0x15, 0x15, 0x15, "image_atomic_umin"), (0x16, 0x16, 0x16, "image_atomic_smax"), (0x17, 0x17, 0x17, "image_atomic_umax"), (0x18, 0x18, 0x18, "image_atomic_and"), (0x19, 0x19, 0x19, "image_atomic_or"), (0x1a, 0x1a, 0x1a, "image_atomic_xor"), (0x1b, 0x1b, 0x1b, "image_atomic_inc"), (0x1c, 0x1c, 0x1c, "image_atomic_dec"), (0x1d, 0x1d, -1, "image_atomic_fcmpswap"), (0x1e, 0x1e, -1, "image_atomic_fmin"), (0x1f, 0x1f, -1, "image_atomic_fmax"), } # (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (gfx6, gfx7, gfx89, gfx89, ???, name) # gfx7 and gfx10 opcodes are the same here for (gfx6, gfx7, gfx89, name) in IMAGE_ATOMIC: opcode(name, gfx7, gfx89, gfx7, Format.MIMG, is_atomic = True) IMAGE_SAMPLE = { (0x20, "image_sample"), (0x21, "image_sample_cl"), (0x22, "image_sample_d"), (0x23, "image_sample_d_cl"), (0x24, "image_sample_l"), (0x25, "image_sample_b"), (0x26, "image_sample_b_cl"), (0x27, "image_sample_lz"), (0x28, "image_sample_c"), (0x29, "image_sample_c_cl"), (0x2a, "image_sample_c_d"), (0x2b, "image_sample_c_d_cl"), (0x2c, "image_sample_c_l"), (0x2d, "image_sample_c_b"), (0x2e, "image_sample_c_b_cl"), (0x2f, "image_sample_c_lz"), (0x30, "image_sample_o"), (0x31, "image_sample_cl_o"), (0x32, "image_sample_d_o"), (0x33, "image_sample_d_cl_o"), (0x34, "image_sample_l_o"), (0x35, "image_sample_b_o"), (0x36, "image_sample_b_cl_o"), (0x37, "image_sample_lz_o"), (0x38, "image_sample_c_o"), (0x39, "image_sample_c_cl_o"), (0x3a, "image_sample_c_d_o"), (0x3b, "image_sample_c_d_cl_o"), (0x3c, "image_sample_c_l_o"), (0x3d, "image_sample_c_b_o"), (0x3e, "image_sample_c_b_cl_o"), (0x3f, "image_sample_c_lz_o"), (0x68, "image_sample_cd"), (0x69, "image_sample_cd_cl"), (0x6a, "image_sample_c_cd"), (0x6b, "image_sample_c_cd_cl"), (0x6c, "image_sample_cd_o"), (0x6d, "image_sample_cd_cl_o"), (0x6e, "image_sample_c_cd_o"), (0x6f, "image_sample_c_cd_cl_o"), } # (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (code, code, code, code, code, name) for (code, name) in IMAGE_SAMPLE: opcode(name, code, code, code, Format.MIMG) IMAGE_GATHER4 = { (0x40, "image_gather4"), (0x41, "image_gather4_cl"), #(0x42, "image_gather4h"), VEGA only? (0x44, "image_gather4_l"), # following instructions have different opcodes according to ISA sheet. (0x45, "image_gather4_b"), (0x46, "image_gather4_b_cl"), (0x47, "image_gather4_lz"), (0x48, "image_gather4_c"), (0x49, "image_gather4_c_cl"), # previous instructions have different opcodes according to ISA sheet. #(0x4a, "image_gather4h_pck"), VEGA only? #(0x4b, "image_gather8h_pck"), VGEA only? (0x4c, "image_gather4_c_l"), (0x4d, "image_gather4_c_b"), (0x4e, "image_gather4_c_b_cl"), (0x4f, "image_gather4_c_lz"), (0x50, "image_gather4_o"), (0x51, "image_gather4_cl_o"), (0x54, "image_gather4_l_o"), (0x55, "image_gather4_b_o"), (0x56, "image_gather4_b_cl_o"), (0x57, "image_gather4_lz_o"), (0x58, "image_gather4_c_o"), (0x59, "image_gather4_c_cl_o"), (0x5c, "image_gather4_c_l_o"), (0x5d, "image_gather4_c_b_o"), (0x5e, "image_gather4_c_b_cl_o"), (0x5f, "image_gather4_c_lz_o"), } # (gfx6, gfx7, gfx8, gfx9, gfx10, name) = (code, code, code, code, code, name) for (code, name) in IMAGE_GATHER4: opcode(name, code, code, code, Format.MIMG) FLAT = { #GFX7, GFX8_9, GFX10 (0x08, 0x10, 0x08, "flat_load_ubyte"), (0x09, 0x11, 0x09, "flat_load_sbyte"), (0x0a, 0x12, 0x0a, "flat_load_ushort"), (0x0b, 0x13, 0x0b, "flat_load_sshort"), (0x0c, 0x14, 0x0c, "flat_load_dword"), (0x0d, 0x15, 0x0d, "flat_load_dwordx2"), (0x0f, 0x16, 0x0f, "flat_load_dwordx3"), (0x0e, 0x17, 0x0e, "flat_load_dwordx4"), (0x18, 0x18, 0x18, "flat_store_byte"), ( -1, 0x19, 0x19, "flat_store_byte_d16_hi"), (0x1a, 0x1a, 0x1a, "flat_store_short"), ( -1, 0x1b, 0x1b, "flat_store_short_d16_hi"), (0x1c, 0x1c, 0x1c, "flat_store_dword"), (0x1d, 0x1d, 0x1d, "flat_store_dwordx2"), (0x1f, 0x1e, 0x1f, "flat_store_dwordx3"), (0x1e, 0x1f, 0x1e, "flat_store_dwordx4"), ( -1, 0x20, 0x20, "flat_load_ubyte_d16"), ( -1, 0x21, 0x21, "flat_load_ubyte_d16_hi"), ( -1, 0x22, 0x22, "flat_load_sbyte_d16"), ( -1, 0x23, 0x23, "flat_load_sbyte_d16_hi"), ( -1, 0x24, 0x24, "flat_load_short_d16"), ( -1, 0x25, 0x25, "flat_load_short_d16_hi"), (0x30, 0x40, 0x30, "flat_atomic_swap"), (0x31, 0x41, 0x31, "flat_atomic_cmpswap"), (0x32, 0x42, 0x32, "flat_atomic_add"), (0x33, 0x43, 0x33, "flat_atomic_sub"), (0x35, 0x44, 0x35, "flat_atomic_smin"), (0x36, 0x45, 0x36, "flat_atomic_umin"), (0x37, 0x46, 0x37, "flat_atomic_smax"), (0x38, 0x47, 0x38, "flat_atomic_umax"), (0x39, 0x48, 0x39, "flat_atomic_and"), (0x3a, 0x49, 0x3a, "flat_atomic_or"), (0x3b, 0x4a, 0x3b, "flat_atomic_xor"), (0x3c, 0x4b, 0x3c, "flat_atomic_inc"), (0x3d, 0x4c, 0x3d, "flat_atomic_dec"), (0x3e, -1, 0x3e, "flat_atomic_fcmpswap"), (0x3f, -1, 0x3f, "flat_atomic_fmin"), (0x40, -1, 0x40, "flat_atomic_fmax"), (0x50, 0x60, 0x50, "flat_atomic_swap_x2"), (0x51, 0x61, 0x51, "flat_atomic_cmpswap_x2"), (0x52, 0x62, 0x52, "flat_atomic_add_x2"), (0x53, 0x63, 0x53, "flat_atomic_sub_x2"), (0x55, 0x64, 0x55, "flat_atomic_smin_x2"), (0x56, 0x65, 0x56, "flat_atomic_umin_x2"), (0x57, 0x66, 0x57, "flat_atomic_smax_x2"), (0x58, 0x67, 0x58, "flat_atomic_umax_x2"), (0x59, 0x68, 0x59, "flat_atomic_and_x2"), (0x5a, 0x69, 0x5a, "flat_atomic_or_x2"), (0x5b, 0x6a, 0x5b, "flat_atomic_xor_x2"), (0x5c, 0x6b, 0x5c, "flat_atomic_inc_x2"), (0x5d, 0x6c, 0x5d, "flat_atomic_dec_x2"), (0x5e, -1, 0x5e, "flat_atomic_fcmpswap_x2"), (0x5f, -1, 0x5f, "flat_atomic_fmin_x2"), (0x60, -1, 0x60, "flat_atomic_fmax_x2"), } for (gfx7, gfx8, gfx10, name) in FLAT: opcode(name, gfx7, gfx8, gfx10, Format.FLAT, is_atomic = "atomic" in name) GLOBAL = { #GFX8_9, GFX10 (0x10, 0x08, "global_load_ubyte"), (0x11, 0x09, "global_load_sbyte"), (0x12, 0x0a, "global_load_ushort"), (0x13, 0x0b, "global_load_sshort"), (0x14, 0x0c, "global_load_dword"), (0x15, 0x0d, "global_load_dwordx2"), (0x16, 0x0f, "global_load_dwordx3"), (0x17, 0x0e, "global_load_dwordx4"), (0x18, 0x18, "global_store_byte"), (0x19, 0x19, "global_store_byte_d16_hi"), (0x1a, 0x1a, "global_store_short"), (0x1b, 0x1b, "global_store_short_d16_hi"), (0x1c, 0x1c, "global_store_dword"), (0x1d, 0x1d, "global_store_dwordx2"), (0x1e, 0x1f, "global_store_dwordx3"), (0x1f, 0x1e, "global_store_dwordx4"), (0x20, 0x20, "global_load_ubyte_d16"), (0x21, 0x21, "global_load_ubyte_d16_hi"), (0x22, 0x22, "global_load_sbyte_d16"), (0x23, 0x23, "global_load_sbyte_d16_hi"), (0x24, 0x24, "global_load_short_d16"), (0x25, 0x25, "global_load_short_d16_hi"), (0x40, 0x30, "global_atomic_swap"), (0x41, 0x31, "global_atomic_cmpswap"), (0x42, 0x32, "global_atomic_add"), (0x43, 0x33, "global_atomic_sub"), (0x44, 0x35, "global_atomic_smin"), (0x45, 0x36, "global_atomic_umin"), (0x46, 0x37, "global_atomic_smax"), (0x47, 0x38, "global_atomic_umax"), (0x48, 0x39, "global_atomic_and"), (0x49, 0x3a, "global_atomic_or"), (0x4a, 0x3b, "global_atomic_xor"), (0x4b, 0x3c, "global_atomic_inc"), (0x4c, 0x3d, "global_atomic_dec"), ( -1, 0x3e, "global_atomic_fcmpswap"), ( -1, 0x3f, "global_atomic_fmin"), ( -1, 0x40, "global_atomic_fmax"), (0x60, 0x50, "global_atomic_swap_x2"), (0x61, 0x51, "global_atomic_cmpswap_x2"), (0x62, 0x52, "global_atomic_add_x2"), (0x63, 0x53, "global_atomic_sub_x2"), (0x64, 0x55, "global_atomic_smin_x2"), (0x65, 0x56, "global_atomic_umin_x2"), (0x66, 0x57, "global_atomic_smax_x2"), (0x67, 0x58, "global_atomic_umax_x2"), (0x68, 0x59, "global_atomic_and_x2"), (0x69, 0x5a, "global_atomic_or_x2"), (0x6a, 0x5b, "global_atomic_xor_x2"), (0x6b, 0x5c, "global_atomic_inc_x2"), (0x6c, 0x5d, "global_atomic_dec_x2"), ( -1, 0x5e, "global_atomic_fcmpswap_x2"), ( -1, 0x5f, "global_atomic_fmin_x2"), ( -1, 0x60, "global_atomic_fmax_x2"), ( -1, 0x16, "global_load_dword_addtid"), #GFX10.3+ ( -1, 0x17, "global_store_dword_addtid"), #GFX10.3+ ( -1, 0x34, "global_atomic_csub"), #GFX10.3+. seems glc must be set } for (gfx8, gfx10, name) in GLOBAL: opcode(name, -1, gfx8, gfx10, Format.GLOBAL, is_atomic = "atomic" in name) SCRATCH = { #GFX8_9, GFX10 (0x10, 0x08, "scratch_load_ubyte"), (0x11, 0x09, "scratch_load_sbyte"), (0x12, 0x0a, "scratch_load_ushort"), (0x13, 0x0b, "scratch_load_sshort"), (0x14, 0x0c, "scratch_load_dword"), (0x15, 0x0d, "scratch_load_dwordx2"), (0x16, 0x0f, "scratch_load_dwordx3"), (0x17, 0x0e, "scratch_load_dwordx4"), (0x18, 0x18, "scratch_store_byte"), (0x19, 0x19, "scratch_store_byte_d16_hi"), (0x1a, 0x1a, "scratch_store_short"), (0x1b, 0x1b, "scratch_store_short_d16_hi"), (0x1c, 0x1c, "scratch_store_dword"), (0x1d, 0x1d, "scratch_store_dwordx2"), (0x1e, 0x1f, "scratch_store_dwordx3"), (0x1f, 0x1e, "scratch_store_dwordx4"), (0x20, 0x20, "scratch_load_ubyte_d16"), (0x21, 0x21, "scratch_load_ubyte_d16_hi"), (0x22, 0x22, "scratch_load_sbyte_d16"), (0x23, 0x23, "scratch_load_sbyte_d16_hi"), (0x24, 0x24, "scratch_load_short_d16"), (0x25, 0x25, "scratch_load_short_d16_hi"), } for (gfx8, gfx10, name) in SCRATCH: opcode(name, -1, gfx8, gfx10, Format.SCRATCH) # check for duplicate opcode numbers for ver in ['gfx9', 'gfx10']: op_to_name = {} for op in opcodes.values(): if op.format in [Format.PSEUDO, Format.PSEUDO_BRANCH, Format.PSEUDO_BARRIER, Format.PSEUDO_REDUCTION]: continue num = getattr(op, 'opcode_' + ver) if num == -1: continue key = (op.format, num) if key in op_to_name: # exceptions names = set([op_to_name[key], op.name]) if ver in ['gfx8', 'gfx9'] and names == set(['v_mul_lo_i32', 'v_mul_lo_u32']): continue # v_mad_legacy_f32 is replaced with v_fma_legacy_f32 on GFX10.3 if ver == 'gfx10' and names == set(['v_mad_legacy_f32', 'v_fma_legacy_f32']): continue print('%s and %s share the same opcode number (%s)' % (op_to_name[key], op.name, ver)) sys.exit(1) else: op_to_name[key] = op.name
49.378019
154
0.603999
12,585
81,770
3.660389
0.099801
0.027352
0.0183
0.005905
0.287696
0.212738
0.142839
0.111145
0.077845
0.074024
0
0.219403
0.208499
81,770
1,655
155
49.407855
0.49236
0.071493
0
0.048136
0
0.001356
0.250644
0.042557
0
0
0.205657
0.000604
0.005424
1
0.004746
false
0
0.001356
0.002034
0.039322
0.000678
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
a2bb2eaff4ee821ffa4339ec8d2452438080f0f8
104
py
Python
Project Euler/pe16.py
NicolasBizzozzero/Online-Judges
e0b492d2eb301cc46691cd9809ea54e8c13cbed0
[ "Unlicense" ]
null
null
null
Project Euler/pe16.py
NicolasBizzozzero/Online-Judges
e0b492d2eb301cc46691cd9809ea54e8c13cbed0
[ "Unlicense" ]
null
null
null
Project Euler/pe16.py
NicolasBizzozzero/Online-Judges
e0b492d2eb301cc46691cd9809ea54e8c13cbed0
[ "Unlicense" ]
null
null
null
nombreACalculer = str(2**1000) somme=0 for i in nombreACalculer: somme += int(i) print(somme) input()
14.857143
30
0.711538
16
104
4.625
0.75
0
0
0
0
0
0
0
0
0
0
0.067416
0.144231
104
7
31
14.857143
0.764045
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.166667
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
a2ce5db0c8672a336fe2498a057a21c75758e51b
117
py
Python
code/controls_test.py
dlaredo/stochastic_dynamics
a851d8fe1e88f5bafa187c4d43c21c7904716670
[ "MIT" ]
null
null
null
code/controls_test.py
dlaredo/stochastic_dynamics
a851d8fe1e88f5bafa187c4d43c21c7904716670
[ "MIT" ]
null
null
null
code/controls_test.py
dlaredo/stochastic_dynamics
a851d8fe1e88f5bafa187c4d43c21c7904716670
[ "MIT" ]
null
null
null
import numpy as np def main(): X1, X2 = grid_sample([0, 0], [-5, -5], [50, 50]) print(X1) print(X2) main()
8.357143
49
0.538462
21
117
2.952381
0.666667
0
0
0
0
0
0
0
0
0
0
0.134831
0.239316
117
14
50
8.357143
0.561798
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
true
0
0.166667
0
0.333333
0.333333
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
a2d247ce6854cd073caaf571f9e2022ada3065d2
63
py
Python
week3/3.05 modules/step02 math.py
project-cemetery/stepik-programming-on-python
3ca4e6a74b9ca5deb50336737fe2e6d74722a95f
[ "MIT" ]
7
2020-08-03T22:10:29.000Z
2022-02-23T16:08:44.000Z
week3/3.05 modules/step02 math.py
Joni2701/stepik-programming-on-python
3ca4e6a74b9ca5deb50336737fe2e6d74722a95f
[ "MIT" ]
null
null
null
week3/3.05 modules/step02 math.py
Joni2701/stepik-programming-on-python
3ca4e6a74b9ca5deb50336737fe2e6d74722a95f
[ "MIT" ]
9
2020-05-19T16:42:39.000Z
2022-02-24T22:41:21.000Z
import math r = float(input()) p = 2 * math.pi * r print(p)
7.875
19
0.571429
12
63
3
0.75
0
0
0
0
0
0
0
0
0
0
0.021277
0.253968
63
7
20
9
0.744681
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
a2d2894df3c271d1642fefe02e2c35107e042303
248
py
Python
output/models/nist_data/list_pkg/double/schema_instance/nistschema_sv_iv_list_double_min_length_5_xsd/__init__.py
tefra/xsdata-w3c-tests
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
[ "MIT" ]
1
2021-08-14T17:59:21.000Z
2021-08-14T17:59:21.000Z
output/models/nist_data/list_pkg/double/schema_instance/nistschema_sv_iv_list_double_min_length_5_xsd/__init__.py
tefra/xsdata-w3c-tests
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
[ "MIT" ]
4
2020-02-12T21:30:44.000Z
2020-04-15T20:06:46.000Z
output/models/nist_data/list_pkg/double/schema_instance/nistschema_sv_iv_list_double_min_length_5_xsd/__init__.py
tefra/xsdata-w3c-tests
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
[ "MIT" ]
null
null
null
from output.models.nist_data.list_pkg.double.schema_instance.nistschema_sv_iv_list_double_min_length_5_xsd.nistschema_sv_iv_list_double_min_length_5 import NistschemaSvIvListDoubleMinLength5 __all__ = [ "NistschemaSvIvListDoubleMinLength5", ]
41.333333
190
0.891129
31
248
6.419355
0.645161
0.120603
0.140704
0.180905
0.341709
0.341709
0.341709
0.341709
0
0
0
0.017094
0.056452
248
5
191
49.6
0.833333
0
0
0
0
0
0.137097
0.137097
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
a2f84d4279f1caa8e26e209d204305c903189414
567
py
Python
abprocess/process.py
marcadeant/ADSL_connector
21e99cb151ed7651f148d37950ecd1ec9ca403db
[ "ADSL" ]
null
null
null
abprocess/process.py
marcadeant/ADSL_connector
21e99cb151ed7651f148d37950ecd1ec9ca403db
[ "ADSL" ]
null
null
null
abprocess/process.py
marcadeant/ADSL_connector
21e99cb151ed7651f148d37950ecd1ec9ca403db
[ "ADSL" ]
null
null
null
from dataclasses import dataclass from abprocess.authenticator import Authenticator from abprocess.booking_course import BookingCourse from time import sleep from abprocess.constants import TIME_SLEEP @dataclass class Process: authenticator: Authenticator booking_course: BookingCourse def process(self): self.authenticator.adsl_connector() # Keeping the same session opened by authenticator class browser = self.authenticator.browser sleep(TIME_SLEEP) self.booking_course.booking_courses_by_priorities(browser)
29.842105
66
0.783069
63
567
6.904762
0.428571
0.089655
0
0
0
0
0
0
0
0
0
0
0.174603
567
18
67
31.5
0.929487
0.095238
0
0
0
0
0
0
0
0
0
0
0
1
0.071429
false
0
0.357143
0
0.642857
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
a2fbeabecd05511b0b03a5c67c6b81cc3edbf11e
3,229
py
Python
mptpy/mpt.py
CognitiveComputationLab/mptpy
820fb6c9019623bc98f14c894ced9ed5d70eb96b
[ "MIT" ]
null
null
null
mptpy/mpt.py
CognitiveComputationLab/mptpy
820fb6c9019623bc98f14c894ced9ed5d70eb96b
[ "MIT" ]
12
2018-02-26T14:06:16.000Z
2018-09-05T10:27:01.000Z
mptpy/mpt.py
CognitiveComputationLab/mptpy
820fb6c9019623bc98f14c894ced9ed5d70eb96b
[ "MIT" ]
1
2022-03-03T07:14:36.000Z
2022-03-03T07:14:36.000Z
""" Data structure for Multinomial Processing Trees (MPTs). """ from mptpy.mpt_word import MPTWord import mptpy.tools.transformations as trans # pylint: disable=import-error from mptpy.visualization.visualize_mpt import cmd_draw # pylint: disable=import-error from mptpy.tools import misc class MPT(object): """ Multinomial Processing Tree (MPT) data structure. """ def __init__(self, mpt, sep=" ", leaf_test=None): """ Constructs the MPT object. Parameters ---------- mpt : [str, Node] either tree in bmpt or as root object. """ self.subtrees = [] self.word = None self.root = None # mpt given as word if isinstance(mpt, str): self.word = MPTWord(mpt, sep=sep, leaf_test=leaf_test) self.root = trans.word_to_nodes(self.word) # mpt given as root node else: self.root = mpt self.word = MPTWord(str(self)) @property def params(self): return self.word.parameters @property def categories(self): return self.word.answers def formulae(self): """ Calculate the branch formulae for the categories in the tree Returns ------- dict {category : formulae} """ return trans.get_formulae(self) def max_parameters(self): """ The maximal number of free parameters in the model Returns ------- int max number of free parameters """ return sum([len(subtree) - 1 for subtree in self.subtrees]) def get_levels(self, node, level=0): """ Generate a dict with all nodes and their respective level 0 is the root Parameters ---------- node : Node starting node level : int, optional level from which to start counting """ levels = {level: [node]} if not node.leaf: left_dict = self.get_levels(node.pos, level=level + 1) right_dict = self.get_levels(node.neg, level=level + 1) temp = misc.merge_dicts(left_dict, right_dict) levels.update(temp) return levels def save(self, path, form="easy"): """ Saves the tree to a file Parameters ---------- path : str where to save the tree """ to_print = trans.to_easy(self) if form == "easy" else self.word.str_ misc.write_iterable_to_file(path, to_print, newline=False) def draw(self): """ Draw MPT to the command line """ cmd_draw(self) def __eq__(self, other): return self.word.abstract() == other.word.abstract() def __ne__(self, other): return not self.__eq__(other) def __str__(self): if self.word: return self.word.str_ sep = " " def dfs(node): """ depth first search """ if node.leaf: return str(node.content) pos = dfs(node.pos) neg = dfs(node.neg) return node.content + sep + pos + sep + neg return dfs(self.root)
22.739437
86
0.551254
382
3,229
4.536649
0.32199
0.046163
0.032314
0.027698
0.06232
0.038084
0
0
0
0
0
0.002367
0.345928
3,229
141
87
22.900709
0.818182
0.27315
0
0.037736
0
0
0.004871
0
0
0
0
0
0
1
0.226415
false
0
0.075472
0.075472
0.528302
0.037736
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
0c05d56037b91b57f276bc2c0216c9fc0ebc480f
5,156
py
Python
CodeSignal/sumOfTwo.py
NickStrick/Code-Challenges
b6c13357783d3b556e90349ccc6f9bb568a3531d
[ "MIT" ]
null
null
null
CodeSignal/sumOfTwo.py
NickStrick/Code-Challenges
b6c13357783d3b556e90349ccc6f9bb568a3531d
[ "MIT" ]
null
null
null
CodeSignal/sumOfTwo.py
NickStrick/Code-Challenges
b6c13357783d3b556e90349ccc6f9bb568a3531d
[ "MIT" ]
null
null
null
# https://app.codesignal.com/interview-practice/task/Hm98RnqK9Be575yoj # https://youtu.be/va1IqN0uplE def sumOfTwo(a, b, v): pass # examples are sorted, but are we going to actually get sorted input? # no, input arrays may not be sorted # sort the two arrays # could we use a similar two pointer strategy? # if we're hash tables, what is going in the hash tables? # store the elements of one of the arrays in the hash table # make a sum of an element from a and an element from b # check if they equal v # does moving all of the elements from one array into a hash table help us? # hash tables help us with lookups # loop through each element x in b # check if v - x is in the hash table # as soon as we see that some v - x is in the table # then we've found a pair # return true # no pair was found, return false # alternative strategy that utilizes a hash table # can we consider a "easier" problem? # if we only had a single array and had to find two values in it # #thatummeduptov,howwouldwedothat def sum_of_two(arr, v): pass # sort the input array # use the 2 pointer technique: # init one pointer at the start of the array # init another pointer at the end of the array # would we ever allow the two pointers to pass each other? # if the pointers pass each other, then we'd just be considering # two values we've already looked at; we shouldn't see a new combo # by having the pointers pass each other # break out of the loop if the pointers pass each other # there's no two numbers that sum up to v # if sum of both pointers == v # return # check if the sum of both pointers == v # if the sum of both pointers < v # then that means we need a larger sum # increment the left pointer # if the sum of both pointers > v # then that means we need a smaller sum # decrement the right pointer # Solution that uses the two-pointer technique def sumOfTwo(a, b, v): # sort both input arrays a.sort() b.sort() # using the two pointer technique # start one pointer at the beginning of one of the arrays ap = 0 # start another pointer at the end of the other array bp = len(b) - 1 # loop so long as neither of the pointers has reached the other # side of its respective array while ap < len(a) and bp >= 0: sum = a[ap] + b[bp] # check the sum of both pointers if sum == v: return True # if the sum < v, we need a larger sum if sum < v: # increment the a pointer ap += 1 # if the sum > v, we need a smaller sum if sum > v: # decrement the b pointer bp -= 1 # no such pair found return False # Solution that uses a set def sumOfTwo(a, b, v): # init a set to hold all of the elements of one of the arrays s = set(a) # traverse each element in the other array for x in b: # check if v - x is in the set if v - x in s: # as soon as we see that some v - x is in the set # then we've found a pair return True # no pair was found, return false return False # Rust Implementation # use std::collections::HashSet; # ​ # fn sum_of_two(a: Vec<i32>, b: Vec<i32>, v: i32) -> bool { # // init a set containing v - x for each x in array a # let set: HashSet<i32> = a.iter() # .map(|x| v - x) # .collect(); # // check if any element in b is contained in the set # b.iter().any(|x| set.contains(x)) # } def sumOfTwo(a, b, v): # are the arrays sorted? # no, don't assume the arrays are sorted # O(2(n log n)) runtime, O(1) space # would sorting be helpful? # sort both arrays # use a two-pointer technique, one in each array # start one of the pointers are the beginning of one of the arrays # start the other pointer at the end of the other array # loop so long as both pointers are still within bounds of their respective arrays # if the sum of both these pointer values == v, return true # if the sum of both these pointer values < v, then we need a larger value # increment the pointer at the start of the array # if the sum of both these pointer values > v, then we need a smaller value # decrement the pointer at the end of the array # the above idea is a variant of the sliding window technique # the idea: having pointers at opposite ends of a sorted array # if the sum of the two pointers is too small, increment the "left" pointer # if the sum of the two pointers is too big, decrement the "right" pointer # O(a + b) runtime, O(a) space # O(a) runtime, O(a) space # iterate through the a array # add each element to a set # O(b) runtime # iterate through the other array # calculate v - current element # check if v - current element is in the set # if it is, then we've found our elements # return true # if we loop through all of b and don't find anything in the set # then no such pair exists # return false
34.837838
86
0.643328
878
5,156
3.773349
0.240319
0.027166
0.024147
0.024147
0.336251
0.283429
0.259583
0.174162
0.142167
0.1147
0
0.006599
0.294608
5,156
147
87
35.07483
0.904317
0.783165
0
0.4
0
0
0
0
0
0
0
0
0
0
null
null
0.08
0
null
null
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
1
0
0
0
0
0
2
0c14a3d1903263ddeda1ff997dcbf45a916e3e64
2,352
py
Python
projeto/core/migrations/0001_initial.py
roseanersn/projeto_heroku
c9885d0455ceeba63d582f0c2558f339e261b5af
[ "Apache-2.0" ]
null
null
null
projeto/core/migrations/0001_initial.py
roseanersn/projeto_heroku
c9885d0455ceeba63d582f0c2558f339e261b5af
[ "Apache-2.0" ]
null
null
null
projeto/core/migrations/0001_initial.py
roseanersn/projeto_heroku
c9885d0455ceeba63d582f0c2558f339e261b5af
[ "Apache-2.0" ]
1
2019-05-07T01:09:44.000Z
2019-05-07T01:09:44.000Z
# Generated by Django 2.2 on 2019-05-01 00:57 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Aluno', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('aluno_nome', models.CharField(max_length=50, verbose_name='Nome Aluno')), ('aluno_ra', models.CharField(max_length=7, verbose_name='RA Aluno')), ], ), migrations.CreateModel( name='Curso', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('nome', models.CharField(max_length=50, verbose_name='Nome')), ('sigla', models.CharField(max_length=5, verbose_name='Sigla')), ('etiqueta', models.SlugField(verbose_name='Etiqueta')), ], ), migrations.CreateModel( name='Disciplina', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('nome', models.CharField(max_length=50, verbose_name='Nome')), ('etiqueta', models.SlugField(verbose_name='Etiqueta')), ('carga_horaria', models.IntegerField(verbose_name='Carga Horária')), ], ), migrations.CreateModel( name='Professor', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('professor_nome', models.CharField(max_length=50, verbose_name='Nome Professor')), ('professor_re', models.CharField(max_length=7, verbose_name='Registro Professor')), ], ), migrations.CreateModel( name='Usuario', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('usu_nome', models.CharField(max_length=50, verbose_name='Nome Usuario')), ('usu_senha', models.CharField(max_length=6, verbose_name='Senha Usuario')), ], ), ]
41.263158
114
0.573129
233
2,352
5.600858
0.248927
0.143295
0.124138
0.165517
0.594636
0.594636
0.530268
0.475096
0.475096
0.371648
0
0.016687
0.286565
2,352
56
115
42
0.761025
0.018282
0
0.591837
1
0
0.119636
0
0
0
0
0
0
1
0
false
0
0.020408
0
0.102041
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
0c330615551a802c83e4375fdfca982116669ad0
2,673
py
Python
python-examples-master/pilha-poo.py
alverad-katsuro/Python
6ba3cc604fd9cde3ee012fcf17bbf6cd944e8c38
[ "MIT" ]
null
null
null
python-examples-master/pilha-poo.py
alverad-katsuro/Python
6ba3cc604fd9cde3ee012fcf17bbf6cd944e8c38
[ "MIT" ]
null
null
null
python-examples-master/pilha-poo.py
alverad-katsuro/Python
6ba3cc604fd9cde3ee012fcf17bbf6cd944e8c38
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- from os import system class Cliente(object): # Classe cliente, vazia pois pode ser atribuido pass # propriedades mais tarde class Pilha(object): # Classe Pilha def __init__(self): # metodo construtor self.pilha = [] # declara lista vazia sendo propriedade da classe def incluir(self): "Inclui um cliente na pilha" cliente = Cliente() # instancia objeto cliente cliente.nome = raw_input('Nome: ') # inclui propriedade nome no objeto com valor digitado cliente.telefone = raw_input('Telefone: ') # inclui propriedade nome no objeto com valor digitado cliente.cpf = raw_input('CPF: ') # inclui propriedade cpf no objeto com valor digitado self.pilha.insert(0, cliente) # insere sempre na primeira posicao def consultar(self): "Lista todos os items" for item in self.pilha: # faz uma iteracao em todos os items da lista print '\nNome: ' + item.nome print 'Telefone: ' + item.telefone print 'CPF: ' + item.cpf raw_input() # aguarda tecla enter def excluir(self): "Exclui o primeiro item da lista" if len(self.pilha) > 0: # pega tamanho da pilha e compara self.pilha.pop(0) # exclui item da posicao 0 print 'Excluido' else: print 'Pilha vazia' raw_input() # aguarda tecla enter def main(): def limpa(): "Limpa a tela" system('cls') p = Pilha() # instancia objeto Pilha atribuindo para p while True: # loop infinito, sempre verdadeiro limpa() print("\n1. Incluir: ") print("\n2. Consultar: ") print("\n3. Excluir: ") print("\n4. Sair: \n") try: # tenta fazer op = int(raw_input()) # pega a entrada do teclado e converte para int if op == 1: # caso der erro na conversao cai no except abaixo limpa() p.incluir() # chama metodo incluir do objeto p (pilha) elif op == 2: limpa() p.consultar() # chama metodo consultar do objeto p (pilha) elif op == 3: limpa() p.excluir() # chama metodo excluir do objeto p (pilha) elif op == 4: break # quebra o loop e fecha o programa else: print 'Opcao invalida' except: # caso tenha execao, (por exemplo digitar uma letra) sera exec print 'Opcao invalida, digite um numero' main() # chama o main, primeira funcao a ser executada
36.616438
106
0.572765
326
2,673
4.665644
0.43865
0.031558
0.021696
0.031558
0.160421
0.144642
0.068376
0.068376
0.068376
0
0
0.007365
0.339693
2,673
72
107
37.125
0.854391
0.371867
0
0.107143
0
0
0.156269
0
0
0
0
0.013889
0
0
null
null
0.017857
0.017857
null
null
0.196429
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
1
0
0
0
0
0
0
0
0
2
0c3a0dd756de2ab9a9495f6323067fdc0ecde5a1
165
py
Python
Code(Temp Identity)/Extra Code for testing cases/43423.py
ayushcv/TemperatureIdentity
0ee51e7c470ad8dd3b4afdf5384b004768490f38
[ "MIT" ]
2
2021-01-30T03:11:32.000Z
2022-03-10T20:44:37.000Z
Code(Temp Identity)/Extra Code for testing cases/43423.py
ayushcv/TemperatureIdentity
0ee51e7c470ad8dd3b4afdf5384b004768490f38
[ "MIT" ]
null
null
null
Code(Temp Identity)/Extra Code for testing cases/43423.py
ayushcv/TemperatureIdentity
0ee51e7c470ad8dd3b4afdf5384b004768490f38
[ "MIT" ]
null
null
null
import requests url = 'https://ayushcv.github.io' file = {"myFile":open('/home/pi/Resources12/database','a')} #Upload File response = requests.post(url, files=file)
27.5
59
0.721212
23
165
5.173913
0.826087
0
0
0
0
0
0
0
0
0
0
0.013245
0.084848
165
6
60
27.5
0.774834
0.066667
0
0
0
0
0.396104
0.188312
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
0c567cf6251f716a0f828377a924f6aa5df476f6
1,783
py
Python
pymatgen/db/builders/util.py
chc273/pymatgen-db
29487993e8c147ef3b3bbdb1ad8306e8b79a47e4
[ "MIT" ]
33
2015-07-15T14:14:40.000Z
2021-11-12T12:50:57.000Z
pymatgen/db/builders/util.py
chc273/pymatgen-db
29487993e8c147ef3b3bbdb1ad8306e8b79a47e4
[ "MIT" ]
24
2015-04-29T13:15:05.000Z
2022-03-21T13:14:31.000Z
pymatgen/db/builders/util.py
chc273/pymatgen-db
29487993e8c147ef3b3bbdb1ad8306e8b79a47e4
[ "MIT" ]
42
2015-02-11T19:48:29.000Z
2022-03-21T20:52:56.000Z
""" Common utility functions for the database functions """ __author__ = "Dan Gunter <dkgunter@lbl.gov>" __date__ = "11/4/13" ## Imports import logging # Stdlib import os # Local import pymatgen ## Globals ## Functions and Classes _top_dir = os.path.dirname(os.path.abspath(pymatgen.db.__file__)) def get_test_dir(name=None): """Get path to subdirectory with test files related to a given class. :param name: Name of class :return: Path :rtype: str """ subdir = name + "_test" return os.path.join(_top_dir, "..", "test_files", subdir) def get_schema_dir(db_version=1): """Get path to directory with schemata. :param db_version: Version of the database :type db_version: int :return: Path :rtype: str """ v = str(db_version) return os.path.join(_top_dir, "..", "schemata", "versions", v) def get_schema_file(db_version=1, db="mg_core", collection="materials"): """Get file with appropriate schema. :param db_version: Version of the database :type db_version: int :param db: Name of database, e.g. 'mg_core' :type db: str :param collection: Name of collection, e.g. 'materials' :type collection: str :return: File with schema :rtype: file :raise: IOError, if file is not found or not accessible """ d = get_schema_dir(db_version=db_version) schemafile = "{}.{}.json".format(db, collection) f = open(os.path.join(d, schemafile), "r") return f def get_builder_log(name): """Get a logging object, in the right place in the hierarchy, for a given builder. :param name: Builder name, e.g. 'my_builder' :type name: str :returns: New logger :rtype: logging.Logger """ return logging.getLogger("mg.builders." + name)
22.858974
72
0.661806
254
1,783
4.480315
0.38189
0.071178
0.026362
0.031634
0.163445
0.126538
0.087873
0.087873
0.087873
0.087873
0
0.005004
0.215367
1,783
77
73
23.155844
0.808435
0.487942
0
0
0
0
0.142857
0
0
0
0
0
0
1
0.210526
false
0
0.157895
0
0.578947
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
0c583ad6ca29f835349374c9c29ddb862f3b29b8
3,062
py
Python
stix2matcher/test/test_timestamps.py
oasis-open/cti-pattern-matcher
1ad275395665d2133be62fd7a824cacf0acbe37a
[ "BSD-3-Clause" ]
32
2017-02-22T14:54:01.000Z
2022-02-21T09:10:02.000Z
stix2matcher/test/test_timestamps.py
sthagen/cti-pattern-matcher
37c74012b4f49eca2fe2de3c4e5ed079fc50b619
[ "BSD-3-Clause" ]
44
2016-11-03T21:41:53.000Z
2022-03-30T15:22:23.000Z
stix2matcher/test/test_timestamps.py
sthagen/cti-pattern-matcher
37c74012b4f49eca2fe2de3c4e5ed079fc50b619
[ "BSD-3-Clause" ]
23
2016-11-07T19:03:13.000Z
2021-06-10T10:12:36.000Z
import pytest from stix2patterns.pattern import ParseException from stix2matcher.matcher import MatcherException, match _observations = [ { "type": "observed-data", "first_observed": "1983-04-21T15:31:06Z", "last_observed": "1983-04-21T15:31:06Z", "number_observed": 1, "objects": { "0": { "type": "event", "good_ts": u"2010-05-21T13:21:43Z", "good_ts_frac": u"2010-05-21T13:21:43.1234Z", "good_ts_frac_nano": u"2010-05-21T13:21:43.123456789Z", "bad_ts": [ u"2010-05-21T13:21:43", u"2010-05-21T13:21:43z", u"2010-05-21t13:21:43Z", u"2010/05/21T13:21:43Z", u"2010-05-21T13:21:99Z", u"2010-05-21T13:21Z" ] } } } ] @pytest.mark.parametrize("pattern", [ "[event:good_ts = t'2010-05-21T13:21:43Z']", "[event:good_ts != t'1974-11-05T05:31:11Z']", "[event:good_ts > t'1974-11-05T05:31:11Z']", "[event:good_ts < t'3012-08-17T17:43:55Z']", "[event:good_ts_frac = t'2010-05-21T13:21:43.1234Z']", "[event:good_ts_frac_nano = t'2010-05-21T13:21:43.123456789Z']", "[event:good_ts IN (t'1953-11-26T14:25:33Z', t'2010-05-21T13:21:43Z', t'2000-06-17T17:25:51.44Z')]", "[event:good_ts NOT IN (t'1953-11-26T14:25:33Z', t'1985-07-25T20:27:52Z', t'2000-06-17T17:25:51.44Z')]" ]) def test_ts_match(pattern): assert match(pattern, _observations) @pytest.mark.parametrize("pattern", [ # Same as above with operators reversed. "[event:good_ts != t'2010-05-21T13:21:43Z']", "[event:good_ts = t'1974-11-05T05:31:11Z']", "[event:good_ts <= t'1974-11-05T05:31:11Z']", "[event:good_ts >= t'3012-08-17T17:43:55Z']", "[event:good_ts_frac != t'2010-05-21T13:21:43.1234Z']", "[event:good_ts_frac_nano != t'2010-05-21T13:21:43.123456789Z']", "[event:good_ts NOT IN (t'1953-11-26T14:25:33Z', t'2010-05-21T13:21:43Z', t'2000-06-17T17:25:51.44Z')]", "[event:good_ts IN (t'1953-11-26T14:25:33Z', t'1985-07-25T20:27:52Z', t'2000-06-17T17:25:51.44Z')]" ]) def test_ts_nomatch(pattern): assert not match(pattern, _observations) @pytest.mark.parametrize("pattern", [ "[event:good_ts = t'2010-05-21T13:21:43']", "[event:good_ts = t'2010-05-21T13:21:43z']", "[event:good_ts = t'2010-05-21t13:21:43Z']", "[event:good_ts = t'2010/05/21T13:21:43Z']", "[event:good_ts = t'2010-05-21T13:21Z']", "[event:good_ts = t'2010-05-21T13:21:99Z']" ]) def test_ts_pattern_error_parse(pattern): with pytest.raises(ParseException): match(pattern, _observations) @pytest.mark.parametrize("pattern", [ # auto-generate simple tests for all the bad timestamps "[event:bad_ts[{}] = t'1996-07-11T09:17:10Z']".format(i) for i in range(len(_observations[0]["objects"]["0"]["bad_ts"])) ]) def test_ts_json_error(pattern): with pytest.raises(MatcherException): match(pattern, _observations)
37.341463
108
0.599935
468
3,062
3.803419
0.209402
0.08427
0.142135
0.153371
0.685393
0.682022
0.606742
0.534831
0.520787
0.520787
0
0.26128
0.203788
3,062
81
109
37.802469
0.468827
0.030046
0
0.144928
0
0.057971
0.549714
0.300977
0
0
0
0
0.028986
1
0.057971
false
0
0.043478
0
0.101449
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
0c5b599cb607d2794e1e000b4cba5c3bb90e5015
382
py
Python
datadog_checks_dev/datadog_checks/dev/tooling/commands/meta/windows/__init__.py
tdimnet/integrations-core
a78133a3b71a1b8377fa214d121a98647031ab06
[ "BSD-3-Clause" ]
663
2016-08-23T05:23:45.000Z
2022-03-29T00:37:23.000Z
datadog_checks_dev/datadog_checks/dev/tooling/commands/meta/windows/__init__.py
tdimnet/integrations-core
a78133a3b71a1b8377fa214d121a98647031ab06
[ "BSD-3-Clause" ]
6,642
2016-06-09T16:29:20.000Z
2022-03-31T22:24:09.000Z
datadog_checks_dev/datadog_checks/dev/tooling/commands/meta/windows/__init__.py
tdimnet/integrations-core
a78133a3b71a1b8377fa214d121a98647031ab06
[ "BSD-3-Clause" ]
1,222
2017-01-27T15:51:38.000Z
2022-03-31T18:17:51.000Z
# (C) Datadog, Inc. 2021-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) import click from ...console import CONTEXT_SETTINGS from .pdh import pdh ALL_COMMANDS = [pdh] @click.group(context_settings=CONTEXT_SETTINGS, short_help='Windows utilities') def windows(): pass for command in ALL_COMMANDS: windows.add_command(command)
20.105263
79
0.76178
54
382
5.259259
0.666667
0.158451
0
0
0
0
0
0
0
0
0
0.015385
0.149215
382
18
80
21.222222
0.858462
0.282723
0
0
0
0
0.062963
0
0
0
0
0
0
1
0.111111
false
0.111111
0.333333
0
0.444444
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
0
0
0
2
0c5d1c880d45b3bca4619d5bf2e1d662a5170328
1,941
py
Python
tenant_schemas/middleware.py
bdauvergne/django-tenant-schemas
15966752872a3335b09df3bdb1ed924a6bb5fcac
[ "MIT" ]
null
null
null
tenant_schemas/middleware.py
bdauvergne/django-tenant-schemas
15966752872a3335b09df3bdb1ed924a6bb5fcac
[ "MIT" ]
null
null
null
tenant_schemas/middleware.py
bdauvergne/django-tenant-schemas
15966752872a3335b09df3bdb1ed924a6bb5fcac
[ "MIT" ]
null
null
null
from django.conf import settings from django.contrib.contenttypes.models import ContentType from django.db import connection from django.shortcuts import get_object_or_404 from tenant_schemas.utils import get_tenant_model, remove_www, get_public_schema_name class TenantMiddleware(object): """ This middleware should be placed at the very top of the middleware stack. Selects the proper database schema using the request host. Can fail in various ways which is better than corrupting or revealing data... """ def hostname_from_request(self, request): """ Extracts hostname from request. Used for custom requests filtering. By default removes the request's port and common prefixes. """ return remove_www(request.get_host().split(':')[0]) def process_request(self, request): # connection needs first to be at the public schema, as this is where the # tenant metadata is stored connection.set_schema_to_public() hostname = self.hostname_from_request(request) request.tenant = get_object_or_404(get_tenant_model(), domain_url=hostname) connection.set_tenant(request.tenant) # content type can no longer be cached as public and tenant schemas have different # models. if someone wants to change this, the cache needs to be separated between # public and shared schemas. if this cache isn't cleared, this can cause permission # problems. for example, on public, a particular model has id 14, but on the tenants # it has the id 15. if 14 is cached instead of 15, the permissions for the wrong # model will be fetched. ContentType.objects.clear_cache() # do we have a public-specific token? if hasattr(settings, 'PUBLIC_SCHEMA_URLCONF') and request.tenant.schema_name == get_public_schema_name(): request.urlconf = settings.PUBLIC_SCHEMA_URLCONF
48.525
113
0.723338
271
1,941
5.04797
0.487085
0.04386
0.041667
0.020468
0
0
0
0
0
0
0
0.009868
0.216899
1,941
39
114
49.769231
0.890132
0.464194
0
0
0
0
0.022426
0.021407
0
0
0
0
0
1
0.125
false
0
0.3125
0
0.5625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
0c609426ff81c67b9441ecb4ce7a71b39c1d3cca
1,286
py
Python
products/models.py
geoffreynyaga/daraja
61db415b474fae004547a4caa057fedfe375ebb6
[ "MIT" ]
23
2019-11-14T14:37:43.000Z
2022-02-25T01:53:09.000Z
products/models.py
geoffreynyaga/daraja
61db415b474fae004547a4caa057fedfe375ebb6
[ "MIT" ]
11
2020-02-12T02:43:25.000Z
2022-02-19T04:43:54.000Z
products/models.py
geoffreynyaga/daraja
61db415b474fae004547a4caa057fedfe375ebb6
[ "MIT" ]
15
2019-11-10T23:28:18.000Z
2022-03-04T08:35:17.000Z
from django.conf import settings from django.db import models # Create your models here. class Product(models.Model): """Model definition for Product.""" # TODO: Define fields here name = models.CharField(max_length=60) description = models.CharField(max_length=140, blank=True, null=True) price = models.FloatField() stock_amount = models.IntegerField() package_details = models.CharField(max_length=20) picture = models.ImageField(upload_to="images/product") seller = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) delivery_option = models.BooleanField(default=False) CATEGORY_TYPE = ( ("GROC", "GROCERIES"), ("ELEC", "ELECTRONICS"), ("CLTH", "CLOTHES"), ("HOME", "HOME AND LIVING"), ) category = models.CharField(max_length=5, choices=CATEGORY_TYPE, null=False) date_created = models.DateTimeField(auto_now_add=True) date_modified = models.DateTimeField(auto_now=True) class Meta: """Meta definition for Product.""" verbose_name = "Product" verbose_name_plural = "Products" def __str__(self): """Unicode representation of Product.""" return self.name def get_picture(self): return self.picture.url
29.906977
82
0.680404
149
1,286
5.697987
0.577181
0.070671
0.084806
0.113074
0
0
0
0
0
0
0
0.007813
0.203733
1,286
42
83
30.619048
0.821289
0.111975
0
0
0
0
0.077333
0
0
0
0
0.02381
0
1
0.074074
false
0
0.074074
0.037037
0.740741
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
1
0
0
2
a74a22cdd27c1a75d4e3ef642d5b7f20dadf2c02
3,631
py
Python
kardioml/segmentation/teijeiro/model/interval.py
Seb-Good/physionet-challenge-2020
c6f1648a148335babc0a26d8a589120616327548
[ "BSD-2-Clause" ]
13
2020-12-18T08:09:34.000Z
2022-03-15T04:51:46.000Z
kardioml/segmentation/teijeiro/model/interval.py
Seb-Good/physionet-challenge-2020
c6f1648a148335babc0a26d8a589120616327548
[ "BSD-2-Clause" ]
null
null
null
kardioml/segmentation/teijeiro/model/interval.py
Seb-Good/physionet-challenge-2020
c6f1648a148335babc0a26d8a589120616327548
[ "BSD-2-Clause" ]
14
2020-09-16T21:07:38.000Z
2022-03-23T14:01:24.000Z
# -*- coding: utf-8 -*- """Module defining Interval model and operations""" # ActiveState recipe 576816 class Interval(object): """ Represents an interval. Defined as closed interval [start,end), which includes the start and end positions. Start and end do not have to be numeric types. """ __slots__ = ('_start', '_end') def __init__(self, start, end): "Construct, start must be <= end." if start > end: raise ValueError('Start (%s) must not be greater than end (%s)' % (start, end)) self._start = start self._end = end @property def start(self): """The interval's start""" return self._start @property def end(self): """The interval's end""" return self._end def __str__(self): "As string." return '[%s,%s]' % (self.start, self.end) def __repr__(self): "String representation." return '[%s,%s]' % (self.start, self.end) def __cmp__(self, other): "Compare." if None == other: return 1 start_cmp = cmp(self.start, other.start) if 0 != start_cmp: return start_cmp else: return cmp(self.end, other.end) def __hash__(self): "Hash." return hash(self.start) ^ hash(self.end) def intersection(self, other): "Intersection. @return: An empty intersection if there is none." if self > other: other, self = self, other if self.end <= other.start: return Interval(self.start, self.start) return Interval(other.start, min(self.end, other.end)) def hull(self, other): "@return: Interval containing both self and other." if self > other: other, self = self, other return Interval(self.start, max(self.end, other.end)) def overlap(self, other): "@return: True iff self intersects other." if self > other: other, self = self, other return self.end > other.start def overlapm(self, other): "@return: True iff selfs overlaps or meets other." if self > other: other, self = self, other return self.end >= other.start def move(self, offset): "@return: Interval displaced offset to start and end" return Interval(self.start + offset, self.end + offset) def __contains__(self, item): "@return: True iff item in self." return self.start <= item and item <= self.end @property def zero_in(self): "@return: True iff 0 in self." return self.start <= 0 and 0 <= self.end def subset(self, other): "@return: True iff self is subset of other." return self.start >= other.start and self.end <= other.end def proper_subset(self, other): "@return: True iff self is proper subset of other." return self.start > other.start and self.end < other.end @property def empty(self): "@return: True iff self is empty." return self.start == self.end @property def length(self): """@return: Difference between end and start""" return self.end - self.start @property def singleton(self): "@return: True iff self.end - self.start == 1." return self.end - self.start == 1 def separation(self, other): "@return: The distance between self and other." if self > other: other, self = self, other if self.end > other.start: return 0 else: return other.start - self.end
29.048
91
0.577251
459
3,631
4.481481
0.200436
0.074866
0.052504
0.036461
0.374332
0.265921
0.253281
0.253281
0.193972
0.191055
0
0.005988
0.310107
3,631
124
92
29.282258
0.81517
0.26081
0
0.224719
0
0
0.205168
0
0
0
0
0
0
1
0.224719
false
0
0
0
0.505618
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
a756cb0b2bc3a505b204382fa0f1c25c83eea5c5
82
py
Python
test_settings.py
champion-automatica/automatica_prometheus
dceb59fb71a48a585066642cca720dd7ed43a476
[ "MIT" ]
null
null
null
test_settings.py
champion-automatica/automatica_prometheus
dceb59fb71a48a585066642cca720dd7ed43a476
[ "MIT" ]
null
null
null
test_settings.py
champion-automatica/automatica_prometheus
dceb59fb71a48a585066642cca720dd7ed43a476
[ "MIT" ]
null
null
null
INSTALLED_APPS = ( 'automatica_prometheus', ) TELEGRAM_BOT_NAME = 'name_bot'
13.666667
30
0.731707
9
82
6.111111
0.777778
0
0
0
0
0
0
0
0
0
0
0
0.158537
82
5
31
16.4
0.797101
0
0
0
0
0
0.353659
0.256098
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
a75ecb87925b333815de21b3d8f54bbc8af21a44
5,343
pyt
Python
prettydoc-templ/man.pyt
billziss-gh/prettydoc
2d2b2caaea5c054fb5020f1903eab03bf7b93117
[ "BSD-3-Clause" ]
6
2016-07-22T08:41:48.000Z
2021-09-01T02:01:31.000Z
prettydoc-templ/man.pyt
billziss-gh/prettydoc
2d2b2caaea5c054fb5020f1903eab03bf7b93117
[ "BSD-3-Clause" ]
1
2017-02-07T14:50:19.000Z
2017-02-07T14:50:19.000Z
prettydoc-templ/man.pyt
billziss-gh/prettydoc
2d2b2caaea5c054fb5020f1903eab03bf7b93117
[ "BSD-3-Clause" ]
null
null
null
# -*- coding: UTF-8 -*- def head(elem): pass def group(pass_, elem): : .SS ${elem.findtext("name").upper()} if elem.find("abstract") is not None: : ${pretty_text(elem.find("abstract"))} if elem.find("desc") is not None: : ${pretty_text(elem.find("desc"))} else: : \& : .br def section(pass_, elem, title): : \fB${title.upper()}\fP : def item_head(pass_, elem): desi = "" if "category" == elem.tag: desi = "Category " elif "protocol" == elem.tag: desi = "Protocol " elif "method" == elem.tag and "occ" == elem.get("lang"): if "instm" == elem.get("type"): desi = "- " elif "clm" == elem.get("type"): desi = "+ " name = pretty_text(elem.find("name")) abst = pretty_text(elem.find("abstract")) if elem.tag in ["header", "framework"]: if "toc" == pass_: : .TH "${name}" 3 "${pretty_text(elem.find("timestamp"))}" : .SH NAME : \& : .br if abst: : ${name} \- ${abst} else: : ${name} : : .SH SYNOPSIS : \& : .br else: : .SH DESCRIPTION : \& : .br else: if abst: : \fB${desi}${name}\fP \- ${abst} else: : \fB${desi}${name}\fP if "toc" != pass_: : .RS 4 : def item(pass_, elem): if "toc" == pass_: return if elem.tag in [ "method", "property", "function", "variable", "constant", "struct", "union", "enum", "typedef", "pdefine"]: if elem.find("declaration") is not None: : ${pretty_declaration(elem.find("declaration"))} : if elem.find("fieldlist") is not None: : \fBFields\fP : .RS 4 for i, e in enumerate(elem.findall("fieldlist/field")): if 0 < i: : : \fI${pretty_text(e.find("name"))}\fP \- ${pretty_text(e.find("desc"))} : .RE : if elem.find("parameterlist") is not None: : \fBParameters\fP : .RS 4 for i, e in enumerate(elem.findall("parameterlist/parameter")): if 0 < i: : : \fI${pretty_text(e.find("name"))}\fP \- ${pretty_text(e.find("desc"))} : .RE : if elem.find("result") is not None: : \fBReturn Value\fP : .RS 4 : ${pretty_text(elem.find("result"))} : .RE : if elem.find("throwlist") is not None: : \fBThrows\fP : .RS 4 for i, e in enumerate(elem.findall("throwlist/throw")): if 0 < i: : : ${pretty_text(e)} : .RE : if elem.find("desc") is not None: if not elem.tag in ["header", "framework"]: : \fBDiscussion\fP : .RS 4 : ${pretty_text(elem.find("desc"))} : .RE : else: : ${pretty_text(elem.find("desc"))} : if elem.find("attributelists") is not None: for e in elem.findall("attributelists/listattribute"): if "See" == e.findtext("name"): : \fBSee Also\fP : .RS 4 for f in e.findall(".//hd_link"): : ${pretty_text(f)} : .br : .RE : def item_foot(pass_, elem): if not elem.tag in ["header", "framework"]: if "toc" != pass_: : .RE : def foot(elem): copyright = pretty_text(elem.find("copyrightinfo")) if copyright: : .SH COPYRIGHT : \& : .br : ${copyright} pretty_text_map = { "i": (r"\fI", r"\fP"), "b": (r"\fB", r"\fP"), "code": (r"\f[CW]", r"\fP"), "p": ("", "\n\n"), "li": (".IP \(bu 4\n", "\n.PP\n"), } def pretty_escape(text): return text.replace("\\", "\\\\").replace(u"©", "\[co]") def pretty_text_append(l, elem): if hasattr(elem, "text"): pretty_text_append(l, elem.text or "") for e in elem: tup = pretty_text_map.get(e.tag, ("", "")) if callable(tup): tup = tup(e) l.append(tup) else: sta, end = tup l.append(sta) pretty_text_append(l, e) l.append(end) pretty_text_append(l, e.tail or "") else: l.append(pretty_escape((elem or "").strip("\r\n"))) def pretty_text(elem): l = [] pretty_text_append(l, elem) return "".join(l).strip() def pretty_declaration(elem): if elem is None: return None fontmap = { "declaration_preprocessor": r"\fB%s\fP", "declaration_keyword": r"\fB%s\fP", "declaration_function": r"\fB%s\fP", "declaration_var": r"\fI%s\fP", "declaration_template": r"\fB%s\fP", "declaration_type": r"\fB%s\fP", "declaration_param": r"\fI%s\fP", "declaration_availabilitymacro": r"\fB%s\fP", } return "".join([fontmap.get(e.tag, "%s") % pretty_escape(e.text or "") + \ pretty_escape(e.tail or "") for e in elem]) def file_extension(): return ".3" def passes(elem): return ["toc", "main"]
29.038043
84
0.460041
616
5,343
3.899351
0.220779
0.095754
0.058285
0.067444
0.315154
0.201915
0.201915
0.115737
0.08826
0.08826
0
0.004106
0.361782
5,343
183
85
29.196721
0.7
0.00393
0
0.289773
0
0
0.148684
0.02406
0
0
0
0
0
0
null
null
0.0625
0
null
null
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
1
0
0
0
0
0
2
a77a0e3a093a9c58d4f747dafbc02329b2e173d3
2,645
py
Python
app/views/admin/forms.py
LXG-Shadow/flaskweb
cc170386053e8eb83cc1dc27e38acdf4290b7427
[ "MIT" ]
null
null
null
app/views/admin/forms.py
LXG-Shadow/flaskweb
cc170386053e8eb83cc1dc27e38acdf4290b7427
[ "MIT" ]
null
null
null
app/views/admin/forms.py
LXG-Shadow/flaskweb
cc170386053e8eb83cc1dc27e38acdf4290b7427
[ "MIT" ]
null
null
null
from flask_wtf import FlaskForm from flask_babel import lazy_gettext as _l from flask_pagedown.fields import PageDownField from wtforms.fields import StringField,TextAreaField,SubmitField, BooleanField from wtforms.ext.sqlalchemy.fields import QuerySelectField from wtforms.validators import DataRequired,Length, Email from app.mysql.user_db import userGroup_db from app.mysql import articleSource_db,articleType_db class UserEditForm(FlaskForm): id = StringField(u'Id') username = StringField(_l('Username'), validators=[DataRequired(), Length(4, 16)]) password = StringField(_l('Password')) email = StringField(_l('Email'), validators=[DataRequired(), Email(),Length(7, 31)]) group = QuerySelectField(_l('User Group'), query_factory=userGroup_db.getAlluserGroup, get_label="name") submit = SubmitField(_l('Submit')) class UserRegisterForm(FlaskForm): id = StringField(u'Id') username = StringField(_l('Username'), validators=[DataRequired(), Length(4, 16)]) password = StringField(_l('Password'),validators=[DataRequired(), Length(5, 16)]) email = StringField(_l('Email'), validators=[DataRequired(), Email(),Length(7, 31)]) group = QuerySelectField(_l('User Group'), query_factory=userGroup_db.getAlluserGroup, get_label="name") submit = SubmitField(_l('New User')) class PageDownForm(FlaskForm): title = StringField(_l('Title'), validators=[DataRequired(),Length(1, 64)]) source = QuerySelectField(_l('Source'),query_factory=articleSource_db.getAll,get_label="name") type = QuerySelectField(_l('Type'),query_factory=articleType_db.getAll,get_label="name") summary = TextAreaField(_l('Summary'), validators=[DataRequired()]) tags = StringField(_l('Tags')) content = PageDownField(_l("Enter MarkDown Text"),validators=[DataRequired()]) no_clean = None submit = SubmitField(_l('Submit')) class AdvancedPageDownForm(PageDownForm): no_clean = BooleanField(_l("Using Advanced Mode")) class FileEditForm(FlaskForm): id = StringField(u'Id') alias = StringField(_l('Alias'), validators=[DataRequired(), Length(1, 16)]) description = TextAreaField(_l("Description")) external = BooleanField(_l("External Link"),default=True) permission = QuerySelectField(_l("Access Permission"), query_factory=userGroup_db.getAlluserGroup, get_label="name") link = StringField(_l("Link")) password = StringField(_l("Password")) submit = SubmitField(_l("Update Info")) class FileUploadForm(FileEditForm): submit = SubmitField(_l("New File")) class DeleteForm(FlaskForm): id = StringField(u"id") submit = SubmitField(_l("Confirm"))
46.403509
120
0.738752
300
2,645
6.336667
0.293333
0.069437
0.056812
0.048396
0.377696
0.309311
0.309311
0.309311
0.283009
0.283009
0
0.009032
0.120983
2,645
56
121
47.232143
0.808602
0
0
0.234043
0
0
0.097543
0
0
0
0
0
0
1
0
false
0.06383
0.170213
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
2
a77edcbbfee52ef1b1e7e3c828b9ea76fb077d82
532
py
Python
message-project/message/app/models.py
sunwenquan/1804
5b5161079411510231f56d4cb2166885812a6b6a
[ "Apache-2.0" ]
null
null
null
message-project/message/app/models.py
sunwenquan/1804
5b5161079411510231f56d4cb2166885812a6b6a
[ "Apache-2.0" ]
9
2019-12-04T23:24:19.000Z
2022-02-10T08:53:21.000Z
message-project/message/app/models.py
sunwenquan/1804
5b5161079411510231f56d4cb2166885812a6b6a
[ "Apache-2.0" ]
1
2019-06-06T03:14:46.000Z
2019-06-06T03:14:46.000Z
from django.db import models # Create your models here. # ORM 对象关系映射 # - 对象 Message是一个类,msg = Message(name='gavin') 就是一个对象 # - 关系 实体和实体之间的关系 # - 映射 # : app_message表 和 Message类 是一一对应的 # : app_message表中每条记录 和 Message类创建的每个对象时一一对应的 class Message(models.Model): name = models.CharField(max_length=30,verbose_name="姓名") email = models.EmailField(max_length=20,verbose_name='邮箱') address = models.CharField(max_length=50,verbose_name='地址') content = models.CharField(max_length=200,verbose_name='留言内容')
29.555556
66
0.723684
70
532
5.357143
0.642857
0.096
0.144
0.192
0
0
0
0
0
0
0
0.020179
0.161654
532
17
67
31.294118
0.820628
0.37594
0
0
0
0
0.03096
0
0
0
0
0
0
1
0
false
0
0.166667
0
1
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
a78c228f9f9c8fc61f192f243dcd136214698720
1,117
py
Python
megatron/module.py
eric-haibin-lin/Megatron-LM
324ddf354db09239d937fabe3d0bf6620edb0e2e
[ "MIT" ]
309
2020-02-07T23:09:27.000Z
2022-03-31T08:01:53.000Z
megatron/module.py
eric-haibin-lin/Megatron-LM
324ddf354db09239d937fabe3d0bf6620edb0e2e
[ "MIT" ]
93
2020-02-22T05:56:28.000Z
2022-03-27T08:43:38.000Z
megatron/module.py
eric-haibin-lin/Megatron-LM
324ddf354db09239d937fabe3d0bf6620edb0e2e
[ "MIT" ]
148
2020-02-14T22:16:11.000Z
2022-03-22T17:08:04.000Z
# coding=utf-8 # Copyright (c) 2020, NVIDIA CORPORATION. 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. """Megatron Module""" import torch class MegatronModule(torch.nn.Module): """Megatron specific extentions of torch Module.""" def __init__(self): super(MegatronModule, self).__init__() def state_dict_for_save_checkpoint(self, destination=None, prefix='', keep_vars=False): """Use this function to override the state dict for saving checkpoints.""" return self.state_dict(destination, prefix, keep_vars)
34.90625
74
0.708147
151
1,117
5.139073
0.642384
0.07732
0.033505
0.041237
0
0
0
0
0
0
0
0.010158
0.206804
1,117
31
75
36.032258
0.865688
0.651746
0
0
0
0
0
0
0
0
0
0
0
1
0.285714
false
0
0.142857
0
0.714286
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
a79065852ec277db0c7f6b9a4e203a72cdc738ca
2,638
py
Python
websites/migrations/0003_add_website_starter_model.py
mitodl/ocw-studio
949f96ec0647064f8d495ebdd22d66eea7d024a5
[ "BSD-3-Clause" ]
2
2020-08-07T15:55:41.000Z
2021-08-16T18:28:09.000Z
websites/migrations/0003_add_website_starter_model.py
mitodl/ocw-studio
949f96ec0647064f8d495ebdd22d66eea7d024a5
[ "BSD-3-Clause" ]
924
2020-08-10T17:54:19.000Z
2022-03-31T21:15:17.000Z
websites/migrations/0003_add_website_starter_model.py
mitodl/ocw-studio
949f96ec0647064f8d495ebdd22d66eea7d024a5
[ "BSD-3-Clause" ]
null
null
null
# Generated by Django 3.1 on 2021-02-02 18:02 import django.db.models.deletion from django.db import migrations, models import websites.models class Migration(migrations.Migration): dependencies = [ ("websites", "0002_websitecontent_hugo_filepath"), ] operations = [ migrations.CreateModel( name="WebsiteStarter", fields=[ ( "id", models.AutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("created_on", models.DateTimeField(auto_now_add=True)), ("updated_on", models.DateTimeField(auto_now=True)), ( "path", models.CharField( help_text="Github repo path or local file path of the starter project.", max_length=256, ), ), ( "name", models.CharField( help_text="Human-friendly name of the starter project.", max_length=100, ), ), ( "source", models.CharField( choices=[("github", "github"), ("local", "local")], db_index=True, max_length=15, ), ), ( "commit", models.CharField( blank=True, help_text="Commit hash for the repo (if this commit came from a Github starter repo).", max_length=40, null=True, ), ), ( "config", models.TextField( help_text="YML-formatted site config.", validators=[websites.models.validate_yaml], ), ), ], options={ "abstract": False, }, ), migrations.AddField( model_name="website", name="starter", field=models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to="websites.websitestarter", ), ), ]
31.404762
111
0.390447
185
2,638
5.443243
0.502703
0.059583
0.027805
0.043694
0.111221
0.055611
0
0
0
0
0
0.022152
0.520849
2,638
83
112
31.783133
0.774525
0.0163
0
0.302632
1
0
0.144234
0.021597
0
0
0
0
0
1
0
false
0
0.039474
0
0.078947
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
a79375cf7eeeab82071108b0bd1844f324d5478c
136
py
Python
Python Fundamentals/Basic Syntax, Conditional Statements and Loops/More Exercises/Task01_2.py
DonikaChervenkova/SoftUni
bff579c037ec48f39ed193b34bc3502a32e90732
[ "MIT" ]
null
null
null
Python Fundamentals/Basic Syntax, Conditional Statements and Loops/More Exercises/Task01_2.py
DonikaChervenkova/SoftUni
bff579c037ec48f39ed193b34bc3502a32e90732
[ "MIT" ]
null
null
null
Python Fundamentals/Basic Syntax, Conditional Statements and Loops/More Exercises/Task01_2.py
DonikaChervenkova/SoftUni
bff579c037ec48f39ed193b34bc3502a32e90732
[ "MIT" ]
1
2021-12-04T12:30:57.000Z
2021-12-04T12:30:57.000Z
number = list(map(lambda x: int(x), list(input()))) number.sort(reverse=True) max_num = "".join([str(i) for i in number]) print(max_num)
34
51
0.683824
25
136
3.64
0.72
0.131868
0
0
0
0
0
0
0
0
0
0
0.102941
136
4
52
34
0.745902
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
a79de92abde8a036971edb9e164fe877f323fa18
554
py
Python
rename.py
loublock/Adam-Soundbox
ba859411a5c289c4ea61735233906d657785071d
[ "MIT" ]
1
2020-08-24T19:27:48.000Z
2020-08-24T19:27:48.000Z
rename.py
loublock/Adam-Soundbox
ba859411a5c289c4ea61735233906d657785071d
[ "MIT" ]
null
null
null
rename.py
loublock/Adam-Soundbox
ba859411a5c289c4ea61735233906d657785071d
[ "MIT" ]
null
null
null
import os path = 'SD_CARD/MP3/' count = 1 for filename in os.listdir('SD_CARD/MP3/'): if count > 9 and count <= 99: os.rename(r'SD_CARD/MP3/' + filename,r'SD_CARD/MP3/00' + str(count) + '.mp3') elif count > 99 and count <= 999: os.rename(r'SD_CARD/MP3/' + filename,r'SD_CARD/MP3/0' + str(count) + '.mp3') elif count > 999: os.rename(r'SD_CARD/MP3/' + filename,r'SD_CARD/MP3/' + str(count) + '.mp3') else: os.rename(r'SD_CARD/MP3/' + filename,r'SD_CARD/MP3/000' + str(count) + '.mp3') count += 1
32.588235
86
0.584838
93
554
3.376344
0.268817
0.191083
0.286624
0.254777
0.621019
0.509554
0.509554
0.509554
0.509554
0.509554
0
0.076566
0.222022
554
16
87
34.625
0.651972
0
0
0
0
0
0.256318
0
0
0
0
0
0
1
0
false
0
0.076923
0
0.076923
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
a7b810404d0031d8c5bb6caee93c5891368e5847
816
py
Python
recognition/src/models/feature_extraction/core.py
AlexeyZhuravlev/OCR-experiments
8493045054678a2e13cafce6d9e85c7581086c7a
[ "MIT" ]
2
2020-05-28T18:46:37.000Z
2020-08-29T12:49:57.000Z
recognition/src/models/feature_extraction/core.py
AlexeyZhuravlev/OCR-experiments
8493045054678a2e13cafce6d9e85c7581086c7a
[ "MIT" ]
null
null
null
recognition/src/models/feature_extraction/core.py
AlexeyZhuravlev/OCR-experiments
8493045054678a2e13cafce6d9e85c7581086c7a
[ "MIT" ]
null
null
null
import torch from torch import nn from torchvision.models import resnet from abc import ABC, abstractmethod class BaseFeatureExtractor(ABC, nn.Module): """Base class for all feature extractors""" def __init__(self): super().__init__() @property @abstractmethod def vertical_scale(self) -> int: """Vertical scale of the model: how much height changes""" pass @property @abstractmethod def horizontal_scale(self) -> int: """Horizontal scale of the model: how much width changes""" pass @property @abstractmethod def output_channels(self) -> int: """Number of output channels for the model""" pass @abstractmethod def forward(self, x: torch.Tensor) -> torch.Tensor: """Forward pass""" pass
24.727273
67
0.644608
93
816
5.537634
0.44086
0.132039
0.145631
0.058252
0.225243
0.085437
0
0
0
0
0
0
0.259804
816
32
68
25.5
0.852649
0.241422
0
0.5
0
0
0
0
0
0
0
0
0
1
0.227273
false
0.181818
0.181818
0
0.454545
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
2
a7c09e8b13f16da9135a2be446889eaa8cdcdf04
309
py
Python
wargame/migrations/0017_submission_times.py
radl97/wargame-web
4062b05717bacb5c1a2c178f3a8bd07af7a18b10
[ "MIT" ]
2
2020-10-06T17:07:32.000Z
2020-10-15T09:25:42.000Z
wargame/migrations/0017_submission_times.py
radl97/wargame-web
4062b05717bacb5c1a2c178f3a8bd07af7a18b10
[ "MIT" ]
67
2018-06-22T09:12:44.000Z
2022-03-11T23:34:39.000Z
wargame/migrations/0017_submission_times.py
radl97/wargame-web
4062b05717bacb5c1a2c178f3a8bd07af7a18b10
[ "MIT" ]
2
2020-10-05T21:13:48.000Z
2020-10-10T13:46:20.000Z
# Generated by Django 2.1.5 on 2019-02-06 14:53 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("wargame", "0016_auto_20190206_1544")] operations = [migrations.AddField(model_name="submission", name="times", field=models.IntegerField(default=0))]
28.090909
115
0.747573
41
309
5.536585
0.853659
0
0
0
0
0
0
0
0
0
0
0.117647
0.119741
309
10
116
30.9
0.716912
0.145631
0
0
1
0
0.171756
0.087786
0
0
0
0
0
1
0
false
0
0.25
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
a7c4a1c25868747c66afae3d12fac715e60186c9
123
py
Python
dork/__init__.py
msudenvercs/Dork
601cbb21398ac8edf5e688db2089ed8805bbdf00
[ "MIT" ]
1
2021-04-04T20:40:18.000Z
2021-04-04T20:40:18.000Z
dork/__init__.py
msudenvercs/Dork
601cbb21398ac8edf5e688db2089ed8805bbdf00
[ "MIT" ]
2
2019-06-06T21:48:33.000Z
2021-04-04T20:41:19.000Z
dork/__init__.py
zenostrash/dork
601cbb21398ac8edf5e688db2089ed8805bbdf00
[ "MIT" ]
4
2019-05-29T04:56:28.000Z
2019-05-30T18:17:55.000Z
# -*- coding: utf-8 -*- """Dork Game main module. """ __version__ = '0.1.0' __author__ = ", ".join([ "Luke Smith", ])
13.666667
25
0.528455
15
123
3.8
0.933333
0
0
0
0
0
0
0
0
0
0
0.040816
0.203252
123
8
26
15.375
0.540816
0.365854
0
0
0
0
0.239437
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
a7cc3206c80980049aa0888c0312676b284faf4a
167
py
Python
src/Memories/Scenes/Level/Genero/Igualdade De Genero/Sprites/terrain/ground_sprites/resize (1).py
Rafael-Cabral/Jogo-Web
2d3a8405f37e9a290dd3faed2db1ea83328372dc
[ "CC-BY-4.0" ]
1
2022-02-17T09:19:55.000Z
2022-02-17T09:19:55.000Z
src/Memories/Scenes/Level/Genero/Igualdade De Genero/Sprites/terrain/ground_sprites/resize (1).py
Rafael-Cabral/Jogo-Web
2d3a8405f37e9a290dd3faed2db1ea83328372dc
[ "CC-BY-4.0" ]
1
2022-02-21T12:22:51.000Z
2022-02-21T12:22:51.000Z
src/Scenes/Level/Genero/Igualdade De Genero/Sprites/terrain/ground_sprites/resize (1).py
2022M1T1/Projeto2
f630ce407c71d82265a7fd5069a779b8d1d42972
[ "CC-BY-4.0" ]
null
null
null
from PIL import Image filename = "1" ext = ".png" new_res = (16,16) image = Image.open(filename+ext) image_r = image.resize(new_res) image_r.save(filename+'_2'+ext)
16.7
32
0.706587
29
167
3.896552
0.551724
0.106195
0
0
0
0
0
0
0
0
0
0.041379
0.131737
167
9
33
18.555556
0.737931
0
0
0
0
0
0.041916
0
0
0
0
0
0
1
0
false
0
0.142857
0
0.142857
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
a7cdf431f8876212eaac8f252e414f2597fff319
5,132
py
Python
sidekick-experimental/sidekick/experimental/magics/list_magic.py
fabiommendes/sidekick
993ae7b8496347ad9720d3ff11e10ab946c3a800
[ "MIT" ]
32
2017-08-10T09:42:51.000Z
2022-03-18T17:21:26.000Z
sidekick-experimental/sidekick/experimental/magics/list_magic.py
fabiommendes/sidekick
993ae7b8496347ad9720d3ff11e10ab946c3a800
[ "MIT" ]
1
2019-04-10T13:07:45.000Z
2019-04-18T02:27:47.000Z
sidekick-experimental/sidekick/experimental/magics/list_magic.py
fabiommendes/sidekick
993ae7b8496347ad9720d3ff11e10ab946c3a800
[ "MIT" ]
5
2017-10-10T13:43:23.000Z
2019-06-18T00:09:15.000Z
import sys from itertools import islice from .base_magics import DataMagic from .. import seq from ..functions import fn, to_callable from ..typing import Seq class L(DataMagic, type=list): """ Class for the L magic object. """ def __getitem__(self, item): if isinstance(item, slice): return fn(lambda obj: self._getslice(obj, item)) elif isinstance(item, int): return fn(lambda obj: self._getindex(obj, item)) else: raise TypeError(f"unsupported type: {type(item).__name__}") def _getindex(self, obj, item): try: return obj[item] except TypeError: return seq.nth(item, obj) def _getslice(self, obj, s): if isinstance(obj, list): return obj[s] if s.step is not None and s.step < 0: result = list(islice(obj, s.start, s.stop, -s.step)) result.reverse() return result return list(islice(obj, s.start, s.stop, s.step)) @staticmethod def append(x, lst): """Append x to lst *INPLACE* and return lst.""" lst.append(x) return lst @staticmethod def append_new(x, lst): """Return new list with x appended to the end of lst.""" return [*lst, x] @staticmethod def clear(lst): """Clear list *INPLACE* and return it. If input is an iterator, consume it. This obviously doesn't play nicely with infinite iterators.""" try: clear = lst.clear except AttributeError: seq.consume(lst) else: clear() return lst @staticmethod def count(value, lst): """Count the number of occurrences of value in list.""" try: count = lst.count except AttributeError: return seq.count(value, lst) else: return count(value) @staticmethod def copy(lst): """Return a copy of list. Non-list iterables are converted to lists.""" if isinstance(lst, list): return lst.copy() return list(lst) @staticmethod def extend(self, seq, lst): """Extend lst with seq *INPLACE* and return lst.""" lst.extend(seq) return lst @staticmethod def extend_new(seq, lst): """Create new list that extends lst with other.""" return [*lst, *seq] @staticmethod def index(value, lst, start=0, stop=sys.maxsize): """Return first index of value in lst.""" try: index = lst.index except AttributeError: return seq.index(value, lst) else: return index(value) @staticmethod def insert(index, obj, lst): """Insert obj at given index of lst *INPLACE* and return lst.""" lst.insert(index, obj) return lst @staticmethod def insert_new(index, obj, lst): """Return new list that insert obj at the given position in lst.""" result = list(lst) result.insert(index, obj) return result @staticmethod def pop(idx, lst): """Pop element at idx *INPLACE* and return it.""" idx = -1 if idx is None else idx return lst.pop(idx) @staticmethod def pop_new(idx, lst): """Creates a copy of lst and return a tuple of (popped_element, rest)""" new = list(lst) popped = new.pop(idx) return popped, new @staticmethod def remove(value, lst): """Remove first occurrence of value *INPLACE* and return lst""" lst.remove(value) return lst def remove_new(self, value, lst): """ Create a list with the first occurrence of value removed. Raises value error if value is not present in list. """ return self.remove(value, list(lst)) @staticmethod def reverse(lst): """Reverse list *INPLACE* and return it.""" lst.reverse() return lst @staticmethod def reverse_new(lst: Seq): """Return reversed copy of lst. Alias to the ``reversed`` builtin.""" return reversed(lst) @staticmethod def sort(key, lst, *, reverse=False): """Sort list with key function *INPLACE* and return it.""" key = to_callable(key) lst.sort(key=key, reverse=reverse) return lst @staticmethod def sort_new(key, lst, *, reverse=False): """ Create new list sorted with key. Equivalent to the ``sorted`` builtin. """ return sorted(lst, key=to_callable(key), reverse=reverse) # # Extra methods # def as_list(self, obj, list_type=list): """Coerce object to list.""" return obj if isinstance(obj, list_type) else list_type(obj) def discard(self, value): def removing(seq): res = list(seq) try: res.remove(value) except ValueError: pass return res return removing def discard_all(self, value): return lambda seq: [x for x in seq if x != value]
27.44385
80
0.571707
641
5,132
4.531981
0.215289
0.08778
0.055766
0.04957
0.10327
0.037177
0.019966
0.019966
0.019966
0
0
0.000866
0.325214
5,132
186
81
27.591398
0.838002
0.226617
0
0.308943
0
0
0.010274
0.005532
0
0
0
0
0
1
0.203252
false
0.00813
0.04878
0.00813
0.520325
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
a7cfce8190289fc967b0062f786579489c6c0da4
74
py
Python
gunicorn.conf.py
minhoryang/ChatBullet
6424e0aa8ac7bbe3a5b9602d4390c2c639c25f71
[ "MIT" ]
null
null
null
gunicorn.conf.py
minhoryang/ChatBullet
6424e0aa8ac7bbe3a5b9602d4390c2c639c25f71
[ "MIT" ]
16
2016-03-28T02:24:36.000Z
2016-03-29T14:48:34.000Z
gunicorn.conf.py
minhoryang/ChatBullet
6424e0aa8ac7bbe3a5b9602d4390c2c639c25f71
[ "MIT" ]
null
null
null
bind = "0.0.0.0:5000" workers = 1 worker_class = "eventlet" reload = True
14.8
25
0.675676
13
74
3.769231
0.769231
0.122449
0.122449
0
0
0
0
0
0
0
0
0.145161
0.162162
74
4
26
18.5
0.645161
0
0
0
0
0
0.27027
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
ac045c29809f6885f1f637b67a4d91c9a29e99fa
1,321
py
Python
tests/test_articles.py
josphat-otieno/news-app
e6ff307230bd2cab787489fca4850004cd9bdbd0
[ "MIT" ]
null
null
null
tests/test_articles.py
josphat-otieno/news-app
e6ff307230bd2cab787489fca4850004cd9bdbd0
[ "MIT" ]
null
null
null
tests/test_articles.py
josphat-otieno/news-app
e6ff307230bd2cab787489fca4850004cd9bdbd0
[ "MIT" ]
1
2022-02-28T22:33:33.000Z
2022-02-28T22:33:33.000Z
import unittest from app.models import Articles class ArticlesTest(unittest.TestCase): def setUp(self): ''' test case to run before each test ''' self.news_articles=Articles("jose", "Black Barbecue Gets Its Due in an Inspiring New Cookbook", "Joe Ray", "The first book from renowned pitmaster...", "2021-06-05T13:00:00Z", "https://media.wired.com/photos/60ba605dd9be3d", "https://www.wired.com/story/rodney-scotts-world-of-bbq/") def test_instance(self): self.assertEqual(isinstance(self.news_articles, Articles)) def test_init(self): ''' test case to confirm the object is initialised correctly ''' self.assertEqual(self.news_articles.name, "jose") self.assertEqual(self.news_articles.title , "Black Barbecue Gets Its Due in an Inspiring New Cookbook") self.assertEqual(self.news_articles.author , "Joe Ray") self.assertEqual(self.news_articles.description, "The first book from renowned pitmaster...") self.assertEqual(self.news_articles.publishedAt, "2021-06-05T13:00:00Z") self.assertEqual(self.news_articles.urlToImage, "https://media.wired.com/photos/60ba605dd9be3d") self.assertEqual(self.news_articles.url, "https://www.wired.com/story/rodney-scotts-world-of-bbq/")
45.551724
291
0.696442
171
1,321
5.315789
0.415205
0.079208
0.158416
0.177118
0.628163
0.354235
0.19802
0.19802
0.19802
0.19802
0
0.03871
0.178653
1,321
28
292
47.178571
0.799078
0.06813
0
0
0
0
0.385461
0
0
0
0
0
0.533333
1
0.2
false
0
0.133333
0
0.4
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
2
ac14f0b6c781b5b60d529cd1713a9cb9f77eb9cc
4,144
py
Python
production_system/models.py
rameshgopalakrishnan/v_excel_inventory
5e7e8cfeb5b0217d7029feb917f84614aa384601
[ "Apache-2.0" ]
null
null
null
production_system/models.py
rameshgopalakrishnan/v_excel_inventory
5e7e8cfeb5b0217d7029feb917f84614aa384601
[ "Apache-2.0" ]
null
null
null
production_system/models.py
rameshgopalakrishnan/v_excel_inventory
5e7e8cfeb5b0217d7029feb917f84614aa384601
[ "Apache-2.0" ]
null
null
null
from django.db import models from people.models import Customer, InternalUser from service_and_process.models import MasterService, MasterProduct, MasterProcess class Order(models.Model): amount = models.DecimalField(max_digits=7, decimal_places=2) customer_id = models.ForeignKey(Customer) expected_timestamp = models.DateTimeField() completed_timestamp = models.DateTimeField() def __str__(self): return "{}".format(self.id) # calculate tax in the invoice # def __str__(self): # return "{}. {}".format(self.id, self.amount) class MasterTag(models.Model): CHOICE = ((1, 'In Use'), (2, 'Free')) status = models.IntegerField(choices=CHOICE) def __str__(self): return "{}. {}".format(self.id, self.status) class Item(models.Model): """Can either be service or product""" service = models.ForeignKey(MasterService, blank=True, null=True) product = models.ForeignKey(MasterProduct, blank=True, null=True) order = models.ForeignKey(Order) tag_id = models.ForeignKey(MasterTag) def __str__(self): return "{}. {}".format(self.id, self.service.label) class MasterRawMaterial(models.Model): CHOICES = ((1, 'piece'), (2, 'kg')) label = models.TextField() unit = models.IntegerField(choices=CHOICES) def __str__(self): return "{}. {}".format( self.id, self.label) class Inventory(models.Model): """Raw materials in purchase""" raw_material = models.ForeignKey(MasterRawMaterial) quantity = models.IntegerField() entry_timestamp = models.DateTimeField(auto_now_add=True) update_timestamp = models.DateTimeField() def __str__(self): return "{}. {}".format(self.id, self.raw_material.label) class Purchase(models.Model): """Get materials from vendor""" raw_material = models.ForeignKey(MasterRawMaterial) vendor = models.TextField() entry_timestamp = models.DateTimeField(auto_now_add=True) price = models.DecimalField(max_digits=9, decimal_places=2) quantity = models.IntegerField() def __str__(self): return "{}. {}. {}".format(self.id, self.raw_material.label, self.vendor) class MappingProductMaterial(models.Model): product = models.ForeignKey(MasterProduct) raw_material = models.ForeignKey(MasterRawMaterial) quantity = models.IntegerField() def __str__(self): return "{}. {}".format(self.id, self.product.label) class Task(models.Model): """User is ironing""" user = models.ForeignKey(InternalUser) process = models.ForeignKey(MasterProcess) item = models.ForeignKey(Item) entry_timestamp = models.DateTimeField(auto_now_add=True) assigned_timestamp = models.DateTimeField() completed_timestamp = models.DateTimeField() is_success = models.BooleanField(default=True) def __str__(self): return "{}. {} - {}".format(self.id, self.user.user.username, self.process.label) class Production(models.Model): PRODUCTION_CHOICE = ((1, 'Training'), (2, 'Actual')) item = models.ForeignKey(Item) product = models.ForeignKey(MasterProduct) entry_timestamp = models.DateTimeField(auto_now_add=True) expected_quantity = models.IntegerField() output_quantity = models.IntegerField(null=True) production_type = models.IntegerField(choices=PRODUCTION_CHOICE) # batch def __str__(self): return "{}. {}".format(self.id, self.production_type) class ProductInventory(models.Model): """Holds the current state of the product (cookies, chocolates) Inventory""" product = models.ForeignKey(MasterProduct) quantity = models.IntegerField() entry_timestamp = models.DateTimeField(auto_now_add=True) update_timestamp = models.DateTimeField() def __str__(self): return "{}. {}".format(self.id, self.product.label) class MappingTrainerTraineeTask(models.Model): task_id = models.ForeignKey('production_system.Task') trainer = models.ForeignKey(InternalUser, related_name='trainer') trainee = models.ForeignKey(InternalUser, related_name='trainee')
32.375
89
0.696429
453
4,144
6.174393
0.240618
0.102967
0.110118
0.062925
0.415088
0.371469
0.371469
0.335002
0.184483
0.184483
0
0.002932
0.176882
4,144
127
90
32.629921
0.817062
0.066361
0
0.39759
0
0
0.034375
0.005729
0
0
0
0
0
1
0.120482
false
0
0.036145
0.120482
0.963855
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
2
ac1651b3b494ed4138e26bda96a1a7764eec8eaf
1,979
py
Python
query.py
weakit/GCI-WHOIS
49d4cf8aad659f93eeb62be6616b2cfa0f6aa12d
[ "MIT" ]
null
null
null
query.py
weakit/GCI-WHOIS
49d4cf8aad659f93eeb62be6616b2cfa0f6aa12d
[ "MIT" ]
null
null
null
query.py
weakit/GCI-WHOIS
49d4cf8aad659f93eeb62be6616b2cfa0f6aa12d
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 import requests as r from bs4 import BeautifulSoup from urllib import parse from random import choice UAs = [ # user agents 'Mozilla Firefox Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:53.0) Gecko/20100101 Firefox/53.0', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/74.0.3729.157 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36', 'Mozilla/5.0 (Windows NT 5.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36', 'Mozilla/5.0 (PlayStation 4 5.55) AppleWebKit/601.2 (KHTML, like Gecko)', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; Xbox; Xbox One) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36' ] URL = "https://viewdns.info/reversewhois/?q=" def scrape(query): url = URL + query req = r.get(url, headers={'User-Agent': choice(UAs)}) soup = BeautifulSoup(req.text, 'html.parser') table = soup.find('table', border=1).find_all('tr')[1:] entries = [] for tr in table: entries.append(tuple(x.text for x in tr.children)) return entries def display(entries): for entry in entries: print(entry[0]) print(entry[1], entry[2], '\n') if __name__ == '__main__': display(scrape(parse.quote(input("Enter registrant name/email: "))))
44.977273
152
0.680647
339
1,979
3.929204
0.359882
0.045045
0.074324
0.072072
0.415916
0.415916
0.400901
0.32958
0.29955
0.149399
0
0.170277
0.160182
1,979
43
153
46.023256
0.631167
0.016675
0
0
0
0.333333
0.645062
0.014403
0
0
0
0
0
1
0.060606
false
0
0.121212
0
0.212121
0.060606
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
ac17a37c56a29369893bcebce2312f2fb7b3c3ab
1,609
py
Python
Python/torsion_angle.py
sockduct/Hackerrank
3f73370fe5e477701e1bb30b116a77b4a2efc888
[ "MIT" ]
null
null
null
Python/torsion_angle.py
sockduct/Hackerrank
3f73370fe5e477701e1bb30b116a77b4a2efc888
[ "MIT" ]
null
null
null
Python/torsion_angle.py
sockduct/Hackerrank
3f73370fe5e477701e1bb30b116a77b4a2efc888
[ "MIT" ]
null
null
null
import math class PointIterator: def __init__(self, point): self._point = point self._index = 0 def __next__(self): if self._index < 3: if self._index == 0: res = self._point.x elif self._index == 1: res = self._point.y else: res = self._point.z self._index += 1 return res raise StopIteration class Point: def __init__(self, x=0, y=0, z=0): self.x = x self.y = y self.z = z def __iter__(self): return PointIterator(self) def __repr__(self): return f'<x={self.x}, y={self.y}, z={self.z}>' def __str__(self): return f'({self.x}, {self.y}, {self.z})' def __sub__(self, other): return Point(other.x - self.x, other.y - self.y, other.z - self.z) def abs(self): return (self.x**2 + self.y**2 + self.z**2)**(0.5) def dot(self, other): return sum(self_i * other_i for self_i, other_i in zip(self, other)) def cross(self, other): return Point(self.y * other.z - self.z * other.y, self.z * other.x - self.x * other.z, self.x * other.y - self.y * other.x) def main(): points = [] for _ in range(4): point = Point(*map(int, input().split())) points.append(point) a, b, c, d = points x = (b - a).cross(c - b) y = (c - b).cross(d - c) angle = math.acos(x.dot(y)/(x.abs() * y.abs())) print(f'{math.degrees(angle):.2f}') if __name__ == '__main__': main()
23.318841
76
0.501554
235
1,609
3.221277
0.246809
0.05284
0.047556
0.023778
0.113606
0.084544
0.055482
0
0
0
0
0.014151
0.341206
1,609
68
77
23.661765
0.7
0
0
0
0
0
0.061529
0.015538
0
0
0
0
0
1
0.22449
false
0
0.020408
0.142857
0.44898
0.020408
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
2
ac58d747bdefce060e170c86c21b7d9d2b487f46
601
py
Python
python/testData/inspections/PyTypeCheckerInspection/CallByClass.py
Tasemo/intellij-community
50aeaf729b7073e91c7c77487a1f155e0dfe3fcd
[ "Apache-2.0" ]
2
2019-04-28T07:48:50.000Z
2020-12-11T14:18:08.000Z
python/testData/inspections/PyTypeCheckerInspection/CallByClass.py
Tasemo/intellij-community
50aeaf729b7073e91c7c77487a1f155e0dfe3fcd
[ "Apache-2.0" ]
null
null
null
python/testData/inspections/PyTypeCheckerInspection/CallByClass.py
Tasemo/intellij-community
50aeaf729b7073e91c7c77487a1f155e0dfe3fcd
[ "Apache-2.0" ]
null
null
null
class Z: def method(self): pass class A: def method(self): Z.method(<warning descr="Expected type 'Z', got 'A' instead">self</warning>) # passing wrong instance Z.method(<warning descr="Expected type 'Z', got 'Type[Z]' instead">Z</warning>) # passing class instead of instance Z.method(<warning descr="Expected type 'Z', got 'Type[A]' instead">A</warning>) # passing class instead of instance AND wrong class Z.method(Z()) #pass def __init__(self): pass class B(A): def __init__(self): A.__init__(self) # pass A.method(B())
31.631579
139
0.62396
86
601
4.22093
0.232558
0.077135
0.115702
0.157025
0.53168
0.53168
0.355372
0.355372
0.258953
0.258953
0
0
0.231281
601
19
140
31.631579
0.785714
0.191348
0
0.4
0
0
0.237006
0
0
0
0
0
0
0
null
null
0.133333
0
null
null
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
1
0
0
0
0
0
2
ac5f47926a272f251132ca9214bcc79734cd9a9a
191
py
Python
Arrays/1426. Counting Elements.py
thewires2/Leetcode
a37ff81d60dd9195ba637b970b40aabbea5f4680
[ "Unlicense" ]
1
2021-06-30T17:51:56.000Z
2021-06-30T17:51:56.000Z
Arrays/1426. Counting Elements.py
thewires2/Leetcode
a37ff81d60dd9195ba637b970b40aabbea5f4680
[ "Unlicense" ]
null
null
null
Arrays/1426. Counting Elements.py
thewires2/Leetcode
a37ff81d60dd9195ba637b970b40aabbea5f4680
[ "Unlicense" ]
null
null
null
class Solution: def countElements(self, nums: List[int]) -> int: nums.sort() k=0 for i in nums: if i+1 in nums: k=k+1 return k
21.222222
52
0.455497
27
191
3.222222
0.62963
0.137931
0
0
0
0
0
0
0
0
0
0.028302
0.445026
191
8
53
23.875
0.792453
0
0
0
0
0
0
0
0
0
0
0
0
1
0.125
false
0
0
0
0.375
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
ac684d2f8e3415f8485ed13b9527e4601d9765ca
386
py
Python
generatePDFList.py
RobRoseKnows/clinton-email-cruncher
44a477e6d1094162478561571b282155ac4f7d2a
[ "MIT" ]
null
null
null
generatePDFList.py
RobRoseKnows/clinton-email-cruncher
44a477e6d1094162478561571b282155ac4f7d2a
[ "MIT" ]
null
null
null
generatePDFList.py
RobRoseKnows/clinton-email-cruncher
44a477e6d1094162478561571b282155ac4f7d2a
[ "MIT" ]
null
null
null
#!/usr/bin/env python # encoding: utf-8 """ generatePDFList.py 1. Get list of links from database 2. Write out file for wget to use """ from __future__ import print_function, division from hrcemail_common import * pdf_base = "https://foia.state.gov/searchapp/" with open('pdflist.txt', 'w') as list_file: for doc in Document.select(): list_file.write(pdf_base+doc.pdfLink+"\n")
20.315789
47
0.73057
62
386
4.387097
0.806452
0.051471
0
0
0
0
0
0
0
0
0
0.009009
0.137306
386
18
48
21.444444
0.807808
0.323834
0
0
1
0
0.186508
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0.166667
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
ac6ba172c026521382fad5c074ec45a0ab503861
93
py
Python
python-3/beginner/1759.py
MisaelAugusto/uri
22bee72edf44f939d7a290383336b4d061faecbb
[ "MIT" ]
null
null
null
python-3/beginner/1759.py
MisaelAugusto/uri
22bee72edf44f939d7a290383336b4d061faecbb
[ "MIT" ]
null
null
null
python-3/beginner/1759.py
MisaelAugusto/uri
22bee72edf44f939d7a290383336b4d061faecbb
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- N = int(input()) answer = " ".join(["Ho"] * N) + "!" print(answer)
13.285714
35
0.462366
12
93
3.583333
0.833333
0
0
0
0
0
0
0
0
0
0
0.013514
0.204301
93
7
36
13.285714
0.567568
0.225806
0
0
0
0
0.056338
0
0
0
0
0
0
1
0
false
0
0
0
0
0.333333
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
ac7091ea64775cea58f66c668d7db53a3ba2412e
1,845
py
Python
notes/algo-ds-practice/problems/graph/stable_marriage.py
Anmol-Singh-Jaggi/interview-notes
65af75e2b5725894fa5e13bb5cd9ecf152a0d652
[ "MIT" ]
6
2020-07-05T05:15:19.000Z
2021-01-24T20:17:14.000Z
notes/algo-ds-practice/problems/graph/stable_marriage.py
Anmol-Singh-Jaggi/interview-notes
65af75e2b5725894fa5e13bb5cd9ecf152a0d652
[ "MIT" ]
null
null
null
notes/algo-ds-practice/problems/graph/stable_marriage.py
Anmol-Singh-Jaggi/interview-notes
65af75e2b5725894fa5e13bb5cd9ecf152a0d652
[ "MIT" ]
2
2020-09-14T06:46:37.000Z
2021-06-15T09:17:21.000Z
''' The Stable Marriage Problem states that given N men and N women, where each person has ranked all members of the opposite sex in order of preference, marry the men and women together such that there are no two people of opposite sex who would both rather have each other than their current partners. If there are no such people, all the marriages are “stable” (Source Wiki). Consider the following example. Let there be two men m1 and m2 and two women w1 and w2. Let m1‘s list of preferences be {w1, w2} Let m2‘s list of preferences be {w1, w2} Let w1‘s list of preferences be {m1, m2} Let w2‘s list of preferences be {m1, m2} The matching { {m1, w2}, {w1, m2} } is not stable because m1 and w1 would prefer each other over their assigned partners. The matching {m1, w1} and {m2, w2} is stable because there are no two people of opposite sex that would prefer each other over their assigned partners. SOLUTION: The idea is to iterate through all free men while there is any free man available. Every free man goes to all women in his preference list according to the order. For every woman he goes to, he checks if the woman is free, if yes, they both become engaged. If the woman is not free, then the woman chooses either says no to him or dumps her current engagement according to her preference list. So an engagement done once can be broken if a woman gets better option. Time Complexity of Gale-Shapley Algorithm is O(n2). Initialize all men and women to free while there exist a free man m who still has a woman w to propose to { w = m's highest ranked such woman to whom he has not yet proposed if w is free (m, w) become engaged else some pair (m', w) already exists if w prefers m to m' (m, w) become engaged m' becomes free else (m', w) remain engaged } '''
47.307692
299
0.732249
338
1,845
3.997041
0.387574
0.014804
0.020725
0.053294
0.189489
0.189489
0.189489
0.15396
0
0
0
0.018815
0.222222
1,845
38
300
48.552632
0.922648
0.99458
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
ac76f30e97497ea605c18477c2658d792b5dd1d6
144
py
Python
Practice/MATDYS.py
anirudhkannanvp/CODECHEF
6d108058c11207caa2e35e471ba88f84c0ea9774
[ "MIT" ]
null
null
null
Practice/MATDYS.py
anirudhkannanvp/CODECHEF
6d108058c11207caa2e35e471ba88f84c0ea9774
[ "MIT" ]
null
null
null
Practice/MATDYS.py
anirudhkannanvp/CODECHEF
6d108058c11207caa2e35e471ba88f84c0ea9774
[ "MIT" ]
null
null
null
for _ in range(int(input())): n,k=map(int,input().split()) a=bin(k)[2:] a=str(a) a=a.zfill(n) a=a[::-1] print(int(a,2))
18
32
0.479167
29
144
2.344828
0.551724
0.088235
0
0
0
0
0
0
0
0
0
0.027273
0.236111
144
7
33
20.571429
0.590909
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.142857
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
ac83cc1ba7becbfdff3350c213bd2c0b8e7e5e57
2,428
py
Python
iktomi/forms/perms.py
boltnev/iktomi
bc92006c026f9b42e56f1af5ced2fe577673a486
[ "MIT" ]
14
2015-02-15T05:24:22.000Z
2020-03-19T10:07:28.000Z
iktomi/forms/perms.py
boltnev/iktomi
bc92006c026f9b42e56f1af5ced2fe577673a486
[ "MIT" ]
10
2015-04-04T10:10:41.000Z
2016-06-01T13:17:58.000Z
iktomi/forms/perms.py
boltnev/iktomi
bc92006c026f9b42e56f1af5ced2fe577673a486
[ "MIT" ]
5
2015-02-20T11:18:58.000Z
2016-10-18T15:30:13.000Z
# -*- coding: utf-8 -*- ''' This module contains basic form access control classes. You can set permissions to form and fields like this:: class SampleForm(form.Form): permissions = 'rwcx' fields=[fields.Field('input', permissions='rw')] or define your own permission logic:: class SampleForm(form.Form): permissions = 'rwcx' fields=[fields.Field('input', perm_getter=UserBasedPerm({'admin': 'rw', 'user': 'r'}))] or pass form permissions to constructor:: >>> form = SampleForm(env, data, permissions='rw') To access current permissions set you can use field's :attr:`permissions` property: >>> form.get_field('input').permissions set(['r', 'w']) ''' DEFAULT_PERMISSIONS = set('rwc') class FieldPerm(object): ''' Default permission getter for Field objects Ancestor should override the :meth:`check` method. They can use field.env to get any values from outside. For example:: class RoleBased(FieldPerm): def __init__(self, role_perms): self.role_perms = role_perms def check(self, field): user = field.env.user perms = set(self.role_perms.get('*', '')) for role in user.roles: perms.update(self.role_perms.get(role, '')) return perms ''' permissions = None def __init__(self, permissions=None): if permissions is not None: self.permissions = set(permissions) def get_perms(self, obj): ''' Returns combined Environment's and object's permissions. Resulting condition is intersection of them. ''' return self.available(obj) & self.check(obj) def available(self, field): ''' Returns permissions according environment's limiting condition. Determined by object's context Allows only field's parents' permissions ''' return field.parent.permissions def check(self, field): ''' Returns permissions determined by object itself ''' if self.permissions is None: return field.parent.permissions return self.permissions def __repr__(self): return '{}({})'.format(self.__class__.__name__, str(self.permissions))
27.590909
78
0.589786
264
2,428
5.314394
0.397727
0.032074
0.037063
0.032787
0.085531
0.085531
0.085531
0.085531
0.085531
0.085531
0
0.000592
0.304778
2,428
87
79
27.908046
0.830569
0.66598
0
0.125
0
0
0.013867
0
0
0
0
0
0
1
0.3125
false
0
0
0.0625
0.75
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
3bb161d9b6e087ae3fefe00e04ef62cfb972f444
4,155
py
Python
dfs/nba/predict.py
jgershen/sportsball
8aa2a599091fb14d1897f2e4b77384e9ee6b0eed
[ "MIT" ]
21
2016-03-12T00:59:04.000Z
2022-03-01T21:32:51.000Z
dfs/nba/predict.py
jgershen/sportsball
8aa2a599091fb14d1897f2e4b77384e9ee6b0eed
[ "MIT" ]
1
2017-04-17T04:39:46.000Z
2017-04-17T04:39:46.000Z
dfs/nba/predict.py
jgershen/sportsball
8aa2a599091fb14d1897f2e4b77384e9ee6b0eed
[ "MIT" ]
4
2016-07-25T11:55:52.000Z
2019-06-19T20:55:53.000Z
""" Predict player values (using a pre-built model) for a game. This should support games which have not yet taken place, as well as past games. """ import pandas as pd, numpy as np from dfs.extdata.bbr.gamelogs import load_all_game_data from dfs.nba.featurizers import salary_fzr from dfs.nba.playerid import get_position, team_tla, name2nbaid from dfs.fanduel2.io import get_game_info, get_loaded_games, read_player_csv import datetime from dateutil.parser import parse def get_eligible_players_df(game_day, fd_game_id=None, guess_historical=False): """ Get a dataframe of eligible NBA players on the target day for a particular FanDuel game ID. :param datetime.datetime game_day: day to grab players for :param int game_id: FanDuel game ID :param bool guess_historical: whether to guess who was an "eligible" player that day -- only include anyone who actually played :return pd.DataFrame: rows for eligible players """ parsed_date = parse(game_day) if not guess_historical: if fd_game_id is None: print "Loading possible game IDs for this day..." loaded_games = get_loaded_games('nba') loaded_games['gameday'] = loaded_games['gamedate'].apply(lambda d: d.date()) todays_games = loaded_games[loaded_games['gameday'] == parsed_date.date()] #import IPython #IPython.embed() chosen_game = todays_games.iloc[0] fd_game_id = chosen_game['game_id'] print 'Choosing game', chosen_game['title'], '(ID', fd_game_id, ')' print ' Starts at:', chosen_game['gameday'] print ' Fee: $', chosen_game['fee'] player_df = read_player_csv('nba', parsed_date, fd_game_id) player_df['Tm'] = player_df['Team'].apply(team_tla) player_df['Opp'] = player_df['Opponent'].apply(team_tla) player_df['date'] = pd.Series(parsed_date, index=player_df.index) player_df['bref_id'] = player_df.apply(lambda row: name2nbaid(row['First Name'] + ' ' + row['Last Name'], row['Tm']), axis=1) player_df['bref_id_confidence'] = player_df.apply(lambda row: name2nbaid(row['First Name'] + ' ' + row['Last Name'], row['Tm'], get_confidence=True)[1], axis=1) player_df.rename(columns={'Position': 'pos', 'Salary': 'salary'}, inplace=True) # Dump anyone we had low confidence in matching by team/name player_df = player_df[player_df['bref_id_confidence'] >= 75] # Finally, dump anyone who is injured (todo: keep GTD players?) safe_players = player_df[player_df['Injury Indicator'].isnull()].copy() return safe_players elif guess_historical and parsed_date.date() >= datetime.date.today(): raise ValueError("Can't guess historical players for a game that hasn't happened yet...") else: # load historical players from our archive as if it were a game about to be played game_date = parsed_date.date() all_games = load_all_game_data() day_players = all_games[all_games['date'] == game_date] actual_players = day_players[day_players['MP'] > 0] return_df = actual_players[['bref_id', 'Opp', 'Tm']].copy() # set the date to the gameday everywhere return_df['date'] = pd.Series(parsed_date, index=return_df.index) # Grab salary information from our scraped numberfire cache return_df['salary'] = return_df.apply(lambda row: salary_fzr(row), axis=1) # Assemble player positional information from our gamelogs return_df['pos'] = return_df['bref_id'].apply(lambda pid: get_position(pid)) return return_df def dump_eligible_players_df(outfile, *args, **kwargs): """ Get a dataframe of eligible NBA players on the target day for a particular FanDuel game ID and save to file Replaces dumping for the live pipeline. :param str outfile: save pickle dump to this file :param datetime.datetime game_day: day to grab players for :param int game_id: FanDuel game ID :param bool guess_historical: whether to guess who was an "eligible" player that day -- only include anyone who actually played :return pd.DataFrame: rows for eligible players """ df = get_eligible_players_df(*args, **kwargs) df.to_pickle(outfile)
53.961039
156
0.712395
623
4,155
4.560193
0.303371
0.04787
0.01408
0.019007
0.295671
0.2654
0.2654
0.244984
0.244984
0.244984
0
0.003525
0.180746
4,155
77
157
53.961039
0.831081
0.092659
0
0.042553
0
0
0.139365
0
0
0
0
0.012987
0
0
null
null
0
0.148936
null
null
0.085106
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
1
0
0
0
0
0
0
0
0
2
3bb1b0107ecb791d7d0ade2321ce0986e26c1350
526
py
Python
aoc2019/solutions/day24.py
mdalzell/advent-of-code-2019
ee3c228542999c8efa3961dc5f64dd9c0272826a
[ "MIT" ]
null
null
null
aoc2019/solutions/day24.py
mdalzell/advent-of-code-2019
ee3c228542999c8efa3961dc5f64dd9c0272826a
[ "MIT" ]
null
null
null
aoc2019/solutions/day24.py
mdalzell/advent-of-code-2019
ee3c228542999c8efa3961dc5f64dd9c0272826a
[ "MIT" ]
null
null
null
from aoc2019.shared.solution import Solution from aoc2019.helpers.day24 import getFirstLayoutToAppearTwice, calculateBiodiversityRating, countBugsAfterMinutes class Day24(Solution): def part1(self): startingLayout = '#..../#...#/##.##/....#/#.##.' repeatedLayout = getFirstLayoutToAppearTwice(startingLayout) return calculateBiodiversityRating(repeatedLayout) def part2(self): startingLayout = '#..../#...#/##?##/....#/#.##.' return countBugsAfterMinutes(startingLayout, 200)
40.461538
113
0.68251
35
526
10.257143
0.542857
0.061281
0
0
0
0
0
0
0
0
0
0.038117
0.152091
526
12
114
43.833333
0.766816
0
0
0
0
0
0.110266
0.110266
0
0
0
0
0
1
0.2
false
0
0.2
0
0.7
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
3bbb7d1647d1df60efd9753d84363cfb95cdc5cb
718
py
Python
product/views.py
MartinMwiti/crm
2f775b25e293da410dc3a37d0e03d838df1144ac
[ "MIT" ]
null
null
null
product/views.py
MartinMwiti/crm
2f775b25e293da410dc3a37d0e03d838df1144ac
[ "MIT" ]
null
null
null
product/views.py
MartinMwiti/crm
2f775b25e293da410dc3a37d0e03d838df1144ac
[ "MIT" ]
null
null
null
from rest_framework.generics import ListCreateAPIView, RetrieveUpdateDestroyAPIView from rest_framework import permissions from .models import Product from .serializers import ProductSerializer # Products class ProductListCreateView(ListCreateAPIView): """ ListCreateAPIView executes both 'GET' and 'POST' requests. i.e listing a queryset or creating a model instance. """ serializer_class = ProductSerializer queryset = Product.objects.all() class ProductRetrieveUpdateDestroyView(RetrieveUpdateDestroyAPIView): """ RetrieveUpdateDestroyAPIView executes 'GET', 'PUT', 'PATCH', & 'DELETE' requests. """ serializer_class = ProductSerializer queryset = Product.objects.all()
32.636364
115
0.772981
65
718
8.476923
0.569231
0.029038
0.061706
0.145191
0.206897
0.206897
0.206897
0
0
0
0
0
0.150418
718
21
116
34.190476
0.903279
0.284123
0
0.4
0
0
0
0
0
0
0
0
0
1
0
false
0
0.4
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
3bbdc85fe3c65920fec6f9278e1a60c19a306f5c
526
py
Python
prebuild.py
trombik/TRB_MCP23017
187a9be9526b30860d08d58f6d1c7a78fbd6612e
[ "ISC" ]
1
2019-03-29T08:46:37.000Z
2019-03-29T08:46:37.000Z
prebuild.py
trombik/TRB_MCP23017
187a9be9526b30860d08d58f6d1c7a78fbd6612e
[ "ISC" ]
1
2018-08-12T10:56:32.000Z
2018-08-12T10:56:32.000Z
prebuild.py
trombik/TRB_MCP23017
187a9be9526b30860d08d58f6d1c7a78fbd6612e
[ "ISC" ]
null
null
null
Import("env") src_filter = ["+<TRB_MCP23017.h>"] env.Replace(SRC_FILTER=src_filter) build_flags = env.ParseFlags(env['BUILD_FLAGS']) cppdefines = build_flags.get("CPPDEFINES") if "TRB_MCP23017_ESP_IDF" in cppdefines: env.Append(SRC_FILTER=["+<TRB_MCP23017.c>", "+<sys/esp_idf>"]) if "TRB_MCP23017_ARDUINO_WIRE" in cppdefines: env.Append(SRC_FILTER=["+<TRB_MCP23017.cpp>", "+<sys/arduino_wire>"]) if "TRB_MCP23017_ARDUINO_BRZO" in cppdefines: env.Append(SRC_FILTER=["+<TRB_MCP23017.cpp>", "+<sys/arduino_brzo>"])
37.571429
73
0.73384
76
526
4.75
0.315789
0.213296
0.132964
0.221607
0.412742
0.412742
0.412742
0.412742
0.299169
0.299169
0
0.072464
0.081749
526
13
74
40.461538
0.674948
0
0
0
0
0
0.414449
0.095057
0
0
0
0
0
1
0
false
0
0.090909
0
0.090909
0
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
3bc854c9ef9864ff78d28378f8d7b4e8c9998066
1,320
py
Python
examples/simpleExample2.py
CharlesHahn/DL-PeptideBuilder
098c873a2e428f9a48b1bee2e1a21dd92806d119
[ "MIT" ]
1
2021-12-24T14:35:24.000Z
2021-12-24T14:35:24.000Z
examples/simpleExample2.py
CharlesHahn/DL-PeptideBuilder
098c873a2e428f9a48b1bee2e1a21dd92806d119
[ "MIT" ]
null
null
null
examples/simpleExample2.py
CharlesHahn/DL-PeptideBuilder
098c873a2e428f9a48b1bee2e1a21dd92806d119
[ "MIT" ]
1
2021-12-20T13:48:02.000Z
2021-12-20T13:48:02.000Z
""" A simple example script demonstrating how to build peptide by PeptideConstructor in primitive way. The script generates a peptide of "AKlsDe" in self-defined conformation, and it stores the peptide under the name "simple_example.pdb". """ import Bio.PDB from PeptideConstructor import Geometry from PeptideConstructor import PeptideBuilder ## create a peptide of "AKlsDe", uppercases mean L amino acids while lowercases indicate D amino acids ## construct the first amino acid geo = Geometry.geometry("A") ## delete the next two lines to not assign secondary structure geo.phi = -60 geo.psi_im1 = -50 structure = PeptideBuilder.initialize_res(geo) ## construcet the rest geo = Geometry.geometry("K") PeptideBuilder.add_residue(structure, geo) geo = Geometry.geometry("l") PeptideBuilder.add_residue(structure, geo) geo = Geometry.geometry("s") PeptideBuilder.add_residue(structure, geo) geo = Geometry.geometry("D") PeptideBuilder.add_residue(structure, geo) geo = Geometry.geometry("e") PeptideBuilder.add_residue(structure, geo) ## add terminal oxygen (OXT) to the final amino acid ## if "NME" capping has been added, NO OXT should be added. PeptideBuilder.add_terminal_OXT(structure) ## save peptide structure to a pdb file out = Bio.PDB.PDBIO() out.set_structure(structure) out.save("simpleExample.pdb")
32.195122
135
0.783333
186
1,320
5.5
0.467742
0.064516
0.111437
0.16129
0.250244
0.215054
0.215054
0.215054
0
0
0
0.004325
0.124242
1,320
40
136
33
0.880623
0.447727
0
0.238095
1
0
0.032486
0
0
0
0
0
0
1
0
false
0
0.142857
0
0.142857
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
3bcbf1e640630cd6e9b54f186a1063d914d91db3
258
py
Python
temp_report/get_name.py
QmFzZTY0/Tool_Project
3b9e718ab6416e3606d00716a744dc44dd7a8257
[ "MIT" ]
1
2019-04-29T23:24:44.000Z
2019-04-29T23:24:44.000Z
temp_report/get_name.py
overflow65537/Tool_Project
3b9e718ab6416e3606d00716a744dc44dd7a8257
[ "MIT" ]
null
null
null
temp_report/get_name.py
overflow65537/Tool_Project
3b9e718ab6416e3606d00716a744dc44dd7a8257
[ "MIT" ]
null
null
null
#!/usr/local/python3.7 # -*- coding:utf8 -*- from datetime import datetime, date, timedelta def get_name(inf = 0): day = (date.today() + timedelta(days = inf)).strftime("%Y-%m-%d") name = '/home/pi/code/temp_report/log/'+day+'.log' return name
25.8
69
0.631783
38
258
4.236842
0.789474
0
0
0
0
0
0
0
0
0
0
0.018433
0.158915
258
9
70
28.666667
0.723502
0.158915
0
0
0
0
0.195349
0.139535
0
0
0
0
0
1
0.2
false
0
0.2
0
0.6
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
3bd294a9951bdfbef3aa373a1ca63b4edb27c886
287
py
Python
client_site/urls.py
sargentfrancesca/coming-up-roses
fa90400cfc0535a8d102cbd0c3c15da858557a2d
[ "MIT" ]
null
null
null
client_site/urls.py
sargentfrancesca/coming-up-roses
fa90400cfc0535a8d102cbd0c3c15da858557a2d
[ "MIT" ]
null
null
null
client_site/urls.py
sargentfrancesca/coming-up-roses
fa90400cfc0535a8d102cbd0c3c15da858557a2d
[ "MIT" ]
null
null
null
from django.conf.urls import patterns, url from client_site import views urlpatterns = patterns('', url(r"^about/", views.AboutView.as_view(), name="about"), ) from django.conf.urls.static import static urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
26.090909
78
0.773519
40
287
5.425
0.525
0.092166
0.129032
0.165899
0
0
0
0
0
0
0
0
0.101045
287
10
79
28.7
0.841085
0
0
0
0
0
0.041812
0
0
0
0
0
0
1
0
false
0
0.428571
0
0.428571
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
3be173d831829a4403ae1115dae092307301692e
469
py
Python
scripts/cros_env_whitelist.py
khromiumos/chromiumos-chromite
a42a85481cdd9d635dc40a04585e427f89f3bb3f
[ "BSD-3-Clause" ]
null
null
null
scripts/cros_env_whitelist.py
khromiumos/chromiumos-chromite
a42a85481cdd9d635dc40a04585e427f89f3bb3f
[ "BSD-3-Clause" ]
2
2021-03-26T00:29:32.000Z
2021-04-30T21:29:33.000Z
scripts/cros_env_whitelist.py
khromiumos/chromiumos-chromite
a42a85481cdd9d635dc40a04585e427f89f3bb3f
[ "BSD-3-Clause" ]
null
null
null
# -*- coding: utf-8 -*- # Copyright (c) 2012 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Print the environment whitelist.""" from __future__ import print_function import sys from chromite.lib import constants assert sys.version_info >= (3, 6), 'This module requires Python 3.6+' def main(_argv): print(' '.join(constants.CHROOT_ENVIRONMENT_WHITELIST))
23.45
72
0.73774
70
469
4.814286
0.785714
0.118694
0
0
0
0
0
0
0
0
0
0.022843
0.159915
469
19
73
24.684211
0.832487
0.464819
0
0
0
0
0.136364
0
0
0
0
0
0.166667
1
0.166667
false
0
0.5
0
0.666667
0.333333
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
3beecb3992578c73cb6fd5ee9c0b1a7039c07b37
1,308
py
Python
tipfy/local.py
pombreda/tipfy
900e5a31a5d24107efa8dfacd89fd69d207cf470
[ "BSD-3-Clause" ]
23
2015-02-15T22:35:04.000Z
2021-11-17T11:39:24.000Z
permit/lib/dist/tipfy/local.py
stanlee321/pysolper
5fa7a5424281ddac2957821b6e1cdc42a0931387
[ "Apache-2.0" ]
null
null
null
permit/lib/dist/tipfy/local.py
stanlee321/pysolper
5fa7a5424281ddac2957821b6e1cdc42a0931387
[ "Apache-2.0" ]
3
2016-03-21T15:57:28.000Z
2020-11-26T02:26:19.000Z
# -*- coding: utf-8 -*- """ tipfy.local ~~~~~~~~~~~ Context-local utilities. :copyright: 2011 by tipfy.org. :license: BSD, see LICENSE.txt for more details. """ import werkzeug.local #: Context-local. local = werkzeug.local.Local() def get_app(): """Returns the current WSGI app instance. :returns: The current :class:`tipfy.app.App` instance. """ return local.app def get_request(): """Returns the current request instance. :returns: The current :class:`tipfy.app.Request` instance. """ return local.request #: A proxy to the active handler for a request. This is intended to be used by #: functions called out of a handler context. Usage is generally discouraged: #: it is preferable to pass the handler as argument when possible and only use #: this as last alternative -- when a proxy is really needed. #: #: For example, the :func:`tipfy.utils.url_for` function requires the current #: request to generate a URL. As its purpose is to be assigned to a template #: context or other objects shared between requests, we use `current_handler` #: there to dynamically get the currently active handler. current_handler = local('current_handler') #: Same as current_handler, only for the active WSGI app. current_app = local('app')
27.829787
78
0.698012
185
1,308
4.891892
0.454054
0.055249
0.075138
0.055249
0.083978
0.083978
0.083978
0
0
0
0
0.004757
0.196483
1,308
46
79
28.434783
0.856327
0.764526
0
0
0
0
0.077253
0
0
0
0
0
0
1
0.25
false
0
0.125
0
0.625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
3befc33bb9ba55eec91fb86335fb9cf80cee36db
16,488
py
Python
Young_Massive_Stars/Code_v32_bar/plots/Plot_Surfaces.py
lhquirogan/Galactic_Maser_Simulator
cb74afd40b6d99429219c44114c74e150d3f5189
[ "MIT" ]
null
null
null
Young_Massive_Stars/Code_v32_bar/plots/Plot_Surfaces.py
lhquirogan/Galactic_Maser_Simulator
cb74afd40b6d99429219c44114c74e150d3f5189
[ "MIT" ]
null
null
null
Young_Massive_Stars/Code_v32_bar/plots/Plot_Surfaces.py
lhquirogan/Galactic_Maser_Simulator
cb74afd40b6d99429219c44114c74e150d3f5189
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- ''' Arecibo: Sources that satisfy Arecibo limits= 76 (Observations) Index factor of the observed flux density function -0.471161157475 (Observation) ################################################################################ MMB: Sources that satisfy MMB limits= 927 (Observations) Index factor of the observed flux density function -0.581896115547 (Observation) ''' #------------------------------------------------------------------------ #Path %cd "/Users/luishenryquiroganunez/Documents/Leiden_University/3_Semester/MSc_thesis/Codes/Code_v31/surface_bestnalpha/Matrix_ind_num_nbar8_sigma4" #Importing Libraries import csv import numpy from pylab import * import matplotlib.pyplot as plt import matplotlib.patches as patches import astropy from astropy.io import ascii import matplotlib.lines as mlines from math import * import scipy from scipy import interpolate from scipy import ndimage import os #------------------------------------------------------------------------ #Reading the cube names_txt_files=[] num_files=(len([name for name in os.listdir('.') if os.path.isfile(name)]))-1 for i in range(num_files): names_txt_files.append('Calc_Num_Ind_'+str(i)+'.txt') #Creating cubes data_dummy=numpy.loadtxt(names_txt_files[0]) size=data_dummy.shape cube_MMB_num=numpy.zeros([int(numpy.sqrt(size[0])),int(numpy.sqrt(size[0])),len(names_txt_files)]) cube_MMB_ind=numpy.zeros([int(numpy.sqrt(size[0])),int(numpy.sqrt(size[0])),len(names_txt_files)]) cube_MMB_chi2=numpy.zeros([int(numpy.sqrt(size[0])),int(numpy.sqrt(size[0])),len(names_txt_files)]) cube_MMB_KLD=numpy.zeros([int(numpy.sqrt(size[0])),int(numpy.sqrt(size[0])),len(names_txt_files)]) cube_Arecibo_num=numpy.zeros([int(numpy.sqrt(size[0])),int(numpy.sqrt(size[0])),len(names_txt_files)]) cube_Arecibo_ind=numpy.zeros([int(numpy.sqrt(size[0])),int(numpy.sqrt(size[0])),len(names_txt_files)]) cube_Arecibo_chi2=numpy.zeros([int(numpy.sqrt(size[0])),int(numpy.sqrt(size[0])),len(names_txt_files)]) cube_Arecibo_KLD=numpy.zeros([int(numpy.sqrt(size[0])),int(numpy.sqrt(size[0])),len(names_txt_files)]) #Constants of the observations num_MMB_obs=908#837#927 ind_MMB_obs=-0.599716013349 #-0.657976860525#-0.581896115547 num_Arecibo_obs=76 ind_Arecibo_obs=-0.471161157475 #------------------------------------------------------------------------ #Getting the data for i in range(len(names_txt_files)): data=numpy.loadtxt(names_txt_files[i]) #Sorting the data num_0=data[:,0] ind_0=data[:,1] MMB_num=abs(data[:,2]-num_MMB_obs) MMB_ind=abs(abs(data[:,3])-abs(ind_MMB_obs)) MMB_chi2=data[:,4] MMB_KLD=data[:,5] Arecibo_num=abs(data[:,6]-num_Arecibo_obs) Arecibo_ind=abs(abs(data[:,7])-abs(ind_Arecibo_obs)) Arecibo_chi2=data[:,8] Arecibo_KLD=data[:,9] data_dims=(int(numpy.sqrt(size[0])),int(numpy.sqrt(size[0]))) num = np.asarray(num_0).reshape(data_dims) ind = np.asarray(ind_0).reshape(data_dims) MMB_n = np.asarray(MMB_num).reshape(data_dims) MMB_i= np.asarray(MMB_ind).reshape(data_dims) MMB_chi = np.asarray(MMB_chi2).reshape(data_dims) MMB_KLD2 = np.asarray(MMB_KLD).reshape(data_dims) Arecibo_n= np.asarray(Arecibo_num).reshape(data_dims) Arecibo_i= np.asarray(Arecibo_ind).reshape(data_dims) Arecibo_chi = np.asarray(Arecibo_chi2).reshape(data_dims) Arecibo_KLD2 = np.asarray(Arecibo_KLD).reshape(data_dims) cube_MMB_num[:,:,i]=MMB_n cube_MMB_ind[:,:,i]=MMB_i cube_MMB_chi2[:,:,i]=MMB_chi cube_MMB_KLD[:,:,i]=MMB_KLD2 cube_Arecibo_num[:,:,i]=Arecibo_n cube_Arecibo_ind[:,:,i]=Arecibo_i cube_Arecibo_chi2[:,:,i]=Arecibo_chi cube_Arecibo_KLD[:,:,i]=Arecibo_KLD2 #------------------------------------------------------------------------ #Colapsing the cubes final_MMB_num=numpy.mean(cube_MMB_num,axis=2) final_MMB_ind=numpy.mean(cube_MMB_ind,axis=2) final_MMB_chi2=numpy.mean(cube_MMB_chi2,axis=2) final_MMB_KLD=numpy.mean(cube_MMB_KLD,axis=2) final_Arecibo_num=numpy.mean(cube_Arecibo_num,axis=2) final_Arecibo_ind=numpy.mean(cube_Arecibo_ind,axis=2) final_Arecibo_chi2=numpy.mean(cube_Arecibo_chi2,axis=2) final_Arecibo_KLD=numpy.mean(cube_Arecibo_KLD,axis=2) ############################################################################################################ #PLOTSSSS! ############################################################################################################ # One Surface Plot #h = plt.contourf(num[:,0],ind[0,:],MMB_n) h=imshow(final_MMB_num, interpolation='none', origin='bottom', extent=[numpy.min(num[:,0]), numpy.max(num[:,0]), numpy.min(ind[0,:]), np.max(ind[0,:])],aspect='auto') plt.colorbar(h, orientation='vertical') plt.xlabel("Initial Number of Sources") plt.ylabel("Initial Index value") plt.show() #------------------------------------------------------------------------ # Four Surface Plot fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, sharex='col', sharey='row') a=ax1.imshow(final_MMB_num, interpolation='none', origin='bottom', extent=[numpy.min(num[:,0]), numpy.max(num[:,0]), numpy.min(ind[0,:]), np.max(ind[0,:])],aspect='auto') #ax1.colorbar(a, orientation='vertical') ax1.set_title('MMB Survey') b=ax2.imshow(final_Arecibo_num, interpolation='none', origin='bottom', extent=[numpy.min(num[:,0]), numpy.max(num[:,0]), numpy.min(ind[0,:]), np.max(ind[0,:])],aspect='auto') ax2.set_title('Arecibo Survey') c=ax3.imshow(final_MMB_ind, interpolation='none', origin='bottom', extent=[numpy.min(num[:,0]), numpy.max(num[:,0]), numpy.min(ind[0,:]), np.max(ind[0,:])],aspect='auto') d=ax4.imshow(final_Arecibo_ind, interpolation='none', origin='bottom', extent=[numpy.min(num[:,0]), numpy.max(num[:,0]), numpy.min(ind[0,:]), np.max(ind[0,:])],aspect='auto') fig.subplots_adjust(right=0.8) cbar_ax_a = fig.add_axes([0.85, 0.53, 0.05, 0.37])#[left, bottom, width, height] fig.colorbar(a, cax=cbar_ax_a) cbar_ax_b = fig.add_axes([0.85, 0.1, 0.05, 0.37])#[left, bottom, width, height] fig.colorbar(b, cax=cbar_ax_b) plt.show() #------------------------------------------------------------------------ # Only MMB Surface Plot #With KLD matplotlib.rcParams.update({'font.size': 17}) fig, ax1 = plt.subplots(1, 1) a=ax1.imshow(final_MMB_KLD, interpolation='none', origin='bottom', extent=[numpy.min(num[:,0]), numpy.max(num[:,0]), numpy.min(ind[0,:]), np.max(ind[0,:])],aspect='auto') #ax1.colorbar(a, orientation='vertical') ax1.set_title('Initial Conditions $N_i$ and $\\alpha$ compared MMB Survey') ax1.set_ylabel('Initial Index Value $(\\alpha)$') ax1.set_xlabel('Initial Number of Sources $(N_i)$') fig.subplots_adjust(right=0.8) cbar_ax_a = fig.add_axes([0.85, 0.1, 0.05, 0.8])#[left, bottom, width, height] fig.colorbar(a, cax=cbar_ax_a) plt.ylabel("$KL$ Differentation") fig.set_label('Initial Index Value') plt.show() #With chi 2 matplotlib.rcParams.update({'font.size': 17}) fig, ax1 = plt.subplots(1, 1) a=ax1.imshow(numpy.log(final_MMB_chi2), interpolation='none', origin='bottom', extent=[numpy.min(num[:,0]), numpy.max(num[:,0]), numpy.min(ind[0,:]), np.max(ind[0,:])],aspect='auto') #ax1.colorbar(a, orientation='vertical') ax1.set_title('Initial Conditions $N_i$ and $\\alpha$ compared MMB Survey') ax1.set_ylabel('Initial Index Value $(\\alpha)$') ax1.set_xlabel('Initial Number of Sources $(N_i)$') fig.subplots_adjust(right=0.8) cbar_ax_a = fig.add_axes([0.85, 0.1, 0.05, 0.8])#[left, bottom, width, height] fig.colorbar(a, cax=cbar_ax_a) plt.ylabel("log($\\chi^2$)") fig.set_label('Initial Index Value') plt.show() #pyplot.savefig("Surface.png",bbox_inches='tight') #With Num and Ind matplotlib.rcParams.update({'font.size': 17}) fig, (ax1,ax2) = plt.subplots(2, 1, sharex='col') a=ax1.imshow(MMB_n, interpolation='none', origin='bottom', extent=[numpy.min(num[:,0]), numpy.max(num[:,0]), numpy.min(ind[0,:]), np.max(ind[0,:])],aspect='auto') #ax1.colorbar(a, orientation='vertical') ax1.set_title('Initial Conditions $N_i$ and $\\alpha$ compared MMB Survey') ax1.set_ylabel('Initial Index Value $(\\alpha)$') b=ax2.imshow(MMB_i, interpolation='none', origin='bottom', extent=[numpy.min(num[:,0]), numpy.max(num[:,0]), numpy.min(ind[0,:]), np.max(ind[0,:])],aspect='auto') ax2.set_xlabel('Initial Number of Sources $(N_i)$') ax2.set_ylabel('Initial Index Value $(\\alpha)$') fig.subplots_adjust(right=0.8) cbar_ax_a = fig.add_axes([0.85, 0.53, 0.05, 0.37])#[left, bottom, width, height] fig.colorbar(a, cax=cbar_ax_a) plt.ylabel("|$N-N_{obs}$|") cbar_ax_b = fig.add_axes([0.85, 0.1, 0.05, 0.37])#[left, bottom, width, height] fig.colorbar(b, cax=cbar_ax_b) plt.ylabel("|$ \\beta-\\beta_{obs}$|") fig.set_label('Initial Index Value') plt.show() #------------------------------------------------------------------------ # Only Arecibo Surface Plot from matplotlib.colors import LogNorm matplotlib.rcParams.update({'font.size': 17}) fig, (ax1,ax2) = plt.subplots(2, 1, sharex='col') a=ax1.imshow(Arecibo_n, interpolation='none', origin='bottom', extent=[numpy.min(num[:,0]), numpy.max(num[:,0]), numpy.min(ind[0,:]), np.max(ind[0,:])],aspect='auto',norm=LogNorm(vmin=1, vmax=100)) #ax1.colorbar(a, orientation='vertical') ax1.set_title('Initial Conditions $N_i$ and $\\alpha$ compared Arecibo Survey') ax1.set_ylabel('Initial Index Value $(\\alpha)$') b=ax2.imshow(Arecibo_i, interpolation='none', origin='bottom', extent=[numpy.min(num[:,0]), numpy.max(num[:,0]), numpy.min(ind[0,:]), np.max(ind[0,:])],aspect='auto',norm=LogNorm(vmin=0.1, vmax=1)) ax2.set_xlabel('Initial Number of Sources $(N_i)$') ax2.set_ylabel('Initial Index Value $(\\alpha)$') fig.subplots_adjust(right=0.8) cbar_ax_a = fig.add_axes([0.85, 0.53, 0.05, 0.37])#[left, bottom, width, height] fig.colorbar(a, cax=cbar_ax_a) plt.ylabel("|$N-N_{obs}$|") cbar_ax_b = fig.add_axes([0.85, 0.1, 0.05, 0.37])#[left, bottom, width, height] fig.colorbar(b, cax=cbar_ax_b) plt.ylabel("|$ \\beta-\\beta_{obs}$|") fig.set_label('Initial Index Value') plt.show() #pyplot.savefig("Surface_Arecibo.png",bbox_inches='tight') #------------------------------------------------------------------------ #Calculting the minimum between two plots of the MMB #Constants of the observations num_MMB_obs=908 ind_MMB_obs=-0.599716013349 #Getting the data data=numpy.loadtxt('Calc_Num_Ind_0.txt') #Sorting the data num_0=data[:,0] ind_0=data[:,1] MMB_num=abs(data[:,2]-num_MMB_obs)/num_MMB_obs MMB_ind=abs(data[:,3]-ind_MMB_obs)/abs(ind_MMB_obs) #data_dims=(5,5) MMB_n = np.asarray(MMB_num).reshape(data_dims) MMB_i= np.asarray(MMB_ind).reshape(data_dims) Total=numpy.log10(((MMB_n+MMB_i)/2.0)) Total=Total*(-1) Total=Total/(numpy.max(Total)) num = np.asarray(num_0).reshape(data_dims) ind = np.asarray(ind_0).reshape(data_dims) img_gaus = ndimage.filters.gaussian_filter(Total, 2, mode='nearest') num_masers=numpy.linspace(numpy.min(num[:,0]),numpy.max(num[:,0]),100) ind_masers=numpy.linspace(numpy.min(ind[0,:]),numpy.max(ind[0,:]),100) X,Y=numpy.meshgrid(num_masers,ind_masers) #Plot matplotlib.rcParams.update({'font.size': 17}) #fig, ax = plt.subplots() imshow(Total, interpolation='none', origin='bottom', extent=[numpy.min(num[:,0]), numpy.max(num[:,0]), numpy.min(ind[0,:]), np.max(ind[0,:])],aspect='auto') #imshow(img_gaus, interpolation='none', origin='bottom', extent=[numpy.min(num[:,0]), numpy.max(num[:,0]), numpy.min(ind[0,:]), np.max(ind[0,:])],aspect='auto') #CS = plt.contour(x, y, Total,colors='k') #heatmap = ax.pcolor(Total) cbar=plt.colorbar() levels_=[0.2,0.3,0.4,0.5,0.6] levels_range=[0.4] levels_center=[0.4] cs=plt.contour(X, Y, img_gaus,50, colors='k',levels=levels_) plt.clabel(cs, inline=1, fontsize=10) plt.xlabel('Initial Number of Sources $(N_i)$') plt.ylabel('Initial Index Value $(\\alpha)$') #cbar.ax.setlabel('Arbitrary Units', rotation=270) cbar.set_label('Arbitrary Units') #pyplot.savefig("Surface_both_MMB.png",bbox_inches='tight') #Calcutaing the center and error cs2=plt.contour(X, Y, img_gaus,50, colors='k',levels=levels_) p = cs2.collections[0].get_paths()[0] v = p.vertices x = v[:,0] y = v[:,1] cs3=plt.contour(X, Y, img_gaus,50, colors='k',levels=levels_center) p = cs2.collections[0].get_paths()[0] v = p.vertices x_center = v[:,0] y_center = v[:,1] def fitEllipse(x,y): x = x[:,np.newaxis] y = y[:,np.newaxis] D = np.hstack((x*x, x*y, y*y, x, y, np.ones_like(x))) S = np.dot(D.T,D) C = np.zeros([6,6]) C[0,2] = C[2,0] = 2; C[1,1] = -1 E, V = eig(np.dot(inv(S), C)) n = np.argmax(np.abs(E)) a = V[:,n] return a def ellipse_center(a): b,c,d,f,g,a = a[1]/2, a[2], a[3]/2, a[4]/2, a[5], a[0] num = b*b-a*c x0=(c*d-b*f)/num y0=(a*f-b*d)/num return np.array([x0,y0]) aa=fitEllipse(x_center,y_center) center=ellipse_center(aa) #array([ 1540.99789764, -1.56126529]) error_Num=numpy.max([abs(numpy.max(x)-center[0]),abs(numpy.min(x)-center[0])]) error_Ind=numpy.max(abs(numpy.max(y)-center[1]),abs(numpy.min(y)-center[1])) #(172.83114895668996, 0.22829395805862451) #------------------------------------------------------------------------ #Calculting the minimum of the MMB (ESAT ES!) img_gaus = ndimage.filters.gaussian_filter(numpy.log(final_MMB_chi2), 2, mode='nearest') num_masers=numpy.linspace(numpy.min(num[:,0]),numpy.max(num[:,0]),100) ind_masers=numpy.linspace(numpy.min(ind[0,:]),numpy.max(ind[0,:]),100) X,Y=numpy.meshgrid(num_masers,ind_masers) #Plot matplotlib.rcParams.update({'font.size': 27}) fig,ax1= plt.subplots(1, 1,figsize=(12,12)) a=ax1.imshow(numpy.log(final_MMB_chi2), interpolation='nearest', origin='bottom', extent=[numpy.min(num[:,0]), numpy.max(num[:,0]), numpy.min(ind[0,:]), np.max(ind[0,:])],aspect='auto') ax1.set_xticks([1000,1200,1400,1600,1800]) ax1.set_yticks([-1.2,-1.4,-1.6,-1.8,-2.0]) #ax1.set_title('Initial Conditions $N_i$ and $\\alpha$ compared MMB Survey') ax1.set_ylabel('Initial Index Value $(\\alpha)$') ax1.set_xlabel('Initial Number of Sources $(N)$') fig.subplots_adjust(right=0.8) cbar_ax_a = fig.add_axes([0.85, 0.1, 0.05, 0.8])#[left, bottom, width, height] cbar=fig.colorbar(a, cax=cbar_ax_a) levels_=numpy.array([4.65,4.7,4.9,5.4,5.7,6.0,7.2,8.4]) #levels_=numpy.array([4.65, 4.7, 4.8]) cs=ax1.contour(X, Y, img_gaus,hold='on', levels=levels_, colors='k',origin='image') #ax1.clabel(cs, inline=5, fontsize=10) cbar.set_label('log($\\xi^2$)') cbar.set_ticks([5.0,6.0,7.0,8.0]) #pyplot.savefig("../../plots/Surface_both_MMB.pdf",bbox_inches='tight') #levels_center=[4.65] levels_center=[4.9] cs3=plt.contour(X, Y, img_gaus, colors='k',levels=levels_center) p = cs3.collections[0].get_paths()[0] v = p.vertices x_center = v[:,0] y_center = v[:,1] #3D def fitEllipse(x,y): x = x[:,np.newaxis] y = y[:,np.newaxis] D = np.hstack((x*x, x*y, y*y, x, y, np.ones_like(x))) S = np.dot(D.T,D) C = np.zeros([6,6]) C[0,2] = C[2,0] = 2; C[1,1] = -1 E, V = eig(np.dot(inv(S), C)) n = np.argmax(np.abs(E)) a = V[:,n] return a def ellipse_center(a): b,c,d,f,g,a = a[1]/2, a[2], a[3]/2, a[4]/2, a[5], a[0] num = b*b-a*c x0=(c*d-b*f)/num y0=(a*f-b*d)/num return np.array([x0,y0]) aa=fitEllipse(x_center,y_center) center=ellipse_center(aa) #array([ 1298.10797886, -1.43666962]) levels_=numpy.array([4.7]) #Calcutaing the center and error cs2=plt.contour(X, Y, img_gaus, colors='k',levels=levels_) p = cs2.collections[0].get_paths()[0] v = p.vertices x = v[:,0] y = v[:,1] error_Num=numpy.max([abs(numpy.max(x)-center[0]),abs(numpy.min(x)-center[0])]) error_Ind=numpy.max(abs(numpy.max(y)-center[1]),abs(numpy.min(y)-center[1])) #140, 0.33 ############################################################################################### #Calculate beta and N for one same galaxy ############################################################################################### %cd "/Users/luishenryquiroganunez/Documents/Leiden_University/3_Semester/MSc_thesis/Codes/Code_v31/surface_bestnalpha/One_same_galaxy" names_txt_files=os.listdir('.') data=numpy.loadtxt(names_txt_files[1]) N_MMB=np.mean(data[0]) err_N_MMB=np.std(data[0]) alpha_MMB=np.mean(data[1]) err_alpha_MMB=np.std(data[1]) N_Arecibo=np.mean(data[2]) err_N_Arecibo=np.std(data[2]) alpha_Arecibo=np.mean(data[3]) err_alpha_Arecibo=np.std(data[3]) print ('Number of sources detected (N) in MMB (%s +/- %s) and Arecibo (%s +/- %s)' %(N_MMB, err_N_MMB, N_Arecibo, err_N_Arecibo)) print ('Slope Flux Desnisty Function (alpha) in MMB (%s +/- %s) and Arecibo (%s +/- %s)' %(alpha_MMB, err_alpha_MMB, alpha_Arecibo, err_alpha_Arecibo))
43.619048
197
0.651868
2,757
16,488
3.747552
0.113529
0.014712
0.026132
0.027875
0.682056
0.662989
0.641599
0.635501
0.616822
0.610724
0
0.049167
0.082242
16,488
377
198
43.734748
0.633624
0.156659
0
0.511029
0
0.007353
0.130401
0.023751
0
0
0
0
0
0
null
null
0
0.051471
null
null
0.007353
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
3bfeed28588a47cb43fd6eaa101c7462945b7517
2,510
py
Python
webhawk/rest/__init__.py
dtsolis/webhawk
11c7bb4e42a9fe4f8ba43f5642cb9b5ad137cff9
[ "Apache-2.0" ]
4
2019-02-26T07:10:19.000Z
2021-07-11T11:40:58.000Z
webhawk/rest/__init__.py
dtsolis/webhawk
11c7bb4e42a9fe4f8ba43f5642cb9b5ad137cff9
[ "Apache-2.0" ]
10
2019-10-12T11:25:22.000Z
2019-10-22T13:01:20.000Z
webhawk/rest/__init__.py
dtsolis/webhawk
11c7bb4e42a9fe4f8ba43f5642cb9b5ad137cff9
[ "Apache-2.0" ]
2
2019-02-06T08:33:32.000Z
2019-02-25T20:07:08.000Z
import logging.config from flask import Blueprint from flask_restful import Api from repositories.recipe_repository import FileRecipeRepository from rest.api_errors import ApiErrorRegistry from rest.bitbucket_webhook import BitBucketWebHook from rest.github_webhook import GithubWebHook from rest.gitlab_webhook import GitlabWebHook from rest.recipe import Recipe from rest.root import Root from rest.webhawk_webhook import WebHawkWebHook from services.app_context import AppContext from services.build_task_manager import BuildTaskManager from services.builder import Builder from services.git_manager import GitManager from services.multiprocess_task_queue import MultiprocessTaskQueue __author__ = "Dimi Balaouras" __copyright__ = "Copyright 2016, Stek.io" __license__ = "Apache License 2.0, see LICENSE for more details." __version__ = "0.0.1" __description__ = "WebHawk Flask Web Initiator" # Create the Flask App api_blueprint = Blueprint('api', __name__) def bootstrap(flask_app, config): """ Bootstra :param flask_app: The Flask object :param config: Application Config """ global api_blueprint # Create the Flask App # Get logger logger = logging.getLogger("webhawk") # Create the context # TODO: put the following key names in a single class as static strings context = AppContext(allow_replace=False) context.register("config", config) context.register("logger", logger) context.register("task_queue", MultiprocessTaskQueue(context=context)) context.register("recipe_repository", FileRecipeRepository(context=context)) context.register("git_manager", GitManager(context=context)) context.register("builder", Builder(context=context)) # Start Worker Greenlets task_manager = BuildTaskManager(context=context) task_manager.start_workers() context.register("task_manager", task_manager) # Register error handlers ApiErrorRegistry.register_error_handlers(api_blueprint) # Create the flask_restful api rest_api = Api(api_blueprint) # Add Resources to API Recipe.add_resource_to_api(rest_api, context=context) Root.add_resource_to_api(rest_api, context=context) BitBucketWebHook.add_resource_to_api(rest_api, context=context) GithubWebHook.add_resource_to_api(rest_api, context=context) GitlabWebHook.add_resource_to_api(rest_api, context=context) WebHawkWebHook.add_resource_to_api(rest_api, context=context) logger.info("WebHawk RESTful API Initiated")
34.383562
80
0.788048
311
2,510
6.102894
0.321543
0.103267
0.036881
0.05058
0.144362
0.116965
0.116965
0.116965
0
0
0
0.004174
0.141036
2,510
72
81
34.861111
0.87616
0.126693
0
0
0
0
0.10463
0
0
0
0
0.013889
0
1
0.022727
false
0
0.363636
0
0.386364
0.113636
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
1
0
0
0
0
2
ce0fde7a64e86562c33723d13e9ec15e40977e85
552
py
Python
sutils/applications/cancel/cancel.py
t-mertz/slurm_utils
6fc9709f62e2bca1387ea9c7a5975f0f0be5d0dd
[ "MIT" ]
null
null
null
sutils/applications/cancel/cancel.py
t-mertz/slurm_utils
6fc9709f62e2bca1387ea9c7a5975f0f0be5d0dd
[ "MIT" ]
null
null
null
sutils/applications/cancel/cancel.py
t-mertz/slurm_utils
6fc9709f62e2bca1387ea9c7a5975f0f0be5d0dd
[ "MIT" ]
null
null
null
import sys from . import core def run(options): if options['all']: run_all(force=options['force']) elif options['last'] is not None: run_last(options['last'], force=options['force']) elif options['first'] is not None: run_first(options['first'], force=options['force']) else: sys.exit(0) # end of program def run_all(force=False): core.cancel_all(force=force) def run_last(N, force=False): core.cancel_last(N, force=force) def run_first(N, force=False): core.cancel_first(N, force=force)
25.090909
59
0.653986
83
552
4.240964
0.301205
0.068182
0.144886
0.170455
0.278409
0
0
0
0
0
0
0.002252
0.195652
552
21
60
26.285714
0.790541
0.025362
0
0
0
0
0.067164
0
0
0
0
0
0
1
0.235294
false
0
0.117647
0
0.352941
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
ce13dc2b13105a8eb6b1919c3fc5855d6a9f9ddf
1,803
py
Python
tests/wrappers/webservices/test_message.py
icryrainix/odil
7fbcf7bb00af159c2e500bd0c3da1519a4806fb4
[ "CECILL-B" ]
null
null
null
tests/wrappers/webservices/test_message.py
icryrainix/odil
7fbcf7bb00af159c2e500bd0c3da1519a4806fb4
[ "CECILL-B" ]
null
null
null
tests/wrappers/webservices/test_message.py
icryrainix/odil
7fbcf7bb00af159c2e500bd0c3da1519a4806fb4
[ "CECILL-B" ]
1
2020-12-08T03:08:11.000Z
2020-12-08T03:08:11.000Z
import unittest import odil class TestMessage(unittest.TestCase): def test_default_constructor(self): message = odil.webservices.Message() self.assertEqual(dict(message.get_headers()), {}) self.assertEqual(message.get_body(), "") def test_full_constructor(self): message = odil.webservices.Message(headers={"foo": "bar"}, body="body") self.assertEqual(dict(message.get_headers()), {"foo": "bar"}) self.assertEqual(message.get_body(), "body") def test_existing_header(self): message = odil.webservices.Message({"foo": "bar", "plip": "plop"}) self.assertTrue(message.has_header("foo")) self.assertEqual(message.get_header("foo"), "bar") def test_missing_header(self): message = odil.webservices.Message({"foo": "bar", "plip": "plop"}) self.assertFalse(message.has_header("none")) with self.assertRaises(odil.Exception): message.get_header("none") def test_set_headers(self): message = odil.webservices.Message() message.set_headers({"foo": "bar", "plip": "plop"}) self.assertEqual( dict(message.get_headers()), {"foo": "bar", "plip": "plop"}) def test_modify_header(self): message = odil.webservices.Message({"foo": "bar", "plip": "plop"}) message.set_header("foo", "baz") self.assertEqual(message.get_header("foo"), "baz") def test_add_header(self): message = odil.webservices.Message() message.set_header("foo", "baz") self.assertEqual(message.get_header("foo"), "baz") def test_body(self): message = odil.webservices.Message() message.set_body("body") self.assertEqual(message.get_body(), "body") if __name__ == "__main__": unittest.main()
36.06
79
0.633943
205
1,803
5.385366
0.195122
0.09058
0.108696
0.188406
0.71558
0.663043
0.45471
0.34692
0.270833
0.270833
0
0
0.200222
1,803
49
80
36.795918
0.765603
0
0
0.333333
0
0
0.081531
0
0
0
0
0
0.307692
1
0.205128
false
0
0.051282
0
0.282051
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
ce14a99ea606b16a399b613b4b9917054f0e5593
564
py
Python
whattowatch/core/admin.py
svhenrique/What-To-Watch-backend
3bab4ad825e13eead9dae23d68b5f91cd6133720
[ "MIT" ]
null
null
null
whattowatch/core/admin.py
svhenrique/What-To-Watch-backend
3bab4ad825e13eead9dae23d68b5f91cd6133720
[ "MIT" ]
5
2022-02-15T04:29:33.000Z
2022-03-25T03:09:23.000Z
whattowatch/core/admin.py
svhenrique/What-To-Watch-backend
3bab4ad825e13eead9dae23d68b5f91cd6133720
[ "MIT" ]
null
null
null
from django.contrib import admin from core.models import WatchableContent, Episode, HighlightedArea @admin.register(Episode) class EpisodeAdmin(admin.ModelAdmin): list_display = ['active', 'id', 'created_at', 'updated_at', 'episode', 'season', 'content'] @admin.register(WatchableContent) class HighlightedAreaAdmin(admin.ModelAdmin): list_display = ['active', 'id', 'created_at', 'updated_at', ] @admin.register(HighlightedArea) class HighlightedAreaAdmin(admin.ModelAdmin): list_display = ['active','id', 'created_at', 'updated_at', 'position']
33.176471
95
0.75
61
564
6.786885
0.409836
0.094203
0.137681
0.188406
0.497585
0.497585
0.497585
0.497585
0.497585
0.497585
0
0
0.102837
564
17
96
33.176471
0.818182
0
0
0.181818
0
0
0.198582
0
0
0
0
0
0
1
0
false
0
0.181818
0
0.727273
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
ce172439333b80f63aef521c4135c8ba95649975
592
py
Python
GameFiles/Floor.py
cgallimore97/Project-Run
b13bdade19c0b5abdd5d717a7a7b14c441dd017d
[ "MIT" ]
null
null
null
GameFiles/Floor.py
cgallimore97/Project-Run
b13bdade19c0b5abdd5d717a7a7b14c441dd017d
[ "MIT" ]
null
null
null
GameFiles/Floor.py
cgallimore97/Project-Run
b13bdade19c0b5abdd5d717a7a7b14c441dd017d
[ "MIT" ]
null
null
null
import pygame class Floor(pygame.sprite.Sprite): """Represents a solid surface that the Player sprite cannot fall through.""" def __init__(self, screen_width, screen_height): super().__init__() self.surface = pygame.Surface((screen_width, 10)) self.rect = self.surface.get_rect(center = (screen_width / 2, screen_height + 10)) self.surface.fill((255,0,0)) self.invisible = False def update(self): pass def draw(self, screen): """Draw the floor onto the screen.""" screen.blit(self.surface, self.rect)
32.888889
90
0.636824
76
592
4.776316
0.486842
0.121212
0
0
0
0
0
0
0
0
0
0.022272
0.241554
592
18
91
32.888889
0.786192
0.172297
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0.083333
0.083333
0
0.416667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
2
ce19877c590656ef1be75b20357a03168ef473b2
7,253
py
Python
resultAnalysis/analysis/result_analysis.py
ShrirangPatil/ResultAnalysis
6fc5faa9314b42aa374c8eab7347f47988a3ce5d
[ "MIT" ]
3
2019-04-25T16:23:58.000Z
2019-06-15T17:38:10.000Z
resultAnalysis/analysis/result_analysis.py
ShrirangPatil/ResultAnalysis
6fc5faa9314b42aa374c8eab7347f47988a3ce5d
[ "MIT" ]
5
2020-02-12T00:08:48.000Z
2022-02-10T08:06:09.000Z
resultAnalysis/analysis/result_analysis.py
ShrirangPatil/ResultAnalysis
6fc5faa9314b42aa374c8eab7347f47988a3ce5d
[ "MIT" ]
null
null
null
# Improvements: read xlsx or csv , generate xlsx # Allow to select file using Graphical interface # Read college name, department, logo # As a application that opens up interface # Use MapReduce # Generate pdf, Statistics , graph # Input: Results of semester, ordered as # Multiple columns representing subject/subject code # Each row having Grades obtained by student, comma separated # Assuming grade as: S+, S, A, B, C, D, E, F, NE, NP, PP # Saved as a CSV, comma separated value file called result.csv # # To convert xlsx as csv: # The Excel sheet should have columns that represent different subject, and # each row content corresponding to grade obtained by the student for that subject # Excel Sheet: # ________________________ # | Code1 | Code2 | Code3 | # |------------------------| # | S1G1 | S1G2 | S1G3 | # |------------------------| # | S2G1 | S2G2 | S2G3 | # |------------------------| # | S3G1 | S3G2 | S3G3 | # |________|_______|_______| # # An option is available in Excel / Calc of Save as CSV # Save the result.xlsx as result.csv # Excel Sheet result.xlsx # ________________________ # | Code1 | Code2 | Code3 | # |------------------------| # | S+ | S | F | # |------------------------| # | S+ | A | F | # |------------------------| # | F | S+ | F | # |________|_______|_______| # The result.csv will now have: # Code1 , Code2, Code3 # S+ , S , F # S+ , A , S # F , F , F # Output: Count of grades obtained in subject as csv # Example output file "analysis.csv" # CourseCode, S+, S, A, B, C, D, E, F, NE, NP, PP, TF, TP, PassPercent # SubjectCode1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 2, 66.66 # SubjectCode2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 100 # SubjectCode3, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0 # # where TF is Total Failed # TP is Total Passed # PassPercent = TP/(TP+TF) # If the analysis.csv file is opened in Excel / Calc then the same csv is # displayed in tabular format as # ____________________________________________________________________________ # | | S+ | S | A | B | C | D | E | F | NE | NP | PP | TF | TP | PassPerc | # |-------|----|---|---|---|---|---|---|---|----|----|----|----|----|----------| # | Code1 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 2 | 66.66 | # |-------|----|---|---|---|---|---|---|---|----|----|----|----|----|----------| # | Code2 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 100 | # |-------|----|---|---|---|---|---|---|---|----|----|----|----|----|----------| # | Code2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 0 | 0 | 3 | 0 | 0 | # |_______|____|___|___|___|___|___|___|___|____|____|____|____|____|__________| # initialize dictionary # read result.csv # For each student # For each subject grade # update dictionary # # write dictionaty to analysis.csv import csv def analysis_fun(fileName, userSelectedSubCode=[]): try: with open('analysis/static/media/'+fileName+'.csv', 'r') as csvfile: results = csv.reader(csvfile, delimiter=',') subjectCode = next(results, None) #print ( "Subject Codes = ", subjectCode ) #print ( "Total number of Subjects = ", len(subjectCode) ) subject={} for code in subjectCode: subject[code] = { 'S+': 0, 'S': 0, 'A': 0, 'B': 0, 'C': 0, 'D': 0, 'E': 0, 'F': 0, 'NE': 0, 'NP': 0, 'PP': 0, 'TF':0, 'TP':0, } # consider PASS column of result totalNumberOfStudents = 0 totalNumberOfPassStudents = 0 totalNumberOfFailStudents = 0 for row in results: totalNumberOfStudents = totalNumberOfStudents + 1 fail = False for code, grade in zip( subjectCode, row ): if ( grade != '' ): subject[code][grade] = subject[code][grade] + 1 # F is also incremented here if ( grade == 'F' ): subject[code]['TF'] = subject[code]['TF'] + 1 fail = True elif ( grade == 'NE' ): pass else: subject[code]['TP'] = subject[code]['TP'] + 1 if ( fail == True ): totalNumberOfFailStudents = totalNumberOfFailStudents + 1 else: totalNumberOfPassStudents = totalNumberOfPassStudents + 1 with open('analysis/static/media/analysis'+fileName+'.csv', 'w') as csvfile: writeAnalysis = csv.writer( csvfile , delimiter=',' ) writeAnalysis.writerow( [ 'SubjectCode' , 'S+' , 'S' , 'A' , 'B' , 'C' , 'D' , 'E' , 'F' , 'NE' , 'NP' , 'PP', 'TF', 'TP', 'PassPerc' ] ) for code in userSelectedSubCode: if ( subject[code]['TF'] + subject[code]['TP'] ) == 0: passPercentage = 0 else: passPercentage = ( 100.00 * subject[code]['TP'] ) / ( subject[code]['TF'] + subject[code]['TP'] ) writeAnalysis.writerow( [ code , subject[code]['S+'] , subject[code]['S'] , subject[code]['A'] , subject[code]['B'] , subject[code]['C'] , subject[code]['D'] , subject[code]['E'] , subject[code]['F'] , subject[code]['NE'] , subject[code]['NP'] , subject[code]['PP'] , subject[code]['TF'] , subject[code]['TP'], passPercentage ] ) writeAnalysis.writerow( [ ] ) writeAnalysis.writerow( [ ] ) writeAnalysis.writerow( [ "OverallPerformance" ] ) writeAnalysis.writerow( [ "TotalNumberOfStudents", totalNumberOfStudents ] ) writeAnalysis.writerow( [ "TotalNumberOfFailStudents", totalNumberOfFailStudents ] ) writeAnalysis.writerow( [ "TotalNumberOfPassStudents", totalNumberOfPassStudents ] ) writeAnalysis.writerow( [ "PassPercentage", ( 100.00 * totalNumberOfPassStudents ) / ( totalNumberOfPassStudents + totalNumberOfFailStudents ) ] ) #print("analysis.csv created") except Exception as e: pass if __name__ == "__main__": analysis() # Save the result.csv and the Python script resultAnalysis.py is same folder # Open Python Terminal and run this script as # python resultAnalysis.py # If input result.csv , hence result.xlsx format was correct, then # analysis.csv will be generated # Now open analysis.csv in Excel / Calc # Improvement: Use MapReduce?
39.63388
159
0.478698
699
7,253
4.625179
0.273248
0.029075
0.032478
0.030931
0.13888
0.092484
0.068048
0.06743
0.055057
0.055057
0
0.03438
0.354336
7,253
182
160
39.851648
0.65599
0.475114
0
0.116667
1
0
0.073079
0.033047
0
0
0
0
0
1
0.016667
false
0.166667
0.016667
0
0.033333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
ce1a298cbaea0f760935fcf3ce34eb273c46e78b
2,600
py
Python
fabric_cf/actor/core/plugins/handlers/config_token.py
fabric-testbed/ActorBase
3c7dd040ee79fef0759e66996c93eeec57c790b2
[ "MIT" ]
null
null
null
fabric_cf/actor/core/plugins/handlers/config_token.py
fabric-testbed/ActorBase
3c7dd040ee79fef0759e66996c93eeec57c790b2
[ "MIT" ]
67
2020-12-21T15:39:49.000Z
2022-02-27T17:55:00.000Z
fabric_cf/actor/core/plugins/handlers/config_token.py
fabric-testbed/ControlFramework
95ab745e32f15c993bc7a017aa97a5a0f67f210f
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2020 FABRIC Testbed # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # # # Author: Komal Thareja (kthare10@renci.org) from abc import abstractmethod, ABC from fim.slivers.base_sliver import BaseSliver from fabric_cf.actor.core.util.id import ID from fabric_cf.actor.core.util.resource_type import ResourceType class ConfigToken(ABC): @abstractmethod def get_reservation_id(self) -> ID: """ Return reservation id @return reservation """ @abstractmethod def get_resource_type(self) -> ResourceType: """ return resource type @return resource type """ @abstractmethod def complete_modify(self): """ Complete the modify operation """ @abstractmethod def get_sequence(self) -> int: """ Get Sequence number @return sequence number """ @abstractmethod def get_id(self) -> ID: """ Get unit id @return unit id """ @abstractmethod def close(self): """ Mark the unit as closed """ @abstractmethod def activate(self): """ Mark the unit as active """ @abstractmethod def get_sliver(self) -> BaseSliver: """ Get Sliver """ @abstractmethod def set_sliver(self, *, sliver: BaseSliver): """ Set sliver """ @abstractmethod def update_sliver(self, *, sliver:BaseSliver): """ Update Sliver """
26.804124
80
0.655769
316
2,600
5.351266
0.452532
0.100532
0.059137
0.020106
0.049675
0.029568
0
0
0
0
0
0.003665
0.265385
2,600
97
81
26.804124
0.881675
0.539231
0
0.4
0
0
0
0
0
0
0
0
0
1
0.4
false
0
0.16
0
0.6
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
ce1ed3a20a03d0b3da0a9d328966c32fb2ee850f
3,599
py
Python
instacommander/utils/mixins.py
msarfati/InstraCommander
85062fb6ff98cd34b8500964f27f9f73708506a9
[ "Apache-2.0" ]
null
null
null
instacommander/utils/mixins.py
msarfati/InstraCommander
85062fb6ff98cd34b8500964f27f9f73708506a9
[ "Apache-2.0" ]
null
null
null
instacommander/utils/mixins.py
msarfati/InstraCommander
85062fb6ff98cd34b8500964f27f9f73708506a9
[ "Apache-2.0" ]
1
2016-01-29T03:44:55.000Z
2016-01-29T03:44:55.000Z
from .. import db import flask class CRUDMixin(object): """ Convenience functions for CRUD operations. Adapted from `flask-kit <https://github.com/semirook/flask-kit/blob/master/base/models.py>`_. """ __table_args__ = {'extend_existing': True} @classmethod def find(cls, **kwargs): """ Find an object in the database with certain properties. :param kwargs: the values of the object to find :type kwargs: dict :returns: the object that was found, or else None """ return cls.query.filter_by(**kwargs).first() @classmethod def find_or_create(cls, _commit=True, **kwargs): """ Find an object or, if it does not exist, create it. :param kwargs: the values of the object to find or create :type kwargs: dict :returns: the object that was created """ obj = cls.find(**kwargs) if not obj: obj = cls.create(_commit=_commit, **kwargs) return obj @classmethod def get_by_id(cls, id): """ Retrieve an object of this class from the database. :param id: the id of the object to be retrieved :type id: integer :returns: the object that was retrieved """ if any( (isinstance(id, basestring) and id.isdigit(), isinstance(id, (int, float))), ): return cls.query.get(int(id)) return None @classmethod def create(cls, _commit=True, **kwargs): """ Create a new object. :param commit: whether to commit the change immediately to the database :type commit: boolean :param kwargs: parameters corresponding to the new values :type kwargs: dict :returns: the object that was created """ instance = cls(**kwargs) obj = instance.save(_commit) flask.current_app.logger.debug("create {}".format(obj)) return obj def update(self, _commit=True, **kwargs): """ Update this object with new values. :param commit: whether to commit the change immediately to the database :type commit: boolean :param kwargs: parameters corresponding to the new values :type kwargs: dict :returns: the object that was updated """ for attr, value in kwargs.iteritems(): setattr(self, attr, value) return _commit and self.save() or self def save(self, _commit=True): """ Save this object to the database. :param commit: whether to commit the change immediately to the database :type commit: boolean :returns: the object that was saved """ db.session.add(self) if _commit: db.session.commit() return self def delete(self, _commit=True): """ Delete this object. :param commit: whether to commit the change immediately to the database :type commit: boolean :returns: whether the delete was successful """ db.session.delete(self) return _commit and db.session.commit() def as_dict(self): 'Returns a Python dict of object' d = {} for column in self.__table__.columns: d[column.name] = str(getattr(self, column.name)) return d def __repr__(self): return "<{}(id={})>".format(self.__class__.__name__, self.id) def __str__(self): return self.__repr__() def __unicode__(self): return self.__repr__()
27.473282
97
0.59072
434
3,599
4.767281
0.271889
0.039149
0.046399
0.057999
0.362977
0.319961
0.319961
0.319961
0.302078
0.241663
0
0
0.315088
3,599
130
98
27.684615
0.839351
0.408725
0
0.156863
0
0
0.037099
0
0
0
0
0
0
1
0.215686
false
0
0.039216
0.058824
0.529412
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
ce1ef24315a7d4f0d610ac35287837236e5fa353
1,115
py
Python
containercafe/common/clients/host.py
rcbops-qe/containercafe
c217af0fb84b0cf9e2e537626a46aa19c8e2e286
[ "Apache-2.0" ]
null
null
null
containercafe/common/clients/host.py
rcbops-qe/containercafe
c217af0fb84b0cf9e2e537626a46aa19c8e2e286
[ "Apache-2.0" ]
null
null
null
containercafe/common/clients/host.py
rcbops-qe/containercafe
c217af0fb84b0cf9e2e537626a46aa19c8e2e286
[ "Apache-2.0" ]
null
null
null
""" Copyright 2014 Rackspace Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ from .base import BaseContainerClient from ..states import State class HostContainerClient(BaseContainerClient): STOPPED = 'N/A' RUNNING = 'N/A' def __init__(self, name, connection, clean=False): super(HostContainerClient, self).__init__( name=name, connection=connection) self._state = State(State.RUNNING) self._requires_destroy = clean def execute(self, user_command, **kwargs): return self.connection.execute(user_command, **kwargs) def clean(self): self.connection.close()
30.135135
72
0.732735
149
1,115
5.395973
0.597315
0.074627
0.032338
0.039801
0
0
0
0
0
0
0
0.00884
0.188341
1,115
36
73
30.972222
0.879558
0.492377
0
0
0
0
0.010753
0
0
0
0
0
0
1
0.214286
false
0
0.142857
0.071429
0.642857
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
ce323760ec600bda6a65944780fb8b381815ec2b
9,776
py
Python
bmtk/simulator/pointnet/pyfunction_cache.py
aaberbach/bmtk
42aa70ce2003227a32df6ce5a95420dbf4bdfbd4
[ "BSD-3-Clause" ]
216
2017-10-03T17:02:42.000Z
2022-03-20T03:35:48.000Z
bmtk/simulator/pointnet/pyfunction_cache.py
moekay/bmtk
6efdf6387d2a6badf276b917ee15d238daeae883
[ "BSD-3-Clause" ]
70
2017-10-05T00:50:41.000Z
2022-03-30T18:55:01.000Z
bmtk/simulator/pointnet/pyfunction_cache.py
moekay/bmtk
6efdf6387d2a6badf276b917ee15d238daeae883
[ "BSD-3-Clause" ]
97
2017-10-03T22:15:06.000Z
2022-03-23T21:03:26.000Z
# Copyright 2017. Allen Institute. All rights reserved # # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the # following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following # disclaimer. # # 2. 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. # # 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote # products derived from this software without specific prior written permission. # # 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 HOLDER 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. # import types from functools import wraps class _PyFunctions(object): """Structure for holding custom user-defined python functions. Will store a set of functions created by the user. Should not access this directly but rather user the decorators or setter functions, and use the py_modules class variable to access individual functions. Is divided up into synaptic_weight: functions for calcuating synaptic weight. cell_model: should return NEURON cell hobj. synapse model: should return a NEURON synapse object. """ def __init__(self): self.__syn_weights = {} self.__cell_models = {} self.__synapse_models = {} self.__cell_processors = {} def clear(self): self.__syn_weights.clear() self.__cell_models.clear() self.__synapse_models.clear() self.__cell_processors.clear() def add_synaptic_weight(self, name, func, overwrite=True): """stores synpatic fuction for given name""" if overwrite or name not in self.__syn_weights: self.__syn_weights[name] = func @property def synaptic_weights(self): """return list of the names of all available synaptic weight functions""" return self.__syn_weights.keys() def synaptic_weight(self, name): """return the synpatic weight function""" return self.__syn_weights[name] def has_synaptic_weight(self, name): return name in self.__syn_weights def __cell_model_key(self, directive, model_type): return (directive, model_type) def add_cell_model(self, directive, model_type, func, overwrite=True): key = self.__cell_model_key(directive, model_type) if overwrite or key not in self.__cell_models: self.__cell_models[key] = func @property def cell_models(self): return self.__cell_models.keys() def cell_model(self, directive, model_type): return self.__cell_models[self.__cell_model_key(directive, model_type)] def has_cell_model(self, directive, model_type): return self.__cell_model_key(directive, model_type) in self.__cell_models def add_synapse_model(self, name, func, overwrite=True): if overwrite or name not in self.__synapse_models: self.__synapse_models[name] = func @property def synapse_models(self): return self.__synapse_models.keys() def synapse_model(self, name): return self.__synapse_models[name] @property def cell_processors(self): return self.__cell_processors.keys() def cell_processor(self, name): return self.__cell_processors[name] def add_cell_processor(self, name, func, overwrite=True): if overwrite or name not in self.__syn_weights: self.__cell_processors[name] = func def __repr__(self): rstr = '{}: {}\n'.format('cell_models', self.cell_models) rstr += '{}: {}\n'.format('synapse_models', self.synapse_models) rstr += '{}: {}'.format('synaptic_weights', self.synaptic_weights) return rstr py_modules = _PyFunctions() def synaptic_weight(*wargs, **wkwargs): """A decorator for registering a function as a synaptic weight function. To use either:: @synaptic_weight def weight_function(): ... or:: @synaptic_weight(name='name_in_edge_types') def weight_function(): ... Once the decorator has been attached and imported the functions will automatically be added to py_modules. """ if len(wargs) == 1 and callable(wargs[0]): # for the case without decorator arguments, grab the function object in wargs and create a decorator func = wargs[0] py_modules.add_synaptic_weight(func.__name__, func) # add function assigned to its original name @wraps(func) def func_wrapper(*args, **kwargs): return func(*args, **kwargs) return func_wrapper else: # for the case with decorator arguments assert(all(k in ['name'] for k in wkwargs.keys())) def decorator(func): # store the function in py_modules but under the name given in the decorator arguments py_modules.add_synaptic_weight(wkwargs['name'], func) @wraps(func) def func_wrapper(*args, **kwargs): return func(*args, **kwargs) return func_wrapper return decorator def cell_model(*wargs, **wkwargs): """A decorator for registering NEURON cell loader functions.""" if len(wargs) == 1 and callable(wargs[0]): # for the case without decorator arguments, grab the function object in wargs and create a decorator func = wargs[0] py_modules.add_cell_model(func.__name__, func) # add function assigned to its original name @wraps(func) def func_wrapper(*args, **kwargs): return func(*args, **kwargs) return func_wrapper else: # for the case with decorator arguments assert(all(k in ['name'] for k in wkwargs.keys())) def decorator(func): # store the function in py_modules but under the name given in the decorator arguments py_modules.add_cell_model(wkwargs['name'], func) @wraps(func) def func_wrapper(*args, **kwargs): return func(*args, **kwargs) return func_wrapper return decorator def synapse_model(*wargs, **wkwargs): """A decorator for registering NEURON synapse loader functions.""" if len(wargs) == 1 and callable(wargs[0]): # for the case without decorator arguments, grab the function object in wargs and create a decorator func = wargs[0] py_modules.add_synapse_model(func.__name__, func) # add function assigned to its original name @wraps(func) def func_wrapper(*args, **kwargs): return func(*args, **kwargs) return func_wrapper else: # for the case with decorator arguments assert(all(k in ['name'] for k in wkwargs.keys())) def decorator(func): # store the function in py_modules but under the name given in the decorator arguments py_modules.add_synapse_model(wkwargs['name'], func) @wraps(func) def func_wrapper(*args, **kwargs): return func(*args, **kwargs) return func_wrapper return decorator def add_weight_function(func, name=None, overwrite=True): assert(callable(func)) func_name = name if name is not None else func.__name__ py_modules.add_synaptic_weight(func_name, func, overwrite) def add_cell_model(func, directive, model_type, overwrite=True): assert(callable(func)) # func_name = name if name is not None else func.__name__ py_modules.add_cell_model(directive, model_type, func, overwrite) def add_cell_processor(func, name=None, overwrite=True): assert(callable(func)) func_name = name if name is not None else func.__name__ py_modules.add_cell_processor(func_name, func, overwrite) def add_synapse_model(func, name=None, overwrite=True): assert (callable(func)) func_name = name if name is not None else func.__name__ py_modules.add_synapse_model(func_name, func, overwrite) def load_py_modules(cell_models=None, syn_models=None, syn_weights=None): # py_modules.clear() if cell_models is not None: assert(isinstance(cell_models, types.ModuleType)) for f in [cell_models.__dict__.get(f) for f in dir(cell_models)]: if isinstance(f, types.FunctionType): py_modules.add_cell_model(f.__name__, f) if syn_models is not None: assert(isinstance(syn_models, types.ModuleType)) for f in [syn_models.__dict__.get(f) for f in dir(syn_models)]: if isinstance(f, types.FunctionType): py_modules.add_synapse_model(f.__name__, f) if syn_weights is not None: assert(isinstance(syn_weights, types.ModuleType)) for f in [syn_weights.__dict__.get(f) for f in dir(syn_weights)]: if isinstance(f, types.FunctionType): py_modules.add_synaptic_weight(f.__name__, f)
39.104
120
0.68617
1,308
9,776
4.90367
0.17737
0.029467
0.024322
0.037418
0.562052
0.490334
0.441222
0.426567
0.383536
0.354537
0
0.002131
0.231997
9,776
249
121
39.261044
0.852158
0.347791
0
0.414286
0
0
0.013953
0
0
0
0
0
0.071429
1
0.25
false
0
0.014286
0.107143
0.464286
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
2
ce32d854137aca18671d92faa4a0e6c083d1a04e
223
py
Python
example/articles/models.py
Formulka/django-fperms
88b8fa3dd87075a56d8bfeb2b9993c578c22694e
[ "MIT" ]
3
2019-03-29T09:50:45.000Z
2021-05-01T21:11:33.000Z
example/articles/models.py
Formulka/django-perms
88b8fa3dd87075a56d8bfeb2b9993c578c22694e
[ "MIT" ]
2
2018-04-12T00:54:05.000Z
2018-04-12T16:32:42.000Z
example/articles/models.py
Formulka/django-perms
88b8fa3dd87075a56d8bfeb2b9993c578c22694e
[ "MIT" ]
1
2018-07-13T14:42:07.000Z
2018-07-13T14:42:07.000Z
from django.db import models class Article(models.Model): name = models.CharField(verbose_name='name', max_length=60) text = models.TextField(verbose_name='text') def __str__(self): return self.name
20.272727
63
0.704036
30
223
5
0.666667
0.146667
0
0
0
0
0
0
0
0
0
0.010989
0.183857
223
10
64
22.3
0.813187
0
0
0
0
0
0.035874
0
0
0
0
0
0
1
0.166667
false
0
0.166667
0.166667
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
2
ce394b6f6da1da6b70a153ab61131386c3eb8599
223
py
Python
src/7sem/binsearch.py
freepvps/hsesamples
adbf35c1c94521d78fb75f72287512a37e49bdc8
[ "MIT" ]
2
2019-10-19T22:29:50.000Z
2019-10-19T22:29:52.000Z
src/7sem/binsearch.py
freepvps/hsesamples
adbf35c1c94521d78fb75f72287512a37e49bdc8
[ "MIT" ]
null
null
null
src/7sem/binsearch.py
freepvps/hsesamples
adbf35c1c94521d78fb75f72287512a37e49bdc8
[ "MIT" ]
null
null
null
a = [ 1, 2, 3, 6, 10, 14, ] t = 10 l = 0 r = len(a) - 1 while l != r: c = (l + r) // 2 if a[c] < t: l = c + 1 elif a[c] > t: r = c - 1 else: r = l = c print(l, r, a[l], a[r])
11.15
23
0.300448
47
223
1.425532
0.382979
0.089552
0.089552
0
0
0
0
0
0
0
0
0.130435
0.484305
223
19
24
11.736842
0.452174
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.066667
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
ce43682f8eb45758c43dda414cd686bdab21a16d
2,108
py
Python
profile_collection/startup/00-startup.py
tacaswell/ipython_smi
d25432225cc0f55afd80fefb1ef3f7d0c8a3cc6c
[ "BSD-3-Clause" ]
null
null
null
profile_collection/startup/00-startup.py
tacaswell/ipython_smi
d25432225cc0f55afd80fefb1ef3f7d0c8a3cc6c
[ "BSD-3-Clause" ]
null
null
null
profile_collection/startup/00-startup.py
tacaswell/ipython_smi
d25432225cc0f55afd80fefb1ef3f7d0c8a3cc6c
[ "BSD-3-Clause" ]
null
null
null
# Make ophyd listen to pyepics. from ophyd import setup_ophyd setup_ophyd() # Subscribe metadatastore to documents. # If this is removed, data is not saved to metadatastore. from bluesky.global_state import gs # ###### UN-COMMENT THESE LINES TO USE MDS # import metadatastore.commands # gs.RE.subscribe_lossless('all', metadatastore.commands.insert) # # At the end of every run, verify that files were saved and # # print a confirmation message. # from bluesky.callbacks.broker import verify_files_saved # gs.RE.subscribe('stop', post_run(verify_files_saved)) # Import matplotlib and put it in interactive mode. import matplotlib.pyplot as plt plt.ion() # Make plots update live while scans run. from bluesky.utils import install_qt_kicker install_qt_kicker() # Optional: set any metadata that rarely changes. # RE.md['beamline_id'] = 'YOUR_BEAMLINE_HERE' # convenience imports from ophyd.commands import * from bluesky.callbacks import * from bluesky.spec_api import * from bluesky.global_state import gs, abort, stop, resume from databroker import (DataBroker as db, get_events, get_images, get_table, get_fields, restream, process) from time import sleep import numpy as np RE = gs.RE # convenience alias # Uncomment the following lines to turn on verbose messages for debugging. # import logging # ophyd.logger.setLevel(logging.DEBUG) # logging.basicConfig(level=logging.DEBUG) from functools import partial from pyOlog import SimpleOlogClient from bluesky.callbacks.olog import logbook_cb_factory # Set up the logbook. This configures bluesky's summaries of # data acquisition (scan type, ID, etc.). LOGBOOKS = ['Data Acquisition'] # list of logbook names to publish to simple_olog_client = SimpleOlogClient() generic_logbook_func = simple_olog_client.log configured_logbook_func = partial(generic_logbook_func, logbooks=LOGBOOKS) cb = logbook_cb_factory(configured_logbook_func) RE.subscribe('start', cb) # This is for ophyd.commands.get_logbook, which simply looks for # a variable called 'logbook' in the global IPython namespace. logbook = simple_olog_client
32.9375
74
0.785579
302
2,108
5.347682
0.496689
0.047678
0.037152
0.027245
0.037152
0.037152
0
0
0
0
0
0
0.140892
2,108
63
75
33.460317
0.891773
0.519924
0
0
0
0
0.021472
0
0
0
0
0
0
1
0
false
0
0.538462
0
0.538462
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
cbefec54f280770dfba368297d14ea5338e4779d
1,476
py
Python
python/puzzles/encodifier/Encode.py
xanderyzwich/Playground
3c8bbfc33383f7ac1c88c2093fbe096cc2c44c3a
[ "Apache-2.0" ]
1
2021-08-19T13:40:26.000Z
2021-08-19T13:40:26.000Z
python/puzzles/encodifier/Encode.py
xanderyzwich/Playground
3c8bbfc33383f7ac1c88c2093fbe096cc2c44c3a
[ "Apache-2.0" ]
null
null
null
python/puzzles/encodifier/Encode.py
xanderyzwich/Playground
3c8bbfc33383f7ac1c88c2093fbe096cc2c44c3a
[ "Apache-2.0" ]
1
2021-03-31T12:37:14.000Z
2021-03-31T12:37:14.000Z
# Adjusts numerical digits by a specified amount class Offsetter: # numericOffset is only altered by init numericOffset=0 def __init__(self, offset): self.numericOffset = int(offset) # apply offset def setOff(self, input_int): return (( int(input_int) + self.numericOffset ) % 10) # remove offset def setOn(self, input_int): return (( input_int + (10 - self.numericOffset) ) % 10) # apply offset to each digit of a longer string def stringOffset(self,input_string): output_string = '' for s in input_string: input_int = self.char2int(s) output_string = output_string + str(self.setOff( input_int )) return output_string # explicitly integer values chars def char2int(self,input_char): return { '0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9, }.get(input_char,0) # Converts char to ascii class Encoder: def string2ascii (self, input_string): return_list = [] for i in range(0,len(input_string)): return_list.insert(i,self.char2ascii(input_string[i])) return return_list def char2ascii(self, input_char): return ord(input_char) # Converts ascii to char class Decoder: def string2ascii (self, input_list): return_string = '' for i in input_list: return_string= return_string + self.char2ascii(i) return return_string def char2ascii(self, input_int): return chr(input_int)
23.428571
65
0.655827
204
1,476
4.578431
0.328431
0.077088
0.059957
0.057816
0
0
0
0
0
0
0
0.032714
0.23374
1,476
63
66
23.428571
0.793103
0.161247
0
0
0
0
0.008562
0
0
0
0
0
0
1
0.209302
false
0
0
0.116279
0.488372
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
2
cbf5e0e594f0ee5ac7c9b2ea46f73086347854c8
998
py
Python
Mac/Tools/macfreeze/macgen_rsrc.py
1byte2bytes/cpython
7fbaeb819ca7b20dca048217ff585ec195e999ec
[ "Unlicense", "TCL", "DOC", "AAL", "X11" ]
3
2022-01-30T20:08:24.000Z
2022-02-12T08:51:12.000Z
Mac/Tools/macfreeze/macgen_rsrc.py
1byte2bytes/cpython
7fbaeb819ca7b20dca048217ff585ec195e999ec
[ "Unlicense", "TCL", "DOC", "AAL", "X11" ]
null
null
null
Mac/Tools/macfreeze/macgen_rsrc.py
1byte2bytes/cpython
7fbaeb819ca7b20dca048217ff585ec195e999ec
[ "Unlicense", "TCL", "DOC", "AAL", "X11" ]
null
null
null
"""macgen_info - Generate PYC resource file only""" import EasyDialogs import py_resource import Res import sys def generate(output, module_dict, debug=0, preload=1): fsid = py_resource.create(output) for name, module in module_dict.items(): mtype = module.gettype() if mtype not in ['module', 'package']: continue location = module.__file__ if location[-4:] == '.pyc': # Attempt corresponding .py location = location[:-1] if location[-3:] != '.py': print '*** skipping', location continue id, name = py_resource.frompyfile(location, name, preload=preload, ispackage=mtype=='package') if debug > 0: print 'PYC resource %5d\t%s\t%s'%(id, name, location) Res.CloseResFile(fsid) def warnings(module_dict): problems = 0 for name, module in module_dict.items(): if module.gettype() not in ('builtin', 'module', 'package'): problems = problems + 1 print 'Warning: %s not included: %s %s'%(name, module.gettype(), module) return problems
26.263158
75
0.678357
134
998
4.962687
0.38806
0.06015
0.039098
0.045113
0.090226
0.090226
0.090226
0
0
0
0
0.010989
0.179359
998
37
76
26.972973
0.800977
0.02505
0
0.142857
1
0
0.123913
0
0
0
0
0
0
0
null
null
0
0.142857
null
null
0.107143
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
02008aa048f57d6131d43883f4407f466496a206
965
py
Python
inviter2/models.py
tpeaton/django-inviter2
5f247325dc54c79e50ed62043446c819c0f0dd4b
[ "MIT" ]
5
2016-05-08T06:15:59.000Z
2021-04-11T21:34:12.000Z
inviter2/models.py
tpeaton/django-inviter2
5f247325dc54c79e50ed62043446c819c0f0dd4b
[ "MIT" ]
13
2015-04-28T15:52:55.000Z
2019-04-12T01:45:50.000Z
inviter2/models.py
tpeaton/django-inviter2
5f247325dc54c79e50ed62043446c819c0f0dd4b
[ "MIT" ]
7
2015-06-30T13:31:37.000Z
2021-04-11T21:34:21.000Z
from __future__ import unicode_literals from django.db import models import hashlib class OptOutManager(models.Manager): def _hash_email(self, email): email_bytes = email.encode('utf-8') return hashlib.sha1(email_bytes).hexdigest() def is_blocked(self, email=None): """ Check if a given email address is on the block list. """ return self.filter(hash=self._hash_email(email)).count() > 0 def create(self, email=None): """ Create an opt out. """ return super(OptOutManager, self).create(hash=self._hash_email(email)) class OptOut(models.Model): """ Opt-out email addresses are stored as SHA1 hashes to make sure we don't accidentally collect any more data once a person signalled they're not interested in receiving any more invitation emails from us. """ hash = models.CharField(max_length=255) objects = OptOutManager() def __unicode__(self): return self.hash
28.382353
79
0.693264
133
965
4.887218
0.586466
0.041538
0.04
0.052308
0.067692
0
0
0
0
0
0
0.009186
0.210363
965
33
80
29.242424
0.843832
0.28601
0
0
0
0
0.007599
0
0
0
0
0
0
1
0.25
false
0
0.1875
0.0625
0.9375
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
02020f99e018d0bd6f08c40448cd83d2f7626ee9
742
py
Python
apps/event/admin.py
bmanzella/zhuartcc.org
4c8104894dd6a9124a6181ac357a53ec5d0b1a28
[ "MIT" ]
8
2020-07-20T08:04:21.000Z
2020-10-23T14:21:39.000Z
apps/event/admin.py
bmanzella/zhuartcc.org
4c8104894dd6a9124a6181ac357a53ec5d0b1a28
[ "MIT" ]
33
2020-09-05T03:30:00.000Z
2020-12-03T16:49:46.000Z
apps/event/admin.py
bmanzella/pacificcontrol.net
4c8104894dd6a9124a6181ac357a53ec5d0b1a28
[ "MIT" ]
2
2020-09-20T00:14:46.000Z
2020-10-23T14:20:51.000Z
from django.contrib import admin from .models import Event, EventPosition, PositionPreset, EventPositionRequest, EventScore @admin.register(Event) class EventAdmin(admin.ModelAdmin): list_display = ('name', 'host', 'start', 'end', 'hidden') @admin.register(EventPosition) class EventPositionAdmin(admin.ModelAdmin): list_display = ('event', 'user', 'name') @admin.register(EventPositionRequest) class EventPositionRequestAdmin(admin.ModelAdmin): list_display = ('position', 'user') @admin.register(PositionPreset) class PositionPresetAdmin(admin.ModelAdmin): list_display = ('name', 'positions_json') @admin.register(EventScore) class EventScoreAdmin(admin.ModelAdmin): list_display = ('user', 'event', 'score')
26.5
90
0.753369
74
742
7.472973
0.418919
0.117541
0.17179
0.235081
0.108499
0
0
0
0
0
0
0
0.110512
742
27
91
27.481481
0.837879
0
0
0
0
0
0.106469
0
0
0
0
0
0
1
0
false
0
0.117647
0
0.705882
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
02021476ddcaf6658f5339d72aae4eb586e9c711
6,523
py
Python
starfish/test/full_pipelines/api/test_dartfish.py
vipulsinghal02/starfish
c3d347954ad40a7a4be9a50d89974f5fbbc2919d
[ "MIT" ]
null
null
null
starfish/test/full_pipelines/api/test_dartfish.py
vipulsinghal02/starfish
c3d347954ad40a7a4be9a50d89974f5fbbc2919d
[ "MIT" ]
null
null
null
starfish/test/full_pipelines/api/test_dartfish.py
vipulsinghal02/starfish
c3d347954ad40a7a4be9a50d89974f5fbbc2919d
[ "MIT" ]
null
null
null
import os import sys import numpy as np import pandas as pd import starfish from starfish import IntensityTable from starfish.types import Features ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(starfish.__file__))) os.environ["USE_TEST_DATA"] = "1" sys.path.append(os.path.join(ROOT_DIR, "notebooks", "py")) def test_dartfish_pipeline_cropped_data(): # set random seed to errors provoked by optimization functions np.random.seed(777) dartfish = __import__('DARTFISH_Pipeline_-_Human_Occipital_Cortex_-_1_FOV') primary_image = dartfish.stack expected_primary_image = np.array( [[1.52590219e-05, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 4.57770657e-05, 0.00000000e+00, 0.00000000e+00, 3.05180438e-05], [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 1.52590219e-05, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00], [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 1.52590219e-05, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 3.05180438e-05, 0.00000000e+00], [0.00000000e+00, 0.00000000e+00, 1.52590219e-05, 0.00000000e+00, 0.00000000e+00, 1.52590219e-05, 0.00000000e+00, 1.52590219e-05, 0.00000000e+00, 0.00000000e+00], [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 3.05180438e-05, 0.00000000e+00, 1.52590219e-05, 0.00000000e+00], [0.00000000e+00, 0.00000000e+00, 1.52590219e-05, 0.00000000e+00, 3.05180438e-05, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 1.52590219e-05], [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 1.52590219e-05, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00], [0.00000000e+00, 1.52590219e-05, 0.00000000e+00, 0.00000000e+00, 1.52590219e-05, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00], [1.52590219e-05, 1.52590219e-05, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00], [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 1.52590219e-05, 1.52590219e-05, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00]], dtype=np.float32 ) assert primary_image.numpy_array.dtype == np.float32 assert np.allclose( primary_image.numpy_array[0, 0, 0, 50:60, 60:70], expected_primary_image ) normalized_image = dartfish.norm_stack expected_normalized_image = np.array( [[0.01960784, 0., 0., 0., 0., 0., 0.05882353, 0., 0., 0.03921569], [0., 0., 0., 0., 0.01960784, 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0.01960784, 0., 0., 0., 0.03921569, 0.], [0., 0., 0.01960784, 0., 0., 0.01960784, 0., 0.01960784, 0., 0.], [0., 0., 0., 0., 0., 0., 0.03921569, 0., 0.01960784, 0.], [0., 0., 0.01960784, 0., 0.03921569, 0., 0., 0., 0., 0.01960784], [0., 0., 0., 0., 0., 0.01960784, 0., 0., 0., 0.], [0., 0.01960784, 0., 0., 0.01960784, 0., 0., 0., 0., 0.], [0.01960784, 0.01960784, 0., 0., 0., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 0.01960784, 0.01960784, 0., 0., 0.]], dtype=np.float32, ) assert normalized_image.numpy_array.dtype == np.float32 assert np.allclose( normalized_image.numpy_array[0, 0, 0, 50:60, 60:70], expected_normalized_image ) zero_norm_stack = dartfish.zero_norm_stack expected_zero_normalized_image = np.array( [[0.01960784, 0., 0., 0., 0., 0., 0.05882353, 0., 0., 0.03921569], [0., 0., 0., 0., 0.01960784, 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0.01960784, 0., 0., 0., 0., 0.], [0., 0., 0.01960784, 0., 0., 0., 0., 0.01960784, 0., 0.], [0., 0., 0., 0., 0., 0., 0.03921569, 0., 0.01960784, 0.], [0., 0., 0.01960784, 0., 0., 0., 0., 0., 0., 0.01960784], [0., 0., 0., 0., 0., 0.01960784, 0., 0., 0., 0.], [0., 0.01960784, 0., 0., 0., 0., 0., 0., 0., 0.], [0.01960784, 0., 0., 0., 0., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 0., 0.01960784, 0., 0., 0.]], dtype=np.float32 ) assert np.allclose( expected_zero_normalized_image, zero_norm_stack.numpy_array[0, 0, 0, 50:60, 60:70] ) spot_intensities = dartfish.initial_spot_intensities spots_df = IntensityTable( spot_intensities.where(spot_intensities[Features.PASSES_THRESHOLDS], drop=True) ).to_features_dataframe() spots_df['area'] = np.pi * spots_df['radius'] ** 2 # verify number of spots detected spots_passing_filters = spot_intensities[Features.PASSES_THRESHOLDS].sum() assert spots_passing_filters == 53 # compare to benchmark data -- note that this particular part of the dataset appears completely # uncorrelated cnts_benchmark = pd.read_csv( 'https://dmf0bdeheu4zf.cloudfront.net/20180905/DARTFISH/fov_001/counts.csv') min_dist = 0.6 cnts_starfish = spots_df[spots_df.distance <= min_dist].groupby('target').count()['area'] cnts_starfish = cnts_starfish.reset_index(level=0) cnts_starfish.rename(columns={'target': 'gene', 'area': 'cnt_starfish'}, inplace=True) # get top 5 genes and verify they are correct high_expression_genes = cnts_starfish.sort_values('cnt_starfish', ascending=False).head(5) assert np.array_equal( high_expression_genes['cnt_starfish'].values, [7, 3, 2, 2, 2] ) assert np.array_equal( high_expression_genes['gene'].values, ['MBP', 'MOBP', 'ADCY8', 'TRIM66', 'SYT6'] ) # verify correlation is accurate for this subset of the image benchmark_comparison = pd.merge(cnts_benchmark, cnts_starfish, on='gene', how='left') benchmark_comparison.head(20) x = benchmark_comparison.dropna().cnt.values y = benchmark_comparison.dropna().cnt_starfish.values corrcoef = np.corrcoef(x, y) corrcoef = corrcoef[0, 1] assert np.round(corrcoef, 5) == 0.04422
38.146199
99
0.595432
948
6,523
3.986287
0.181435
0.088912
0.103996
0.103731
0.579783
0.535856
0.53321
0.513099
0.510982
0.471024
0
0.337018
0.237161
6,523
170
100
38.370588
0.422428
0.046451
0
0.376812
0
0
0.04056
0.008048
0
0
0
0
0.065217
1
0.007246
false
0.021739
0.057971
0
0.065217
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
020bd5a22f90291218f66e52d41d88a18b1fb9c2
529
py
Python
grapy/decimalencoder.py
nl-hugo/grapy
b72216f0a1c93286575d4c1d81c1f4825021dfec
[ "MIT" ]
2
2018-08-02T20:33:44.000Z
2018-11-14T12:57:28.000Z
grapy/decimalencoder.py
nl-hugo/grapy
b72216f0a1c93286575d4c1d81c1f4825021dfec
[ "MIT" ]
null
null
null
grapy/decimalencoder.py
nl-hugo/grapy
b72216f0a1c93286575d4c1d81c1f4825021dfec
[ "MIT" ]
1
2019-01-10T16:19:35.000Z
2019-01-10T16:19:35.000Z
import decimal import json class NumberStr(float): def __init__(self, o): self.o = o def __repr__(self): return str(self.o) # This is a workaround for: http://bugs.python.org/issue16535 # https://github.com/serverless/examples/blob/master/aws-python-rest-api-with-dynamodb/todos/decimalencoder.py class DecimalEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, decimal.Decimal): return NumberStr(obj) return super(DecimalEncoder, self).default(obj)
26.45
110
0.695652
69
529
5.217391
0.637681
0.041667
0
0
0
0
0
0
0
0
0
0.011628
0.187146
529
19
111
27.842105
0.825581
0.31758
0
0
0
0
0
0
0
0
0
0.052632
0
1
0.25
false
0
0.166667
0.083333
0.833333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
1
0
0
0
0
0
0
0
2
02194c24b10488e00a1d0c1681c907e6d5047dd3
372
py
Python
CeV - Gustavo Guanabara/exerc076.py
us19861229c/Meu-aprendizado-Python
575c0714ac5377ff3122f4cb57952969e07ba89b
[ "Unlicense" ]
1
2021-12-11T19:53:41.000Z
2021-12-11T19:53:41.000Z
CeV - Gustavo Guanabara/exerc076.py
us19861229c/Meu-aprendizado-Python
575c0714ac5377ff3122f4cb57952969e07ba89b
[ "Unlicense" ]
null
null
null
CeV - Gustavo Guanabara/exerc076.py
us19861229c/Meu-aprendizado-Python
575c0714ac5377ff3122f4cb57952969e07ba89b
[ "Unlicense" ]
null
null
null
produtos_prec = ("Croissant", 2.0, "Leite", 5.0, "Mix de grãos", 8.0 , "Mix de nozes", 7.55, "Café", 3.45, "Bolo", 13.66, "Torta gelada", 6.77, "Suco", 3.27 ) print("="*38) print(f"{'LISTAGEM DE PREÇOS':^38}") print("="*38) prod = 0 while prod < len(produtos_prec): print(f'{produtos_prec[prod]:.<28}R$ {produtos_prec[prod+1]:>5.2f}') prod +=2
33.818182
92
0.569892
63
372
3.301587
0.603175
0.230769
0.057692
0
0
0
0
0
0
0
0
0.115512
0.185484
372
10
93
37.2
0.570957
0
0
0.222222
0
0
0.404313
0.153639
0
0
0
0
0
1
0
false
0
0
0
0
0.444444
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
2
0219ea497b55e0d7531d2c8a6e4fcd787407080d
269
py
Python
todos/migrations/0007_merge_20200222_2053.py
phen0menon/muctodo-backend
204497a989bbaed24a4f86990e5ce5f35cd95af1
[ "MIT" ]
null
null
null
todos/migrations/0007_merge_20200222_2053.py
phen0menon/muctodo-backend
204497a989bbaed24a4f86990e5ce5f35cd95af1
[ "MIT" ]
4
2021-03-30T12:44:38.000Z
2021-09-22T18:37:18.000Z
todos/migrations/0007_merge_20200222_2053.py
phen0menon/muctodo-backend
204497a989bbaed24a4f86990e5ce5f35cd95af1
[ "MIT" ]
null
null
null
# Generated by Django 3.0.3 on 2020-02-22 20:53 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('todos', '0006_auto_20200222_2351'), ('todos', '0005_auto_20200222_2040'), ] operations = [ ]
17.933333
47
0.643123
33
269
5.060606
0.787879
0.143713
0
0
0
0
0
0
0
0
0
0.228155
0.234201
269
14
48
19.214286
0.582524
0.167286
0
0
1
0
0.252252
0.207207
0
0
0
0
0
1
0
false
0
0.125
0
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
0223bfdf4011ad269b0060f7da74a7dbc749542f
71,268
py
Python
Crawler/Test/test1.py
XiMuYouZi/PythonDemo
476d4d814338f37148bbf1504c0dd94a68f55a05
[ "MIT" ]
null
null
null
Crawler/Test/test1.py
XiMuYouZi/PythonDemo
476d4d814338f37148bbf1504c0dd94a68f55a05
[ "MIT" ]
1
2020-12-11T06:21:32.000Z
2020-12-11T06:21:32.000Z
Crawler/Test/test1.py
XiMuYouZi/PythonDemo
476d4d814338f37148bbf1504c0dd94a68f55a05
[ "MIT" ]
null
null
null
from pyquery import PyQuery as pq html = """ <!DOCTYPE html> <html lang="zh-cmn-Hans" class="ua-mac ua-webkit book-new-nav"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title> 豆瓣图书标签: 小说 </title> <script>!function(e){var o=function(o,n,t){var c,i,r=new Date;n=n||30,t=t||"/",r.setTime(r.getTime()+24*n*60*60*1e3),c="; expires="+r.toGMTString();for(i in o)e.cookie=i+"="+o[i]+c+"; path="+t},n=function(o){var n,t,c,i=o+"=",r=e.cookie.split(";");for(t=0,c=r.length;t<c;t++)if(n=r[t].replace(/^\s+|\s+$/g,""),0==n.indexOf(i))return n.substring(i.length,n.length).replace(/\"/g,"");return null},t=e.write,c={"douban.com":1,"douban.fm":1,"google.com":1,"google.cn":1,"googleapis.com":1,"gmaptiles.co.kr":1,"gstatic.com":1,"gstatic.cn":1,"google-analytics.com":1,"googleadservices.com":1},i=function(e,o){var n=new Image;n.onload=function(){},n.src="https://www.douban.com/j/except_report?kind=ra022&reason="+encodeURIComponent(e)+"&environment="+encodeURIComponent(o)},r=function(o){try{t.call(e,o)}catch(e){t(o)}},a=/<script.*?src\=["']?([^"'\s>]+)/gi,g=/http:\/\/(.+?)\.([^\/]+).+/i;e.writeln=e.write=function(e){var t,l=a.exec(e);return l&&(t=g.exec(l[1]))?c[t[2]]?void r(e):void("tqs"!==n("hj")&&(i(l[1],location.href),o({hj:"tqs"},1),setTimeout(function(){location.replace(location.href)},50))):void r(e)}}(document); </script> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Expires" content="Sun, 6 Mar 2005 01:00:00 GMT"> <script>var _head_start = new Date();</script> <link href="https://img3.doubanio.com/f/book/c562010083631a8b5625ac07bc2a6e7e4466b6f6/css/book/master.css" rel="stylesheet" type="text/css"> <link href="https://img3.doubanio.com/f/book/8a9d097c416aabac4f7e45f5d2ce9c6834b3fc7a/css/book/base/init.css" rel="stylesheet"> <style type="text/css"></style> <script src="https://img3.doubanio.com/f/book/0495cb173e298c28593766009c7b0a953246c5b5/js/book/lib/jquery/jquery.js"></script> <script src="https://img3.doubanio.com/f/book/0f1957d4c436280f238b0295e4d0ba6855510555/js/book/master.js"></script> <script> </script> <link rel="stylesheet" href="https://img3.doubanio.com/misc/mixed_static/28fc3e84f96f7794.css"> <link rel="shortcut icon" href="https://img3.doubanio.com/favicon.ico" type="image/x-icon"> </head> <body> <script>var _body_start = new Date();</script> <link href="//img3.doubanio.com/dae/accounts/resources/321e246/shire/bundle.css" rel="stylesheet" type="text/css"> <div id="db-global-nav" class="global-nav"> <div class="bd"> <div class="top-nav-info"> <ul> <li> <a id="top-nav-doumail-link" href="https://www.douban.com/doumail/">豆邮</a> </li> <li class="nav-user-account"> <a target="_blank" href="https://www.douban.com/accounts/" class="bn-more"> <span>西木柚子的帐号</span><span class="arrow"></span> </a> <div class="more-items"> <table cellpadding="0" cellspacing="0"> <tbody> <tr> <td> <a href="https://www.douban.com/mine/">个人主页</a> </td> </tr> <tr> <td> <a target="_blank" href="https://www.douban.com/mine/orders/">我的订单</a> </td> </tr> <tr> <td> <a target="_blank" href="https://www.douban.com/mine/wallet/">我的钱包</a> </td> </tr> <tr> <td> <a target="_blank" href="https://www.douban.com/accounts/">帐号管理</a> </td> </tr> <tr> <td> <a href="https://www.douban.com/accounts/logout?source=book&ck=_msq">退出</a> </td> </tr> </tbody> </table> </div> </li> </ul> </div> <div class="top-nav-reminder"> <a href="https://www.douban.com/notification/" class="lnk-remind">提醒</a> <div id="top-nav-notimenu" class="more-items"> <div class="bd"> <p>加载中...</p> </div> </div> </div> <div class="top-nav-doubanapp"> <a href="https://www.douban.com/doubanapp/app?channel=top-nav" class="lnk-doubanapp">下载豆瓣客户端</a> <div id="top-nav-appintro" class="more-items"> <p class="appintro-title">豆瓣</p> <p class="slogan">我们的精神角落</p> <p class="qrcode">扫码直接下载</p> <div class="download"> <a href="https://www.douban.com/doubanapp/redirect?channel=top-nav&direct_dl=1&download=iOS">iPhone</a> <span>·</span> <a href="https://www.douban.com/doubanapp/redirect?channel=top-nav&direct_dl=1&download=Android" class="download-android">Android</a> </div> <div id="doubanapp-tip"> <a href="https://www.douban.com/doubanapp/app?channel=qipao" class="tip-link">豆瓣 5.0 全新发布</a> <a href="javascript: void 0;" class="tip-close">×</a> </div> </div> </div> <div class="global-nav-items"> <ul> <li class=""> <a href="https://www.douban.com" target="_blank" data-moreurl-dict="{&quot;from&quot;:&quot;top-nav-click-main&quot;,&quot;uid&quot;:&quot;42279477&quot;}">豆瓣</a> </li> <li class="on"> <a href="https://book.douban.com" data-moreurl-dict="{&quot;from&quot;:&quot;top-nav-click-book&quot;,&quot;uid&quot;:&quot;42279477&quot;}">读书</a> </li> <li class=""> <a href="https://movie.douban.com" target="_blank" data-moreurl-dict="{&quot;from&quot;:&quot;top-nav-click-movie&quot;,&quot;uid&quot;:&quot;42279477&quot;}">电影</a> </li> <li class=""> <a href="https://music.douban.com" target="_blank" data-moreurl-dict="{&quot;from&quot;:&quot;top-nav-click-music&quot;,&quot;uid&quot;:&quot;42279477&quot;}">音乐</a> </li> <li class=""> <a href="https://www.douban.com/location" target="_blank" data-moreurl-dict="{&quot;from&quot;:&quot;top-nav-click-location&quot;,&quot;uid&quot;:&quot;42279477&quot;}">同城</a> </li> <li class=""> <a href="https://www.douban.com/group" target="_blank" data-moreurl-dict="{&quot;from&quot;:&quot;top-nav-click-group&quot;,&quot;uid&quot;:&quot;42279477&quot;}">小组</a> </li> <li class=""> <a href="https://read.douban.com&#47;?dcs=top-nav&amp;dcm=douban" target="_blank" data-moreurl-dict="{&quot;from&quot;:&quot;top-nav-click-read&quot;,&quot;uid&quot;:&quot;42279477&quot;}">阅读</a> </li> <li class=""> <a href="https://douban.fm&#47;?from_=shire_top_nav" target="_blank" data-moreurl-dict="{&quot;from&quot;:&quot;top-nav-click-fm&quot;,&quot;uid&quot;:&quot;42279477&quot;}">FM</a> </li> <li class=""> <a href="https://time.douban.com&#47;?dt_time_source=douban-web_top_nav" target="_blank" data-moreurl-dict="{&quot;from&quot;:&quot;top-nav-click-time&quot;,&quot;uid&quot;:&quot;42279477&quot;}">时间</a> </li> <li class=""> <a href="https://market.douban.com&#47;?utm_campaign=douban_top_nav&amp;utm_source=douban&amp;utm_medium=pc_web" target="_blank" data-moreurl-dict="{&quot;from&quot;:&quot;top-nav-click-market&quot;,&quot;uid&quot;:&quot;42279477&quot;}">市集</a> </li> <li> <a href="#more" class="bn-more"><span>更多</span></a> <div class="more-items"> <table cellpadding="0" cellspacing="0"> <tbody> <tr> <td> <a href="https://ypy.douban.com" target="_blank" data-moreurl-dict="{&quot;from&quot;:&quot;top-nav-click-ypy&quot;,&quot;uid&quot;:&quot;42279477&quot;}">豆瓣摄影</a> </td> </tr> </tbody> </table> </div> </li> </ul> </div> </div> </div> <script> ;window._GLOBAL_NAV = { USER_ID: "42279477", UPLOAD_AUTH_TOKEN: "42279477:8b22dec856b4355d11d2f08ec54d821c29b92a7e", SSE_TOKEN: "ab8a67e7429303effe306609fb05405c28cbbaf1", SSE_TIMESTAMP: "1517200161", DOUBAN_URL: "https://www.douban.com", N_NEW_NOTIS: 0, N_NEW_DOUMAIL: 0 }; </script> <script src="//img3.doubanio.com/dae/accounts/resources/321e246/shire/bundle.js" defer="defer"></script> <link href="//img3.doubanio.com/dae/accounts/resources/094108a/book/bundle.css" rel="stylesheet" type="text/css"> <div id="db-nav-book" class="nav"> <div class="nav-wrap"> <div class="nav-primary"> <div class="nav-logo"> <a href="https:&#47;&#47;book.douban.com">豆瓣读书</a> </div> <div class="nav-search"> <form action="https:&#47;&#47;book.douban.com/subject_search" method="get"> <fieldset> <legend>搜索:</legend> <label for="inp-query"> </label> <div class="inp"><input id="inp-query" name="search_text" size="22" maxlength="60" placeholder="书名、作者、ISBN" value=""></div> <div class="inp-btn"><input type="submit" value="搜索"></div> <input type="hidden" name="cat" value="1001" /> </fieldset> </form> </div> </div> </div> <div class="nav-secondary"> <div class="nav-items"> <ul> <li ><a href="https://book.douban.com/mine" >我读</a> </li> <li ><a href="https://book.douban.com/updates" >动态</a> </li> <li ><a href="https://book.douban.com/recommended" >豆瓣猜</a> </li> <li ><a href="https://book.douban.com/tag/" >分类浏览</a> </li> <li ><a href="https://book.douban.com/cart/" >购书单</a> </li> <li ><a href="https://read.douban.com/ebooks/?dcs=book-nav&dcm=douban" target="_blank" >电子图书</a> </li> <li ><a href="https://market.douban.com/book?utm_campaign=book_nav_freyr&utm_source=douban&utm_medium=pc_web" >豆瓣书店</a> </li> <li ><a href="https://book.douban.com/annual/2017?source=navigation" target="_blank" >2017年度榜单</a> </li> <li ><a href="https://book.douban.com/standbyme/2017?source=navigation" target="_blank" >2017读书报告</a> </li> <li class=" book-cart" ><a href="https://market.douban.com/cart/?utm_campaign=book_nav_cart&utm_source=douban&utm_medium=pc_web" target="_blank" >购物车</a> </li> </ul> </div> </div> <a href="https://book.douban.com/annual/2017?source=patch" class="bookannual2017"></a> </div> <script id="suggResult" type="text/x-jquery-tmpl"> <li data-link="{{= url}}"> <a href="{{= url}}" onclick="moreurl(this, {from:'book_search_sugg', query:'{{= keyword }}', subject_id:'{{= id}}', i: '{{= index}}', type: '{{= type}}'})"> <img src="{{= pic}}" width="40" /> <div> <em>{{= title}}</em> {{if year}} <span>{{= year}}</span> {{/if}} <p> {{if type == "b"}} {{= author_name}} {{else type == "a" }} {{if en_name}} {{= en_name}} {{/if}} {{/if}} </p> </div> </a> </li> </script> <script src="//img3.doubanio.com/dae/accounts/resources/094108a/book/bundle.js" defer="defer"></script> <div id="wrapper"> <div id="content"> <h1>豆瓣图书标签: 小说</h1> <div class="grid-16-8 clearfix"> <div class="article"> <div id="subject_list"> <div class="clearfix"> <span class="rr greyinput"> 综合排序 &nbsp;/&nbsp; <a href="/tag/%E5%B0%8F%E8%AF%B4?type=R">按出版日期排序</a> &nbsp;/&nbsp; <a href="/tag/%E5%B0%8F%E8%AF%B4?type=S">按评价排序</a> </span> </div> <ul class="subject-list"> <li class="subject-item"> <div class="pic"> <a class="nbg" href="https://book.douban.com/subject/2230208/" onclick="moreurl(this,{i:'0',query:'',subject_id:'2230208',from:'book_subject_search'})"> <img class="" src="https://img1.doubanio.com/mpic/s2720819.jpg" width="90"> </a> </div> <div class="info"> <h2 class=""> <a href="https://book.douban.com/subject/2230208/" title="我的前半生" onclick="moreurl(this,{i:'0',query:'',subject_id:'2230208',from:'book_subject_search'})"> 我的前半生 </a> </h2> <div class="pub"> 亦舒 / 新世界出版社 / 2007-8 / 22.00元 </div> <div class="star clearfix"> <span class="allstar40"></span> <span class="rating_nums">7.9</span> <span class="pl"> (21897人评价) </span> </div> <p>一个三十几岁的美丽女人子君,在家做全职家庭主妇。却被一个平凡女人夺走丈夫,一段婚姻的失败,让女主角不得不坚强,变得更美丽,有了事业,最终遇见一个更值得爱的男... </p> <div class="ft"> <div class="collect-info"> <span> <a href="wish/42279477/update?add=2230208" name="sbtn-2230208-wish" class="j a_collect_btn" rel="nofollow">想读</a> </span> <span> <a href="do/42279477/update?add=2230208" name="sbtn-2230208-do" class="j a_collect_btn" rel="nofollow">在读</a> </span> <span> <a href="collection/42279477/update?add=2230208" name="sbtn-2230208-collect" class="j a_collect_btn" rel="nofollow">读过</a> </span> </div> <div class="cart-actions"> <span class="cart-info"> <span class="add2cartWidget "> <a href="javascript:;" class="j a_add2cart add2cart" name="2230208"> <span>加入购书单</span></a> <span class="color_gary book-in-cart hidden" > 已在<a href="https://book.douban.com/cart">购书单</a> <a class="delete-cart-item" rel="2230208" href="https://book.douban.com/cart">删除</a> </span> </span> </span> </div> </div> </div> </li> <li class="subject-item"> <div class="pic"> <a class="nbg" href="https://book.douban.com/subject/6082808/" onclick="moreurl(this,{i:'1',query:'',subject_id:'6082808',from:'book_subject_search'})"> <img class="" src="https://img3.doubanio.com/mpic/s6384944.jpg" width="90"> </a> </div> <div class="info"> <h2 class=""> <a href="https://book.douban.com/subject/6082808/" title="百年孤独" onclick="moreurl(this,{i:'1',query:'',subject_id:'6082808',from:'book_subject_search'})"> 百年孤独 </a> </h2> <div class="pub"> [哥伦比亚] 加西亚·马尔克斯 / 范晔 / 南海出版公司 / 2011-6 / 39.50元 </div> <div class="star clearfix"> <span class="allstar45"></span> <span class="rating_nums">9.2</span> <span class="pl"> (124018人评价) </span> </div> <p>《百年孤独》是魔幻现实主义文学的代表作,描写了布恩迪亚家族七代人的传奇故事,以及加勒比海沿岸小镇马孔多的百年兴衰,反映了拉丁美洲一个世纪以来风云变幻的历史。... </p> <div class="ft"> <div class="collect-info"> <span> <a href="wish/42279477/update?add=6082808" name="sbtn-6082808-wish" class="j a_collect_btn" rel="nofollow">想读</a> </span> <span> <a href="do/42279477/update?add=6082808" name="sbtn-6082808-do" class="j a_collect_btn" rel="nofollow">在读</a> </span> <span> <a href="collection/42279477/update?add=6082808" name="sbtn-6082808-collect" class="j a_collect_btn" rel="nofollow">读过</a> </span> </div> <div class="cart-actions"> <span class="market-info"> <a href="https://book.douban.com/subject/6082808/?channel=subject_list&amp;platform=web" target="_blank">在豆瓣购买</a> </span> <span class="cart-info"> <span class="add2cartWidget "> <a href="javascript:;" class="j a_add2cart add2cart" name="6082808"> <span>加入购书单</span></a> <span class="color_gary book-in-cart hidden" > 已在<a href="https://book.douban.com/cart">购书单</a> <a class="delete-cart-item" rel="6082808" href="https://book.douban.com/cart">删除</a> </span> </span> </span> </div> </div> </div> </li> <li class="subject-item"> <div class="pic"> <a class="nbg" href="https://book.douban.com/subject/1770782/" onclick="moreurl(this,{i:'2',query:'',subject_id:'1770782',from:'book_subject_search'})"> <img class="" src="https://img3.doubanio.com/mpic/s1727290.jpg" width="90"> </a> </div> <div class="info"> <h2 class=""> <a href="https://book.douban.com/subject/1770782/" title="追风筝的人" onclick="moreurl(this,{i:'2',query:'',subject_id:'1770782',from:'book_subject_search'})"> 追风筝的人 </a> </h2> <div class="pub"> [美] 卡勒德·胡赛尼 / 李继宏 / 上海人民出版社 / 2006-5 / 29.00元 </div> <div class="star clearfix"> <span class="allstar45"></span> <span class="rating_nums">8.9</span> <span class="pl"> (300438人评价) </span> </div> <p>12岁的阿富汗富家少爷阿米尔与仆人哈桑情同手足。然而,在一场风筝比赛后,发生了一件悲惨不堪的事,阿米尔为自己的懦弱感到自责和痛苦,逼走了哈桑,不久,自己也跟... </p> <div class="ft"> <div class="collect-info"> <span> <a href="wish/42279477/update?add=1770782" name="sbtn-1770782-wish" class="j a_collect_btn" rel="nofollow">想读</a> </span> <span> <a href="do/42279477/update?add=1770782" name="sbtn-1770782-do" class="j a_collect_btn" rel="nofollow">在读</a> </span> <span> <a href="collection/42279477/update?add=1770782" name="sbtn-1770782-collect" class="j a_collect_btn" rel="nofollow">读过</a> </span> </div> <div class="cart-actions"> <span class="market-info"> <a href="https://book.douban.com/subject/1770782/?channel=subject_list&amp;platform=web" target="_blank">在豆瓣购买</a> </span> <span class="cart-info"> <span class="add2cartWidget "> <a href="javascript:;" class="j a_add2cart add2cart" name="1770782"> <span>加入购书单</span></a> <span class="color_gary book-in-cart hidden" > 已在<a href="https://book.douban.com/cart">购书单</a> <a class="delete-cart-item" rel="1770782" href="https://book.douban.com/cart">删除</a> </span> </span> </span> </div> <div class="ebook-link"> <a target="_blank" href="https://read.douban.com/ebook/1162265/?dcs=tag-buylink&amp;dcm=douban&amp;dct=1770782">去看电子版</a> </div> </div> </div> </li> <li class="subject-item"> <div class="pic"> <a class="nbg" href="https://book.douban.com/subject/4820710/" onclick="moreurl(this,{i:'3',query:'',subject_id:'4820710',from:'book_subject_search'})"> <img class="" src="https://img1.doubanio.com/mpic/s4371408.jpg" width="90"> </a> </div> <div class="info"> <h2 class=""> <a href="https://book.douban.com/subject/4820710/" title="1984" onclick="moreurl(this,{i:'3',query:'',subject_id:'4820710',from:'book_subject_search'})"> 1984 </a> </h2> <div class="pub"> [英] 乔治·奥威尔 / 刘绍铭 / 北京十月文艺出版社 / 2010-4-1 / 28.00 </div> <div class="star clearfix"> <span class="allstar45"></span> <span class="rating_nums">9.3</span> <span class="pl"> (42425人评价) </span> </div> <p>★村上春树以《1Q84》向本书致敬 ★著名学者刘绍铭经典译本内地首次出版 ★62种文字风靡110个国家,全球销量超过5000万册 ★《时代周刊》“最好的10... </p> <div class="ft"> <div class="collect-info"> <span>我想读这本书</span> <span> <a href="do/42279477/update?add=4820710" name="sbtn-4820710-do" class="j a_collect_btn" rel="nofollow">在读</a> </span> <span> <a href="collection/42279477/update?add=4820710" name="sbtn-4820710-collect" class="j a_collect_btn" rel="nofollow">读过</a> </span> </div> <div class="cart-actions"> <span class="market-info"> <a href="https://book.douban.com/subject/25708359/?channel=subject_list&amp;platform=web" target="_blank">在豆瓣购买</a> </span> <span class="cart-info"> <span class="add2cartWidget "> <a href="javascript:;" class="j a_add2cart add2cart" name="4820710"> <span>加入购书单</span></a> <span class="color_gary book-in-cart hidden" > 已在<a href="https://book.douban.com/cart">购书单</a> <a class="delete-cart-item" rel="4820710" href="https://book.douban.com/cart">删除</a> </span> </span> </span> </div> </div> </div> </li> <li class="subject-item"> <div class="pic"> <a class="nbg" href="https://book.douban.com/subject/1858513/" onclick="moreurl(this,{i:'4',query:'',subject_id:'1858513',from:'book_subject_search'})"> <img class="" src="https://img1.doubanio.com/mpic/s2659208.jpg" width="90"> </a> </div> <div class="info"> <h2 class=""> <a href="https://book.douban.com/subject/1858513/" title="月亮和六便士" onclick="moreurl(this,{i:'4',query:'',subject_id:'1858513',from:'book_subject_search'})"> 月亮和六便士 </a> </h2> <div class="pub"> [英] 毛姆 / 傅惟慈 / 上海译文出版社 / 2006-8 / 15.00元 </div> <div class="star clearfix"> <span class="allstar45"></span> <span class="rating_nums">9.0</span> <span class="pl"> (74873人评价) </span> </div> <p>一个英国证券交易所的经纪人,本已有牢靠的职业和地位、美满的家庭,但却迷恋上绘画,像“被魔鬼附了体”,突然弃家出走,到巴黎去追求绘画的理想。他的行径没有人能够... </p> <div class="ft"> <div class="collect-info"> <span>我想读这本书</span> <span> <a href="do/42279477/update?add=1858513" name="sbtn-1858513-do" class="j a_collect_btn" rel="nofollow">在读</a> </span> <span> <a href="collection/42279477/update?add=1858513" name="sbtn-1858513-collect" class="j a_collect_btn" rel="nofollow">读过</a> </span> </div> <div class="cart-actions"> <span class="cart-info"> <span class="add2cartWidget "> <a href="javascript:;" class="j a_add2cart add2cart" name="1858513"> <span>加入购书单</span></a> <span class="color_gary book-in-cart hidden" > 已在<a href="https://book.douban.com/cart">购书单</a> <a class="delete-cart-item" rel="1858513" href="https://book.douban.com/cart">删除</a> </span> </span> </span> </div> </div> </div> </li> <li class="subject-item"> <div class="pic"> <a class="nbg" href="https://book.douban.com/subject/1082154/" onclick="moreurl(this,{i:'5',query:'',subject_id:'1082154',from:'book_subject_search'})"> <img class="" src="https://img3.doubanio.com/mpic/s23836852.jpg" width="90"> </a> </div> <div class="info"> <h2 class=""> <a href="https://book.douban.com/subject/1082154/" title="活着" onclick="moreurl(this,{i:'5',query:'',subject_id:'1082154',from:'book_subject_search'})"> 活着 </a> </h2> <div class="pub"> 余华 / 南海出版公司 / 1998-5 / 12.00元 </div> <div class="star clearfix"> <span class="allstar45"></span> <span class="rating_nums">9.1</span> <span class="pl"> (140112人评价) </span> </div> <p>地主少爷福贵嗜赌成性,终于赌光了家业一贫如洗,穷困之中的福贵因为母亲生病前去求医,没想到半路上被国民党部队抓了壮丁,后被解放军所俘虏,回到家乡他才知道母亲已... </p> <div class="ft"> <div class="collect-info"> <span>我读过这本书</span> </div> <div class="cart-actions"> <span class="cart-info"> <span class="add2cartWidget "> <a href="javascript:;" class="j a_add2cart add2cart" name="1082154"> <span>加入购书单</span></a> <span class="color_gary book-in-cart hidden" > 已在<a href="https://book.douban.com/cart">购书单</a> <a class="delete-cart-item" rel="1082154" href="https://book.douban.com/cart">删除</a> </span> </span> </span> </div> </div> </div> </li> <li class="subject-item"> <div class="pic"> <a class="nbg" href="https://book.douban.com/subject/1008145/" onclick="moreurl(this,{i:'6',query:'',subject_id:'1008145',from:'book_subject_search'})"> <img class="" src="https://img3.doubanio.com/mpic/s1070222.jpg" width="90"> </a> </div> <div class="info"> <h2 class=""> <a href="https://book.douban.com/subject/1008145/" title="围城" onclick="moreurl(this,{i:'6',query:'',subject_id:'1008145',from:'book_subject_search'})"> 围城 </a> </h2> <div class="pub"> 钱锺书 / 人民文学出版社 / 1991-2 / 19.00 </div> <div class="star clearfix"> <span class="allstar45"></span> <span class="rating_nums">8.9</span> <span class="pl"> (194700人评价) </span> </div> <p>《围城》是钱钟书所著的长篇小说。第一版于1947年由上海晨光出版公司出版。1949年之后,由于政治等方面的原因,本书长期无法在中国大陆和台湾重印,仅在香港出... </p> <div class="ft"> <div class="collect-info"> <span>我读过这本书</span> </div> <div class="cart-actions"> <span class="cart-info"> <span class="add2cartWidget "> <a href="javascript:;" class="j a_add2cart add2cart" name="1008145"> <span>加入购书单</span></a> <span class="color_gary book-in-cart hidden" > 已在<a href="https://book.douban.com/cart">购书单</a> <a class="delete-cart-item" rel="1008145" href="https://book.douban.com/cart">删除</a> </span> </span> </span> </div> </div> </div> </li> <li class="subject-item"> <div class="pic"> <a class="nbg" href="https://book.douban.com/subject/1200840/" onclick="moreurl(this,{i:'7',query:'',subject_id:'1200840',from:'book_subject_search'})"> <img class="" src="https://img3.doubanio.com/mpic/s2335693.jpg" width="90"> </a> </div> <div class="info"> <h2 class=""> <a href="https://book.douban.com/subject/1200840/" title="平凡的世界(全三部)" onclick="moreurl(this,{i:'7',query:'',subject_id:'1200840',from:'book_subject_search'})"> 平凡的世界(全三部) </a> </h2> <div class="pub"> 路遥 / 人民文学出版社 / 2005-1 / 64.00元 </div> <div class="star clearfix"> <span class="allstar45"></span> <span class="rating_nums">9.0</span> <span class="pl"> (104426人评价) </span> </div> <p>《平凡的世界》是一部现实主义小说,也是一部小说形式的家族史。作者浓缩了中国西北农村的历史变迁过程,在小说中全景式地表现了中国当代城乡的社会生活。在近十年的广... </p> <div class="ft"> <div class="collect-info"> <span> <a href="wish/42279477/update?add=1200840" name="sbtn-1200840-wish" class="j a_collect_btn" rel="nofollow">想读</a> </span> <span> <a href="do/42279477/update?add=1200840" name="sbtn-1200840-do" class="j a_collect_btn" rel="nofollow">在读</a> </span> <span> <a href="collection/42279477/update?add=1200840" name="sbtn-1200840-collect" class="j a_collect_btn" rel="nofollow">读过</a> </span> </div> <div class="cart-actions"> <span class="cart-info"> <span class="add2cartWidget "> <a href="javascript:;" class="j a_add2cart add2cart" name="1200840"> <span>加入购书单</span></a> <span class="color_gary book-in-cart hidden" > 已在<a href="https://book.douban.com/cart">购书单</a> <a class="delete-cart-item" rel="1200840" href="https://book.douban.com/cart">删除</a> </span> </span> </span> </div> </div> </div> </li> <li class="subject-item"> <div class="pic"> <a class="nbg" href="https://book.douban.com/subject/4908885/" onclick="moreurl(this,{i:'8',query:'',subject_id:'4908885',from:'book_subject_search'})"> <img class="" src="https://img3.doubanio.com/mpic/s4468484.jpg" width="90"> </a> </div> <div class="info"> <h2 class=""> <a href="https://book.douban.com/subject/4908885/" title="局外人" onclick="moreurl(this,{i:'8',query:'',subject_id:'4908885',from:'book_subject_search'})"> 局外人 </a> </h2> <div class="pub"> [法] 阿尔贝·加缪 / 柳鸣九 / 上海译文出版社 / 2010-9 / 22.00元 </div> <div class="star clearfix"> <span class="allstar45"></span> <span class="rating_nums">9.0</span> <span class="pl"> (33152人评价) </span> </div> <p>《局外人》是加缪小说的成名作和代表作之一,堪称20世纪整个西方文坛最具有划时代意义最著名小说之一,“局外人”也由此成为整个西方文学-哲学中最经典的人物形象和... </p> <div class="ft"> <div class="collect-info"> <span> <a href="wish/42279477/update?add=4908885" name="sbtn-4908885-wish" class="j a_collect_btn" rel="nofollow">想读</a> </span> <span> <a href="do/42279477/update?add=4908885" name="sbtn-4908885-do" class="j a_collect_btn" rel="nofollow">在读</a> </span> <span> <a href="collection/42279477/update?add=4908885" name="sbtn-4908885-collect" class="j a_collect_btn" rel="nofollow">读过</a> </span> </div> <div class="cart-actions"> <span class="market-info"> <a href="https://book.douban.com/subject/4908885/?channel=subject_list&amp;platform=web" target="_blank">在豆瓣购买</a> </span> <span class="cart-info"> <span class="add2cartWidget "> <a href="javascript:;" class="j a_add2cart add2cart" name="4908885"> <span>加入购书单</span></a> <span class="color_gary book-in-cart hidden" > 已在<a href="https://book.douban.com/cart">购书单</a> <a class="delete-cart-item" rel="4908885" href="https://book.douban.com/cart">删除</a> </span> </span> </span> </div> </div> </div> </li> <li class="subject-item"> <div class="pic"> <a class="nbg" href="https://book.douban.com/subject/1856494/" onclick="moreurl(this,{i:'9',query:'',subject_id:'1856494',from:'book_subject_search'})"> <img class="" src="https://img3.doubanio.com/mpic/s2059791.jpg" width="90"> </a> </div> <div class="info"> <h2 class=""> <a href="https://book.douban.com/subject/1856494/" title="卡拉马佐夫兄弟" onclick="moreurl(this,{i:'9',query:'',subject_id:'1856494',from:'book_subject_search'})"> 卡拉马佐夫兄弟 </a> </h2> <div class="pub"> [俄]陀思妥耶夫斯基 / 荣如德 / 上海译文出版社 / 2006-8 / 25.00 </div> <div class="star clearfix"> <span class="allstar45"></span> <span class="rating_nums">9.4</span> <span class="pl"> (7627人评价) </span> </div> <p>老卡拉马佐夫贪婪好色,独占妻子留给儿子们的遗产,并与长子德米特里为一个风流女子争风吃醋。一天黑夜,德米特里疑心自己的情人去跟老头儿幽会,便闯入家园,一怒之下... </p> <div class="ft"> <div class="collect-info"> <span> <a href="wish/42279477/update?add=1856494" name="sbtn-1856494-wish" class="j a_collect_btn" rel="nofollow">想读</a> </span> <span> <a href="do/42279477/update?add=1856494" name="sbtn-1856494-do" class="j a_collect_btn" rel="nofollow">在读</a> </span> <span> <a href="collection/42279477/update?add=1856494" name="sbtn-1856494-collect" class="j a_collect_btn" rel="nofollow">读过</a> </span> </div> <div class="cart-actions"> <span class="cart-info"> <span class="add2cartWidget "> <a href="javascript:;" class="j a_add2cart add2cart" name="1856494"> <span>加入购书单</span></a> <span class="color_gary book-in-cart hidden" > 已在<a href="https://book.douban.com/cart">购书单</a> <a class="delete-cart-item" rel="1856494" href="https://book.douban.com/cart">删除</a> </span> </span> </span> </div> <div class="ebook-link"> <a target="_blank" href="https://read.douban.com/ebook/26004399/?dcs=tag-buylink&amp;dcm=douban&amp;dct=1856494">去看电子版</a> </div> </div> </div> </li> <li class="subject-item"> <div class="pic"> <a class="nbg" href="https://book.douban.com/subject/2035162/" onclick="moreurl(this,{i:'10',query:'',subject_id:'2035162',from:'book_subject_search'})"> <img class="" src="https://img3.doubanio.com/mpic/s2347562.jpg" width="90"> </a> </div> <div class="info"> <h2 class=""> <a href="https://book.douban.com/subject/2035162/" title="刀锋" onclick="moreurl(this,{i:'10',query:'',subject_id:'2035162',from:'book_subject_search'})"> 刀锋 </a> </h2> <div class="pub"> [英]毛姆 / 周煦良 / 上海译文出版社 / 2007-3 / 18.00元 </div> <div class="star clearfix"> <span class="allstar45"></span> <span class="rating_nums">9.0</span> <span class="pl"> (27870人评价) </span> </div> <p>威廉·萨默塞特·毛姆(1874-1965),英国著名小说家、戏剧家。《刀锋》是他的主要作品之一。 小说写一个参加第一次世界大战的美国青年飞行员拉里·达雷尔。... </p> <div class="ft"> <div class="collect-info"> <span> <a href="wish/42279477/update?add=2035162" name="sbtn-2035162-wish" class="j a_collect_btn" rel="nofollow">想读</a> </span> <span> <a href="do/42279477/update?add=2035162" name="sbtn-2035162-do" class="j a_collect_btn" rel="nofollow">在读</a> </span> <span> <a href="collection/42279477/update?add=2035162" name="sbtn-2035162-collect" class="j a_collect_btn" rel="nofollow">读过</a> </span> </div> <div class="cart-actions"> <span class="cart-info"> <span class="add2cartWidget "> <a href="javascript:;" class="j a_add2cart add2cart" name="2035162"> <span>加入购书单</span></a> <span class="color_gary book-in-cart hidden" > 已在<a href="https://book.douban.com/cart">购书单</a> <a class="delete-cart-item" rel="2035162" href="https://book.douban.com/cart">删除</a> </span> </span> </span> </div> </div> </div> </li> <li class="subject-item"> <div class="pic"> <a class="nbg" href="https://book.douban.com/subject/2035171/" onclick="moreurl(this,{i:'11',query:'',subject_id:'2035171',from:'book_subject_search'})"> <img class="" src="https://img1.doubanio.com/mpic/s3983958.jpg" width="90"> </a> </div> <div class="info"> <h2 class=""> <a href="https://book.douban.com/subject/2035171/" title="人生的枷锁" onclick="moreurl(this,{i:'11',query:'',subject_id:'2035171',from:'book_subject_search'})"> 人生的枷锁 </a> </h2> <div class="pub"> [英] 毛姆 / 张柏然、张增健、倪俊 / 上海译文出版社 / 2007-3 / 32.00元 </div> <div class="star clearfix"> <span class="allstar45"></span> <span class="rating_nums">9.0</span> <span class="pl"> (12439人评价) </span> </div> <p>《人生的枷锁》是毛姆的代表作,具有明显的自传色彩。 小说主人公菲利普·凯里自幼父母双亡,不幸又先天残疾,在冷漠而陌生的环境中度过了童年,性格因此孤僻而敏感。... </p> <div class="ft"> <div class="collect-info"> <span> <a href="wish/42279477/update?add=2035171" name="sbtn-2035171-wish" class="j a_collect_btn" rel="nofollow">想读</a> </span> <span> <a href="do/42279477/update?add=2035171" name="sbtn-2035171-do" class="j a_collect_btn" rel="nofollow">在读</a> </span> <span> <a href="collection/42279477/update?add=2035171" name="sbtn-2035171-collect" class="j a_collect_btn" rel="nofollow">读过</a> </span> </div> <div class="cart-actions"> <span class="cart-info"> <span class="add2cartWidget "> <a href="javascript:;" class="j a_add2cart add2cart" name="2035171"> <span>加入购书单</span></a> <span class="color_gary book-in-cart hidden" > 已在<a href="https://book.douban.com/cart">购书单</a> <a class="delete-cart-item" rel="2035171" href="https://book.douban.com/cart">删除</a> </span> </span> </span> </div> </div> </div> </li> <li class="subject-item"> <div class="pic"> <a class="nbg" href="https://book.douban.com/subject/1017143/" onclick="moreurl(this,{i:'12',query:'',subject_id:'1017143',from:'book_subject_search'})"> <img class="" src="https://img1.doubanio.com/mpic/s1091698.jpg" width="90"> </a> </div> <div class="info"> <h2 class=""> <a href="https://book.douban.com/subject/1017143/" title="不能承受的生命之轻" onclick="moreurl(this,{i:'12',query:'',subject_id:'1017143',from:'book_subject_search'})"> 不能承受的生命之轻 </a> </h2> <div class="pub"> [捷克] 米兰·昆德拉 / 许钧 / 上海译文出版社 / 2003-7 / 23.00元 </div> <div class="star clearfix"> <span class="allstar45"></span> <span class="rating_nums">8.5</span> <span class="pl"> (137821人评价) </span> </div> <p>《不能承受的生命之轻》是米兰·昆德拉最负盛名的作品。小说描写了托马斯与特丽莎、萨丽娜之间的感情生活。但它不是一个男人和两个女人的三角性爱故事,它是一部哲理小... </p> <div class="ft"> <div class="collect-info"> <span>我想读这本书</span> <span> <a href="do/42279477/update?add=1017143" name="sbtn-1017143-do" class="j a_collect_btn" rel="nofollow">在读</a> </span> <span> <a href="collection/42279477/update?add=1017143" name="sbtn-1017143-collect" class="j a_collect_btn" rel="nofollow">读过</a> </span> </div> <div class="cart-actions"> <span class="cart-info"> <span class="add2cartWidget "> <a href="javascript:;" class="j a_add2cart add2cart" name="1017143"> <span>加入购书单</span></a> <span class="color_gary book-in-cart hidden" > 已在<a href="https://book.douban.com/cart">购书单</a> <a class="delete-cart-item" rel="1017143" href="https://book.douban.com/cart">删除</a> </span> </span> </span> </div> </div> </div> </li> <li class="subject-item"> <div class="pic"> <a class="nbg" href="https://book.douban.com/subject/1085799/" onclick="moreurl(this,{i:'13',query:'',subject_id:'1085799',from:'book_subject_search'})"> <img class="" src="https://img1.doubanio.com/mpic/s9137567.jpg" width="90"> </a> </div> <div class="info"> <h2 class=""> <a href="https://book.douban.com/subject/1085799/" title="白鹿原" onclick="moreurl(this,{i:'13',query:'',subject_id:'1085799',from:'book_subject_search'})"> 白鹿原 </a> </h2> <div class="pub"> 陈忠实 / 人民文学出版社 / 1997-12 / 28.00元 </div> <div class="star clearfix"> <span class="allstar45"></span> <span class="rating_nums">8.6</span> <span class="pl"> (44886人评价) </span> </div> <p>这是一部渭河平原五十年变迁的雄奇史诗,一轴中国农村班斓多彩、触目惊心的长幅画卷。主人公六娶六丧,神秘的序曲预示着不祥。一个家族两代子孙,为争夺白鹿原的统治代... </p> <div class="ft"> <div class="collect-info"> <span>我想读这本书</span> <span> <a href="do/42279477/update?add=1085799" name="sbtn-1085799-do" class="j a_collect_btn" rel="nofollow">在读</a> </span> <span> <a href="collection/42279477/update?add=1085799" name="sbtn-1085799-collect" class="j a_collect_btn" rel="nofollow">读过</a> </span> </div> <div class="cart-actions"> <span class="cart-info"> <span class="add2cartWidget "> <a href="javascript:;" class="j a_add2cart add2cart" name="1085799"> <span>加入购书单</span></a> <span class="color_gary book-in-cart hidden" > 已在<a href="https://book.douban.com/cart">购书单</a> <a class="delete-cart-item" rel="1085799" href="https://book.douban.com/cart">删除</a> </span> </span> </span> </div> </div> </div> </li> <li class="subject-item"> <div class="pic"> <a class="nbg" href="https://book.douban.com/subject/2035179/" onclick="moreurl(this,{i:'14',query:'',subject_id:'2035179',from:'book_subject_search'})"> <img class="" src="https://img3.doubanio.com/mpic/s2347590.jpg" width="90"> </a> </div> <div class="info"> <h2 class=""> <a href="https://book.douban.com/subject/2035179/" title="动物农场" onclick="moreurl(this,{i:'14',query:'',subject_id:'2035179',from:'book_subject_search'})"> 动物农场 </a> </h2> <div class="pub"> [英] 乔治·奥威尔 / 荣如德 / 上海译文出版社 / 2007-3 / 10.00元 </div> <div class="star clearfix"> <span class="allstar45"></span> <span class="rating_nums">9.2</span> <span class="pl"> (33565人评价) </span> </div> <p>《动物农场》是奥威尔最优秀的作品之一,是一则入木三分的反乌托的政治讽喻寓言。 农场的一群动物成功地进行了一场“革命”,将压榨他们的人类东家赶出农场,建立起一... </p> <div class="ft"> <div class="collect-info"> <span> <a href="wish/42279477/update?add=2035179" name="sbtn-2035179-wish" class="j a_collect_btn" rel="nofollow">想读</a> </span> <span> <a href="do/42279477/update?add=2035179" name="sbtn-2035179-do" class="j a_collect_btn" rel="nofollow">在读</a> </span> <span> <a href="collection/42279477/update?add=2035179" name="sbtn-2035179-collect" class="j a_collect_btn" rel="nofollow">读过</a> </span> </div> <div class="cart-actions"> <span class="cart-info"> <span class="add2cartWidget "> <a href="javascript:;" class="j a_add2cart add2cart" name="2035179"> <span>加入购书单</span></a> <span class="color_gary book-in-cart hidden" > 已在<a href="https://book.douban.com/cart">购书单</a> <a class="delete-cart-item" rel="2035179" href="https://book.douban.com/cart">删除</a> </span> </span> </span> </div> </div> </div> </li> <li class="subject-item"> <div class="pic"> <a class="nbg" href="https://book.douban.com/subject/3406401/" onclick="moreurl(this,{i:'15',query:'',subject_id:'3406401',from:'book_subject_search'})"> <img class="" src="https://img1.doubanio.com/mpic/s6790238.jpg" width="90"> </a> </div> <div class="info"> <h2 class=""> <a href="https://book.douban.com/subject/3406401/" title="悉达多" onclick="moreurl(this,{i:'15',query:'',subject_id:'3406401',from:'book_subject_search'})"> 悉达多 </a> </h2> <div class="pub"> [德] 赫尔曼·黑塞 / 杨玉功 译、丁君君 校 / 上海人民出版社 / 2009-3 / 20.00 </div> <div class="star clearfix"> <span class="allstar45"></span> <span class="rating_nums">9.0</span> <span class="pl"> (13296人评价) </span> </div> <p>古印度贵族青年悉达多英俊聪慧,拥有人们羡慕的一切。为了追求心灵的安宁,他孤身一人展开了求道之旅。他在舍卫城聆听佛陀乔答摩宣讲教义,在繁华的大城中结识了名妓伽... </p> <div class="ft"> <div class="collect-info"> <span> <a href="wish/42279477/update?add=3406401" name="sbtn-3406401-wish" class="j a_collect_btn" rel="nofollow">想读</a> </span> <span> <a href="do/42279477/update?add=3406401" name="sbtn-3406401-do" class="j a_collect_btn" rel="nofollow">在读</a> </span> <span> <a href="collection/42279477/update?add=3406401" name="sbtn-3406401-collect" class="j a_collect_btn" rel="nofollow">读过</a> </span> </div> <div class="cart-actions"> <span class="cart-info"> <span class="add2cartWidget "> <a href="javascript:;" class="j a_add2cart add2cart" name="3406401"> <span>加入购书单</span></a> <span class="color_gary book-in-cart hidden" > 已在<a href="https://book.douban.com/cart">购书单</a> <a class="delete-cart-item" rel="3406401" href="https://book.douban.com/cart">删除</a> </span> </span> </span> </div> </div> </div> </li> <li class="subject-item"> <div class="pic"> <a class="nbg" href="https://book.douban.com/subject/1089243/" onclick="moreurl(this,{i:'16',query:'',subject_id:'1089243',from:'book_subject_search'})"> <img class="" src="https://img3.doubanio.com/mpic/s1076372.jpg" width="90"> </a> </div> <div class="info"> <h2 class=""> <a href="https://book.douban.com/subject/1089243/" title="黄金时代" onclick="moreurl(this,{i:'16',query:'',subject_id:'1089243',from:'book_subject_search'})"> 黄金时代 <span style="font-size:12px;"> : 时代三部曲 </span> </a> </h2> <div class="pub"> 王小波 / 花城出版社 / 1999-3 / 19.00元 </div> <div class="star clearfix"> <span class="allstar45"></span> <span class="rating_nums">8.8</span> <span class="pl"> (59960人评价) </span> </div> <p>《黄金时代》是《时代三部曲》之一。 这是以文革时期为背景的系列作品构成的长篇。发生“文化大革命”的二十世纪六七十年代,正是我们国家和民族的灾难年代。那时,... </p> <div class="ft"> <div class="collect-info"> <span>我读过这本书</span> </div> <div class="cart-actions"> <span class="cart-info"> <span class="add2cartWidget "> <a href="javascript:;" class="j a_add2cart add2cart" name="1089243"> <span>加入购书单</span></a> <span class="color_gary book-in-cart hidden" > 已在<a href="https://book.douban.com/cart">购书单</a> <a class="delete-cart-item" rel="1089243" href="https://book.douban.com/cart">删除</a> </span> </span> </span> </div> </div> </div> </li> <li class="subject-item"> <div class="pic"> <a class="nbg" href="https://book.douban.com/subject/1829226/" onclick="moreurl(this,{i:'17',query:'',subject_id:'1829226',from:'book_subject_search'})"> <img class="" src="https://img3.doubanio.com/mpic/s4007145.jpg" width="90"> </a> </div> <div class="info"> <h2 class=""> <a href="https://book.douban.com/subject/1829226/" title="肖申克的救赎" onclick="moreurl(this,{i:'17',query:'',subject_id:'1829226',from:'book_subject_search'})"> 肖申克的救赎 </a> </h2> <div class="pub"> [美] 斯蒂芬·金 / 施寄青、赵永芬、齐若兰 / 人民文学出版社 / 2006-7 / 29.90元 </div> <div class="star clearfix"> <span class="allstar45"></span> <span class="rating_nums">9.1</span> <span class="pl"> (39519人评价) </span> </div> <p>这本书收入斯蒂芬·金的四部中篇小说,是他作品中的杰出代表作。其英文版一经推出,即登上《纽约时报》畅销书排行榜的冠军之位,当年在美国狂销二十八万册。目前,这本... </p> <div class="ft"> <div class="collect-info"> <span> <a href="wish/42279477/update?add=1829226" name="sbtn-1829226-wish" class="j a_collect_btn" rel="nofollow">想读</a> </span> <span> <a href="do/42279477/update?add=1829226" name="sbtn-1829226-do" class="j a_collect_btn" rel="nofollow">在读</a> </span> <span> <a href="collection/42279477/update?add=1829226" name="sbtn-1829226-collect" class="j a_collect_btn" rel="nofollow">读过</a> </span> </div> <div class="cart-actions"> <span class="cart-info"> <span class="add2cartWidget "> <a href="javascript:;" class="j a_add2cart add2cart" name="1829226"> <span>加入购书单</span></a> <span class="color_gary book-in-cart hidden" > 已在<a href="https://book.douban.com/cart">购书单</a> <a class="delete-cart-item" rel="1829226" href="https://book.douban.com/cart">删除</a> </span> </span> </span> </div> </div> </div> </li> <li class="subject-item"> <div class="pic"> <a class="nbg" href="https://book.douban.com/subject/5337248/" onclick="moreurl(this,{i:'18',query:'',subject_id:'5337248',from:'book_subject_search'})"> <img class="" src="https://img3.doubanio.com/mpic/s4526465.jpg" width="90"> </a> </div> <div class="info"> <h2 class=""> <a href="https://book.douban.com/subject/5337248/" title="台北人" onclick="moreurl(this,{i:'18',query:'',subject_id:'5337248',from:'book_subject_search'})"> 台北人 </a> </h2> <div class="pub"> 白先勇 / 广西师范大学出版社 / 2010-10 / 38.00元 </div> <div class="star clearfix"> <span class="allstar45"></span> <span class="rating_nums">8.9</span> <span class="pl"> (14052人评价) </span> </div> <p>作为20世纪中文小说100强的《台北人》,是一部深具复杂性的短篇小说集,由十四个一流的短篇小说构成,串联成一体,则效果遽然增加,不但小说之幅面变广,使我们看... </p> <div class="ft"> <div class="collect-info"> <span> <a href="wish/42279477/update?add=5337248" name="sbtn-5337248-wish" class="j a_collect_btn" rel="nofollow">想读</a> </span> <span> <a href="do/42279477/update?add=5337248" name="sbtn-5337248-do" class="j a_collect_btn" rel="nofollow">在读</a> </span> <span> <a href="collection/42279477/update?add=5337248" name="sbtn-5337248-collect" class="j a_collect_btn" rel="nofollow">读过</a> </span> </div> <div class="cart-actions"> <span class="buy-info"> <a href="https://book.douban.com/subject/5337248/buylinks"> 纸质版 156.00 元起 </a> </span> <span class="cart-info"> <span class="add2cartWidget "> <a href="javascript:;" class="j a_add2cart add2cart" name="5337248"> <span>加入购书单</span></a> <span class="color_gary book-in-cart hidden" > 已在<a href="https://book.douban.com/cart">购书单</a> <a class="delete-cart-item" rel="5337248" href="https://book.douban.com/cart">删除</a> </span> </span> </span> </div> <div class="ebook-link"> <a target="_blank" href="https://read.douban.com/ebook/263569/?dcs=tag-buylink&amp;dcm=douban&amp;dct=5337248">去看电子版</a> </div> </div> </div> </li> <li class="subject-item"> <div class="pic"> <a class="nbg" href="https://book.douban.com/subject/1068920/" onclick="moreurl(this,{i:'19',query:'',subject_id:'1068920',from:'book_subject_search'})"> <img class="" src="https://img1.doubanio.com/mpic/s1078958.jpg" width="90"> </a> </div> <div class="info"> <h2 class=""> <a href="https://book.douban.com/subject/1068920/" title="飘" onclick="moreurl(this,{i:'19',query:'',subject_id:'1068920',from:'book_subject_search'})"> 飘 </a> </h2> <div class="pub"> [美国] 玛格丽特·米切尔 / 李美华 / 译林出版社 / 2000-9 / 40.00元 </div> <div class="star clearfix"> <span class="allstar45"></span> <span class="rating_nums">9.3</span> <span class="pl"> (80512人评价) </span> </div> <p>小说中的故事发生在1861年美国南北战争前夕。生活在南方的少女郝思嘉从小深受南方文化传统的熏陶,可在她的血液里却流淌着野性的叛逆因素。随着战火的蔓廷和生活环... </p> <div class="ft"> <div class="collect-info"> <span> <a href="wish/42279477/update?add=1068920" name="sbtn-1068920-wish" class="j a_collect_btn" rel="nofollow">想读</a> </span> <span> <a href="do/42279477/update?add=1068920" name="sbtn-1068920-do" class="j a_collect_btn" rel="nofollow">在读</a> </span> <span> <a href="collection/42279477/update?add=1068920" name="sbtn-1068920-collect" class="j a_collect_btn" rel="nofollow">读过</a> </span> </div> <div class="cart-actions"> <span class="cart-info"> <span class="add2cartWidget "> <a href="javascript:;" class="j a_add2cart add2cart" name="1068920"> <span>加入购书单</span></a> <span class="color_gary book-in-cart hidden" > 已在<a href="https://book.douban.com/cart">购书单</a> <a class="delete-cart-item" rel="1068920" href="https://book.douban.com/cart">删除</a> </span> </span> </span> </div> </div> </div> </li> </ul> <div class="paginator"> <span class="prev"> &lt;前页 </span> <span class="thispage">1</span> <a href="/tag/小说?start=20&amp;type=T" >2</a> <a href="/tag/小说?start=40&amp;type=T" >3</a> <a href="/tag/小说?start=60&amp;type=T" >4</a> <a href="/tag/小说?start=80&amp;type=T" >5</a> <a href="/tag/小说?start=100&amp;type=T" >6</a> <a href="/tag/小说?start=120&amp;type=T" >7</a> <a href="/tag/小说?start=140&amp;type=T" >8</a> <a href="/tag/小说?start=160&amp;type=T" >9</a> <span class="break">...</span> <a href="/tag/小说?start=1960&amp;type=T" >99</a> <a href="/tag/小说?start=1980&amp;type=T" >100</a> <span class="next"> <link rel="next" href="/tag/小说?start=20&amp;type=T"/> <a href="/tag/小说?start=20&amp;type=T" >后页&gt;</a> </span> </div> </div> </div> <div class="aside"> <br/> <div id="dale_book_tag_top_right"></div> <h2> <span class="">相关的标签</span> &nbsp;&middot;&nbsp;&middot;&nbsp;&middot;&nbsp;&middot;&nbsp;&middot;&nbsp;&middot; </h2> <div class="tags-list"> <a href="/tag/外国文学">外国文学</a> <a href="/tag/言情">言情</a> <a href="/tag/美国">美国</a> <a href="/tag/文学">文学</a> <a href="/tag/爱情">爱情</a> <a href="/tag/中国">中国</a> <a href="/tag/中国文学">中国文学</a> <a href="/tag/英国">英国</a> </div> <form name="tsp_form" action="/tag/" method="GET"> <input name="search_text" class="j a_search_text" type="text" size="24" maxlength="36" title="去其他标签" value=""/> <input class="butt" type="submit" value="进入"/> </form> <br/> <br/> <p class="pl2 mb30"> &gt; <a href="/tag/">浏览全部图书标签</a> </p> <br/> <br/> <div class="block5 movie_show"> <h2>最近受关注的书-小说</h2> <div class="content clearfix" id="book_rec"> <dl> <dt><a onclick="moreurl(this, {'r1001':'book-tag-top'})" href="https://book.douban.com/subject/2230208/"><img src="https://img1.doubanio.com/spic/s2720819.jpg" class="m_sub_img" /></a></dt> <dd><a onclick="moreurl(this, {'r1001':'book-tag-top'})" href="https://book.douban.com/subject/2230208/">我的前半生</a> </dd> </dl> <dl> <dt><a onclick="moreurl(this, {'r1001':'book-tag-top'})" href="https://book.douban.com/subject/1003000/"><img src="https://img3.doubanio.com/spic/s9026255.jpg" class="m_sub_img" /></a></dt> <dd><a onclick="moreurl(this, {'r1001':'book-tag-top'})" href="https://book.douban.com/subject/1003000/">悟空传</a> </dd> </dl> <dl> <dt><a onclick="moreurl(this, {'r1001':'book-tag-top'})" href="https://book.douban.com/subject/25967870/"><img src="https://img1.doubanio.com/spic/s27432697.jpg" class="m_sub_img" /></a></dt> <dd><a onclick="moreurl(this, {'r1001':'book-tag-top'})" href="https://book.douban.com/subject/25967870/">长白秘闻之不咸灵迹</a> </dd> </dl> <div class="clearfix rr" style="width:100%"></div> <dl> <dt><a onclick="moreurl(this, {'r1001':'book-tag-top'})" href="https://book.douban.com/subject/27079142/"><img src="https://img1.doubanio.com/spic/s29484809.jpg" class="m_sub_img" /></a></dt> <dd><a onclick="moreurl(this, {'r1001':'book-tag-top'})" href="https://book.douban.com/subject/27079142/">有匪3</a> </dd> </dl> <dl> <dt><a onclick="moreurl(this, {'r1001':'book-tag-top'})" href="https://book.douban.com/subject/27006492/"><img src="https://img3.doubanio.com/spic/s29428074.jpg" class="m_sub_img" /></a></dt> <dd><a onclick="moreurl(this, {'r1001':'book-tag-top'})" href="https://book.douban.com/subject/27006492/">戴上手套擦泪</a> </dd> </dl> <dl> <dt><a onclick="moreurl(this, {'r1001':'book-tag-top'})" href="https://book.douban.com/subject/27064644/"><img src="https://img1.doubanio.com/spic/s29470789.jpg" class="m_sub_img" /></a></dt> <dd><a onclick="moreurl(this, {'r1001':'book-tag-top'})" href="https://book.douban.com/subject/27064644/">北方大道</a> </dd> </dl> <div class="clearfix rr" style="width:100%"></div> </div> </div> <script type="text/javascript"> (function (global) { var newNode = global.document.createElement('script'), existingNode = global.document.getElementsByTagName('script')[0], adSource = '//erebor.douban.com/', userId = '42279477', browserId = 'PDswO7ExjHU', criteria = '3:/tag/小说?start=0&amp;type=T', preview = '', debug = false, adSlots = ['dale_book_tag_top_right']; global.DoubanAdRequest = {src: adSource, uid: userId, bid: browserId, crtr: criteria, prv: preview, debug: debug}; global.DoubanAdSlots = (global.DoubanAdSlots || []).concat(adSlots); newNode.setAttribute('type', 'text/javascript'); newNode.setAttribute('src', 'https://img3.doubanio.com/f/adjs/d59867ddbe8a25645584b467a58a41cbd672c9be/ad.release.js'); newNode.setAttribute('async', true); existingNode.parentNode.insertBefore(newNode, existingNode); })(this); </script> </div> <div class="extra"> </div> </div> </div> <div id="footer"> <span id="icp" class="fleft gray-link"> &copy; 2005-2018 douban.com, all rights reserved 北京豆网科技有限公司 </span> <a href="https://www.douban.com/hnypt/variformcyst.py" style="display: none;"></a> <span class="fright"> <a href="https://www.douban.com/about">关于豆瓣</a> · <a href="https://www.douban.com/jobs">在豆瓣工作</a> · <a href="https://www.douban.com/about?topic=contactus">联系我们</a> · <a href="https://www.douban.com/about?policy=disclaimer">免责声明</a> · <a href="https://help.douban.com/?app=book" target="_blank">帮助中心</a> · <a href="https://book.douban.com/library_invitation">图书馆合作</a> · <a href="https://www.douban.com/doubanapp/">移动应用</a> · <a href="https://www.douban.com/partner/">豆瓣广告</a> </span> </div> </div> <script type="text/javascript"> $(function(){ $('.add2cartWidget').each(function() { var add2CartBtn = $(this).find('.add2cart'); var inCartHint = $(this).find('.book-in-cart'); var deleteBtn = inCartHint.find('.delete-cart-item'); deleteBtn.click(function(e) { e.preventDefault(); $.post_withck('/cart', {remove: this.rel}, function() { add2CartBtn.show(); inCartHint.hide(); }); }); }); }); </script> <!-- mako --> <script> $(function () { function update_tags(current) { html = $.map(current, function(o) {return '<span class="tags-name">' + o + '</span><sup class="tags-del"></sup> '}).join('<span class="tags-add">+</span>'); $('h1').html('<span class="name">电影标签:</span>' + html); }; function get_current_tags() { var r = []; $('.tags-name').each(function() {r.push($(this).text())}); return r; }; function get_current_sort_type() { url = location.href; array = url.split("?") if (array.length == 1) { return ""; } query = array[1]; arr = query.split("&"); for (var i = 0; i < arr.length; i++) { arr2 = arr[i].split('='); if (arr2[0] == "type") { if (arr2.length == 1) { return ""; } return arr2[1]; } } return ""; }; function update_subject_list(current, sort_type) { $('#subject_list').html('<span class="pl">载入中,请稍候...</span>'); $('#subject_list').load_withck('/j/tag/j_subject_list', {tags:current.join(' '), type:sort_type}, function() {}); }; function update_related_tags_and_subject(current, sort_type) { update_related_tags(current, sort_type); // update_subject_list(current, sort_type); }; function update_related_tags(current, sort_type) { $('#related_tags').load_withck('/j/tag/j_related_tag', {tags:current.join(' '), type:sort_type}, function() { $('.more').toggle( function () { $('.tags-hide').css('display', 'inline'); $(this).text('收起▲'); }, function () { $('.tags-hide').hide(); $(this).text('更多▼'); } ); $('.tags-del').click(function () { if($(this).prev().prev().text() == '+') { $(this).prev().prev().remove(); } else if ($(this).next().text() == '+') { $(this).next().remove(); } $(this).prev().remove().end().remove(); current = get_current_tags(); if (current.length == 0){ document.location.href = '/tag/'; } else { //setHash(current.join(' ')); //location.href = '/tag/' + (location.href).split('#')[1] + '?type=' + sort_type; sort_type = get_current_sort_type(); location.href = '/tag/' + current.join(' ') + '?type=' + sort_type; } }); $('.add-tag').click(function () { current = get_current_tags(); current.push($(this).text()); update_tags(current); //setHash(current.join(' ')); //location.href = '/tag/' + (location.href).split('#')[1] + '?type=' + sort_type; sort_type = get_current_sort_type(); location.href = '/tag/' + current.join(' ') + '?type=' + sort_type; }); $('.tagsInput').keypress(function (e) { if (e.which == 13) { current = get_current_tags(); current.push($(this).val()); update_tags(current); sort_type = get_current_sort_type(); //setHash(current.join(' ')); //location.href = '/tag/' + (location.href).split('#')[1] + '?type=' + sort_type; location.href = '/tag/' + current.join(' ') + '?type=' + sort_type; } }); checkInput($('.tagsInput')); }); }; current = get_current_tags(); sort_type = get_current_sort_type(); update_related_tags_and_subject(current, sort_type); function checkInput (o) { if (!o.val() || o.val() == o.attr('title')) { o.addClass('greyinput'); o.val(o.attr('title')); } o.focus(function(){ o.removeClass('greyinput'); if(o.val() == o.attr('title')) o.val(''); }); o.blur(function(){ if(!o.val()){ o.addClass('greyinput'); o.val(o.attr('title')); } }); } if($.browser.msie && $.browser.version == 6.0) { $('.tags-del').hover( function () { $(this).addClass('tags-hover'); }, function () { $(this).removeClass('tags-hover'); } ); } if (location.href.split('#').length > 1) { //changeUrl (); } }); function setHash (a) { $.browser.msie?$.locationHash(a):location.hash = a; } </script> <script type="text/javascript"> var _paq = _paq || []; _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var p=(('https:' == document.location.protocol) ? 'https' : 'http'), u=p+'://fundin.douban.com/'; _paq.push(['setTrackerUrl', u+'piwik']); _paq.push(['setSiteId', '100001']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.defer=true; g.async=true; g.src=p+'://s.doubanio.com/dae/fundin/piwik.js'; s.parentNode.insertBefore(g,s); })(); </script> <script type="text/javascript"> var setMethodWithNs = function(namespace) { var ns = namespace ? namespace + '.' : '' , fn = function(string) { if(!ns) {return string} return ns + string } return fn } var gaWithNamespace = function(fn, namespace) { var method = setMethodWithNs(namespace) fn.call(this, method) } var _gaq = _gaq || [] , accounts = [ { id: 'UA-7019765-1', namespace: 'douban' } , { id: 'UA-7019765-16', namespace: '' } ] , gaInit = function(account) { gaWithNamespace(function(method) { gaInitFn.call(this, method, account) }, account.namespace) } , gaInitFn = function(method, account) { _gaq.push([method('_setAccount'), account.id]) _gaq.push([method('_addOrganic'), 'google', 'q']) _gaq.push([method('_addOrganic'), 'baidu', 'wd']) _gaq.push([method('_addOrganic'), 'soso', 'w']) _gaq.push([method('_addOrganic'), 'youdao', 'q']) _gaq.push([method('_addOrganic'), 'so.360.cn', 'q']) _gaq.push([method('_addOrganic'), 'sogou', 'query']) if (account.namespace) { _gaq.push([method('_addIgnoredOrganic'), '豆瓣']) _gaq.push([method('_addIgnoredOrganic'), 'douban']) _gaq.push([method('_addIgnoredOrganic'), '豆瓣网']) _gaq.push([method('_addIgnoredOrganic'), 'www.douban.com']) } if (account.namespace === 'douban') { _gaq.push([method('_setDomainName'), '.douban.com']) } _gaq.push([method('_setCustomVar'), 1, 'responsive_view_mode', 'desktop', 3]) _gaq.push([method('_setCustomVar'), 2, 'login_status', '1', 2]); _gaq.push([method('_trackPageview')]) } for(var i = 0, l = accounts.length; i < l; i++) { var account = accounts[i] gaInit(account) } ;(function() { var ga = document.createElement('script'); ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; ga.setAttribute('async', 'true'); document.documentElement.firstChild.appendChild(ga); })() </script> <!-- sindar2b-docker--> </body> </html> """ from Crawler.DouBan.DouBan.items import DoubanItem import re response_text = pq(html) books = response_text.find('.subject-list .subject-item').items() item = DoubanItem() for book in books: item['cover'] = book.find('img').attr('src') item['name'] = book.find('h2 a').attr('title') item['url'] = book.find('h2 a').attr('href') pubs = book.find('.pub').text().split('/') item["author"] = pubs[0] item["translator"] = pubs[1] if len(pubs) == 5 else ' ' item['press'] = pubs[len(pubs) - 3] item['publish_year'] = pubs[len(pubs) - 2] item['price'] = pubs[len(pubs) - 1] item['grade'] = book.find('.rating_nums').text() item["grade_count"] = re.search(r'(\d+)', book.find('.star.clearfix .pl').text()).group(0) item['content_synopsis'] = book.find('p').text() print(item)
22.064396
1,121
0.519335
8,494
71,268
4.301507
0.115022
0.024085
0.038783
0.055642
0.691956
0.671621
0.64967
0.585489
0.568547
0.54646
0
0.06978
0.286763
71,268
3,229
1,122
22.071229
0.648423
0
0
0.614106
0
0.095183
0.99022
0.295448
0
0
0
0
0
1
0
false
0
0.00172
0
0.005734
0.000573
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
022abe731b2a4eee5dda4128c4d6c308dc90ed97
2,067
py
Python
dev/mixtures/Table2.9_to_JSON.py
pauliacomi/CoolProp
80eb4601c67ecd04353067663db50937fd7ccdae
[ "MIT" ]
520
2015-01-14T16:49:41.000Z
2022-03-29T07:48:50.000Z
dev/mixtures/Table2.9_to_JSON.py
pauliacomi/CoolProp
80eb4601c67ecd04353067663db50937fd7ccdae
[ "MIT" ]
1,647
2015-01-01T07:42:45.000Z
2022-03-31T23:48:56.000Z
dev/mixtures/Table2.9_to_JSON.py
pauliacomi/CoolProp
80eb4601c67ecd04353067663db50937fd7ccdae
[ "MIT" ]
320
2015-01-02T17:24:27.000Z
2022-03-19T07:01:00.000Z
data = """CO2-H2O 1.030538 0.828472 1.021392 0.895156 1 CO2-N2 0.994140013 1.107654104 1.022709642 1.047578256 1 CO2-O2 1.000000 1.031986 1.000000 1.084460 0 CO2-Ar 1.027147 0.968781 1.001378 1.029710 1 CO2-CO 0.993245 1.068392 1.030855 1.245499 0 H2O-N2 0.954149 0.805147 1.079628 0.733443 1 H2O-O2 0.798046 0.807842 0.972576 0.873460 0.6017 H2O-Ar 0.679104 0.921000 0.940398 1.050952 0 H2O-CO 1.045927 0.823984 1.063348 0.766756 0.9897 N2-O2 0.997190589 0.995157044 0.999521770 0.997082328 0 N2-Ar 0.999442 0.989311 1.006697 1.001549 0 N2-CO 1.002409 0.994100 1.000000 1.001317 0 O2-Ar 0.999039 0.988822 1.006502 1.001341 0 O2-CO 1.000000 1.000000 1.000000 1.000000 0 CO-Ar 1.000000000 0.954215746 1.000000000 1.159720623 0""" namedict = dict(O2='Oxygen', N2='Nitrogen', CO2='CarbonDioxide', CO='CarbonMonoxide', H2O='Water', Ar='Argon') import CoolProp CASdict = {namedict[n]: CoolProp.CoolProp.get_fluid_param_string(namedict[n], "CAS") for n in namedict} functiondict = {'CO2-H2O': 'CarbonDioxide-Water', 'CO2-N2': 'CarbonDioxide-Nitrogen', 'CO2-Ar': 'CarbonDioxide-Argon', 'H2O-N2': 'GeneralizedAirWater', 'H2O-O2': 'GeneralizedAirWater', 'H2O-CO': 'GeneralizedAirWater'} out = [] for line in data.split('\n'): pair, betaT, betaV, gammaT, gammaV, F = line.split(' ') n1, n2 = pair.split('-') out.append(dict(BibTeX='Gernert-Thesis-2013', F=float(F), betaT=float(betaT), betaV=float(betaV), gammaT=float(gammaT), gammaV=float(gammaV), Name1=namedict[n1], Name2=namedict[n2], CAS1=CASdict[namedict[n1]], CAS2=CASdict[namedict[n2]])) if F != '0': out[-1]['function'] = functiondict[pair] import json, sys sys.path.append('..') from package_json import json_options print(json.dumps(out, **json_options))
41.34
110
0.605709
303
2,067
4.112211
0.379538
0.039326
0.038523
0.033708
0.022472
0.022472
0
0
0
0
0
0.344625
0.257378
2,067
49
111
42.183673
0.467101
0
0
0
0
0
0.499758
0.010643
0
0
0
0
0
1
0
false
0
0.068182
0
0.068182
0.022727
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
022ddde53e91b00098b48448dc90f8254bc815f5
108
py
Python
01-logica-de-programacao-e-algoritmos/Aula 05/5 Recursos avancados com funcoes/5.1 excecoes e erros/ex03.py
rafaelbarretomg/Uninter
1f84b0103263177122663e991db3a8aeb106a959
[ "MIT" ]
null
null
null
01-logica-de-programacao-e-algoritmos/Aula 05/5 Recursos avancados com funcoes/5.1 excecoes e erros/ex03.py
rafaelbarretomg/Uninter
1f84b0103263177122663e991db3a8aeb106a959
[ "MIT" ]
null
null
null
01-logica-de-programacao-e-algoritmos/Aula 05/5 Recursos avancados com funcoes/5.1 excecoes e erros/ex03.py
rafaelbarretomg/Uninter
1f84b0103263177122663e991db3a8aeb106a959
[ "MIT" ]
null
null
null
# Excecao ValueError. # digitando letras ao inves de numeros x = int(input('Por favor digite um numero: '))
27
46
0.731481
16
108
4.9375
1
0
0
0
0
0
0
0
0
0
0
0
0.166667
108
3
47
36
0.877778
0.518519
0
0
0
0
0.571429
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
0233873ecef5b0cdaa9ec93df05183c2e9eb1a9b
904
py
Python
page_objects/UserPage.py
pavlovprojects/python_qa_pageobject
017bd35bcf57ab5d5e52b4e270d0f279e2222b60
[ "MIT" ]
null
null
null
page_objects/UserPage.py
pavlovprojects/python_qa_pageobject
017bd35bcf57ab5d5e52b4e270d0f279e2222b60
[ "MIT" ]
null
null
null
page_objects/UserPage.py
pavlovprojects/python_qa_pageobject
017bd35bcf57ab5d5e52b4e270d0f279e2222b60
[ "MIT" ]
null
null
null
from .BasePage import BasePage class UserPage(BasePage): """Страница пользователя""" RIGHT_MENU = {'css': '#column-right'} WISH_LIST = {'css': RIGHT_MENU['css'] + ' a:nth-child(5)'} PAYMENT_FORM = {'css': '#payment-new'} LOGIN_EMAIL_INPUT = {'css': '#input-email'} LOGIN_PASSWORD_INPUT = {'css': '#input-password'} LOGIN_BUTTON = {'css': 'input[value=Login]'} def login_user(self, email, password): self._input(self.LOGIN_EMAIL_INPUT, email) self._input(self.LOGIN_PASSWORD_INPUT, password) self._click(self.LOGIN_BUTTON) return self def open_wishlist(self): self._click(self.WISH_LIST) return self def verify_payment_form(self): self._wait_for_visible(self.PAYMENT_FORM) return self def verify_product(self, name): self._wait_for_visible(name, link_text=True) return self
29.16129
62
0.652655
114
904
4.894737
0.368421
0.071685
0.069892
0.064516
0
0
0
0
0
0
0
0.001408
0.214602
904
30
63
30.133333
0.784507
0.02323
0
0.181818
0
0
0.120867
0
0
0
0
0
0
1
0.181818
false
0.136364
0.045455
0
0.727273
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
2
024346402d94284e13f11d4a755265982b1e8aee
3,384
py
Python
cadCAD/utils/__init__.py
dnllvrvz/cadCAD
f931945eafc3b4654f6eb7de3592f14f34c220ae
[ "MIT" ]
3
2020-05-26T12:17:48.000Z
2020-06-25T12:03:37.000Z
cadCAD/utils/__init__.py
dnllvrvz/cadCAD
f931945eafc3b4654f6eb7de3592f14f34c220ae
[ "MIT" ]
4
2020-05-26T21:03:44.000Z
2020-06-30T12:13:15.000Z
cadCAD/utils/__init__.py
dnllvrvz/cadCAD
f931945eafc3b4654f6eb7de3592f14f34c220ae
[ "MIT" ]
1
2019-12-11T18:28:18.000Z
2019-12-11T18:28:18.000Z
from functools import reduce from typing import Dict, List from collections import defaultdict, Counter from itertools import product import warnings from pandas import DataFrame class SilentDF(DataFrame): def __repr__(self): return str(hex(id(DataFrame))) #"pandas.core.frame.DataFrame" def append_dict(dict, new_dict): dict.update(new_dict) return dict class IndexCounter: def __init__(self): self.i = 0 def __call__(self): self.i += 1 return self.i def compose(*functions): return reduce(lambda f, g: lambda x: f(g(x)), functions, lambda x: x) def pipe(x): return x def print_pipe(x): print(x) return x def flattenDict(l): def tupalize(k, vs): l = [] if isinstance(vs, list): for v in vs: l.append((k, v)) else: l.append((k, vs)) return l flat_list = [tupalize(k, vs) for k, vs in l.items()] flat_dict = [dict(items) for items in product(*flat_list)] return flat_dict def flatten(l): if isinstance(l, list): return [item for sublist in l for item in sublist] elif isinstance(l, dict): return flattenDict(l) def flatMap(f, collection): return flatten(list(map(f, collection))) def dict_filter(dictionary, condition): return dict([(k, v) for k, v in dictionary.items() if condition(v)]) def get_max_dict_val_len(g: Dict[str, List[int]]) -> int: return len(max(g.values(), key=len)) def tabulate_dict(d: Dict[str, List[int]]) -> Dict[str, List[int]]: max_len = get_max_dict_val_len(d) _d = {} for k, vl in d.items(): if len(vl) != max_len: _d[k] = vl + list([vl[-1]] * (max_len-1)) else: _d[k] = vl return _d def flatten_tabulated_dict(d: Dict[str, List[int]]) -> List[Dict[str, int]]: max_len = get_max_dict_val_len(d) dl = [{} for i in range(max_len)] for k, vl in d.items(): for v, i in zip(vl, list(range(len(vl)))): dl[i][k] = v return dl def contains_type(_collection, type): return any(isinstance(x, type) for x in _collection) def drop_right(l, n): return l[:len(l) - n] def key_filter(l, keyname): if (type(l) == list): return [v[keyname] for v in l] # Keeping support to dictionaries for backwards compatibility # Should be removed in the future warnings.warn( "The use of a dictionary to describe Partial State Update Blocks will be deprecated. Use a list instead.", FutureWarning) return [v[keyname] for k, v in l.items()] def groupByKey(l): d = defaultdict(list) for key, value in l: d[key].append(value) return list(dict(d).items()).pop() # @curried def rename(new_name, f): f.__name__ = new_name return f def curry_pot(f, *argv): sweep_ind = f.__name__[0:5] == 'sweep' arg_len = len(argv) if sweep_ind is True and arg_len == 4: return f(argv[0])(argv[1])(argv[2])(argv[3]) elif sweep_ind is False and arg_len == 4: return f(argv[0], argv[1], argv[2], argv[3]) elif sweep_ind is True and arg_len == 3: return f(argv[0])(argv[1])(argv[2]) elif sweep_ind is False and arg_len == 3: return f(argv[0], argv[1], argv[2]) else: raise TypeError('curry_pot() needs 3 or 4 positional arguments')
23.664336
114
0.611998
532
3,384
3.757519
0.255639
0.005003
0.022011
0.028014
0.171086
0.163082
0.130065
0.121061
0.109055
0.083042
0
0.01035
0.257683
3,384
142
115
23.830986
0.78543
0.038416
0
0.09375
0
0
0.047077
0
0
0
0
0
0
1
0.21875
false
0
0.0625
0.083333
0.5625
0.020833
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
025275f133088c8ceea1a8d549d4165c95ec7f04
493
py
Python
Activations/__init__.py
recep-yildirim/Machine-Learning-Algorithms
dc4f4e6939631468246efc7537b1569007fee792
[ "MIT" ]
3
2021-05-12T13:13:52.000Z
2022-01-19T19:54:16.000Z
Activations/__init__.py
recep-yildirim/Machine-Learning-Algorithms
dc4f4e6939631468246efc7537b1569007fee792
[ "MIT" ]
null
null
null
Activations/__init__.py
recep-yildirim/Machine-Learning-Algorithms
dc4f4e6939631468246efc7537b1569007fee792
[ "MIT" ]
null
null
null
from importlib import import_module import os def get_parent_dir(n=0): current_path = os.path.dirname(os.path.abspath(__file__)) for _ in range(n): current_path = os.path.dirname(current_path) return current_path def get_activation(name): module = import_module(name) activation = getattr(module, name) return activation() # creates an instance of the class os.sys.path.append(get_parent_dir()) from Activation import Activation from Relu import Relu
23.47619
62
0.736308
71
493
4.887324
0.450704
0.126801
0.069164
0.097983
0.138329
0
0
0
0
0
0
0.002475
0.180527
493
21
63
23.47619
0.856436
0.064909
0
0
0
0
0
0
0
0
0
0
0
1
0.142857
false
0
0.357143
0
0.642857
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
0262244944c48105e05feeeea70f9e1a7a59a5c9
1,008
py
Python
Sampling/gp/GP_interface.py
josephhic/AutoDot
9acd0ddab9191b8a90afc6f1f6373cf711b40b89
[ "MIT" ]
7
2020-09-16T23:50:01.000Z
2022-01-29T13:31:35.000Z
Sampling/gp/GP_interface.py
josephhic/AutoDot
9acd0ddab9191b8a90afc6f1f6373cf711b40b89
[ "MIT" ]
1
2022-01-15T14:50:16.000Z
2022-01-15T14:50:16.000Z
Sampling/gp/GP_interface.py
josephhic/AutoDot
9acd0ddab9191b8a90afc6f1f6373cf711b40b89
[ "MIT" ]
6
2020-08-20T11:52:51.000Z
2021-03-12T08:04:35.000Z
import numpy as np class GPInterface(object): def __init__(self): self.kernel = None self.ndim = None self.model = None self.outdim = 1 def create_kernel(self, ndim, kernel_name, var_f=1.0, lengthscale=1.0): pass def create_model(self, x, y, noise_var, noise_prior): pass def predict_f(self, x, full_cov=False): pass def optimize(self, num_restarts=30, opt_messages=False, print_result=False): pass def convert_lengthscale(ndim, lengthscale): if np.isscalar(lengthscale): l = lengthscale * np.ones(ndim) else: l = lengthscale return l def convert_2D_format(arr): if not isinstance(arr, np.ndarray): raise ValueError('The array is not a numpy array.') if arr.ndim == 1: return arr[:, np.newaxis] # asuumes arr is single dimensional data if arr.ndim == 2: return arr else: raise ValueError('The array cannot be more than 2 dimensional')
25.2
80
0.630952
140
1,008
4.414286
0.485714
0.045307
0.038835
0.074434
0
0
0
0
0
0
0
0.015068
0.275794
1,008
39
81
25.846154
0.831507
0.037698
0
0.2
0
0
0.076525
0
0
0
0
0
0
1
0.233333
false
0.133333
0.033333
0
0.4
0.033333
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
2
02672df29fc9ebbd81a095528bf8daa18c15e598
588
py
Python
Python/powx-n.py
xtt129/LeetCode
1afa893d38e2fce68e4677b34169c0f0262b6fac
[ "MIT" ]
2
2020-04-08T17:57:43.000Z
2021-11-07T09:11:51.000Z
Python/powx-n.py
xtt129/LeetCode
1afa893d38e2fce68e4677b34169c0f0262b6fac
[ "MIT" ]
null
null
null
Python/powx-n.py
xtt129/LeetCode
1afa893d38e2fce68e4677b34169c0f0262b6fac
[ "MIT" ]
8
2018-03-13T18:20:26.000Z
2022-03-09T19:48:11.000Z
# Time: O(logn) # Space: O(logn) # # Implement pow(x, n). # class Solution: # @param x, a float # @param n, a integer # @return a float def pow(self, x, n): if n < 0: return 1 / self.powRecu(x, -n) return self.powRecu(x, n) def powRecu(self, x, n): if n == 0: return 1.0 if n % 2 == 0: return self.powRecu(x * x, n / 2) else: return x * self.powRecu(x * x, n / 2) if __name__ == "__main__": print Solution().pow(3, 5) print Solution().pow(3, -5)
21
49
0.464286
86
588
3.081395
0.325581
0.05283
0.181132
0.060377
0.377358
0.241509
0.128302
0.128302
0
0
0
0.036212
0.389456
588
28
50
21
0.70195
0.178571
0
0
0
0
0.016842
0
0
0
0
0
0
0
null
null
0
0
null
null
0.133333
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
0283a7352923af27fdd16711a1bde4c6fd11c4e8
1,568
py
Python
machine-learning-ex1/ex1/gradientDescent.py
xu1718191411/coursera-ml-py
a15fa53cd4c293587fa668661657b18ac95b5818
[ "MIT" ]
null
null
null
machine-learning-ex1/ex1/gradientDescent.py
xu1718191411/coursera-ml-py
a15fa53cd4c293587fa668661657b18ac95b5818
[ "MIT" ]
null
null
null
machine-learning-ex1/ex1/gradientDescent.py
xu1718191411/coursera-ml-py
a15fa53cd4c293587fa668661657b18ac95b5818
[ "MIT" ]
null
null
null
import numpy as np from computeCost import * def gradient_descent(X, y, theta, alpha, num_iters): # Initialize some useful values m = y.size J_history = np.zeros(num_iters) for i in range(0, num_iters): # ===================== Your Code Here ===================== # Instructions : Perform a single gradient step on the parameter vector theta # # Hint: X.shape = (97, 2), y.shape = (97, ), theta.shape = (2, ) m = np.dot(X, theta) k = m - y k = np.reshape(k,[-1,1]) ss = k * X jj = np.sum(ss,axis=0) gradient = jj / X.shape[0] theta = theta - alpha * gradient # =========================================================== # Save the cost every iteration J_history[i] = compute_cost(X, y, theta) return theta, J_history def gradient_descent_multi(X, y, theta, alpha, num_iters): # Initialize some useful values m = y.size J_history = np.zeros(num_iters) for i in range(0, num_iters): # ===================== Your Code Here ===================== # Instructions : Perform a single gradient step on the parameter vector theta s1 = np.dot(X,theta) - y s1 = np.reshape(s1,(-1,1)) s2 = s1 * X s3 = np.sum(s2,axis=0) s4 = s3 / m theta = theta - alpha * s4 # =========================================================== # Save the cost every iteration J_history[i] = compute_cost(X, y, theta) return theta, J_history
27.034483
85
0.487245
199
1,568
3.753769
0.321608
0.064257
0.037483
0.032129
0.645248
0.645248
0.645248
0.645248
0.645248
0.645248
0
0.022543
0.29273
1,568
58
86
27.034483
0.651037
0.364796
0
0.37037
0
0
0
0
0
0
0
0.017241
0
1
0.074074
false
0
0.074074
0
0.222222
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
2
65f3d2fc9acc37dc939b8937d190997de92ec79e
2,875
py
Python
tests/test_i18n.py
dcramer/jinja1-djangosupport
755287f155c18ccabe69f1318bacdaca14f55da3
[ "BSD-3-Clause" ]
2
2015-09-24T19:53:35.000Z
2015-11-06T10:47:02.000Z
tests/test_i18n.py
dcramer/jinja1-djangosupport
755287f155c18ccabe69f1318bacdaca14f55da3
[ "BSD-3-Clause" ]
null
null
null
tests/test_i18n.py
dcramer/jinja1-djangosupport
755287f155c18ccabe69f1318bacdaca14f55da3
[ "BSD-3-Clause" ]
null
null
null
# -*- coding: utf-8 -*- """ unit test for the i18n functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: 2007 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from jinja import Environment, DictLoader templates = { 'master.html': '<title>{{ page_title|default(_("missing")) }}</title>' '{% block body %}{% endblock %}', 'child.html': '{% extends "master.html" %}{% block body %}' '{% trans "watch out" %}{% endblock %}', 'plural.html': '{% trans user_count %}One user online{% pluralize %}' '{{ user_count }} users online{% endtrans %}', 'stringformat.html': '{{ _("User: %d")|format(user_count) }}' } languages = { 'de': { 'missing': 'fehlend', 'watch out': 'pass auf', 'One user online': 'Ein Benutzer online', '%(user_count)s users online': '%(user_count)s Benutzer online', 'User: %d': 'Benutzer: %d' } } class SimpleTranslator(object): """Yes i know it's only suitable for english and german but that's a stupid unittest...""" def __init__(self, language): self.strings = languages.get(language, {}) def gettext(self, string): return self.strings.get(string, string) def ngettext(self, s, p, n): if n != 1: return self.strings.get(p, p) return self.strings.get(s, s) class I18NEnvironment(Environment): def __init__(self): super(I18NEnvironment, self).__init__(loader=DictLoader(templates)) def get_translator(self, context): return SimpleTranslator(context['LANGUAGE'] or 'en') i18n_env = I18NEnvironment() def test_factory(): def factory(context): return SimpleTranslator(context['LANGUAGE'] or 'en') env = Environment(translator_factory=factory) tmpl = env.from_string('{% trans "watch out" %}') assert tmpl.render(LANGUAGE='de') == 'pass auf' def test_get_translations(): trans = list(i18n_env.get_translations('child.html')) assert len(trans) == 1 assert trans[0] == (1, u'watch out', None) def test_get_translations_for_string(): trans = list(i18n_env.get_translations('master.html')) assert len(trans) == 1 assert trans[0] == (1, u'missing', None) def test_trans(): tmpl = i18n_env.get_template('child.html') assert tmpl.render(LANGUAGE='de') == '<title>fehlend</title>pass auf' def test_trans_plural(): tmpl = i18n_env.get_template('plural.html') assert tmpl.render(LANGUAGE='de', user_count=1) == 'Ein Benutzer online' assert tmpl.render(LANGUAGE='de', user_count=2) == '2 Benutzer online' def test_trans_stringformatting(): tmpl = i18n_env.get_template('stringformat.html') assert tmpl.render(LANGUAGE='de', user_count=5) == 'Benutzer: 5'
30.263158
76
0.60487
339
2,875
4.985251
0.327434
0.042604
0.047337
0.071006
0.271598
0.21716
0.162722
0.085207
0.039053
0.039053
0
0.01675
0.231652
2,875
94
77
30.585106
0.748302
0.088696
0
0.068966
0
0
0.271357
0.03131
0
0
0
0
0.155172
1
0.206897
false
0.051724
0.017241
0.051724
0.344828
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
2
65f3f28d20e8dde9e8b89754fe8a9129f101d89e
453
py
Python
head_first/chapter1/beersong.py
adubois85/python_projects
e8794ed100e4fb2cbe89380c5d636ebdf954b33b
[ "Apache-2.0" ]
null
null
null
head_first/chapter1/beersong.py
adubois85/python_projects
e8794ed100e4fb2cbe89380c5d636ebdf954b33b
[ "Apache-2.0" ]
null
null
null
head_first/chapter1/beersong.py
adubois85/python_projects
e8794ed100e4fb2cbe89380c5d636ebdf954b33b
[ "Apache-2.0" ]
null
null
null
word = "bottles" for beer_num in range(99, 0, -1): print(beer_num, word, " of beer on the wall,") print(beer_num, word, " bottles of beer.") print("You take one down,") print("You pass it around,") if (beer_num == 1): print("No more bottles of beer on the wall.") else: new_num = beer_num - 1 if new_num == 1: word = "bottle" print(new_num, word, "of beer on the wall.") print()
26.647059
53
0.560706
71
453
3.464789
0.394366
0.142276
0.097561
0.134146
0.280488
0.219512
0.219512
0.219512
0
0
0
0.022222
0.304636
453
16
54
28.3125
0.75873
0
0
0
0
0
0.317881
0
0
0
0
0
0
1
0
false
0.071429
0
0
0
0.5
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
1
0
2
5a018c226ed71699c2113593043427fc368eae2c
1,730
py
Python
rlalgos/template_exp.py
ludc/rlstructures
99fa91bb4e955d31348bed007f25b41641c9fa73
[ "MIT" ]
null
null
null
rlalgos/template_exp.py
ludc/rlstructures
99fa91bb4e955d31348bed007f25b41641c9fa73
[ "MIT" ]
null
null
null
rlalgos/template_exp.py
ludc/rlstructures
99fa91bb4e955d31348bed007f25b41641c9fa73
[ "MIT" ]
null
null
null
# # 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 rlstructures.logger import Logger, TFLogger from rlstructures import DictTensor, TemporalDictTensor from rlstructures import logging from rlstructures.tools import weight_init import torch.nn as nn import copy import torch import time import numpy as np import torch.nn.functional as F class BaseExperiment: def __init__(self, config,create_env,create_agent): assert self.check_arguments(config) self.config = config self.logger = TFLogger(log_dir=self.config["logdir"], hps=self.config) self.batchers=[] self._create_env=create_env self._create_agent=create_agent def check_arguments(self,arguments): """ The function aims at checking that the arguments (provided in config) are the good ones """ return True def register_batcher(self,batcher): """ Register a new batcher when you create one, to ensure a correct closing of the experiment """ self.batchers.append(batcher) def _create_model(self): # self.learning_model = ...... raise NotImplementedError def create_model(self): self.learning_model = self._create_model() self.iteration = 0 def reset(self): raise NotImplementedError def run(self): raise NotImplementedError def terminate(self): for b in self.batchers: b.close() self.logger.close() def go(self): self.create_model() self.reset() self.run() self.terminate()
26.212121
97
0.67052
216
1,730
5.25463
0.444444
0.039648
0.052863
0.031718
0.061674
0.061674
0.061674
0
0
0
0
0.000773
0.252023
1,730
65
98
26.615385
0.876352
0.217341
0
0.075
0
0
0.004612
0
0
0
0
0
0.025
1
0.225
false
0
0.25
0
0.525
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
5a02faffb7cfa9fdb23adccb42a064f2f5db12ed
726
py
Python
src/azure-cli-core/azure/cli/core/_output.py
cmcclister/azure-cli
f30fa76380072da9754c222463ef20d28df5a8be
[ "MIT" ]
null
null
null
src/azure-cli-core/azure/cli/core/_output.py
cmcclister/azure-cli
f30fa76380072da9754c222463ef20d28df5a8be
[ "MIT" ]
3
2021-03-26T00:25:36.000Z
2022-03-29T22:03:55.000Z
src/azure-cli-core/azure/cli/core/_output.py
cmcclister/azure-cli
f30fa76380072da9754c222463ef20d28df5a8be
[ "MIT" ]
1
2020-07-13T22:28:09.000Z
2020-07-13T22:28:09.000Z
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- import knack.output class AzOutputProducer(knack.output.OutputProducer): def __init__(self, cli_ctx=None): super(AzOutputProducer, self).__init__(cli_ctx) super(AzOutputProducer, self)._FORMAT_DICT['yaml'] = self.format_yaml @staticmethod def format_yaml(obj): import yaml return yaml.safe_dump(obj.result, default_flow_style=False)
40.333333
94
0.548209
68
726
5.602941
0.661765
0.057743
0.131234
0
0
0
0
0
0
0
0
0
0.132231
726
17
95
42.705882
0.604762
0.46281
0
0
0
0
0.01039
0
0
0
0
0
0
1
0.222222
false
0
0.222222
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
5a03d7bbeabbca6708c7cac2090946c612d13f84
2,207
py
Python
game/data/scripts/village_master/9001_alliance/__init__.py
TheDemonLife/Lineage2Server-Interlude
d23d145db533fd899d4064026e4bc7ee45c6624a
[ "Apache-2.0" ]
10
2019-07-27T13:12:11.000Z
2022-01-15T19:13:26.000Z
game/data/scripts/village_master/9001_alliance/__init__.py
TheDemonLife/Lineage2Server-Interlude
d23d145db533fd899d4064026e4bc7ee45c6624a
[ "Apache-2.0" ]
1
2021-08-06T12:15:01.000Z
2021-08-09T10:18:47.000Z
game/data/scripts/village_master/9001_alliance/__init__.py
TheDemonLife/Lineage2Server-Interlude
d23d145db533fd899d4064026e4bc7ee45c6624a
[ "Apache-2.0" ]
2
2020-02-20T23:02:26.000Z
2020-11-22T09:27:51.000Z
# Created by DraX on 2005.08.12 # minor fixes by DrLecter 2005.09.10 import sys from ru.catssoftware.gameserver.model.quest import State from ru.catssoftware.gameserver.model.quest import QuestState from ru.catssoftware.gameserver.model.quest.jython import QuestJython as JQuest qn = "9001_alliance" NPC=[30026,30031,30037,30066,30070,30109,30115,30120,30154,30174,30175,30176,30187, \ 30191,30195,30288,30289,30290,30297,30358,30373,30462,30474,30498,30499,30500, \ 30503,30504,30505,30508,30511,30512,30513,30520,30525,30565,30594,30595,30676, \ 30677,30681,30685,30687,30689,30694,30699,30704,30845,30847,30849,30854,30857, \ 30862,30865,30894,30897,30900,30905,30910,30913,31269,31272,31276,31279,31285, \ 31288,31314,31317,31321,31324,31326,31328,31331,31334,31755,31958,31961,31965, \ 31968,31974,31977,31996,32092,32093,32094,32095,32096,32097,32098,32145,32146, \ 32147,32150,32153,32154,32157,32158,32160,32171,32191,32193,32196,32199,32202, \ 32205,32206,32209,32210,32213,32214,32217,32218,32221,32222,32225,32226,32229, \ 32230,32233,32234] class Quest (JQuest) : def onEvent (self,event,st): Clan = st.getPlayer().getClanId() htmltext = event if event == "9001-01.htm" : htmltext = "9001-01.htm" elif (Clan == 0): st.exitQuest(1); htmltext = "<html><body>You must be in Clan.</body></html"; elif event == "9001-02.htm" : htmltext = "9001-02.htm" return htmltext def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr) def onTalk (Self,npc,player): st = player.getQuestState(qn) npcId = npc.getNpcId() ClanLeader = st.getPlayer().getClan() Clan = st.getPlayer().getClanId() if npcId in NPC and Clan == 0 : st.set("cond","0") st.setState(State.STARTED) htmltext = "9001-01a.htm" elif npcId in NPC and ClanLeader.getAllyId() == 0 : st.set("cond","0") st.setState(State.STARTED) htmltext = "9001-01a.htm" else : st.set("cond","0") st.setState(State.STARTED) htmltext = "9001-01.htm" return htmltext QUEST = Quest(9001,qn,"village_master") for item in NPC: QUEST.addStartNpc(item) QUEST.addTalkId(item)
36.783333
85
0.696874
319
2,207
4.789969
0.626959
0.01178
0.03534
0.054974
0.20288
0.17801
0.153141
0.09555
0.09555
0.09555
0
0.360278
0.153602
2,207
60
86
36.783333
0.457709
0.028999
0
0.28
0
0
0.077534
0
0
0
0
0
0
1
0.06
false
0
0.08
0
0.2
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
5a0dbfd851766ed88650e0e8928d7b20b25f1525
6,571
py
Python
articles/views.py
shobhit10058/newspaper-app
091d4410b649a8acef8076be779f136a7366046c
[ "MIT" ]
null
null
null
articles/views.py
shobhit10058/newspaper-app
091d4410b649a8acef8076be779f136a7366046c
[ "MIT" ]
null
null
null
articles/views.py
shobhit10058/newspaper-app
091d4410b649a8acef8076be779f136a7366046c
[ "MIT" ]
null
null
null
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin from django.views.generic import ListView, DetailView from django.views.generic.edit import UpdateView, DeleteView, CreateView from django.urls import reverse_lazy from django.template.loader import render_to_string from .forms import ArticleForm from django.http import JsonResponse from .models import Article, Comment from social_django.models import UserSocialAuth from django.contrib.auth.decorators import login_required from django.contrib.auth.forms import AdminPasswordChangeForm, PasswordChangeForm from django.contrib.auth import update_session_auth_hash from django.contrib import messages from django.shortcuts import render, redirect, get_object_or_404 import django_tables2 as table from import_export import resources from export_download.views import ResourceDownloadMixin import django_filters from django.http import HttpResponse from .resources import ArticleResource def export_json(request): article_resource = ArticleResource() articles = article_resource.export() response = HttpResponse(articles.json, content_type='application/json') response['Content-Disposition'] = 'attachment; filename="articles.json"' return response def export_csv(request): article_resource = ArticleResource() articles = article_resource.export() response = HttpResponse(articles.xls, content_type='application/vnd.ms-excel') response['Content-Disposition'] = 'attachment; filename="articles.xls"' return response def export_my_csv(request): article_resource = ArticleResource() queryset = Article.objects.filter(author=request.user) my_articles = article_resource.export(queryset) response = HttpResponse(my_articles.xls, content_type='application/vnd.ms-excel') response['Content-Disposition'] = 'attachment; filename="my_articles.xls"' return response def export_my_json(request): article_resource = ArticleResource() queryset = Article.objects.filter(author=request.user) my_articles = article_resource.export(queryset) response = HttpResponse(my_articles.json, content_type='application/json') response['Content-Disposition'] = 'attachment; filename="my_articles.json"' return response @login_required def home(request): return render(request, 'templates/index.html') @login_required def settings(request): user = request.user try: github_login = user.social_auth.get(provider='github') except UserSocialAuth.DoesNotExist: github_login = None try: google_login = user.social_auth.get(provider='google') except UserSocialAuth.DoesNotExist: google_login = None try: facebook_login = user.social_auth.get(provider='facebook') except UserSocialAuth.DoesNotExist: facebook_login = None can_disconnect = (user.social_auth.count() > 1 or user.has_usable_password()) return render(request, 'templates/settings.html', { 'github_login': github_login, 'google_login': google_login, 'facebook_login': facebook_login, 'can_disconnect': can_disconnect }) @login_required def password(request): if request.user.has_usable_password(): PasswordForm = PasswordChangeForm else: PasswordForm = AdminPasswordChangeForm if request.method == 'POST': form = PasswordForm(request.user, request.POST) if form.is_valid(): form.save() update_session_auth_hash(request, form.user) messages.success(request, 'Your password was successfully updated!') return redirect('password') else: messages.error(request, 'Please correct the error below.') else: form = PasswordForm(request.user) return render(request, 'templates/password.html', {'form': form}) class ArticleListView(ResourceDownloadMixin, LoginRequiredMixin, ListView, table.SingleTableMixin): model = Article template_name = 'article_list.html' login_url = 'login' paginate_by = 5 ordering = ['-updated'] class MyArticleListView(LoginRequiredMixin, ListView): model = Article template_name = 'my_articles.html' login_url = 'login' paginate_by = 5 ordering = ['-updated'] def get_queryset(self): return Article.objects.filter(author=self.request.user) class ArticleDetailView(LoginRequiredMixin, DetailView): model = Article template_name = 'article_detail.html' login_url = 'login' class ArticleUpdateView(LoginRequiredMixin, UserPassesTestMixin, UpdateView): model = Article form_class = ArticleForm template_name = 'article_edit.html' success_url = reverse_lazy('article_list') login_url = 'login' def test_func(self): obj = self.get_object() return obj.author == self.request.user class ArticleDeleteView(LoginRequiredMixin, UserPassesTestMixin, DeleteView): model = Article template_name = 'article_delete.html' success_url = reverse_lazy('article_list') login_url = 'login' def test_func(self): obj = self.get_object() return obj.author == self.request.user class ArticleCreateView(LoginRequiredMixin, CreateView): model = Article form_class = ArticleForm template_name = 'article_new.html' success_url = reverse_lazy('article_list') login_url = 'login' def form_valid(self, form): form.instance.author = self.request.user return super().form_valid(form) class CommentCreateView(LoginRequiredMixin, CreateView): model = Comment template_name = 'Comment_new.html' fields = ('article', 'comment') login_url = 'login' def form_valid(self, form): form.instance.author = self.request.user return super().form_valid(form) class CommentListView(LoginRequiredMixin, DetailView): model = Article template_name = 'comment_list.html' login_url = 'login' def search_view(request): ctx = {} url_parameter = request.GET.get("q") if url_parameter: articles = Article.objects.filter(title__icontains=url_parameter) else: articles = Article.objects.all() ctx["articles"] = articles if request.is_ajax(): html = render_to_string( template_name="articles-results-partial.html", context={"articles": articles} ) data_dict = {"html_from_view": html} return JsonResponse(data=data_dict, safe=False) return render(request, "article_search.html", context=ctx)
31.14218
99
0.723939
730
6,571
6.338356
0.226027
0.025935
0.022477
0.025935
0.401988
0.373028
0.329371
0.311217
0.289172
0.270586
0
0.001303
0.182468
6,571
210
100
31.290476
0.860015
0
0
0.391304
0
0
0.129356
0.033937
0
0
0
0
0
1
0.080745
false
0.086957
0.124224
0.012422
0.559006
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
2
5a16647872c09dc7ae15c2cf3b39dcb31bef693f
186
py
Python
testData/typeinspection/ignoreInitArguments.py
alek-sun/pydantic-pycharm-plugin
6b07519aadf0ff8b8a644c1f9ede88e09c687c80
[ "Apache-2.0", "MIT" ]
238
2019-08-05T12:46:09.000Z
2022-03-25T08:53:25.000Z
testData/typeinspection/ignoreInitArguments.py
alek-sun/pydantic-pycharm-plugin
6b07519aadf0ff8b8a644c1f9ede88e09c687c80
[ "Apache-2.0", "MIT" ]
415
2019-07-15T17:39:35.000Z
2022-03-31T01:18:38.000Z
testData/typeinspection/ignoreInitArguments.py
KotlinIsland/pydantic-pycharm-plugin
6a20563c3a174931ff49759c713c7fa609a82abb
[ "Apache-2.0", "MIT" ]
7
2019-08-09T01:03:16.000Z
2022-02-08T03:28:19.000Z
from pydantic import BaseModel class A(BaseModel): a: int def __init__(self, xyz: str): super().__init__(a=xyz) A(xyz=123<warning descr="null">)</warning> A(a=123)
13.285714
42
0.639785
28
186
3.964286
0.607143
0.072072
0
0
0
0
0
0
0
0
0
0.040541
0.204301
186
14
43
13.285714
0.709459
0
0
0
0
0
0.021622
0
0
0
0
0
0
0
null
null
0
0.142857
null
null
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
5a2084cc818ba788f37f330b29ff87430a63cdb3
2,505
py
Python
backend/apollo/elections/migrations/0001_initial.py
heidal/apollo
576743e12048985ae8ef127224e1cb8ac49acd28
[ "MIT" ]
2
2020-02-28T16:24:55.000Z
2020-03-27T17:12:50.000Z
backend/apollo/elections/migrations/0001_initial.py
heidal/apollo
576743e12048985ae8ef127224e1cb8ac49acd28
[ "MIT" ]
51
2020-02-12T20:52:08.000Z
2022-02-27T00:23:20.000Z
backend/apollo/elections/migrations/0001_initial.py
heidal/apollo
576743e12048985ae8ef127224e1cb8ac49acd28
[ "MIT" ]
null
null
null
# Generated by Django 3.0.4 on 2020-03-25 18:37 from django.db import migrations, models import django.db.models.deletion from typing import List, Tuple class Migration(migrations.Migration): initial = True dependencies: List[Tuple[str, str]] = [] operations = [ migrations.CreateModel( name="Election", fields=[ ( "id", models.AutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("created_at", models.DateTimeField(auto_now_add=True)), ("description", models.TextField()), ("title", models.CharField(max_length=200)), ], options={"ordering": ["created_at"],}, ), migrations.CreateModel( name="Question", fields=[ ( "id", models.AutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("question", models.CharField(max_length=200)), ( "election", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name="questions", to="elections.Election", ), ), ], ), migrations.CreateModel( name="Answer", fields=[ ( "id", models.AutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("text", models.CharField(max_length=200)), ("votes", models.IntegerField(default=0)), ( "question", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name="answers", to="elections.Question", ), ), ], ), ]
30.925926
72
0.389222
167
2,505
5.718563
0.407186
0.033508
0.043979
0.06911
0.467016
0.382199
0.382199
0.382199
0.382199
0.382199
0
0.020475
0.512575
2,505
80
73
31.3125
0.761671
0.017964
0
0.60274
1
0
0.066314
0
0
0
0
0
0
1
0
false
0
0.041096
0
0.09589
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
5a43781b64d44b06444ed477a16b17323815027e
114,239
py
Python
pysnmp-with-texts/AtiL2-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
8
2019-05-09T17:04:00.000Z
2021-06-09T06:50:51.000Z
pysnmp-with-texts/AtiL2-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
4
2019-05-31T16:42:59.000Z
2020-01-31T21:57:17.000Z
pysnmp-with-texts/AtiL2-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
10
2019-04-30T05:51:36.000Z
2022-02-16T03:33:41.000Z
# # PySNMP MIB module AtiL2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/AtiL2-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:33:22 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, ValueRangeConstraint, ConstraintsIntersection, ConstraintsUnion, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsIntersection", "ConstraintsUnion", "SingleValueConstraint") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") enterprises, Counter32, ModuleIdentity, iso, TimeTicks, IpAddress, Integer32, Counter64, MibIdentifier, NotificationType, Gauge32, Bits, Unsigned32, ObjectIdentity, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "enterprises", "Counter32", "ModuleIdentity", "iso", "TimeTicks", "IpAddress", "Integer32", "Counter64", "MibIdentifier", "NotificationType", "Gauge32", "Bits", "Unsigned32", "ObjectIdentity", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") class MacAddress(OctetString): subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(6, 6) fixedLength = 6 class BridgeId(OctetString): subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(8, 8) fixedLength = 8 class Timeout(Integer32): pass alliedTelesyn = MibIdentifier((1, 3, 6, 1, 4, 1, 207)) atiProduct = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 1)) swhub = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 1, 4)) at_8324 = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 1, 4, 37)).setLabel("at-8324") at_8124XL_V2 = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 1, 4, 52)).setLabel("at-8124XL-V2") at_8326GB = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 1, 4, 72)).setLabel("at-8326GB") at_9410GB = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 1, 4, 73)).setLabel("at-9410GB") at_8350GB = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 1, 4, 74)).setLabel("at-8350GB") at_8316F = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 1, 4, 77)).setLabel("at-8316F") mibObject = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 8)) atiL2Mib = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 8, 33)) atiL2GlobalGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 8, 33, 1)) atiL2IpGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 8, 33, 2)) atiL2NMGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 8, 33, 3)) atiL2DHCPGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 8, 33, 4)) atiL2DeviceGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 8, 33, 5)) atiL2EthernetStatsGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 8, 33, 6)) atiL2DevicePortConfigGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 8, 33, 7)) atiL2VlanConfigGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 8, 33, 8)) atiL2IfExt = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 8, 33, 9)) atiL2BridgeMib = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 8, 33, 10)) atiL2BrBase = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 1)) atiL2BrStp = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2)) atiL2BrTp = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 3)) atiL2TrapAttrGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 8, 33, 11)) atiL2QOSConfigGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 8, 33, 12)) atiL2SwProduct = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2SwProduct.setStatus('mandatory') if mibBuilder.loadTexts: atiL2SwProduct.setDescription('Identifies the software product the device is running.') atiL2SwVersion = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2SwVersion.setStatus('mandatory') if mibBuilder.loadTexts: atiL2SwVersion.setDescription(' Identifies the version number of the present release.') atiL2Reset = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("switch-no-reset", 1), ("switch-reset", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2Reset.setStatus('mandatory') if mibBuilder.loadTexts: atiL2Reset.setDescription(' Object use to reset all the Modules globally.') atiL2MirroringSourceModule = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 1, 4), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2MirroringSourceModule.setStatus('mandatory') if mibBuilder.loadTexts: atiL2MirroringSourceModule.setDescription(" This is the mirror source module number. If the atiL2EthConfigMirrorState is Enabled then the mirror source module/port data gets routed to the mirror destination module/port. Both transmitted and recieved source activity is mirrored to the destination. This arrangement is to put an RMON Probe on the destination port to probe the traffic on the Source port. This object will return a '0' if the MirrorState is not enabled.") atiL2MirroringSourcePort = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 1, 5), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2MirroringSourcePort.setStatus('mandatory') if mibBuilder.loadTexts: atiL2MirroringSourcePort.setDescription(" This is the Source port number for which there is another mirror port.If the atiL2EthConfigMirrorState is Enabled then the mirror portgets routed with all the packets going in and out of Source port. This arrangement is to put an RMON Probe on mirrored port to Probe the traffic on the Source port. One of the port is dedicated to this so that for any port as source port, this dedicated port can be a mirrored port. This object will return a '0' if the MirrorState is not enabled.") atiL2MirroringDestinationModule = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 1, 6), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2MirroringDestinationModule.setStatus('mandatory') if mibBuilder.loadTexts: atiL2MirroringDestinationModule.setDescription(" This is the mirror destination module number. If the atiL2EthConfigMirrorState is Enabled then the mirror source module/port data gets routed to the mirror destination module/port. Both transmitted and recieved source activity is mirrored to the destination. This arrangement is to put an RMON Probe on the destination port to probe the traffic on the Source port. This object will return a '0' if the MirrorState is not enabled.") atiL2MirroringDestinationPort = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 1, 7), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2MirroringDestinationPort.setStatus('mandatory') if mibBuilder.loadTexts: atiL2MirroringDestinationPort.setDescription(" This is the Destination port number for which there is another mirror port.If the atiL2EthConfigMirrorState is Enabled then,the mirror portgets routed with all the packets going in and out of Destination port. This arrangement is to put an RMON Probe on mirrored port to Probe the traffic on the Destination port. One of the port is dedicated to this so that for any port as destination port, this dedicated port can be a mirrored port. This object will return a '0' if the MirrorState is not enabled.") atiL2MirrorState = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("receive-and-transmit", 1), ("disabled", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2MirrorState.setStatus('mandatory') if mibBuilder.loadTexts: atiL2MirrorState.setDescription(' if the state of Mirroring is enabled by selecting one of the two values , then the Mirroring explained above works. If disabled, port operation works normally. No Traffic gets routed from MirroringSourcePort to Destination Mirrored Port.') atiL2IGMPState = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2IGMPState.setStatus('mandatory') if mibBuilder.loadTexts: atiL2IGMPState.setDescription('This attribute allows an administrative request to configure IGMP') atiL2DeviceNumber = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 1, 10), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2DeviceNumber.setStatus('mandatory') if mibBuilder.loadTexts: atiL2DeviceNumber.setDescription('The total number of devices in the stack.') atiL2CurrentIpAddress = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 2, 1), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2CurrentIpAddress.setStatus('mandatory') if mibBuilder.loadTexts: atiL2CurrentIpAddress.setDescription(' The Current IP address is the one which is currently used and is obtained dynamically through one of the protocols interaction.( DHCP or Bootp.) This address is NULL if the Address is Statically configured.') atiL2ConfiguredIpAddress = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 2, 2), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2ConfiguredIpAddress.setStatus('mandatory') if mibBuilder.loadTexts: atiL2ConfiguredIpAddress.setDescription(' The Configured IP address of the device. This is the address configured through Network or Local Omega. ') atiL2ConfiguredSubnetMask = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 2, 3), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2ConfiguredSubnetMask.setStatus('mandatory') if mibBuilder.loadTexts: atiL2ConfiguredSubnetMask.setDescription(' The Configured Subnet Mask of the device.') atiL2ConfiguredRouter = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 2, 4), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2ConfiguredRouter.setStatus('mandatory') if mibBuilder.loadTexts: atiL2ConfiguredRouter.setDescription(' The Configured Gateway/Router address of the device') atiL2IPAddressStatus = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 2, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("from-dhcp", 1), ("from-bootp", 2), ("from-psuedoip", 3), ("from-Omega", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2IPAddressStatus.setStatus('mandatory') if mibBuilder.loadTexts: atiL2IPAddressStatus.setDescription(' The IP Address can be obtained/configured by any of the above different ways. This object specifies how IP address currently on the switch Box, was configured/obtained.') atiL2DNServer = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 2, 6), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2DNServer.setStatus('mandatory') if mibBuilder.loadTexts: atiL2DNServer.setDescription(' The Configured DNS Server address of the device') atiL2DefaultDomainName = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 2, 7), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2DefaultDomainName.setStatus('mandatory') if mibBuilder.loadTexts: atiL2DefaultDomainName.setDescription(' This Object defines the Default Domain where this switch can be belong to.') atiL2NwMgrTable = MibTable((1, 3, 6, 1, 4, 1, 207, 8, 33, 3, 1), ) if mibBuilder.loadTexts: atiL2NwMgrTable.setStatus('mandatory') if mibBuilder.loadTexts: atiL2NwMgrTable.setDescription('A list of SNMP Trap Manager stations Entries. The number of entries is given by the switchNwMgrTotal mib object.') atiL2NwMgrEntry = MibTableRow((1, 3, 6, 1, 4, 1, 207, 8, 33, 3, 1, 1), ).setIndexNames((0, "AtiL2-MIB", "atiL2NwMgrIndex")) if mibBuilder.loadTexts: atiL2NwMgrEntry.setStatus('mandatory') if mibBuilder.loadTexts: atiL2NwMgrEntry.setDescription("Trap receipt Manager Entry containing ipaddress of the configured NMS's to which Traps are sent.") atiL2NwMgrIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 3, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 4))).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2NwMgrIndex.setStatus('mandatory') if mibBuilder.loadTexts: atiL2NwMgrIndex.setDescription('The Index of the Managers Ip address.') atiL2NwMgrIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 3, 1, 1, 2), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2NwMgrIpAddr.setStatus('mandatory') if mibBuilder.loadTexts: atiL2NwMgrIpAddr.setDescription('The IP Address of the NMS host configured.') atiL2DHCPSysGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 8, 33, 4, 1)) atiL2DHCPTimerGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 8, 33, 4, 2)) atiL2DHCPCurrentDHCPClientAddress = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 4, 1, 1), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2DHCPCurrentDHCPClientAddress.setStatus('mandatory') if mibBuilder.loadTexts: atiL2DHCPCurrentDHCPClientAddress.setDescription('Current IP address of the client. To start with,it might be null. This is filled by the server when sending a DHCPOFFER and the client uses the most comfortable offer from offers sent by different DHCP servers. A DHCPREQUEST packet is sent with the Client address agreed upon to the selected server ( Broadcast). Server Acks back this packet which is where Client/Server moves to the Bound state. Once reached into Bound state, the client address is made the official address on the client.') atiL2DHCPSubnetMask = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 4, 1, 2), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2DHCPSubnetMask.setStatus('mandatory') if mibBuilder.loadTexts: atiL2DHCPSubnetMask.setDescription('When the client/server reaches the BOUND state, this is one of the parameters set by the server.') atiL2DHCPCurrentRelayAgentAddress = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 4, 1, 3), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2DHCPCurrentRelayAgentAddress.setStatus('mandatory') if mibBuilder.loadTexts: atiL2DHCPCurrentRelayAgentAddress.setDescription('The IP address of the DHCP relay Agent on the same subnet. Normally there will be no DHCP server on each of the subnet and this Relay Agent will act in sending server across the subnets. There might not be any relay agent. This depends on the network Toplogy like where is the DHCP server and DHCP client.') atiL2DHCPNextDHCPServerAddress = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 4, 1, 4), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2DHCPNextDHCPServerAddress.setStatus('mandatory') if mibBuilder.loadTexts: atiL2DHCPNextDHCPServerAddress.setDescription('The IP address of the next DHCP server to be used during bootstrap. This address is sent by the DHCP server in the messages DHCPOFFER, DHCPACK,DHCPNACK.') atiL2DHCPLeaseTimer = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 4, 2, 1), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2DHCPLeaseTimer.setStatus('mandatory') if mibBuilder.loadTexts: atiL2DHCPLeaseTimer.setDescription('When the client/server reaches the BOUND state, this is one of the parameters set by the server. The lease time period in seconds for the DHCP client for using IP address on lease from the server. At the end of 50% of this timer a renewal request is sent by the client . This is the next Object atiL2DHCPReacquisitionTimer.') atiL2DHCPReacquisitionTimer = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 4, 2, 2), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2DHCPReacquisitionTimer.setStatus('mandatory') if mibBuilder.loadTexts: atiL2DHCPReacquisitionTimer.setDescription("When the client/server reaches the BOUND state, this is one of the parameters set by the server. Mentioned in RFC2131 4.4.5 as T1, this renewal time period in secs for the DHCP client is for using IP address on lease from the server Once the Reacquisition Timer period in secs after the lease period is reached, the client sends a DHCPREQUEST to the DHCP server requesting for renewal of the lease. Default would be 50% of the Lease timer which is represeneted by the above object. The client moves from BOUND to RENEW state once the DHCPREQUEST is sent after time T1 secs is passed from the start of to release time. T1 is always less than T2 ( see below for 'T2') which is less than the lease Timer period.") atiL2DHCPExpirationTimer = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 4, 2, 3), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2DHCPExpirationTimer.setStatus('mandatory') if mibBuilder.loadTexts: atiL2DHCPExpirationTimer.setDescription('When the client/server reaches the BOUND state, this is one of the parameters set by the server. Mentioned in RFC2131 4.4.5 as T2,this Expiration time period in secs is the time period in secs during which DHCP has gone through the BOUND->RENEWAL state. After T1 secs and when the state machine reaches T2 secs, ( T1 < T2 < lease period), DHCP client sends another DHCPREQUEST to the server asking the server to renew the lease for the IP parameters. By default it would be 87.5% of the Lease timer .If there is DHCPACK then the DHCP client moves from REBIND to BOUND. Else it moves to INIT state where it starts all over again sending a request for DHCPDISCOVER.') atiL2deviceTable = MibTable((1, 3, 6, 1, 4, 1, 207, 8, 33, 5, 1), ) if mibBuilder.loadTexts: atiL2deviceTable.setStatus('mandatory') if mibBuilder.loadTexts: atiL2deviceTable.setDescription('The table contains the mapping of all devices in the chassis.') atiL2deviceEntry = MibTableRow((1, 3, 6, 1, 4, 1, 207, 8, 33, 5, 1, 1), ).setIndexNames((0, "AtiL2-MIB", "atiL2deviceIndex")) if mibBuilder.loadTexts: atiL2deviceEntry.setStatus('mandatory') if mibBuilder.loadTexts: atiL2deviceEntry.setDescription('The device entry in the DeviceTable.') atiL2deviceIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 5, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 8))).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2deviceIndex.setStatus('mandatory') if mibBuilder.loadTexts: atiL2deviceIndex.setDescription('The Slot number in the chassis where the device is installed.') atiL2deviceDescr = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 5, 1, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2deviceDescr.setStatus('mandatory') if mibBuilder.loadTexts: atiL2deviceDescr.setDescription('A textual description of the device.') atiL2deviceProductType = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 5, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 20))).clone(namedValues=NamedValues(("at-8324", 1), ("at-8316F", 2), ("at-8124XL-V2", 3), ("at-8326GB", 4), ("at-9410GB", 5), ("at-8350GB", 6), ("other", 20)))).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2deviceProductType.setStatus('mandatory') if mibBuilder.loadTexts: atiL2deviceProductType.setDescription('This object will return Product Type.') atiL2devicePortCount = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 5, 1, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1024))).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2devicePortCount.setStatus('mandatory') if mibBuilder.loadTexts: atiL2devicePortCount.setDescription('The number of ports contained within the device. Valid range is 1-32. Within each device, the ports are uniquely numbered in the range from 1 to maxportCapacity.') atiL2deviceSecurityConfig = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 5, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("disabled", 1), ("enabled-with-learning-locked", 2), ("limited-enabled", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2deviceSecurityConfig.setStatus('mandatory') if mibBuilder.loadTexts: atiL2deviceSecurityConfig.setDescription('Security feature configuration Object.The Security disable would let the device carry on the learn-new-address-as-it-comes-in mode as usual.When security is enabled-with-learning-locked, the learning of new address is stopped and the addresses locked in the device is used as the security Database. If an address comes in which is not present in the Device Security Database, then any of the atiL2SecurityAction Configured is triggered. When limited-enabled is selected, a per-port atiL2PortSecurityNumberOfAddresses specify the max number of MACs to be learned.') atiL2deviceSecurityAction = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 5, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("send-trap-only", 1), ("disable-port-only", 2), ("disable-port-and-send-trap", 3), ("do-nothing", 4)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2deviceSecurityAction.setStatus('mandatory') if mibBuilder.loadTexts: atiL2deviceSecurityAction.setDescription('Security Action to be carried when the atiL2SecurityConfig is enabled-with-learning-locked or limted-enabled.') atiL2deviceDebugAvailableBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 5, 1, 1, 8), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2deviceDebugAvailableBytes.setStatus('mandatory') if mibBuilder.loadTexts: atiL2deviceDebugAvailableBytes.setDescription('This is strictly for Debug reason and this object should not be believed as the correct number.') atiL2deviceMDA1Type = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 5, 1, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("ten-100rj45-mii", 1), ("hundredfiber-mii", 2), ("oneGb-rj45", 3), ("oneGb-Fiber", 4), ("none", 5)))).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2deviceMDA1Type.setStatus('mandatory') if mibBuilder.loadTexts: atiL2deviceMDA1Type.setDescription("This object returns the MDA type of the Uplink port. The values of 1 and 2 are the only one present in 81XX. 82XX has all the values supported. This object returns the MDA type of the Uplink Port named 'A'. It returns 'none' if a 'A' MDA slot is not installed.") atiL2deviceMDA2Type = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 5, 1, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("ten-100rj45-mii", 1), ("hundredfiber-mii", 2), ("oneGb-rj45", 3), ("oneGb-Fiber", 4), ("none", 5)))).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2deviceMDA2Type.setStatus('mandatory') if mibBuilder.loadTexts: atiL2deviceMDA2Type.setDescription("This Object is supported in 81XX 82XX product lines. The values of 1 and 2 are the only one present in 81XX. 82XX has all the values supported. This object returns the MDA type of the Uplink Port named 'B'. It returns 'none' if a 'B' MDA slot is not installed.") atiL2deviceReset = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 5, 1, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("switch-no-reset", 1), ("switch-reset", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2deviceReset.setStatus('mandatory') if mibBuilder.loadTexts: atiL2deviceReset.setDescription("Setting this object to 'switch-reset' will cause the switch to perform a hardware reset within approximately 4-6 seconds. Setting this object to 'switch-no-reset will have no effect. The value 'no-reset' will be returned whenever this object is retrieved.") atiL2EthMonStatsGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 1)) atiL2EthErrStatsGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 2)) atiL2EthMonStatsTable = MibTable((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 1, 1), ) if mibBuilder.loadTexts: atiL2EthMonStatsTable.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthMonStatsTable.setDescription('A list of statistics entries.') atiL2EthMonStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 1, 1, 1), ).setIndexNames((0, "AtiL2-MIB", "atiL2EthMonModuleId")) if mibBuilder.loadTexts: atiL2EthMonStatsEntry.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthMonStatsEntry.setDescription('A collection of statistics kept for a particular port.') atiL2EthMonModuleId = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 1, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthMonModuleId.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthMonModuleId.setDescription('This Object Identifies the Module Id for which the Statistics is collected.') atiL2EthMonRxGoodFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 1, 1, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthMonRxGoodFrames.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthMonRxGoodFrames.setDescription('The total number of Good Frames received on this module.') atiL2EthMonTxGoodFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 1, 1, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthMonTxGoodFrames.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthMonTxGoodFrames.setDescription('The total number of Good Frames Transmitted by this module.') atiL2EthMonTxTotalBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 1, 1, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthMonTxTotalBytes.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthMonTxTotalBytes.setDescription('The total number of Bytes transmitted from this module.') atiL2EthMonTxDeferred = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 1, 1, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthMonTxDeferred.setStatus('deprecated') if mibBuilder.loadTexts: atiL2EthMonTxDeferred.setDescription('This is the count of first time Transmission attempt which failed on an interface due to medium being busy.') atiL2EthMonTxCollisions = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 1, 1, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthMonTxCollisions.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthMonTxCollisions.setDescription('The total number of collisions while switching on an interface.') atiL2EthMonTxBroadcastFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 1, 1, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthMonTxBroadcastFrames.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthMonTxBroadcastFrames.setDescription('The total number of Transmit Broadcast Frames while switching on an interface.') atiL2EthMonTxMulticastFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 1, 1, 1, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthMonTxMulticastFrames.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthMonTxMulticastFrames.setDescription('The total number of Transmit Multicast while switching on an interface.') atiL2EthMonRxOverruns = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 1, 1, 1, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthMonRxOverruns.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthMonRxOverruns.setDescription('The total number of Recieved Overrun Frames while switching on an interface.') atiL2EthPortMonStatsTable = MibTable((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 1, 2), ) if mibBuilder.loadTexts: atiL2EthPortMonStatsTable.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthPortMonStatsTable.setDescription('A list of statistics entries per Port on a Module.') atiL2EthPortMonStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 1, 2, 1), ).setIndexNames((0, "AtiL2-MIB", "atiL2EthPortMonModuleId"), (0, "AtiL2-MIB", "atiL2EthPortMonPortId")) if mibBuilder.loadTexts: atiL2EthPortMonStatsEntry.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthPortMonStatsEntry.setDescription('A collection of statistics kept for a particular port.') atiL2EthPortMonModuleId = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 1, 2, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthPortMonModuleId.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthPortMonModuleId.setDescription('This Object Identifies the Module Id for which the Statistics is collected.') atiL2EthPortMonPortId = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 1, 2, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthPortMonPortId.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthPortMonPortId.setDescription('This Object Identifies the Port on the Module recognised by EthMonPortModuleId for which the Statistics is collected.') atiL2EthPortMonRxGoodFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 1, 2, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthPortMonRxGoodFrames.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthPortMonRxGoodFrames.setDescription('The total number of Good Frames received on this module.') atiL2EthPortMonTxGoodFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 1, 2, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthPortMonTxGoodFrames.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthPortMonTxGoodFrames.setDescription('The total number of Good Frames Transmitted by this module.') atiL2EthPortMonTxTotalBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 1, 2, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthPortMonTxTotalBytes.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthPortMonTxTotalBytes.setDescription('The total number of Bytes transmitted from this module.') atiL2EthPortMonTxDeferred = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 1, 2, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthPortMonTxDeferred.setStatus('deprecated') if mibBuilder.loadTexts: atiL2EthPortMonTxDeferred.setDescription('This is the count of first time Transmission attempt which failed on an interface due to medium being busy.') atiL2EthPortMonTxCollisions = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 1, 2, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthPortMonTxCollisions.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthPortMonTxCollisions.setDescription('The total number of collisions while switching on an interface.') atiL2EthPortMonTxBroadcastFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 1, 2, 1, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthPortMonTxBroadcastFrames.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthPortMonTxBroadcastFrames.setDescription('The total number of Transmit Broadcast Frames on this port and Module while switching on an interface.') atiL2EthPortMonTxMulticastFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 1, 2, 1, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthPortMonTxMulticastFrames.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthPortMonTxMulticastFrames.setDescription('The total number of Transmit Multicast on this port and Module while switching on an interface.') atiL2EthPortMonRxOverruns = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 1, 2, 1, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthPortMonRxOverruns.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthPortMonRxOverruns.setDescription('The total number of Recieved Overrun Frames on this port and Module while switching on an interface.') atiL2EthErrStatsTable = MibTable((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 2, 1), ) if mibBuilder.loadTexts: atiL2EthErrStatsTable.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthErrStatsTable.setDescription('A list of statistics entries.') atiL2EthErrorStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 2, 1, 1), ).setIndexNames((0, "AtiL2-MIB", "atiL2EthErrModuleId")) if mibBuilder.loadTexts: atiL2EthErrorStatsEntry.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthErrorStatsEntry.setDescription('A collection of statistics kept for a particular port.') atiL2EthErrModuleId = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 2, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthErrModuleId.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthErrModuleId.setDescription('This Object Identifies the Module Id for which the Statistics is collected.') atiL2EthErrorCRC = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 2, 1, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthErrorCRC.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthErrorCRC.setDescription('The total number of CRC errors on received packets.') atiL2EthErrorAlignment = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 2, 1, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthErrorAlignment.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthErrorAlignment.setDescription('The total number of packets received that has alignment errors.') atiL2EthErrorRxBadFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 2, 1, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthErrorRxBadFrames.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthErrorRxBadFrames.setDescription('The counter is incremented when a bad frame was received.') atiL2EthErrorLateCollisions = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 2, 1, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthErrorLateCollisions.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthErrorLateCollisions.setDescription('This object counts the number of times the collison was detected in the port.') atiL2EthErrorTxTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 2, 1, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthErrorTxTotal.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthErrorTxTotal.setDescription('Total number of error resulted from transfer operations.') atiL2EthPortErrStatsTable = MibTable((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 2, 2), ) if mibBuilder.loadTexts: atiL2EthPortErrStatsTable.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthPortErrStatsTable.setDescription('A list of statistics entries.') atiL2EthPortErrorStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 2, 2, 1), ).setIndexNames((0, "AtiL2-MIB", "atiL2EthPortErrModuleId"), (0, "AtiL2-MIB", "atiL2EthPortErrPortId")) if mibBuilder.loadTexts: atiL2EthPortErrorStatsEntry.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthPortErrorStatsEntry.setDescription('A collection of statistics kept for a particular port.') atiL2EthPortErrModuleId = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 2, 2, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthPortErrModuleId.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthPortErrModuleId.setDescription('This Object Identifies the Module Id for which the Statistics is collected.') atiL2EthPortErrPortId = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 2, 2, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthPortErrPortId.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthPortErrPortId.setDescription('This Object Identifies the Port on the Module recognised by the above Object for which the Statistics is collected.') atiL2EthPortErrorCRC = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 2, 2, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthPortErrorCRC.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthPortErrorCRC.setDescription('The total number of CRC errors on received packets.') atiL2EthPortErrorAlignment = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 2, 2, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthPortErrorAlignment.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthPortErrorAlignment.setDescription('The total number of packets received that has alignment errors.') atiL2EthPortErrorRxBadFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 2, 2, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthPortErrorRxBadFrames.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthPortErrorRxBadFrames.setDescription('The counter is incremented when a bad frame was received.') atiL2EthPortErrorLateCollisions = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 2, 2, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthPortErrorLateCollisions.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthPortErrorLateCollisions.setDescription('This object counts the number of times the collison was detected in the port.') atiL2EthPortErrorTxTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 6, 2, 2, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2EthPortErrorTxTotal.setStatus('mandatory') if mibBuilder.loadTexts: atiL2EthPortErrorTxTotal.setDescription('Total number of error resulted from transfer operations.') atiL2DevicePortTable = MibTable((1, 3, 6, 1, 4, 1, 207, 8, 33, 7, 1), ) if mibBuilder.loadTexts: atiL2DevicePortTable.setStatus('mandatory') if mibBuilder.loadTexts: atiL2DevicePortTable.setDescription('Table of basic port configuration information.') atiL2DevicePortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 207, 8, 33, 7, 1, 1), ).setIndexNames((0, "AtiL2-MIB", "atiL2DeviceId"), (0, "AtiL2-MIB", "atiL2DevicePortNumber")) if mibBuilder.loadTexts: atiL2DevicePortEntry.setStatus('mandatory') if mibBuilder.loadTexts: atiL2DevicePortEntry.setDescription('An entry in the port config table.') atiL2DeviceId = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 7, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2DeviceId.setStatus('mandatory') if mibBuilder.loadTexts: atiL2DeviceId.setDescription('This object identifies the Module Id of the switch Stack.') atiL2DevicePortNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 7, 1, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2DevicePortNumber.setStatus('mandatory') if mibBuilder.loadTexts: atiL2DevicePortNumber.setDescription('This object identifies the Port on atiL2ModuleId of the switch Stack.') atiL2DevicePortName = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 7, 1, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 20))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2DevicePortName.setStatus('mandatory') if mibBuilder.loadTexts: atiL2DevicePortName.setDescription('This attribute associates a user defined string name with the port.') atiL2DevicePortAutosenseOrHalfDuplex = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 7, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("portAutoSense", 1), ("forceHalfDuplex-10M", 2), ("forceHalfDuplex-100M", 3), ("forceFullDuplex-10M", 4), ("forceFullDuplex-100M", 5), ("forceHalfDuplex-1G", 6), ("forceFullDuplex-1G", 7)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2DevicePortAutosenseOrHalfDuplex.setStatus('mandatory') if mibBuilder.loadTexts: atiL2DevicePortAutosenseOrHalfDuplex.setDescription('This attribute allows an administrative request to configure whether this port can Autosense or Force the Half Duplex or Full Duplex on different Port Speeds.') atiL2DevicePortLinkState = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 7, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("online", 1), ("offline", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2DevicePortLinkState.setStatus('mandatory') if mibBuilder.loadTexts: atiL2DevicePortLinkState.setDescription('This attribute allows an administrative request to read the status of link state on this port.') atiL2DevicePortDuplexStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 7, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("fullDuplex", 1), ("halfDuplex", 2), ("autosense", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2DevicePortDuplexStatus.setStatus('mandatory') if mibBuilder.loadTexts: atiL2DevicePortDuplexStatus.setDescription('This attribute allows an administrative request to read the status of Duplex on this port.') atiL2DevicePortSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 7, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("tenMBits", 1), ("hundredMBits", 2), ("gigaBits", 3), ("unknown", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2DevicePortSpeed.setStatus('mandatory') if mibBuilder.loadTexts: atiL2DevicePortSpeed.setDescription("This attribute allows an administrative request to read or write the speed of this port. This Object is valid only for 10/100Mbits and gigaBits ports. The only gigabit port that can be set is that of AT-A14 and it's values can be either 2 or 3.") atiL2DevicePortState = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 7, 1, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2), ("blocking", 3), ("listening", 4), ("learning", 5)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2DevicePortState.setStatus('mandatory') if mibBuilder.loadTexts: atiL2DevicePortState.setDescription('This attribute allows an administrative request to disable or enable communications on this port.It also responds with the status of the port .Except enabled(1) and disabled(2), all values are read-only status.') atiL2DevicePortTransmitPacingConfig = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 7, 1, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2DevicePortTransmitPacingConfig.setStatus('mandatory') if mibBuilder.loadTexts: atiL2DevicePortTransmitPacingConfig.setDescription('This Object is supported on at36XX product line Only. This attribute allows the transmit Pacing to be enabled or disabled.') atiL2DevicePortSTPConfig = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 7, 1, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2DevicePortSTPConfig.setStatus('mandatory') if mibBuilder.loadTexts: atiL2DevicePortSTPConfig.setDescription('This attribute allows a bridging Mode to be configured with either Spanning Tree enabled or disabled. When Spanning tree is enabled, make sure that this port is belonging to a valid Bridge_id. Spanning Tree is enabled only when a valid Bridge_id is set.') atiL2DevicePortBridgeid = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 7, 1, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 64))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2DevicePortBridgeid.setStatus('mandatory') if mibBuilder.loadTexts: atiL2DevicePortBridgeid.setDescription(' The Bridge to which this port belongs to.') atiL2DevicePortSTPCost = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 7, 1, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2DevicePortSTPCost.setStatus('mandatory') if mibBuilder.loadTexts: atiL2DevicePortSTPCost.setDescription('The Cost of the Spanning Tree Protocol.This object is valid only when STP is enabled.') atiL2DevicePortSTPPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 7, 1, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2DevicePortSTPPriority.setStatus('mandatory') if mibBuilder.loadTexts: atiL2DevicePortSTPPriority.setDescription(' The Priority of the spanning Tree Protocol. This object is valid when STP is enabled.') atiL2DevicePortFlowControlEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 7, 1, 1, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disable", 1), ("enable", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2DevicePortFlowControlEnable.setStatus('deprecated') if mibBuilder.loadTexts: atiL2DevicePortFlowControlEnable.setDescription('This per-port attribute describes whether the port identified has flow Control Enabled or not. Flow Control on Full Duplex and Half Duplex is detected and automatically, flow control accordingly is taken care of. By Default, Flow Control is Disabled.') atiL2DevicePortBackPressureEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 7, 1, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disable", 1), ("enable", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2DevicePortBackPressureEnable.setStatus('deprecated') if mibBuilder.loadTexts: atiL2DevicePortBackPressureEnable.setDescription('This per-port attribute describes whether the port identified has Back Pressure Enabled or not. By Default, Back Pressure is Disabled.') atiL2DevicePortVlanTagPriorityConfig = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 7, 1, 1, 16), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("use-vlan-priority", 1), ("override-vlan-priority", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2DevicePortVlanTagPriorityConfig.setStatus('deprecated') if mibBuilder.loadTexts: atiL2DevicePortVlanTagPriorityConfig.setDescription('This per-port attribute allows the configuration of the Tag Priority to be Override or Use the Tag Priority. By Default, all ports use Vlan Tag priority.') atiL2DevicePortQOSPriorityConfig = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 7, 1, 1, 17), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("high-priority", 1), ("normal-priority", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2DevicePortQOSPriorityConfig.setStatus('deprecated') if mibBuilder.loadTexts: atiL2DevicePortQOSPriorityConfig.setDescription('This per-port attribute is applicable only to at-8324, at-8124XL-V2 and at-8316 and it allows for the configuration of the Priority of the port to be high or Low. In a switch environment, Ports with high Priority and traffic from and to the ports get more priority when compared with those with normal priority. By Default, all ports have Normal Priority.') atiL2BasicVlanTable = MibTable((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 1), ) if mibBuilder.loadTexts: atiL2BasicVlanTable.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BasicVlanTable.setDescription('Table of Virtual LAN configured.') atiL2BasicVlanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 1, 1), ).setIndexNames((0, "AtiL2-MIB", "atiL2BeVlanIndex")) if mibBuilder.loadTexts: atiL2BasicVlanEntry.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BasicVlanEntry.setDescription('An entry in the table, containing VLAN information.') atiL2BeVlanIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BeVlanIndex.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BeVlanIndex.setDescription('This object identifies the VLAN.') atiL2BeVlanName = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 1, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 20))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BeVlanName.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BeVlanName.setDescription("This attribute associates a user defined string with the Virtual LAN. To configure a new VLAN, do 'set' operation on this object with the VLAN name. To delete a VLAN, do 'set' operation with string '*<module_num>', where <module_num> is the module number (1..8) from which the delete request is being sent. If a vlan is being created or modified, before configuring any of the objects in this row, set atiL2VlanStatus to 'under-construction' and once configured with all the information, set the same object to operational. This step is not required when deleting a vlan.") atiL2BeVlanTagId = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 4095))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BeVlanTagId.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BeVlanTagId.setDescription("This object configures the VId in the Tag Information header in accordance with 802.1q spec. Before configuring any of the objects in this row , set the atiL2VlanStatus to 'under-construction' and once configured with all the information, please set the same object to operational.") atiL2BeVlanModule1UntaggedPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 1, 1, 4), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BeVlanModule1UntaggedPorts.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BeVlanModule1UntaggedPorts.setDescription("This Object builds the Output Ports on the Module that participate in the Vlan with the atiL2BeVlanName. The Format of the input string would be like '1,2,5,7,12..15,18-22,26'. Before configuring any of the objects in this row , set the atiL2VlanStatus to 'under-construction' and once configured with all the information, please set the same object to operational.") atiL2BeVlanModule1TaggedPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 1, 1, 5), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BeVlanModule1TaggedPorts.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BeVlanModule1TaggedPorts.setDescription("This Object builds the Output Ports on the Module atiL2BeVlanModuleId that participate in the Vlan with the atiL2BeVlanName. The Format of the input string would be like '1,2,5,7,12'. Please select the Module by setting the atiL2BeVlanModuleId with the Module Id and then set the port mask. If this is not set, by default this will be set to 1. Before configuring any of the objects in this row , set the atiL2VlanStatus to 'under-construction' and once configured with all the information, please set the same object to operational.") atiL2BeVlanModule2UntaggedPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 1, 1, 6), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BeVlanModule2UntaggedPorts.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BeVlanModule2UntaggedPorts.setDescription("This Object builds the Output Ports on the Module atiL2BeVlanModuleId that participate in the Vlan with the atiL2BeVlanName. The Format of the input string would be like '1,2,5,7,12'. Please select the Module by setting the atiL2BeVlanModuleId with the Module Id and then set the port mask. If this is not set, by default this will be set to 1. Before configuring any of the objects in this row , set the atiL2VlanStatus to 'under-construction' and once configured with all the information, please set the same object to operational.") atiL2BeVlanModule2TaggedPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 1, 1, 7), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BeVlanModule2TaggedPorts.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BeVlanModule2TaggedPorts.setDescription("This Object builds the Output Ports on the Module atiL2BeVlanModuleId that participate in the Vlan with the atiL2BeVlanName. The Format of the input string would be like '1,2,5,7,12'. Please select the Module by setting the atiL2BeVlanModuleId with the Module Id and then set the port mask. If this is not set, by default this will be set to 1. Before configuring any of the objects in this row , set the atiL2VlanStatus to 'under-construction' and once configured with all the information, please set the same object to operational.") atiL2BeVlanModule3UntaggedPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 1, 1, 8), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BeVlanModule3UntaggedPorts.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BeVlanModule3UntaggedPorts.setDescription("This Object builds the Output Ports on the Module atiL2BeVlanModuleId that participate in the Vlan with the atiL2BeVlanName. The Format of the input string would be like '1,2,5,7,12'. Please select the Module by setting the atiL2BeVlanModuleId with the Module Id and then set the port mask. If this is not set, by default this will be set to 1. Before configuring any of the objects in this row , set the atiL2VlanStatus to 'under-construction' and once configured with all the information, please set the same object to operational.") atiL2BeVlanModule3TaggedPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 1, 1, 9), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BeVlanModule3TaggedPorts.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BeVlanModule3TaggedPorts.setDescription("This Object builds the Output Ports on the Module atiL2BeVlanModuleId that participate in the Vlan with the atiL2BeVlanName. The Format of the input string would be like '1,2,5,7,12'. Please select the Module by setting the atiL2BeVlanModuleId with the Module Id and then set the port mask. If this is not set, by default this will be set to 1. Before configuring any of the objects in this row , set the atiL2VlanStatus to 'under-construction' and once configured with all the information, please set the same object to operational.") atiL2BeVlanModule4UntaggedPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 1, 1, 10), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BeVlanModule4UntaggedPorts.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BeVlanModule4UntaggedPorts.setDescription("This Object builds the Output Ports on the Module atiL2BeVlanModuleId that participate in the Vlan with the atiL2BeVlanName. The Format of the input string would be like '1,2,5,7,12'. Please select the Module by setting the atiL2BeVlanModuleId with the Module Id and then set the port mask. If this is not set, by default this will be set to 1. Before configuring any of the objects in this row , set the atiL2VlanStatus to 'under-construction' and once configured with all the information, please set the same object to operational.") atiL2BeVlanModule4TaggedPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 1, 1, 11), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BeVlanModule4TaggedPorts.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BeVlanModule4TaggedPorts.setDescription("This Object builds the Output Ports on the Module atiL2BeVlanModuleId that participate in the Vlan with the atiL2BeVlanName. The Format of the input string would be like '1,2,5,7,12'. Please select the Module by setting the atiL2BeVlanModuleId with the Module Id and then set the port mask. If this is not set, by default this will be set to 1. Before configuring any of the objects in this row , set the atiL2VlanStatus to 'under-construction' and once configured with all the information, please set the same object to operational.") atiL2BeVlanModule5UntaggedPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 1, 1, 12), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BeVlanModule5UntaggedPorts.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BeVlanModule5UntaggedPorts.setDescription("This Object builds the Output Ports on the Module atiL2BeVlanModuleId that participate in the Vlan with the atiL2BeVlanName. The Format of the input string would be like '1,2,5,7,12'. Please select the Module by setting the atiL2BeVlanModuleId with the Module Id and then set the port mask. If this is not set, by default this will be set to 1. Before configuring any of the objects in this row , set the atiL2VlanStatus to 'under-construction' and once configured with all the information, please set the same object to operational.") atiL2BeVlanModule5TaggedPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 1, 1, 13), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BeVlanModule5TaggedPorts.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BeVlanModule5TaggedPorts.setDescription("This Object builds the Output Ports on the Module atiL2BeVlanModuleId that participate in the Vlan with the atiL2BeVlanName. The Format of the input string would be like '1,2,5,7,12'. Please select the Module by setting the atiL2BeVlanModuleId with the Module Id and then set the port mask. If this is not set, by default this will be set to 1. Before configuring any of the objects in this row , set the atiL2VlanStatus to 'under-construction' and once configured with all the information, please set the same object to operational.") atiL2BeVlanModule6UntaggedPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 1, 1, 14), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BeVlanModule6UntaggedPorts.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BeVlanModule6UntaggedPorts.setDescription("This Object builds the Output Ports on the Module atiL2BeVlanModuleId that participate in the Vlan with the atiL2BeVlanName. The Format of the input string would be like '1,2,5,7,12'. Please select the Module by setting the atiL2BeVlanModuleId with the Module Id and then set the port mask. If this is not set, by default this will be set to 1. Before configuring any of the objects in this row , set the atiL2VlanStatus to 'under-construction' and once configured with all the information, please set the same object to operational.") atiL2BeVlanModule6TaggedPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 1, 1, 15), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BeVlanModule6TaggedPorts.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BeVlanModule6TaggedPorts.setDescription("This Object builds the Output Ports on the Module atiL2BeVlanModuleId that participate in the Vlan with the atiL2BeVlanName. The Format of the input string would be like '1,2,5,7,12'. Please select the Module by setting the atiL2BeVlanModuleId with the Module Id and then set the port mask. If this is not set, by default this will be set to 1. Before configuring any of the objects in this row , set the atiL2VlanStatus to 'under-construction' and once configured with all the information, please set the same object to operational.") atiL2BeVlanModule7UntaggedPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 1, 1, 16), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BeVlanModule7UntaggedPorts.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BeVlanModule7UntaggedPorts.setDescription("This Object builds the Output Ports on the Module atiL2BeVlanModuleId that participate in the Vlan with the atiL2BeVlanName. The Format of the input string would be like '1,2,5,7,12'. Please select the Module by setting the atiL2BeVlanModuleId with the Module Id and then set the port mask. If this is not set, by default this will be set to 1. Before configuring any of the objects in this row , set the atiL2VlanStatus to 'under-construction' and once configured with all the information, please set the same object to operational.") atiL2BeVlanModule7TaggedPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 1, 1, 17), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BeVlanModule7TaggedPorts.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BeVlanModule7TaggedPorts.setDescription("This Object builds the Output Ports on the Module atiL2BeVlanModuleId that participate in the Vlan with the atiL2BeVlanName. The Format of the input string would be like '1,2,5,7,12'. Please select the Module by setting the atiL2BeVlanModuleId with the Module Id and then set the port mask. If this is not set, by default this will be set to 1. Before configuring any of the objects in this row , set the atiL2VlanStatus to 'under-construction' and once configured with all the information, please set the same object to operational.") atiL2BeVlanModule8UntaggedPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 1, 1, 18), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BeVlanModule8UntaggedPorts.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BeVlanModule8UntaggedPorts.setDescription("This Object builds the Output Ports on the Module atiL2BeVlanModuleId that participate in the Vlan with the atiL2BeVlanName. The Format of the input string would be like '1,2,5,7,12'. Please select the Module by setting the atiL2BeVlanModuleId with the Module Id and then set the port mask. If this is not set, by default this will be set to 1. Before configuring any of the objects in this row , set the atiL2VlanStatus to 'under-construction' and once configured with all the information, please set the same object to operational.") atiL2BeVlanModule8TaggedPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 1, 1, 19), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BeVlanModule8TaggedPorts.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BeVlanModule8TaggedPorts.setDescription("This Object builds the Output Ports on the Module atiL2BeVlanModuleId that participate in the Vlan with the atiL2BeVlanName. The Format of the input string would be like '1,2,5,7,12'. Please select the Module by setting the atiL2BeVlanModuleId with the Module Id and then set the port mask. If this is not set, by default this will be set to 1. Before configuring any of the objects in this row , set the atiL2VlanStatus to 'under-construction' and once configured with all the information, please set the same object to operational.") atiL2BeVlanRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 1, 1, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("idle", 1), ("operational", 2), ("under-construction", 3), ("not-operational", 4)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BeVlanRowStatus.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BeVlanRowStatus.setDescription('This object is used to create or modify a vlan. The user should first set this object to under-construction. After the vlan name, the tag Id and the ports belonging to the vlan are configured/modified, this object should be set to operational. If it is not set to operational, the whole row will be lost and the vlan will not be configured in the switch.') atiL2Port2VlanTable = MibTable((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 2), ) if mibBuilder.loadTexts: atiL2Port2VlanTable.setStatus('mandatory') if mibBuilder.loadTexts: atiL2Port2VlanTable.setDescription('Table of per port Virtual LAN configuration.') atiL2Port2VlanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 2, 1), ).setIndexNames((0, "AtiL2-MIB", "atiL2PvModuleId"), (0, "AtiL2-MIB", "atiL2PvPortNumber")) if mibBuilder.loadTexts: atiL2Port2VlanEntry.setStatus('mandatory') if mibBuilder.loadTexts: atiL2Port2VlanEntry.setDescription('An entry in the table, containing per port VLAN information.') atiL2PvModuleId = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 2, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2PvModuleId.setStatus('mandatory') if mibBuilder.loadTexts: atiL2PvModuleId.setDescription('This object identifies the Module Id on the switching Stack.') atiL2PvPortNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 2, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2PvPortNumber.setStatus('mandatory') if mibBuilder.loadTexts: atiL2PvPortNumber.setDescription('This object identifies the port on the Module atiL2PvModuleId .') atiL2PvVlanName = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 8, 2, 1, 3), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2PvVlanName.setStatus('mandatory') if mibBuilder.loadTexts: atiL2PvVlanName.setDescription('This attribute associates a user defined string with the Virtual LAN. This Object is the same as atiL2BeVlanName. Please make sure to give the same string as atiL2BeVlanName.') atiL2IfExtensions = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 8, 33, 9, 1)) atiIfExtnTable = MibTable((1, 3, 6, 1, 4, 1, 207, 8, 33, 9, 1, 1), ) if mibBuilder.loadTexts: atiIfExtnTable.setStatus('mandatory') if mibBuilder.loadTexts: atiIfExtnTable.setDescription('A list of interface entries. The number of entries is given by the value of ifNumber.') atiIfExtnEntry = MibTableRow((1, 3, 6, 1, 4, 1, 207, 8, 33, 9, 1, 1, 1), ).setIndexNames((0, "AtiL2-MIB", "atiIfExtnIndex")) if mibBuilder.loadTexts: atiIfExtnEntry.setStatus('mandatory') if mibBuilder.loadTexts: atiIfExtnEntry.setDescription('An interface entry containing objects at the subnetwork layer and below for a particular interface.') atiIfExtnIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 9, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 256))).setMaxAccess("readonly") if mibBuilder.loadTexts: atiIfExtnIndex.setStatus('mandatory') if mibBuilder.loadTexts: atiIfExtnIndex.setDescription('A unique value for each interface corresponding to the ifIndex value for the same interface.') atiIfExtnModuleId = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 9, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 8))).setMaxAccess("readonly") if mibBuilder.loadTexts: atiIfExtnModuleId.setStatus('mandatory') if mibBuilder.loadTexts: atiIfExtnModuleId.setDescription('The unit number associated with this particular interface.') atiIfExtnPort = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 9, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: atiIfExtnPort.setStatus('mandatory') if mibBuilder.loadTexts: atiIfExtnPort.setDescription('The port number within a unit or slot.') atiL2BrBaseTable = MibTable((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 1, 1), ) if mibBuilder.loadTexts: atiL2BrBaseTable.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrBaseTable.setDescription('Table of basic bridge information.') atiL2BrBaseEntry = MibTableRow((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 1, 1, 1), ).setIndexNames((0, "AtiL2-MIB", "atiL2BrBaseLanId")) if mibBuilder.loadTexts: atiL2BrBaseEntry.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrBaseEntry.setDescription('An entry in the atiL2BrBaseTable.') atiL2BrBaseLanId = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 1, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrBaseLanId.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrBaseLanId.setDescription('This object uniquely identifies the lan or Virtual lan.') atiL2BrBaseBridgeAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 1, 1, 1, 2), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrBaseBridgeAddress.setReference('IEEE 802.1D-1990: Sections 6.4.1.1.3 and 3.12.5') if mibBuilder.loadTexts: atiL2BrBaseBridgeAddress.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrBaseBridgeAddress.setDescription('The MAC address used by this bridge when it must be referred to in a unique fashion. It is recommended that this be the numerically smallest MAC address of all ports that belong to this bridge. However it is only required to be unique. When concatenated with atiL2BrStpPriority a unique BridgeIdentifier is formed which is used in the Spanning Tree Protocol.') atiL2BrBaseNumPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 1, 1, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrBaseNumPorts.setReference('IEEE 802.1D-1990: Section 6.4.1.1.3') if mibBuilder.loadTexts: atiL2BrBaseNumPorts.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrBaseNumPorts.setDescription('The number of ports controlled by this bridging entity.') atiL2BrBaseType = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("unknown", 1), ("transparent-only", 2), ("sourceroute-only", 3), ("srt", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrBaseType.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrBaseType.setDescription('Indicates what type of bridging this bridge can perform. If a bridge is actually performing a certain type of bridging this will be indicated by entries in the port table for the given type.') atiL2BrBasePortTable = MibTable((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 1, 4), ) if mibBuilder.loadTexts: atiL2BrBasePortTable.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrBasePortTable.setDescription('A table that contains generic information about every port that is associated with this bridge. Transparent, source-route, and srt ports are included.') atiL2BrBasePortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 1, 4, 1), ).setIndexNames((0, "AtiL2-MIB", "atiL2BrBasePortLanId"), (0, "AtiL2-MIB", "atiL2BrBasePort")) if mibBuilder.loadTexts: atiL2BrBasePortEntry.setReference('IEEE 802.1D-1990: Section 6.4.2, 6.6.1') if mibBuilder.loadTexts: atiL2BrBasePortEntry.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrBasePortEntry.setDescription('A list of information for each port of the bridge.') atiL2BrBasePortLanId = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 1, 4, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrBasePortLanId.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrBasePortLanId.setDescription('This object uniquely identifies the lan or Virtual lan.') atiL2BrBasePort = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 1, 4, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrBasePort.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrBasePort.setDescription('The port number of the port for which this entry contains bridge management information.') atiL2BrBasePortIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 1, 4, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrBasePortIfIndex.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrBasePortIfIndex.setDescription('The value of the instance of the ifIndex object, defined in MIB-II, for the interface corresponding to this port.') atiL2BrBasePortCircuit = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 1, 4, 1, 4), ObjectIdentifier()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrBasePortCircuit.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrBasePortCircuit.setDescription('For a port which (potentially) has the same value of atiL2BrBasePortIfIndex as another port on the same bridge, this object contains the name of an object instance unique to this port. For example, in the case where multiple ports correspond one- to-one with multiple X.25 virtual circuits, this value might identify an (e.g., the first) object instance associated with the X.25 virtual circuit corresponding to this port. For a port which has a unique value of atiL2BrBasePortIfIndex, this object can have the value { 0 0 }.') atiL2BrBasePortDelayExceededDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 1, 4, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrBasePortDelayExceededDiscards.setReference('IEEE 802.1D-1990: Section 6.6.1.1.3') if mibBuilder.loadTexts: atiL2BrBasePortDelayExceededDiscards.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrBasePortDelayExceededDiscards.setDescription('The number of frames discarded by this port due to excessive transit delay through the bridge. It is incremented by both transparent and source route bridges.') atiL2BrBasePortMtuExceededDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 1, 4, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrBasePortMtuExceededDiscards.setReference('IEEE 802.1D-1990: Section 6.6.1.1.3') if mibBuilder.loadTexts: atiL2BrBasePortMtuExceededDiscards.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrBasePortMtuExceededDiscards.setDescription('The number of frames discarded by this port due to an excessive size. It is incremented by both transparent and source route bridges.') atiL2BrStpTable = MibTable((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 1), ) if mibBuilder.loadTexts: atiL2BrStpTable.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpTable.setDescription('Table of bridge spanning tree information.') atiL2BrStpEntry = MibTableRow((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 1, 1), ).setIndexNames((0, "AtiL2-MIB", "atiL2BrStpLanId")) if mibBuilder.loadTexts: atiL2BrStpEntry.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpEntry.setDescription('An entry in the atiL2BrStpTable.') atiL2BrStpLanId = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrStpLanId.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpLanId.setDescription('This object uniquely identifies the lan or Virtual lan.') atiL2BrStpProtocolSpecification = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("unknown", 1), ("decLb100", 2), ("ieee8021d", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrStpProtocolSpecification.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpProtocolSpecification.setDescription("An indication of what version of the Spanning Tree Protocol is being run. The value 'decLb100(2)' indicates the DEC LANbridge 100 Spanning Tree protocol. IEEE 802.1d implementations will return 'ieee8021d(3)'. If future versions of the IEEE Spanning Tree Protocol are released that are incompatible with the current version a new value will be defined.") atiL2BrStpPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BrStpPriority.setReference('IEEE 802.1D-1990: Section 4.5.3.7') if mibBuilder.loadTexts: atiL2BrStpPriority.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpPriority.setDescription('The value of the write-able portion of the Bridge ID, i.e., the first two octets of the (8 octet long) Bridge ID. The other (last) 6 octets of the Bridge ID are given by the value of atiL2BrBaseBridgeAddress.') atiL2BrStpTimeSinceTopologyChange = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 1, 1, 4), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrStpTimeSinceTopologyChange.setReference('IEEE 802.1D-1990: Section 6.8.1.1.3') if mibBuilder.loadTexts: atiL2BrStpTimeSinceTopologyChange.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpTimeSinceTopologyChange.setDescription('The time (in hundredths of a second) since the last time a topology change was detected by the bridge entity.') atiL2BrStpTopChanges = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 1, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrStpTopChanges.setReference('IEEE 802.1D-1990: Section 6.8.1.1.3') if mibBuilder.loadTexts: atiL2BrStpTopChanges.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpTopChanges.setDescription('The total number of topology changes detected by this bridge since the management entity was last reset or initialized.') atiL2BrStpDesignatedRoot = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 1, 1, 6), BridgeId()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrStpDesignatedRoot.setReference('IEEE 802.1D-1990: Section 4.5.3.1') if mibBuilder.loadTexts: atiL2BrStpDesignatedRoot.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpDesignatedRoot.setDescription('The bridge identifier of the root of the spanning tree as determined by the Spanning Tree Protocol as executed by this node. This value is used as the Root Identifier parameter in all Configuration Bridge PDUs originated by this node.') atiL2BrStpRootCost = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 1, 1, 7), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrStpRootCost.setReference('IEEE 802.1D-1990: Section 4.5.3.2') if mibBuilder.loadTexts: atiL2BrStpRootCost.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpRootCost.setDescription('The cost of the path to the root as seen from this bridge.') atiL2BrStpRootPort = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 1, 1, 8), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrStpRootPort.setReference('IEEE 802.1D-1990: Section 4.5.3.3') if mibBuilder.loadTexts: atiL2BrStpRootPort.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpRootPort.setDescription('The port number of the port which offers the lowest cost path from this bridge to the root bridge.') atiL2BrStpMaxAge = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 1, 1, 9), Timeout()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrStpMaxAge.setReference('IEEE 802.1D-1990: Section 4.5.3.4') if mibBuilder.loadTexts: atiL2BrStpMaxAge.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpMaxAge.setDescription('The maximum age of Spanning Tree Protocol information learned from the network on any port before it is discarded, in units of hundredths of a second. This is the actual value that this bridge is currently using.') atiL2BrStpHelloTime = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 1, 1, 10), Timeout()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrStpHelloTime.setReference('IEEE 802.1D-1990: Section 4.5.3.5') if mibBuilder.loadTexts: atiL2BrStpHelloTime.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpHelloTime.setDescription('The amount of time between the transmission of Configuration bridge PDUs by this node on any port when it is the root of the spanning tree or trying to become so, in units of hundredths of a second. This is the actual value that this bridge is currently using.') atiL2BrStpHoldTime = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 1, 1, 11), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrStpHoldTime.setReference('IEEE 802.1D-1990: Section 4.5.3.14') if mibBuilder.loadTexts: atiL2BrStpHoldTime.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpHoldTime.setDescription('This time value determines the interval length during which no more than two Configuration bridge PDUs shall be transmitted by this node, in units of hundredths of a second.') atiL2BrStpForwardDelay = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 1, 1, 12), Timeout()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrStpForwardDelay.setReference('IEEE 802.1D-1990: Section 4.5.3.6') if mibBuilder.loadTexts: atiL2BrStpForwardDelay.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpForwardDelay.setDescription('This time value, measured in units of hundredths of a second, controls how fast a port changes its spanning state when moving towards the Forwarding state. The value determines how long the port stays in each of the Listening and Learning states, which precede the Forwarding state. This value is also used, when a topology change has been detected and is underway, to age all dynamic entries in the Forwarding Database. [Note that this value is the one that this bridge is currently using, in contrast to atiL2BrStpBridgeForwardDelay which is the value that this bridge and all others would start using if/when this bridge were to become the root.]') atiL2BrStpBridgeMaxAge = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 1, 1, 13), Timeout().subtype(subtypeSpec=ValueRangeConstraint(600, 4000))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BrStpBridgeMaxAge.setReference('IEEE 802.1D-1990: Section 4.5.3.8') if mibBuilder.loadTexts: atiL2BrStpBridgeMaxAge.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpBridgeMaxAge.setDescription('The value that all bridges use for MaxAge when this bridge is acting as the root. Note that 802.1D-1990 specifies that the range for this parameter is related to the value of atiL2BrStpBridgeHelloTime. The granularity of this timer is specified by 802.1D-1990 to be 1 second. An agent may return a badValue error if a set is attempted to a value which is not a whole number of seconds.') atiL2BrStpBridgeHelloTime = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 1, 1, 14), Timeout().subtype(subtypeSpec=ValueRangeConstraint(100, 1000))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BrStpBridgeHelloTime.setReference('IEEE 802.1D-1990: Section 4.5.3.9') if mibBuilder.loadTexts: atiL2BrStpBridgeHelloTime.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpBridgeHelloTime.setDescription('The value that all bridges use for HelloTime when this bridge is acting as the root. The granularity of this timer is specified by 802.1D- 1990 to be 1 second. An agent may return a badValue error if a set is attempted to a value which is not a whole number of seconds.') atiL2BrStpBridgeForwardDelay = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 1, 1, 15), Timeout().subtype(subtypeSpec=ValueRangeConstraint(400, 3000))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BrStpBridgeForwardDelay.setReference('IEEE 802.1D-1990: Section 4.5.3.10') if mibBuilder.loadTexts: atiL2BrStpBridgeForwardDelay.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpBridgeForwardDelay.setDescription('The value that all bridges use for ForwardDelay when this bridge is acting as the root. Note that 802.1D-1990 specifies that the range for this parameter is related to the value of atiL2BrStpBridgeMaxAge. The granularity of this timer is specified by 802.1D-1990 to be 1 second. An agent may return a badValue error if a set is attempted to a value which is not a whole number of seconds.') atiL2BrStpPortTable = MibTable((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 15), ) if mibBuilder.loadTexts: atiL2BrStpPortTable.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpPortTable.setDescription('A table that contains port-specific information for the Spanning Tree Protocol.') atiL2BrStpPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 15, 1), ).setIndexNames((0, "AtiL2-MIB", "atiL2BrStpPortLanId"), (0, "AtiL2-MIB", "atiL2BrStpPort")) if mibBuilder.loadTexts: atiL2BrStpPortEntry.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpPortEntry.setDescription('A list of information maintained by every port about the Spanning Tree Protocol state for that port.') atiL2BrStpPortLanId = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 15, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrStpPortLanId.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpPortLanId.setDescription('This object uniquely identifies the lan or Virtual lan.') atiL2BrStpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 15, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrStpPort.setReference('IEEE 802.1D-1990: Section 6.8.2.1.2') if mibBuilder.loadTexts: atiL2BrStpPort.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpPort.setDescription('The port number of the port for which this entry contains Spanning Tree Protocol management information.') atiL2BrStpPortPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 15, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BrStpPortPriority.setReference('IEEE 802.1D-1990: Section 4.5.5.1') if mibBuilder.loadTexts: atiL2BrStpPortPriority.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpPortPriority.setDescription('The value of the priority field which is contained in the first (in network byte order) octet of the (2 octet long) Port ID. The other octet of the Port ID is given by the value of atiL2BrStpPort.') atiL2BrStpPortState = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 15, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("disabled", 1), ("blocking", 2), ("listening", 3), ("learning", 4), ("forwarding", 5), ("broken", 6)))).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrStpPortState.setReference('IEEE 802.1D-1990: Section 4.5.5.2') if mibBuilder.loadTexts: atiL2BrStpPortState.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpPortState.setDescription("The port's current state as defined by application of the Spanning Tree Protocol. This state controls what action a port takes on reception of a frame. If the bridge has detected a port that is malfunctioning it will place that port into the broken(6) state. For ports which are disabled (see atiL2BrStpPortEnable), this object will have a value of disabled(1).") atiL2BrStpPortEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 15, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BrStpPortEnable.setReference('IEEE 802.1D-1990: Section 4.5.5.2') if mibBuilder.loadTexts: atiL2BrStpPortEnable.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpPortEnable.setDescription('The enabled/disabled status of the port.') atiL2BrStpPortPathCost = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 15, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BrStpPortPathCost.setReference('IEEE 802.1D-1990: Section 4.5.5.3') if mibBuilder.loadTexts: atiL2BrStpPortPathCost.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpPortPathCost.setDescription('The contribution of this port to the path cost of paths towards the spanning tree root which include this port. 802.1D-1990 recommends that the default value of this parameter be in inverse proportion to the speed of the attached LAN.') atiL2BrStpPortDesignatedRoot = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 15, 1, 7), BridgeId()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrStpPortDesignatedRoot.setReference('IEEE 802.1D-1990: Section 4.5.5.4') if mibBuilder.loadTexts: atiL2BrStpPortDesignatedRoot.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpPortDesignatedRoot.setDescription('The unique Bridge Identifier of the Bridge recorded as the Root in the Configuration BPDUs transmitted by the Designated Bridge for the segment to which the port is attached.') atiL2BrStpPortDesignatedCost = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 15, 1, 8), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrStpPortDesignatedCost.setReference('IEEE 802.1D-1990: Section 4.5.5.5') if mibBuilder.loadTexts: atiL2BrStpPortDesignatedCost.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpPortDesignatedCost.setDescription('The path cost of the Designated Port of the segment connected to this port. This value is compared to the Root Path Cost field in received bridge PDUs.') atiL2BrStpPortDesignatedBridge = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 15, 1, 9), BridgeId()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrStpPortDesignatedBridge.setReference('IEEE 802.1D-1990: Section 4.5.5.6') if mibBuilder.loadTexts: atiL2BrStpPortDesignatedBridge.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpPortDesignatedBridge.setDescription("The Bridge Identifier of the bridge which this port considers to be the Designated Bridge for this port's segment.") atiL2BrStpPortDesignatedPort = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 15, 1, 10), OctetString().subtype(subtypeSpec=ValueSizeConstraint(2, 2)).setFixedLength(2)).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrStpPortDesignatedPort.setReference('IEEE 802.1D-1990: Section 4.5.5.7') if mibBuilder.loadTexts: atiL2BrStpPortDesignatedPort.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpPortDesignatedPort.setDescription("The Port Identifier of the port on the Designated Bridge for this port's segment.") atiL2BrStpPortForwardTransitions = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 2, 15, 1, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrStpPortForwardTransitions.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrStpPortForwardTransitions.setDescription('The number of times this port has transitioned from the Learning state to the Forwarding state.') atiL2BrTpTable = MibTable((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 3, 1), ) if mibBuilder.loadTexts: atiL2BrTpTable.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrTpTable.setDescription('Table of transparent bridging information.') atiL2BrTpEntry = MibTableRow((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 3, 1, 1), ).setIndexNames((0, "AtiL2-MIB", "atiL2BrTpLanId")) if mibBuilder.loadTexts: atiL2BrTpEntry.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrTpEntry.setDescription('An entry in the atiL2BrTpTable.') atiL2BrTpLanId = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 3, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrTpLanId.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrTpLanId.setDescription('This object uniquely identifies the lan or Virtual lan.') atiL2BrTpLearnedEntryDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 3, 1, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrTpLearnedEntryDiscards.setReference('IEEE 802.1D-1990: Section 6.7.1.1.3') if mibBuilder.loadTexts: atiL2BrTpLearnedEntryDiscards.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrTpLearnedEntryDiscards.setDescription('The total number of Forwarding Database entries, which have been or would have been learnt, but have been discarded due to a lack of space to store them in the Forwarding Database. If this counter is increasing, it indicates that the Forwarding Database is regularly becoming full (a condition which has unpleasant performance effects on the subnetwork). If this counter has a significant value but is not presently increasing, it indicates that the problem has been occurring but is not persistent.') atiL2BrTpAgingTime = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 3, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(10, 1000000))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2BrTpAgingTime.setReference('IEEE 802.1D-1990: Section 6.7.1.1.3') if mibBuilder.loadTexts: atiL2BrTpAgingTime.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrTpAgingTime.setDescription('The timeout period in seconds for aging out dynamically learned forwarding information. 802.1D-1990 recommends a default of 300 seconds.') atiL2BrTpFdbTable = MibTable((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 3, 3), ) if mibBuilder.loadTexts: atiL2BrTpFdbTable.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrTpFdbTable.setDescription('A table that contains information about unicast entries for which the bridge has forwarding and/or filtering information. This information is used by the transparent bridging function in determining how to propagate a received frame.') atiL2BrTpFdbEntry = MibTableRow((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 3, 3, 1), ).setIndexNames((0, "AtiL2-MIB", "atiL2BrTpFdbLanId"), (0, "AtiL2-MIB", "atiL2BrTpFdbAddress")) if mibBuilder.loadTexts: atiL2BrTpFdbEntry.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrTpFdbEntry.setDescription('Information about a specific unicast MAC address for which the bridge has some forwarding and/or filtering information.') atiL2BrTpFdbLanId = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 3, 3, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrTpFdbLanId.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrTpFdbLanId.setDescription('This object uniquely identifies the lan or Virtual lan.') atiL2BrTpFdbAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 3, 3, 1, 2), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrTpFdbAddress.setReference('IEEE 802.1D-1990: Section 3.9.1, 3.9.2') if mibBuilder.loadTexts: atiL2BrTpFdbAddress.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrTpFdbAddress.setDescription('A unicast MAC address for which the bridge has forwarding and/or filtering information.') atiL2BrTpFdbPort = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 3, 3, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrTpFdbPort.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrTpFdbPort.setDescription("Either the value '0', or the port number of the port on which a frame having a source address equal to the value of the corresponding instance of atiL2BrTpFdbAddress has been seen. A value of '0' indicates that the port number has not been learned but that the bridge does have some forwarding/filtering information about this address . Implementors are encouraged to assign the port value to this object whenever it is learned even for addresses for which the corresponding value of atiL2BrTpFdbStatus is not learned(3).") atiL2BrTpFdbStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 3, 3, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("inactive", 1), ("active", 2), ("other", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrTpFdbStatus.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrTpFdbStatus.setDescription('The status of this entry. The meanings of the values are: inactive(1) : this entry is not longer valid (e.g., it was learned but has since aged-out), but has not yet been flushed from the table. active(2) : the value of the corresponding instance of atiL2BrTpFdbPort was active, and is being used. other(3) : none of the following. This would include the case where some other MIB object (not the corresponding instance of atiL2BrTpFdbPort ) is being used to determine if and how frames addressed to the value of the corresponding instance of atiL2BrTpFdbAddress are being forwarded.') atiL2BrTpPortTable = MibTable((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 3, 4), ) if mibBuilder.loadTexts: atiL2BrTpPortTable.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrTpPortTable.setDescription('A table that contains information about every port that is associated with this transparent bridge.') atiL2BrTpPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 3, 4, 1), ).setIndexNames((0, "AtiL2-MIB", "atiL2BrTpPortLanId"), (0, "AtiL2-MIB", "atiL2BrTpPort")) if mibBuilder.loadTexts: atiL2BrTpPortEntry.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrTpPortEntry.setDescription('A list of information for each port of a transparent bridge.') atiL2BrTpPortLanId = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 3, 4, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrTpPortLanId.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrTpPortLanId.setDescription('This object uniquely identifies the lan or Virtual lan.') atiL2BrTpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 3, 4, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrTpPort.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrTpPort.setDescription('The port number of the port for which this entry contains Transparent bridging management information.') atiL2BrTpPortMaxInfo = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 3, 4, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrTpPortMaxInfo.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrTpPortMaxInfo.setDescription('The maximum size of the INFO (non-MAC) field that this port will receive or transmit.') atiL2BrTpPortInFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 3, 4, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrTpPortInFrames.setReference('IEEE 802.1D-1990: Section 6.6.1.1.3') if mibBuilder.loadTexts: atiL2BrTpPortInFrames.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrTpPortInFrames.setDescription('The number of frames that have been received by this port from its segment. Note that a frame received on the interface corresponding to this port is only counted by this object if and only if it is for a protocol being processed by the local bridging function, including bridge management frames.') atiL2BrTpPortOutFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 3, 4, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrTpPortOutFrames.setReference('IEEE 802.1D-1990: Section 6.6.1.1.3') if mibBuilder.loadTexts: atiL2BrTpPortOutFrames.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrTpPortOutFrames.setDescription('The number of frames that have been transmitted by this port to its segment. Note that a frame transmitted on the interface corresponding to this port is only counted by this object if and only if it is for a protocol being processed by the local bridging function, including bridge management frames.') atiL2BrTpPortInDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 10, 3, 4, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2BrTpPortInDiscards.setReference('IEEE 802.1D-1990: Section 6.6.1.1.3') if mibBuilder.loadTexts: atiL2BrTpPortInDiscards.setStatus('mandatory') if mibBuilder.loadTexts: atiL2BrTpPortInDiscards.setDescription('Count of valid frames received which were discarded (i.e., filtered) by the Forwarding Process.') atiL2TrapAttrModuleId = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 11, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 8))) if mibBuilder.loadTexts: atiL2TrapAttrModuleId.setStatus('mandatory') if mibBuilder.loadTexts: atiL2TrapAttrModuleId.setDescription('This attribute is the Module Numver used when Traps pertinent to Module is sent.') atiL2TrapAttrPortId = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 11, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 32))) if mibBuilder.loadTexts: atiL2TrapAttrPortId.setStatus('mandatory') if mibBuilder.loadTexts: atiL2TrapAttrPortId.setDescription('This attribute is the Port Number used when Traps pertinent to Ports are sent.') newRoot = NotificationType((1, 3, 6, 1, 4, 1, 207) + (0,101)) if mibBuilder.loadTexts: newRoot.setDescription('The newRoot trap indicates that the sending agent has become the new root of the Spanning Tree; the trap is sent by a bridge soon after its election as the new root, e.g., upon expiration of the Topology Change Timer immediately subsequent to its election. Implementation of this trap is optional.') topologyChange = NotificationType((1, 3, 6, 1, 4, 1, 207) + (0,102)) if mibBuilder.loadTexts: topologyChange.setDescription('A topologyChange trap is sent by a bridge when any of its configured ports transitions from the Learning state to the Forwarding state, or from the Forwarding state to the Blocking state. The trap is not sent if a newRoot trap is sent for the same transition. Implementation of this trap is optional.') atiL2FanStopTrap = NotificationType((1, 3, 6, 1, 4, 1, 207) + (0,103)).setObjects(("AtiL2-MIB", "atiL2TrapAttrModuleId")) if mibBuilder.loadTexts: atiL2FanStopTrap.setDescription(' A Trap sent from the Module defined by the varable above when a fan from that Module stops.') atiL2TemperatureAbnormalTrap = NotificationType((1, 3, 6, 1, 4, 1, 207) + (0,104)).setObjects(("AtiL2-MIB", "atiL2TrapAttrModuleId")) if mibBuilder.loadTexts: atiL2TemperatureAbnormalTrap.setDescription(' A Trap sent from the Module defined by the varable above when temperature of the Module is abnormal.') atiL2PowerSupplyOutage = NotificationType((1, 3, 6, 1, 4, 1, 207) + (0,105)).setObjects(("AtiL2-MIB", "atiL2TrapAttrModuleId")) if mibBuilder.loadTexts: atiL2PowerSupplyOutage.setDescription(' A Trap sent from the Module defined by the varable above when one of the power supply goes down.') atiL2IntruderAlert = NotificationType((1, 3, 6, 1, 4, 1, 207) + (0,106)).setObjects(("AtiL2-MIB", "atiL2TrapAttrModuleId"), ("AtiL2-MIB", "atiL2TrapAttrPortId")) if mibBuilder.loadTexts: atiL2IntruderAlert.setDescription(' A Trap sent from the specified module and specified port when an intruder has been detected.') atiL2QOSStatus = MibScalar((1, 3, 6, 1, 4, 1, 207, 8, 33, 12, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2QOSStatus.setStatus('mandatory') if mibBuilder.loadTexts: atiL2QOSStatus.setDescription('If the QOS status is enabled, then QOS packets will be assigned to high or low priority queue. If it is disabled, packets works normally.(Applicable only to at-8326GB, at-9410GB and at-8350GB)') atiL2TrafficMappingTable = MibTable((1, 3, 6, 1, 4, 1, 207, 8, 33, 12, 2), ) if mibBuilder.loadTexts: atiL2TrafficMappingTable.setStatus('mandatory') if mibBuilder.loadTexts: atiL2TrafficMappingTable.setDescription('It contains the mapping of all traffic classes and their priority assignments.(Applicable only to at-8326GB, at-9410GB and at-8350GB)') atiL2TrafficMappingEntry = MibTableRow((1, 3, 6, 1, 4, 1, 207, 8, 33, 12, 2, 1), ).setIndexNames((0, "AtiL2-MIB", "atiL2TrafficClassIndex")) if mibBuilder.loadTexts: atiL2TrafficMappingEntry.setStatus('mandatory') if mibBuilder.loadTexts: atiL2TrafficMappingEntry.setDescription("Each entry maps a traffic class to the priority queue to be used for it's packets. (Applicable only to at-8326GB, at-9410GB and at-8350GB)") atiL2TrafficClassIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 12, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readonly") if mibBuilder.loadTexts: atiL2TrafficClassIndex.setStatus('mandatory') if mibBuilder.loadTexts: atiL2TrafficClassIndex.setDescription('The Index of the traffic class. It is obtained from the packet format.(Applicable only to at-8326GB, at-9410GB and at-8350GB)') atiL2PriorityQueue = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 33, 12, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("highest", 0), ("lowest", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: atiL2PriorityQueue.setStatus('mandatory') if mibBuilder.loadTexts: atiL2PriorityQueue.setDescription('The priority queue to be used to forward packets. (Applicable only to at-8326GB, at-9410GB and at-8350GB)') mibBuilder.exportSymbols("AtiL2-MIB", atiL2DHCPGroup=atiL2DHCPGroup, atiL2BrStp=atiL2BrStp, atiL2BeVlanModule6UntaggedPorts=atiL2BeVlanModule6UntaggedPorts, atiL2BrTpPortLanId=atiL2BrTpPortLanId, atiL2PriorityQueue=atiL2PriorityQueue, atiL2EthErrorStatsEntry=atiL2EthErrorStatsEntry, atiL2EthMonTxBroadcastFrames=atiL2EthMonTxBroadcastFrames, atiL2FanStopTrap=atiL2FanStopTrap, atiL2BrStpPortTable=atiL2BrStpPortTable, atiL2EthPortMonModuleId=atiL2EthPortMonModuleId, atiL2deviceIndex=atiL2deviceIndex, atiL2EthPortMonTxMulticastFrames=atiL2EthPortMonTxMulticastFrames, atiL2EthPortErrorCRC=atiL2EthPortErrorCRC, atiL2BrStpTopChanges=atiL2BrStpTopChanges, atiL2BrTpPortEntry=atiL2BrTpPortEntry, atiL2BrStpBridgeHelloTime=atiL2BrStpBridgeHelloTime, atiL2BrTpPortInDiscards=atiL2BrTpPortInDiscards, atiL2DevicePortAutosenseOrHalfDuplex=atiL2DevicePortAutosenseOrHalfDuplex, atiL2TrafficMappingEntry=atiL2TrafficMappingEntry, atiIfExtnModuleId=atiIfExtnModuleId, atiL2DHCPLeaseTimer=atiL2DHCPLeaseTimer, atiL2BrTpLearnedEntryDiscards=atiL2BrTpLearnedEntryDiscards, atiL2DevicePortEntry=atiL2DevicePortEntry, atiL2DevicePortState=atiL2DevicePortState, atiL2EthPortErrorStatsEntry=atiL2EthPortErrorStatsEntry, atiL2DevicePortVlanTagPriorityConfig=atiL2DevicePortVlanTagPriorityConfig, atiL2BrStpDesignatedRoot=atiL2BrStpDesignatedRoot, atiL2EthPortMonRxGoodFrames=atiL2EthPortMonRxGoodFrames, at_8316F=at_8316F, atiL2SwVersion=atiL2SwVersion, atiL2DHCPSysGroup=atiL2DHCPSysGroup, atiL2DeviceId=atiL2DeviceId, atiL2BrStpRootPort=atiL2BrStpRootPort, mibObject=mibObject, atiL2EthPortMonTxGoodFrames=atiL2EthPortMonTxGoodFrames, atiL2EthPortErrorLateCollisions=atiL2EthPortErrorLateCollisions, topologyChange=topologyChange, at_9410GB=at_9410GB, atiL2BrStpPortState=atiL2BrStpPortState, atiL2DevicePortName=atiL2DevicePortName, atiL2BrStpLanId=atiL2BrStpLanId, atiL2BrBaseLanId=atiL2BrBaseLanId, atiL2BeVlanModule8TaggedPorts=atiL2BeVlanModule8TaggedPorts, atiL2NwMgrIpAddr=atiL2NwMgrIpAddr, newRoot=newRoot, atiL2TemperatureAbnormalTrap=atiL2TemperatureAbnormalTrap, atiL2EthMonTxTotalBytes=atiL2EthMonTxTotalBytes, atiL2BrStpPortForwardTransitions=atiL2BrStpPortForwardTransitions, atiL2DevicePortSTPCost=atiL2DevicePortSTPCost, atiL2BrStpTimeSinceTopologyChange=atiL2BrStpTimeSinceTopologyChange, atiL2deviceDescr=atiL2deviceDescr, atiL2BeVlanModule5TaggedPorts=atiL2BeVlanModule5TaggedPorts, atiL2NwMgrEntry=atiL2NwMgrEntry, atiL2TrapAttrPortId=atiL2TrapAttrPortId, atiL2GlobalGroup=atiL2GlobalGroup, atiL2BeVlanModule5UntaggedPorts=atiL2BeVlanModule5UntaggedPorts, atiL2PvPortNumber=atiL2PvPortNumber, atiL2BrTpPortInFrames=atiL2BrTpPortInFrames, atiL2deviceSecurityAction=atiL2deviceSecurityAction, alliedTelesyn=alliedTelesyn, atiL2EthPortMonRxOverruns=atiL2EthPortMonRxOverruns, atiL2BeVlanModule2UntaggedPorts=atiL2BeVlanModule2UntaggedPorts, atiL2BrStpMaxAge=atiL2BrStpMaxAge, atiL2DHCPTimerGroup=atiL2DHCPTimerGroup, atiL2QOSStatus=atiL2QOSStatus, atiL2TrafficMappingTable=atiL2TrafficMappingTable, atiL2BrBasePortCircuit=atiL2BrBasePortCircuit, atiL2DNServer=atiL2DNServer, atiL2DevicePortQOSPriorityConfig=atiL2DevicePortQOSPriorityConfig, atiL2ConfiguredRouter=atiL2ConfiguredRouter, atiL2ConfiguredSubnetMask=atiL2ConfiguredSubnetMask, atiL2EthPortErrPortId=atiL2EthPortErrPortId, atiL2DevicePortTable=atiL2DevicePortTable, atiL2IfExt=atiL2IfExt, atiL2DevicePortSTPPriority=atiL2DevicePortSTPPriority, atiL2IntruderAlert=atiL2IntruderAlert, atiL2VlanConfigGroup=atiL2VlanConfigGroup, atiL2EthErrorAlignment=atiL2EthErrorAlignment, atiL2BrStpPortDesignatedCost=atiL2BrStpPortDesignatedCost, atiL2BeVlanModule2TaggedPorts=atiL2BeVlanModule2TaggedPorts, atiIfExtnEntry=atiIfExtnEntry, atiL2BrBasePortTable=atiL2BrBasePortTable, atiL2SwProduct=atiL2SwProduct, atiL2BrStpBridgeForwardDelay=atiL2BrStpBridgeForwardDelay, atiL2Reset=atiL2Reset, atiL2PvModuleId=atiL2PvModuleId, atiL2BridgeMib=atiL2BridgeMib, atiL2BeVlanModule1TaggedPorts=atiL2BeVlanModule1TaggedPorts, atiL2deviceDebugAvailableBytes=atiL2deviceDebugAvailableBytes, atiL2BrTpAgingTime=atiL2BrTpAgingTime, atiL2IPAddressStatus=atiL2IPAddressStatus, atiL2DeviceGroup=atiL2DeviceGroup, at_8350GB=at_8350GB, atiL2CurrentIpAddress=atiL2CurrentIpAddress, atiL2BrTpFdbAddress=atiL2BrTpFdbAddress, atiL2BeVlanModule4UntaggedPorts=atiL2BeVlanModule4UntaggedPorts, atiL2DevicePortSTPConfig=atiL2DevicePortSTPConfig, atiL2BeVlanTagId=atiL2BeVlanTagId, atiL2BrBaseNumPorts=atiL2BrBaseNumPorts, atiL2BrTpFdbEntry=atiL2BrTpFdbEntry, atiL2BrStpTable=atiL2BrStpTable, atiL2BrTpPortTable=atiL2BrTpPortTable, atiL2BrStpHelloTime=atiL2BrStpHelloTime, atiL2BrBasePortMtuExceededDiscards=atiL2BrBasePortMtuExceededDiscards, atiL2EthPortMonStatsTable=atiL2EthPortMonStatsTable, atiL2DHCPSubnetMask=atiL2DHCPSubnetMask, atiL2BeVlanModule8UntaggedPorts=atiL2BeVlanModule8UntaggedPorts, atiL2PowerSupplyOutage=atiL2PowerSupplyOutage, atiL2BrTpPortMaxInfo=atiL2BrTpPortMaxInfo, atiL2deviceSecurityConfig=atiL2deviceSecurityConfig, atiL2DevicePortNumber=atiL2DevicePortNumber, atiL2BrBasePortLanId=atiL2BrBasePortLanId, atiL2BasicVlanEntry=atiL2BasicVlanEntry, atiL2BrStpEntry=atiL2BrStpEntry, atiL2deviceTable=atiL2deviceTable, atiL2DevicePortConfigGroup=atiL2DevicePortConfigGroup, atiL2BrStpPortDesignatedBridge=atiL2BrStpPortDesignatedBridge, atiL2BeVlanModule7UntaggedPorts=atiL2BeVlanModule7UntaggedPorts, atiL2IpGroup=atiL2IpGroup, atiL2QOSConfigGroup=atiL2QOSConfigGroup, atiL2DHCPCurrentRelayAgentAddress=atiL2DHCPCurrentRelayAgentAddress, atiL2EthErrStatsTable=atiL2EthErrStatsTable, atiL2EthErrorLateCollisions=atiL2EthErrorLateCollisions, atiProduct=atiProduct, atiL2EthPortErrModuleId=atiL2EthPortErrModuleId, atiL2BrTp=atiL2BrTp, atiL2BeVlanIndex=atiL2BeVlanIndex, atiL2BrStpPort=atiL2BrStpPort, atiL2BrBaseTable=atiL2BrBaseTable, atiL2BrBasePortIfIndex=atiL2BrBasePortIfIndex, at_8124XL_V2=at_8124XL_V2, atiL2DeviceNumber=atiL2DeviceNumber, atiL2DevicePortSpeed=atiL2DevicePortSpeed, atiL2BeVlanModule6TaggedPorts=atiL2BeVlanModule6TaggedPorts, atiL2TrapAttrGroup=atiL2TrapAttrGroup, atiL2NMGroup=atiL2NMGroup, atiL2EthErrStatsGroup=atiL2EthErrStatsGroup, atiL2EthErrorTxTotal=atiL2EthErrorTxTotal, atiL2BrBase=atiL2BrBase, atiL2BrTpTable=atiL2BrTpTable, atiL2deviceMDA2Type=atiL2deviceMDA2Type, atiL2ConfiguredIpAddress=atiL2ConfiguredIpAddress, atiL2BeVlanModule3UntaggedPorts=atiL2BeVlanModule3UntaggedPorts, at_8326GB=at_8326GB, atiL2BeVlanName=atiL2BeVlanName, atiL2MirroringDestinationPort=atiL2MirroringDestinationPort, at_8324=at_8324, atiL2MirrorState=atiL2MirrorState, atiL2EthPortMonPortId=atiL2EthPortMonPortId, atiL2PvVlanName=atiL2PvVlanName, atiIfExtnPort=atiIfExtnPort, atiL2BrBasePortEntry=atiL2BrBasePortEntry, atiL2TrapAttrModuleId=atiL2TrapAttrModuleId, atiL2BrStpPortDesignatedPort=atiL2BrStpPortDesignatedPort, atiL2BrStpPortPathCost=atiL2BrStpPortPathCost, atiL2BrTpFdbStatus=atiL2BrTpFdbStatus, atiL2DevicePortBackPressureEnable=atiL2DevicePortBackPressureEnable, atiL2EthMonStatsGroup=atiL2EthMonStatsGroup, atiIfExtnIndex=atiIfExtnIndex, atiL2EthMonModuleId=atiL2EthMonModuleId, MacAddress=MacAddress, atiL2BrBaseBridgeAddress=atiL2BrBaseBridgeAddress, atiL2BrTpPort=atiL2BrTpPort, atiL2deviceMDA1Type=atiL2deviceMDA1Type, atiL2BrTpLanId=atiL2BrTpLanId, atiL2EthMonTxCollisions=atiL2EthMonTxCollisions, atiL2deviceProductType=atiL2deviceProductType, atiL2MirroringSourceModule=atiL2MirroringSourceModule, atiL2DevicePortTransmitPacingConfig=atiL2DevicePortTransmitPacingConfig, atiL2IfExtensions=atiL2IfExtensions, atiL2DHCPExpirationTimer=atiL2DHCPExpirationTimer, atiL2EthMonTxGoodFrames=atiL2EthMonTxGoodFrames, atiL2EthPortMonTxTotalBytes=atiL2EthPortMonTxTotalBytes, atiL2BrBaseEntry=atiL2BrBaseEntry, Timeout=Timeout, atiL2deviceEntry=atiL2deviceEntry, atiL2EthPortErrorTxTotal=atiL2EthPortErrorTxTotal, atiL2EthMonTxDeferred=atiL2EthMonTxDeferred, atiL2DevicePortFlowControlEnable=atiL2DevicePortFlowControlEnable, atiL2BrStpRootCost=atiL2BrStpRootCost, atiL2BeVlanModule7TaggedPorts=atiL2BeVlanModule7TaggedPorts, atiL2IGMPState=atiL2IGMPState, atiL2BeVlanModule1UntaggedPorts=atiL2BeVlanModule1UntaggedPorts, atiL2BeVlanModule3TaggedPorts=atiL2BeVlanModule3TaggedPorts, atiL2DHCPReacquisitionTimer=atiL2DHCPReacquisitionTimer, atiL2BrTpPortOutFrames=atiL2BrTpPortOutFrames, atiL2EthPortMonTxCollisions=atiL2EthPortMonTxCollisions, atiL2BrStpPortEntry=atiL2BrStpPortEntry, atiL2BrStpPortDesignatedRoot=atiL2BrStpPortDesignatedRoot, atiL2DHCPCurrentDHCPClientAddress=atiL2DHCPCurrentDHCPClientAddress, atiL2MirroringSourcePort=atiL2MirroringSourcePort, atiL2EthMonRxOverruns=atiL2EthMonRxOverruns, atiL2BrBasePortDelayExceededDiscards=atiL2BrBasePortDelayExceededDiscards, atiL2BrStpHoldTime=atiL2BrStpHoldTime, atiL2NwMgrTable=atiL2NwMgrTable, atiL2BrStpPortEnable=atiL2BrStpPortEnable, atiL2BeVlanRowStatus=atiL2BeVlanRowStatus, atiL2EthPortMonStatsEntry=atiL2EthPortMonStatsEntry, atiL2EthPortErrorRxBadFrames=atiL2EthPortErrorRxBadFrames, atiIfExtnTable=atiIfExtnTable, atiL2BrStpPortLanId=atiL2BrStpPortLanId, atiL2BrStpProtocolSpecification=atiL2BrStpProtocolSpecification, atiL2BrTpFdbLanId=atiL2BrTpFdbLanId, atiL2BeVlanModule4TaggedPorts=atiL2BeVlanModule4TaggedPorts, atiL2NwMgrIndex=atiL2NwMgrIndex, atiL2Port2VlanTable=atiL2Port2VlanTable, atiL2EthPortMonTxDeferred=atiL2EthPortMonTxDeferred, atiL2EthErrorCRC=atiL2EthErrorCRC, atiL2BrStpBridgeMaxAge=atiL2BrStpBridgeMaxAge, atiL2BrStpPortPriority=atiL2BrStpPortPriority, atiL2EthPortMonTxBroadcastFrames=atiL2EthPortMonTxBroadcastFrames, atiL2EthErrorRxBadFrames=atiL2EthErrorRxBadFrames, atiL2DefaultDomainName=atiL2DefaultDomainName, BridgeId=BridgeId, atiL2EthPortErrorAlignment=atiL2EthPortErrorAlignment, atiL2BrBaseType=atiL2BrBaseType, atiL2BrBasePort=atiL2BrBasePort, atiL2EthPortErrStatsTable=atiL2EthPortErrStatsTable, atiL2BrTpFdbTable=atiL2BrTpFdbTable, atiL2BrTpEntry=atiL2BrTpEntry, atiL2BrStpForwardDelay=atiL2BrStpForwardDelay, atiL2devicePortCount=atiL2devicePortCount, atiL2BrStpPriority=atiL2BrStpPriority, swhub=swhub, atiL2DHCPNextDHCPServerAddress=atiL2DHCPNextDHCPServerAddress, atiL2EthernetStatsGroup=atiL2EthernetStatsGroup, atiL2EthMonStatsEntry=atiL2EthMonStatsEntry, atiL2EthMonRxGoodFrames=atiL2EthMonRxGoodFrames, atiL2EthErrModuleId=atiL2EthErrModuleId, atiL2Port2VlanEntry=atiL2Port2VlanEntry, atiL2TrafficClassIndex=atiL2TrafficClassIndex, atiL2deviceReset=atiL2deviceReset, atiL2EthMonStatsTable=atiL2EthMonStatsTable, atiL2Mib=atiL2Mib, atiL2DevicePortDuplexStatus=atiL2DevicePortDuplexStatus, atiL2EthMonTxMulticastFrames=atiL2EthMonTxMulticastFrames, atiL2BasicVlanTable=atiL2BasicVlanTable, atiL2DevicePortLinkState=atiL2DevicePortLinkState, atiL2DevicePortBridgeid=atiL2DevicePortBridgeid, atiL2MirroringDestinationModule=atiL2MirroringDestinationModule, atiL2BrTpFdbPort=atiL2BrTpFdbPort)
162.041135
10,780
0.792882
14,507
114,239
6.242021
0.076377
0.058441
0.102272
0.010513
0.535653
0.415569
0.371197
0.3544
0.332822
0.292525
0
0.066006
0.102706
114,239
704
10,781
162.271307
0.817386
0.002731
0
0
0
0.128242
0.378281
0.007058
0
0
0
0
0
1
0
false
0.002882
0.008646
0
0.018732
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
5a5b707e0aeb24e9a10e367ad713f9184a85bf1c
2,111
py
Python
neural_pi/utils.py
tarik/pi-snm-qde
61b0d60b5e7a56454d313693c2d1a9694879f1dc
[ "MIT" ]
8
2020-08-05T18:02:20.000Z
2022-03-16T17:41:13.000Z
neural_pi/utils.py
tarik/pi-snm-qde
61b0d60b5e7a56454d313693c2d1a9694879f1dc
[ "MIT" ]
1
2021-05-17T15:43:22.000Z
2021-07-12T20:29:12.000Z
neural_pi/utils.py
tarik/pi-snm-qde
61b0d60b5e7a56454d313693c2d1a9694879f1dc
[ "MIT" ]
1
2021-12-10T12:20:24.000Z
2021-12-10T12:20:24.000Z
import os import torch import pandas as pd import numpy as np import datetime from tabulate import tabulate def get_timestamp(): return datetime.datetime.now().strftime("%Y%m%d-%H%M%S") def rename(name): """ Sets a new `__name__`. """ def decorator(f): f.__name__ = name return f return decorator def print_df(df, table_format='fancy_grid'): print(tabulate(df, headers='keys', tablefmt=table_format)) def dict_to_dataframe(obj): return pd.DataFrame(obj).T def save_predictions(y_preds, y_test, r_shuffle, r_seed, output_dir): """ `pd.read_csv(file_path, header=[0, 1], index_col=0)` """ r_preds_dfs = [] for rp in y_preds: r_preds_dfs.append(pd.DataFrame(data=rp, columns=['y_l', 'y_u', 'y_p'])) r_preds_dfs.append(pd.DataFrame(data=y_test, columns=['y_t'])) y_preds = pd.concat(r_preds_dfs, axis=1, keys=range(len(r_preds_dfs))) output_path = os.path.join(output_dir, '%d_%d_predictions.csv' % (r_shuffle, r_seed)) y_preds.to_csv(output_path) def torch_to_numpy(dict_): for key, value in dict_.items(): if isinstance(value, torch.Tensor): dict_[key] = value.cpu().numpy() return dict_ class Timer: def __init__(self): self._start_time = None self._stop_time = None def start(self): self._start_time = self._now() self._stop_time = None return self def stop(self): self._stop_time = self._now() return self def reset(self): self._start_time = None self._stop_time = None return self def duration(self, decimals=1): stop_time = self._stop_time or self._now() return np.round((stop_time - self._start_time).total_seconds(), decimals) @staticmethod def _now(): return datetime.datetime.now() @property def start_time(self): return self._start_time @property def stop_time(self): return self._stop_time def print_time(string_in): print(string_in, '\t -- ', datetime.datetime.now().strftime('%H:%M:%S'))
23.455556
89
0.641402
308
2,111
4.090909
0.327922
0.057143
0.057143
0.040476
0.139683
0.139683
0.139683
0.05873
0.05873
0
0
0.003077
0.230223
2,111
89
90
23.719101
0.772308
0.035528
0
0.169492
0
0
0.036908
0.010474
0
0
0
0
0
1
0.271186
false
0
0.101695
0.084746
0.59322
0.067797
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2