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
34fae8de500f0fefa1f47e343071d4f10241d272
229
py
Python
__main__.py
Luke-zhang-04/powercord-plugin-emojify
8713f048fb6da160cfdc7d2e7e7aa925eeaaf79e
[ "MIT" ]
null
null
null
__main__.py
Luke-zhang-04/powercord-plugin-emojify
8713f048fb6da160cfdc7d2e7e7aa925eeaaf79e
[ "MIT" ]
null
null
null
__main__.py
Luke-zhang-04/powercord-plugin-emojify
8713f048fb6da160cfdc7d2e7e7aa925eeaaf79e
[ "MIT" ]
null
null
null
import scraper.scraper as scraper import scraper.parser as parser import sys from dotenv import load_dotenv load_dotenv() if __name__ == "__main__": if "--noScrape" not in sys.argv: scraper.main() parser.main()
19.083333
36
0.716157
32
229
4.8125
0.46875
0.168831
0
0
0
0
0
0
0
0
0
0
0.19214
229
11
37
20.818182
0.832432
0
0
0
0
0
0.078603
0
0
0
0
0
0
1
0
true
0
0.444444
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
1
0
1
0
0
0
0
2
550d6f4bd6f869c618dd2e2fd54a7578116878b5
1,728
py
Python
exercises/rational-numbers/rational_numbers.py
southpush/python
048191583ed2cf668c6180d851d100f277a74101
[ "MIT" ]
null
null
null
exercises/rational-numbers/rational_numbers.py
southpush/python
048191583ed2cf668c6180d851d100f277a74101
[ "MIT" ]
null
null
null
exercises/rational-numbers/rational_numbers.py
southpush/python
048191583ed2cf668c6180d851d100f277a74101
[ "MIT" ]
null
null
null
from __future__ import division class Rational(object): def __init__(self, numer, denom): if denom == 0: raise ValueError('denom should not be 0') i = 2 while i <= abs(numer): if numer % i == 0 and denom % i == 0: numer = numer // i denom = denom // i else: i += 1 if numer * denom < 0: self.numer = -abs(numer) self.denom = abs(denom) else: self.numer = abs(numer) self.denom = abs(denom) def __eq__(self, other): if self.numer == 0 and other.numer == 0: return True return self.numer == other.numer and self.denom == other.denom def __repr__(self): return '{}/{}'.format(self.numer, self.denom) def __add__(self, other): return Rational(self.numer * other.denom + other.numer * self.denom, self.denom * other.denom) def __sub__(self, other): return Rational(self.numer * other.denom - other.numer * self.denom, self.denom * other.denom) def __mul__(self, other): return Rational(self.numer * other.numer, self.denom * other.denom) def __truediv__(self, other): if self.denom * other.numer != 0: return Rational(self.numer * other.denom, self.denom * other.numer) else: raise ValueError() def __abs__(self): return Rational(abs(self.numer), abs(self.denom)) def __pow__(self, power): return Rational(self.numer ** power, self.denom ** power) if power > 0 else Rational(self.denom ** -power, self.numer ** -power) def __rpow__(self, base): return base ** (self.numer / self.denom)
32.603774
136
0.567708
216
1,728
4.337963
0.185185
0.144077
0.104589
0.122732
0.371398
0.32444
0.289221
0.249733
0.177161
0.177161
0
0.009236
0.310764
1,728
52
137
33.230769
0.777498
0
0
0.121951
0
0
0.015046
0
0
0
0
0
0
1
0.243902
false
0
0.02439
0.170732
0.536585
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
9b2edfe2e18a8a45ebbb7dd7d27ff5218861d483
1,203
py
Python
src/sample-scripts/solved_problems/Examples test_compare/make_prop.py
hpgl/hpgl
72d8c4113c242295de740513093f5779c94ba84a
[ "BSD-3-Clause" ]
70
2015-01-21T12:24:50.000Z
2022-03-16T02:10:45.000Z
src/sample-scripts/solved_problems/Examples test_compare/make_prop.py
hpgl/hpgl
72d8c4113c242295de740513093f5779c94ba84a
[ "BSD-3-Clause" ]
8
2015-04-22T13:14:30.000Z
2021-11-23T12:16:32.000Z
src/sample-scripts/solved_problems/Examples test_compare/make_prop.py
hpgl/hpgl
72d8c4113c242295de740513093f5779c94ba84a
[ "BSD-3-Clause" ]
18
2015-02-15T18:04:31.000Z
2021-01-16T08:54:32.000Z
from geo import * from geo.routines import * from matplotlib import * from sys import * from pylab import * import os import time import pylab size = (166, 141, 20) print "loading image..." data_3D = load_ind_property("BIG_SOFT_DATA_160_141_20.INC", -99, [0,1], size) data = data_3D[0][:,:,0] mask = data_3D[1][:,:,0] figure() pylab.imshow(data[:,:], vmin = 0, vmax = 2) pylab.savefig("hard_data") #initial_data = copy(data) # test with 98% of harddata #n = 0.995 # for i in xrange(size[0]): # for j in xrange(size[1]): # value = numpy.random.uniform() # if (value < n): # mask[i,j] = 0 # data[i,j] = -99 # initial_data[i,j] = -99 # for i in xrange(size[0]): # for j in xrange(size[1]): # if (mask[i,j] <> 0): # if (initial_data[i,j] <> -99): # initial_data[i,j] = float32(numpy.random.normal(4.0, 1.0)) # for i in xrange(size[0]): # for j in xrange(size[1]): # if (initial_data[i,j] <> -99): # initial_data[i,j] = abs(initial_data[i,j,0]) / initial_data.max() prop = (data, mask, 2) write_property(prop, "IND_data.INC", "Ind_data", -99) # write_property((initial_data, mask), "CONT_data.INC", "Cont_data", -99)
24.06
78
0.60266
201
1,203
3.477612
0.313433
0.141631
0.060086
0.111588
0.267525
0.264664
0.264664
0.264664
0.234621
0.234621
0
0.066107
0.207814
1,203
49
79
24.55102
0.667366
0.496259
0
0
0
0
0.13594
0.052142
0
0
0
0
0
0
null
null
0
0.444444
null
null
0.055556
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
2
9b37765b1ebe35daf9d92813e7199c416682ab3a
1,313
py
Python
modules/investigate/investigate.py
geekpy03/pgn-tactics-generator
a0509ec412b7163526aba3d29220b87d9cf7f688
[ "MIT" ]
68
2018-09-09T17:55:30.000Z
2022-03-28T17:04:43.000Z
modules/investigate/investigate.py
geekpy03/pgn-tactics-generator
a0509ec412b7163526aba3d29220b87d9cf7f688
[ "MIT" ]
31
2018-09-07T19:32:27.000Z
2022-01-25T13:25:29.000Z
modules/investigate/investigate.py
geekpy03/pgn-tactics-generator
a0509ec412b7163526aba3d29220b87d9cf7f688
[ "MIT" ]
20
2019-03-11T09:52:14.000Z
2022-02-23T05:37:31.000Z
import chess from chess import Board from chess.engine import Score def sign(a): return (a > 0) - (a < 0) def material_value(board): return sum(v * (len(board.pieces(pt, True)) + len(board.pieces(pt, False))) for v, pt in zip([0, 3, 3, 5.5, 9], chess.PIECE_TYPES)) def material_count(board): return chess.popcount(board.occupied) def investigate(a: Score, b: Score, board: Board): """ determine if the difference between position A and B is worth investigating for a puzzle. """ a_cp, a_mate = a.score(), a.mate() b_cp, b_mate = b.score(), b.mate() if a_cp is not None and b_cp is not None: if (((-110 < a_cp < 850 and 200 < b_cp < 850) or (-850 < a_cp < 110 and -200 > b_cp > -850)) and material_value(board) > 3 and material_count(board) > 6): return True elif a_cp is not None and b_mate is not None and material_value(board) > 3: if (a_cp < 110 and sign(b_mate) == -1) or (a_cp > -110 and sign(b_mate) == 1): # from an even position, walking int a checkmate return True elif a_mate is not None and b_mate is not None: if sign(a_mate) == sign(b_mate): # actually means that they're opposite return True return False
32.02439
92
0.599391
216
1,313
3.523148
0.305556
0.027595
0.070959
0.063075
0.237845
0.143233
0.143233
0.118265
0.068331
0
0
0.046137
0.290175
1,313
40
93
32.825
0.770386
0.132521
0
0.115385
0
0
0
0
0
0
0
0
0
1
0.153846
false
0
0.115385
0.115385
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
0
1
1
0
0
2
9b3e5ba25f6539f2d54fc3ee309eb76f77501061
1,435
py
Python
editor/plugins/example_app_keys.py
albertvisser/hotkeys
73b2b10af326a37e4ae01294f44cd855ccb3ab99
[ "MIT" ]
1
2019-11-03T08:28:59.000Z
2019-11-03T08:28:59.000Z
editor/plugins/example_app_keys.py
albertvisser/hotkeys
73b2b10af326a37e4ae01294f44cd855ccb3ab99
[ "MIT" ]
null
null
null
editor/plugins/example_app_keys.py
albertvisser/hotkeys
73b2b10af326a37e4ae01294f44cd855ccb3ab99
[ "MIT" ]
null
null
null
"""Hotkeys plugin example this module contains the general, non gui-toolkit specific part of the code """ # uncomment these where appropriate # import collections # from example_app_keys_gui import layout_extra_fields_* # om dit beschikbaar te maken voor import # uncomment this to define a routine to (re)build the csv file from source data # showinfo is a switch for in case you want to show instructions # otherstuff can be used to pass on things like a list of possible commands # to method add_extra_attributes # ** corresponds to the RebuildCSV setting ** # def buildcsv(parent, showinfo=True): # shortcuts = collections.defaultdict() # otherstuff = {} # ...implement some logic here... # return shortcuts, otherstuff # uncomment these to define routines to be used by methods of a HotKeyPanel instance # ** corresponds to the ShowDetails setting ** # win is a reference to the HotKeyPanel instance # def add_extra_attributes(win): # """add attributes specific to this plugin # e.g a shorter name for a collection read from buildcsv's otherstuff # some of these are needed when filling fields in the details part of the screen # """ # win.contextslist = win.otherstuff['...'] # win.commandslist = win.otherstuff['...'] # uncomment this to define a routine to write back the keydefs to the source data # ** corresponds to the RedefineKeys setting ** # def savekeys(parent): # pass
41
99
0.738676
203
1,435
5.172414
0.536946
0.02381
0.045714
0.04
0.059048
0.059048
0.059048
0
0
0
0
0
0.18885
1,435
34
100
42.205882
0.902062
0.954704
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
9b4f6caa8f4e00e79f672af5d86d90e4902524c8
548
py
Python
app/users/__init__.py
niross/ftrack
73196f8b72f52ad04fe67ffa2bd830e058ceaf7f
[ "MIT" ]
null
null
null
app/users/__init__.py
niross/ftrack
73196f8b72f52ad04fe67ffa2bd830e058ceaf7f
[ "MIT" ]
null
null
null
app/users/__init__.py
niross/ftrack
73196f8b72f52ad04fe67ffa2bd830e058ceaf7f
[ "MIT" ]
null
null
null
from flask import Blueprint from flask_security import SQLAlchemyUserDatastore from app import db from app.users.models import User, Role bp = Blueprint('users', __name__, template_folder='templates') user_datastore = SQLAlchemyUserDatastore(db, User, Role) # Create a user to test with @bp.before_app_first_request def create_user(): db.create_all() if User.query.filter_by(email='[email protected]').count() == 0: user_datastore.create_user(email='[email protected]', password='password') db.session.commit()
28.842105
86
0.755474
76
548
5.25
0.526316
0.045113
0.065163
0.100251
0.115288
0
0
0
0
0
0
0.00211
0.135037
548
18
87
30.444444
0.839662
0.047445
0
0
0
0
0.123077
0.080769
0
0
0
0
0
1
0.083333
false
0.083333
0.333333
0
0.416667
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
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
0
0
0
2
9b65e671e782ba8045e5362d7f2aa0daf9d92725
716
py
Python
tests/factory_fixtures/notes.py
codeforpdx/dwellinglybackend
92fee6d19a68ae00750927b8700eaa7195b57668
[ "MIT" ]
15
2020-07-09T20:51:09.000Z
2021-11-28T21:59:02.000Z
tests/factory_fixtures/notes.py
codeforpdx/dwellinglybackend
92fee6d19a68ae00750927b8700eaa7195b57668
[ "MIT" ]
148
2020-03-28T22:10:30.000Z
2021-12-19T09:22:59.000Z
tests/factory_fixtures/notes.py
codeforpdx/dwellinglybackend
92fee6d19a68ae00750927b8700eaa7195b57668
[ "MIT" ]
30
2020-03-12T02:31:27.000Z
2021-07-29T02:40:36.000Z
import pytest from models.notes import NotesModel from schemas.notes import NotesSchema from tests.attributes import note_attrs @pytest.fixture def note_attributes(faker): def _note_attributes(text, user, ticket): return {**note_attrs(faker, text), "user_id": user.id, "ticket_id": ticket.id} yield _note_attributes @pytest.fixture def create_note(faker, note_attributes, create_admin_user, create_ticket): def _create_note(user=None, ticket=None, text=None): user = user or create_admin_user() ticket = ticket or create_ticket() return NotesModel.create( schema=NotesSchema, payload=note_attributes(text, user, ticket) ) yield _create_note
27.538462
86
0.726257
93
716
5.354839
0.290323
0.140562
0.064257
0.088353
0.11245
0
0
0
0
0
0
0
0.187151
716
25
87
28.64
0.85567
0
0
0.111111
0
0
0.022346
0
0
0
0
0
0
1
0.222222
false
0
0.222222
0.055556
0.555556
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
9b695e220684cc34d44b4b158affb4987027de4f
213
py
Python
test/test_hook.py
mudox/pytav
4124628c45ffd3fc35913d781278eb349d9c8559
[ "MIT" ]
null
null
null
test/test_hook.py
mudox/pytav
4124628c45ffd3fc35913d781278eb349d9c8559
[ "MIT" ]
null
null
null
test/test_hook.py
mudox/pytav
4124628c45ffd3fc35913d781278eb349d9c8559
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from tav.tmux import hook def test_hook_suppression(): hook.disable('testing') assert not hook.isEnabled() hook.enable('testing') assert hook.isEnabled()
16.384615
29
0.690141
29
213
5
0.724138
0.17931
0
0
0
0
0
0
0
0
0
0.01105
0.150235
213
12
30
17.75
0.790055
0.201878
0
0
0
0
0.083333
0
0
0
0
0
0.333333
1
0.166667
true
0
0.166667
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
9b70b9748dd8ac6b70d6284121fe398a2d54b264
367
py
Python
ScratchPad/TestSendWeb.py
jdzawodniak/TempMonitorWeb
280ce2612af9125967b8113d50df945eaf532a5b
[ "MIT" ]
null
null
null
ScratchPad/TestSendWeb.py
jdzawodniak/TempMonitorWeb
280ce2612af9125967b8113d50df945eaf532a5b
[ "MIT" ]
null
null
null
ScratchPad/TestSendWeb.py
jdzawodniak/TempMonitorWeb
280ce2612af9125967b8113d50df945eaf532a5b
[ "MIT" ]
null
null
null
# Imports import requests import os import sys import lcddriver import time import datetime import RPi.GPIO as GPIO import dht11 thingspeak_key = 'ZHAO5MQEKA0B93P7' temperature = 23 humidity = 35 # Send the data to Thingspeak r = requests.post('https://api.thingspeak.com/update.json', data = {'api_key':thingspeak_key, 'field1':temperature, 'field2':humidity})
19.315789
135
0.771117
50
367
5.6
0.64
0.092857
0
0
0
0
0
0
0
0
0
0.040752
0.13079
367
19
135
19.315789
0.836991
0.095368
0
0
0
0
0.221212
0
0
0
0
0
0
1
0
false
0
0.666667
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
0
0
0
1
0
1
0
0
2
9b7acf5a00804730593a41046352d93d47c45b81
4,006
py
Python
suspect/dag/expressions.py
michaelbynum/suspect
efbfbc4a004d8e167fd4a7247b465b6569818433
[ "Apache-2.0" ]
14
2018-07-10T20:15:15.000Z
2022-02-10T09:55:45.000Z
suspect/dag/expressions.py
michaelbynum/suspect
efbfbc4a004d8e167fd4a7247b465b6569818433
[ "Apache-2.0" ]
9
2019-10-11T15:27:15.000Z
2021-08-13T12:28:52.000Z
suspect/dag/expressions.py
michaelbynum/suspect
efbfbc4a004d8e167fd4a7247b465b6569818433
[ "Apache-2.0" ]
4
2019-10-07T14:57:31.000Z
2021-08-20T19:17:53.000Z
# Copyright 2017 Francesco Ceccon # # 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 enum import Enum import abc import sys from suspect.math import inf # pylint: disable=no-name-in-module class Domain(Enum): """The variable domain""" REALS = 0 INTEGERS = 1 BINARY = 2 class Sense(Enum): """The objective function sense""" MINIMIZE = 0 MAXIMIZE = 1 class Expression(metaclass=abc.ABCMeta): """The base class for all expressions objects in the DAG""" is_source = False is_sink = False def __init__(self, children=None): if children is None: children = [] self._children = children @property def args(self): return self._children @property def args(self): return self._children def is_variable_type(self): return False def is_constant(self): return False class Objective(Expression): is_sink = True def __init__(self, name, sense=None, children=None): super().__init__(children) if sense is None: sense = Sense.MINIMIZE self.sense = sense self.name = name @property def body(self): return self.args[0] def is_expression_type(self): return True def is_minimizing(self): return self.sense == Sense.MINIMIZE def is_maximizing(self): return self.sense == Sense.MAXIMIZE class BoundedExpression(Expression): def __init__(self, lower_bound, upper_bound, children=None): super().__init__(children) self.lower_bound = lower_bound self.upper_bound = upper_bound def bounded_below(self): return self.lower_bound is not None and self.lower_bound != -inf def bounded_above(self): return self.upper_bound is not None and self.upper_bound != inf class Constraint(BoundedExpression): is_sink = True def __init__(self, name, lower_bound, upper_bound, children=None): super().__init__(lower_bound, upper_bound, children) self.name = name @property def body(self): return self.args[0] def is_expression_type(self): return True def is_equality(self): return self.lower_bound == self.upper_bound def __str__(self): return 'Constraint(name={}, lower_bound={}, upper_bound={}, args={})'.format( self.name, self.lower_bound, self.upper_bound, self.args ) class Variable(BoundedExpression): is_source = True def __init__(self, name, lower_bound, upper_bound, domain=None): super().__init__(lower_bound, upper_bound, None) self.domain = domain self.name = name def is_binary(self): return self.domain == Domain.BINARY def is_integer(self): return self.domain == Domain.INTEGERS def is_real(self): return self.domain == Domain.REALS def is_constant(self): # TODO(fracek): if we ever support fixing variables, change this return False def __str__(self): return 'Variable(name={}, lower_bound={}, upper_bound={}, domain={})'.format( self.name, self.lower_bound, self.upper_bound, self.domain ) class Constant(BoundedExpression): is_source = True def __init__(self, value): super().__init__(value, value, None) @property def value(self): assert self.lower_bound == self.upper_bound return self.lower_bound def is_constant(self): return True
25.0375
85
0.658512
517
4,006
4.891683
0.266925
0.075129
0.066429
0.055358
0.418743
0.302491
0.249506
0.190589
0.13365
0.102807
0
0.004987
0.249126
4,006
159
86
25.194969
0.835771
0.188218
0
0.357143
0
0
0.037244
0
0
0
0
0.006289
0.010204
1
0.27551
false
0
0.040816
0.204082
0.72449
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
9b82673b26c46b4b26d95c88f868cace6cd8a642
294
py
Python
flows/statestore/tests/django_tests.py
sergioisidoro/django-flows
326baa3e216a15bd7a8d13b2a09ba9752e250dbb
[ "BSD-2-Clause" ]
104
2015-01-05T14:29:16.000Z
2021-11-08T11:20:24.000Z
flows/statestore/tests/django_tests.py
sergioisidoro/django-flows
326baa3e216a15bd7a8d13b2a09ba9752e250dbb
[ "BSD-2-Clause" ]
4
2015-09-23T11:14:50.000Z
2020-03-21T06:08:34.000Z
flows/statestore/tests/django_tests.py
sergioisidoro/django-flows
326baa3e216a15bd7a8d13b2a09ba9752e250dbb
[ "BSD-2-Clause" ]
16
2015-01-05T10:13:44.000Z
2022-02-14T05:21:23.000Z
import unittest from flows.statestore.django_store import StateStore from flows.statestore.tests.utils import store_state_works class DjangoStateStoreTest(unittest.TestCase): def test_django_store_state(self): store = StateStore() store_state_works(self, store)
24.5
58
0.765306
35
294
6.2
0.485714
0.138249
0.175115
0
0
0
0
0
0
0
0
0
0.173469
294
11
59
26.727273
0.893004
0
0
0
0
0
0
0
0
0
0
0
0
1
0.142857
false
0
0.428571
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
0
0
0
1
0
1
0
0
2
9b902f255bd9d45e07a2e966eeb8f841dbe8fc88
1,985
py
Python
tests/lamvery/cli_test.py
rdtr/lamvery
e9334a0d258c63e6426c7cd320f691b9f21044c1
[ "MIT" ]
101
2015-11-12T11:29:20.000Z
2020-05-24T19:26:37.000Z
tests/lamvery/cli_test.py
rdtr/lamvery
e9334a0d258c63e6426c7cd320f691b9f21044c1
[ "MIT" ]
45
2015-11-13T05:43:18.000Z
2017-04-27T18:14:49.000Z
tests/lamvery/cli_test.py
marcy-terui/lamvery
e9334a0d258c63e6426c7cd320f691b9f21044c1
[ "MIT" ]
22
2016-01-26T00:12:57.000Z
2019-12-13T09:06:43.000Z
# -*- coding: utf-8 -*- from unittest import TestCase from mock import Mock, patch from lamvery.cli import ( main, init, build, configure, deploy, encrypt, encrypt_file, events, decrypt, set_alias, invoke, rollback, api, generate ) class FunctionsTestCase(TestCase): def test_init(self): with patch('lamvery.cli.InitAction'): init(Mock()) def test_archive(self): with patch('lamvery.cli.BuildAction'): build(Mock()) def test_configure(self): with patch('lamvery.cli.ConfigureAction'): configure(Mock()) def test_deploy(self): with patch('lamvery.cli.DeployAction'): deploy(Mock()) def test_encrypt(self): with patch('lamvery.cli.EncryptAction'): encrypt(Mock()) def test_encrypt_file(self): with patch('lamvery.cli.EncryptFileAction'): encrypt_file(Mock()) def test_events(self): with patch('lamvery.cli.EventsAction'): events(Mock()) def test_decrypt(self): with patch('lamvery.cli.DecryptAction'): decrypt(Mock()) def test_set_alias(self): with patch('lamvery.cli.SetAliasAction'): set_alias(Mock()) def test_invoke(args): with patch('lamvery.cli.InvokeAction'): invoke(Mock()) def test_rollback(args): with patch('lamvery.cli.RollbackAction'): rollback(Mock()) def test_api(args): with patch('lamvery.cli.ApiAction'): api(Mock()) def test_generate(args): with patch('lamvery.cli.GenerateAction'): generate(Mock()) @patch('argparse.ArgumentParser') @patch('sys.exit') def test_main(self, argp, ex): main() @patch('argparse.ArgumentParser') @patch('sys.exit') def test_main_error(self, argp, ex): argp.parse_args = Mock(side_effect=Exception) main()
22.816092
53
0.594458
216
1,985
5.351852
0.268519
0.09083
0.179931
0.213668
0.345156
0.086505
0.086505
0.086505
0.086505
0
0
0.000697
0.277582
1,985
86
54
23.081395
0.805439
0.010579
0
0.089552
0
0
0.195719
0.187564
0
0
0
0
0
1
0.223881
false
0
0.044776
0
0.283582
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
9b906d0ca190514b42e0b5edafba1d709df76a02
569
py
Python
db-test.py
alexolotl/apt-hunt
25d2a2d565b0b694a8f5e3442ba429ae99688e54
[ "MIT" ]
null
null
null
db-test.py
alexolotl/apt-hunt
25d2a2d565b0b694a8f5e3442ba429ae99688e54
[ "MIT" ]
null
null
null
db-test.py
alexolotl/apt-hunt
25d2a2d565b0b694a8f5e3442ba429ae99688e54
[ "MIT" ]
null
null
null
import sqlite3 from util import post_listing_to_slack from slackclient import SlackClient import settings sc = SlackClient(settings.SLACK_TOKEN) con = sqlite3.connect('listings.db') # with con: # con.row_factory = sqlite3.Row # cur = con.cursor() # # print("SQLite version: %s" % data) # cur.execute("SELECT * FROM Listings") # rows = cur.fetchone() # for row in rows: # print(row) # # post_listing_to_slack(sc, rows) # deletes entire table !!! # with con: # cur = con.cursor() # cur.execute("DROP TABLE IF EXISTS Listings")
22.76
50
0.669596
75
569
4.973333
0.506667
0.058981
0.069705
0.096515
0
0
0
0
0
0
0
0.006652
0.207381
569
24
51
23.708333
0.820399
0.620387
0
0
0
0
0.055
0
0
0
0
0
0
1
0
false
0
0.666667
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
0
0
0
1
0
1
0
0
2
9ba6402b03516602907bdd9d7c0d28f9b0666716
1,601
py
Python
python/test.py
drulm/Spark_Knapsack
ef8ab8b6ac6762391b63ff29ebf857a65f98698d
[ "Apache-2.0" ]
7
2018-04-18T00:51:29.000Z
2021-05-30T12:58:36.000Z
python/test.py
darrell-ulm/Spark_Knapsack
ef8ab8b6ac6762391b63ff29ebf857a65f98698d
[ "Apache-2.0" ]
null
null
null
python/test.py
darrell-ulm/Spark_Knapsack
ef8ab8b6ac6762391b63ff29ebf857a65f98698d
[ "Apache-2.0" ]
2
2019-05-28T03:13:26.000Z
2019-11-22T19:50:14.000Z
# -------------------------------------------- # Test the Approximate Knapsack function test # -------------------------------------------- # Pull in the knapsack library. import random from pyspark.sql import SparkSession from knapsack import knapsack # Create the SparkContext. sc = SparkSession \ .builder \ .appName("Knapsack Approximation Algorithm Test") \ .getOrCreate() # Knapsack problem size. N = 10 # Setup sample data for knapsack. knapsackData = [('item_' + str(k), random.uniform(1.0, 10.0), random.uniform(1.0, 10.0)) for k in range(N)] # Make a Dataframe with item(s), weight(s), and value(s) for the knapsack. knapsackData = sc.createDataFrame(knapsackData, ['item', 'weights', 'values']) # Display the original data print "Original Data:" print knapsackData.show() print "\n" # Create a random maximum weight W = random.uniform(N * 1.3, N * 1.6) # Show the weight. print "W: " print W print "\n" # Call the knapsack greedy approximation function, with data and size 5. k = knapsack.knapsackApprox(knapsackData, W) # Show the results Dataframe. print "Selected Elements:" print k.show() print "\n" # Show totals for selected elements of knapsack. sumValues = k.rdd.map(lambda x: x["values"]).reduce(lambda x, y: x+y) sumWeights = k.rdd.map(lambda x: x["weights"]).reduce(lambda x, y: x+y) numResults = k.count() print "Totals:" print "Sum Values: ", sumValues print "Sum Weights: ", sumWeights print numResults print "\n" # ------------------------------------------ # End of Approximate Knapsack function test # ------------------------------------------
26.245902
107
0.634603
207
1,601
4.903382
0.376812
0.023645
0.053202
0.061084
0.096552
0.096552
0
0
0
0
0
0.012436
0.146159
1,601
60
108
26.683333
0.730066
0.414741
0
0.137931
0
0
0.159956
0
0
0
0
0
0
0
null
null
0
0.103448
null
null
0.482759
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
1
0
2
9bb08d27951cdcbd92a25a4408ad1a1b8fb55f34
1,345
py
Python
test/test_CommandHead.py
jcandan/WonderPy
ee82322b082e94015258b34b27f23501f8130fa2
[ "MIT" ]
46
2018-07-31T20:30:41.000Z
2022-03-23T17:14:51.000Z
test/test_CommandHead.py
jcandan/WonderPy
ee82322b082e94015258b34b27f23501f8130fa2
[ "MIT" ]
24
2018-08-01T09:59:29.000Z
2022-02-26T20:57:51.000Z
test/test_CommandHead.py
jcandan/WonderPy
ee82322b082e94015258b34b27f23501f8130fa2
[ "MIT" ]
24
2018-08-01T19:14:31.000Z
2021-02-18T13:26:40.000Z
import unittest from mock import Mock from test.robotTestUtil import RobotTestUtil class MyTestCase(unittest.TestCase): def test_head_turn(self): robot = RobotTestUtil.make_fake_dash() robot.stage_cmds = Mock() m = robot.stage_cmds robot.commands.head.do_pan_angle (90) robot.commands.head.do_tilt_angle (10) robot.commands.head.do_pan_voltage (75) robot.commands.head.do_tilt_voltage (85) robot.commands.head.do_pan_tilt_angle (-45.3, -30.3) robot.commands.head.do_pan_tilt_voltage(-10.3, -11.3) self.assertEquals(m.call_count, 8) self.assertAlmostEquals(m.call_args_list[0][0][0]['203']['degree'], 90) self.assertAlmostEquals(m.call_args_list[1][0][0]['202']['degree'], -10) self.assertAlmostEquals(m.call_args_list[2][0][0]['213']['prcnt' ], 75) self.assertAlmostEquals(m.call_args_list[3][0][0]['214']['prcnt' ], -85) self.assertAlmostEquals(m.call_args_list[4][0][0]['203']['degree'], -45.3) self.assertAlmostEquals(m.call_args_list[5][0][0]['202']['degree'], 30.3) self.assertAlmostEquals(m.call_args_list[6][0][0]['213']['prcnt' ], -10.3) self.assertAlmostEquals(m.call_args_list[7][0][0]['214']['prcnt' ], 11.3) if __name__ == '__main__': unittest.main()
40.757576
82
0.646097
194
1,345
4.247423
0.293814
0.054612
0.223301
0.262136
0.515777
0.406553
0.131068
0
0
0
0
0.080909
0.182156
1,345
32
83
42.03125
0.668182
0
0
0
0
0
0.056506
0
0
0
0
0
0.36
1
0.04
false
0
0.12
0
0.2
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
9bb22f65833ccdf573c2ff6580ffe37f01d473f8
247
py
Python
sciapp/action/advanced/macros.py
Pad0y/imagepy
23f41b64ade02f94b566b0d23a4b6459c1a1578d
[ "BSD-4-Clause" ]
null
null
null
sciapp/action/advanced/macros.py
Pad0y/imagepy
23f41b64ade02f94b566b0d23a4b6459c1a1578d
[ "BSD-4-Clause" ]
null
null
null
sciapp/action/advanced/macros.py
Pad0y/imagepy
23f41b64ade02f94b566b0d23a4b6459c1a1578d
[ "BSD-4-Clause" ]
null
null
null
class Macros: def __init__(self, title, cmds): self.title = title self.cmds = cmds def __call__(self): return self def start(self, app, para=None, callafter=None): app.run_macros(self.cmds, callafter)
22.454545
52
0.615385
32
247
4.46875
0.46875
0.125874
0
0
0
0
0
0
0
0
0
0
0.279352
247
10
53
24.7
0.803371
0
0
0
0
0
0
0
0
0
0
0
0
1
0.375
false
0
0
0.125
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
1
0
0
0
2
9bb4070df0345465e234b3e6738bbb40c587c512
2,038
py
Python
py_randomprime/__init__.py
UltiNaruto/py-randomprime
597d3636c2e40e11ed92d4808200ded879ccb244
[ "MIT" ]
null
null
null
py_randomprime/__init__.py
UltiNaruto/py-randomprime
597d3636c2e40e11ed92d4808200ded879ccb244
[ "MIT" ]
2
2021-05-24T18:05:11.000Z
2021-05-31T08:07:29.000Z
py_randomprime/__init__.py
henriquegemignani/py-randomprime
aac48b44761cbb8d857a4d72e06dfac17efc1fae
[ "MIT" ]
2
2021-08-18T01:17:19.000Z
2021-11-26T15:08:34.000Z
import copy import os import json from pathlib import Path from typing import Callable, Optional from . import rust, version class BaseProgressNotifier: def notify_total_bytes(self, total_size: int): raise NotImplementedError() def notify_writing_file(self, file_name: bytes, file_bytes: int): raise NotImplementedError() def notify_writing_header(self): raise NotImplementedError() def notify_flushing_to_disk(self): raise NotImplementedError() class ProgressNotifier(BaseProgressNotifier): total_size: int = 0 bytes_so_far: int = 0 def __init__(self, callback: Callable[[float, str], None]): self.callback = callback def notify_total_bytes(self, total_size: int): self.total_size += total_size def notify_writing_file(self, file_name: bytes, file_bytes: int): self.callback(self.bytes_so_far / self.total_size, "Writing file {}".format(file_name.decode("utf-8"))) self.bytes_so_far += file_bytes def notify_writing_header(self): self.callback(self.bytes_so_far / self.total_size, "Writing ISO header") def notify_flushing_to_disk(self): self.callback(1, "Flushing written data to the disk") def patch_iso_raw(config_str: str, notifier: BaseProgressNotifier): if notifier is None: raise ValueError("notifier is None") return rust.patch_iso(config_str, notifier) def patch_iso(input_iso: Path, output_iso: Path, config: dict, notifier: BaseProgressNotifier): new_config = copy.copy(config) new_config["inputIso"] = os.fspath(input_iso) new_config["outputIso"] = os.fspath(output_iso) return patch_iso_raw(json.dumps(new_config), notifier) def symbols_for_file(input_file: Path) -> Optional[dict]: v = rust.get_iso_mp1_version(os.fspath(input_file)) if v is not None: return rust.get_mp1_symbols(v) def symbols_for_version(v: str) -> Optional[dict]: return rust.get_mp1_symbols(v) __version__ = version.version VERSION = version.version
29.536232
111
0.723749
277
2,038
5.050542
0.252708
0.051465
0.046462
0.070765
0.360257
0.304503
0.185847
0.185847
0.135811
0.135811
0
0.004194
0.18106
2,038
69
112
29.536232
0.834032
0
0
0.304348
0
0
0.051005
0
0
0
0
0
0
1
0.282609
false
0
0.130435
0.021739
0.586957
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
32ca34b8eacf24dc530fada37a04db8272ab0be6
523
py
Python
langcreator/system.py
xzripper/LanguageCreator
65421063161166d3e4f97e4b874909259b665fce
[ "MIT" ]
2
2021-12-12T16:48:20.000Z
2021-12-31T17:48:21.000Z
langcreator/system.py
xzripper/LanguageCreator
65421063161166d3e4f97e4b874909259b665fce
[ "MIT" ]
null
null
null
langcreator/system.py
xzripper/LanguageCreator
65421063161166d3e4f97e4b874909259b665fce
[ "MIT" ]
null
null
null
import subprocess import sys import os subprocess = subprocess sys = sys os = os def output(command: str, remlstc: bool) -> str: """ Get output from console command. If remlstc is True, it's return an output without a useless newline. :param command: The command. :param remlstc: Remove last character from output. """ return subprocess.check_output(command, shell=True, encoding='cp866')[:-1] if remlstc else subprocess.check_output(command, shell=True, encoding='cp866')
27.526316
158
0.692161
69
523
5.217391
0.507246
0.108333
0.116667
0.155556
0.277778
0.277778
0.277778
0.277778
0
0
0
0.017032
0.214149
523
18
159
29.055556
0.858881
0.347992
0
0
0
0
0.033898
0
0
0
0
0
0
1
0.125
false
0
0.375
0
0.625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
32d936fc21c284d747f6a37882f102cf2a32a1e5
567
py
Python
src/directory-starter/README_text.py
hannahweber244/directory-starter
0cb12b6e9dfe9c3a6eb5029d7d0b6cb5da52b44b
[ "MIT" ]
null
null
null
src/directory-starter/README_text.py
hannahweber244/directory-starter
0cb12b6e9dfe9c3a6eb5029d7d0b6cb5da52b44b
[ "MIT" ]
null
null
null
src/directory-starter/README_text.py
hannahweber244/directory-starter
0cb12b6e9dfe9c3a6eb5029d7d0b6cb5da52b44b
[ "MIT" ]
null
null
null
""" # [REPO NAME] ## Table of contents [Here you can use a table of contents to keep your README structured.] ## Overview [Here you give a short overview over the motivation behind your project and what problem it solves.] ## How to use it [Here you can explain how your tool/project is usable.] ### Requirements and dependencies [If there are any requirements or dependencies to use what you developed, you can put those here.] ## Additional information [Here you can include an overview over the structure of your code, additional information, tests etc.] """
31.5
102
0.75485
88
567
4.863636
0.579545
0.065421
0.070093
0
0
0
0
0
0
0
0
0
0.176367
567
18
103
31.5
0.916488
0.985891
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
32e013bad1fb65c5a409199a8b804f1d0f72e07c
1,379
py
Python
sdpremote/utils/user.py
gudn/sdpremote
431234420ea1e0c752432eac6000c11a75851375
[ "MIT" ]
null
null
null
sdpremote/utils/user.py
gudn/sdpremote
431234420ea1e0c752432eac6000c11a75851375
[ "MIT" ]
null
null
null
sdpremote/utils/user.py
gudn/sdpremote
431234420ea1e0c752432eac6000c11a75851375
[ "MIT" ]
null
null
null
import binascii from base64 import b64decode from typing import Optional from fastapi import Depends, Header, status from fastapi.exceptions import HTTPException def _user_header(authorization: Optional[str] = Header(None)) -> str: if not authorization: raise HTTPException(status.HTTP_401_UNAUTHORIZED) splitted = authorization.split() if len(splitted) != 2: raise HTTPException( status.HTTP_401_UNAUTHORIZED, 'only support basic authz schema', ) schema, value = splitted if schema != 'Basic': raise HTTPException( status.HTTP_401_UNAUTHORIZED, 'only support basic authz schema', ) try: value = b64decode(value).decode() except binascii.Error: raise HTTPException( status.HTTP_401_UNAUTHORIZED, 'unable to decode value', ) splitted = value.split(':') if len(splitted) != 2: raise HTTPException(status.HTTP_401_UNAUTHORIZED, 'invalid value') user = splitted[0] if not user: raise HTTPException(status.HTTP_401_UNAUTHORIZED, 'invalid value') return user def user( user: Optional[str] = None, login: str = Depends(_user_header), ) -> str: if user is not None and user != login: raise HTTPException(status.HTTP_403_FORBIDDEN) return login
26.018868
74
0.649021
151
1,379
5.807947
0.317881
0.143672
0.191562
0.223489
0.426454
0.426454
0.328392
0.328392
0.251995
0.251995
0
0.029762
0.269036
1,379
52
75
26.519231
0.840278
0
0
0.292683
0
0
0.084119
0
0
0
0
0
0
1
0.04878
false
0
0.121951
0
0.219512
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
32f16560a7eafdb17a4951c61d182a0eaa97e4e4
880
py
Python
src/Tools/Button.py
hieuhdh/Multi-tasking-program
2f064a554f647247c84979b7a27f0797d1e1b5af
[ "MIT" ]
null
null
null
src/Tools/Button.py
hieuhdh/Multi-tasking-program
2f064a554f647247c84979b7a27f0797d1e1b5af
[ "MIT" ]
null
null
null
src/Tools/Button.py
hieuhdh/Multi-tasking-program
2f064a554f647247c84979b7a27f0797d1e1b5af
[ "MIT" ]
null
null
null
from tkinter import* from tkinter import Button, font from tkinter.font import BOLD import tkinter.ttk as ttk from tkhtmlview import HTMLLabel from tkhtmlview import HTMLText def frameButton(frame, xx, yy, text, backgroundcolor, foregroundcolor, cmd, images): def IN(e): button['background'] = backgroundcolor button['foreground']= '#120b26' def OUT(e): button['background'] = foregroundcolor button['foreground']= '#120b26' button = Button(frame, text = text, width = 30, height = 2, fg = '#120b26', border = 0, bg = foregroundcolor, activeforeground = '#120b26', activebackground = backgroundcolor, command=(cmd), font = ("Microsoft Sans Serif", 12, "bold"), cursor="hand2", borderwidth=0, image = images ) button.bind("<Enter>", IN) button.bind("<Leave>", OUT) button.place(x = xx, y = yy)
40
303
0.659091
101
880
5.742574
0.514851
0.056897
0.058621
0
0
0
0
0
0
0
0
0.040288
0.210227
880
21
304
41.904762
0.794245
0
0
0.117647
0
0
0.126136
0
0
0
0
0
0
1
0.176471
false
0
0.352941
0
0.529412
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
32f73e3a96427c84bfa7bd842e7e9ab6eeb893b6
931
py
Python
Aula07/Exercicio2.py
PabloSchumacher/TrabalhosPython
828edd35eb40442629211bc9f1477f75fb025d74
[ "bzip2-1.0.6", "MIT" ]
null
null
null
Aula07/Exercicio2.py
PabloSchumacher/TrabalhosPython
828edd35eb40442629211bc9f1477f75fb025d74
[ "bzip2-1.0.6", "MIT" ]
null
null
null
Aula07/Exercicio2.py
PabloSchumacher/TrabalhosPython
828edd35eb40442629211bc9f1477f75fb025d74
[ "bzip2-1.0.6", "MIT" ]
null
null
null
#--- Exercicio 2 - Dicionários #--- Escreva um programa que leia os dados de 11 jogadores #--- Jogador: Nome, Posicao, Numero, PernaBoa #--- Crie um dicionario para armazenar os dados #--- Imprima todos os jogadores e seus dados lista_jogador = [] for i in range(0,11): dicionario_jogador = {'Nome':'', 'Posicao':'', 'Numero':'','Pernaboa':''} dicionario_jogador['Nome'] = input(f'Digite o nome do {i+1}° jogador: ') dicionario_jogador['Posicao'] = input(f'Digite a posição do {i+1}° jogador: ') dicionario_jogador['Numero'] = int(input(f'Digite o número do {i+1}° jogador: ')) dicionario_jogador['Pernaboa'] = input(f'Digite o perna boa do {i+1}° jogador: ') lista_jogador.append(dicionario_jogador) for j in lista_jogador: print(f"Nome: {dicionario_jogador['Nome']} - Posição: {dicionario_jogador['Posicao']} - Numero: {dicionario_jogador['Numero']} - Pernaboa: {dicionario_jogador['Pernaboa']}")
46.55
177
0.688507
128
931
4.9375
0.375
0.268987
0.075949
0.031646
0.257911
0.137658
0.137658
0
0
0
0
0.012563
0.145005
931
19
178
49
0.776382
0.235231
0
0
0
0.1
0.502833
0.171388
0
0
0
0.052632
0
1
0
false
0
0
0
0
0.1
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
1
0
0
0
0
0
0
0
0
0
0
2
fd067b6667868f936c5b7ba2c71c491e3eeb9190
844
py
Python
venv/Lib/site-packages/traits/observation/events.py
richung99/digitizePlots
6b408c820660a415a289726e3223e8f558d3e18b
[ "MIT" ]
1
2022-01-18T17:56:51.000Z
2022-01-18T17:56:51.000Z
venv/Lib/site-packages/traits/observation/events.py
richung99/digitizePlots
6b408c820660a415a289726e3223e8f558d3e18b
[ "MIT" ]
null
null
null
venv/Lib/site-packages/traits/observation/events.py
richung99/digitizePlots
6b408c820660a415a289726e3223e8f558d3e18b
[ "MIT" ]
null
null
null
# (C) Copyright 2005-2021 Enthought, Inc., Austin, TX # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in LICENSE.txt and may be redistributed only under # the conditions described in the aforementioned license. The license # is also available online at http://www.enthought.com/licenses/BSD.txt # # Thanks for using Enthought open source! """ Event objects received by change handlers added using observe. """ from traits.observation._dict_change_event import ( # noqa: F401 DictChangeEvent, ) from traits.observation._list_change_event import ( # noqa: F401 ListChangeEvent, ) from traits.observation._set_change_event import ( # noqa: F401 SetChangeEvent, ) from traits.observation._trait_change_event import ( # noqa: F401 TraitChangeEvent, )
29.103448
71
0.760664
110
844
5.727273
0.627273
0.063492
0.133333
0.133333
0.15873
0
0
0
0
0
0
0.028369
0.164692
844
28
72
30.142857
0.865248
0.587678
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
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
fd19ca0b5b114583ad7ed023250d660c51840010
141
py
Python
solutions/1639.py
nxexox/acm.timus
9548d2a0b54fdd99bd60071f3be2fb7f897a7303
[ "MIT" ]
null
null
null
solutions/1639.py
nxexox/acm.timus
9548d2a0b54fdd99bd60071f3be2fb7f897a7303
[ "MIT" ]
null
null
null
solutions/1639.py
nxexox/acm.timus
9548d2a0b54fdd99bd60071f3be2fb7f897a7303
[ "MIT" ]
null
null
null
#!/usr/bin/python a, b = [int(i) for i in input().split()] c = a * b if c % 2 == 0: print('[:=[first]') else: print('[second]=:]')
14.1
40
0.475177
24
141
2.791667
0.791667
0.059701
0
0
0
0
0
0
0
0
0
0.018519
0.234043
141
9
41
15.666667
0.601852
0.113475
0
0
0
0
0.169355
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
fd25176d16569d58b76384f5892d5e731b3f5603
434
py
Python
tests/test_demo.py
PrabhuLoganathan/Pytest-Selenium-POM--Google
d0b50faf28a0c3797d1b0bc838d77f82dd0be81c
[ "MIT" ]
null
null
null
tests/test_demo.py
PrabhuLoganathan/Pytest-Selenium-POM--Google
d0b50faf28a0c3797d1b0bc838d77f82dd0be81c
[ "MIT" ]
1
2021-04-22T12:02:19.000Z
2021-04-22T12:02:19.000Z
tests/test_demo.py
wadle/test_demo_pytest_selenium
bc9f2b4a9da895568da2cc3f0bc904f78775884c
[ "MIT" ]
1
2020-11-26T20:03:07.000Z
2020-11-26T20:03:07.000Z
from pages.demo_page import DemoPage class TestDemo: def test_open_page(self, browser): """ :param browser: :return: """ obj = DemoPage(browser) obj.open_page() def test_verify_page_title(self, browser): """ :param browser: :return: """ obj = DemoPage(browser) obj.open_page() assert obj.driver.title == "Google"
16.074074
46
0.532258
44
434
5.068182
0.477273
0.107623
0.143498
0.206278
0.520179
0.520179
0.520179
0.520179
0.520179
0.520179
0
0
0.357143
434
26
47
16.692308
0.799283
0.112903
0
0.444444
0
0
0.018927
0
0
0
0
0
0.111111
1
0.222222
false
0
0.111111
0
0.444444
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
fd4df1f5acd3eb66e203334228aa56f68ab7a4a9
302
py
Python
tests/huge.py
nbdy/podb
684ed6b8330c0d18a2b89d6521cb15586d1f95a4
[ "MIT" ]
null
null
null
tests/huge.py
nbdy/podb
684ed6b8330c0d18a2b89d6521cb15586d1f95a4
[ "MIT" ]
null
null
null
tests/huge.py
nbdy/podb
684ed6b8330c0d18a2b89d6521cb15586d1f95a4
[ "MIT" ]
null
null
null
import unittest from podb import DB from tqdm import tqdm from . import HugeDBItem db = DB("huge") class HugeDBTest(unittest.TestCase): def test_huge_insert(self): for _ in tqdm(range(1000000)): db.insert(HugeDBItem.random()) if __name__ == '__main__': unittest.main()
17.764706
42
0.682119
39
302
5
0.589744
0
0
0
0
0
0
0
0
0
0
0.029412
0.211921
302
16
43
18.875
0.789916
0
0
0
0
0
0.039735
0
0
0
0
0
0
1
0.090909
false
0
0.363636
0
0.545455
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
fd60adf005e921981d0393064770bc769120bb9d
3,401
py
Python
slivka/server/forms/file_proxy.py
warownia1/Slivca
5491afec63c8cd41d6f1389a5dd0ba9877b888a1
[ "Apache-2.0" ]
5
2016-09-01T15:30:46.000Z
2019-07-15T12:26:46.000Z
slivka/server/forms/file_proxy.py
warownia1/Slivca
5491afec63c8cd41d6f1389a5dd0ba9877b888a1
[ "Apache-2.0" ]
75
2016-08-31T11:32:49.000Z
2021-05-12T14:33:17.000Z
slivka/server/forms/file_proxy.py
warownia1/Slivca
5491afec63c8cd41d6f1389a5dd0ba9877b888a1
[ "Apache-2.0" ]
3
2017-06-01T10:21:04.000Z
2020-06-12T10:32:49.000Z
import io import os import shutil from base64 import urlsafe_b64decode from bson import ObjectId from slivka.db.documents import UploadedFile, JobRequest class FileProxy: _file: io.IOBase = None closed = property(lambda self: self._file is None or self.file.closed) fileno = property(lambda self: self.file.fileno) flush = property(lambda self: self.file.flush) isatty = property(lambda self: self.file.isatty) read = property(lambda self: self.file.read) readable = property(lambda self: self.file.readable) readinto = property(lambda self: self.file.readinto) readline = property(lambda self: self.file.readline) readlines = property(lambda self: self.file.readlines) seek = property(lambda self: self.file.seek) seekable = property(lambda self: self.file.seekable) tell = property(lambda self: self.file.tell) truncate = property(lambda self: self.file.truncate) writable = property(lambda self: self.file.writable) write = property(lambda self: self.file.write) writelines = property(lambda self: self.file.writelines) @staticmethod def from_id(file_id, database): tokens = file_id.split('/', 1) if len(tokens) == 1: # user uploaded file _id = ObjectId(urlsafe_b64decode(file_id)) uf = UploadedFile.find_one(database, _id=_id) if uf is None: return None return FileProxy(path=uf.path) else: # job output file job_uuid, filename = tokens request = JobRequest.find_one(database, id=job_uuid) if request is not None: path = os.path.join(request.job.cwd, filename) if os.path.isfile(path): return FileProxy(path=path) return None def __init__(self, file=None, path=None): self.file = file self.path = path def __iter__(self): return iter(self.file) def __enter__(self): return self def __exit__(self, _exc_type, _exc_value, _tb): self.close() def reopen(self): if not self.closed: self.seek(0) elif self.path and os.path.exists(self.path): self.file = open(self.path, 'rb') else: raise OSError("can't open the file.") return self def _get_file(self): if self._file is None: if self.path is None: raise ValueError("file not set") self.reopen() return self._file def _set_file(self, file): self._file = file def _del_file(self): del self._file file = property(_get_file, _set_file, _del_file) def save_as(self, path, fp=None): """ Saves the file at the specified location. If ``fp`` is specified it will be used to write the content. Otherwise, a new file at ``path`` will be created. :param path: Path to the destination file :param fp: File-like object at the location specified by ``path`` """ self.reopen() path = os.path.realpath(path) if fp: shutil.copyfileobj(self.file, fp) else: with open(path, 'wb') as dst: shutil.copyfileobj(self.file, dst) self.path = path def close(self): if self._file is not None: self._file.close()
31.490741
76
0.612173
439
3,401
4.617312
0.271071
0.118402
0.142082
0.173656
0.221016
0
0
0
0
0
0
0.003739
0.292267
3,401
107
77
31.785047
0.838388
0.087621
0
0.1125
0
0
0.012147
0
0
0
0
0
0
1
0.1375
false
0
0.075
0.025
0.5375
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
b5be5d0470828bf2d8483755e027514f357777f6
1,694
py
Python
PyTrinamic/ic/TMC2130/TMC2130.py
trinamic-AA/PyTrinamic
b054f4baae8eb6d3f5d2574cf69c232f66abb4ee
[ "MIT" ]
37
2019-01-13T11:08:45.000Z
2022-03-25T07:18:15.000Z
PyTrinamic/ic/TMC2130/TMC2130.py
trinamic-AA/PyTrinamic
b054f4baae8eb6d3f5d2574cf69c232f66abb4ee
[ "MIT" ]
56
2019-02-25T02:48:27.000Z
2022-03-31T08:45:34.000Z
PyTrinamic/ic/TMC2130/TMC2130.py
trinamic-AA/PyTrinamic
b054f4baae8eb6d3f5d2574cf69c232f66abb4ee
[ "MIT" ]
26
2019-01-14T05:20:16.000Z
2022-03-08T13:27:35.000Z
''' Created on 14.10.2019 @author: JM ''' from PyTrinamic.ic.TMC2130.TMC2130_register import TMC2130_register from PyTrinamic.ic.TMC2130.TMC2130_register_variant import TMC2130_register_variant from PyTrinamic.ic.TMC2130.TMC2130_fields import TMC2130_fields from PyTrinamic.helpers import TMC_helpers class TMC2130(): """ Class for the TMC2130 IC """ def __init__(self, channel): self.__channel = channel self.registers = TMC2130_register self.fields = TMC2130_fields self.variants = TMC2130_register_variant self.MOTORS = 2 def showChipInfo(self): print("TMC2130 chip info: The TMC2130 is a high-performane driver IC for two phase stepper motors. Standard SPI and STEP/DIR simply communication. Voltage supply: 4.75 - 46V") def writeRegister(self, registerAddress, value, channel): raise NotImplementedError def readRegister(self, registerAddress, channel): raise NotImplementedError def writeRegisterField(self, field, value): return self.writeRegister(field[0], TMC_helpers.field_set(self.readRegister(field[0], self.__channel), field[1], field[2], value), self.__channel) def readRegisterField(self, field): return TMC_helpers.field_get(self.readRegister(field[0], self.__channel), field[1], field[2]) def moveBy(self, motor, distance, velocity): if not(0 <= motor < self.MOTORS): raise ValueError position = self.readRegister(self.registers.XACTUAL, self.__channel, signed=True) self.moveTo(motor, position + distance, velocity) return position + distance def get_pin_state(self): pass
32.576923
183
0.707202
204
1,694
5.710784
0.397059
0.077253
0.041202
0.059227
0.16824
0.142489
0.077253
0.077253
0.077253
0.077253
0
0.063704
0.20307
1,694
51
184
33.215686
0.799259
0.034829
0
0.068966
0
0.034483
0.102978
0
0
0
0
0
0
1
0.275862
false
0.034483
0.137931
0.068966
0.551724
0.034483
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
b5d05429ba74cb0c817d19e6c37641ec569991cf
2,191
py
Python
logparser/logs/logs.py
rkorte/rticonnextdds-logparser
e8d0446c8d1318e68886a58e95c3f1ba4a1fa455
[ "Apache-2.0" ]
11
2016-06-28T13:26:01.000Z
2021-06-07T09:18:32.000Z
logparser/logs/logs.py
rkorte/rticonnextdds-logparser
e8d0446c8d1318e68886a58e95c3f1ba4a1fa455
[ "Apache-2.0" ]
27
2016-10-26T19:57:16.000Z
2019-04-12T16:48:11.000Z
logparser/logs/logs.py
rkorte/rticonnextdds-logparser
e8d0446c8d1318e68886a58e95c3f1ba4a1fa455
[ "Apache-2.0" ]
7
2016-08-28T17:24:15.000Z
2021-12-10T11:28:20.000Z
# Log Parser for RTI Connext. # # Copyright 2016 Real-Time Innovations, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Create the global list of regular expressions and functions. Functions: + add_regex: Compile the regex and add it to the list. + create_regex_list: Create the list of regular expressions and functions. """ from __future__ import absolute_import import re from logparser.logs.custom.logs import get_regex_list as custom_regex from logparser.logs.debug.logs import get_regex_list as debug_regex from logparser.logs.events.logs import get_regex_list as events_regex from logparser.logs.micro.logs import get_regex_list as micro_regex from logparser.logs.micro.micro import init as init_micro from logparser.logs.network.logs import get_regex_list as network_regex from logparser.logs.routing.logs import get_regex_list as routing_regex def add_regex(log_list, method, regex): """Compile the regex and add it to the list.""" log_list.append((method, re.compile(regex))) def create_regex_list(state): """Create the list of regular expressions and functions.""" init_micro(state) # pylint: disable=W0106 expressions = [] [add_regex(expressions, expr[0], expr[1]) for expr in micro_regex()] [add_regex(expressions, expr[0], expr[1]) for expr in network_regex()] [add_regex(expressions, expr[0], expr[1]) for expr in events_regex()] [add_regex(expressions, expr[0], expr[1]) for expr in routing_regex()] [add_regex(expressions, expr[0], expr[1]) for expr in custom_regex()] if state['debug']: [add_regex(expressions, expr[0], expr[1]) for expr in debug_regex()] return expressions
40.574074
76
0.748517
338
2,191
4.718935
0.310651
0.040125
0.074608
0.067712
0.405016
0.37116
0.258307
0.258307
0.201881
0.201881
0
0.013086
0.162939
2,191
53
77
41.339623
0.856598
0.428115
0
0
0
0
0.004095
0
0
0
0
0
0
1
0.090909
false
0
0.409091
0
0.545455
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
b5d543bdac2737ffc8b7efa718d7cd3c1a92a7cd
1,539
py
Python
utilities.py
Fredrik-Oberg/volkswagencarnet
877123f4053c66d11d1f99abfc1dc4bbc74effde
[ "MIT" ]
null
null
null
utilities.py
Fredrik-Oberg/volkswagencarnet
877123f4053c66d11d1f99abfc1dc4bbc74effde
[ "MIT" ]
null
null
null
utilities.py
Fredrik-Oberg/volkswagencarnet
877123f4053c66d11d1f99abfc1dc4bbc74effde
[ "MIT" ]
null
null
null
from datetime import date, datetime from base64 import b64encode from string import ascii_letters as letters, digits from sys import argv from os import environ as env from os.path import join, dirname, expanduser from itertools import product import json import logging import re _LOGGER = logging.getLogger(__name__) def find_path(src, path): """Simple navigation of a hierarchical dict structure using XPATH-like syntax. >>> find_path(dict(a=1), 'a') 1 >>> find_path(dict(a=1), '') {'a': 1} >>> find_path(dict(a=None), 'a') >>> find_path(dict(a=1), 'b') Traceback (most recent call last): ... KeyError: 'b' >>> find_path(dict(a=dict(b=1)), 'a.b') 1 >>> find_path(dict(a=dict(b=1)), 'a') {'b': 1} >>> find_path(dict(a=dict(b=1)), 'a.c') Traceback (most recent call last): ... KeyError: 'c' """ if not path: return src if isinstance(path, str): path = path.split(".") return find_path(src[path[0]], path[1:]) def is_valid_path(src, path): """ >>> is_valid_path(dict(a=1), 'a') True >>> is_valid_path(dict(a=1), '') True >>> is_valid_path(dict(a=1), None) True >>> is_valid_path(dict(a=1), 'b') False """ try: find_path(src, path) return True except KeyError: return False def camel2slug(s): """Convert camelCase to camel_case. >>> camel2slug('fooBar') 'foo_bar' """ return re.sub("([A-Z])", "_\\1", s).lower().lstrip("_")
19.481013
82
0.587394
222
1,539
3.936937
0.355856
0.100687
0.113272
0.104119
0.315789
0.296339
0.196796
0.124714
0.124714
0.124714
0
0.019776
0.244314
1,539
78
83
19.730769
0.731728
0.441845
0
0
0
0
0.018106
0
0
0
0
0
0
1
0.12
false
0
0.4
0
0.72
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
b5d9899c07fca487f770f0c61e19c1fd8ac3a831
78
py
Python
config.py
NormanLo4319/Project-1
a7b6bf6adc681a94cc23be5934ddbed1cf7ab6a6
[ "MIT" ]
1
2020-07-19T07:10:01.000Z
2020-07-19T07:10:01.000Z
config.py
NormanLo4319/Food-Enviroment-Project
a7b6bf6adc681a94cc23be5934ddbed1cf7ab6a6
[ "MIT" ]
null
null
null
config.py
NormanLo4319/Food-Enviroment-Project
a7b6bf6adc681a94cc23be5934ddbed1cf7ab6a6
[ "MIT" ]
null
null
null
#!/usr/bin/env python # coding: utf-8 # In[ ]: gkey="Enter Your Key Here"
8.666667
26
0.602564
13
78
3.615385
1
0
0
0
0
0
0
0
0
0
0
0.016129
0.205128
78
8
27
9.75
0.741935
0.525641
0
0
0
0
0.575758
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
b5f4eae105a3ccda0bbf32f61e4d9bc409056d85
773
py
Python
website/addons/dropbox/tests/test_serializer.py
DanielSBrown/osf.io
98dda2ac237377197acacce78274bc0a4ce8f303
[ "Apache-2.0" ]
null
null
null
website/addons/dropbox/tests/test_serializer.py
DanielSBrown/osf.io
98dda2ac237377197acacce78274bc0a4ce8f303
[ "Apache-2.0" ]
13
2020-03-24T15:29:41.000Z
2022-03-11T23:15:28.000Z
website/addons/dropbox/tests/test_serializer.py
DanielSBrown/osf.io
98dda2ac237377197acacce78274bc0a4ce8f303
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- """Serializer tests for the Dropbox addon.""" from nose.tools import * # noqa (PEP8 asserts) from website.addons.base.testing.serializers import StorageAddonSerializerTestSuiteMixin from website.addons.dropbox.tests.utils import MockDropbox from website.addons.dropbox.tests.factories import DropboxAccountFactory from website.addons.dropbox.serializer import DropboxSerializer from tests.base import OsfTestCase mock_client = MockDropbox() class TestDropboxSerializer(StorageAddonSerializerTestSuiteMixin, OsfTestCase): addon_short_name = 'dropbox' Serializer = DropboxSerializer ExternalAccountFactory = DropboxAccountFactory client = mock_client def set_provider_id(self, pid): self.node_settings.folder = pid
32.208333
88
0.798189
81
773
7.530864
0.54321
0.072131
0.111475
0.118033
0.095082
0
0
0
0
0
0
0.002967
0.128072
773
23
89
33.608696
0.902077
0.10608
0
0
0
0
0.010234
0
0
0
0
0
0
1
0.071429
false
0
0.428571
0
0.857143
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
bd15c472f906d140ef00546b94634b33eb43240f
714
py
Python
topy/__init__.py
TarcisioLOliveira/topy
060da675e6494fee63fa5547befcb1f8ecc39fdc
[ "MIT" ]
1
2021-01-25T00:13:34.000Z
2021-01-25T00:13:34.000Z
topy/__init__.py
TarcisioLOliveira/topy
060da675e6494fee63fa5547befcb1f8ecc39fdc
[ "MIT" ]
null
null
null
topy/__init__.py
TarcisioLOliveira/topy
060da675e6494fee63fa5547befcb1f8ecc39fdc
[ "MIT" ]
null
null
null
""" # ============================================================================== # ToPy -- Topology optimization with Python. # Copyright (C) 2012, 2015, 2016, 2017 William Hunter. # Copyright (C) 2020, 2021, Tarcísio L. de Oliveira # ============================================================================== """ from .topology_trad import * from .topology_gen import * from .visualisation import * from .elements import * from .optimisation import * from .pathfinding import * __version__ = "1.0.0" __author__ = "Tarcisio L. de Oliveira" __all__ = ( topology_trad.__all__ + topology_gen.__all__ + visualisation.__all__ + elements.__all__ + optimisation.__all__ + pathfinding.__all__ )
26.444444
80
0.560224
66
714
5.469697
0.515152
0.138504
0.060942
0
0
0
0
0
0
0
0
0.04376
0.135854
714
26
81
27.461538
0.539708
0
0
0
0
0
0.071429
0
0
0
0
0
0
0
null
null
0
0.375
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
0
1
0
0
0
0
2
bd2bf016c3e6797feee09cab8b88dd0593ba10a9
332
py
Python
hackathonbaobab2020/tests/__init__.py
baobabsoluciones/hackathonbaobab2020
ada30525cca061daad4bd420aa45dd4cfc7b790e
[ "MIT" ]
null
null
null
hackathonbaobab2020/tests/__init__.py
baobabsoluciones/hackathonbaobab2020
ada30525cca061daad4bd420aa45dd4cfc7b790e
[ "MIT" ]
2
2020-12-03T22:37:45.000Z
2021-01-28T19:43:42.000Z
hackathonbaobab2020/tests/__init__.py
baobabsoluciones/hackathonbaobab2020
ada30525cca061daad4bd420aa45dd4cfc7b790e
[ "MIT" ]
5
2020-11-20T15:37:58.000Z
2021-01-29T10:22:07.000Z
import os import zipfile from ..core import Instance def get_test_instance(zip, filename): directory = os.path.dirname(__file__) zip_path = os.path.join(directory, zip) zip_obj = zipfile.ZipFile(zip_path) data = zip_obj.read(filename) return Instance.from_mm(path=None, content=data.decode().splitlines(True))
27.666667
78
0.740964
48
332
4.895833
0.541667
0.051064
0
0
0
0
0
0
0
0
0
0
0.14759
332
11
79
30.181818
0.830389
0
0
0
0
0
0
0
0
0
0
0
0
1
0.111111
false
0
0.333333
0
0.555556
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
bd2cd6efeb3ab12f89218d4758f64e6ad10fe52a
3,778
py
Python
tests/test_versions.py
jaleskovec/reqcheck
ffc13cd28127f751617cdd29f7003866341fca58
[ "MIT" ]
null
null
null
tests/test_versions.py
jaleskovec/reqcheck
ffc13cd28127f751617cdd29f7003866341fca58
[ "MIT" ]
2
2021-01-27T12:22:11.000Z
2021-01-31T03:32:08.000Z
tests/test_versions.py
jaleskovec/reqcheck
ffc13cd28127f751617cdd29f7003866341fca58
[ "MIT" ]
null
null
null
import unittest from datetime import datetime, timedelta from pkg_resources import parse_version import reqcheck.versions as versions class GetBehindNumVersionsTest(unittest.TestCase): def setUp(self): self.versions = [ {'version': parse_version('1.0.1')}, {'version': parse_version('1.0.2')}, {'version': parse_version('1.0.3')}, ] def testWhenVersionNotFound(self): self.assertEqual(None, versions.get_behind_num_versions(self.versions, parse_version('1.0.1'), parse_version('5.1'))) self.assertEqual(None, versions.get_behind_num_versions(self.versions, parse_version('5.1'), parse_version('1.0.1'))) class GetBehindTimeDeltaTest(unittest.TestCase): def setUp(self): self.versions = [ {'version': parse_version('1.0.1'), 'last_upload': datetime(2016, 10, 22, 12, 34, 56)}, {'version': parse_version('1.0.2'), 'last_upload': datetime(2016, 10, 22, 14, 46, 24)}, ] def testWhenMissingVersion(self): self.assertEqual(None, versions.get_behind_time_delta(self.versions, parse_version('1.0.1'), None)) self.assertEqual(None, versions.get_behind_time_delta(self.versions, None, parse_version('1.0.2'))) def testWhenVersionsMatch(self): version = parse_version('1.0.1') self.assertEqual(timedelta(0), versions.get_behind_time_delta(self.versions, version, version)) def testResult(self): expected = self.versions[1]['last_upload'] - self.versions[0]['last_upload'] self.assertEqual(expected, versions.get_behind_time_delta(self.versions, parse_version('1.0.1'), parse_version('1.0.2'))) class DetermineBehindTest(unittest.TestCase): def setUp(self): self.versions = [ {'version': parse_version('1.0.0'), 'last_upload': datetime(2014, 10, 21, 17, 14, 45)}, {'version': parse_version('1.0.1'), 'last_upload': datetime(2016, 10, 22, 14, 14, 45)}, {'version': parse_version('1.0.2'), 'last_upload': datetime(2016, 10, 22, 16, 14, 45)}, {'version': parse_version('1.0.3'), 'last_upload': datetime(2018, 11, 12, 18, 10, 15)}, {'version': parse_version('1.0.4'), 'last_upload': datetime(2021, 1, 28, 18, 15, 30)}, ] def testWhenBehind(self): result = versions.determine_behind(self.versions, parse_version('1.0.1'), parse_version('1.0.4')) self.assertEqual((3, timedelta(days = 1559, seconds = 14445), '-3 versions (~ 4 years 99 days)'), result) def testWhenLatest(self): result = versions.determine_behind(self.versions, parse_version('1.0.4'), parse_version('1.0.4')) self.assertEqual((0, timedelta(days = 0), 'latest'), result) class DetermineAgeTest(unittest.TestCase): def setUp(self): self.versions = [ {'version': parse_version('1.0.0'), 'last_upload': datetime(2014, 10, 21, 17, 14, 45)}, {'version': parse_version('1.0.1'), 'last_upload': datetime(2016, 10, 22, 14, 14, 45)}, {'version': parse_version('1.0.2'), 'last_upload': datetime(2016, 10, 22, 16, 14, 45)}, {'version': parse_version('1.0.3'), 'last_upload': datetime(2018, 11, 12, 18, 10, 15)}, {'version': parse_version('1.0.4'), 'last_upload': datetime(2021, 1, 28, 18, 15, 30)}, ] def testWhenVersionFound(self): result = versions.determine_age(self.versions, parse_version('1.0.3'), datetime(2021, 1, 29)) self.assertEqual((timedelta(days = 808, seconds = 20985), '~ 2 years 78 days (2018-11-12)'), result) def testWhenVersionNotFound(self): result = versions.determine_age(self.versions, parse_version('1.20.12'), datetime(2021, 1, 29)) self.assertEqual((None, 'unknown'), result)
49.064935
129
0.642139
501
3,778
4.706587
0.161677
0.157761
0.154368
0.160305
0.7095
0.695081
0.641221
0.601357
0.601357
0.594996
0
0.100293
0.187136
3,778
76
130
49.710526
0.667535
0
0
0.338983
0
0
0.127316
0
0
0
0
0
0.169492
1
0.20339
false
0
0.067797
0
0.338983
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
bd33d681a6be39dde7d89c1d2456e4e15b7cbc67
296
py
Python
src/code42cli/cmds/shell.py
maddie-vargo/code42cli
fde4a70d4810923b668e8ca2d8d00af75c567dd1
[ "MIT" ]
14
2020-07-15T13:55:53.000Z
2022-02-24T19:09:50.000Z
src/code42cli/cmds/shell.py
maddie-vargo/code42cli
fde4a70d4810923b668e8ca2d8d00af75c567dd1
[ "MIT" ]
213
2020-07-16T14:21:00.000Z
2022-03-29T16:08:08.000Z
src/code42cli/cmds/shell.py
maddie-vargo/code42cli
fde4a70d4810923b668e8ca2d8d00af75c567dd1
[ "MIT" ]
11
2020-07-15T13:58:09.000Z
2022-03-29T17:33:51.000Z
import click import IPython from code42cli import BANNER from code42cli.options import sdk_options @click.command() @sdk_options() def shell(state): """Open an IPython shell with py42 initialized as `sdk`.""" IPython.embed(colors="Neutral", banner1=BANNER, user_ns={"sdk": state.sdk})
22.769231
79
0.743243
41
296
5.292683
0.585366
0.119816
0
0
0
0
0
0
0
0
0
0.027344
0.135135
296
12
80
24.666667
0.820313
0.179054
0
0
0
0
0.042194
0
0
0
0
0
0
1
0.125
false
0
0.5
0
0.625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
bd3b2ec0d2c9b53564b73ae83d10294a44c47243
269
py
Python
datos_modelar/clean_data.py
alexvaca0/EquipoGamma
6999cb2d24104c9cabdbfbddcb3d2746f395b0ba
[ "MIT" ]
null
null
null
datos_modelar/clean_data.py
alexvaca0/EquipoGamma
6999cb2d24104c9cabdbfbddcb3d2746f395b0ba
[ "MIT" ]
null
null
null
datos_modelar/clean_data.py
alexvaca0/EquipoGamma
6999cb2d24104c9cabdbfbddcb3d2746f395b0ba
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ Created on Wed Feb 6 23:26:38 2019 @author: avaca """ import pandas as pd import numpy as np from sklearn.model_selection import GridSearchCV complete_data = pd.read_csv('', encoding = 'utf-8') vars_categ = ['HY_provincia', 'HY_tipo']
16.8125
51
0.69145
42
269
4.285714
0.833333
0.044444
0
0
0
0
0
0
0
0
0
0.057778
0.163569
269
15
52
17.933333
0.742222
0.275093
0
0
0
0
0.129032
0
0
0
0
0
0
1
0
false
0
0.6
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
0
0
0
1
0
1
0
0
2
1fa567e6eb55b654152cc249c03df4836f9c4a5f
340
py
Python
restart/TokenyjcL/Float.py
yujiecong/yjcL
6d6dc4ad3611cb34c07192a1a3038a1ac3f67d6c
[ "MIT" ]
null
null
null
restart/TokenyjcL/Float.py
yujiecong/yjcL
6d6dc4ad3611cb34c07192a1a3038a1ac3f67d6c
[ "MIT" ]
null
null
null
restart/TokenyjcL/Float.py
yujiecong/yjcL
6d6dc4ad3611cb34c07192a1a3038a1ac3f67d6c
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: UTF-8 -*- ''' @IDE :PyCharm @Project :yjcL @USER :yanyin @File :Float.py @Author :yujiecong @Date :2021/9/1 16:19 ''' from restart.TokenyjcL.Token import Token_yjcL class Float_yjcL(Token_yjcL): def __init__(self,valueDict): super(Float_yjcL, self).__init__(valueDict)
21.25
51
0.652941
46
340
4.565217
0.76087
0.085714
0
0
0
0
0
0
0
0
0
0.040293
0.197059
340
16
51
21.25
0.728938
0.482353
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0
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
1fac74b876540807e88381140691e44fb1871829
6,417
py
Python
src/webinterface.py
Wassasin/vrijbrief
de081395c651e73a436662bfe09f4542e0ca27c7
[ "MIT" ]
null
null
null
src/webinterface.py
Wassasin/vrijbrief
de081395c651e73a436662bfe09f4542e0ca27c7
[ "MIT" ]
1
2015-02-07T23:36:13.000Z
2015-02-07T23:36:13.000Z
src/webinterface.py
Wassasin/vrijbrief
de081395c651e73a436662bfe09f4542e0ca27c7
[ "MIT" ]
2
2015-02-07T20:01:18.000Z
2021-05-13T13:21:11.000Z
import browser import re import datetime from bs4 import BeautifulSoup, NavigableString RX_OCCUPATION = re.compile(r"([0-9]+)/([0-9]+)") RX_TIME = re.compile(r"([0-9]{2}:[0-9]{2})-([0-9]{2}:[0-9]{2})") RX_FULLDATE = re.compile(r"[a-z]{2} ([0-9]{2}) ([a-z]{3}) ([0-9]{4})") MONTHS = ["jan", "feb", "maa", "apr", "mei", "jun", "jul", "aug", "sep", "okt", "nov", "dec"] class AuthenticationFailure(Exception): pass class Webinterface: def login(self, mode=None): # Prime session self.b.open_url("https://publiek.usc.ru.nl/publiek/login.php") # Submit mode body = self.b.open_url("https://publiek.usc.ru.nl/publiek/login.php", [("PRESET[Login][login_groep][]", self.mode)]) # Submit login form self.b.open_url("https://publiek.usc.ru.nl/publiek/login.php", [("username", self.username), ("password", self.password)]) # Open main page; check if login was successful body, _headers = self.b.open_url("https://publiek.usc.ru.nl/publiek/") soup = BeautifulSoup(body) if soup.find("a", href="logout.php") is None: raise AuthenticationFailure print "Logged in successfully as '%s'" % soup.find("div", "pullrightfooterinfo").string.strip() pass def __init__(self, username, password, mode='S_RU'): self.username = username self.password = password self.mode = mode self.b = browser.Browser("Vrijbrief/0.1") self.login() pass def parseDate(self, date): matched = RX_FULLDATE.match(date) d, mstr, y = matched.groups() m = MONTHS.index(mstr)+1 return datetime.date(int(y), int(m), int(d)) def listCategories(self): body, _headers = self.b.open_url("https://publiek.usc.ru.nl/publiek/laanbod.php") soup = BeautifulSoup(body, "html5lib") groups = soup.find("form", id="target") current_series = None for tr in groups.children: if type(tr) is NavigableString: continue elif tr.has_attr('class') and "list-group-item-heading" in tr["class"]: current_series = tr.find("b").get_text().strip() elif tr.name == "label": assert current_series is not None inputradio = tr.find("input") assert inputradio["name"] == "PRESET[Laanbod][inschrijving_id_pool_id][]" value = inputradio["value"] pool = tr.find('i').get_text().strip() yield value, current_series, pool def listEntries(self, catId): body, _headers = self.b.open_url("https://publiek.usc.ru.nl/publiek/laanbod.php", [("PRESET[Laanbod][inschrijving_id_pool_id][]", catId)]) soup = BeautifulSoup(body) groups = soup.find("table", class_="responstable clickabletr") for tr in groups.find_all("tr"): if not tr.has_attr("class") or "clickabletr" not in tr["class"]: continue fields = tr.find_all("td") date = fields[0].get_text().strip() time = fields[1].get_text().strip() accesskey = fields[2].a["href"] occupation = fields[3].get_text().strip() availability = 0 if occupation != "VOL": occupation_matched = RX_OCCUPATION.match(occupation) assert occupation_matched availability = int(occupation_matched.groups()[1]) - int(occupation_matched.groups()[0]) time_matched = RX_TIME.match(time) assert(time_matched) startTime, endTime = time_matched.groups() date = self.parseDate(date) yield date, startTime, endTime, availability, accesskey pass def addEntry(self, accesskey): # View entry page body, _headers = self.b.open_url("https://publiek.usc.ru.nl/publiek/" + accesskey) soup = BeautifulSoup(body) a = soup.find("a", class_="btn btn-responsive btn-success pull-right") assert(a.get_text().strip() == "Toevoegen aan Keuzelijst") # Press on add-button confirmkey = a["href"] body, _headers = self.b.open_url("https://publiek.usc.ru.nl/publiek/" + confirmkey) pass def confirm(self): body, _headers = self.b.open_url("https://publiek.usc.ru.nl/publiek/bevestigen.php", [("actie", "bevestig"), ("tabel", "klant"), ("kolom", "klant_id"), ("waarde", self.username)]) # Confirming logs you out; thus we need to log back in self.login() pass def listReservations(self): body, _headers = self.b.open_url("https://publiek.usc.ru.nl/publiek/overzicht.php") soup = BeautifulSoup(body) reservations_label = soup.find(text="Reserveringen Locaties") if reservations_label is None: return thr = list(reservations_label.parents)[3] assert thr.name == "tr" for tr in thr.find_next_siblings("tr"): fields = tr.find_all("td") accesskey = fields[0].a["href"] pool = fields[1].get_text().strip() date = fields[2].get_text().strip() time = fields[3].get_text().strip() time_matched = RX_TIME.match(time) assert(time_matched) startTime, endTime = time_matched.groups() date = self.parseDate(date) yield pool, date, startTime, endTime, accesskey pass def killReservation(self, accesskey): body, _headers = self.b.open_url("https://publiek.usc.ru.nl/publiek/" + accesskey) soup = BeautifulSoup(body) linschrijving_id = soup.find("input", attrs={"name": "linschrijving_id"})["value"] self.b.open_url("https://publiek.usc.ru.nl/publiek/" + accesskey, [("linschrijving_id", linschrijving_id), ("actie", "bevestig"), ("tabel", "klant"), ("kolom", "klant_id"), ("waarde", self.username)]) print "Killed %s" % linschrijving_id pass
38.196429
158
0.555244
739
6,417
4.711773
0.262517
0.018667
0.031017
0.041356
0.350661
0.303561
0.284607
0.284607
0.284607
0.28116
0
0.009133
0.300452
6,417
167
159
38.42515
0.76654
0.027739
0
0.252174
0
0.017391
0.192425
0.027925
0
0
0
0
0.06087
0
null
null
0.095652
0.034783
null
null
0.017391
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
1fb417062e3b9b19b6daba41e40d879e942a6790
203
py
Python
px511-2021/code/qrCode/TestQrCode.py
Relex12/Decentralized-Password-Manager
0b861a310131782003a469d9c436e04e5bb05420
[ "MIT" ]
null
null
null
px511-2021/code/qrCode/TestQrCode.py
Relex12/Decentralized-Password-Manager
0b861a310131782003a469d9c436e04e5bb05420
[ "MIT" ]
null
null
null
px511-2021/code/qrCode/TestQrCode.py
Relex12/Decentralized-Password-Manager
0b861a310131782003a469d9c436e04e5bb05420
[ "MIT" ]
null
null
null
from QrCode import * # Sert pour tester sur un même pc à la fois la génération du QrCode et la lecture de celui ci if __name__ == '__main__': sync_other_device_QrCode() sync_this_device_QrCode()
33.833333
93
0.753695
34
203
4.088235
0.794118
0.172662
0
0
0
0
0
0
0
0
0
0
0.192118
203
6
94
33.833333
0.847561
0.448276
0
0
0
0
0.072072
0
0
0
0
0
0
1
0
true
0
0.25
0
0.25
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
1
0
0
0
0
0
0
2
1fc419f20f21c00b2f7e26ead5cc3549a10d6b37
662
py
Python
decorator/mark_with_args.py
levs72/pyneng-examples
d6288292dcf9d1ebc5a9db4a0d620bd11b4a2df9
[ "MIT" ]
11
2021-04-05T09:30:23.000Z
2022-03-09T13:27:56.000Z
decorator/mark_with_args.py
levs72/pyneng-examples
d6288292dcf9d1ebc5a9db4a0d620bd11b4a2df9
[ "MIT" ]
null
null
null
decorator/mark_with_args.py
levs72/pyneng-examples
d6288292dcf9d1ebc5a9db4a0d620bd11b4a2df9
[ "MIT" ]
11
2021-04-06T03:44:35.000Z
2022-03-04T21:20:40.000Z
def mark(**kwargs): print(f"Получил аргументы {kwargs}") def decorator(func): print(f"добавляем атрибуты функции {kwargs}") for name, value in kwargs.items(): setattr(func, name, value) return func decorator.data = kwargs return decorator def mark_2(**kwargs_mark): print(f"Получил аргументы {kwargs_mark}") def decorator(func): def inner(*args, **kwargs): return func(*args, **kwargs) print(f"добавляем атрибуты функции {kwargs_mark}") for name, value in kwargs_mark.items(): setattr(inner, name, value) return inner return decorator
24.518519
58
0.614804
78
662
5.153846
0.294872
0.059701
0.059701
0.109453
0.41791
0.179104
0
0
0
0
0
0.002083
0.274924
662
26
59
25.461538
0.835417
0
0
0.210526
0
0
0.199396
0
0
0
0
0
0
1
0.263158
false
0
0
0.052632
0.526316
0.210526
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
1fce94867341b2964e24bbb0a90fa03bff2006d5
2,201
py
Python
PyRods/examples/user_info.py
kaldrill/irodspython
9a1018429acf9e86af8fb7ea6f37fb397e0010da
[ "CNRI-Python" ]
null
null
null
PyRods/examples/user_info.py
kaldrill/irodspython
9a1018429acf9e86af8fb7ea6f37fb397e0010da
[ "CNRI-Python" ]
null
null
null
PyRods/examples/user_info.py
kaldrill/irodspython
9a1018429acf9e86af8fb7ea6f37fb397e0010da
[ "CNRI-Python" ]
null
null
null
# Copyright (c) 2013, University of Liverpool # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # # Author : Jerome Fuselier # from irods import * if __name__ == "__main__": status, myEnv = getRodsEnv() conn, errMsg = rcConnect(myEnv.rodsHost, myEnv.rodsPort, myEnv.rodsUserName, myEnv.rodsZone) status = clientLogin(conn) # Get the information present in the iCAT print getUserInfo(conn, myEnv.rodsUserName) #print getUserInfo(conn, myEnv.rodsUserName, myEnv.rodsZone) # Get an irodsUser object, the zone is optional user = getUser(conn, myEnv.rodsUserName) #user = getUser(conn, myEnv.rodsUserName, myEnv.rodsZone) print "Id:", user.getId() print "Name:", user.getName() print "Type:", user.getTypeName() print "Zone:", user.getZone() print "Info:", user.getInfo() print "Comment:", user.getComment() print "Create TS:", user.getCreateTs() print "Modify TS:", user.getModifyTs() # You can modify some of the fields if you are admin #user.setComment("Useful Comment") #user.setInfo("Useful info") # Be careful if you remove your user from rodsadmin you will have trouble to put it back #user.setTypeName("rodsuser") # Be careful with this one as changing the zone will change the authentication #user.setZone("newZone") # You can get the groups the user belongs to. You obtain irodsGroup instances print "Member of :" for g in user.getGroups(): print " -", g.getName() conn.disconnect()
37.305085
92
0.685597
293
2,201
5.122867
0.501706
0.056629
0.055963
0.037975
0.175883
0.066622
0.045303
0
0
0
0
0.002929
0.224443
2,201
59
93
37.305085
0.876391
0.594275
0
0
0
0
0.084589
0
0
0
0
0
0
0
null
null
0
0.05
null
null
0.55
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
1
0
2
1fd6f57e7b90621a24c47afd31d7bbd91668d230
59
py
Python
raising_exception_3.py
godontop/python-work
ea22e0df8b0b17605f5a434e556a388d1f75aa47
[ "MIT" ]
null
null
null
raising_exception_3.py
godontop/python-work
ea22e0df8b0b17605f5a434e556a388d1f75aa47
[ "MIT" ]
null
null
null
raising_exception_3.py
godontop/python-work
ea22e0df8b0b17605f5a434e556a388d1f75aa47
[ "MIT" ]
null
null
null
try: num = 5 / 0 except: print("An error occured") raise
11.8
26
0.644068
10
59
3.8
1
0
0
0
0
0
0
0
0
0
0
0.043478
0.220339
59
5
27
11.8
0.782609
0
0
0
0
0
0.266667
0
0
0
0
0
0
1
0
false
0
0
0
0
0.2
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
9506269afc0618a55f2884b0a52f8b3902a5b1f4
997
py
Python
config.py
anvme/TONTgContractBot
e5fa48d262faec26e2835daa6db764867a369672
[ "Apache-2.0" ]
null
null
null
config.py
anvme/TONTgContractBot
e5fa48d262faec26e2835daa6db764867a369672
[ "Apache-2.0" ]
null
null
null
config.py
anvme/TONTgContractBot
e5fa48d262faec26e2835daa6db764867a369672
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ##### TONTgBotContract Config # Edit starts here TgBotAPIKey = 'xxxx:yyyy' # API Keythat you get from @BotFather tg = 11111 # Your id, you can get it by sending command /id to bot @TONTgIDBot # Edit ends here tonoscli = '/opt/tonos-cli/target/release/tonos-cli' # Path to tonos-cli solccompiler = '/opt/ton-solidity-compiler/compiler/build/solc/solc' tvmlinker = '/opt/ton-tvm-linker/tvm_linker/target/debug/tvm_linker' compiler = '/opt/tontgbotcontract/data/compiler/' # Path to compiler tvc = '/opt/tontgbotcontract/data/tvc/' # Path to tvc sol = '/opt/tontgbotcontract/data/sol/' # Path to sol keys = '/opt/tontgbotcontract/data/keys/' # Path to keys tcurl = 'https://net.ton.dev' # tonos-cli net network gruntabi = "/opt/tontgbotcontract/data/Grunt.abi" ########## tontgcpath = '/opt/tontgbotcontract' # Folder with this bot. tontgcpathdb = '/opt/tontgbotcontract/db' # Folder with bot database. # ##### /TONTgBotContract Config
32.16129
78
0.713139
135
997
5.251852
0.518519
0.187588
0.1622
0
0
0
0
0
0
0
0
0.008102
0.1334
997
30
79
33.233333
0.8125
0.372116
0
0
0
0
0.649153
0.601695
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
950ac99a04713eeb0672575cefd8c1ec3997841b
4,377
py
Python
cnn_implementer/backends/halide.py
lwaeijen/cnn-mapping-tool
a41c2dccb820f6227ddb6d75af9213e187744826
[ "MIT" ]
null
null
null
cnn_implementer/backends/halide.py
lwaeijen/cnn-mapping-tool
a41c2dccb820f6227ddb6d75af9213e187744826
[ "MIT" ]
null
null
null
cnn_implementer/backends/halide.py
lwaeijen/cnn-mapping-tool
a41c2dccb820f6227ddb6d75af9213e187744826
[ "MIT" ]
null
null
null
import os import jinja2 import networkx as nx from ..utils import Logger from math import ceil, floor from ..model import Segment #Add function to Segments that generates unique names for internal nodes #Function is specific for halide backend, hence it is added here and not in the original definition of Segment def halide_name(self, layer_name): def sanitize(s): return s.replace('/','_') #if not on of our nodes, don't rename if layer_name not in self.nodes(): return sanitize(layer_name) #if an output, don't rename if layer_name in self.produces: return sanitize(layer_name) # This is an internal node, there might be other segments with similar named layers # return a name with the segment id added return sanitize(layer_name+'_seg'+str(self.id)) Segment.halide_name=halide_name class Halide(Logger): def __init__(self, **kwargs): #init super super(Halide, self).__init__(**kwargs) self.template_dir=os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates') self.main_template='main.c.j2' def implement(self, network, networkConfig, DEBUG=False, PROFILING=False, TRACING=False): self.network = network #contains the filenames of the binaries self.params = self.network.weights #sanity check assert(self.params and "Can not implement a network if the weights are not specified!") #convert config segments to real segments segments=[] inputs=0 info_msg=['Halide Backend implementing the selected segments:'] for segment_cfg in networkConfig.sorted_segments(self.network): #Init segment with required layers segment = Segment(network=network, layers=segment_cfg.layers) #convert to old-style tuple segments+=[(segment, segment_cfg)] #some extra bookkeeping for layer in segment.get_nodes(): if layer['type'] in ['input']: inputs+=1 #tell the user what we are up to info_msg+=[' - '+str(segment)] self.info('\n'.join(info_msg)) #render main code code = self.render({ 'segments': segments, 'number_inputs': inputs, 'debug': DEBUG, 'PROFILING': PROFILING, 'TRACING': TRACING, }) #return dictionary with filenames return code def render(self, context): #helper function to translate internal model dimensions to halide backend dimensions def rename(dim): rt = { 'x': 'n', 'y': 'm', 'zo': 'o', 'zi': 'i', 'x_i': 'n_i', 'y_i': 'm_i', 'zo_i': 'o_i', 'zi_i': 'i_i', 'x_o': 'n_o', 'y_o': 'm_o', 'zo_o': 'o_o', 'zi_o': 'i_o', } assert(dim in rt and "Error: unknown dimension, check your config file and also make sure it is analysed to ensure proper compute levels are defined") return rt[dim] def rename_order(order, postfix='', exclude=[]): return [ rename(dim)+postfix for dim in order if rename(dim)[0] not in exclude] def jinja_debug(text): print 'Halide Backend Template Debug:', text return #context to pass to jinja ctxt={ 'nx': nx, 'network': self.network, 'rename': rename, 'rename_order': rename_order, 'len': len, 'type': type, 'range': range, 'enumerate': enumerate, 'max': max, 'min': min, 'params': self.params, 'map': map, 'str': str, 'int': int, 'float': float, 'floor': floor, 'ceil': ceil, 'list': list, } ctxt.update(context) #set the environment env=jinja2.Environment( loader=jinja2.FileSystemLoader(self.template_dir) ) #add filter env.filters['dbg']=jinja_debug #load template and render return env.get_template(self.main_template).render(ctxt)
31.042553
162
0.558145
516
4,377
4.622093
0.366279
0.022642
0.023899
0.028931
0.01761
0.01761
0
0
0
0
0
0.002427
0.341101
4,377
140
163
31.264286
0.824549
0.179118
0
0.021739
1
0.01087
0.139978
0
0
0
0
0
0.021739
0
null
null
0
0.065217
null
null
0.01087
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
952983a05bf28fe82e2cd622f5d71bbde9e46c7c
876
py
Python
tr_converter.py
EFatihAydin/contverter_error_utf8
971035644425af69d48b869d0de1668127843f01
[ "MIT" ]
null
null
null
tr_converter.py
EFatihAydin/contverter_error_utf8
971035644425af69d48b869d0de1668127843f01
[ "MIT" ]
null
null
null
tr_converter.py
EFatihAydin/contverter_error_utf8
971035644425af69d48b869d0de1668127843f01
[ "MIT" ]
null
null
null
file = open("./data.txt" , encoding = 'utf-8') data = file.readlines() liste=[] for string in data: string=string.replace('ü','ü') string=string.replace('ÅŸ','ş') string=string.replace('ÄŸ','ğ') string=string.replace('ç','ç') string=string.replace('ı','ı') string=string.replace('ö','ö') string=string.replace('Ü','Ü') string=string.replace('Ö','Ö') string=string.replace('İ','İ') string=string.replace('Ş','Ş') string=string.replace('Ğ','Ğ') string=string.replace('Ç','Ç') string=string.replace("ý","ı") string=string.replace("ð","ğ") string=string.replace("þ","ş") string=string.replace("Ð","Ğ") string=string.replace("Ý","İ") string=string.replace("Þ","Ş") string=string.lower() liste.append(string) with open('./dosya_out.txt' , 'w' , encoding = 'utf-8') as fl: for i in liste: fl.write(str(i))
27.375
63
0.615297
142
876
3.873239
0.352113
0.414545
0.621818
0.145455
0.327273
0.209091
0.209091
0.145455
0
0
0
0.002635
0.133562
876
31
64
28.258065
0.704875
0
0
0
0
0
0.099526
0
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
95300a9bbee2d9246ae4298544114b63521e0cfa
2,851
py
Python
arachne/lingo.py
Darumin/arachne
ddae1c9f47e177941a6d6deed84357cbf41ad116
[ "MIT" ]
1
2020-08-24T05:19:05.000Z
2020-08-24T05:19:05.000Z
arachne/lingo.py
Darumin/arachne
ddae1c9f47e177941a6d6deed84357cbf41ad116
[ "MIT" ]
null
null
null
arachne/lingo.py
Darumin/arachne
ddae1c9f47e177941a6d6deed84357cbf41ad116
[ "MIT" ]
null
null
null
from enum import Enum import arachne.nouns as a nouns = ( a.Container, a.Item, a.Door, a.Room, a.Key, a.Door ) class Verb(Enum): # basic player actions LOOK = 'im rotating it in my mind' TAKE = 'the act of picking things up' DROP = 'the act of putting things down' PUT = 'the act of placing things where you want them' EXAMINE = 'when you want to really see something' INVENTORY = 'when you really want to see your somethings' USE = 'when you want to spend your somethings' # room limitation actions OPEN = 'open a container or door' CLOSE = 'close a container or door' UNLOCK = 'unlock a container or door' LOCK = 'lock a container or door' # social and personal actions THINK = 'can be used as an objective tracker' ASK = '' TELL = '' SAY = '' GIVE = '' SHOW = '' # sequence actions WAIT = '' REPEAT = '' # case of bad verb NULL = 'invalid input' # this is an arachne object, in the english grammar sense. # not to be confused with object types. class Object(Enum): FOUND = 'there is something like that nearby' MULTIPLE = 'there is more than one thing like that nearby' NONEXISTENT = 'there is nothing like that nearby' UNSPECIFIED = 'there is nothing' POSSESSED = 'not in a scary sense, but in a carry sense' ALL = 'every loose item nearby' class Prep(Enum): WITHIN = 'put the toy in the box' ATOP = 'place the toy on the box' SETTING = 'turn the dial to ten' NONE = 'no prep specified' class Compass(Enum): NORTH = 'north' EAST = 'east' WEST = 'west' SOUTH = 'south' NORTHEAST = 'northeast' NORTHWEST = 'northwest' SOUTHEAST = 'southeast' SOUTHWEST = 'southwest' UP = 'going up' DOWN = 'coming down' # encompasses all known in-game vocabulary, unmatched vocab always default to type Object lexicon = ( ('ARTICLES', '^the$|^a$|^an$|^some$'), (Compass.NORTH, '^north$|^n$'), (Compass.EAST, '^east$|^e$'), (Compass.WEST, '^west$|^w$'), (Compass.SOUTH, '^south$|^s$'), (Compass.NORTHEAST, '^northeast$|^ne$'), (Compass.NORTHWEST, '^northwest$|^nw$'), (Compass.SOUTHEAST, '^southeast$|^se$'), (Compass.SOUTHWEST, '^southwest$|^sw$'), (Compass.UP, '^up$|^u$'), (Compass.DOWN, '^down$|^d$'), (Verb.LOOK, '^look$'), (Verb.TAKE, '^take$|^get$'), (Verb.DROP, '^drop$'), (Verb.PUT, '^put$|^store$|^place$'), (Verb.EXAMINE, '^x$|^check$|^examine$'), (Verb.INVENTORY, '^i$|^inv$|^inventory$'), (Verb.USE, '^use$|^consume$|^spend$'), (Verb.OPEN, '^open$'), (Verb.CLOSE, '^close$'), (Verb.UNLOCK, '^unlock$'), (Verb.LOCK, '^lock$'), (Prep.WITHIN, '^in$|^inside$|^into$'), (Prep.ATOP, '^on$|^above$'), (Prep.SETTING, '^at$|^to$') )
24.577586
89
0.591371
369
2,851
4.569106
0.455285
0.029656
0.02847
0.03796
0
0
0
0
0
0
0
0
0.244826
2,851
115
90
24.791304
0.783093
0.101368
0
0
0
0
0.420682
0.041911
0
0
0
0
0
1
0
false
0.135802
0.024691
0
0.567901
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
9531452916d8af98d79a18cfcf7c243ec86f577d
488
py
Python
src/hera/host_alias.py
bchalk101/hera-workflows
a3e9262f996ba477a35850c7e4b18ce3d5749687
[ "MIT" ]
84
2021-10-20T17:20:22.000Z
2022-03-31T17:20:06.000Z
src/hera/host_alias.py
bchalk101/hera-workflows
a3e9262f996ba477a35850c7e4b18ce3d5749687
[ "MIT" ]
84
2021-10-31T16:05:51.000Z
2022-03-31T14:25:25.000Z
src/hera/host_alias.py
bchalk101/hera-workflows
a3e9262f996ba477a35850c7e4b18ce3d5749687
[ "MIT" ]
18
2021-11-01T04:34:39.000Z
2022-03-29T03:48:19.000Z
from typing import List from argo_workflows.models import HostAlias as ArgoHostAlias from pydantic import BaseModel class HostAlias(BaseModel): """mapping between IP and hostnames Notes ----- See https://github.com/argoproj/argo-workflows/blob/master/sdks/python/client/docs/HostAlias.md """ hostnames: List[str] ip: str @property def argo_host_alias(self) -> ArgoHostAlias: return ArgoHostAlias(hostnames=self.hostnames, ip=self.ip)
23.238095
103
0.715164
60
488
5.766667
0.633333
0.075145
0
0
0
0
0
0
0
0
0
0
0.188525
488
20
104
24.4
0.873737
0.297131
0
0
0
0
0
0
0
0
0
0
0
1
0.111111
false
0
0.333333
0.111111
0.888889
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
1
0
0
0
2
20ff397b31725a7c336cc66646521d603dc8bb92
389
py
Python
task_queuing/tasks/custom.py
joejcollins/lieutenant-dean
eea536a146fb89b2feca244d5c4cf68e662cf2f2
[ "MIT" ]
null
null
null
task_queuing/tasks/custom.py
joejcollins/lieutenant-dean
eea536a146fb89b2feca244d5c4cf68e662cf2f2
[ "MIT" ]
null
null
null
task_queuing/tasks/custom.py
joejcollins/lieutenant-dean
eea536a146fb89b2feca244d5c4cf68e662cf2f2
[ "MIT" ]
null
null
null
"""Custom celery task to capitalize text""" import task_queuing.celery_app as app class Capitalize(app.queue_broker.Task): """Custom task without the decorator""" def run(self, text): capitalized = text.upper() return capitalized @app.queue_broker.task(base=Capitalize) def shit(x): print('shit') return "val" # app.queues.tasks.register(Capitalize)
19.45
43
0.694087
51
389
5.215686
0.588235
0.06015
0.105263
0.135338
0
0
0
0
0
0
0
0
0.18509
389
19
44
20.473684
0.839117
0.282776
0
0
0
0
0.026119
0
0
0
0
0
0
1
0.222222
false
0
0.111111
0
0.666667
0.111111
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
1f0aed11f4fb176f853b2e44dfcbd9b5e33ba39f
16,468
py
Python
src/model_transforms.py
pmclSF/DeepCompress
6fc51aa0e9b34fb89f97877ad56da6345f93b929
[ "MIT" ]
8
2021-03-11T10:56:35.000Z
2022-02-24T12:44:33.000Z
src/model_transforms.py
pmclSF/DeepCompress
6fc51aa0e9b34fb89f97877ad56da6345f93b929
[ "MIT" ]
null
null
null
src/model_transforms.py
pmclSF/DeepCompress
6fc51aa0e9b34fb89f97877ad56da6345f93b929
[ "MIT" ]
null
null
null
from enum import Enum import tensorflow.compat.v1 as tf from tensorflow.keras.layers import Layer, Conv3D, Conv3DTranspose, AveragePooling3D from tensorflow_core.python.keras.utils import conv_utils import tensorflow_compression as tfc import tensorflow.keras as keras def relu(): return keras.activations.relu def CGDN(): return tfc.GDN(alpha_parameter=1, epsilon_parameter=1) # ad-hoc alert: specify the activation using this: #ACTIVATION = relu # define a function similar to relu() to instantiate a GDN with alternative parameters ACTIVATION = tfc.GDN #ACTIVATION = CGDN def get_channel_axis(data_format): return 1 if data_format == 'channels_first' else -1 class SequentialLayer(Layer): def __init__(self, layers, *args, **kwargs): super(SequentialLayer, self).__init__(*args, **kwargs) self._layers = layers def call(self, tensor, **kwargs): for layer in self._layers: tensor = layer(tensor) return tensor class ResidualLayer(Layer): def __init__(self, layers, residual_mode='add', data_format=None, *args, **kwargs): super(ResidualLayer, self).__init__(*args, **kwargs) assert residual_mode in ('add', 'concat') self._layers = layers self.residual_mode = residual_mode self.data_format = conv_utils.normalize_data_format(data_format) def call(self, tensor, **kwargs): tensor = self._layers[0](tensor) tensor1 = tensor for layer in self._layers[1:]: tensor = layer(tensor) if self.residual_mode == 'add': return tensor1 + tensor else: return tf.concat((tensor, tensor1), get_channel_axis(self.data_format)) class AnalysisTransformV1(SequentialLayer): def __init__(self, filters, data_format=None, activation=tf.nn.relu, *args, **kwargs): data_format = conv_utils.normalize_data_format(data_format) params = {'strides': (2, 2, 2), 'padding': 'same', 'data_format': data_format, 'filters': filters} layers = [Conv3D(kernel_size=(9, 9, 9), use_bias=True, activation=activation, **params), Conv3D(kernel_size=(5, 5, 5), use_bias=True, activation=activation, **params), Conv3D(kernel_size=(5, 5, 5), use_bias=False, activation=None, **params)] super(AnalysisTransformV1, self).__init__(layers, *args, **kwargs) class SynthesisTransformV1(SequentialLayer): def __init__(self, filters, data_format=None, activation=tf.nn.relu, *args, **kwargs): data_format = conv_utils.normalize_data_format(data_format) params = {'strides': (2, 2, 2), 'padding': 'same', 'data_format': data_format, 'use_bias': True, 'activation': activation} layers = [Conv3DTranspose(filters, (5, 5, 5), **params), Conv3DTranspose(filters, (5, 5, 5), **params), Conv3DTranspose(1, (9, 9, 9), **params)] super(SynthesisTransformV1, self).__init__(layers, *args, **kwargs) class AnalysisBlock(ResidualLayer): def __init__(self, filters, data_format=None, kernel_size=(3, 3, 3), strides=(2, 2, 2), activation=tf.nn.relu, *args, **kwargs): data_format = conv_utils.normalize_data_format(data_format) params = {'padding': 'same', 'data_format': data_format, 'filters': filters, 'kernel_size': kernel_size, 'use_bias': True} layers = [Conv3D(strides=strides, activation=activation() **params), Conv3D(activation=activation(), **params), Conv3D(activation=activation(), **params)] super(AnalysisBlock, self).__init__(layers, *args, data_format=data_format, **kwargs) class SynthesisBlock(ResidualLayer): def __init__(self, filters, data_format=None, kernel_size=(3, 3, 3), strides=(2, 2, 2), activation=tf.nn.relu, *args, **kwargs): data_format = conv_utils.normalize_data_format(data_format) params = {'padding': 'same', 'data_format': data_format, 'use_bias': True, 'activation': activation, 'filters': filters, 'kernel_size': kernel_size} layers = [Conv3DTranspose(strides=strides, **params), Conv3DTranspose(**params), Conv3DTranspose(**params)] super(SynthesisBlock, self).__init__(layers, *args, data_format=data_format, **kwargs) class AnalysisBlockV3(ResidualLayer): def __init__(self, filters, data_format=None, kernel_size=(3, 3, 3), strides=(2, 2, 2), activation=tf.nn.relu, *args, **kwargs): data_format = conv_utils.normalize_data_format(data_format) params = {'padding': 'same', 'data_format': data_format, 'filters': filters, 'kernel_size': kernel_size, 'use_bias': True} layers = [Conv3D(strides=strides, activation=activation() **params), AnalysisBlockV3Base(filters=filters, data_format=data_format), AnalysisBlockV3Base(filters=filters, data_format=data_format)] super(AnalysisBlockV3, self).__init__(layers, *args, data_format=data_format, **kwargs) class AnalysisBlockV3Base(SequentialLayer): def __init__(self, filters, data_format=None, activation=ACTIVATION, *args, **kwargs): self.data_format = conv_utils.normalize_data_format(data_format) params = {'padding': 'same', 'data_format': data_format, 'use_bias': True} self.paths = [[Conv3D(kernel_size=(1,1,1), activation=activation(), filters=filters // 4, **params)], [Conv3D(kernel_size=(1,1,1), activation=activation(), filters=filters // 2, **params), [Conv3D(kernel_size=(1,1,3), activation=activation(), filters=filters // 4, **params), Conv3D(kernel_size=(3,3,1), activation=activation(), filters=filters // 4, **params), Conv3D(kernel_size=(3,1,1), activation=activation(), filters=filters // 4, **params), Conv3D(kernel_size=(1,3,3), activation=activation(), filters=filters // 4, **params), Conv3D(kernel_size=(1,3,1), activation=activation(), filters=filters // 4, **params), Conv3D(kernel_size=(3,1,3), activation=activation(), filters=filters // 4, **params)]]] super(AnalysisBlockV3Base, self).__init__(Self.paths, *args, **kwargs) def call(self, tensor, **kwargs): path_outs = [tensor, tensor] for p in self.paths[0]: path_outs[0] = p(path_outs[0]) path_outs[1] = self.paths[1][0](path_outs[1]) sub_outs = [path_outs[1], path_outs[1], path_outs[1]] sub_outs[0] = self.paths[1][1][0](sub_outs[0]) sub_outs[0] = self.paths[1][1][1](sub_outs[0]) sub_outs[1] = self.paths[1][1][2](sub_outs[1]) sub_outs[1] = self.paths[1][1][3](sub_outs[1]) sub_outs[2] = self.paths[1][1][4](sub_outs[2]) sub_outs[2] = self.paths[1][1][5](sub_outs[2]) return tf.concat((path_outs[0], sub_outs[0], sub_outs[1], sub_outs[2]), get_channel_axis(self.data_format)) class ResidualLayerV2(Layer): def __init__(self, layers, residual_mode='add', data_format=None, *args, **kwargs): super(ResidualLayerV2, self).__init__(*args, **kwargs) assert residual_mode in ('add', 'concat') self._layers = layers self.residual_mode = residual_mode self.data_format = conv_utils.normalize_data_format(data_format) def call(self, tensor, **kwargs): tensor = self._layers[0](tensor) tensor1 = tensor layer = self._layers[1] tensor = layer(tensor) tensor2 = tensor layer = self._layers[2] tensor = layer(tensor + tensor1) return tensor1 + tensor2 + tensor class AnalysisBlockV4(ResidualLayerV2): def __init__(self, filters, data_format=None, kernel_size=(3, 3, 3), strides=(2, 2, 2), activation=tf.nn.relu, *args, **kwargs): data_format = conv_utils.normalize_data_format(data_format) params = {'padding': 'same', 'data_format': data_format, 'filters': filters, 'kernel_size': kernel_size, 'use_bias': True} layers = [Conv3D(strides=strides, activation=activation() **params), AnalysisBlockV3Base(filters=filters, data_format=data_format), AnalysisBlockV3Base(filters=filters, data_format=data_format)] super(AnalysisBlockV4, self).__init__(layers, *args, data_format=data_format, **kwargs) class AnalysisTransformV2(SequentialLayer): def __init__(self, filters, data_format=None, kernel_size=(3, 3, 3), activation=tf.nn.relu, residual_mode='add', *args, **kwargs): data_format = conv_utils.normalize_data_format(data_format) params = {'kernel_size': kernel_size, 'activation': activation, 'data_format': data_format, 'residual_mode': residual_mode} layers = [AnalysisBlock(filters // 2, **params), AnalysisBlock(filters, **params), AnalysisBlock(filters, **params), Conv3D(filters, kernel_size, padding="same", use_bias=False, activation=None, data_format=data_format)] super(AnalysisTransformV2, self).__init__(layers, *args, **kwargs) class SynthesisTransformV2(SequentialLayer): def __init__(self, filters, data_format=None, kernel_size=(3, 3, 3), activation=tf.nn.relu, residual_mode='add', *args, **kwargs): data_format = conv_utils.normalize_data_format(data_format) params = {'kernel_size': kernel_size, 'activation': activation, 'data_format': data_format, 'residual_mode': residual_mode} layers = [SynthesisBlock(filters, **params), SynthesisBlock(filters, **params), SynthesisBlock(filters // 2, **params), Conv3DTranspose(1, kernel_size, padding="same", use_bias=True, activation=activation, data_format=data_format)] super(SynthesisTransformV2, self).__init__(layers, *args, **kwargs) class AnalysisTransformProgressiveV2(SequentialLayer): def __init__(self, filters, data_format=None, kernel_size=(3, 3, 3), activation=ACTIVATION, residual_mode='add', *args, **kwargs): data_format = conv_utils.normalize_data_format(data_format) params = {'kernel_size': kernel_size, 'activation': activation, 'data_format': data_format, 'residual_mode': residual_mode} layers = [AnalysisBlock(filters // 4, **params), AnalysisBlock(filters // 2, **params), AnalysisBlock(filters, **params), Conv3D(filters, kernel_size, padding="same", use_bias=False, activation=None, data_format=data_format)] super(AnalysisTransformProgressiveV2, self).__init__(layers, *args, **kwargs) class SynthesisTransformProgressiveV2(SequentialLayer): def __init__(self, filters, data_format=None, kernel_size=(3, 3, 3), activation=tf.nn.relu, residual_mode='add', *args, **kwargs): data_format = conv_utils.normalize_data_format(data_format) params = {'kernel_size': kernel_size, 'activation': activation, 'data_format': data_format, 'residual_mode': residual_mode} layers = [SynthesisBlock(filters, **params), SynthesisBlock(filters // 2, **params), SynthesisBlock(filters // 4, **params), Conv3DTranspose(1, kernel_size, padding="same", use_bias=True, activation=activation, data_format=data_format)] super(SynthesisTransformProgressiveV2, self).__init__(layers, *args, **kwargs) class AnalysisTransformProgressiveV3(SequentialLayer): def __init__(self, filters, data_format=None, activation=ACTIVATION, *args, **kwargs): data_format = conv_utils.normalize_data_format(data_format) params = {'activation': activation, 'data_format': data_format} layers = [AnalysisBlock(filters // 4, **params), AnalysisBlock(filters // 2, **params), AnalysisBlockV3(filters, **params), Conv3D(filters, (3, 3, 3), padding="same", use_bias=False, activation=None, data_format=data_format)] super(AnalysisTransformProgressiveV3, self).__init__(layers, *args, **kwargs) class AnalysisTransformProgressiveV4(SequentialLayer): def __init__(self, filters, data_format=None, activation=ACTIVATION, *args, **kwargs): data_format = conv_utils.normalize_data_format(data_format) params = {'activation': activation, 'data_format': data_format} layers = [AnalysisBlockV4(filters // 4, **params), AnalysisBlockV4(filters // 2, **params), AnalysisBlockV4(filters, **params), Conv3D(filters, (3, 3, 3), padding="same", use_bias=False, activation=None, data_format=data_format)] super(AnalysisTransformProgressiveV4, self).__init__(layers, *args, **kwargs) class AnalysisTransformProgressiveV5(SequentialLayer): def __init__(self, filters, data_format=None, activation=ACTIVATION, *args, **kwargs): data_format = conv_utils.normalize_data_format(data_format) params = {'activation': activation, 'data_format': data_format} layers = [AnalysisBlock(filters // 4, **params), AnalysisBlock(filters // 2, **params), AnalysisBlockV4(filters, **params), Conv3D(filters, (3, 3, 3), padding="same", use_bias=False, activation=None, data_format=data_format)] super(AnalysisTransformProgressiveV5, self).__init__(layers, *args, **kwargs) class AnalysisTransformProgressiveV6(SequentialLayer): def __init__(self, filters, data_format=None, activation=ACTIVATION, *args, **kwargs): data_format = conv_utils.normalize_data_format(data_format) params = {'activation': activation, 'data_format': data_format} layers = [AnalysisBlock(filters // 4, **params), AnalysisBlockV4(filters // 2, **params), AnalysisBlockV4(filters, **params), Conv3D(filters, (3, 3, 3), padding="same", use_bias=False, activation=None, data_format=data_format)] super(AnalysisTransformProgressiveV6, self).__init__(layers, *args, **kwargs) class HyperAnalysisTransform(SequentialLayer): def __init__(self, filters, data_format=None, kernel_size=(3, 3, 3), activation=tf.nn.relu, *args, **kwargs): data_format = conv_utils.normalize_data_format(data_format) params = {'padding': 'same', 'data_format': data_format, 'filters': filters, 'kernel_size': kernel_size} layers = [Conv3D(use_bias=True, activation=activation, **params), Conv3D(use_bias=True, activation=activation, strides=(2, 2, 2), **params), Conv3D(use_bias=False, activation=None, **params)] super(HyperAnalysisTransform, self).__init__(layers, *args, **kwargs) class HyperSynthesisTransform(SequentialLayer): def __init__(self, filters, data_format=None, kernel_size=(3, 3, 3), activation=tf.nn.relu, *args, **kwargs): data_format = conv_utils.normalize_data_format(data_format) params = {'padding': 'same', 'data_format': data_format, 'activation': activation, 'use_bias': True, 'filters': filters, 'kernel_size': kernel_size} layers = [Conv3DTranspose(**params), Conv3DTranspose(strides=(2, 2, 2), **params), Conv3DTranspose(**params)] super(HyperSynthesisTransform, self).__init__(layers, *args, **kwargs) class TransformType(Enum): AnalysisTransformV1 = AnalysisTransformV1 AnalysisTransformV2 = AnalysisTransformV2 AnalysisTransformProgressiveV2 = AnalysisTransformProgressiveV2 AnalysisTransformProgressiveV3 = AnalysisTransformProgressiveV3 AnalysisTransformProgressiveV4 = AnalysisTransformProgressiveV4 AnalysisTransformProgressiveV5 = AnalysisTransformProgressiveV5 AnalysisTransformProgressiveV6 = AnalysisTransformProgressiveV6 SynthesisTransformV1 = SynthesisTransformV1 SynthesisTransformV2 = SynthesisTransformV2 SynthesisTransformProgressiveV2 = SynthesisTransformProgressiveV2 HyperAnalysisTransform = HyperAnalysisTransform HyperSynthesisTransform = HyperSynthesisTransform
55.076923
197
0.660189
1,779
16,468
5.84317
0.066892
0.140452
0.070034
0.100048
0.743338
0.726696
0.674651
0.626647
0.610582
0.607888
0
0.022652
0.211865
16,468
298
198
55.261745
0.778257
0.010141
0
0.497976
0
0
0.04676
0
0
0
0
0
0.008097
1
0.109312
false
0
0.024292
0.012146
0.299595
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
1f12f143e8af312aabb54b8c1b32c57f8566b95e
793
py
Python
python/tHome/msgHub/__init__.py
ZigmundRat/T-Home
5dc8689f52d87dac890051e540b338b009293ced
[ "BSD-2-Clause" ]
18
2016-04-17T19:39:28.000Z
2020-11-19T06:55:20.000Z
python/tHome/msgHub/__init__.py
ZigmundRat/T-Home
5dc8689f52d87dac890051e540b338b009293ced
[ "BSD-2-Clause" ]
11
2018-09-07T18:34:41.000Z
2021-05-02T04:44:54.000Z
python/tHome/msgHub/__init__.py
ZigmundRat/T-Home
5dc8689f52d87dac890051e540b338b009293ced
[ "BSD-2-Clause" ]
12
2016-10-31T12:29:08.000Z
2021-12-28T12:18:28.000Z
#=========================================================================== # # msgHub package # #=========================================================================== __doc__ = """Zero-MQ Message Hub The msgHub is a pub/sub forwarder. All of the various data producers send messages to the msgHub as a single point of contact for the producers. Consumers of the messages read from the hub as a single point of contact for the consumers. Logging object name: tHome.msgHub """ #=========================================================================== #=========================================================================== from . import cmdLine from . import config from .start import start #===========================================================================
28.321429
76
0.387137
66
793
4.590909
0.560606
0.059406
0.059406
0.092409
0.191419
0.191419
0.191419
0.191419
0
0
0
0
0.108449
793
27
77
29.37037
0.428571
0.491803
0
0
0
0
0.748731
0
0
0
0
0
0
1
0
false
0
0.3
0
0.3
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
1f14b7efeb28f5b978cdbfde55415ea03866d4ca
569
py
Python
tests/Exscript/memtest_host.py
saveshodhan/exscript
72718eee3e87b345d5a5255be9824e867e42927b
[ "MIT" ]
226
2015-01-20T19:59:06.000Z
2022-01-02T11:13:01.000Z
tests/Exscript/memtest_host.py
saveshodhan/exscript
72718eee3e87b345d5a5255be9824e867e42927b
[ "MIT" ]
155
2015-01-02T07:56:27.000Z
2022-01-09T20:56:19.000Z
tests/Exscript/memtest_host.py
saveshodhan/exscript
72718eee3e87b345d5a5255be9824e867e42927b
[ "MIT" ]
114
2015-01-03T11:48:17.000Z
2022-01-26T02:50:43.000Z
from __future__ import print_function from builtins import str from builtins import range # This script is not meant to provide a fully automated test, it's # merely a hack/starting point for investigating memory consumption # manually. The behavior also depends heavily on the version of meliae. from meliae import scanner, loader from Exscript import Account, Host hostlist = [Host(str(i)) for i in range(1, 10000)] # accountlist = [Account(str(i)) for i in range(1, 10000)] scanner.dump_all_objects('test.dump') om = loader.load('test.dump') print(om.summarize())
35.5625
71
0.773286
90
569
4.811111
0.622222
0.055427
0.083141
0.036952
0.096998
0.096998
0.096998
0.096998
0
0
0
0.02454
0.140598
569
15
72
37.933333
0.860941
0.45167
0
0
0
0
0.058632
0
0
0
0
0
0
1
0
false
0
0.555556
0
0.555556
0.222222
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
1f26b6eb6d6dcadfa381edb1a417fab9d0a51f97
5,305
py
Python
python_graphs/instruction_test.py
reshinthadithyan/python-graphs
1234c448cb38af44c963d5ef7f8d99f678028104
[ "Apache-2.0" ]
53
2021-04-12T14:20:16.000Z
2022-03-29T02:47:30.000Z
python_graphs/instruction_test.py
reshinthadithyan/python-graphs
1234c448cb38af44c963d5ef7f8d99f678028104
[ "Apache-2.0" ]
2
2021-09-08T16:37:34.000Z
2022-03-15T17:32:36.000Z
python_graphs/instruction_test.py
reshinthadithyan/python-graphs
1234c448cb38af44c963d5ef7f8d99f678028104
[ "Apache-2.0" ]
14
2021-05-08T04:34:46.000Z
2022-01-16T12:58:16.000Z
# Copyright (C) 2021 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Tests for instruction module.""" from absl.testing import absltest import gast as ast from python_graphs import instruction as instruction_module def create_instruction(source): node = ast.parse(source) node = instruction_module._canonicalize(node) return instruction_module.Instruction(node) class InstructionTest(absltest.TestCase): def test_instruction(self): self.assertIsNotNone(instruction_module.Instruction) def test_represent_same_program_basic_positive_case(self): program1 = ast.parse('x + 1') program2 = ast.parse('x + 1') self.assertTrue( instruction_module.represent_same_program(program1, program2)) def test_represent_same_program_basic_negative_case(self): program1 = ast.parse('x + 1') program2 = ast.parse('x + 2') self.assertFalse( instruction_module.represent_same_program(program1, program2)) def test_represent_same_program_different_contexts(self): full_program1 = ast.parse('y = x + 1') # y is a write program1 = full_program1.body[0].targets[0] # 'y' program2 = ast.parse('y') # y is a read self.assertTrue( instruction_module.represent_same_program(program1, program2)) def test_get_accesses(self): instruction = create_instruction('x + 1') self.assertEqual(instruction.get_read_names(), {'x'}) self.assertEqual(instruction.get_write_names(), set()) instruction = create_instruction('return x + y + z') self.assertEqual(instruction.get_read_names(), {'x', 'y', 'z'}) self.assertEqual(instruction.get_write_names(), set()) instruction = create_instruction('fn(a, b, c)') self.assertEqual(instruction.get_read_names(), {'a', 'b', 'c', 'fn'}) self.assertEqual(instruction.get_write_names(), set()) instruction = create_instruction('c = fn(a, b, c)') self.assertEqual(instruction.get_read_names(), {'a', 'b', 'c', 'fn'}) self.assertEqual(instruction.get_write_names(), {'c'}) def test_get_accesses_augassign(self): instruction = create_instruction('x += 1') self.assertEqual(instruction.get_read_names(), {'x'}) self.assertEqual(instruction.get_write_names(), {'x'}) instruction = create_instruction('x *= y') self.assertEqual(instruction.get_read_names(), {'x', 'y'}) self.assertEqual(instruction.get_write_names(), {'x'}) def test_get_accesses_augassign_subscript(self): instruction = create_instruction('x[0] *= y') # This is not currently considered a write of x. It is a read of x. self.assertEqual(instruction.get_read_names(), {'x', 'y'}) self.assertEqual(instruction.get_write_names(), set()) def test_get_accesses_augassign_attribute(self): instruction = create_instruction('x.attribute *= y') # This is not currently considered a write of x. It is a read of x. self.assertEqual(instruction.get_read_names(), {'x', 'y'}) self.assertEqual(instruction.get_write_names(), set()) def test_get_accesses_subscript(self): instruction = create_instruction('x[0] = y') # This is not currently considered a write of x. It is a read of x. self.assertEqual(instruction.get_read_names(), {'x', 'y'}) self.assertEqual(instruction.get_write_names(), set()) def test_get_accesses_attribute(self): instruction = create_instruction('x.attribute = y') # This is not currently considered a write of x. It is a read of x. self.assertEqual(instruction.get_read_names(), {'x', 'y'}) self.assertEqual(instruction.get_write_names(), set()) def test_access_ordering(self): instruction = create_instruction('c = fn(a, b + c, d / a)') access_names_and_kinds = [(instruction_module.access_name(access), instruction_module.access_kind(access)) for access in instruction.accesses] self.assertEqual(access_names_and_kinds, [('fn', 'read'), ('a', 'read'), ('b', 'read'), ('c', 'read'), ('d', 'read'), ('a', 'read'), ('c', 'write')]) instruction = create_instruction('c += fn(a, b + c, d / a)') access_names_and_kinds = [(instruction_module.access_name(access), instruction_module.access_kind(access)) for access in instruction.accesses] self.assertEqual(access_names_and_kinds, [('fn', 'read'), ('a', 'read'), ('b', 'read'), ('c', 'read'), ('d', 'read'), ('a', 'read'), ('c', 'read'), ('c', 'write')]) if __name__ == '__main__': absltest.main()
42.782258
77
0.6541
664
5,305
5.019578
0.197289
0.09901
0.156016
0.174017
0.690969
0.672067
0.660366
0.658566
0.646265
0.646265
0
0.00791
0.213572
5,305
123
78
43.130081
0.790988
0.164373
0
0.45679
0
0
0.067831
0
0
0
0
0
0.320988
1
0.148148
false
0
0.037037
0
0.209877
0
0
0
0
null
0
0
1
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
0
0
0
0
0
0
0
0
0
2
1f3ab12d8151036391c9ff1e4b3cbf52e4305e09
1,147
py
Python
slacm/exceptions.py
SLAcM/SLAcM
62943f4a68725674b103c73fcbcd25bb9cb5890e
[ "Apache-2.0" ]
1
2022-01-13T03:19:24.000Z
2022-01-13T03:19:24.000Z
slacm/exceptions.py
SLAcM/SLAcM
62943f4a68725674b103c73fcbcd25bb9cb5890e
[ "Apache-2.0" ]
null
null
null
slacm/exceptions.py
SLAcM/SLAcM
62943f4a68725674b103c73fcbcd25bb9cb5890e
[ "Apache-2.0" ]
null
null
null
''' Created on Sep 19, 2020 @author: esdev ''' class SlacmException(Exception): ''' Base class for all SLAcM expressions ''' def __init__(self, message): super().__init__(message) class NotYetImplemented(SlacmException): def __init__(self, message): super().__init__(message) class LoadError(SlacmException): def __init__(self, message): super().__init__(message) class PeerOperationError(SlacmException): def __init__(self, message): super().__init__(message) class PortOperationError(SlacmException): def __init__(self, message): super().__init__(message) class UndefinedOperation(SlacmException): def __init__(self, message): super().__init__(message) class InvalidOperation(SlacmException): def __init__(self, message): super().__init__(message) class UndefinedHandler(SlacmException): def __init__(self, message): super().__init__(message) class ParameterLoadError(SlacmException): def __init__(self, message): super().__init__(message)
24.404255
41
0.652136
103
1,147
6.563107
0.271845
0.093195
0.14645
0.239645
0.677515
0.677515
0.677515
0.677515
0.548817
0
0
0.006889
0.240628
1,147
47
42
24.404255
0.769231
0.067132
0
0.666667
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0
0.666667
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
1f3fa004ef7cd2d4e23f674d416525c0f3924172
128
py
Python
rotatelist/rotatelist.py
tanaytoshniwal/Python-Programs
6553a2dcef5d26aad5a818cafd3c678ef59e8b82
[ "MIT" ]
1
2019-01-29T18:46:39.000Z
2019-01-29T18:46:39.000Z
rotatelist/rotatelist.py
AlphaBAT69/Python-Programs
6553a2dcef5d26aad5a818cafd3c678ef59e8b82
[ "MIT" ]
null
null
null
rotatelist/rotatelist.py
AlphaBAT69/Python-Programs
6553a2dcef5d26aad5a818cafd3c678ef59e8b82
[ "MIT" ]
null
null
null
def rotatelist(l,k): (i,t) = (1,l) while i<=k: (l,i) = (l[len(l)-1:len(l)] + l[0:len(l)-1],i+1) (rot,l) = (l,t) return rot
21.333333
50
0.484375
32
128
1.9375
0.375
0.193548
0.16129
0
0
0
0
0
0
0
0
0.04717
0.171875
128
6
51
21.333333
0.537736
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0
0
0.333333
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
1f4f35f139c907b889c9bfaceea5f2502d416ae2
2,099
py
Python
ironic/tests/drivers/test_base.py
Tehsmash/ironic
a34c351639e960af92a3608fbc9249dfce5c6057
[ "Apache-2.0" ]
null
null
null
ironic/tests/drivers/test_base.py
Tehsmash/ironic
a34c351639e960af92a3608fbc9249dfce5c6057
[ "Apache-2.0" ]
null
null
null
ironic/tests/drivers/test_base.py
Tehsmash/ironic
a34c351639e960af92a3608fbc9249dfce5c6057
[ "Apache-2.0" ]
null
null
null
# Copyright 2014 Cisco Systems, Inc. # 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. import mock from ironic.common import exception from ironic.drivers import base as driver_base from ironic.tests import base class FakeVendorInterface(driver_base.VendorInterface): def get_properties(self): pass @driver_base.passthru(['POST']) def noexception(self): return "Fake" @driver_base.passthru(['POST']) def ironicexception(self): raise exception.IronicException("Fake!") @driver_base.passthru(['POST']) def normalexception(self): raise Exception("Fake!") def validate(self, task, **kwargs): pass def driver_validate(self, **kwargs): pass class PassthruDecoratorTestCase(base.TestCase): def setUp(self): super(PassthruDecoratorTestCase, self).setUp() self.fvi = FakeVendorInterface() driver_base.LOG = mock.Mock() def test_passthru_noexception(self): result = self.fvi.noexception() self.assertEqual("Fake", result) def test_passthru_ironicexception(self): self.assertRaises(exception.IronicException, self.fvi.ironicexception, mock.ANY) driver_base.LOG.exception.assert_called_with( mock.ANY, 'ironicexception') def test_passthru_nonironicexception(self): self.assertRaises(exception.VendorPassthruException, self.fvi.normalexception, mock.ANY) driver_base.LOG.exception.assert_called_with( mock.ANY, 'normalexception')
30.867647
78
0.697475
246
2,099
5.869919
0.447154
0.055402
0.037396
0.045706
0.129501
0.112188
0.072022
0.072022
0.072022
0.072022
0
0.004843
0.212959
2,099
67
79
31.328358
0.869249
0.288232
0
0.210526
0
0
0.040568
0
0
0
0
0
0.131579
1
0.263158
false
0.315789
0.105263
0.026316
0.447368
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
1f581484e57d7f06ab12a83feeb46bea44a7e7c3
327
py
Python
app/logger.py
d3vzer0/reternal-backend
aeeb613c820759212e7aef9150738a66b2882d50
[ "MIT" ]
6
2019-01-01T23:38:12.000Z
2021-07-27T03:43:11.000Z
app/logger.py
d3vzer0/kickstart-flask-vuejs
562a829d3f3b87488035719025f2d29b4fe33a89
[ "MIT" ]
1
2020-08-02T00:21:41.000Z
2020-08-02T00:21:41.000Z
app/logger.py
d3vzer0/kickstart-flask-vuejs
562a829d3f3b87488035719025f2d29b4fe33a89
[ "MIT" ]
1
2021-07-27T03:43:24.000Z
2021-07-27T03:43:24.000Z
import logging from logging.handlers import SysLogHandler # Logging environment that can be used by the application to output syslog logging_object = logging.getLogger(__name__) logging_object.setLevel(logging.INFO) syslog_handler = logging.handlers.SysLogHandler(address='/dev/log') logging_object.addHandler(syslog_handler)
36.333333
74
0.844037
42
327
6.357143
0.619048
0.146067
0
0
0
0
0
0
0
0
0
0
0.085627
327
8
75
40.875
0.892977
0.220183
0
0
0
0
0.031621
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
1f5bf93e6d736ffce8e14bcf71e0ff664aca6f6a
553
py
Python
tests/private/test_uber_string_formatter.py
odedlaz-oss/uberlogs
09658f6ee98b4018c1c3620f56973fcdadb260d5
[ "MIT" ]
null
null
null
tests/private/test_uber_string_formatter.py
odedlaz-oss/uberlogs
09658f6ee98b4018c1c3620f56973fcdadb260d5
[ "MIT" ]
null
null
null
tests/private/test_uber_string_formatter.py
odedlaz-oss/uberlogs
09658f6ee98b4018c1c3620f56973fcdadb260d5
[ "MIT" ]
null
null
null
import six from unittest import TestCase from uberlogs.private import UberStringFormatter class UberStringFormatterTests(TestCase): def setUp(self): self.formatter = UberStringFormatter() self.invalid_format = "{[blabla]" def test_raise_on_invalid_format_when_not_silent(self): with self.assertRaises(Exception): list(self.formatter.parse(self.invalid_format, silent=False)) def test_no_raise_on_invalid_format_when_silent(self): list(self.formatter.parse(self.invalid_format, silent=True))
29.105263
73
0.750452
66
553
6.030303
0.469697
0.163317
0.128141
0.100503
0.346734
0.226131
0.226131
0.226131
0
0
0
0
0.166365
553
18
74
30.722222
0.863341
0
0
0
0
0
0.016275
0
0
0
0
0
0.083333
1
0.25
false
0
0.25
0
0.583333
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
1f6c4abc3f836e517354bb086cbc395ddcb5e9b2
251
py
Python
utils.py
Ls-Dai/Pytorch_FL_CNN
59bfd017dc21a4d11e7dafb382cdae3c57086071
[ "MIT" ]
3
2021-03-22T01:54:43.000Z
2021-03-28T10:48:35.000Z
utils.py
Ls-Dai/Pytorch_FL_CNN
59bfd017dc21a4d11e7dafb382cdae3c57086071
[ "MIT" ]
null
null
null
utils.py
Ls-Dai/Pytorch_FL_CNN
59bfd017dc21a4d11e7dafb382cdae3c57086071
[ "MIT" ]
null
null
null
import os def dir_setup(path): if not os.path.exists(path): os.makedirs(path) """def dir_setup(path): if not os.path.isdir(path): dir_setup(os.path.split(path)[0]) else: return os.mkdir(path)"""
17.928571
42
0.561753
37
251
3.72973
0.432432
0.173913
0.15942
0.217391
0.376812
0.376812
0.376812
0.376812
0
0
0
0.005618
0.290837
251
13
43
19.307692
0.769663
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.5
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
1f839d58efbf61c5507f3e11ca4b447b2e8e7b82
1,826
py
Python
ssrlsim/scripts/start_RE.py
tangkong/ssrlsim
62f8a07989ebc187ecf6d2dc3bd8d97ae4c56536
[ "BSD-3-Clause" ]
null
null
null
ssrlsim/scripts/start_RE.py
tangkong/ssrlsim
62f8a07989ebc187ecf6d2dc3bd8d97ae4c56536
[ "BSD-3-Clause" ]
2
2020-06-18T05:18:15.000Z
2021-09-08T21:44:29.000Z
ssrlsim/scripts/start_RE.py
tangkong/ssrlsim
62f8a07989ebc187ecf6d2dc3bd8d97ae4c56536
[ "BSD-3-Clause" ]
null
null
null
import os import matplotlib # get_ipython().run_line_magic("matplotlib", "widget") # i.e. %matplotlib widget import matplotlib.pyplot as plt from ophyd import Device, Component, EpicsSignal from ophyd.signal import EpicsSignalBase from ophyd.areadetector.filestore_mixins import resource_factory import uuid import os from pathlib import Path import numpy as np from IPython import get_ipython # Set up a RunEngine and use metadata backed by a sqlite file. from bluesky import RunEngine from bluesky.utils import PersistentDict RE = RunEngine({}) # RE.md = PersistentDict(str(Path("~/.bluesky_history").expanduser())) # Set up SupplementalData. from bluesky import SupplementalData sd = SupplementalData() RE.preprocessors.append(sd) # Set up a Broker. from databroker import Broker db = Broker.named("temp") #mongo-intake") print(f'Using databroker: {db.name}') # and subscribe it to the RunEngine RE.subscribe(db.insert) # Add a progress bar. from bluesky.utils import ProgressBarManager pbar_manager = ProgressBarManager() RE.waiting_hook = pbar_manager # # Register bluesky IPython magics. # from bluesky.magics import BlueskyMagics # get_ipython().register_magics(BlueskyMagics) # Set up the BestEffortCallback. from bluesky.callbacks.best_effort import BestEffortCallback bec = BestEffortCallback() RE.subscribe(bec) peaks = bec.peaks # Make plots update live while scans run. from bluesky.utils import install_nb_kicker install_nb_kicker() # convenience imports # some of the * imports are for 'back-compatibility' of a sort -- we have # taught BL staff to expect LiveTable and LivePlot etc. to be in their # namespace import numpy as np from bluesky.callbacks.mpl_plotting import LivePlot, LiveGrid import bluesky.plans as bp import bluesky.plan_stubs as bps import bluesky.preprocessors as bpp
24.675676
81
0.793538
254
1,826
5.629921
0.5
0.061538
0.033566
0.046154
0.026573
0
0
0
0
0
0
0
0.133625
1,826
73
82
25.013699
0.903919
0.372399
0
0.114286
0
0
0.027531
0
0
0
0
0
0
1
0
false
0
0.657143
0
0.657143
0.028571
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
1f8ae5e3724e8e2ef10be9cc46bc0a4381cac952
3,236
py
Python
tests/test_models/test_place.py
lepc1972/AirBnB_clone
3ba7f0332e926ff7715272866a00d3a23341b3c3
[ "MIT" ]
2
2021-07-16T01:07:40.000Z
2021-07-16T01:23:15.000Z
tests/test_models/test_place.py
lepc1972/AirBnB_clone
3ba7f0332e926ff7715272866a00d3a23341b3c3
[ "MIT" ]
null
null
null
tests/test_models/test_place.py
lepc1972/AirBnB_clone
3ba7f0332e926ff7715272866a00d3a23341b3c3
[ "MIT" ]
1
2021-07-09T01:41:16.000Z
2021-07-09T01:41:16.000Z
#!/usr/bin/python3 ''' test for the place model here. ''' import unittest from models.base_model import BaseModel from models.place import Place class TestUser(unittest.TestCase): ''' Testing Place class ''' def setUp(self): ''' Create instance for place. ''' self.new_place = Place() def test_Place_inheritance(self): ''' tests City Inherits BaseModel ''' self.assertIsInstance(self.new_place, BaseModel) def test_Place_attributes(self): ''' test attribute is there. ''' self.assertTrue("city_id" in self.new_place.__dir__()) self.assertTrue("user_id" in self.new_place.__dir__()) self.assertTrue("description" in self.new_place.__dir__()) self.assertTrue("name" in self.new_place.__dir__()) self.assertTrue("number_rooms" in self.new_place.__dir__()) self.assertTrue("max_guest" in self.new_place.__dir__()) self.assertTrue("price_by_night" in self.new_place.__dir__()) self.assertTrue("latitude" in self.new_place.__dir__()) self.assertTrue("longitude" in self.new_place.__dir__()) self.assertTrue("amenity_ids" in self.new_place.__dir__()) def test_type_longitude(self): ''' Test type long. ''' longitude = getattr(self.new_place, "longitude") self.assertIsInstance(longitude, float) def test_type_latitude(self): ''' Test type lat ''' latitude = getattr(self.new_place, "latitude") self.assertIsInstance(latitude, float) def test_type_price_by_night(self): ''' Test type price night ''' price_by_night = getattr(self.new_place, "price_by_night") self.assertIsInstance(price_by_night, int) def test_type_max_guest(self): ''' Test type max guest ''' max_guest = getattr(self.new_place, "max_guest") self.assertIsInstance(max_guest, int) def test_type_number_bathrooms(self): ''' Test number bathrooms ''' number_bathrooms = getattr(self.new_place, "number_bathrooms") self.assertIsInstance(number_bathrooms, int) def test_type_number_rooms(self): ''' Test type number rooms ''' number_rooms = getattr(self.new_place, "number_rooms") self.assertIsInstance(number_rooms, int) def test_type_description(self): ''' Test type description ''' description = getattr(self.new_place, "description") self.assertIsInstance(description, str) def test_type_name(self): ''' Test type name ''' name = getattr(self.new_place, "name") self.assertIsInstance(name, str) def test_type_user_id(self): ''' Test type user id ''' user_id = getattr(self.new_place, "user_id") self.assertIsInstance(user_id, str) def test_type_city_id(self): ''' Test type city id ''' city_id = getattr(self.new_place, "city_id") self.assertIsInstance(city_id, str)
28.637168
70
0.603523
364
3,236
5.03022
0.164835
0.084107
0.144184
0.076461
0.235937
0.15456
0.15456
0.036046
0
0
0
0.000434
0.287392
3,236
112
71
28.892857
0.793582
0.105377
0
0
0
0
0.075209
0
0
0
0
0
0.428571
1
0.265306
false
0
0.061224
0
0.346939
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
1
0
0
0
0
0
0
0
2
2f0b0a77f9fa1f45efa368882434f52b3044f388
322
py
Python
20211001_PythonIntro/ex2/ex2.py
alessandro-massarenti/Cybersec2021
3d6dcc4b255dd425b1be66d440df1d94d5ea5ac0
[ "BSD-3-Clause" ]
15
2021-10-01T16:10:48.000Z
2022-02-19T20:45:35.000Z
20211001_PythonIntro/ex2/ex2.py
alessandro-massarenti/Cybersec2021
3d6dcc4b255dd425b1be66d440df1d94d5ea5ac0
[ "BSD-3-Clause" ]
null
null
null
20211001_PythonIntro/ex2/ex2.py
alessandro-massarenti/Cybersec2021
3d6dcc4b255dd425b1be66d440df1d94d5ea5ac0
[ "BSD-3-Clause" ]
2
2021-11-06T08:32:41.000Z
2021-12-11T16:18:54.000Z
from operator import add, itruediv, mul, sub ops = [add, sub, mul, itruediv] a = float(input("Inserisci un numero: ")) b = float(input("Inserisci un altro numero: ")) op = int( input("Inserisci un operatore (0 per addizione, 1 per sottrazione, 2 per moltiplicazione oppure 3 per divisione: ") ) print(ops[op](a, b))
29.272727
119
0.695652
49
322
4.571429
0.612245
0.1875
0.214286
0.1875
0
0
0
0
0
0
0
0.014981
0.170807
322
10
120
32.2
0.82397
0
0
0
0
0
0.478261
0
0
0
0
0
0
1
0
false
0
0.125
0
0.125
0.125
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
2f1dfd7483d1c7356a889232b88033380a6fbee8
3,600
py
Python
src/openprocurement/framework/electroniccatalogue/views/submission.py
ProzorroUKR/openprocurement.api
2855a99aa8738fb832ee0dbad4e9590bd3643511
[ "Apache-2.0" ]
10
2020-02-18T01:56:21.000Z
2022-03-28T00:32:57.000Z
src/openprocurement/framework/electroniccatalogue/views/submission.py
quintagroup/openprocurement.api
2855a99aa8738fb832ee0dbad4e9590bd3643511
[ "Apache-2.0" ]
26
2018-07-16T09:30:44.000Z
2021-02-02T17:51:30.000Z
src/openprocurement/framework/electroniccatalogue/views/submission.py
ProzorroUKR/openprocurement.api
2855a99aa8738fb832ee0dbad4e9590bd3643511
[ "Apache-2.0" ]
15
2019-08-08T10:50:47.000Z
2022-02-05T14:13:36.000Z
from openprocurement.api.utils import APIResource, json_view, context_unpack, get_now, generate_id from openprocurement.framework.core.utils import ( submissionsresource, apply_patch, save_qualification, ) from openprocurement.framework.core.validation import ( validate_patch_submission_data, validate_operation_submission_in_not_allowed_period, validate_submission_status, validate_update_submission_in_not_allowed_status, validate_activate_submission, validate_action_in_not_allowed_framework_status, ) from openprocurement.framework.electroniccatalogue.models import Qualification @submissionsresource( name="electronicCatalogue:Submissions", path="/submissions/{submission_id}", submissionType="electronicCatalogue", description="", # TODO: add description ) class SubmissionResource(APIResource): @json_view(permission="view_submission") def get(self): """ Get info by submission """ submission_data = self.context.serialize("view") return {"data": submission_data} @json_view( content_type="application/json", validators=( validate_patch_submission_data, validate_operation_submission_in_not_allowed_period, validate_update_submission_in_not_allowed_status, validate_action_in_not_allowed_framework_status("submission"), validate_submission_status, validate_activate_submission, ), permission="edit_submission", ) def patch(self): """ Submission edit(partial) """ submission = self.request.context old_status = submission.status new_status = self.request.validated["data"].get("status", old_status) now = get_now() if new_status != old_status: submission.date = now activated = new_status == "active" and old_status != new_status if activated: submission.datePublished = now self.create_qualification() apply_patch(self.request, src=self.request.validated["submission_src"], obj_name="submission") self.LOGGER.info("Updated submission {}".format(submission.id), extra=context_unpack(self.request, {"MESSAGE_ID": "submission_patch"})) return {"data": submission.serialize("view")} def create_qualification(self): submission = self.request.context framework = self.request.validated["framework"] qualification_id = generate_id() qualification_data = { "id": qualification_id, "frameworkID": framework["_id"], "submissionID": submission.id, "framework_owner": framework["owner"], "framework_token": framework["owner_token"], "qualificationType": framework["frameworkType"], "mode": framework.get("type") } qualification = Qualification(qualification_data) self.request.validated["qualification_src"] = {} self.request.validated["qualification"] = qualification if save_qualification(self.request): submission.qualificationID = qualification_id self.LOGGER.info( "Created qualification {}".format(qualification_id), extra=context_unpack( self.request, {"MESSAGE_ID": "qualification_create"}, {"qualification_id": qualification_id, "qualification_mode": qualification.mode}, ), )
36.734694
102
0.656111
329
3,600
6.87538
0.258359
0.053492
0.03183
0.038904
0.179487
0.179487
0.179487
0.146773
0.070734
0.070734
0
0
0.249444
3,600
97
103
37.113402
0.837158
0.019444
0
0.175
1
0
0.136664
0.016939
0
0
0
0.010309
0
1
0.0375
false
0
0.05
0
0.125
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
1
0
0
0
0
0
0
0
0
0
0
2
2f2781811c4aeb325fd30cc295a58030636b2c7d
695
py
Python
formacao-python/brasilidades/Telefone.py
hollowrm08/python-alura
eb43be24c7160b38f1598d8da25582bfe04ade29
[ "MIT" ]
null
null
null
formacao-python/brasilidades/Telefone.py
hollowrm08/python-alura
eb43be24c7160b38f1598d8da25582bfe04ade29
[ "MIT" ]
null
null
null
formacao-python/brasilidades/Telefone.py
hollowrm08/python-alura
eb43be24c7160b38f1598d8da25582bfe04ade29
[ "MIT" ]
null
null
null
import re class Telefone: padrao = "([0-9]{2,3})?([0-9]{2})([0-9]{4,5})([0-9]{4})" def __init__(self, telefone): if self.valida_telefone(telefone): self._numero = telefone else: raise ValueError("Número Incorreto!") def __str__(self): return self.format_numero() def valida_telefone(self, telefone): resposta = re.findall(self.padrao, telefone) if resposta: return True else: return False def format_numero(self): resposta = re.search(self.padrao, self._numero) return f'+{resposta.group(1)} ({resposta.group(2)}) {resposta.group(3)}-{resposta.group(4)}'
24.821429
100
0.579856
86
695
4.523256
0.383721
0.020566
0.015424
0
0
0
0
0
0
0
0
0.035433
0.269065
695
27
101
25.740741
0.730315
0
0
0.105263
0
0.105263
0.207194
0.151079
0
0
0
0
0
1
0.210526
false
0
0.052632
0.052632
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
2f34c3e2255c1aaf56cddd4bf264efb8253bf37a
1,254
py
Python
scripts/run_metasv_bed2vcf.py
willrockout/metasv
b46f15cbe8a28941661855da6587451c971dc2e3
[ "BSD-2-Clause" ]
43
2015-01-12T20:58:24.000Z
2021-11-24T07:30:06.000Z
scripts/run_metasv_bed2vcf.py
willrockout/metasv
b46f15cbe8a28941661855da6587451c971dc2e3
[ "BSD-2-Clause" ]
80
2015-01-08T00:34:55.000Z
2022-02-16T08:30:34.000Z
scripts/run_metasv_bed2vcf.py
willrockout/metasv
b46f15cbe8a28941661855da6587451c971dc2e3
[ "BSD-2-Clause" ]
25
2015-04-30T06:30:28.000Z
2022-02-22T02:48:20.000Z
#!/usr/bin/env python import argparse import logging from metasv.generate_final_vcf import convert_metasv_bed_to_vcf if __name__ == "__main__": FORMAT = '%(levelname)s %(asctime)-15s %(name)-20s %(message)s' logging.basicConfig(level=logging.INFO, format=FORMAT) logger = logging.getLogger(__name__) parser = argparse.ArgumentParser( description="Convert MetaSV final BED to VCF", formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument("--sample", help="Sample name", required=True) parser.add_argument("--bed", help="MetaSV final BED", required=True) parser.add_argument("--vcf", help="Final VCF to output", required=True) parser.add_argument("--reference", help="Reference FASTA") parser.add_argument("--work", help="Work directory", default="work") parser.add_argument("--pass_only", action="store_true", help="Output only PASS calls") args = parser.parse_args() convert_metasv_bed_to_vcf(bedfile=args.bed, vcf_out=args.vcf, workdir=args.work, sample=args.sample, reference=args.reference, pass_calls=args.pass_only)
41.8
75
0.651515
145
1,254
5.393103
0.4
0.069054
0.130435
0.080563
0.164962
0
0
0
0
0
0
0.004128
0.227273
1,254
30
76
41.8
0.80289
0.015949
0
0
1
0
0.200972
0
0
0
0
0
0
1
0
false
0.130435
0.130435
0
0.130435
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
2f436e86cdf8ffd5b6c159aa475cc3ce92d884bf
50
py
Python
app/api/config.py
stdevelopr/Jtray
287a4be1e26b2dab372323cc0bd8df1f8689fd97
[ "MIT" ]
null
null
null
app/api/config.py
stdevelopr/Jtray
287a4be1e26b2dab372323cc0bd8df1f8689fd97
[ "MIT" ]
1
2020-05-01T20:37:34.000Z
2020-05-01T20:37:34.000Z
app/api/config.py
stdevelopr/JTray
287a4be1e26b2dab372323cc0bd8df1f8689fd97
[ "MIT" ]
null
null
null
jira_user_url = "" jira_email = "" jira_token = ""
16.666667
18
0.66
7
50
4.142857
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.16
50
3
19
16.666667
0.690476
0
0
0
0
0
0
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
2f76d7407f4890886daf9577fd641a2214d9abc6
1,848
py
Python
backend/serializers.py
richardswei/werk
b08b1ffc2d3aaf61f2cfb07ecc259a35eea77e91
[ "MIT" ]
null
null
null
backend/serializers.py
richardswei/werk
b08b1ffc2d3aaf61f2cfb07ecc259a35eea77e91
[ "MIT" ]
8
2020-03-21T01:57:31.000Z
2021-09-22T18:46:07.000Z
backend/serializers.py
richardswei/werkit
b08b1ffc2d3aaf61f2cfb07ecc259a35eea77e91
[ "MIT" ]
null
null
null
from rest_framework import serializers from backend.models import TodoItem, Note from django.contrib.auth import authenticate, get_user_model class TodoItemSerializer(serializers.ModelSerializer): class Meta: model = TodoItem fields = ('id', 'created', 'updated', 'due', 'title', 'description', 'priority', 'user_id') user_id = serializers.ReadOnlyField(source='owner.id') class NoteSerializer(serializers.ModelSerializer): class Meta: model = Note fields = ('id', 'created', 'updated', 'title', 'description', 'user_id') user_id = serializers.ReadOnlyField(source='owner.id') class UserSerializer(serializers.ModelSerializer): # notes = serializers.PrimaryKeyRelatedField(many=True, queryset=Note.objects.all(), allow_null=True) # todoitems = serializers.PrimaryKeyRelatedField(many=True, queryset=TodoItem.objects.all(), allow_null=True) class Meta: model = get_user_model() fields = ('id', 'username', 'password', 'email', 'first_name', 'last_name') write_only_fields = ['password'] read_only_fields = ['id'] def create(self, validated_data): user = get_user_model().objects.create( username=validated_data['username'], email=validated_data['email'], first_name=validated_data['first_name'], last_name=validated_data['last_name'] ) user.set_password(validated_data['password']) user.save() return user class LoginUserSerializer(serializers.Serializer): username = serializers.CharField() password = serializers.CharField() def validate(self, data): user = authenticate(**data) if user and user.is_active: return user raise serializers.ValidationError("Unable to log in with provided credentials.")
33.6
113
0.679113
195
1,848
6.276923
0.394872
0.063725
0.029412
0.05719
0.271242
0.088235
0.088235
0.088235
0.088235
0.088235
0
0
0.202922
1,848
54
114
34.222222
0.830957
0.112013
0
0.189189
0
0
0.14652
0
0
0
0
0.018519
0
1
0.054054
false
0.108108
0.081081
0
0.486486
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
1
0
0
0
0
0
2
2f7d4b66c546d9cc934e15934759dad2ba2d7078
1,967
py
Python
src/zope/error/interfaces.py
zopefoundation/zope.error
8dc7b77a60388bdfb5b2a4606ed8b400db06d3ef
[ "ZPL-2.1" ]
null
null
null
src/zope/error/interfaces.py
zopefoundation/zope.error
8dc7b77a60388bdfb5b2a4606ed8b400db06d3ef
[ "ZPL-2.1" ]
9
2016-03-24T07:48:35.000Z
2018-10-19T13:28:04.000Z
src/zope/error/interfaces.py
zopefoundation/zope.error
8dc7b77a60388bdfb5b2a4606ed8b400db06d3ef
[ "ZPL-2.1" ]
1
2015-04-03T08:42:41.000Z
2015-04-03T08:42:41.000Z
############################################################################## # # Copyright (c) 2001, 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Error Reporting Utility interfaces """ __docformat__ = 'restructuredtext' from zope.interface import Interface class IErrorReportingUtility(Interface): """Error Reporting Utility""" def raising(info, request=None): """ Logs an exception. :param info: The exception info, as determined by :func:`sys.exc_info`. """ class ILocalErrorReportingUtility(Interface): """Local Error Reporting Utility This interface contains additional management functions. """ def getProperties(): """Gets the properties as dictionary. keep_entries, copy_to_logfile, ignored_exceptions """ def setProperties(keep_entries, copy_to_zlog=1, ignored_exceptions=(), RESPONSE=None): """Sets the properties keep_entries, copy_to_logfile, ignored_exceptions :keyword tuple ignored_exceptions: A sequence of *str* unqualified class names (such as ``'Unauthorized'``) that will be ignored. The values here will be compared with the ``__name__`` of the first member of the ``info`` passed to :meth:`raising`. """ def getLogEntries(): """Returns the entries in the log, most recent first.""" def getLogEntryById(id): """Return LogEntry by ID"""
32.783333
79
0.627351
213
1,967
5.690141
0.586854
0.016502
0.05198
0.042079
0.067657
0.067657
0.067657
0
0
0
0
0.007106
0.213015
1,967
59
80
33.338983
0.77584
0.605999
0
0
0
0
0.034335
0
0
0
0
0
0
1
0.5
false
0
0.1
0
0.8
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
2f8fc48275f4387b3e97bc8ce0893dd23b2af531
2,250
py
Python
core.py
sure-fire/derbypi
681e266d40fa238effe5de54bd4bbff963db028e
[ "MIT" ]
1
2016-10-31T17:34:40.000Z
2016-10-31T17:34:40.000Z
core.py
sure-fire/derbypi
681e266d40fa238effe5de54bd4bbff963db028e
[ "MIT" ]
null
null
null
core.py
sure-fire/derbypi
681e266d40fa238effe5de54bd4bbff963db028e
[ "MIT" ]
null
null
null
#!/usr/bin/python # Copyright (c) 2015 Aaron Soto # Released under the MIT license # Incorporates libraries from AdaFruit, also released under the MIT license # TODO functions: # display_progress(percentage,[title]) - display a progress bar (0-1,1-100) / check for float # display_error(message,[timeout],[title]) - change backlight color, display error import glob # module_scan(): to find files import imp # module_run(): to load and run plugin modules import traceback # module_run(): to gather a traceback during exceptions import lcd # module_run(): to print fatal errors to the screen import time # log(): to print the epoch time in log messages import os # main(): to check UID for root import sys # main(): to exit with status code import subprocess # shutdown(): to call the 'halt' command def module_scan(path): # Identify all modules, and sort by time modified (newest first) # NOTE TO FUTURE SELF: Use "touch -m" to re-order the menu modules = sorted(glob.glob("modules/*/main.py"), key=os.path.getmtime) modules.reverse() moduleList = [] for module in modules: log("FOUND MODULE: " + module) moduleList.append(module.split('/')[1]) return moduleList def module_run(path): # Accepts path as "modules/[name]/main.py", "modules/[name]/", or "[name]" # where [name] is the name of the module to run. # Imports [name] and runs the init() function within 'modules/[name]/main.py' if path.find('/') > 0: name = path.split('/')[1] else: name = path path = "./modules/" + name + "/main.py" try: log("LOADING MODULE: " + name + " (" + path + ")") module = imp.load_source(name, path) module.init() except: log("ERROR: SOMETHING HAPPENED IN THE " + name + " MODULE!") trace = traceback.format_exc() log(trace) err = sys.exc_info()[0] err = str(err).split("'")[1].split('.')[1] lcd.showError(err,redraw=False) sys.exit(-1) def log(text): print str(time.time()) + ": " + text f = open('/var/log/wiper', 'a+') f.write(str(time.time()) + ": " + text + "\r\n") f.flush() f.close() def error(text): log("ERROR:" + text) if __name__=="__main__": if "wipe" in module_scan("."): module_run("modules/wipe2/main.py")
33.088235
107
0.651556
326
2,250
4.432515
0.453988
0.031142
0.022837
0.035294
0.035986
0
0
0
0
0
0
0.009928
0.194222
2,250
68
108
33.088235
0.787093
0.452444
0
0
0
0
0.146744
0.017312
0
0
0
0.014706
0
0
null
null
0
0.177778
null
null
0.022222
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
85d0ab0de0a1394f2406e3a5b3e99179d2c59390
486
py
Python
tests/test/stateful/conftest.py
ActorForth/brownie
ef0d5af3bb48edcd11abf985626fc99dbc577c7d
[ "MIT" ]
1,595
2020-06-01T19:41:53.000Z
2022-03-31T16:09:54.000Z
tests/test/stateful/conftest.py
ActorForth/brownie
ef0d5af3bb48edcd11abf985626fc99dbc577c7d
[ "MIT" ]
532
2020-05-30T12:06:17.000Z
2022-03-31T22:33:41.000Z
tests/test/stateful/conftest.py
ActorForth/brownie
ef0d5af3bb48edcd11abf985626fc99dbc577c7d
[ "MIT" ]
303
2020-06-17T00:38:34.000Z
2022-03-31T10:59:48.000Z
#!/usr/bin/python3 import pytest from hypothesis import settings # derandomizing prevents flaky test outcomes # we are testing hypothesis itself, not testing with hypothesis settings.register_profile("derandomize", derandomize=True) @pytest.fixture def SMTestBase(devnetwork): settings.load_profile("derandomize") class _Base: def rule_one(self): pass def rule_two(self): pass yield _Base settings.load_profile("default")
19.44
63
0.709877
56
486
6.035714
0.660714
0.106509
0.112426
0
0
0
0
0
0
0
0
0.002618
0.213992
486
24
64
20.25
0.882199
0.251029
0
0.153846
0
0
0.080332
0
0
0
0
0
0
1
0.230769
false
0.153846
0.153846
0
0.461538
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
85f5bac9de2e5415cb10c2fbf5dabb5fee1eb3a8
436
py
Python
config.py
anggerwicaksono/vehicle-brand-recognition-yolov4-python
b58a76481bd499ff77deb037f5791119a9572d0c
[ "MIT" ]
null
null
null
config.py
anggerwicaksono/vehicle-brand-recognition-yolov4-python
b58a76481bd499ff77deb037f5791119a9572d0c
[ "MIT" ]
null
null
null
config.py
anggerwicaksono/vehicle-brand-recognition-yolov4-python
b58a76481bd499ff77deb037f5791119a9572d0c
[ "MIT" ]
null
null
null
# Copyright © 2020 by Spectrico # Licensed under the MIT License model_file = "model-weights-spectrico-car-colors-recognition-mobilenet_v3-224x224-180420.pb" # path to the car color classifier label_file = "labelsC.txt" # path to the text file, containing list with the supported makes and models input_layer = "input_1" output_layer = "Predictions/Softmax/Softmax" classifier_input_size = (224, 224) # input size of the classifier
48.444444
128
0.784404
65
436
5.153846
0.692308
0.035821
0.053731
0
0
0
0
0
0
0
0
0.06366
0.135321
436
8
129
54.5
0.822281
0.451835
0
0
0
0
0.523605
0.446352
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
c82c884ecd2fbb3f7bbb619a3ed6f25fe4c5e6e9
484
py
Python
django_migrate_project/executor.py
dsanders11/django-migrate-project
68b637d08dfb6aecdf75d836ab4736e1ba624dcc
[ "MIT" ]
2
2018-12-27T05:15:48.000Z
2018-12-28T00:37:03.000Z
django_migrate_project/executor.py
dsanders11/django-migrate-project
68b637d08dfb6aecdf75d836ab4736e1ba624dcc
[ "MIT" ]
null
null
null
django_migrate_project/executor.py
dsanders11/django-migrate-project
68b637d08dfb6aecdf75d836ab4736e1ba624dcc
[ "MIT" ]
null
null
null
from __future__ import unicode_literals from django.db.migrations.executor import MigrationExecutor from django_migrate_project.loader import ProjectMigrationLoader class ProjectMigrationExecutor(MigrationExecutor): def __init__(self, connection, progress_callback=None): super(ProjectMigrationExecutor, self).__init__( connection, progress_callback) # Change out the migration loader self.loader = ProjectMigrationLoader(self.connection)
32.266667
64
0.789256
46
484
7.934783
0.608696
0.054795
0.142466
0
0
0
0
0
0
0
0
0
0.157025
484
14
65
34.571429
0.894608
0.06405
0
0
0
0
0
0
0
0
0
0
0
1
0.125
false
0
0.375
0
0.625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
c82e3f7cd86031ad65e19765bc6e16f53e31ebc5
1,393
py
Python
src/grokcore/formlib/tests/base/form/customautoform.py
zopefoundation/grokcore.formlib
afcb6fce344ef60e3fec2aa839c13a61228d8d23
[ "ZPL-2.1" ]
null
null
null
src/grokcore/formlib/tests/base/form/customautoform.py
zopefoundation/grokcore.formlib
afcb6fce344ef60e3fec2aa839c13a61228d8d23
[ "ZPL-2.1" ]
null
null
null
src/grokcore/formlib/tests/base/form/customautoform.py
zopefoundation/grokcore.formlib
afcb6fce344ef60e3fec2aa839c13a61228d8d23
[ "ZPL-2.1" ]
2
2015-04-03T04:51:14.000Z
2018-01-12T06:51:36.000Z
""" A form view can have a custom form_fields but reusing those fields that were deduced automatically, using grok.AutoFields: >>> grok.testing.grok(__name__) We only expect a single field to be present in the form, as we omitted 'size': >>> from zope import component >>> from zope.publisher.browser import TestRequest >>> request = TestRequest() >>> view = component.getMultiAdapter((Mammoth(), request), name='edit') >>> len(view.form_fields) 1 >>> [w.__name__ for w in view.form_fields] ['name'] >>> view = component.getMultiAdapter((Mammoth2(), request), name='edit2') >>> len(view.form_fields) 1 >>> [w.__name__ for w in view.form_fields] ['size'] """ import grokcore.formlib as grok from zope import schema from zope.interface import Interface, implementer class IMammoth(Interface): name = schema.TextLine(title=u"Name") size = schema.TextLine(title=u"Size", default=u"Quite normal") @implementer(IMammoth) class Mammoth(grok.Context): pass class Edit(grok.EditForm): grok.context(Mammoth) form_fields = grok.AutoFields(Mammoth).omit('size') class Mammoth2(grok.Context): class fields: name = schema.TextLine(title=u"Name") size = schema.TextLine(title=u"Size", default=u"Quite normal") class Edit2(grok.EditForm): grok.context(Mammoth2) form_fields = grok.AutoFields(Mammoth).omit('name')
24.017241
78
0.701364
185
1,393
5.178378
0.356757
0.073069
0.058455
0.083507
0.319415
0.319415
0.246347
0.246347
0.246347
0.246347
0
0.006019
0.165111
1,393
57
79
24.438596
0.817713
0.488873
0
0.210526
0
0
0.068279
0
0
0
0
0
0
1
0
false
0.052632
0.157895
0
0.684211
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
c8332e05cc190a6c1e47fdd51cb882fbebe47837
1,449
py
Python
src/geos/_stops_with_wrong_bearing.py
alex-baciu-dft/Open_NaPTAN
abbb3e162f2638099f5050f51d81099f5a0a72a9
[ "MIT" ]
24
2020-07-02T12:08:39.000Z
2021-05-12T12:07:32.000Z
src/geos/_stops_with_wrong_bearing.py
alex-baciu-dft/Open_NaPTAN
abbb3e162f2638099f5050f51d81099f5a0a72a9
[ "MIT" ]
11
2020-11-04T12:14:15.000Z
2022-03-12T00:38:36.000Z
src/geos/_stops_with_wrong_bearing.py
alex-baciu-dft/Open_NaPTAN
abbb3e162f2638099f5050f51d81099f5a0a72a9
[ "MIT" ]
7
2020-07-03T09:32:11.000Z
2021-07-23T18:53:09.000Z
from checks import NaptanCheck # %% class StopsBearing(NaptanCheck): """[summary] top has a bearing that is different to the calculated bearing of the road link it is connected to. The test compensates for stops being snapped to the wrong side of the road. Therefore if the calculated bearing is E then stops with a bearing of E or W will be allowed. A 22.5 degree boundary threshold is also allowed. Therefore for example if the calculated bearing in degrees is 280 (which falls in the range for W), as this falls within 22.5 degrees of the boundary to NW (292.5 degrees) allowed values will be W, NW and the mirror values of E, SE. Args: NaptanCheck ([type]): [description] """ check_geographic_level = 'stops' check_name = 'stops with wrong bearing' check_warning_level = 'medium' @classmethod def stops_with_wrong_bearing(cls, gdf): """ Descriptions: The bearing shown in the data does not correspond with the bearing as calculated by reference to the orientation of the road at the location of the stopping point. Note this is not the direction of the road or the direction of travel the bus is taking necessarily. This is the way the bus is facing when it is stationary, picking/ dropping passengers Args: Returns: """ pass
38.131579
86
0.664596
208
1,449
4.591346
0.495192
0.031414
0.037696
0.046073
0
0
0
0
0
0
0
0.012658
0.291235
1,449
37
87
39.162162
0.917235
0.708075
0
0
0
0
0.128205
0
0
0
0
0
0
1
0.125
false
0.125
0.125
0
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
0
0
1
0
0
1
0
0
2
c83954e71051c128691f4f8f79229509cdfd37e3
1,068
py
Python
codes/kmc/2Dim/general2d/lambdaFluc2dCreator.py
joshuahellier/PhDStuff
6fbe9e507c40e9017cde9312b0cfcc6ceefa284e
[ "MIT" ]
null
null
null
codes/kmc/2Dim/general2d/lambdaFluc2dCreator.py
joshuahellier/PhDStuff
6fbe9e507c40e9017cde9312b0cfcc6ceefa284e
[ "MIT" ]
null
null
null
codes/kmc/2Dim/general2d/lambdaFluc2dCreator.py
joshuahellier/PhDStuff
6fbe9e507c40e9017cde9312b0cfcc6ceefa284e
[ "MIT" ]
null
null
null
import subprocess import sys import os # This code is meant to manage running multiple instances of my KMCLib codes at the same time, # in the name of time efficiency numLambda = 512 numStepsEquilib = 1600000 numStepsAnal = 16000 numStepsSnapshot = 1000 numStepsReq = 16000 sysWidth = 32 sysLength = 32 analInterval = 1 numPasses = 100 timeInterval = 1.0 dataLocation = "dim2Runs/lambdaScan1/" lambdaMin = 0.05 lambdaMax = 1.25 rateStepSize = (lambdaMax-lambdaMin)/float(numLambda-1) runningJobs = [] for rateIndex in range(0, numLambda): currentRate = lambdaMin + rateStepSize*rateIndex botConc = 0.99 topConc = 0.01 jobInput = "2dSteadyFlow.py "+str(botConc)+" "+str(topConc)+" "+str(currentRate)+" "+str(sysWidth)+" "+str(sysLength)+" "+str(analInterval)+" "+str(numStepsEquilib)+" "+str(numStepsSnapshot)+" "+str(numStepsAnal)+" "+str(numStepsReq)+" "+str(numPasses)+" "+str(timeInterval)+" "+dataLocation+str(rateIndex)+"\n" with open("jobInputs/testInput."+str(jobIndex), 'w') as f: f.write(jobInput) jobIndex += 1
33.375
323
0.708801
127
1,068
5.96063
0.582677
0
0
0
0
0
0
0
0
0
0
0.057522
0.153558
1,068
31
324
34.451613
0.779867
0.115169
0
0
0
0
0.076433
0.022293
0
0
0
0
0
0
null
null
0.076923
0.115385
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
c844d609644b8e0f8c68c6cb8c2457c055991723
2,309
py
Python
pysnmp-with-texts/ONEFS-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/ONEFS-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/ONEFS-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 ONEFS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ONEFS-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:34:48 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsIntersection") ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup") Unsigned32, snmpModules, IpAddress, Gauge32, enterprises, iso, Integer32, ModuleIdentity, Counter32, NotificationType, TimeTicks, Bits, Counter64, ObjectIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "snmpModules", "IpAddress", "Gauge32", "enterprises", "iso", "Integer32", "ModuleIdentity", "Counter32", "NotificationType", "TimeTicks", "Bits", "Counter64", "ObjectIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "MibIdentifier") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") onefs = ModuleIdentity((1, 3, 6, 1, 4, 1, 12124)) if mibBuilder.loadTexts: onefs.setLastUpdated('0201172301Z') if mibBuilder.loadTexts: onefs.setOrganization('COMPANY_NAME') if mibBuilder.loadTexts: onefs.setContactInfo('COMPANY_NAME Support phone: SUPPORT_PHONE Support email: SUPPORT_EMAIL ') if mibBuilder.loadTexts: onefs.setDescription('This is the enterprise number for OneFS') class TimeTicks64(TextualConvention, Counter64): description = 'A 64 bit value representing milliseconds from the epoch' status = 'current' subtypeSpec = Counter64.subtypeSpec + ValueRangeConstraint(0, 18446744073709551615) mibBuilder.exportSymbols("ONEFS-MIB", PYSNMP_MODULE_ID=onefs, onefs=onefs, TimeTicks64=TimeTicks64)
92.36
533
0.792551
235
2,309
7.761702
0.53617
0.075658
0.046053
0.057018
0.316886
0.208333
0.208333
0.208333
0.208333
0.208333
0
0.057765
0.085318
2,309
24
534
96.208333
0.805871
0.135123
0
0
0
0
0.340543
0.022133
0
0
0
0
0
1
0
false
0
0.375
0
0.625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
c84cd7c853b8faebaefc88697ddd7f956ce53148
374
py
Python
KahootPY/src/modules/questionStart.py
boiimakillu/KahootPY
c8d7a03a766bf061015a178cd7df2382906f91ae
[ "MIT" ]
null
null
null
KahootPY/src/modules/questionStart.py
boiimakillu/KahootPY
c8d7a03a766bf061015a178cd7df2382906f91ae
[ "MIT" ]
null
null
null
KahootPY/src/modules/questionStart.py
boiimakillu/KahootPY
c8d7a03a766bf061015a178cd7df2382906f91ae
[ "MIT" ]
1
2021-11-25T12:19:27.000Z
2021-11-25T12:19:27.000Z
from json import loads from time import time def main(self): def handler(message): if message["channel"] == "/service/player" and message.get("data") and message["data"].get("id") == 2: self.questionStartTime = int(time() * 1000) self._emit("QuestionStart",loads(message["data"]["content"])) self.handlers["questionStart"] = handler
37.4
110
0.641711
45
374
5.311111
0.577778
0.083682
0
0
0
0
0
0
0
0
0
0.016556
0.192513
374
9
111
41.555556
0.774834
0
0
0
0
0
0.184492
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
c86486b7aff3805a872796537a88993f82f85be5
191
py
Python
CaloOnlineTools/EcalTools/python/ecalExclusiveTrigFilter_cfi.py
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
852
2015-01-11T21:03:51.000Z
2022-03-25T21:14:00.000Z
CaloOnlineTools/EcalTools/python/ecalExclusiveTrigFilter_cfi.py
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
30,371
2015-01-02T00:14:40.000Z
2022-03-31T23:26:05.000Z
CaloOnlineTools/EcalTools/python/ecalExclusiveTrigFilter_cfi.py
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
3,240
2015-01-02T05:53:18.000Z
2022-03-31T17:24:21.000Z
import FWCore.ParameterSet.Config as cms ecalExclusiveTrigFilter = cms.EDFilter("EcalExclusiveTrigFilter", # Global trigger tag l1GlobalReadoutRecord = cms.string("gtDigis") )
21.222222
65
0.759162
17
191
8.529412
0.823529
0
0
0
0
0
0
0
0
0
0
0.006211
0.157068
191
8
66
23.875
0.89441
0.094241
0
0
0
0
0.175439
0.134503
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
c8669721869b7d885f2345a687dcb60a71f978c7
2,930
py
Python
OSMTagFinder/thesaurus/relatedterm.py
geometalab/OSMTagFinder
9ffe854a2bebbd7f96facd7e236434e761fee884
[ "MIT" ]
20
2015-01-18T19:57:40.000Z
2020-06-15T22:06:42.000Z
OSMTagFinder/thesaurus/relatedterm.py
geometalab/OSMTagFinder
9ffe854a2bebbd7f96facd7e236434e761fee884
[ "MIT" ]
4
2015-01-18T22:16:15.000Z
2021-03-31T18:32:22.000Z
OSMTagFinder/thesaurus/relatedterm.py
geometalab/OSMTagFinder
9ffe854a2bebbd7f96facd7e236434e761fee884
[ "MIT" ]
2
2019-01-16T15:43:41.000Z
2020-06-15T22:03:31.000Z
# -*- coding: utf-8 -*- ''' Created on 16.11.2014 @author: Simon Gwerder ''' from utilities.configloader import ConfigLoader from rdfgraph import RDFGraph class RelatedTerm: rdfGraph = RDFGraph() cl = ConfigLoader() termSchemeName = cl.getThesaurusString('TERM_SCHEME_NAME') termSchemeTitle = cl.getThesaurusString('TERM_SCHEME_TITLE') creator = cl.getThesaurusString('CREATOR') termScheme = None def __init__(self, rdfGraph): if rdfGraph is not None: self.rdfGraph = rdfGraph self.termScheme = self.rdfGraph.addConceptScheme(self.termSchemeName, self.termSchemeTitle, self.creator) # doesn't matter if called a lot def createTerm(self, keyTagConcept, prefLabelEN, prefLabelDE): label = prefLabelEN.decode("utf-8") if self.rdfGraph.isInKeyScheme(keyTagConcept): label = keyTagConcept.split('Key:')[1] else: label = keyTagConcept.split('Tag:')[1] label = (label.replace('=','_')).decode("utf-8") termConcept = self.rdfGraph.addConcept(self.termSchemeName + '/' + label) self.rdfGraph.addInScheme(termConcept, self.termSchemeName) self.rdfGraph.addPrefLabel(termConcept, prefLabelEN, language='en') self.rdfGraph.addPrefLabel(termConcept, prefLabelDE, language='de') self.rdfGraph.addRelatedMatch(keyTagConcept, termConcept) self.rdfGraph.addRelatedMatch(termConcept, keyTagConcept) return termConcept def addAltLabelEN(self, termConcept, altLabelEN): self.rdfGraph.addAltLabel(termConcept, altLabelEN, 'en') return termConcept def addAltLabelDE(self, termConcept, altLabelDE): self.rdfGraph.addAltLabel(termConcept, altLabelDE, 'de') return termConcept def addNarrowerLiteralEN(self, termConcept, narrowerEN): self.rdfGraph.addNarrowerLiteral(termConcept, narrowerEN, 'en') return termConcept def addNarrowerLiteralDE(self, termConcept, narrowerDE): self.rdfGraph.addNarrowerLiteral(termConcept, narrowerDE, 'de') return termConcept def addBroaderLiteralEN(self, termConcept, broaderEN): self.rdfGraph.addBroaderLiteral(termConcept, broaderEN, 'en') return termConcept def addBroaderLiteralDE(self, termConcept, broaderDE): self.rdfGraph.addBroaderLiteral(termConcept, broaderDE, 'de') return termConcept def removeAltLabelLiteral(self, termConcept, altLabelObj): self.rdfGraph.removeAltLabelLiteral(termConcept, altLabelObj) def removeBroaderLiteral(self, termConcept, broaderObj): self.rdfGraph.removeAltLabelLiteral(termConcept, broaderObj) def removeNarrowerLiteral(self, termConcept, narrowerObj): self.rdfGraph.removeAltLabelLiteral(termConcept, narrowerObj) def save(self): self.rdfGraph.serialize(self.rdfGraph.filePath) return self.rdfGraph.filePath
34.880952
146
0.713652
267
2,930
7.797753
0.329588
0.126801
0.067243
0.0317
0
0
0
0
0
0
0
0.005471
0.189079
2,930
83
147
35.301205
0.870791
0.033788
0
0.12963
0
0
0.027315
0
0
0
0
0
0
1
0.222222
false
0
0.037037
0
0.537037
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
c06e2030a941664f4cc84a738c586a21db2c9695
1,169
py
Python
python/8.Making-a-POST-Request.py
17nikhil/codecademy
58fbd652691c9df8139544965ebb0e9748142538
[ "Apache-2.0" ]
null
null
null
python/8.Making-a-POST-Request.py
17nikhil/codecademy
58fbd652691c9df8139544965ebb0e9748142538
[ "Apache-2.0" ]
null
null
null
python/8.Making-a-POST-Request.py
17nikhil/codecademy
58fbd652691c9df8139544965ebb0e9748142538
[ "Apache-2.0" ]
1
2018-10-03T14:36:31.000Z
2018-10-03T14:36:31.000Z
# Using the Requests library, you can make a POST request by using the requests.post() method. You aren't just GETting data with a POST - you can pass your own data into the request as well, like so: # # requests.post("http://placekitten.com/", data="myDataToPost") # We're going to make the same request as the one shown on line 2 through line 5. Request header lines (line 3 and line 4) are usually created automatically, so we don't have to worry about them. The body of the request on line 5 is what we will need to add to our POST. # # Instructions # We created the body of the request as a dictionary on line 9. Call requests.post() on the URL http://codecademy.com/learn-http/ and pass the argument data=body, as in the example above, to create the POST request; set this result equal to a new variable named response. ########## Example request ############# # POST /learn-http HTTP/1.1 # Host: www.codecademy.com # Content-Type: text/html; charset=UTF-8 # Name=Eric&Age=26 import requests body = {'Name': 'Eric', 'Age': '26'} # Make the POST request here, passing body as the data: response = requests.post('http://codecademy.com/learn-http/', data=body)
53.136364
271
0.726262
203
1,169
4.182266
0.497537
0.056537
0.037691
0.028269
0.106007
0
0
0
0
0
0
0.013292
0.163388
1,169
21
272
55.666667
0.854806
0.846022
0
0
0
0
0.319444
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
c0712a7efbb3bde035967d1fd7d0d7a42cb89f4b
278
py
Python
inputs/in4.py
mabbaszade/transportation-problem
64ab4db7f836513c388073b5e2e9c64d7c439fde
[ "MIT" ]
null
null
null
inputs/in4.py
mabbaszade/transportation-problem
64ab4db7f836513c388073b5e2e9c64d7c439fde
[ "MIT" ]
null
null
null
inputs/in4.py
mabbaszade/transportation-problem
64ab4db7f836513c388073b5e2e9c64d7c439fde
[ "MIT" ]
null
null
null
ITERATION_NUM = 10 MAX_POPULATION = 500 CROSSOVER_RATE = 1 MUTATION_RATE = 1 supplies = { 'S1': 20, 'S2': 15, 'S3': 40 } demands = { 'D1': 20, 'D2': 30, 'D3': 25 } cost = [[2, 3, 1], [5, 4, 8], [5, 6, 8] ]
12.636364
21
0.406475
36
278
3.027778
0.833333
0.091743
0
0
0
0
0
0
0
0
0
0.209877
0.417266
278
21
22
13.238095
0.462963
0
0
0
0
0
0.046693
0
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
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
c073994563fd9d56aecce3609828c1cbf0a8170a
31,133
py
Python
vkwave/bots/addons/easy/easy_handlers.py
amishakov/vkwave
377d470fc4b84b64516fffcabc6d682bf86b5d7f
[ "MIT" ]
null
null
null
vkwave/bots/addons/easy/easy_handlers.py
amishakov/vkwave
377d470fc4b84b64516fffcabc6d682bf86b5d7f
[ "MIT" ]
null
null
null
vkwave/bots/addons/easy/easy_handlers.py
amishakov/vkwave
377d470fc4b84b64516fffcabc6d682bf86b5d7f
[ "MIT" ]
null
null
null
import json import random import warnings from typing import Any, Callable, Dict, List, Union, Type, Optional, NoReturn from pydantic import PrivateAttr from vkwave.bots import BotEvent, BotType, EventTypeFilter, UserEvent from vkwave.bots.core import BaseFilter from vkwave.bots.core.dispatching.filters.builtin import get_payload, get_text from vkwave.bots.core.dispatching.handler.callback import BaseCallback from vkwave.bots.core.dispatching.handler.cast import caster as callback_caster from vkwave.bots.core.types.json_types import JSONEncoder from vkwave.types.bot_events import BotEventType from vkwave.types.objects import ( BaseBoolInt, MessagesMessageAttachment, MessagesMessageAttachmentType, UsersUser, ) from vkwave.types.responses import BaseOkResponse, MessagesEditResponse, MessagesSendResponse from vkwave.types.user_events import EventId try: import aiofile except ImportError: aiofile = None class SimpleUserEvent(UserEvent): def __init__(self, event: UserEvent): super().__init__(event.object, event.api_ctx) self.user_data = event.user_data def __setitem__(self, key: Any, item: Any) -> None: self.user_data[key] = item def __getitem__(self, key: Any) -> Any: return self.user_data[key] @property def text(self) -> str: return get_text(self) @property def peer_id(self) -> int: return self.object.object.peer_id @property def from_id(self) -> int: return self.object.object.message_data.from_id @property def user_id(self) -> int: return self.from_id if self.peer_id > 2e9 else self.peer_id async def get_user( self, raw_mode: bool = False, **kwargs ) -> Union["UsersUser", dict]: # getting information about the sender raw_user = ( await self.api_ctx.api_request("users.get", {"user_ids": self.user_id, **kwargs}) )["response"][0] return raw_user if raw_mode else UsersUser(**raw_user) async def answer( self, message: Optional[str] = None, domain: Optional[str] = None, lat: Optional[int] = None, long: Optional[int] = None, attachment: Optional[str] = None, reply_to: Optional[int] = None, forward_messages: Optional[List[int]] = None, forward: Optional[str] = None, sticker_id: Optional[int] = None, group_id: Optional[int] = None, keyboard: Optional[str] = None, template: Optional[str] = None, payload: Optional[str] = None, content_source: Optional[str] = None, dont_parse_links: Optional[bool] = None, disable_mentions: Optional[bool] = None, intent: Optional[str] = None, subscribe_id: Optional[int] = None, expire_ttl: Optional[int] = None, silent: Optional[bool] = None, ) -> MessagesSendResponse: return await self.api_ctx.messages.send( message=message, forward=forward, template=template, content_source=content_source, intent=intent, subscribe_id=subscribe_id, expire_ttl=expire_ttl, silent=silent, domain=domain, lat=lat, long=long, attachment=attachment, reply_to=reply_to, forward_messages=forward_messages, sticker_id=sticker_id, group_id=group_id, keyboard=keyboard, payload=payload, dont_parse_links=dont_parse_links, disable_mentions=disable_mentions, peer_id=self.object.object.peer_id, random_id=random.randint(-2147483648, 2147483647), ) async def long_answer( self, message: str, domain: Optional[str] = None, lat: Optional[int] = None, long: Optional[int] = None, attachment: Optional[str] = None, reply_to: Optional[int] = None, forward_messages: Optional[List[int]] = None, forward: Optional[str] = None, sticker_id: Optional[int] = None, group_id: Optional[int] = None, keyboard: Optional[str] = None, template: Optional[str] = None, payload: Optional[str] = None, content_source: Optional[str] = None, dont_parse_links: Optional[bool] = None, disable_mentions: Optional[bool] = None, intent: Optional[str] = None, subscribe_id: Optional[int] = None, expire_ttl: Optional[int] = None, silent: Optional[bool] = None, ) -> List[MessagesSendResponse]: """ Shortcut for sending message > 4096 lenght :return: Message IDs """ message_ids: List[MessagesSendResponse] = [] for x in range(0, len(message), 4096): message_id = await self.answer( message=message[x:x+4096], forward=forward, template=template, content_source=content_source, intent=intent, subscribe_id=subscribe_id, expire_ttl=expire_ttl, silent=silent, domain=domain, lat=lat, long=long, attachment=attachment, reply_to=reply_to, forward_messages=forward_messages, sticker_id=sticker_id, group_id=group_id, keyboard=keyboard, payload=payload, dont_parse_links=dont_parse_links, disable_mentions=disable_mentions, ) message_ids.append(message_id) return message_ids async def reply( self, message: Optional[str] = None, domain: Optional[str] = None, lat: Optional[int] = None, long: Optional[int] = None, attachment: Optional[str] = None, forward_messages: Optional[List[int]] = None, forward: Optional[str] = None, sticker_id: Optional[int] = None, group_id: Optional[int] = None, keyboard: Optional[str] = None, template: Optional[str] = None, payload: Optional[str] = None, content_source: Optional[str] = None, dont_parse_links: Optional[bool] = None, disable_mentions: Optional[bool] = None, intent: Optional[str] = None, subscribe_id: Optional[int] = None, expire_ttl: Optional[int] = None, silent: Optional[bool] = None, ) -> MessagesSendResponse: return await self.api_ctx.messages.send( message=message, forward=forward, template=template, content_source=content_source, intent=intent, subscribe_id=subscribe_id, expire_ttl=expire_ttl, silent=silent, domain=domain, lat=lat, long=long, attachment=attachment, reply_to=self.object.object.message_id, forward_messages=forward_messages, sticker_id=sticker_id, group_id=group_id, keyboard=keyboard, payload=payload, dont_parse_links=dont_parse_links, disable_mentions=disable_mentions, peer_id=self.object.object.peer_id, random_id=random.randint(-2147483648, 2147483647), ) async def edit( self, message: Optional[str] = None, return_raw_response: bool = False, lat: Optional[int] = None, long: Optional[int] = None, attachment: Optional[str] = None, keep_forward_messages: Optional[BaseBoolInt] = None, keep_snippets: Optional[BaseBoolInt] = None, group_id: Optional[int] = None, dont_parse_links: Optional[bool] = None, message_id: Optional[int] = None, conversation_message_id: Optional[int] = None, template: Optional[str] = None, keyboard: Optional[str] = None, ) -> MessagesEditResponse: return await self.api_ctx.messages.edit( message=message, peer_id=self.object.object.peer_id, return_raw_response=return_raw_response, lat=lat, long=long, attachment=attachment, keep_forward_messages=keep_forward_messages, keep_snippets=keep_snippets, group_id=group_id, dont_parse_links=dont_parse_links, message_id=message_id or self.object.object.message_id, conversation_message_id=conversation_message_id, template=template, keyboard=keyboard, ) async def set_activity( self, type: Optional[str] = None, user_id: Optional[int] = None, group_id: Optional[int] = None, ) -> MessagesSendResponse: """ type: typing — пользователь начал набирать текст, audiomessage — пользователь записывает голосовое сообщение """ return await self.api_ctx.messages.set_activity( user_id=user_id, type=type, peer_id=self.object.object.peer_id, group_id=group_id, ) def _check_event_type(event_type: str): if event_type not in ( BotEventType.MESSAGE_NEW, BotEventType.MESSAGE_EDIT, BotEventType.MESSAGE_REPLY, BotEventType.MESSAGE_TYPING_STATE, BotEventType.MESSAGE_ALLOW, ): raise RuntimeError("You cant use event.answer() with this event") class SimpleAttachment(MessagesMessageAttachment): _event: "SimpleBotEvent" = PrivateAttr() _data: Optional[bytes] = PrivateAttr() _allowed_types: List[MessagesMessageAttachmentType] = PrivateAttr() _url_types: Dict[MessagesMessageAttachmentType, Callable] = PrivateAttr() def __init__(self, attachment: MessagesMessageAttachment, event: "SimpleBotEvent"): super().__init__(**attachment.dict()) self._event = event self._data = None self._allowed_types = [ MessagesMessageAttachmentType.AUDIO_MESSAGE, MessagesMessageAttachmentType.DOC, MessagesMessageAttachmentType.AUDIO, MessagesMessageAttachmentType.PHOTO, MessagesMessageAttachmentType.GRAFFITI, ] self._url_types = { MessagesMessageAttachmentType.PHOTO: lambda _attachment: _attachment.photo.sizes[ -1 ].url, MessagesMessageAttachmentType.AUDIO_MESSAGE: lambda _attachment: _attachment.audio_message.link_ogg, MessagesMessageAttachmentType.DOC: lambda _attachment: _attachment.doc.url, MessagesMessageAttachmentType.AUDIO: lambda _attachment: _attachment.audio.url, MessagesMessageAttachmentType.GRAFFITI: lambda _attachment: _attachment.graffiti.url, } @property def url(self) -> str: return self._url_types[self.type](self) async def download(self) -> Union[NoReturn, bytes]: if self._data is not None: return self._data if self.type not in self._allowed_types: raise RuntimeError("cannot download this attachment type") url = self.url client, token = await self._event.api_ctx.api_options.get_client_and_token() data = await client.http_client.request_data(method="GET", url=url) self._data = data return data async def save(self, path: str): attach_data = self._data if attach_data is None: attach_data = await self.download() if aiofile is None: warnings.warn("aiofile is not installed, saving synchronously") with open(path, "wb") as f: f.write(attach_data) return async with aiofile.async_open(path, "wb") as afp: await afp.write(attach_data) class Attachments(list): def __init__(self, event: "SimpleBotEvent"): super().__init__( [ SimpleAttachment(attachment, event=event) for attachment in event.object.object.message.attachments ] ) class SimpleBotEvent(BotEvent): """Базовый класс события.""" def __init__(self, event: BotEvent): super().__init__(event.object, event.api_ctx) self.user_data = event.user_data self._attachments: Optional[Attachments] = None self._payload: Optional[dict] = None def __setitem__(self, key: Any, item: Any) -> None: self.user_data[key] = item def __getitem__(self, key: Any) -> Any: return self.user_data[key] @property def text(self) -> str: """Получает текст сообщения Returns: str: Текст """ return get_text(self) @property def peer_id(self) -> int: """Получает идентификатор чата Returns: int: идентификатор чата """ if self.object.type == BotEventType.MESSAGE_EVENT.value: return self.object.object.peer_id return self.object.object.message.peer_id @property def from_id(self) -> int: """Получает идентификатор отправителя Returns: int: идентификатор отправителя """ if self.object.type == BotEventType.MESSAGE_EVENT.value: return self.object.object.user_id return self.object.object.message.from_id @property def payload(self) -> Optional[dict]: """Получает payload события Returns: int: payload события """ current_payload = get_payload(self) if current_payload is None: return current_payload if self._payload is None: self._payload = ( json.loads(current_payload) if not isinstance(current_payload, dict) else current_payload ) return self._payload @property def attachments(self) -> Optional[List[SimpleAttachment]]: """Получает список вложений Returns: Optional[List[SimpleAttachment]]: список вложений """ if self.object.object.message.attachments is None: return None if self._attachments is None: self._attachments = Attachments(event=self) return self._attachments @property def user_id(self) -> int: """Шорткат для выбора from_id или peer_id Returns: int: идентификатор пользователя """ return self.from_id if self.peer_id > 2e9 else self.peer_id async def get_user(self, raw_mode: bool = False, **kwargs) -> Union["UsersUser", dict]: """Получение объекта пользователя Returns: Union["UsersUser", dict]: Объект пользователя """ raw_user = ( await self.api_ctx.api_request("users.get", {"user_ids": self.user_id, **kwargs}) )["response"][0] return raw_user if raw_mode else UsersUser(**raw_user) async def edit( self, message: Optional[str] = None, lat: Optional[int] = None, long: Optional[int] = None, attachment: Optional[str] = None, keep_forward_messages: Optional[BaseBoolInt] = None, keep_snippets: Optional[BaseBoolInt] = None, group_id: Optional[int] = None, dont_parse_links: Optional[bool] = None, disable_mentions: Optional[bool] = None, message_id: Optional[int] = None, conversation_message_id: Optional[int] = None, template: Optional[str] = None, keyboard: Optional[str] = None, ) -> MessagesEditResponse: """Шорткат для редактирования своего сообщения. Args: message (Optional[str]): Текст. lat (Optional[int]): Широта. long (Optional[int]): Долгота. attachment (Optional[str]): Вложения (строка с идентификаторами, разделёнными запятой). keep_forward_messages (Optional[BaseBoolInt]): — сохранить прикрепленные пересланные сообщения. keep_snippets (Optional[BaseBoolInt]): 1 — сохранить прикрепленные внешние ссылки (сниппеты). group_id (Optional[int]): Идентификатор группы. dont_parse_links (Optional[bool]): 1 — не создавать сниппет ссылки из сообщения. disable_mentions (Optional[bool]): 1 — отключить уведомление об упоминании в сообщении. message_id (Optional[int]): Идентификатор сообщения. conversation_message_id (Optional[int]): Идентификатор сообщения в беседе. template (Optional[str]): Шаблон. keyboard (Optional[str]): Клавиатура. Returns: MessagesEditResponse: Ответ сервера """ _check_event_type(self.object.type) return await self.api_ctx.messages.edit( peer_id=self.object.object.message.peer_id, message=message, lat=lat, long=long, attachment=attachment, keep_forward_messages=keep_forward_messages, keep_snippets=keep_snippets, group_id=group_id, dont_parse_links=dont_parse_links, disable_mentions=disable_mentions, message_id=message_id, conversation_message_id=conversation_message_id, template=template, keyboard=keyboard ) async def reply( self, message: Optional[str] = None, domain: Optional[str] = None, lat: Optional[int] = None, long: Optional[int] = None, attachment: Optional[str] = None, sticker_id: Optional[int] = None, group_id: Optional[int] = None, keyboard: Optional[str] = None, template: Optional[str] = None, payload: Optional[str] = None, content_source: Optional[str] = None, dont_parse_links: Optional[bool] = None, disable_mentions: Optional[bool] = None, intent: Optional[str] = None, subscribe_id: Optional[int] = None, expire_ttl: Optional[int] = None, silent: Optional[bool] = None, json_serialize: JSONEncoder = json.dumps, ) -> MessagesSendResponse: """Шорткат для отправки ответа на сообщение пользователю, от которого пришло событие Args: message (Optional[str]): Текст. domain (Optional[str]): Короткая ссылка пользователя. lat (Optional[int]): Широта. long (Optional[int]): Долгота. attachment (Optional[str]): Вложения (строка с идентификаторами, разделёнными запятой). sticker_id (Optional[int]): Идентификатор прикрепляемого стикера. group_id (Optional[int]): Идентификатор группы. keyboard (Optional[str]): Клавиатура. template (Optional[str]): Шаблон (карусель, например). payload (Optional[str]): Payload. content_source (Optional[str]): Источник [пользовательского контента](https://vk.com/dev/bots_docs_2?f=3.3.+%D0%A1%D0%BE%D0%BE%D0%B1%D1%89%D0%B5%D0%BD%D0%B8%D1%8F+%D1%81+%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D1%82%D0%B5%D0%BB%D1%8C%D1%81%D0%BA%D0%B8%D0%BC+%D0%BA%D0%BE%D0%BD%D1%82%D0%B5%D0%BD%D1%82%D0%BE%D0%BC). dont_parse_links (Optional[bool]): 1 &mdash; не создавать сниппет ссылки из сообщения. disable_mentions (Optional[bool]): 1 &mdash; отключить создание упоминаний. intent (Optional[str]): Строка, описывающая [интенты](https://vk.com/dev/bots_docs_4?f=7.+%D0%98%D0%BD%D1%82%D0%B5%D0%BD%D1%82%D1%8B). subscribe_id (Optional[int]): число, которое в будущем будет предназначено для работы с интентами. expire_ttl (Optional[int]): ???. silent (Optional[bool]): ???. json_serialize (JSONEncoder): сериализация. Returns: MessagesSendResponse - Ответ сервера """ _check_event_type(self.object.type) forward = { "is_reply": 1, "conversation_message_ids": self.object.object.message.conversation_message_id, "peer_id": self.object.object.message.peer_id, } return await self.api_ctx.messages.send( forward=json_serialize(forward), intent=intent, subscribe_id=subscribe_id, expire_ttl=expire_ttl, silent=silent, domain=domain, lat=lat, long=long, attachment=attachment, sticker_id=sticker_id, group_id=group_id, keyboard=keyboard, payload=payload, dont_parse_links=dont_parse_links, disable_mentions=disable_mentions, peer_id=self.object.object.message.peer_id, message=message, random_id=0, template=template, content_source=content_source, ) async def answer( self, message: Optional[str] = None, domain: Optional[str] = None, lat: Optional[int] = None, long: Optional[int] = None, attachment: Optional[str] = None, reply_to: Optional[int] = None, forward_messages: Optional[List[int]] = None, forward: Optional[str] = None, sticker_id: Optional[int] = None, group_id: Optional[int] = None, keyboard: Optional[str] = None, template: Optional[str] = None, payload: Optional[str] = None, content_source: Optional[str] = None, dont_parse_links: Optional[bool] = None, disable_mentions: Optional[bool] = None, intent: Optional[str] = None, subscribe_id: Optional[int] = None, expire_ttl: Optional[int] = None, silent: Optional[bool] = None, ) -> MessagesSendResponse: """Шорткат для отправки сообщения пользователю, от которого пришло событие. Args: message (Optional[str]): Текст. domain (Optional[str]): Короткая ссылка пользователя. lat (Optional[int]): Широта. long (Optional[int]): Долгота. attachment (Optional[str]): Вложения (строка с идентификаторами, разделёнными запятой). reply_to (Optional[int]): Идентификатор сообщения, на которое нужно ответить. forward_messages (Optional[List[int]]): Идентификаторы пересылаемых сообщений. forward (Optional[str]): JSON-объект (подробнее в [документации ВК](https://vk.com/dev/messages.send)). sticker_id (Optional[int]): Идентификатор прикрепляемого стикера. group_id (Optional[int]): Идентификатор группы. keyboard (Optional[str]): Клавиатура. template (Optional[str]): Шаблон (карусель, например). payload (Optional[str]): Payload. content_source (Optional[str]): Источник [пользовательского контента](https://vk.com/dev/bots_docs_2?f=3.3.+%D0%A1%D0%BE%D0%BE%D0%B1%D1%89%D0%B5%D0%BD%D0%B8%D1%8F+%D1%81+%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D1%82%D0%B5%D0%BB%D1%8C%D1%81%D0%BA%D0%B8%D0%BC+%D0%BA%D0%BE%D0%BD%D1%82%D0%B5%D0%BD%D1%82%D0%BE%D0%BC). dont_parse_links (Optional[bool]): 1 &mdash; не создавать сниппет ссылки из сообщения. disable_mentions (Optional[bool]): 1 &mdash; отключить создание упоминаний. intent (Optional[str]): Строка, описывающая [интенты](https://vk.com/dev/bots_docs_4?f=7.+%D0%98%D0%BD%D1%82%D0%B5%D0%BD%D1%82%D1%8B). subscribe_id (Optional[int]): число, которое в будущем будет предназначено для работы с интентами. expire_ttl (Optional[int]): ???. silent (Optional[bool]): ???. :return: Message ID """ _check_event_type(self.object.type) return await self.api_ctx.messages.send( forward=forward, intent=intent, subscribe_id=subscribe_id, expire_ttl=expire_ttl, silent=silent, domain=domain, lat=lat, long=long, attachment=attachment, reply_to=reply_to, forward_messages=forward_messages, sticker_id=sticker_id, group_id=group_id, keyboard=keyboard, payload=payload, dont_parse_links=dont_parse_links, disable_mentions=disable_mentions, peer_id=self.object.object.message.peer_id, message=message, random_id=0, template=template, content_source=content_source, ) async def long_answer( self, message: Optional[str] = None, domain: Optional[str] = None, lat: Optional[int] = None, long: Optional[int] = None, attachment: Optional[str] = None, reply_to: Optional[int] = None, forward_messages: Optional[List[int]] = None, forward: Optional[str] = None, sticker_id: Optional[int] = None, group_id: Optional[int] = None, keyboard: Optional[str] = None, template: Optional[str] = None, payload: Optional[str] = None, content_source: Optional[str] = None, dont_parse_links: Optional[bool] = None, disable_mentions: Optional[bool] = None, intent: Optional[str] = None, subscribe_id: Optional[int] = None, expire_ttl: Optional[int] = None, silent: Optional[bool] = None, ) -> List[MessagesSendResponse]: """ Shortcut for sending messages > 4096 length :return: Message IDs """ _check_event_type(self.object.type) message_ids: List[MessagesSendResponse] = [] for x in range(0, len(message), 4096): message_id = await self.answer( forward=forward, intent=intent, subscribe_id=subscribe_id, expire_ttl=expire_ttl, silent=silent, domain=domain, lat=lat, long=long, attachment=attachment, reply_to=reply_to, forward_messages=forward_messages, sticker_id=sticker_id, group_id=group_id, keyboard=keyboard, payload=payload, dont_parse_links=dont_parse_links, disable_mentions=disable_mentions, message=message[x:x+4096], template=template, content_source=content_source, ) message_ids.append(message_id) return message_ids async def set_activity( self, type: Optional[str] = None, user_id: Optional[int] = None, group_id: Optional[int] = None, ) -> MessagesSendResponse: """Изменение статуса активности Args: type (Optional[str], optional): Тип активности. (`typing` — пользователь начал набирать текст, `audiomessage` — пользователь записывает голосовое сообщение) user_id (Optional[int], optional): Идентификатор пользователя-получателя. group_id (Optional[int], optional): Идентификатор группы. Returns: MessagesSendResponse: Результат запроса. """ _check_event_type(self.object.type) return await self.api_ctx.messages.set_activity( user_id=user_id, type=type, peer_id=self.object.object.message.peer_id, group_id=group_id, ) async def callback_answer(self, event_data: str) -> BaseOkResponse: """Ответ на нажатие callback кнопки. Args: event_data (Dict[str, str]): [описание данных](https://vk.com/dev/bots_docs_5?f=4.4.%2BCallback-%D0%BA%D0%BD%D0%BE%D0%BF%D0%BA%D0%B8) для ответа на callback Raises: RuntimeError: Если вызван, когда событие не MessageEvent типа. Returns: BaseOkResponse: Результат запроса """ if self.object.type != BotEventType.MESSAGE_EVENT: raise RuntimeError("You cant use event.callback_answer() with this event") return await self.api_ctx.messages.send_message_event_answer( user_id=self.object.object.user_id, peer_id=self.object.object.peer_id, event_id=self.object.object.event_id, event_data=event_data, ) class SimpleBotCallback(BaseCallback): def __init__( self, func: Any, bot_type: BotType, event_type: Type[Union[SimpleUserEvent, SimpleBotEvent]] ): self.bot_type = bot_type self.func = callback_caster.cast(func) self.event_type = event_type async def execute(self, event: Union[UserEvent, BotEvent]) -> Any: if self.bot_type is BotType.BOT: new_event = self.event_type(event) else: new_event = self.event_type(event) return await self.func.execute(new_event) def __repr__(self): return f"<SimpleBotCallback {self.func.__name__} bot_type={self.bot_type}>" def simple_bot_handler(router, event: Optional[Type[SimpleBotEvent]] = None, *filters: BaseFilter): """ Handler for all bot events """ def decorator(func: Callable[..., Any]): record = router.registrar.new() record.with_filters(*filters) record.handle(SimpleBotCallback(func, BotType.BOT, event or SimpleBotEvent)) router.registrar.register(record.ready()) return func return decorator def simple_user_handler(router, *filters: BaseFilter, event: Optional[Type[SimpleUserEvent]] = None): """ Handler for all user events """ def decorator(func: Callable[..., Any]): record = router.registrar.new() record.with_filters(*filters) record.handle(SimpleBotCallback(func, BotType.USER, event or SimpleUserEvent)) router.registrar.register(record.ready()) return func return decorator def simple_bot_message_handler(router, *filters: BaseFilter, event: Optional[Type[SimpleBotEvent]] = None): """ Handler only for message events """ def decorator(func: Callable[..., Any]): record = router.registrar.new() record.with_filters(*filters) record.filters.append(EventTypeFilter(BotEventType.MESSAGE_NEW)) record.handle(SimpleBotCallback(func, BotType.BOT, event or SimpleBotEvent)) router.registrar.register(record.ready()) return func return decorator def simple_user_message_handler(router, *filters: BaseFilter, event: Optional[Type[SimpleUserEvent]] = None): """ Handler only for message events """ def decorator(func: Callable[..., Any]): record = router.registrar.new() record.with_filters(*filters) record.filters.append(EventTypeFilter(EventId.MESSAGE_EVENT.value)) record.handle(SimpleBotCallback(func, BotType.USER, event or SimpleUserEvent)) router.registrar.register(record.ready()) return func return decorator
37.195938
335
0.615039
3,392
31,133
5.470224
0.107311
0.049798
0.050121
0.025653
0.708165
0.686607
0.654056
0.644193
0.62533
0.62533
0
0.011421
0.285678
31,133
836
336
37.240431
0.822564
0.019561
0
0.718287
0
0
0.016382
0.002964
0
0
0
0
0
1
0.049423
false
0
0.028007
0.01318
0.163097
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
c078fecfd19302ee3b513baaaa01bf856eb712e7
24,154
py
Python
pysnmp/CISCO-FC-PM-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
11
2021-02-02T16:27:16.000Z
2021-08-31T06:22:49.000Z
pysnmp/CISCO-FC-PM-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
75
2021-02-24T17:30:31.000Z
2021-12-08T00:01:18.000Z
pysnmp/CISCO-FC-PM-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
10
2019-04-30T05:51:36.000Z
2022-02-16T03:33:41.000Z
# # PySNMP MIB module CISCO-FC-PM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-FC-PM-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:40:52 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsIntersection, ValueRangeConstraint, ConstraintsUnion, SingleValueConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueRangeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ValueSizeConstraint") ciscoMgmt, = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt") ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex") PerfIntervalCount, PerfCurrentCount, PerfTotalCount = mibBuilder.importSymbols("PerfHist-TC-MIB", "PerfIntervalCount", "PerfCurrentCount", "PerfTotalCount") ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup") iso, Bits, ModuleIdentity, ObjectIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, MibIdentifier, Integer32, NotificationType, Counter32, Gauge32, IpAddress, Unsigned32, Counter64, TimeTicks = mibBuilder.importSymbols("SNMPv2-SMI", "iso", "Bits", "ModuleIdentity", "ObjectIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "MibIdentifier", "Integer32", "NotificationType", "Counter32", "Gauge32", "IpAddress", "Unsigned32", "Counter64", "TimeTicks") TextualConvention, TruthValue, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "TruthValue", "DisplayString") ciscoFcPmMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 99997)) ciscoFcPmMIB.setRevisions(('2005-02-06 00:00',)) if mibBuilder.loadTexts: ciscoFcPmMIB.setLastUpdated('200502060000Z') if mibBuilder.loadTexts: ciscoFcPmMIB.setOrganization('Cisco Systems, Inc.') ciscoFcPmMIBNotifs = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 99997, 0)) ciscoFcPmMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1)) ciscoFcPmMIBConform = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 99997, 2)) cfcpmPortPerfStatus = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 1)) cfcpmPortErrorStatusBlock = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2)) cfcpmPortPerfStatusTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 1, 1), ) if mibBuilder.loadTexts: cfcpmPortPerfStatusTable.setStatus('current') cfcpmPortPerfStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 1, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: cfcpmPortPerfStatusEntry.setStatus('current') cfcpmTimeElapsed = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 899))).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmTimeElapsed.setStatus('current') cfcpmValidIntervals = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 96))).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmValidIntervals.setStatus('current') cfcpmInvalidIntervals = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 96))).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmInvalidIntervals.setStatus('current') cfcpmTotalPortErrorTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 1), ) if mibBuilder.loadTexts: cfcpmTotalPortErrorTable.setStatus('current') cfcpmTotalPortErrorEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: cfcpmTotalPortErrorEntry.setStatus('current') cfcpmtPortRxLinkResets = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 1, 1, 1), PerfTotalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmtPortRxLinkResets.setStatus('current') cfcpmtPortTxLinkResets = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 1, 1, 2), PerfTotalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmtPortTxLinkResets.setStatus('current') cfcpmtPortLinkResets = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 1, 1, 3), PerfTotalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmtPortLinkResets.setStatus('current') cfcpmtPortRxOfflineSequences = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 1, 1, 4), PerfTotalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmtPortRxOfflineSequences.setStatus('current') cfcpmtPortTxOfflineSequences = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 1, 1, 5), PerfTotalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmtPortTxOfflineSequences.setStatus('current') cfcpmtPortLinkFailures = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 1, 1, 6), PerfTotalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmtPortLinkFailures.setStatus('current') cfcpmtPortSynchLosses = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 1, 1, 7), PerfTotalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmtPortSynchLosses.setStatus('current') cfcpmtPortSignalLosses = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 1, 1, 8), PerfTotalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmtPortSignalLosses.setStatus('current') cfcpmtPortPrimSeqProtocolErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 1, 1, 9), PerfTotalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmtPortPrimSeqProtocolErrors.setStatus('current') cfcpmtPortInvalidTxWords = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 1, 1, 10), PerfTotalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmtPortInvalidTxWords.setStatus('current') cfcpmtPortInvalidCRCs = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 1, 1, 11), PerfTotalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmtPortInvalidCRCs.setStatus('current') cfcpmtPortInvalidOrderedSets = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 1, 1, 12), PerfTotalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmtPortInvalidOrderedSets.setStatus('current') cfcpmtPortFramesTooLong = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 1, 1, 13), PerfTotalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmtPortFramesTooLong.setStatus('current') cfcpmtPortTruncatedFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 1, 1, 14), PerfTotalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmtPortTruncatedFrames.setStatus('current') cfcpmtPortAddressErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 1, 1, 15), PerfTotalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmtPortAddressErrors.setStatus('current') cfcpmtPortDelimiterErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 1, 1, 16), PerfTotalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmtPortDelimiterErrors.setStatus('current') cfcpmtPortEncDisparityErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 1, 1, 17), PerfTotalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmtPortEncDisparityErrors.setStatus('current') cfcpmtPortOtherErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 1, 1, 18), PerfTotalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmtPortOtherErrors.setStatus('current') cfcpmCurrentPortErrorTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 2), ) if mibBuilder.loadTexts: cfcpmCurrentPortErrorTable.setStatus('current') cfcpmCurrentPortErrorEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 2, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: cfcpmCurrentPortErrorEntry.setStatus('current') cfcpmcPortRxLinkResets = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 2, 1, 1), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmcPortRxLinkResets.setStatus('current') cfcpmcPortTxLinkResets = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 2, 1, 2), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmcPortTxLinkResets.setStatus('current') cfcpmcPortLinkResets = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 2, 1, 3), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmcPortLinkResets.setStatus('current') cfcpmcPortRxOfflineSequences = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 2, 1, 4), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmcPortRxOfflineSequences.setStatus('current') cfcpmcPortTxOfflineSequences = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 2, 1, 5), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmcPortTxOfflineSequences.setStatus('current') cfcpmcPortLinkFailures = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 2, 1, 6), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmcPortLinkFailures.setStatus('current') cfcpmcPortSynchLosses = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 2, 1, 7), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmcPortSynchLosses.setStatus('current') cfcpmcPortSignalLosses = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 2, 1, 8), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmcPortSignalLosses.setStatus('current') cfcpmcPortPrimSeqProtocolErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 2, 1, 9), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmcPortPrimSeqProtocolErrors.setStatus('current') cfcpmcPortInvalidTxWords = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 2, 1, 10), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmcPortInvalidTxWords.setStatus('current') cfcpmcPortInvalidCRCs = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 2, 1, 11), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmcPortInvalidCRCs.setStatus('current') cfcpmcPortInvalidOrderedSets = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 2, 1, 12), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmcPortInvalidOrderedSets.setStatus('current') cfcpmcPortFramesTooLong = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 2, 1, 13), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmcPortFramesTooLong.setStatus('current') cfcpmcPortTruncatedFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 2, 1, 14), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmcPortTruncatedFrames.setStatus('current') cfcpmcPortAddressErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 2, 1, 15), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmcPortAddressErrors.setStatus('current') cfcpmcPortDelimiterErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 2, 1, 16), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmcPortDelimiterErrors.setStatus('current') cfcpmcPortEncDisparityErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 2, 1, 17), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmcPortEncDisparityErrors.setStatus('current') cfcpmcPortOtherErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 2, 1, 18), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmcPortOtherErrors.setStatus('current') cfcpmIntervalPortErrorTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 3), ) if mibBuilder.loadTexts: cfcpmIntervalPortErrorTable.setStatus('current') cfcpmIntervalPortErrorEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 3, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "CISCO-FC-PM-MIB", "cfcpmiPortErrorIntervalNumber")) if mibBuilder.loadTexts: cfcpmIntervalPortErrorEntry.setStatus('current') cfcpmiPortErrorIntervalNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 3, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 96))) if mibBuilder.loadTexts: cfcpmiPortErrorIntervalNumber.setStatus('current') cfcpmiPortRxLinkResets = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 3, 1, 2), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmiPortRxLinkResets.setStatus('current') cfcpmiPortTxLinkResets = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 3, 1, 3), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmiPortTxLinkResets.setStatus('current') cfcpmiPortLinkResets = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 3, 1, 4), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmiPortLinkResets.setStatus('current') cfcpmiPortRxOfflineSequences = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 3, 1, 5), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmiPortRxOfflineSequences.setStatus('current') cfcpmiPortTxOfflineSequences = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 3, 1, 6), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmiPortTxOfflineSequences.setStatus('current') cfcpmiPortLinkFailures = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 3, 1, 7), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmiPortLinkFailures.setStatus('current') cfcpmiPortSynchLosses = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 3, 1, 8), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmiPortSynchLosses.setStatus('current') cfcpmiPortSignalLosses = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 3, 1, 9), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmiPortSignalLosses.setStatus('current') cfcpmiPortPrimSeqProtocolErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 3, 1, 10), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmiPortPrimSeqProtocolErrors.setStatus('current') cfcpmiPortInvalidTxWords = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 3, 1, 11), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmiPortInvalidTxWords.setStatus('current') cfcpmiPortInvalidCRCs = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 3, 1, 12), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmiPortInvalidCRCs.setStatus('current') cfcpmiPortInvalidOrderedSets = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 3, 1, 13), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmiPortInvalidOrderedSets.setStatus('current') cfcpmiPortFramesTooLong = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 3, 1, 14), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmiPortFramesTooLong.setStatus('current') cfcpmiPortTruncatedFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 3, 1, 15), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmiPortTruncatedFrames.setStatus('current') cfcpmiPortAddressErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 3, 1, 16), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmiPortAddressErrors.setStatus('current') cfcpmiPortDelimiterErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 3, 1, 17), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmiPortDelimiterErrors.setStatus('current') cfcpmiPortEncDisparityErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 3, 1, 18), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmiPortEncDisparityErrors.setStatus('current') cfcpmiPortOtherErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 3, 1, 19), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmiPortOtherErrors.setStatus('current') cfcpmiPortValidData = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 99997, 1, 2, 3, 1, 20), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfcpmiPortValidData.setStatus('current') cfcpmMibCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 99997, 2, 1)) cfcpmMibGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 99997, 2, 2)) cfcpmMibCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 99997, 2, 1, 1)).setObjects(("CISCO-FC-PM-MIB", "cfcpmPortStatusGroup"), ("CISCO-FC-PM-MIB", "cfcpmMandatoryGroup"), ("CISCO-FC-PM-MIB", "cfcpmOptionalGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfcpmMibCompliance = cfcpmMibCompliance.setStatus('current') cfcpmPortStatusGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 99997, 2, 2, 1)).setObjects(("CISCO-FC-PM-MIB", "cfcpmTimeElapsed"), ("CISCO-FC-PM-MIB", "cfcpmValidIntervals"), ("CISCO-FC-PM-MIB", "cfcpmInvalidIntervals")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfcpmPortStatusGroup = cfcpmPortStatusGroup.setStatus('current') cfcpmMandatoryGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 99997, 2, 2, 2)).setObjects(("CISCO-FC-PM-MIB", "cfcpmtPortPrimSeqProtocolErrors"), ("CISCO-FC-PM-MIB", "cfcpmcPortPrimSeqProtocolErrors"), ("CISCO-FC-PM-MIB", "cfcpmiPortPrimSeqProtocolErrors"), ("CISCO-FC-PM-MIB", "cfcpmiPortValidData")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfcpmMandatoryGroup = cfcpmMandatoryGroup.setStatus('current') cfcpmOptionalGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 99997, 2, 2, 3)).setObjects(("CISCO-FC-PM-MIB", "cfcpmtPortRxLinkResets"), ("CISCO-FC-PM-MIB", "cfcpmtPortTxLinkResets"), ("CISCO-FC-PM-MIB", "cfcpmtPortLinkResets"), ("CISCO-FC-PM-MIB", "cfcpmtPortRxOfflineSequences"), ("CISCO-FC-PM-MIB", "cfcpmtPortTxOfflineSequences"), ("CISCO-FC-PM-MIB", "cfcpmtPortLinkFailures"), ("CISCO-FC-PM-MIB", "cfcpmtPortSynchLosses"), ("CISCO-FC-PM-MIB", "cfcpmtPortSignalLosses"), ("CISCO-FC-PM-MIB", "cfcpmtPortInvalidTxWords"), ("CISCO-FC-PM-MIB", "cfcpmtPortInvalidCRCs"), ("CISCO-FC-PM-MIB", "cfcpmtPortInvalidOrderedSets"), ("CISCO-FC-PM-MIB", "cfcpmtPortFramesTooLong"), ("CISCO-FC-PM-MIB", "cfcpmtPortTruncatedFrames"), ("CISCO-FC-PM-MIB", "cfcpmtPortAddressErrors"), ("CISCO-FC-PM-MIB", "cfcpmtPortDelimiterErrors"), ("CISCO-FC-PM-MIB", "cfcpmtPortEncDisparityErrors"), ("CISCO-FC-PM-MIB", "cfcpmtPortOtherErrors"), ("CISCO-FC-PM-MIB", "cfcpmcPortRxLinkResets"), ("CISCO-FC-PM-MIB", "cfcpmcPortTxLinkResets"), ("CISCO-FC-PM-MIB", "cfcpmcPortLinkResets"), ("CISCO-FC-PM-MIB", "cfcpmcPortRxOfflineSequences"), ("CISCO-FC-PM-MIB", "cfcpmcPortTxOfflineSequences"), ("CISCO-FC-PM-MIB", "cfcpmcPortLinkFailures"), ("CISCO-FC-PM-MIB", "cfcpmcPortSynchLosses"), ("CISCO-FC-PM-MIB", "cfcpmcPortSignalLosses"), ("CISCO-FC-PM-MIB", "cfcpmcPortInvalidTxWords"), ("CISCO-FC-PM-MIB", "cfcpmcPortInvalidCRCs"), ("CISCO-FC-PM-MIB", "cfcpmcPortInvalidOrderedSets"), ("CISCO-FC-PM-MIB", "cfcpmcPortFramesTooLong"), ("CISCO-FC-PM-MIB", "cfcpmcPortTruncatedFrames"), ("CISCO-FC-PM-MIB", "cfcpmcPortAddressErrors"), ("CISCO-FC-PM-MIB", "cfcpmcPortDelimiterErrors"), ("CISCO-FC-PM-MIB", "cfcpmcPortEncDisparityErrors"), ("CISCO-FC-PM-MIB", "cfcpmcPortOtherErrors"), ("CISCO-FC-PM-MIB", "cfcpmiPortRxLinkResets"), ("CISCO-FC-PM-MIB", "cfcpmiPortTxLinkResets"), ("CISCO-FC-PM-MIB", "cfcpmiPortLinkResets"), ("CISCO-FC-PM-MIB", "cfcpmiPortRxOfflineSequences"), ("CISCO-FC-PM-MIB", "cfcpmiPortTxOfflineSequences"), ("CISCO-FC-PM-MIB", "cfcpmiPortLinkFailures"), ("CISCO-FC-PM-MIB", "cfcpmiPortSynchLosses"), ("CISCO-FC-PM-MIB", "cfcpmiPortSignalLosses"), ("CISCO-FC-PM-MIB", "cfcpmiPortInvalidTxWords"), ("CISCO-FC-PM-MIB", "cfcpmiPortInvalidCRCs"), ("CISCO-FC-PM-MIB", "cfcpmiPortInvalidOrderedSets"), ("CISCO-FC-PM-MIB", "cfcpmiPortFramesTooLong"), ("CISCO-FC-PM-MIB", "cfcpmiPortTruncatedFrames"), ("CISCO-FC-PM-MIB", "cfcpmiPortAddressErrors"), ("CISCO-FC-PM-MIB", "cfcpmiPortDelimiterErrors"), ("CISCO-FC-PM-MIB", "cfcpmiPortEncDisparityErrors"), ("CISCO-FC-PM-MIB", "cfcpmiPortOtherErrors")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfcpmOptionalGroup = cfcpmOptionalGroup.setStatus('current') mibBuilder.exportSymbols("CISCO-FC-PM-MIB", cfcpmtPortSynchLosses=cfcpmtPortSynchLosses, cfcpmPortStatusGroup=cfcpmPortStatusGroup, cfcpmtPortFramesTooLong=cfcpmtPortFramesTooLong, cfcpmtPortTxLinkResets=cfcpmtPortTxLinkResets, cfcpmcPortTxOfflineSequences=cfcpmcPortTxOfflineSequences, cfcpmiPortRxOfflineSequences=cfcpmiPortRxOfflineSequences, cfcpmcPortInvalidCRCs=cfcpmcPortInvalidCRCs, cfcpmcPortInvalidOrderedSets=cfcpmcPortInvalidOrderedSets, cfcpmtPortEncDisparityErrors=cfcpmtPortEncDisparityErrors, cfcpmcPortPrimSeqProtocolErrors=cfcpmcPortPrimSeqProtocolErrors, cfcpmTimeElapsed=cfcpmTimeElapsed, cfcpmMibCompliances=cfcpmMibCompliances, cfcpmiPortPrimSeqProtocolErrors=cfcpmiPortPrimSeqProtocolErrors, cfcpmInvalidIntervals=cfcpmInvalidIntervals, cfcpmcPortSynchLosses=cfcpmcPortSynchLosses, cfcpmValidIntervals=cfcpmValidIntervals, cfcpmiPortEncDisparityErrors=cfcpmiPortEncDisparityErrors, cfcpmMibGroups=cfcpmMibGroups, cfcpmcPortRxOfflineSequences=cfcpmcPortRxOfflineSequences, cfcpmMibCompliance=cfcpmMibCompliance, cfcpmPortPerfStatusEntry=cfcpmPortPerfStatusEntry, cfcpmiPortValidData=cfcpmiPortValidData, cfcpmtPortRxOfflineSequences=cfcpmtPortRxOfflineSequences, cfcpmIntervalPortErrorEntry=cfcpmIntervalPortErrorEntry, cfcpmPortErrorStatusBlock=cfcpmPortErrorStatusBlock, ciscoFcPmMIBConform=ciscoFcPmMIBConform, cfcpmcPortSignalLosses=cfcpmcPortSignalLosses, cfcpmOptionalGroup=cfcpmOptionalGroup, cfcpmPortPerfStatusTable=cfcpmPortPerfStatusTable, cfcpmtPortRxLinkResets=cfcpmtPortRxLinkResets, PYSNMP_MODULE_ID=ciscoFcPmMIB, cfcpmTotalPortErrorEntry=cfcpmTotalPortErrorEntry, cfcpmtPortLinkResets=cfcpmtPortLinkResets, cfcpmiPortRxLinkResets=cfcpmiPortRxLinkResets, cfcpmiPortSignalLosses=cfcpmiPortSignalLosses, cfcpmiPortInvalidTxWords=cfcpmiPortInvalidTxWords, cfcpmcPortAddressErrors=cfcpmcPortAddressErrors, cfcpmiPortErrorIntervalNumber=cfcpmiPortErrorIntervalNumber, cfcpmIntervalPortErrorTable=cfcpmIntervalPortErrorTable, cfcpmiPortDelimiterErrors=cfcpmiPortDelimiterErrors, cfcpmPortPerfStatus=cfcpmPortPerfStatus, cfcpmcPortLinkFailures=cfcpmcPortLinkFailures, cfcpmCurrentPortErrorEntry=cfcpmCurrentPortErrorEntry, cfcpmiPortInvalidCRCs=cfcpmiPortInvalidCRCs, cfcpmcPortEncDisparityErrors=cfcpmcPortEncDisparityErrors, cfcpmiPortFramesTooLong=cfcpmiPortFramesTooLong, cfcpmtPortLinkFailures=cfcpmtPortLinkFailures, cfcpmcPortOtherErrors=cfcpmcPortOtherErrors, cfcpmtPortOtherErrors=cfcpmtPortOtherErrors, cfcpmcPortInvalidTxWords=cfcpmcPortInvalidTxWords, cfcpmiPortInvalidOrderedSets=cfcpmiPortInvalidOrderedSets, cfcpmtPortInvalidTxWords=cfcpmtPortInvalidTxWords, cfcpmiPortTxLinkResets=cfcpmiPortTxLinkResets, cfcpmtPortTruncatedFrames=cfcpmtPortTruncatedFrames, ciscoFcPmMIBNotifs=ciscoFcPmMIBNotifs, cfcpmtPortAddressErrors=cfcpmtPortAddressErrors, cfcpmcPortLinkResets=cfcpmcPortLinkResets, cfcpmiPortOtherErrors=cfcpmiPortOtherErrors, cfcpmcPortDelimiterErrors=cfcpmcPortDelimiterErrors, cfcpmCurrentPortErrorTable=cfcpmCurrentPortErrorTable, cfcpmiPortTruncatedFrames=cfcpmiPortTruncatedFrames, cfcpmcPortTxLinkResets=cfcpmcPortTxLinkResets, cfcpmtPortInvalidOrderedSets=cfcpmtPortInvalidOrderedSets, cfcpmMandatoryGroup=cfcpmMandatoryGroup, cfcpmcPortTruncatedFrames=cfcpmcPortTruncatedFrames, ciscoFcPmMIBObjects=ciscoFcPmMIBObjects, cfcpmiPortAddressErrors=cfcpmiPortAddressErrors, cfcpmiPortLinkFailures=cfcpmiPortLinkFailures, cfcpmiPortTxOfflineSequences=cfcpmiPortTxOfflineSequences, cfcpmtPortTxOfflineSequences=cfcpmtPortTxOfflineSequences, cfcpmiPortLinkResets=cfcpmiPortLinkResets, cfcpmtPortDelimiterErrors=cfcpmtPortDelimiterErrors, cfcpmtPortSignalLosses=cfcpmtPortSignalLosses, ciscoFcPmMIB=ciscoFcPmMIB, cfcpmtPortInvalidCRCs=cfcpmtPortInvalidCRCs, cfcpmTotalPortErrorTable=cfcpmTotalPortErrorTable, cfcpmtPortPrimSeqProtocolErrors=cfcpmtPortPrimSeqProtocolErrors, cfcpmiPortSynchLosses=cfcpmiPortSynchLosses, cfcpmcPortRxLinkResets=cfcpmcPortRxLinkResets, cfcpmcPortFramesTooLong=cfcpmcPortFramesTooLong)
137.238636
3,967
0.770928
2,569
24,154
7.247567
0.083301
0.008916
0.012729
0.016972
0.359418
0.335893
0.167678
0.167678
0.167678
0.164456
0
0.069463
0.079159
24,154
175
3,968
138.022857
0.767647
0.013414
0
0.023952
0
0
0.17006
0.056085
0
0
0
0
0
1
0
false
0
0.053892
0
0.053892
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
c081b2d11a5b435dcb1b7be483e436c803475836
232
gyp
Python
binding.gyp
sony/node-win-usbdev
bcdbd277419f1e34b1778390ec1624ccce63068d
[ "Apache-2.0" ]
3
2017-06-28T12:00:36.000Z
2021-11-08T12:34:26.000Z
binding.gyp
sony/node-win-usbdev
bcdbd277419f1e34b1778390ec1624ccce63068d
[ "Apache-2.0" ]
1
2018-02-16T04:32:55.000Z
2018-02-16T04:32:55.000Z
binding.gyp
sony/node-win-usbdev
bcdbd277419f1e34b1778390ec1624ccce63068d
[ "Apache-2.0" ]
3
2017-07-31T23:19:07.000Z
2022-03-25T17:02:51.000Z
{ "targets": [ { "target_name": "usb_dev", "sources": [ "usb_dev.cc" ], "include_dirs" : [ "<!(node -e \"require('nan')\")" ], "libraries": [ "-lsetupapi" ] } ] }
15.466667
42
0.37069
18
232
4.611111
0.888889
0.144578
0
0
0
0
0
0
0
0
0
0
0.396552
232
14
43
16.571429
0.585714
0
0
0
0
0
0.385281
0
0
0
0
0
0
0
null
null
0
0
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
c0a873492ea0286949973b05633bb259a0fc0b1d
422
py
Python
requests/requests-custom_authentication.py
all3g/pieces
bc378fd22ddc700891fe7f34ab0d5b341141e434
[ "CNRI-Python" ]
34
2016-10-31T02:05:24.000Z
2018-11-08T14:33:13.000Z
requests/requests-custom_authentication.py
join-us/python-programming
bc378fd22ddc700891fe7f34ab0d5b341141e434
[ "CNRI-Python" ]
2
2017-05-11T03:00:31.000Z
2017-11-01T23:37:37.000Z
requests/requests-custom_authentication.py
join-us/python-programming
bc378fd22ddc700891fe7f34ab0d5b341141e434
[ "CNRI-Python" ]
21
2016-08-19T09:05:45.000Z
2018-11-08T14:33:16.000Z
#!/usr/bin/python # -*- coding: utf-8 -*- from requests.auth import AuthBase class PizzaAuth(AuthBase): """Attaches HTTP Pizza Authentication to the given Request object.""" def __init__(self, username): # setup any auth-related data here. self.username = username def __call__(self, r): # modify and return the request r.headers['X-Pizza'] = self.username return r
24.823529
73
0.64455
53
422
4.981132
0.716981
0.136364
0
0
0
0
0
0
0
0
0
0.003135
0.244076
422
16
74
26.375
0.824451
0.393365
0
0
0
0
0.02834
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
c0ab2b2d4a6d03d592483deeff8d92956a06c0e7
287
py
Python
src/test_main.py
HenrikPilz/BMEcatConverter
28c6840fc70a3f04e3eae5fc7be32c7bc779c1da
[ "BSD-3-Clause" ]
1
2021-03-14T08:20:51.000Z
2021-03-14T08:20:51.000Z
src/test_main.py
HenrikPilz/BMEcatConverter
28c6840fc70a3f04e3eae5fc7be32c7bc779c1da
[ "BSD-3-Clause" ]
1
2021-11-29T09:56:18.000Z
2021-12-01T22:01:13.000Z
src/test_main.py
HenrikPilz/BMEcatConverter
28c6840fc70a3f04e3eae5fc7be32c7bc779c1da
[ "BSD-3-Clause" ]
2
2021-08-30T08:14:34.000Z
2021-09-28T15:10:23.000Z
import os import test import unittest def tests(): if not os.path.exists("../test_output"): os.makedirs(os.path.join(os.path.dirname(__file__), "../test_output"), exist_ok=True) unittest.main(test) # if __name__ == '__main__': # Datenmodultests tests()
19.133333
94
0.648084
37
287
4.621622
0.567568
0.105263
0
0
0
0
0
0
0
0
0
0
0.198606
287
14
95
20.5
0.743478
0.146341
0
0
0
0
0.122807
0
0
0
0
0
0
1
0.125
true
0
0.375
0
0.5
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
c0ab90f34a7bc1c416809bd67bdc787e6a30c4a3
99
py
Python
problem/01000~09999/02857/2857.py3.py
njw1204/BOJ-AC
1de41685725ae4657a7ff94e413febd97a888567
[ "MIT" ]
1
2019-04-19T16:37:44.000Z
2019-04-19T16:37:44.000Z
problem/01000~09999/02857/2857.py3.py
njw1204/BOJ-AC
1de41685725ae4657a7ff94e413febd97a888567
[ "MIT" ]
1
2019-04-20T11:42:44.000Z
2019-04-20T11:42:44.000Z
problem/01000~09999/02857/2857.py3.py
njw1204/BOJ-AC
1de41685725ae4657a7ff94e413febd97a888567
[ "MIT" ]
3
2019-04-19T16:37:47.000Z
2021-10-25T00:45:00.000Z
a=1 for i in range(5): if 'FBI' in input(): print(i+1,end=' ') a=0 if a: print('HE GOT AWAY!')
16.5
27
0.555556
23
99
2.391304
0.695652
0
0
0
0
0
0
0
0
0
0
0.051282
0.212121
99
6
27
16.5
0.653846
0
0
0
0
0
0.16
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
c0b94e63b8ef518a54d1b8787a0fbfafc3083387
53
py
Python
script/__init__.py
KaoruNishikawa/nanten_tools
f5af30a40e8d558ae247c8e864fdea5edc0f5fb7
[ "MIT" ]
null
null
null
script/__init__.py
KaoruNishikawa/nanten_tools
f5af30a40e8d558ae247c8e864fdea5edc0f5fb7
[ "MIT" ]
null
null
null
script/__init__.py
KaoruNishikawa/nanten_tools
f5af30a40e8d558ae247c8e864fdea5edc0f5fb7
[ "MIT" ]
null
null
null
__version__ = "0.1.0" __author__ = "Kaoru Nishikawa"
17.666667
30
0.716981
7
53
4.285714
0.857143
0
0
0
0
0
0
0
0
0
0
0.065217
0.132075
53
2
31
26.5
0.586957
0
0
0
0
0
0.377358
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
c0bc31b78e193431b864fc09c2a40bbe17627b76
301
py
Python
1 ano/logica-de-programacao/condicionais/peso-animais-maior-menor.py
Biguelini/Atividades-Tecnico-em-Informatica
468e9ac05a666143d8752d053854ecc22bcc8b79
[ "MIT" ]
4
2021-04-27T01:00:32.000Z
2021-09-24T16:25:48.000Z
1 ano/logica-de-programacao/condicionais/peso-animais-maior-menor.py
Biguelini/Atividades-Tecnico-em-Informatica
468e9ac05a666143d8752d053854ecc22bcc8b79
[ "MIT" ]
null
null
null
1 ano/logica-de-programacao/condicionais/peso-animais-maior-menor.py
Biguelini/Atividades-Tecnico-em-Informatica
468e9ac05a666143d8752d053854ecc22bcc8b79
[ "MIT" ]
1
2021-05-12T18:28:06.000Z
2021-05-12T18:28:06.000Z
peso1 = float(input('Digite o peso do primeiro animal... ')) peso2 = float(input('Digite o peso do segundo animal... ')) if peso1 > peso2: print('O primeiro animal é mais pesado') elif peso1 < peso2: print('O segundo animal é mais pesado') else: print('Os dois animais têm o mesmo peso')
30.1
60
0.681063
47
301
4.361702
0.489362
0.097561
0.156098
0.165854
0.22439
0.22439
0
0
0
0
0
0.024793
0.196013
301
9
61
33.444444
0.822314
0
0
0
0
0
0.544851
0
0
0
0
0
0
1
0
false
0
0
0
0
0.375
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
c0d13bb4fa90665ac270a6c1d4953230e7cffcc2
371
py
Python
sensors/routing.py
edisondotme/motoPi
18ddd46d97a4db0918fd2c3cc1ffc60600158124
[ "MIT" ]
2
2021-05-10T22:04:36.000Z
2022-01-10T03:23:04.000Z
sensors/routing.py
edisondotme/motoPi
18ddd46d97a4db0918fd2c3cc1ffc60600158124
[ "MIT" ]
1
2017-02-13T08:18:49.000Z
2017-02-14T07:11:18.000Z
sensors/routing.py
edisondotme/motoPi
18ddd46d97a4db0918fd2c3cc1ffc60600158124
[ "MIT" ]
1
2021-05-10T22:04:57.000Z
2021-05-10T22:04:57.000Z
from channels.routing import route from .consumers import ws_message, ws_connect, ws_disconnect # TODO: Edit this to make proper use of channels.routing.route() or not channel_routing = { # route("websocket.receive", ws_message, path=r"^/chat/"), "websocket.connect": ws_connect, "websocket.receive": ws_message, "websocket.disconnect": ws_disconnect, }
30.916667
72
0.74124
49
371
5.44898
0.530612
0.101124
0.134831
0.187266
0
0
0
0
0
0
0
0
0.142857
371
11
73
33.727273
0.839623
0.339623
0
0
0
0
0.233766
0
0
0
0
0.090909
0
1
0
false
0
0.285714
0
0.285714
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
1
0
0
0
0
0
0
0
0
0
0
2
c0d5ca80bb24462f1f4a71c0cb35cf7b23654b5a
3,207
py
Python
etl/parsers/etw/Microsoft_Windows_AssignedAccess.py
IMULMUL/etl-parser
76b7c046866ce0469cd129ee3f7bb3799b34e271
[ "Apache-2.0" ]
104
2020-03-04T14:31:31.000Z
2022-03-28T02:59:36.000Z
etl/parsers/etw/Microsoft_Windows_AssignedAccess.py
IMULMUL/etl-parser
76b7c046866ce0469cd129ee3f7bb3799b34e271
[ "Apache-2.0" ]
7
2020-04-20T09:18:39.000Z
2022-03-19T17:06:19.000Z
etl/parsers/etw/Microsoft_Windows_AssignedAccess.py
IMULMUL/etl-parser
76b7c046866ce0469cd129ee3f7bb3799b34e271
[ "Apache-2.0" ]
16
2020-03-05T18:55:59.000Z
2022-03-01T10:19:28.000Z
# -*- coding: utf-8 -*- """ Microsoft-Windows-AssignedAccess GUID : 8530db6e-51c0-43d6-9d02-a8c2088526cd """ from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct from etl.utils import WString, CString, SystemTime, Guid from etl.dtyp import Sid from etl.parsers.etw.core import Etw, declare, guid @declare(guid=guid("8530db6e-51c0-43d6-9d02-a8c2088526cd"), event_id=10001, version=0) class Microsoft_Windows_AssignedAccess_10001_0(Etw): pattern = Struct( "SID" / WString ) @declare(guid=guid("8530db6e-51c0-43d6-9d02-a8c2088526cd"), event_id=10002, version=0) class Microsoft_Windows_AssignedAccess_10002_0(Etw): pattern = Struct( "SID" / WString ) @declare(guid=guid("8530db6e-51c0-43d6-9d02-a8c2088526cd"), event_id=10003, version=0) class Microsoft_Windows_AssignedAccess_10003_0(Etw): pattern = Struct( "SID" / WString ) @declare(guid=guid("8530db6e-51c0-43d6-9d02-a8c2088526cd"), event_id=10004, version=0) class Microsoft_Windows_AssignedAccess_10004_0(Etw): pattern = Struct( "AppID" / WString ) @declare(guid=guid("8530db6e-51c0-43d6-9d02-a8c2088526cd"), event_id=10010, version=0) class Microsoft_Windows_AssignedAccess_10010_0(Etw): pattern = Struct( "ErrorCode" / Int32ul ) @declare(guid=guid("8530db6e-51c0-43d6-9d02-a8c2088526cd"), event_id=10020, version=0) class Microsoft_Windows_AssignedAccess_10020_0(Etw): pattern = Struct( "ErrorCode" / Int32ul ) @declare(guid=guid("8530db6e-51c0-43d6-9d02-a8c2088526cd"), event_id=20000, version=0) class Microsoft_Windows_AssignedAccess_20000_0(Etw): pattern = Struct( "SID" / WString, "UserName" / WString, "AppID" / WString, "AppName" / WString ) @declare(guid=guid("8530db6e-51c0-43d6-9d02-a8c2088526cd"), event_id=30000, version=0) class Microsoft_Windows_AssignedAccess_30000_0(Etw): pattern = Struct( "File" / CString, "LineNumber" / Int32ul, "ErrorCode" / Int32ul, "ErrorCodeExpanded" / Int32sl ) @declare(guid=guid("8530db6e-51c0-43d6-9d02-a8c2088526cd"), event_id=31000, version=0) class Microsoft_Windows_AssignedAccess_31000_0(Etw): pattern = Struct( "ErrorCode" / Int32sl ) @declare(guid=guid("8530db6e-51c0-43d6-9d02-a8c2088526cd"), event_id=31001, version=0) class Microsoft_Windows_AssignedAccess_31001_0(Etw): pattern = Struct( "ErrorCode" / Int32sl ) @declare(guid=guid("8530db6e-51c0-43d6-9d02-a8c2088526cd"), event_id=31002, version=0) class Microsoft_Windows_AssignedAccess_31002_0(Etw): pattern = Struct( "Custom" / WString, "ErrorCode" / Int32ul ) @declare(guid=guid("8530db6e-51c0-43d6-9d02-a8c2088526cd"), event_id=32000, version=0) class Microsoft_Windows_AssignedAccess_32000_0(Etw): pattern = Struct( "Custom" / WString, "ErrorCode" / Int32ul ) @declare(guid=guid("8530db6e-51c0-43d6-9d02-a8c2088526cd"), event_id=33000, version=0) class Microsoft_Windows_AssignedAccess_33000_0(Etw): pattern = Struct( "Custom" / WString, "ErrorCode" / Int32ul )
28.891892
123
0.707827
379
3,207
5.817942
0.171504
0.101587
0.190476
0.126984
0.769161
0.769161
0.487075
0.487075
0.466213
0.466213
0
0.18736
0.166199
3,207
110
124
29.154545
0.637248
0.03087
0
0.333333
0
0
0.202001
0.151016
0
0
0
0
0
1
0
false
0
0.051282
0
0.384615
0
0
0
0
null
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
c0d827e88a1ab4916995d9e81ac4218d54ad748c
631
py
Python
tests/bdd/test_fixures.py
othercodes/connect-devops-testing-library
700f1a86f92c3b7f91a3882bf29ed62d98fe9dcd
[ "Apache-2.0" ]
3
2021-11-19T08:10:17.000Z
2022-01-05T15:37:28.000Z
tests/bdd/test_fixures.py
othercodes/connect-devops-testing-library
700f1a86f92c3b7f91a3882bf29ed62d98fe9dcd
[ "Apache-2.0" ]
1
2021-12-09T16:33:15.000Z
2021-12-09T16:33:15.000Z
tests/bdd/test_fixures.py
othercodes/connect-devops-testing-library
700f1a86f92c3b7f91a3882bf29ed62d98fe9dcd
[ "Apache-2.0" ]
2
2021-11-08T08:39:11.000Z
2021-11-08T08:40:23.000Z
from connect.devops_testing.bdd.fixtures import use_connect_request_dispatcher, use_connect_request_builder from connect.devops_testing.request import Builder, Dispatcher def test_should_successfully_initialize_request_builder_in_behave_context(behave_context): use_connect_request_builder(behave_context) assert isinstance(behave_context.builder, Builder) def test_should_successfully_initialize_request_dispatcher_in_behave_context(behave_context): use_connect_request_dispatcher(behave_context, use_specs=False) assert isinstance(behave_context.connect, Dispatcher) assert behave_context.request == {}
39.4375
107
0.865293
78
631
6.512821
0.294872
0.230315
0.133858
0.094488
0.34252
0.34252
0.177165
0.177165
0
0
0
0
0.083994
631
15
108
42.066667
0.878893
0
0
0
0
0
0
0
0
0
0
0
0.333333
1
0.222222
false
0
0.222222
0
0.444444
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
c0e271f6251b995e55557dc615aa3e3800aa1106
587
py
Python
demos/cyk_test.py
wannaphong/pycfg
ffa67958ed1c3deb73cadb3969ac086336fb1269
[ "MIT" ]
8
2017-12-18T08:51:27.000Z
2020-11-26T02:21:06.000Z
demos/cyk_test.py
wannaphong/pycfg
ffa67958ed1c3deb73cadb3969ac086336fb1269
[ "MIT" ]
1
2020-01-09T15:41:09.000Z
2020-01-09T15:41:09.000Z
demos/cyk_test.py
wannaphong/pycfg
ffa67958ed1c3deb73cadb3969ac086336fb1269
[ "MIT" ]
6
2017-06-12T16:58:40.000Z
2019-11-27T06:55:07.000Z
'''Run Example 4.8 from Aho & Ullman p. 315-316, printing the steps to stdout. ''' from cfg import aho_ullman, core import sys CFG = core.ContextFreeGrammar G = CFG(''' S -> AA | AS | b A -> SA | AS | a ''') w = map(core.Terminal, 'abaab') print 'G:' print G print print 'w =', ''.join(map(str, w)) print T = aho_ullman.cocke_younger_kasami_algorithm(G, w, out=sys.stdout, check=False) print 'T:' print aho_ullman.parse_table_str(T) print parse = aho_ullman.left_parse_from_parse_table(G, w, T, check=False) tree = aho_ullman.LeftParse(G, parse).tree() print 'Parse tree:', tree
18.935484
80
0.691652
101
587
3.881188
0.465347
0.137755
0.056122
0
0
0
0
0
0
0
0
0.016129
0.155026
587
30
81
19.566667
0.774194
0
0
0.15
0
0
0.115079
0
0
0
0
0
0
0
null
null
0
0.1
null
null
0.45
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
1
0
2
8d0744d0d6c3d370aff01717e44e415269208d73
238
py
Python
output/models/nist_data/list_pkg/date/schema_instance/nistschema_sv_iv_list_date_min_length_1_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/date/schema_instance/nistschema_sv_iv_list_date_min_length_1_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/date/schema_instance/nistschema_sv_iv_list_date_min_length_1_xsd/__init__.py
tefra/xsdata-w3c-tests
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
[ "MIT" ]
null
null
null
from output.models.nist_data.list_pkg.date.schema_instance.nistschema_sv_iv_list_date_min_length_1_xsd.nistschema_sv_iv_list_date_min_length_1 import NistschemaSvIvListDateMinLength1 __all__ = [ "NistschemaSvIvListDateMinLength1", ]
39.666667
182
0.886555
31
238
6.096774
0.645161
0.126984
0.148148
0.190476
0.338624
0.338624
0.338624
0.338624
0
0
0
0.017857
0.058824
238
5
183
47.6
0.825893
0
0
0
0
0
0.134454
0.134454
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
239448a88cf09613c57c9e9d85d7149c490e74ce
740
py
Python
Python/剑指offer53-I.py
1050669722/LeetCode-Answers
c8f4d1ccaac09cda63b60d75144335347b06dc81
[ "MIT" ]
null
null
null
Python/剑指offer53-I.py
1050669722/LeetCode-Answers
c8f4d1ccaac09cda63b60d75144335347b06dc81
[ "MIT" ]
null
null
null
Python/剑指offer53-I.py
1050669722/LeetCode-Answers
c8f4d1ccaac09cda63b60d75144335347b06dc81
[ "MIT" ]
null
null
null
class Solution: def search(self, nums: List[int], target: int) -> int: # if len(nums) == 1: # return 1 if nums[0] == target else 0 tmp = [] i, j = 0, len(nums) - 1 while i <= j: m = (i + j) // 2 if nums[m] == target: tmp.append(m) if i < len(nums) and nums[i] == target: tmp.append(i) i += 1 elif nums[m] > target: j = m - 1 if j >= 0 and nums[j] == target: tmp.append(j) else: i = m + 1 if i < len(nums) and nums[i] == target: tmp.append(i) return len(set(tmp))
32.173913
58
0.364865
93
740
2.903226
0.268817
0.103704
0.222222
0.074074
0.251852
0.251852
0.251852
0.251852
0.251852
0.251852
0
0.030055
0.505405
740
22
59
33.636364
0.70765
0.07973
0
0.2
0
0
0
0
0
0
0
0
0
1
0.05
false
0
0
0
0.15
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
239787e50f7f31c3ea658751864cb26108816d6d
275
py
Python
ctfproblems/Hopper/10_who_is_digging/grader.py
milesmcc/pactf-2018
cfd9d94a7b6828259220f52ab3c5893a28429c62
[ "MIT" ]
null
null
null
ctfproblems/Hopper/10_who_is_digging/grader.py
milesmcc/pactf-2018
cfd9d94a7b6828259220f52ab3c5893a28429c62
[ "MIT" ]
null
null
null
ctfproblems/Hopper/10_who_is_digging/grader.py
milesmcc/pactf-2018
cfd9d94a7b6828259220f52ab3c5893a28429c62
[ "MIT" ]
null
null
null
def grade(key, submission): if submission.lower() == 'sea' or submission.lower() == 'the sea': return True, "Yes! Miles learns Russian so he came up with the words that visually look same in both English and Russian." else: return False, "Nyet!"
45.833333
131
0.650909
39
275
4.589744
0.820513
0.167598
0
0
0
0
0
0
0
0
0
0
0.243636
275
5
132
55
0.860577
0
0
0
0
0.2
0.451852
0
0
0
0
0
0
1
0.2
false
0
0
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
239de3aa205a8c68e33dedf541996817e27acfa5
3,440
py
Python
virtualsmartcard-0.8/src/vpicc/virtualsmartcard/tests/SmartcardSAM_test.py
CMelas/foo
d7a34b24606c7b9ab04ea8c39a8b3716ca6255c1
[ "MIT" ]
1
2021-11-09T12:01:56.000Z
2021-11-09T12:01:56.000Z
virtualsmartcard-0.8/src/vpicc/virtualsmartcard/tests/SmartcardSAM_test.py
CMelas/foo
d7a34b24606c7b9ab04ea8c39a8b3716ca6255c1
[ "MIT" ]
null
null
null
virtualsmartcard-0.8/src/vpicc/virtualsmartcard/tests/SmartcardSAM_test.py
CMelas/foo
d7a34b24606c7b9ab04ea8c39a8b3716ca6255c1
[ "MIT" ]
null
null
null
# # Copyright (C) 2014 Dominik Oepen # # This file is part of virtualsmartcard. # # virtualsmartcard is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # virtualsmartcard is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # more details. # # You should have received a copy of the GNU General Public License along with # virtualsmartcard. If not, see <http://www.gnu.org/licenses/>. # import unittest from virtualsmartcard.SmartcardSAM import * class TestSmartcardSAM(unittest.TestCase): def setUp(self): self.password = "DUMMYKEYDUMMYKEY" self.myCard = SAM("1234", "1234567890") self.secEnv = Security_Environment(None, self.myCard) # TODO: Set CRTs self.secEnv.ht.algorithm = "SHA" self.secEnv.ct.algorithm = "AES-CBC" def test_incorrect_pin(self): with self.assertRaises(SwError): self.myCard.verify(0x00, 0x00, "5678") def test_counter_decrement(self): ctr1 = self.myCard.counter try: self.myCard.verify(0x00, 0x00, "3456") except SwError as e: pass self.assertEquals(self.myCard.counter, ctr1 - 1) def test_internal_authenticate(self): sw, challenge = self.myCard.get_challenge(0x00, 0x00, "") blocklen = vsCrypto.get_cipher_blocklen("DES3-ECB") padded = vsCrypto.append_padding(blocklen, challenge) sw, result_data = self.myCard.internal_authenticate(0x00, 0x00, padded) self.assertEquals(sw, SW["NORMAL"]) def test_external_authenticate(self): sw, challenge = self.myCard.get_challenge(0x00, 0x00, "") blocklen = vsCrypto.get_cipher_blocklen("DES3-ECB") padded = vsCrypto.append_padding(blocklen, challenge) sw, result_data = self.myCard.internal_authenticate(0x00, 0x00, padded) sw, result_data = self.myCard.external_authenticate(0x00, 0x00, result_data) self.assertEquals(sw, SW["NORMAL"]) def test_security_environment(self): hash = self.secEnv.hash(0x90, 0x80, self.password) # The API should be changed so that the hash function returns SW_NORMAL self.secEnv.ct.key = hash[:16] crypted = self.secEnv.encipher(0x00, 0x00, self.password) # The API should be changed so that encipher() returns SW_NORMAL plain = self.secEnv.decipher(0x00, 0x00, crypted) # The API should be changed so that decipher() returns SW_NORMAL # self.assertEqual(plain, self.password) # secEnv.decipher doesn't strip padding. Should it? # should this really be secEnv.ct? probably rather secEnv.dst self.secEnv.ct.algorithm = "RSA" self.secEnv.dst.keylength = 1024 sw, pk = self.secEnv.generate_public_key_pair(0x00, 0x00, "") self.assertEquals(sw, SW["NORMAL"]) if __name__ == "__main__": unittest.main() # CF = CryptoflexSE(None) # print CF.generate_public_key_pair(0x00, 0x80, "\x01\x00\x01\x00") # print MyCard._get_referenced_key(0x01)
40
79
0.670058
433
3,440
5.21709
0.399538
0.048694
0.02479
0.025232
0.35104
0.2749
0.250111
0.208942
0.208942
0.174413
0
0.04599
0.235174
3,440
85
80
40.470588
0.812619
0.343605
0
0.244444
0
0
0.041723
0
0
0
0.03948
0.011765
0.111111
1
0.133333
false
0.088889
0.044444
0
0.2
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
1
0
0
0
0
0
2
23a8d2f8440fc0f4ab166887414f385e16797422
381
py
Python
mac.py
focusaurus/commander
4d511c9211ec6afcb2614e7b24b287c7c833c853
[ "MIT", "Unlicense" ]
3
2015-10-12T21:32:37.000Z
2021-09-16T16:51:03.000Z
mac.py
focusaurus/commander
4d511c9211ec6afcb2614e7b24b287c7c833c853
[ "MIT", "Unlicense" ]
null
null
null
mac.py
focusaurus/commander
4d511c9211ec6afcb2614e7b24b287c7c833c853
[ "MIT", "Unlicense" ]
null
null
null
from builtins import str from .helpers import run import logging import subprocess import functools import types logger = logging.getLogger("commander") def maestro(scriptId): """Run a Keyboard Maestro script by ID (more robust) or name.""" run( """osascript -e 'tell application "Keyboard Maestro Engine" to """ """do script "%s"'\n""" % scriptId )
22.411765
74
0.67979
48
381
5.395833
0.708333
0.11583
0
0
0
0
0
0
0
0
0
0
0.207349
381
16
75
23.8125
0.857616
0.152231
0
0
0
0
0.039474
0
0
0
0
0
0
1
0.090909
false
0
0.545455
0
0.636364
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
23a8d8b1cd48f9fd55d3941e62fe86313bca756e
764
py
Python
planning_system/db/schema/views/finance/v_ui_finance.py
jehboyes/planning_system
a415f1408ef344732498d2ffb111dfd187b9b50f
[ "MIT" ]
null
null
null
planning_system/db/schema/views/finance/v_ui_finance.py
jehboyes/planning_system
a415f1408ef344732498d2ffb111dfd187b9b50f
[ "MIT" ]
null
null
null
planning_system/db/schema/views/finance/v_ui_finance.py
jehboyes/planning_system
a415f1408ef344732498d2ffb111dfd187b9b50f
[ "MIT" ]
null
null
null
from planning_system.db.schema.views import _get_set_cols def definition(session): """ Return UI view. Complex view, which requires a dynamic pivot. """ pvt_list = _get_set_cols(session) sql = f""" SELECT costc, summary_code, summary, section, supersection, summary_order, sec_order, super_order, level, {pvt_list} FROM (SELECT costc, summary_code, summary, section, supersection, summary_order, sec_order, super_order, level, CAST(f_Set.acad_year as CHAR(4)) + ' ' + f_set.set_cat_id as finance_summary, amount as amount FROM [v_mri_finance_grouped_subtotal] f INNER JOIN f_set ON f_set.set_id = f.set_id) p PIVOT (SUM(amount) FOR finance_summary in ({pvt_list})) as pvt """ return sql
38.2
120
0.700262
114
764
4.403509
0.5
0.039841
0.039841
0.087649
0.330677
0.330677
0.330677
0.330677
0.330677
0.330677
0
0.00165
0.206806
764
19
121
40.210526
0.826733
0.081152
0
0
0
0.25
0.76393
0.046921
0
0
0
0
0
1
0.083333
false
0
0.083333
0
0.25
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
23aebda5722243d52ce15ff9c4cb52dbd5434d9f
1,217
py
Python
waferscreen/data_io/exceptions.py
chw3k5/WaferScreen
c0ca7fe939fe7cd0b722b7d6129b148c03a7505c
[ "Apache-2.0" ]
1
2021-07-30T19:06:07.000Z
2021-07-30T19:06:07.000Z
waferscreen/data_io/exceptions.py
chw3k5/WaferScreen
c0ca7fe939fe7cd0b722b7d6129b148c03a7505c
[ "Apache-2.0" ]
8
2021-04-22T20:47:48.000Z
2021-07-30T19:06:01.000Z
waferscreen/data_io/exceptions.py
chw3k5/WaferScreen
c0ca7fe939fe7cd0b722b7d6129b148c03a7505c
[ "Apache-2.0" ]
null
null
null
class ResProcessingError(Exception): """The base class for exceptions the occur during resonator processing.""" pass class ResMinIsLeftMost(ResProcessingError): """Raised when the RWHM definition detects that the resonator's minima is the left-most point""" pass class ResMinIsRightMost(ResProcessingError): """Raised when the RWHM definition detects that the resonator's minima is the right-most point""" pass class FailedResFit(ResProcessingError): """Raised when the curvefit has a runtime error and a the resonator fit fails to converge""" pass # Lambda processing class LambdaProcessingError(Exception): """The base class for exceptions the occur during lambda curve fitting and processing.""" pass class NoDataForCurveFit(LambdaProcessingError): """Empty lists, [], were return for currentuA and/or freqGHz needed for lambda fitting""" pass class NotEnoughDataForCurveFit(LambdaProcessingError): """Curve Fit for lambda fitting has more free parameters then data points""" pass class OptimalParametersNotFoundForCurveFit(LambdaProcessingError): """Optimal parameters not found: Number of calls to function has reached maxfev""" pass
30.425
101
0.758422
142
1,217
6.5
0.478873
0.058505
0.091008
0.100758
0.277356
0.277356
0.277356
0.277356
0.277356
0.173348
0
0
0.171734
1,217
39
102
31.205128
0.915675
0.552999
0
0.5
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
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