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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
fd60f24410fd53be2af86996632f5721f5b0bb86 | 317 | py | Python | Source/mtm/util/CommonSettings.py | fairhopeweb/Projeny | 4c11ab8f3d2c91765bdf50766f39b2df1d208467 | [
"MIT"
] | 752 | 2016-01-09T04:56:10.000Z | 2022-02-13T14:13:53.000Z | Source/mtm/util/CommonSettings.py | fairhopeweb/Projeny | 4c11ab8f3d2c91765bdf50766f39b2df1d208467 | [
"MIT"
] | 86 | 2016-01-08T22:48:27.000Z | 2019-10-02T03:15:49.000Z | Source/mtm/util/CommonSettings.py | fairhopeweb/Projeny | 4c11ab8f3d2c91765bdf50766f39b2df1d208467 | [
"MIT"
] | 108 | 2016-01-10T20:43:52.000Z | 2021-09-17T22:46:26.000Z |
from mtm.ioc.Inject import Inject
ConfigFileName = 'Projeny.yaml'
class CommonSettings:
_config = Inject('Config')
def __init__(self):
self.maxProjectNameLength = self._config.getInt('MaxProjectNameLength')
def getShortProjectName(self, val):
return val[0:self.maxProjectNameLength]
| 21.133333 | 79 | 0.725552 | 32 | 317 | 7 | 0.625 | 0.214286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003831 | 0.176656 | 317 | 14 | 80 | 22.642857 | 0.854406 | 0 | 0 | 0 | 0 | 0 | 0.120635 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.125 | 0.125 | 0.75 | 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 | 1 | 0 | 0 | 0 | 3 |
b5f47e8e26cab8e30eab9f884aeb24b96d6c5045 | 1,816 | py | Python | devo/common/dates/dateoperations.py | imposeren/python-sdk | c772da98664a31d86207f86bc005ecb2128e74d7 | [
"MIT"
] | 18 | 2018-09-25T11:47:28.000Z | 2021-12-14T20:28:39.000Z | devo/common/dates/dateoperations.py | imposeren/python-sdk | c772da98664a31d86207f86bc005ecb2128e74d7 | [
"MIT"
] | 57 | 2018-11-08T12:40:30.000Z | 2022-03-31T13:01:19.000Z | devo/common/dates/dateoperations.py | imposeren/python-sdk | c772da98664a31d86207f86bc005ecb2128e74d7 | [
"MIT"
] | 34 | 2018-11-05T16:09:15.000Z | 2022-03-08T10:51:34.000Z | # -*- coding: utf-8 -*-
"""A collection of allowed operations on date parsing"""
from datetime import datetime as dt, timedelta
from .dateutils import to_millis, trunc_time, trunc_time_minute
def month():
"""
Return millis for a month
:return: 30 * 24 * 60 * 60 * 1000
"""
return 2592000000
def week():
"""
Return millis for a week
:return: 7 * 24 * 60 * 60 * 1000
"""
return 604800000
def day():
"""
Return millis for a day
:return: 24 * 60 * 60 * 1000
"""
return 86400000
def hour():
"""
Return millis for an hour
:return: Return 60 * 60 * 1000
"""
return 3600000
def minute():
"""
Return millis for a minute
:return: 60 * 1000
"""
return 60000
def second():
"""
Return millis for a second
:return: 1000
"""
return 1000
def now():
"""
Return current millis in UTC
:return: Millis
"""
return to_millis(dt.utcnow())
def now_without_ms():
"""
Return current millis in UTC
:return: Millis
"""
return to_millis(trunc_time_minute(dt.utcnow()))
def today():
"""
Return current millis with the time truncated to 00:00:00
:return: Millis
"""
return to_millis(trunc_time(dt.utcnow()))
def yesterday():
"""
Return millis from yesterday with time truncated to 00:00:00
:return: Millis
"""
return to_millis(trunc_time(dt.utcnow()) - timedelta(days=1))
def parse_functions():
"""Return object with all functions availables"""
return {
"month": month,
"week": week,
"day": day,
"hour": hour,
"minute": minute,
"second": second,
"now": now,
"now_without_ms": now_without_ms,
"today": today,
"yesterday": yesterday
}
| 17.980198 | 65 | 0.577643 | 223 | 1,816 | 4.618834 | 0.278027 | 0.128155 | 0.087379 | 0.07767 | 0.276699 | 0.230097 | 0.230097 | 0.221359 | 0.221359 | 0.221359 | 0 | 0.08464 | 0.297357 | 1,816 | 100 | 66 | 18.16 | 0.722571 | 0.370595 | 0 | 0 | 0 | 0 | 0.062633 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.314286 | true | 0 | 0.057143 | 0 | 0.685714 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
bd10bb451c0e6e32bb432b15207ed5b420dec786 | 360 | py | Python | turret/layers/relu.py | hemantranvir/turret | bc3df21541ce2f808c749c985db47a210149f22c | [
"MIT"
] | 4 | 2019-03-14T18:27:33.000Z | 2021-07-05T05:34:30.000Z | turret/layers/relu.py | hemantranvir/turret | bc3df21541ce2f808c749c985db47a210149f22c | [
"MIT"
] | 1 | 2019-06-07T06:03:04.000Z | 2019-06-07T06:03:04.000Z | turret/layers/relu.py | hemantranvir/turret | bc3df21541ce2f808c749c985db47a210149f22c | [
"MIT"
] | 4 | 2019-10-30T10:30:47.000Z | 2019-10-30T11:15:40.000Z | # -*- coding: utf-8 -*-
from .builtin import ActivationType
from .builtin import builtin_activation
def relu(input):
"""Layer for ReLU.
Args:
input(turret.Tensor): Tensor which will be processed by ReLU.
Returns:
tensor(turret.Tensor): Tensor processed by ReLU.
"""
return builtin_activation(input, ActivationType.RELU)
| 22.5 | 69 | 0.683333 | 43 | 360 | 5.674419 | 0.534884 | 0.090164 | 0.139344 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003534 | 0.213889 | 360 | 15 | 70 | 24 | 0.858657 | 0.483333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.5 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
bd25ebe360b158288947550806a94a17f9d3f5de | 170 | py | Python | python/289.game-of-life.py | stavanmehta/leetcode | 1224e43ce29430c840e65daae3b343182e24709c | [
"Apache-2.0"
] | null | null | null | python/289.game-of-life.py | stavanmehta/leetcode | 1224e43ce29430c840e65daae3b343182e24709c | [
"Apache-2.0"
] | null | null | null | python/289.game-of-life.py | stavanmehta/leetcode | 1224e43ce29430c840e65daae3b343182e24709c | [
"Apache-2.0"
] | null | null | null | class Solution:
def gameOfLife(self, board: List[List[int]]) -> None:
"""
Do not return anything, modify board in-place instead.
"""
| 24.285714 | 62 | 0.552941 | 19 | 170 | 4.947368 | 0.894737 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.323529 | 170 | 6 | 63 | 28.333333 | 0.817391 | 0.317647 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
bd285134e3105cf8476c2af59f0269fe52018d30 | 18,905 | py | Python | objdetect_msgs/src/objdetect_msgs/msg/_DetectObjectGrid.py | MRSD2018/reefbot-1 | a595ca718d0cda277726894a3105815cef000475 | [
"MIT"
] | null | null | null | objdetect_msgs/src/objdetect_msgs/msg/_DetectObjectGrid.py | MRSD2018/reefbot-1 | a595ca718d0cda277726894a3105815cef000475 | [
"MIT"
] | null | null | null | objdetect_msgs/src/objdetect_msgs/msg/_DetectObjectGrid.py | MRSD2018/reefbot-1 | a595ca718d0cda277726894a3105815cef000475 | [
"MIT"
] | null | null | null | """autogenerated by genpy from objdetect_msgs/DetectObjectGrid.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import sensor_msgs.msg
import objdetect_msgs.msg
import std_msgs.msg
class DetectObjectGrid(genpy.Message):
_md5sum = "b797b0432e7c2ecd0ace33d4c690869f"
_type = "objdetect_msgs/DetectObjectGrid"
_has_header = True #flag to mark the presence of a Header object
_full_text = """# To detect an object on a w,h,x,y grid. It is more compressed than listing all of the boxes we care about
Header header
# The image to find objects in
sensor_msgs/Image image
# The (w,h,x,y) grid to search on
Grid grid
# An optional binary mask that is 4 dimensional (w,h,x,y) and
# specifies which entries we actually want to search in
sensor_msgs/MatND mask
================================================================================
MSG: std_msgs/Header
# Standard metadata for higher-level stamped data types.
# This is generally used to communicate timestamped data
# in a particular coordinate frame.
#
# sequence ID: consecutively increasing ID
uint32 seq
#Two-integer timestamp that is expressed as:
# * stamp.secs: seconds (stamp_secs) since epoch
# * stamp.nsecs: nanoseconds since stamp_secs
# time-handling sugar is provided by the client library
time stamp
#Frame this data is associated with
# 0: no frame
# 1: global frame
string frame_id
================================================================================
MSG: sensor_msgs/Image
# This message contains an uncompressed image
# (0, 0) is at top-left corner of image
#
Header header # Header timestamp should be acquisition time of image
# Header frame_id should be optical frame of camera
# origin of frame should be optical center of cameara
# +x should point to the right in the image
# +y should point down in the image
# +z should point into to plane of the image
# If the frame_id here and the frame_id of the CameraInfo
# message associated with the image conflict
# the behavior is undefined
uint32 height # image height, that is, number of rows
uint32 width # image width, that is, number of columns
# The legal values for encoding are in file src/image_encodings.cpp
# If you want to standardize a new string format, join
# ros-users@lists.sourceforge.net and send an email proposing a new encoding.
string encoding # Encoding of pixels -- channel meaning, ordering, size
# taken from the list of strings in src/image_encodings.cpp
uint8 is_bigendian # is this data bigendian?
uint32 step # Full row length in bytes
uint8[] data # actual matrix data, size is (step * rows)
================================================================================
MSG: objdetect_msgs/Grid
# Specifies a w,h,x,y dense grid
# The starting points for the location search
uint32 minX
uint32 minY
# The strides in the location space
uint32 strideX
uint32 strideY
# The starting points for the scaling
uint32 minW
uint32 minH
# The strides in the w, h space. In this case, we step by growing by a
# fraction, so that width_i is round(minWidth*strideW^i)
float64 strideW
float64 strideH
# True if the width and height should be a consistent aspect ratio that are
# defined by minW and minH. This reduces the grid to (s,x,y)
bool fixAspect
================================================================================
MSG: sensor_msgs/MatND
# A message that contains an uncompressed n dimensional
# matrix. Designed to be compatible with the opencv n-dimensional
# matrix.
Header header
int32[] sizes # The size of each dimension in the matrix
string encoding # The data type see src/image_encodings.cpp
bool is_bigendian # Is the data bigendian?
uint8[] data # The actual data
"""
__slots__ = ['header','image','grid','mask']
_slot_types = ['std_msgs/Header','sensor_msgs/Image','objdetect_msgs/Grid','sensor_msgs/MatND']
def __init__(self, *args, **kwds):
"""
Constructor. Any message fields that are implicitly/explicitly
set to None will be assigned a default value. The recommend
use is keyword arguments as this is more robust to future message
changes. You cannot mix in-order arguments and keyword arguments.
The available fields are:
header,image,grid,mask
:param args: complete set of field values, in .msg order
:param kwds: use keyword arguments corresponding to message field names
to set specific fields.
"""
if args or kwds:
super(DetectObjectGrid, self).__init__(*args, **kwds)
#message fields cannot be None, assign default values for those that are
if self.header is None:
self.header = std_msgs.msg.Header()
if self.image is None:
self.image = sensor_msgs.msg.Image()
if self.grid is None:
self.grid = objdetect_msgs.msg.Grid()
if self.mask is None:
self.mask = sensor_msgs.msg.MatND()
else:
self.header = std_msgs.msg.Header()
self.image = sensor_msgs.msg.Image()
self.grid = objdetect_msgs.msg.Grid()
self.mask = sensor_msgs.msg.MatND()
def _get_types(self):
"""
internal API method
"""
return self._slot_types
def serialize(self, buff):
"""
serialize message into buffer
:param buff: buffer, ``StringIO``
"""
try:
_x = self
buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
_x = self.header.frame_id
length = len(_x)
if python3 or type(_x) == unicode:
_x = _x.encode('utf-8')
length = len(_x)
buff.write(struct.pack('<I%ss'%length, length, _x))
_x = self
buff.write(_struct_3I.pack(_x.image.header.seq, _x.image.header.stamp.secs, _x.image.header.stamp.nsecs))
_x = self.image.header.frame_id
length = len(_x)
if python3 or type(_x) == unicode:
_x = _x.encode('utf-8')
length = len(_x)
buff.write(struct.pack('<I%ss'%length, length, _x))
_x = self
buff.write(_struct_2I.pack(_x.image.height, _x.image.width))
_x = self.image.encoding
length = len(_x)
if python3 or type(_x) == unicode:
_x = _x.encode('utf-8')
length = len(_x)
buff.write(struct.pack('<I%ss'%length, length, _x))
_x = self
buff.write(_struct_BI.pack(_x.image.is_bigendian, _x.image.step))
_x = self.image.data
length = len(_x)
# - if encoded as a list instead, serialize as bytes instead of string
if type(_x) in [list, tuple]:
buff.write(struct.pack('<I%sB'%length, length, *_x))
else:
buff.write(struct.pack('<I%ss'%length, length, _x))
_x = self
buff.write(_struct_6I2dB3I.pack(_x.grid.minX, _x.grid.minY, _x.grid.strideX, _x.grid.strideY, _x.grid.minW, _x.grid.minH, _x.grid.strideW, _x.grid.strideH, _x.grid.fixAspect, _x.mask.header.seq, _x.mask.header.stamp.secs, _x.mask.header.stamp.nsecs))
_x = self.mask.header.frame_id
length = len(_x)
if python3 or type(_x) == unicode:
_x = _x.encode('utf-8')
length = len(_x)
buff.write(struct.pack('<I%ss'%length, length, _x))
length = len(self.mask.sizes)
buff.write(_struct_I.pack(length))
pattern = '<%si'%length
buff.write(struct.pack(pattern, *self.mask.sizes))
_x = self.mask.encoding
length = len(_x)
if python3 or type(_x) == unicode:
_x = _x.encode('utf-8')
length = len(_x)
buff.write(struct.pack('<I%ss'%length, length, _x))
buff.write(_struct_B.pack(self.mask.is_bigendian))
_x = self.mask.data
length = len(_x)
# - if encoded as a list instead, serialize as bytes instead of string
if type(_x) in [list, tuple]:
buff.write(struct.pack('<I%sB'%length, length, *_x))
else:
buff.write(struct.pack('<I%ss'%length, length, _x))
except struct.error as se: self._check_types(se)
except TypeError as te: self._check_types(te)
def deserialize(self, str):
"""
unpack serialized message in str into this message instance
:param str: byte array of serialized message, ``str``
"""
try:
if self.header is None:
self.header = std_msgs.msg.Header()
if self.image is None:
self.image = sensor_msgs.msg.Image()
if self.grid is None:
self.grid = objdetect_msgs.msg.Grid()
if self.mask is None:
self.mask = sensor_msgs.msg.MatND()
end = 0
_x = self
start = end
end += 12
(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
start = end
end += 4
(length,) = _struct_I.unpack(str[start:end])
start = end
end += length
if python3:
self.header.frame_id = str[start:end].decode('utf-8')
else:
self.header.frame_id = str[start:end]
_x = self
start = end
end += 12
(_x.image.header.seq, _x.image.header.stamp.secs, _x.image.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
start = end
end += 4
(length,) = _struct_I.unpack(str[start:end])
start = end
end += length
if python3:
self.image.header.frame_id = str[start:end].decode('utf-8')
else:
self.image.header.frame_id = str[start:end]
_x = self
start = end
end += 8
(_x.image.height, _x.image.width,) = _struct_2I.unpack(str[start:end])
start = end
end += 4
(length,) = _struct_I.unpack(str[start:end])
start = end
end += length
if python3:
self.image.encoding = str[start:end].decode('utf-8')
else:
self.image.encoding = str[start:end]
_x = self
start = end
end += 5
(_x.image.is_bigendian, _x.image.step,) = _struct_BI.unpack(str[start:end])
start = end
end += 4
(length,) = _struct_I.unpack(str[start:end])
start = end
end += length
if python3:
self.image.data = str[start:end].decode('utf-8')
else:
self.image.data = str[start:end]
_x = self
start = end
end += 53
(_x.grid.minX, _x.grid.minY, _x.grid.strideX, _x.grid.strideY, _x.grid.minW, _x.grid.minH, _x.grid.strideW, _x.grid.strideH, _x.grid.fixAspect, _x.mask.header.seq, _x.mask.header.stamp.secs, _x.mask.header.stamp.nsecs,) = _struct_6I2dB3I.unpack(str[start:end])
self.grid.fixAspect = bool(self.grid.fixAspect)
start = end
end += 4
(length,) = _struct_I.unpack(str[start:end])
start = end
end += length
if python3:
self.mask.header.frame_id = str[start:end].decode('utf-8')
else:
self.mask.header.frame_id = str[start:end]
start = end
end += 4
(length,) = _struct_I.unpack(str[start:end])
pattern = '<%si'%length
start = end
end += struct.calcsize(pattern)
self.mask.sizes = struct.unpack(pattern, str[start:end])
start = end
end += 4
(length,) = _struct_I.unpack(str[start:end])
start = end
end += length
if python3:
self.mask.encoding = str[start:end].decode('utf-8')
else:
self.mask.encoding = str[start:end]
start = end
end += 1
(self.mask.is_bigendian,) = _struct_B.unpack(str[start:end])
self.mask.is_bigendian = bool(self.mask.is_bigendian)
start = end
end += 4
(length,) = _struct_I.unpack(str[start:end])
start = end
end += length
if python3:
self.mask.data = str[start:end].decode('utf-8')
else:
self.mask.data = str[start:end]
return self
except struct.error as e:
raise genpy.DeserializationError(e) #most likely buffer underfill
def serialize_numpy(self, buff, numpy):
"""
serialize message with numpy array types into buffer
:param buff: buffer, ``StringIO``
:param numpy: numpy python module
"""
try:
_x = self
buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
_x = self.header.frame_id
length = len(_x)
if python3 or type(_x) == unicode:
_x = _x.encode('utf-8')
length = len(_x)
buff.write(struct.pack('<I%ss'%length, length, _x))
_x = self
buff.write(_struct_3I.pack(_x.image.header.seq, _x.image.header.stamp.secs, _x.image.header.stamp.nsecs))
_x = self.image.header.frame_id
length = len(_x)
if python3 or type(_x) == unicode:
_x = _x.encode('utf-8')
length = len(_x)
buff.write(struct.pack('<I%ss'%length, length, _x))
_x = self
buff.write(_struct_2I.pack(_x.image.height, _x.image.width))
_x = self.image.encoding
length = len(_x)
if python3 or type(_x) == unicode:
_x = _x.encode('utf-8')
length = len(_x)
buff.write(struct.pack('<I%ss'%length, length, _x))
_x = self
buff.write(_struct_BI.pack(_x.image.is_bigendian, _x.image.step))
_x = self.image.data
length = len(_x)
# - if encoded as a list instead, serialize as bytes instead of string
if type(_x) in [list, tuple]:
buff.write(struct.pack('<I%sB'%length, length, *_x))
else:
buff.write(struct.pack('<I%ss'%length, length, _x))
_x = self
buff.write(_struct_6I2dB3I.pack(_x.grid.minX, _x.grid.minY, _x.grid.strideX, _x.grid.strideY, _x.grid.minW, _x.grid.minH, _x.grid.strideW, _x.grid.strideH, _x.grid.fixAspect, _x.mask.header.seq, _x.mask.header.stamp.secs, _x.mask.header.stamp.nsecs))
_x = self.mask.header.frame_id
length = len(_x)
if python3 or type(_x) == unicode:
_x = _x.encode('utf-8')
length = len(_x)
buff.write(struct.pack('<I%ss'%length, length, _x))
length = len(self.mask.sizes)
buff.write(_struct_I.pack(length))
pattern = '<%si'%length
buff.write(self.mask.sizes.tostring())
_x = self.mask.encoding
length = len(_x)
if python3 or type(_x) == unicode:
_x = _x.encode('utf-8')
length = len(_x)
buff.write(struct.pack('<I%ss'%length, length, _x))
buff.write(_struct_B.pack(self.mask.is_bigendian))
_x = self.mask.data
length = len(_x)
# - if encoded as a list instead, serialize as bytes instead of string
if type(_x) in [list, tuple]:
buff.write(struct.pack('<I%sB'%length, length, *_x))
else:
buff.write(struct.pack('<I%ss'%length, length, _x))
except struct.error as se: self._check_types(se)
except TypeError as te: self._check_types(te)
def deserialize_numpy(self, str, numpy):
"""
unpack serialized message in str into this message instance using numpy for array types
:param str: byte array of serialized message, ``str``
:param numpy: numpy python module
"""
try:
if self.header is None:
self.header = std_msgs.msg.Header()
if self.image is None:
self.image = sensor_msgs.msg.Image()
if self.grid is None:
self.grid = objdetect_msgs.msg.Grid()
if self.mask is None:
self.mask = sensor_msgs.msg.MatND()
end = 0
_x = self
start = end
end += 12
(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
start = end
end += 4
(length,) = _struct_I.unpack(str[start:end])
start = end
end += length
if python3:
self.header.frame_id = str[start:end].decode('utf-8')
else:
self.header.frame_id = str[start:end]
_x = self
start = end
end += 12
(_x.image.header.seq, _x.image.header.stamp.secs, _x.image.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
start = end
end += 4
(length,) = _struct_I.unpack(str[start:end])
start = end
end += length
if python3:
self.image.header.frame_id = str[start:end].decode('utf-8')
else:
self.image.header.frame_id = str[start:end]
_x = self
start = end
end += 8
(_x.image.height, _x.image.width,) = _struct_2I.unpack(str[start:end])
start = end
end += 4
(length,) = _struct_I.unpack(str[start:end])
start = end
end += length
if python3:
self.image.encoding = str[start:end].decode('utf-8')
else:
self.image.encoding = str[start:end]
_x = self
start = end
end += 5
(_x.image.is_bigendian, _x.image.step,) = _struct_BI.unpack(str[start:end])
start = end
end += 4
(length,) = _struct_I.unpack(str[start:end])
start = end
end += length
if python3:
self.image.data = str[start:end].decode('utf-8')
else:
self.image.data = str[start:end]
_x = self
start = end
end += 53
(_x.grid.minX, _x.grid.minY, _x.grid.strideX, _x.grid.strideY, _x.grid.minW, _x.grid.minH, _x.grid.strideW, _x.grid.strideH, _x.grid.fixAspect, _x.mask.header.seq, _x.mask.header.stamp.secs, _x.mask.header.stamp.nsecs,) = _struct_6I2dB3I.unpack(str[start:end])
self.grid.fixAspect = bool(self.grid.fixAspect)
start = end
end += 4
(length,) = _struct_I.unpack(str[start:end])
start = end
end += length
if python3:
self.mask.header.frame_id = str[start:end].decode('utf-8')
else:
self.mask.header.frame_id = str[start:end]
start = end
end += 4
(length,) = _struct_I.unpack(str[start:end])
pattern = '<%si'%length
start = end
end += struct.calcsize(pattern)
self.mask.sizes = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length)
start = end
end += 4
(length,) = _struct_I.unpack(str[start:end])
start = end
end += length
if python3:
self.mask.encoding = str[start:end].decode('utf-8')
else:
self.mask.encoding = str[start:end]
start = end
end += 1
(self.mask.is_bigendian,) = _struct_B.unpack(str[start:end])
self.mask.is_bigendian = bool(self.mask.is_bigendian)
start = end
end += 4
(length,) = _struct_I.unpack(str[start:end])
start = end
end += length
if python3:
self.mask.data = str[start:end].decode('utf-8')
else:
self.mask.data = str[start:end]
return self
except struct.error as e:
raise genpy.DeserializationError(e) #most likely buffer underfill
_struct_I = genpy.struct_I
_struct_6I2dB3I = struct.Struct("<6I2dB3I")
_struct_3I = struct.Struct("<3I")
_struct_B = struct.Struct("<B")
_struct_2I = struct.Struct("<2I")
_struct_BI = struct.Struct("<BI")
| 35.535714 | 266 | 0.619043 | 2,695 | 18,905 | 4.193321 | 0.123562 | 0.072206 | 0.056455 | 0.04212 | 0.680648 | 0.674631 | 0.654544 | 0.654544 | 0.647642 | 0.638616 | 0 | 0.012871 | 0.243798 | 18,905 | 531 | 267 | 35.602637 | 0.77763 | 0.078445 | 0 | 0.768053 | 1 | 0.002188 | 0.227191 | 0.029427 | 0 | 0 | 0.000579 | 0 | 0 | 1 | 0.013129 | false | 0 | 0.013129 | 0 | 0.04814 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
1fa4029c056f638f13a82b7db5dacee77627abdb | 188 | py | Python | settings.py | speedbur/logVmTraffic | 398d03bbb3823b2451846995e96dc9b7fa669070 | [
"MIT"
] | null | null | null | settings.py | speedbur/logVmTraffic | 398d03bbb3823b2451846995e96dc9b7fa669070 | [
"MIT"
] | 1 | 2017-10-03T06:45:07.000Z | 2017-10-03T06:45:07.000Z | settings.py | speedbur/logVmTraffic | 398d03bbb3823b2451846995e96dc9b7fa669070 | [
"MIT"
] | null | null | null | import os
def _database_path():
path = os.path.dirname(os.path.realpath(__file__))
path = os.path.join(path, "logvmtraffic.db")
return path
DATABASE_PATH = _database_path()
| 18.8 | 54 | 0.707447 | 26 | 188 | 4.769231 | 0.461538 | 0.290323 | 0.16129 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.164894 | 188 | 9 | 55 | 20.888889 | 0.789809 | 0 | 0 | 0 | 0 | 0 | 0.079787 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.166667 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
1fbd2502e378de177cc067e0cc80838d7e794fcb | 155 | py | Python | src/alumnos/urls.py | ElDwarf/django-examples | 94b6115d518af34dc65d57d5b066cfcebc1d1da1 | [
"MIT"
] | null | null | null | src/alumnos/urls.py | ElDwarf/django-examples | 94b6115d518af34dc65d57d5b066cfcebc1d1da1 | [
"MIT"
] | null | null | null | src/alumnos/urls.py | ElDwarf/django-examples | 94b6115d518af34dc65d57d5b066cfcebc1d1da1 | [
"MIT"
] | 1 | 2021-12-23T21:15:14.000Z | 2021-12-23T21:15:14.000Z | from django.urls import path
from .views import get_alumnos, alumno
urlpatterns = [
path('', get_alumnos),
path('<int:id_alumno>', alumno),
]
| 15.5 | 38 | 0.670968 | 20 | 155 | 5.05 | 0.6 | 0.19802 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.193548 | 155 | 9 | 39 | 17.222222 | 0.808 | 0 | 0 | 0 | 0 | 0 | 0.096774 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
1ffa850e25e70fcedb3b5db7f94a5d076452db81 | 59 | py | Python | elmo/moon_tracker/__init__.py | stephenswat/eve_lunar_mining_organiser | 2f6e84b0a9fc60588ca9bdc2ffd074be7fbf0b12 | [
"MIT"
] | 1 | 2017-09-20T09:15:14.000Z | 2017-09-20T09:15:14.000Z | elmo/moon_tracker/__init__.py | stephenswat/eve_lunar_mining_organiser | 2f6e84b0a9fc60588ca9bdc2ffd074be7fbf0b12 | [
"MIT"
] | 2 | 2021-08-19T13:26:04.000Z | 2021-08-19T13:26:08.000Z | elmo/moon_tracker/__init__.py | stephenswat/eve_lunar_mining_organiser | 2f6e84b0a9fc60588ca9bdc2ffd074be7fbf0b12 | [
"MIT"
] | 2 | 2017-10-09T20:15:03.000Z | 2018-02-03T15:54:53.000Z | default_app_config = 'moon_tracker.apps.MoonTrackerConfig'
| 29.5 | 58 | 0.864407 | 7 | 59 | 6.857143 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.050847 | 59 | 1 | 59 | 59 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0.59322 | 0.59322 | 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 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
950efd1e2f61a819dc5f6ff172161a140065cd5c | 35,817 | py | Python | pysnmp-with-texts/Wellfleet-IPEX-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/Wellfleet-IPEX-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/Wellfleet-IPEX-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 Wellfleet-IPEX-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-IPEX-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:40:34 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint, ConstraintsIntersection, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ConstraintsUnion")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Unsigned32, NotificationType, ObjectIdentity, IpAddress, Counter64, Gauge32, Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, Bits, Integer32, ModuleIdentity, iso, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "NotificationType", "ObjectIdentity", "IpAddress", "Counter64", "Gauge32", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "Bits", "Integer32", "ModuleIdentity", "iso", "MibIdentifier")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
wfIpexGroup, = mibBuilder.importSymbols("Wellfleet-COMMON-MIB", "wfIpexGroup")
wfIpex = MibIdentifier((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1))
wfIpexDelete = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("created", 1), ("deleted", 2))).clone('created')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexDelete.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexDelete.setDescription('Create/Delete parameter. Default is created. Users perform an SNMP SET operation on this object in order to create/delete IPEX.')
wfIpexDisable = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('enabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexDisable.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexDisable.setDescription('Enable/Disable parameter. Default is enabled. Users perform an SNMP SET operation on this object in order to enable/disable IPEX.')
wfIpexState = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("init", 3), ("notpresent", 4))).clone('down')).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexState.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexState.setDescription('The current state of IPEX.')
wfIpexMaxMessageSize = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(16, 4096)).clone(1600)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMaxMessageSize.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMaxMessageSize.setDescription('The maximum client message size that IPEX accepts. The size is in bytes.')
wfIpexInsCalledDte = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexInsCalledDte.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexInsCalledDte.setDescription('Enable/Disable parameter. Default is disabled. Users perform an SNMP SET operation on this object in order to enable/disable the support for inserting Called DTE address.')
wfIpexInsCallingDte = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexInsCallingDte.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexInsCallingDte.setDescription('Enable/disable the support for transmitting the calling DTE address over TCP tunnel. This changes the IPEX control message header format and hence this attribute should be enabled (only for 11.02 or up) on both ends (local & remote routers) for proper operation. This attribute applies only to End_to_End mode.')
wfIpexTcpRequestLimit = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1000)).clone(25)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexTcpRequestLimit.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexTcpRequestLimit.setDescription('The maximum number of TCP requests IPEX can have pending with TCP. Any addition requests will be queued until the number of pending requests fall below the limit.')
wfIpexTcpRequestCheck = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 30000)).clone(1000)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexTcpRequestCheck.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexTcpRequestCheck.setDescription('When IPEX has queued TCP requests, the time period (in milliseconds) between checking if the number of pending TCP requests have fallen below wfIpexTcpRequestLimit.')
wfIpexSendResetRequestOnTCPUp = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 9), Integer32().clone(9)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexSendResetRequestOnTCPUp.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSendResetRequestOnTCPUp.setDescription('Default(cause code) is 0x09 and PVC_TCP sends out the Reset Request with the cause code = 0x09 and TCP_PVC Router does not send the Reset Request when TCP is up. If the value is changed from the default cause code(0x09) then IPEX Gateway will send out the Reset Request with this value when network is operational. TCP_PVC will also send the Reset Request with this cause code when TCP connection is up.')
wfIpexTranslateNetworkOutOfOrder = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 10), Integer32().clone(29)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexTranslateNetworkOutOfOrder.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexTranslateNetworkOutOfOrder.setDescription('Default is 0x1d(29): Network out of order. If the value is changed from the default cause code = 0x1d then the IPEX Gateway will send the Reset Request with cause code specified when the network is out of order.')
wfIpexTcpUseIpAddress = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexTcpUseIpAddress.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexTcpUseIpAddress.setDescription('Enable/Disable parameter. Default is disabled. If set to Enabled, the IP address used for a TCP connection will be the coresponding address for the circuit.')
wfIpexBobEnabled = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexBobEnabled.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexBobEnabled.setDescription('This attribute will indicate whether IPEX supports Bank Of Bahrain enhancement. If it is enabled, only calling DTE will be send in ASCII format in user defined area of message header, if header type is full.')
wfIpexBobTimeout = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 30000)).clone(15000)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexBobTimeout.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexBobTimeout.setDescription('This attribute will indicate the timeout in milliseconds, after which DEVICE UP message is to be send to BOB mainserver from router, as long as this service supports BOB functionality.')
wfIpexMaxAuditIp = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 14), Integer32().clone(25)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMaxAuditIp.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMaxAuditIp.setDescription("Default is 25. Specify the maximum of IP address and TCP port pairs that IPEX Audit gate can hold in its internal table when IPEX PVC-TCP Gateway is in TCP Retry Mode. Audit gate puts new ip address and TCP port pair to the internal table when it tries TCP connection. IPEX Audit gate will be re-trying TCP connections until the table is filled up. Once it is full then it won't re-try new TCP connections. Setting zero causes IPEX audit gate to try TCP connections without examining the IP address and TCP port pairs had already tried out or not.")
wfIpexSessionInstanceIdOffsetForSvc = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 15), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexSessionInstanceIdOffsetForSvc.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionInstanceIdOffsetForSvc.setDescription('Default is 0. Specify the offset value for wfIpexSessionEntry when instances for SVC are created. For example, when it is set to 1023, instance ID for wfIpexSessionEntry for SVC connections will be wfIpexSessionEntry.*.3.1024 and the next one will be wfIpexSessionEntry.*.3.1025 and so on. This MIB object is introduced not to assign same instance ID to PVC and SVC when SVCs and PVCs are configured with single circuit. Because wfIpexSessionEntry for PVCs are based on the LCNs and the ones for SVCs are based on the order of each SVC being created, there would be the cases that same instance IDs are assigned to both SVC and PVC and it will cause the router to fault. It needs to be set to the value which is greater than the maximum LCN of the PVC connections when PVCs and SVCs co-exist on a single circuit.')
wfIpexMappingTable = MibTable((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2), )
if mibBuilder.loadTexts: wfIpexMappingTable.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingTable.setDescription('A table which contains the list of mappings between TCP connections and X.25 connections. This is the configuration table in which each entry sets up the association between a TCP port number and a X.25 DTE address or connection. inst_id[] = wfIpexMappingSrcConnCct wfIpexMappingSrcConnType wfIpexMappingID')
wfIpexMappingEntry = MibTableRow((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1), ).setIndexNames((0, "Wellfleet-IPEX-MIB", "wfIpexMappingSrcConnCct"), (0, "Wellfleet-IPEX-MIB", "wfIpexMappingSrcConnType"), (0, "Wellfleet-IPEX-MIB", "wfIpexMappingID1"), (0, "Wellfleet-IPEX-MIB", "wfIpexMappingID2"))
if mibBuilder.loadTexts: wfIpexMappingEntry.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingEntry.setDescription('An entry in wfIpexMappingTable.')
wfIpexMappingDelete = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("created", 1), ("deleted", 2))).clone('created')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingDelete.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingDelete.setDescription('Create/Delete attribute. Default is created. Users perform an SNMP SET operation on this object in order to create/delete a translation mapping record.')
wfIpexMappingDisable = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('enabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingDisable.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingDisable.setDescription('Enables or Disables this Mapping entry. Setting this attribute to DISABLED will disconnect all active Sessions pertaining to this Mapping entry')
wfIpexMappingSrcConnCct = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexMappingSrcConnCct.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingSrcConnCct.setDescription('The circuit from which the connection attempt is received that initiates a translation session.')
wfIpexMappingSrcConnType = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 4, 8, 16))).clone(namedValues=NamedValues(("pvc", 1), ("svc", 2), ("dcesvc", 4), ("lapb", 8), ("tcp", 16)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexMappingSrcConnType.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingSrcConnType.setDescription('Defines the type of original connection attempt. Whether it is a PVC, SVC, DCE_SVC, LAPB or TCP')
wfIpexMappingID1 = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexMappingID1.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingID1.setDescription('The translation mapping identifier which identifies the remote connection of the translation session. This is an identifier that is available from the incoming connection attempt. The meaning of this object (wfIpexMappingID1) and the next object (wfIpexMappingID2) is dependent on the value of wfIpexMappingSrcConnType. SrcConnType ID1 ID2 --------------------------------------------------- pvc(1) LCN value 0 (Null) svc(2) 0 Called X.121 Address dcesvc(4) 0 0 (Null) lapb(8) 0 0 (Null) tcp(16) Port Number 0 (Null) ')
wfIpexMappingID2 = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 6), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexMappingID2.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingID2.setDescription('(See description for wfIpexMappingID1 above)')
wfIpexMappingDstConnCct = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 7), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingDstConnCct.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingDstConnCct.setDescription('The circuit from which the connection to the destination is to be established to set up a translation session.')
wfIpexMappingDstConnType = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 4, 8, 16))).clone(namedValues=NamedValues(("pvc", 1), ("svc", 2), ("dcesvc", 4), ("lapb", 8), ("tcp", 16))).clone('pvc')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingDstConnType.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingDstConnType.setDescription('Defines type of connection at the destination end. Whether it is a PVC, SVC, DCE_SVC, LAPB or TCP')
wfIpexMappingLocalDTEAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 9), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingLocalDTEAddr.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingLocalDTEAddr.setDescription('The Local DTE address (identifies the X.121 address of the X.25 interface on the IPEX). This attribute is only used in the case of a SVC connection initiated from the IPEX to the terminal')
wfIpexMappingRemoteDTEAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 10), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingRemoteDTEAddr.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingRemoteDTEAddr.setDescription('The Remote DTE address (identifies the X.121 address of the X.25 interface on the terminal). This attribute is only used in the case of a SVC connection initiated from the IPEX to the terminal')
wfIpexMappingPvcLcn = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 4095)).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingPvcLcn.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingPvcLcn.setDescription('The LCN of the PVC connection from the IPEX to the terminal (identifies the channel to be used to reset the PVC connection. This attribute * is only used in the case of a PVC connection initiated from the IPEX to the terminal')
wfIpexMappingRemoteIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 12), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingRemoteIpAddr.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingRemoteIpAddr.setDescription('The IP address of the remote host with which this translation session is established. This attribute is only used in the case of a TCP connection initiated from the IPEX to a host')
wfIpexMappingRemoteTcpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 13), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingRemoteTcpPort.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingRemoteTcpPort.setDescription('The remote TCP port number in the host to be used to establish a TCP connection from the IPEX to the host server. This attribute is only used in the case of a TCP connection initiated from the IPEX to a host')
wfIpexMappingQueueSize = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(16, 8192)).clone(8192)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingQueueSize.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingQueueSize.setDescription('The size of the IPEX queues used for transfering data between TCP and X.25. The size is in bytes.')
wfIpexMappingSlotNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 13))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingSlotNumber.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingSlotNumber.setDescription('The slot of the access (X.25 or LAPB) circuit on which the X.25 or LAPB connections will be established.')
wfIpexMappingCtrlMode = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 16), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("local", 1), ("end2end", 2), ("gateway", 3))).clone('end2end')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingCtrlMode.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingCtrlMode.setDescription('Local mode configuration terminates X.25 at the router interface. The end2end mode configuration allows X.25 signalling and data to operate between two remote X.25 networks, using the router to translate both call control and data over a TCP/IP network. The gateway mode terminates X.25 at the router interface, but allows the user to configure 3 message header types at the TCP application layer. These header values are described in wfIpexMappingMsgHdrType.')
wfIpexMappingX25CUDF = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 17), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingX25CUDF.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingX25CUDF.setDescription('The X.25 Call User Data field (CUDF) in a X.25 Call Request packet header. This attribute is only used in the case of a SVC connection initiated from the IPEX to the terminal. It is used as the network layer protocol identifier of the X.25 connection.')
wfIpexMappingIdleTimer = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 18), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 86400)).clone(120)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingIdleTimer.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingIdleTimer.setDescription('Idle session timeout period, in seconds. If an established TCP connection remains inactive for this interval, KEEPALIVE messages will be sent to the peer (if the Keepalive Timer is non-zero). Setting the Idle Timer to zero disables the keepalive feature.')
wfIpexMappingKeepaliveTimer = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 19), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 600)).clone(3)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingKeepaliveTimer.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingKeepaliveTimer.setDescription('KEEPALIVE retransmit timeout period, in seconds. This is the interval at which unacknowledged KEEPALIVE messages will be retransmitted. If the Idle Timer is set to zero, this timer ignored. If the Idle Timer is non-zero and this timer IS zero, no KEEPALIVEs are sent and the session is terminated upon expiration of the Idle Timer.')
wfIpexMappingKeepaliveRetries = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 20), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 99)).clone(5)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingKeepaliveRetries.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingKeepaliveRetries.setDescription('Number of unacknowledged KEEPALIVE messages retransmitted before the TCP session is terminated. If this count is set to zero, only one KEEPALIVE message will be sent.')
wfIpexMappingTrace = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 21), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingTrace.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingTrace.setDescription('This object is a bitmask, setting the low order bit enables tracing of IPEX internal events. Setting other individual bit postions disable logging of internal IPEX events. Values may be added together to disable multiple message groups. Hex Dec Value Value Message/Event --------------------------------------------------------- 0x0001 1 Enable IPEX tracing. 0x0002 2 Data packets from IPEX to X.25. 0x0004 4 Data packets from X.25 to IPEX. 0x0008 8 Window updates from X.25. 0x0010 16 Data from TCP to IPEX. 0x0020 32 Window updates from TCP. 0x0040 64 Window requests from TCP.')
wfIpexMappingMsgHdrType = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 22), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("none", 1), ("short", 2), ("long", 3), ("full", 4))).clone('full')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingMsgHdrType.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingMsgHdrType.setDescription('This attribute enables the Message Boundary Protocol. When enabled, this bit is used to mark the boundary of TCP application data that is consistent with Gateway Operation. The first three message header types are used only with wfIpexMappingCtlMode in gateway mode. The default value is used with wfIpexMappingCtlMode in the local or end2end mode of operation. NONE = Msg Boundary Protocol is off, no msg header. SHORT = Msg header condtains a 2-Byte length field. LONG = Msg header contains a 1-Byte type, 1-Byte version, and a 2-Byte length fields. FULL = Msg Header contains a 2-Byte length1 field, 1-Byte Version field, 1-Byte Type field and, a 1-Byte length2 field')
wfIpexMappingRemoteBackupIp = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 23), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingRemoteBackupIp.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingRemoteBackupIp.setDescription('The IP address of the remote host with which this translation session is established. This attribute is only used in the case of a TCP connection with the primary remote IP address (wfIpexMappingRemoteIpAddr) failed.')
wfIpexMappingXlateCallingX121 = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 24), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingXlateCallingX121.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingXlateCallingX121.setDescription('If this attribute is configured then insert this X.121 addr as the calling addr in the Call request pkt.')
wfIpexMappingTcpMaxRetry = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 25), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 16384))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingTcpMaxRetry.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingTcpMaxRetry.setDescription('The maximum number of attempts that PVC-TCP will make to re-establish the connection to the remote peer. The TCP Retry takes place every 15 seconds hence default setting will perform the TCP Retry forever.')
wfIpexMappingCfgLocalIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 26), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingCfgLocalIpAddr.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingCfgLocalIpAddr.setDescription('The IP address on the router to use as the source of the TCP session. This attribute is only used in the case of a TCP connection initiated from the IPEX to a host')
wfIpexMappingRemoteBackupTcpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 27), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingRemoteBackupTcpPort.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingRemoteBackupTcpPort.setDescription('The TCP port of the remote host with which this translation session is established. This attribute is only used in the case of a TCP connection with the primary remote IP address (wfIpexMappingRemoteIpAddr) failed.')
wfIpexSessionTable = MibTable((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3), )
if mibBuilder.loadTexts: wfIpexSessionTable.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionTable.setDescription('A table that contains the information about the current active IPEX translation sessions. The status and statistics information related to each translation session is provided here. inst_id[] = wfIpexSessionIndex')
wfIpexSessionEntry = MibTableRow((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1), ).setIndexNames((0, "Wellfleet-IPEX-MIB", "wfIpexSessionSrcConnCct"), (0, "Wellfleet-IPEX-MIB", "wfIpexSessionIndex"))
if mibBuilder.loadTexts: wfIpexSessionEntry.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionEntry.setDescription('An entry in wfIpexSession.')
wfIpexSessionState = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("x25up", 1), ("tcpup", 2), ("ccestab", 3), ("notconn", 4), ("lapbup", 5))).clone('notconn')).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionState.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionState.setDescription('The IPEX state of this translation session. These are the steady states of the IPEX state machine. Transition states are not reflected.')
wfIpexSessionSrcConnCct = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionSrcConnCct.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionSrcConnCct.setDescription('The circuit from which the original connection attempt is received that initiated a translation session.')
wfIpexSessionIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionIndex.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionIndex.setDescription('The index of this translation session')
wfIpexSessionSrcConnType = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 4, 8, 16))).clone(namedValues=NamedValues(("pvc", 1), ("svc", 2), ("dcesvc", 4), ("lapb", 8), ("tcp", 16)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionSrcConnType.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionSrcConnType.setDescription('Defines type of original connection attempt. Whether it is a PVC, SVC, DCE_SVC, LAPB or TCP')
wfIpexSessionDstConnCct = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionDstConnCct.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionDstConnCct.setDescription('The circuit from which the connection at the destination to be established to set up a translation session.')
wfIpexSessionDstConnType = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 4, 8, 16))).clone(namedValues=NamedValues(("pvc", 1), ("svc", 2), ("dcesvc", 4), ("lapb", 8), ("tcp", 16))).clone('pvc')).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionDstConnType.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionDstConnType.setDescription('Defines type of connection at the destination end. Whether it is a PVC, SVC, DCE_SVC, LAPB or TCP')
wfIpexSessionLocalDTEAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 7), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionLocalDTEAddr.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionLocalDTEAddr.setDescription('The Local DTE address (identifies the X.121 address of the X.25 interface on the IPEX). This attribute is only used in the case of a SVC connection initiated from the IPEX to the terminal')
wfIpexSessionRemoteDTEAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 8), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionRemoteDTEAddr.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionRemoteDTEAddr.setDescription('The Remote DTE address (identifies the X.121 address of the X.25 interface on the terminal). This attribute is only used in the case of a SVC connection initiated from the IPEX to the terminal')
wfIpexSessionLCN = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255)).clone(1)).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionLCN.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionLCN.setDescription('The LCN of the PVC (identifies the channel to be used to establish a PVC connection from the IPEX to the terminal')
wfIpexSessionLocalIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 10), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionLocalIpAddr.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionLocalIpAddr.setDescription('The IP address of an interface on the IPEX to be used to establish a TCP connection with the host server. This attribute is only used in the case of a TCP connection initiated from the IPEX to a host')
wfIpexSessionLocalTcpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 11), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionLocalTcpPort.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionLocalTcpPort.setDescription('The local TCP port number in the IPEX to be used to establish a TCP connection to the host server This attribute is only used in the case of a TCP connection initiated from the IPEX to a host')
wfIpexSessionRemoteIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 12), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionRemoteIpAddr.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionRemoteIpAddr.setDescription('The IP address of the remote host with which this translation session is established. This attribute is only used in the case of a TCP connection initiated from the IPEX to a host')
wfIpexSessionRemoteTcpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 13), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionRemoteTcpPort.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionRemoteTcpPort.setDescription('The remote TCP port number in the host to be used to establish a TCP connection from the IPEX to the host server. This attribute is only used in the case of a TCP connection initiated from the IPEX to a host')
wfIpexSessionQueueSize = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 14), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionQueueSize.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionQueueSize.setDescription('The size of the IPEX queues used for transfering data between IPEX and TCP. The size is in bytes.')
mibBuilder.exportSymbols("Wellfleet-IPEX-MIB", wfIpexSessionInstanceIdOffsetForSvc=wfIpexSessionInstanceIdOffsetForSvc, wfIpexMappingLocalDTEAddr=wfIpexMappingLocalDTEAddr, wfIpexSessionEntry=wfIpexSessionEntry, wfIpexMappingXlateCallingX121=wfIpexMappingXlateCallingX121, wfIpexMappingDisable=wfIpexMappingDisable, wfIpexMappingQueueSize=wfIpexMappingQueueSize, wfIpexMappingMsgHdrType=wfIpexMappingMsgHdrType, wfIpexMappingDstConnCct=wfIpexMappingDstConnCct, wfIpexSessionRemoteTcpPort=wfIpexSessionRemoteTcpPort, wfIpexBobEnabled=wfIpexBobEnabled, wfIpexDelete=wfIpexDelete, wfIpexMappingCfgLocalIpAddr=wfIpexMappingCfgLocalIpAddr, wfIpexMappingX25CUDF=wfIpexMappingX25CUDF, wfIpexSessionState=wfIpexSessionState, wfIpexTcpUseIpAddress=wfIpexTcpUseIpAddress, wfIpexMappingID2=wfIpexMappingID2, wfIpexMappingID1=wfIpexMappingID1, wfIpexSessionSrcConnCct=wfIpexSessionSrcConnCct, wfIpexMappingSlotNumber=wfIpexMappingSlotNumber, wfIpexDisable=wfIpexDisable, wfIpexSessionDstConnCct=wfIpexSessionDstConnCct, wfIpexInsCalledDte=wfIpexInsCalledDte, wfIpexMappingRemoteBackupIp=wfIpexMappingRemoteBackupIp, wfIpexMappingKeepaliveTimer=wfIpexMappingKeepaliveTimer, wfIpexMaxAuditIp=wfIpexMaxAuditIp, wfIpexMappingTable=wfIpexMappingTable, wfIpexSessionSrcConnType=wfIpexSessionSrcConnType, wfIpexMappingKeepaliveRetries=wfIpexMappingKeepaliveRetries, wfIpexSessionTable=wfIpexSessionTable, wfIpexSessionLocalIpAddr=wfIpexSessionLocalIpAddr, wfIpexMappingDstConnType=wfIpexMappingDstConnType, wfIpexMappingTcpMaxRetry=wfIpexMappingTcpMaxRetry, wfIpexInsCallingDte=wfIpexInsCallingDte, wfIpexSendResetRequestOnTCPUp=wfIpexSendResetRequestOnTCPUp, wfIpexSessionDstConnType=wfIpexSessionDstConnType, wfIpexMappingRemoteBackupTcpPort=wfIpexMappingRemoteBackupTcpPort, wfIpexTcpRequestCheck=wfIpexTcpRequestCheck, wfIpexState=wfIpexState, wfIpex=wfIpex, wfIpexMappingSrcConnType=wfIpexMappingSrcConnType, wfIpexMappingIdleTimer=wfIpexMappingIdleTimer, wfIpexSessionIndex=wfIpexSessionIndex, wfIpexSessionLocalDTEAddr=wfIpexSessionLocalDTEAddr, wfIpexSessionRemoteIpAddr=wfIpexSessionRemoteIpAddr, wfIpexTcpRequestLimit=wfIpexTcpRequestLimit, wfIpexMappingRemoteIpAddr=wfIpexMappingRemoteIpAddr, wfIpexSessionLocalTcpPort=wfIpexSessionLocalTcpPort, wfIpexMappingCtrlMode=wfIpexMappingCtrlMode, wfIpexMappingRemoteTcpPort=wfIpexMappingRemoteTcpPort, wfIpexSessionQueueSize=wfIpexSessionQueueSize, wfIpexMappingSrcConnCct=wfIpexMappingSrcConnCct, wfIpexTranslateNetworkOutOfOrder=wfIpexTranslateNetworkOutOfOrder, wfIpexMappingRemoteDTEAddr=wfIpexMappingRemoteDTEAddr, wfIpexMappingTrace=wfIpexMappingTrace, wfIpexSessionRemoteDTEAddr=wfIpexSessionRemoteDTEAddr, wfIpexMappingEntry=wfIpexMappingEntry, wfIpexMappingPvcLcn=wfIpexMappingPvcLcn, wfIpexBobTimeout=wfIpexBobTimeout, wfIpexSessionLCN=wfIpexSessionLCN, wfIpexMaxMessageSize=wfIpexMaxMessageSize, wfIpexMappingDelete=wfIpexMappingDelete)
| 181.812183 | 2,883 | 0.789904 | 4,550 | 35,817 | 6.215604 | 0.126813 | 0.050918 | 0.089106 | 0.008628 | 0.484177 | 0.330116 | 0.286517 | 0.265868 | 0.250168 | 0.244758 | 0 | 0.046547 | 0.102074 | 35,817 | 196 | 2,884 | 182.739796 | 0.83281 | 0.009214 | 0 | 0 | 0 | 0.259259 | 0.404645 | 0.012628 | 0 | 0 | 0.001748 | 0 | 0 | 1 | 0 | false | 0 | 0.037037 | 0 | 0.037037 | 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 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
95312d21ddfa53380884fc05ce379b88b892970b | 180 | py | Python | src/main.py | IvanKosik/med-3d-segmentation | ff3c4229c9d7bd3e9fb15fb856d0bd28ecc1eda3 | [
"BSD-3-Clause"
] | 1 | 2022-03-01T12:32:30.000Z | 2022-03-01T12:32:30.000Z | src/main.py | IvanKosik/med-3d-segmentation | ff3c4229c9d7bd3e9fb15fb856d0bd28ecc1eda3 | [
"BSD-3-Clause"
] | null | null | null | src/main.py | IvanKosik/med-3d-segmentation | ff3c4229c9d7bd3e9fb15fb856d0bd28ecc1eda3 | [
"BSD-3-Clause"
] | null | null | null | from pathlib import Path
PROJECT_PATH = Path(__file__).parents[1]
DATA_PATH = PROJECT_PATH / 'data'
def main():
print('EMPTY MAIN')
if __name__ == '__main__':
main()
| 12.857143 | 40 | 0.672222 | 24 | 180 | 4.416667 | 0.625 | 0.207547 | 0.283019 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006897 | 0.194444 | 180 | 13 | 41 | 13.846154 | 0.724138 | 0 | 0 | 0 | 0 | 0 | 0.122222 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.142857 | 0 | 0.285714 | 0.142857 | 1 | 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 | 3 |
20ffcbafba0059596fc738d581d63e522668db6c | 118 | py | Python | hapapi/__init__.py | quanta-computing/hapapi | 31e2d5cb3327772896103b6f7eb4a0b5e956ca98 | [
"MIT"
] | 1 | 2016-09-14T17:59:57.000Z | 2016-09-14T17:59:57.000Z | hapapi/__init__.py | quanta-computing/hapapi | 31e2d5cb3327772896103b6f7eb4a0b5e956ca98 | [
"MIT"
] | null | null | null | hapapi/__init__.py | quanta-computing/hapapi | 31e2d5cb3327772896103b6f7eb4a0b5e956ca98 | [
"MIT"
] | null | null | null | """
Main entry points and resources for hapapi
"""
from flask import Flask
VERSION = '0.1.0'
app = Flask('hapapi')
| 11.8 | 42 | 0.677966 | 18 | 118 | 4.444444 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.03125 | 0.186441 | 118 | 9 | 43 | 13.111111 | 0.802083 | 0.355932 | 0 | 0 | 0 | 0 | 0.164179 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
1f326dd8add489b82ed78cdd4a8d2c0f93555161 | 5,294 | py | Python | cache_dependencies/transaction.py | Tusky/cache-dependencies | 6c19d0c2adfce19c3fdc53ad5704eddc6d84e106 | [
"BSD-3-Clause"
] | 3 | 2017-08-08T20:06:56.000Z | 2018-09-19T03:16:20.000Z | cache_dependencies/transaction.py | Tusky/cache-dependencies | 6c19d0c2adfce19c3fdc53ad5704eddc6d84e106 | [
"BSD-3-Clause"
] | 1 | 2017-10-24T23:11:32.000Z | 2017-10-24T23:11:32.000Z | cache_dependencies/transaction.py | Tusky/cache-dependencies | 6c19d0c2adfce19c3fdc53ad5704eddc6d84e106 | [
"BSD-3-Clause"
] | 8 | 2017-10-24T07:43:56.000Z | 2021-06-17T07:03:02.000Z | import time
from functools import wraps
from cache_dependencies import dependencies, interfaces, mixins, utils
from cache_dependencies.utils import Undef
class AbstractTransaction(interfaces.ITransaction):
def __init__(self, lock):
"""
:type lock: cache_dependencies.interfaces.IDependencyLock
"""
self._lock = lock
def get_session_id(self):
return utils.get_thread_id()
def evaluate(self, dependency, version):
"""
:type dependency: cache_dependencies.interfaces.IDependency
:type version: int or None
"""
return self._lock.evaluate(dependency, self, version)
@staticmethod
def _current_time():
return time.time()
class Transaction(AbstractTransaction):
def __init__(self, lock):
"""
:type lock: cache_dependencies.interfaces.IDependencyLock
"""
super(Transaction, self).__init__(lock)
self._dependencies = dict()
self._start_time = self._current_time()
self._end_time = None
def get_start_time(self):
return self._start_time
def get_end_time(self):
if self._end_time is None:
raise RuntimeError("Transaction is not finished yet!")
return self._end_time
def parent(self):
return None
def add_dependency(self, dependency, version):
"""
:type dependency: cache_dependencies.interfaces.IDependency
:type version: int or None
"""
assert isinstance(dependency, interfaces.IDependency)
if version not in self._dependencies:
self._dependencies[version] = dependencies.CompositeDependency()
self._dependencies[version].extend(dependency)
self._lock.acquire(dependency, self, version)
def finish(self):
self._end_time = self._current_time()
for version, dependency in self._dependencies.items():
self._lock.release(dependency, self, version)
def __bool__(self):
return True
class SavePoint(Transaction):
def __init__(self, lock, parent):
"""
:type lock: cache_dependencies.interfaces.IDependencyLock
:type parent: cache_dependencies.transaction.Transaction or cache_dependencies.transaction.SavePoint
"""
super(SavePoint, self).__init__(lock)
assert isinstance(parent, interfaces.ITransaction)
self._parent = parent
def get_start_time(self):
return self.parent().get_start_time()
def get_end_time(self):
return self.parent().get_end_time()
def parent(self):
return self._parent
def add_dependency(self, dependency, version):
"""
:type dependency: cache_dependencies.interfaces.IDependency
:type version: int or None
"""
assert isinstance(dependency, interfaces.IDependency)
super(SavePoint, self).add_dependency(dependency, version)
self._parent.add_dependency(dependency, version)
def finish(self):
pass
class DummyTransaction(AbstractTransaction):
def get_start_time(self):
return self._current_time()
def get_end_time(self):
return self._current_time()
def parent(self):
return None
def add_dependency(self, dependency, version):
"""
:type dependency: cache_dependencies.interfaces.IDependency
:type version: int or None
"""
assert isinstance(dependency, interfaces.IDependency)
def finish(self):
pass
def __bool__(self):
return False
class AbstractTransactionManager(interfaces.ITransactionManager):
def __call__(self, func=None):
if func is None:
return self
@wraps(func)
def _decorated(*args, **kw):
with self:
rv = func(*args, **kw)
return rv
return _decorated
def __enter__(self):
self.begin()
def __exit__(self, *args):
self.finish()
return False
class TransactionManager(AbstractTransactionManager):
def __init__(self, lock):
"""
:type lock: cache_dependencies.interfaces.IDependencyLock
"""
self._lock = lock
self._current = None
def current(self, node=Undef):
if node is Undef:
return self._current or DummyTransaction(self._lock)
self._current = node
def begin(self):
if self._current is None:
self.current(Transaction(self._lock))
else:
self.current(SavePoint(self._lock, self.current()))
return self.current()
def finish(self):
self.current().finish()
self.current(self.current().parent())
def flush(self):
while self._current:
self.finish()
class ThreadSafeTransactionManagerDecorator(mixins.ThreadSafeDecoratorMixIn, AbstractTransactionManager):
def current(self, node=Undef):
self._validate_thread_sharing()
return self._delegate.current(node)
def begin(self):
self._validate_thread_sharing()
return self._delegate.begin()
def finish(self):
self._validate_thread_sharing()
return self._delegate.finish()
def flush(self):
return self._delegate.flush()
| 27.010204 | 108 | 0.646392 | 550 | 5,294 | 5.969091 | 0.156364 | 0.05361 | 0.065793 | 0.027414 | 0.411209 | 0.384405 | 0.354858 | 0.301553 | 0.254036 | 0.254036 | 0 | 0 | 0.261806 | 5,294 | 195 | 109 | 27.148718 | 0.840072 | 0.128447 | 0 | 0.393162 | 0 | 0 | 0.007291 | 0 | 0 | 0 | 0 | 0 | 0.034188 | 1 | 0.307692 | false | 0.017094 | 0.034188 | 0.111111 | 0.606838 | 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 | 1 | 0 | 0 | 3 |
1f3e2e737f955162906cd90e8dbd5af1a9301bb2 | 348 | py | Python | misc/slack/slack_notification.py | gotitinc/code-samples | 78f4a42b7ea3826d84b91d7303c41da3458d75de | [
"Apache-2.0"
] | null | null | null | misc/slack/slack_notification.py | gotitinc/code-samples | 78f4a42b7ea3826d84b91d7303c41da3458d75de | [
"Apache-2.0"
] | null | null | null | misc/slack/slack_notification.py | gotitinc/code-samples | 78f4a42b7ea3826d84b91d7303c41da3458d75de | [
"Apache-2.0"
] | null | null | null | import json
import requests
from eventbus.queue_deferred import queue_deferred
def send_message(url, content):
queue_deferred(_send_message, url, content, _queue='default')
def _send_message(url, content):
if not url:
return
data = {
'text': content
}
return requests.post(url=url, data=json.dumps(data))
| 17.4 | 65 | 0.692529 | 45 | 348 | 5.155556 | 0.444444 | 0.168103 | 0.181034 | 0.271552 | 0.340517 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.212644 | 348 | 19 | 66 | 18.315789 | 0.846715 | 0 | 0 | 0 | 0 | 0 | 0.031609 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.25 | 0 | 0.583333 | 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 | 1 | 0 | 0 | 3 |
1f5b1f6c4af269d5558704b4466f5fb0cc613c0c | 199 | py | Python | server.py | PyEddy/login-system | ed314bcdd7532f6f2d5df7fd21926ae195d22396 | [
"Apache-2.0"
] | null | null | null | server.py | PyEddy/login-system | ed314bcdd7532f6f2d5df7fd21926ae195d22396 | [
"Apache-2.0"
] | null | null | null | server.py | PyEddy/login-system | ed314bcdd7532f6f2d5df7fd21926ae195d22396 | [
"Apache-2.0"
] | null | null | null | from login import username
from flask import Flask, render_template
app = Flask('Login_System')
@app.route('/')
def index():
return render_template('index.html', username=username)
app.run() | 16.583333 | 59 | 0.733668 | 27 | 199 | 5.296296 | 0.555556 | 0.195804 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.135678 | 199 | 12 | 60 | 16.583333 | 0.831395 | 0 | 0 | 0 | 0 | 0 | 0.115 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.285714 | 0.142857 | 0.571429 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
1f7928c3d5b6a9ddc42c4d6bd43291e210b94146 | 60 | py | Python | django_webdav_storage/__init__.py | m-thielen/django-webdav-storage | c40d2ba53f171e23684769c0b41f0d12da4c9a49 | [
"BSD-3-Clause"
] | null | null | null | django_webdav_storage/__init__.py | m-thielen/django-webdav-storage | c40d2ba53f171e23684769c0b41f0d12da4c9a49 | [
"BSD-3-Clause"
] | null | null | null | django_webdav_storage/__init__.py | m-thielen/django-webdav-storage | c40d2ba53f171e23684769c0b41f0d12da4c9a49 | [
"BSD-3-Clause"
] | null | null | null | from __future__ import unicode_literals
version = u'1.0.0'
| 15 | 39 | 0.783333 | 10 | 60 | 4.2 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.057692 | 0.133333 | 60 | 3 | 40 | 20 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0.083333 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
1f798f961dfffa33fb90852fa0a812e86a6e2539 | 439 | py | Python | backend/account/migrations/0016_auto_20210703_1559.py | skku-npc/SKKU_Coding_Platform | 1d972e8922484cf94f6735fd08b2565e5d3517d0 | [
"MIT"
] | 1 | 2022-03-30T14:03:23.000Z | 2022-03-30T14:03:23.000Z | backend/account/migrations/0016_auto_20210703_1559.py | skku-npc/SKKU_Coding_Platform | 1d972e8922484cf94f6735fd08b2565e5d3517d0 | [
"MIT"
] | 56 | 2022-02-19T08:13:48.000Z | 2022-03-25T10:17:07.000Z | backend/account/migrations/0016_auto_20210703_1559.py | skku-npc/SKKU_Coding_Platform | 1d972e8922484cf94f6735fd08b2565e5d3517d0 | [
"MIT"
] | 1 | 2022-03-25T15:02:46.000Z | 2022-03-25T15:02:46.000Z | # Generated by Django 2.2.24 on 2021-07-03 06:59
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('account', '0015_auto_20210703_1545'),
]
operations = [
migrations.RemoveField(
model_name='user',
name='open_api',
),
migrations.RemoveField(
model_name='user',
name='open_api_appkey',
),
]
| 19.954545 | 48 | 0.567198 | 45 | 439 | 5.355556 | 0.688889 | 0.174274 | 0.215768 | 0.248963 | 0.373444 | 0.373444 | 0.373444 | 0.373444 | 0 | 0 | 0 | 0.107383 | 0.321185 | 439 | 21 | 49 | 20.904762 | 0.701342 | 0.104784 | 0 | 0.4 | 1 | 0 | 0.15601 | 0.058824 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.066667 | 0 | 0.266667 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
1f93ff266b984e9720c701082dee07c45e9dbaf3 | 232 | py | Python | src/schema/orders.py | gabrielroot/pedidosDelivery | 52315d6e5db6dc2c8be9e523f7491d798ed07c5b | [
"MIT"
] | null | null | null | src/schema/orders.py | gabrielroot/pedidosDelivery | 52315d6e5db6dc2c8be9e523f7491d798ed07c5b | [
"MIT"
] | null | null | null | src/schema/orders.py | gabrielroot/pedidosDelivery | 52315d6e5db6dc2c8be9e523f7491d798ed07c5b | [
"MIT"
] | null | null | null | from src import ma
from src.models import Orders
class OrdersSchema(ma.Schema):
class Meta:
model = Orders
fields = ('id', 'flavorItem_id', 'client_id', 'quantity', 'observation', 'created_at', 'updated_at')
| 21.090909 | 108 | 0.663793 | 29 | 232 | 5.172414 | 0.689655 | 0.093333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.206897 | 232 | 10 | 109 | 23.2 | 0.815217 | 0 | 0 | 0 | 0 | 0 | 0.271552 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
2f1d7b748b8ae0d5d36a02fb458895667b2c02a9 | 260 | py | Python | setup.py | cloew/SmartDefaults | 1001d8058304807e3df53ae42ade65f0658358f6 | [
"MIT"
] | null | null | null | setup.py | cloew/SmartDefaults | 1001d8058304807e3df53ae42ade65f0658358f6 | [
"MIT"
] | null | null | null | setup.py | cloew/SmartDefaults | 1001d8058304807e3df53ae42ade65f0658358f6 | [
"MIT"
] | null | null | null | from distutils.core import setup
setup(name='smart_defaults',
version='0.0.1',
description="",
author='',
author_email='',
packages=['smart_defaults', 'smart_defaults.providers'],
install_requires=["kao_fn"]
) | 26 | 63 | 0.603846 | 27 | 260 | 5.592593 | 0.740741 | 0.258278 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015228 | 0.242308 | 260 | 10 | 64 | 26 | 0.751269 | 0 | 0 | 0 | 0 | 0 | 0.25 | 0.095238 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.111111 | 0 | 0.111111 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2f25d67e3299c4c72a3a797f0d24d171270d9bd7 | 1,955 | py | Python | metodoBloqueioMovimento.py | TGI-educativo/IPA | cdd93fe94ae5b085ff5a4af6142291ea199c8775 | [
"MIT"
] | null | null | null | metodoBloqueioMovimento.py | TGI-educativo/IPA | cdd93fe94ae5b085ff5a4af6142291ea199c8775 | [
"MIT"
] | null | null | null | metodoBloqueioMovimento.py | TGI-educativo/IPA | cdd93fe94ae5b085ff5a4af6142291ea199c8775 | [
"MIT"
] | null | null | null | def metodoBloqueioMovimento(x, y, mapaAtual, direcao, item_select):
if x > -1 and x < 750 and y >-1 and y < 560:
if mapaAtual == 1:
if direcao == 'direita':
if y < 330 and y > 200:
if (x+10>350 or x+10<270):
return True
else:
return False
else:
return True
if direcao == 'esquerda':
if y < 330 and y > 200:
if (x-10>350 or x-10<270):
return True
else:
return False
else:
return True
if direcao == 'cima':
if x > 250 and x < 350:
if (y-10<200 or y-10>310):
return True
else:
return False
else:
return True
if direcao == 'baixo':
if x > 250 and x < 350:
if (y-10<200 or y-10>310):
return True
else:
return False
else:
return True
if mapaAtual == 2:
if y<340 and y>210 and direcao != "direita" and x<400:
if x> 130:
return True
else:
return False
if y<310 and y>180 and direcao != "esquerda" and x>400:
if x< 550:
return True
else:
return False
else:
return True
if mapaAtual == 3:
if item_select >=2 and direcao == 'cima':
return True
if item_select < 3 and direcao == 'baixo':
return True
else:
return False
else:
return False | 33.135593 | 67 | 0.360102 | 196 | 1,955 | 3.576531 | 0.188776 | 0.185449 | 0.171184 | 0.199715 | 0.627675 | 0.563481 | 0.563481 | 0.513552 | 0.513552 | 0.513552 | 0 | 0.121249 | 0.573913 | 1,955 | 59 | 68 | 33.135593 | 0.720288 | 0 | 0 | 0.701754 | 0 | 0 | 0.02454 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.017544 | false | 0 | 0 | 0 | 0.385965 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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 | 3 |
2f2b014551f7f91e4aff2896ebfeef745449ce82 | 11,120 | py | Python | src/olympia/scanners/tests/test_views.py | dnutiu/addons-server | f42e8d44fc21bf9d40968b1732f62d8465a8389e | [
"BSD-3-Clause"
] | 1 | 2020-11-30T18:58:30.000Z | 2020-11-30T18:58:30.000Z | src/olympia/scanners/tests/test_views.py | dnutiu/addons-server | f42e8d44fc21bf9d40968b1732f62d8465a8389e | [
"BSD-3-Clause"
] | null | null | null | src/olympia/scanners/tests/test_views.py | dnutiu/addons-server | f42e8d44fc21bf9d40968b1732f62d8465a8389e | [
"BSD-3-Clause"
] | null | null | null | from olympia import amo
from olympia.activity.models import ActivityLog, VersionLog
from olympia.amo.tests import (
APITestClient,
TestCase,
addon_factory,
reverse_ns,
user_factory,
version_factory,
)
from olympia.constants.scanners import YARA, CUSTOMS, WAT, TRUE_POSITIVE
from olympia.scanners.models import ScannerResult
from olympia.scanners.serializers import ScannerResultSerializer
from django.test.utils import override_settings
class TestScannerResultView(TestCase):
client_class = APITestClient
def setUp(self):
super().setUp()
self.user = user_factory()
self.grant_permission(self.user, 'Admin:ScannersResultsView')
self.client.login_api(self.user)
self.url = reverse_ns('scanner-results', api_version='v5')
def assert_json_results(self, response, expected_results):
json = response.json()
assert 'results' in json
results = json['results']
assert len(results) == expected_results
return results
def test_endpoint_requires_authentication(self):
self.client.logout_api()
response = self.client.get(self.url)
assert response.status_code == 401
def test_endpoint_requires_permissions(self):
self.user = user_factory()
self.client.login_api(self.user)
response = self.client.get(self.url)
assert response.status_code == 403
def test_endpoint_can_be_disabled(self):
self.create_switch('enable-scanner-results-api', active=False)
response = self.client.get(self.url)
assert response.status_code == 404
def test_get(self):
self.create_switch('enable-scanner-results-api', active=True)
task_user = user_factory()
# result labelled as "bad" because its state is TRUE_POSITIVE
bad_version = version_factory(addon=addon_factory())
bad_result = ScannerResult.objects.create(
scanner=YARA, version=bad_version, state=TRUE_POSITIVE
)
# result without a version and state is UNKNOWN
ScannerResult.objects.create(scanner=YARA)
# true positive, but without a version
ScannerResult.objects.create(scanner=YARA, state=TRUE_POSITIVE)
# result labelled as "good" because it has been approved
good_version_1 = version_factory(addon=addon_factory())
good_result_1 = ScannerResult.objects.create(
scanner=WAT, version=good_version_1
)
VersionLog.objects.create(
activity_log=ActivityLog.create(
action=amo.LOG.APPROVE_VERSION,
version=good_version_1,
user=self.user,
),
version=good_version_1,
)
# result labelled as "good" because auto-approve has been confirmed
good_version_2 = version_factory(addon=addon_factory())
good_result_2 = ScannerResult.objects.create(
scanner=CUSTOMS, version=good_version_2
)
VersionLog.objects.create(
activity_log=ActivityLog.create(
action=amo.LOG.APPROVE_VERSION,
version=good_version_2,
user=task_user,
),
version=good_version_2,
)
VersionLog.objects.create(
activity_log=ActivityLog.create(
action=amo.LOG.CONFIRM_AUTO_APPROVED,
version=good_version_2,
user=self.user,
),
version=good_version_2,
)
# Simulate a reviewer who has confirmed auto-approval a second time. We
# should not return duplicate results.
VersionLog.objects.create(
activity_log=ActivityLog.create(
action=amo.LOG.CONFIRM_AUTO_APPROVED,
version=good_version_2,
user=self.user,
),
version=good_version_2,
)
# result NOT labelled as "good" because action is not correct.
version_3 = version_factory(addon=addon_factory())
ScannerResult.objects.create(scanner=YARA, version=version_3)
VersionLog.objects.create(
activity_log=ActivityLog.create(
action=amo.LOG.REJECT_VERSION,
version=version_3,
user=self.user,
),
version=version_3,
)
# result NOT labelled as "good" because user is TASK_USER_ID
version_4 = version_factory(addon=addon_factory())
ScannerResult.objects.create(scanner=YARA, version=version_4)
VersionLog.objects.create(
activity_log=ActivityLog.create(
action=amo.LOG.APPROVE_VERSION,
version=version_4,
user=task_user,
),
version=version_4,
)
with override_settings(TASK_USER_ID=task_user.pk):
response = self.client.get(self.url)
assert response.status_code == 200
results = self.assert_json_results(response, expected_results=3)
# Force a `label` value so that the serialized (expected) data is
# accurate. This is needed because `label` is an annotated field
# created in the QuerySet.
good_result_2.label = 'good'
assert (
results[0] == ScannerResultSerializer(instance=good_result_2).data
)
# Force a `label` value so that the serialized (expected) data is
# accurate. This is needed because `label` is an annotated field
# created in the QuerySet.
good_result_1.label = 'good'
assert (
results[1] == ScannerResultSerializer(instance=good_result_1).data
)
# Force a `label` value so that the serialized (expected) data is
# accurate. This is needed because `label` is an annotated field
# created in the QuerySet.
bad_result.label = 'bad'
assert results[2] == ScannerResultSerializer(instance=bad_result).data
def test_get_by_scanner(self):
self.create_switch('enable-scanner-results-api', active=True)
# result labelled as "bad" because its state is TRUE_POSITIVE
bad_version = version_factory(addon=addon_factory())
ScannerResult.objects.create(
scanner=YARA, version=bad_version, state=TRUE_POSITIVE
)
ScannerResult.objects.create(
scanner=CUSTOMS, version=bad_version, state=TRUE_POSITIVE
)
response = self.client.get(self.url)
self.assert_json_results(response, expected_results=2)
response = self.client.get('{}?scanner=yara'.format(self.url))
results = self.assert_json_results(response, expected_results=1)
assert results[0].get('scanner') == 'yara'
response = self.client.get('{}?scanner=customs'.format(self.url))
results = self.assert_json_results(response, expected_results=1)
assert results[0].get('scanner') == 'customs'
def test_get_by_scanner_with_empty_value(self):
self.create_switch('enable-scanner-results-api', active=True)
invalid_scanner = ""
response = self.client.get(
'{}?scanner={}'.format(self.url, invalid_scanner)
)
assert response.status_code == 400
def test_get_by_scanner_with_unknown_scanner(self):
self.create_switch('enable-scanner-results-api', active=True)
invalid_scanner = "yaraaaa"
response = self.client.get(
'{}?scanner={}'.format(self.url, invalid_scanner)
)
assert response.status_code == 400
def test_get_by_label(self):
self.create_switch('enable-scanner-results-api', active=True)
# result labelled as "bad" because its state is TRUE_POSITIVE
bad_version = version_factory(addon=addon_factory())
ScannerResult.objects.create(
scanner=YARA, version=bad_version, state=TRUE_POSITIVE
)
# result labelled as "good" because it has been approved
good_version = version_factory(addon=addon_factory())
ScannerResult.objects.create(scanner=WAT, version=good_version)
VersionLog.objects.create(
activity_log=ActivityLog.create(
action=amo.LOG.APPROVE_VERSION,
version=good_version,
user=self.user,
),
version=good_version,
)
response = self.client.get(self.url)
self.assert_json_results(response, expected_results=2)
response = self.client.get('{}?label=good'.format(self.url))
results = self.assert_json_results(response, expected_results=1)
assert results[0].get('label') == 'good'
response = self.client.get('{}?label=bad'.format(self.url))
results = self.assert_json_results(response, expected_results=1)
assert results[0].get('label') == 'bad'
def test_get_by_label_with_empty_value(self):
self.create_switch('enable-scanner-results-api', active=True)
invalid_label = ""
response = self.client.get(
'{}?label={}'.format(self.url, invalid_label)
)
assert response.status_code == 400
def test_get_by_label_with_unknown_label(self):
self.create_switch('enable-scanner-results-api', active=True)
invalid_label = "gooda"
response = self.client.get(
'{}?label={}'.format(self.url, invalid_label)
)
assert response.status_code == 400
def test_get_by_label_and_scanner(self):
self.create_switch('enable-scanner-results-api', active=True)
# result labelled as "bad" because its state is TRUE_POSITIVE
bad_version = version_factory(addon=addon_factory())
ScannerResult.objects.create(
scanner=YARA, version=bad_version, state=TRUE_POSITIVE
)
# result labelled as "good" because it has been approved
good_version = version_factory(addon=addon_factory())
ScannerResult.objects.create(scanner=WAT, version=good_version)
VersionLog.objects.create(
activity_log=ActivityLog.create(
action=amo.LOG.APPROVE_VERSION,
version=good_version,
user=self.user,
),
version=good_version,
)
response = self.client.get(self.url)
self.assert_json_results(response, expected_results=2)
response = self.client.get(
'{}'.format('{}?scanner=yara&label=good'.format(self.url))
)
self.assert_json_results(response, expected_results=0)
response = self.client.get(
'{}'.format('{}?scanner=yara&label=bad'.format(self.url))
)
self.assert_json_results(response, expected_results=1)
response = self.client.get(
'{}'.format('{}?scanner=wat&label=bad'.format(self.url))
)
self.assert_json_results(response, expected_results=0)
response = self.client.get(
'{}'.format('{}?scanner=wat&label=good'.format(self.url))
)
self.assert_json_results(response, expected_results=1)
| 40 | 79 | 0.640558 | 1,265 | 11,120 | 5.434783 | 0.115415 | 0.032 | 0.049745 | 0.058036 | 0.780509 | 0.746036 | 0.701382 | 0.689455 | 0.665309 | 0.658182 | 0 | 0.008538 | 0.26268 | 11,120 | 277 | 80 | 40.144404 | 0.829979 | 0.111151 | 0 | 0.524229 | 0 | 0 | 0.057708 | 0.03641 | 0 | 0 | 0 | 0 | 0.132159 | 1 | 0.057269 | false | 0 | 0.030837 | 0 | 0.101322 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 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 | 3 |
2f394b3a96b8f0ab9c86cf1d4dd69af2bbface35 | 241 | py | Python | tests/test3.py | NeighbourLizard/quadratic_equation_pkg | 20dc5f49d3991a139e799724d2aee5317491b96c | [
"MIT"
] | null | null | null | tests/test3.py | NeighbourLizard/quadratic_equation_pkg | 20dc5f49d3991a139e799724d2aee5317491b96c | [
"MIT"
] | null | null | null | tests/test3.py | NeighbourLizard/quadratic_equation_pkg | 20dc5f49d3991a139e799724d2aee5317491b96c | [
"MIT"
] | null | null | null | import quadratic_equation_giarts
a = 1
b = -2
c = 1
print("Test 3 commencing... \n")
print("Answer should be: 1\n")
quadratic_equation_giarts.quadratic_equation_giarts(a,b,c) # 1
# https://test.pypi.org/project/quadratic-equation-giarts/
| 20.083333 | 62 | 0.742739 | 39 | 241 | 4.435897 | 0.538462 | 0.393064 | 0.531792 | 0.277457 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.028037 | 0.112033 | 241 | 11 | 63 | 21.909091 | 0.780374 | 0.240664 | 0 | 0 | 0 | 0 | 0.244444 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.142857 | 0.285714 | 0 | 0 | 0 | null | 1 | 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 | 3 |
2f3a64b21611c92abee61d6e02a87317fb0a2a43 | 4,438 | py | Python | App/models.py | NeverLeft/FLASKTPP | 3480131f3386bfc86e45a914f2140949863641dd | [
"Apache-2.0"
] | null | null | null | App/models.py | NeverLeft/FLASKTPP | 3480131f3386bfc86e45a914f2140949863641dd | [
"Apache-2.0"
] | null | null | null | App/models.py | NeverLeft/FLASKTPP | 3480131f3386bfc86e45a914f2140949863641dd | [
"Apache-2.0"
] | null | null | null | from werkzeug.security import generate_password_hash, check_password_hash
from App.ModelUtil import BaseModel
from App.ext import db
class Letter(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
letter = db.Column(db.String(1), unique=True)
class City(db.Model):
id = db.Column(db.Integer, primary_key=True)
regionName = db.Column(db.String(16))
cityCode = db.Column(db.Integer, default=0)
pinYin = db.Column(db.String(64))
c_letter = db.Column(db.Integer, db.ForeignKey(Letter.id))
# def __str__(self):
# return self.regionName
# def __unicode__(self):
# return self.regionName
def __repr__(self):
return self.regionName
"""
insert into movies(id, showname, shownameen, director, leadingRole, type, country, language, duration, screeningmodel,
openday, backgroundpicture, flag, isdelete) values(228830,"梭哈人生","The Drifting Red Balloon","郑来志",
"谭佑铭,施予斐,赵韩樱子,孟智超,李林轩","剧情,爱情,喜剧","中国大陆","汉语普通话",90,"4D",date("2018-01-30 00:00:00"),
"i1/TB19_XCoLDH8KJjy1XcXXcpdXXa_.jpg",1,0);
"""
class Movie(db.Model):
__tablename__ = "movies"
id = db.Column(db.Integer, primary_key=True)
showname = db.Column(db.String(32))
shownameen = db.Column(db.String(64))
director = db.Column(db.String(32))
leadingRole = db.Column(db.String(256))
type = db.Column(db.String(32))
country = db.Column(db.String(64))
language = db.Column(db.String(32))
duration = db.Column(db.Integer)
screeningmodel = db.Column(db.String(16))
openday = db.Column(db.DateTime)
backgroundpicture = db.Column(db.String(256))
flag = db.Column(db.Integer)
isdelete = db.Column(db.Boolean)
"""
insert into cinemas(name,city,district,address,phone,score,hallnum,servicecharge,astrict,flag,isdelete)
values("深圳戏院影城","深圳","罗湖","罗湖区新园路1号东门步行街西口","0755-82175808",9.7,9,1.2,20,1,0);
"""
class Cinemas(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(32))
city = db.Column(db.String(16))
district = db.Column(db.String(16))
address = db.Column(db.String(128))
phone = db.Column(db.String(32))
score = db.Column(db.Float)
hallnum = db.Column(db.Integer)
servicecharge = db.Column(db.Float)
astrict = db.Column(db.Integer)
flag = db.Column(db.Integer)
isdelete = db.Column(db.Boolean)
"""
文件上传
1. 原生导流
- 原生操作
- 一遍读一遍写
2. 直接可以save
3. uploads
"""
PERMISSION_ORDERED = 1
PERMISSION_DELETE = 2
PERMISSION_MODIFCATION = 4
class User(BaseModel, db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
u_name = db.Column(db.String(16), unique=True)
u_email = db.Column(db.String(64), unique=True)
u_password = db.Column(db.String(256))
is_active = db.Column(db.Boolean, default=False)
u_permission = db.Column(db.Integer, default=0)
def set_password(self, password):
self.u_password = generate_password_hash(password)
def verify_password(self, password):
return check_password_hash(self.u_password, password)
def check_permission(self, permission):
return self.u_permission & permission == permission
# def save(self):
# db.session.add(self)
# db.session.commit()
#
# 大厅, 电影院
class Hall(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
# 1 工字型 12 × 10
h_type = db.Column(db.Integer)
h_count = db.Column(db.Integer, default=5)
# 0 1 2 3 。。。100
seats = db.Column(db.String(512))
"""
和大厅和电影的关系
大厅和电影的关系表
和购物车一个道理
"""
class MoviePlan(db.Model):
id = db.Column(db.String(128), primary_key=True)
mp_movie = db.Column(db.Integer, db.ForeignKey(Movie.id))
mp_hall = db.Column(db.Integer, db.ForeignKey(Hall.id))
mp_time = db.Column(db.DateTime)
class Order(BaseModel,db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
o_user = db.Column(db.Integer, db.ForeignKey(User.id))
o_movie_plan = db.Column(db.String(128), db.ForeignKey(MoviePlan.id))
# 1 代表已下单,未付款 2 代表已下单已付款 3 ....
o_status = db.Column(db.Integer, default=1)
class Ticket(BaseModel, db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
t_order = db.Column(db.Integer, db.ForeignKey(Order.id))
t_seat = db.Column(db.Integer) | 28.448718 | 118 | 0.674178 | 632 | 4,438 | 4.639241 | 0.264241 | 0.14734 | 0.184175 | 0.139154 | 0.420191 | 0.255116 | 0.182128 | 0.182128 | 0.170873 | 0.170873 | 0 | 0.035498 | 0.181163 | 4,438 | 156 | 119 | 28.448718 | 0.771051 | 0.052501 | 0 | 0.153846 | 1 | 0 | 0.001726 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.051282 | false | 0.076923 | 0.038462 | 0.038462 | 0.948718 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
2f50e01301bfbd3de582ce9eef10ea52e7f66a07 | 455 | py | Python | tools/leetcode.071.Simplify Path/leetcode.071.Simplify Path.submission6.py | tedye/leetcode | 975d7e3b8cb9b6be9e80e07febf4bcf6414acd46 | [
"MIT"
] | 4 | 2015-10-10T00:30:55.000Z | 2020-07-27T19:45:54.000Z | tools/leetcode.071.Simplify Path/leetcode.071.Simplify Path.submission6.py | tedye/leetcode | 975d7e3b8cb9b6be9e80e07febf4bcf6414acd46 | [
"MIT"
] | null | null | null | tools/leetcode.071.Simplify Path/leetcode.071.Simplify Path.submission6.py | tedye/leetcode | 975d7e3b8cb9b6be9e80e07febf4bcf6414acd46 | [
"MIT"
] | null | null | null | class Solution:
# @param {string} path
# @return {string}
def simplifyPath(self, path):
if not path: return ''
p = [x for x in path.split('/') if x]
s = []
for n in p:
if n == '..':
if s:
s.pop(-1)
elif n == '.':
continue
else:
s.append(n)
res = '/'.join(s)
return '/'+res
| 455 | 455 | 0.349451 | 48 | 455 | 3.3125 | 0.541667 | 0.125786 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004525 | 0.514286 | 455 | 1 | 455 | 455 | 0.714932 | 0.081319 | 0 | 0 | 0 | 0 | 0.014423 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.066667 | false | 0 | 0 | 0 | 0.2 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2f579408e79324a8c22b5e04ff9dbe47d049b34b | 16,839 | py | Python | pyboto3/iotsecuretunneling.py | gehad-shaat/pyboto3 | 4a0c2851a8bc04fb1c71c36086f7bb257e48181d | [
"MIT"
] | 91 | 2016-12-31T11:38:37.000Z | 2021-09-16T19:33:23.000Z | pyboto3/iotsecuretunneling.py | gehad-shaat/pyboto3 | 4a0c2851a8bc04fb1c71c36086f7bb257e48181d | [
"MIT"
] | 7 | 2017-01-02T18:54:23.000Z | 2020-08-11T13:54:02.000Z | pyboto3/iotsecuretunneling.py | gehad-shaat/pyboto3 | 4a0c2851a8bc04fb1c71c36086f7bb257e48181d | [
"MIT"
] | 26 | 2016-12-31T13:11:00.000Z | 2022-03-03T21:01:12.000Z | '''
The MIT License (MIT)
Copyright (c) 2016 WavyCloud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
'''
def can_paginate(operation_name=None):
"""
Check if an operation can be paginated.
:type operation_name: string
:param operation_name: The operation name. This is the same name\nas the method name on the client. For example, if the\nmethod name is create_foo, and you\'d normally invoke the\noperation as client.create_foo(**kwargs), if the\ncreate_foo operation can be paginated, you can use the\ncall client.get_paginator('create_foo').
"""
pass
def close_tunnel(tunnelId=None, delete=None):
"""
Closes a tunnel identified by the unique tunnel id. When a CloseTunnel request is received, we close the WebSocket connections between the client and proxy server so no data can be transmitted.
See also: AWS API Documentation
Exceptions
:example: response = client.close_tunnel(
tunnelId='string',
delete=True|False
)
:type tunnelId: string
:param tunnelId: [REQUIRED]\nThe ID of the tunnel to close.\n
:type delete: boolean
:param delete: When set to true, AWS IoT Secure Tunneling deletes the tunnel data immediately.
:rtype: dict
ReturnsResponse Syntax
{}
Response Structure
(dict) --
Exceptions
IoTSecureTunneling.Client.exceptions.ResourceNotFoundException
:return: {}
:returns:
(dict) --
"""
pass
def describe_tunnel(tunnelId=None):
"""
Gets information about a tunnel identified by the unique tunnel id.
See also: AWS API Documentation
Exceptions
:example: response = client.describe_tunnel(
tunnelId='string'
)
:type tunnelId: string
:param tunnelId: [REQUIRED]\nThe tunnel to describe.\n
:rtype: dict
ReturnsResponse Syntax{
'tunnel': {
'tunnelId': 'string',
'tunnelArn': 'string',
'status': 'OPEN'|'CLOSED',
'sourceConnectionState': {
'status': 'CONNECTED'|'DISCONNECTED',
'lastUpdatedAt': datetime(2015, 1, 1)
},
'destinationConnectionState': {
'status': 'CONNECTED'|'DISCONNECTED',
'lastUpdatedAt': datetime(2015, 1, 1)
},
'description': 'string',
'destinationConfig': {
'thingName': 'string',
'services': [
'string',
]
},
'timeoutConfig': {
'maxLifetimeTimeoutMinutes': 123
},
'tags': [
{
'key': 'string',
'value': 'string'
},
],
'createdAt': datetime(2015, 1, 1),
'lastUpdatedAt': datetime(2015, 1, 1)
}
}
Response Structure
(dict) --
tunnel (dict) --The tunnel being described.
tunnelId (string) --A unique alpha-numeric ID that identifies a tunnel.
tunnelArn (string) --The Amazon Resource Name (ARN) of a tunnel. The tunnel ARN format is arn:aws:tunnel:<region>:<account-id>:tunnel/<tunnel-id>
status (string) --The status of a tunnel. Valid values are: Open and Closed.
sourceConnectionState (dict) --The connection state of the source application.
status (string) --The connection status of the tunnel. Valid values are CONNECTED and DISCONNECTED .
lastUpdatedAt (datetime) --The last time the connection status was updated.
destinationConnectionState (dict) --The connection state of the destination application.
status (string) --The connection status of the tunnel. Valid values are CONNECTED and DISCONNECTED .
lastUpdatedAt (datetime) --The last time the connection status was updated.
description (string) --A description of the tunnel.
destinationConfig (dict) --The destination configuration that specifies the thing name of the destination device and a service name that the local proxy uses to connect to the destination application.
thingName (string) --The name of the IoT thing to which you want to connect.
services (list) --A list of service names that identity the target application. Currently, you can only specify a single name. The AWS IoT client running on the destination device reads this value and uses it to look up a port or an IP address and a port. The AWS IoT client instantiates the local proxy which uses this information to connect to the destination application.
(string) --
timeoutConfig (dict) --Timeout configuration for the tunnel.
maxLifetimeTimeoutMinutes (integer) --The maximum amount of time (in minutes) a tunnel can remain open. If not specified, maxLifetimeTimeoutMinutes defaults to 720 minutes. Valid values are from 1 minute to 12 hours (720 minutes)
tags (list) --A list of tag metadata associated with the secure tunnel.
(dict) --An arbitary key/value pair used to add searchable metadata to secure tunnel resources.
key (string) --The key of the tag.
value (string) --The value of the tag.
createdAt (datetime) --The time when the tunnel was created.
lastUpdatedAt (datetime) --The last time the tunnel was updated.
Exceptions
IoTSecureTunneling.Client.exceptions.ResourceNotFoundException
:return: {
'tunnel': {
'tunnelId': 'string',
'tunnelArn': 'string',
'status': 'OPEN'|'CLOSED',
'sourceConnectionState': {
'status': 'CONNECTED'|'DISCONNECTED',
'lastUpdatedAt': datetime(2015, 1, 1)
},
'destinationConnectionState': {
'status': 'CONNECTED'|'DISCONNECTED',
'lastUpdatedAt': datetime(2015, 1, 1)
},
'description': 'string',
'destinationConfig': {
'thingName': 'string',
'services': [
'string',
]
},
'timeoutConfig': {
'maxLifetimeTimeoutMinutes': 123
},
'tags': [
{
'key': 'string',
'value': 'string'
},
],
'createdAt': datetime(2015, 1, 1),
'lastUpdatedAt': datetime(2015, 1, 1)
}
}
:returns:
IoTSecureTunneling.Client.exceptions.ResourceNotFoundException
"""
pass
def generate_presigned_url(ClientMethod=None, Params=None, ExpiresIn=None, HttpMethod=None):
"""
Generate a presigned url given a client, its method, and arguments
:type ClientMethod: string
:param ClientMethod: The client method to presign for
:type Params: dict
:param Params: The parameters normally passed to\nClientMethod.
:type ExpiresIn: int
:param ExpiresIn: The number of seconds the presigned url is valid\nfor. By default it expires in an hour (3600 seconds)
:type HttpMethod: string
:param HttpMethod: The http method to use on the generated url. By\ndefault, the http method is whatever is used in the method\'s model.
"""
pass
def get_paginator(operation_name=None):
"""
Create a paginator for an operation.
:type operation_name: string
:param operation_name: The operation name. This is the same name\nas the method name on the client. For example, if the\nmethod name is create_foo, and you\'d normally invoke the\noperation as client.create_foo(**kwargs), if the\ncreate_foo operation can be paginated, you can use the\ncall client.get_paginator('create_foo').
:rtype: L{botocore.paginate.Paginator}
ReturnsA paginator object.
"""
pass
def get_waiter(waiter_name=None):
"""
Returns an object that can wait for some condition.
:type waiter_name: str
:param waiter_name: The name of the waiter to get. See the waiters\nsection of the service docs for a list of available waiters.
:rtype: botocore.waiter.Waiter
"""
pass
def list_tags_for_resource(resourceArn=None):
"""
Lists the tags for the specified resource.
See also: AWS API Documentation
Exceptions
:example: response = client.list_tags_for_resource(
resourceArn='string'
)
:type resourceArn: string
:param resourceArn: [REQUIRED]\nThe resource ARN.\n
:rtype: dict
ReturnsResponse Syntax{
'tags': [
{
'key': 'string',
'value': 'string'
},
]
}
Response Structure
(dict) --
tags (list) --The tags for the specified resource.
(dict) --An arbitary key/value pair used to add searchable metadata to secure tunnel resources.
key (string) --The key of the tag.
value (string) --The value of the tag.
Exceptions
IoTSecureTunneling.Client.exceptions.ResourceNotFoundException
:return: {
'tags': [
{
'key': 'string',
'value': 'string'
},
]
}
"""
pass
def list_tunnels(thingName=None, maxResults=None, nextToken=None):
"""
List all tunnels for an AWS account. Tunnels are listed by creation time in descending order, newer tunnels will be listed before older tunnels.
See also: AWS API Documentation
:example: response = client.list_tunnels(
thingName='string',
maxResults=123,
nextToken='string'
)
:type thingName: string
:param thingName: The name of the IoT thing associated with the destination device.
:type maxResults: integer
:param maxResults: The maximum number of results to return at once.
:type nextToken: string
:param nextToken: A token to retrieve the next set of results.
:rtype: dict
ReturnsResponse Syntax
{
'tunnelSummaries': [
{
'tunnelId': 'string',
'tunnelArn': 'string',
'status': 'OPEN'|'CLOSED',
'description': 'string',
'createdAt': datetime(2015, 1, 1),
'lastUpdatedAt': datetime(2015, 1, 1)
},
],
'nextToken': 'string'
}
Response Structure
(dict) --
tunnelSummaries (list) --
A short description of the tunnels in an AWS account.
(dict) --
Information about the tunnel.
tunnelId (string) --
The unique alpha-numeric identifier for the tunnel.
tunnelArn (string) --
The Amazon Resource Name of the tunnel. The tunnel ARN format is arn:aws:tunnel:<region>:<account-id>:tunnel/<tunnel-id>
status (string) --
The status of a tunnel. Valid values are: Open and Closed.
description (string) --
A description of the tunnel.
createdAt (datetime) --
The time the tunnel was created.
lastUpdatedAt (datetime) --
The time the tunnel was last updated.
nextToken (string) --
A token to used to retrieve the next set of results.
:return: {
'tunnelSummaries': [
{
'tunnelId': 'string',
'tunnelArn': 'string',
'status': 'OPEN'|'CLOSED',
'description': 'string',
'createdAt': datetime(2015, 1, 1),
'lastUpdatedAt': datetime(2015, 1, 1)
},
],
'nextToken': 'string'
}
"""
pass
def open_tunnel(description=None, tags=None, destinationConfig=None, timeoutConfig=None):
"""
Creates a new tunnel, and returns two client access tokens for clients to use to connect to the AWS IoT Secure Tunneling proxy server. .
See also: AWS API Documentation
Exceptions
:example: response = client.open_tunnel(
description='string',
tags=[
{
'key': 'string',
'value': 'string'
},
],
destinationConfig={
'thingName': 'string',
'services': [
'string',
]
},
timeoutConfig={
'maxLifetimeTimeoutMinutes': 123
}
)
:type description: string
:param description: A short text description of the tunnel.
:type tags: list
:param tags: A collection of tag metadata.\n\n(dict) --An arbitary key/value pair used to add searchable metadata to secure tunnel resources.\n\nkey (string) -- [REQUIRED]The key of the tag.\n\nvalue (string) -- [REQUIRED]The value of the tag.\n\n\n\n\n
:type destinationConfig: dict
:param destinationConfig: The destination configuration for the OpenTunnel request.\n\nthingName (string) -- [REQUIRED]The name of the IoT thing to which you want to connect.\n\nservices (list) -- [REQUIRED]A list of service names that identity the target application. Currently, you can only specify a single name. The AWS IoT client running on the destination device reads this value and uses it to look up a port or an IP address and a port. The AWS IoT client instantiates the local proxy which uses this information to connect to the destination application.\n\n(string) --\n\n\n\n
:type timeoutConfig: dict
:param timeoutConfig: Timeout configuration for a tunnel.\n\nmaxLifetimeTimeoutMinutes (integer) --The maximum amount of time (in minutes) a tunnel can remain open. If not specified, maxLifetimeTimeoutMinutes defaults to 720 minutes. Valid values are from 1 minute to 12 hours (720 minutes)\n\n\n
:rtype: dict
ReturnsResponse Syntax
{
'tunnelId': 'string',
'tunnelArn': 'string',
'sourceAccessToken': 'string',
'destinationAccessToken': 'string'
}
Response Structure
(dict) --
tunnelId (string) --
A unique alpha-numeric tunnel ID.
tunnelArn (string) --
The Amazon Resource Name for the tunnel. The tunnel ARN format is arn:aws:tunnel:<region>:<account-id>:tunnel/<tunnel-id>
sourceAccessToken (string) --
The access token the source local proxy uses to connect to AWS IoT Secure Tunneling.
destinationAccessToken (string) --
The access token the destination local proxy uses to connect to AWS IoT Secure Tunneling.
Exceptions
IoTSecureTunneling.Client.exceptions.LimitExceededException
:return: {
'tunnelId': 'string',
'tunnelArn': 'string',
'sourceAccessToken': 'string',
'destinationAccessToken': 'string'
}
:returns:
IoTSecureTunneling.Client.exceptions.LimitExceededException
"""
pass
def tag_resource(resourceArn=None, tags=None):
"""
A resource tag.
See also: AWS API Documentation
Exceptions
:example: response = client.tag_resource(
resourceArn='string',
tags=[
{
'key': 'string',
'value': 'string'
},
]
)
:type resourceArn: string
:param resourceArn: [REQUIRED]\nThe ARN of the resource.\n
:type tags: list
:param tags: [REQUIRED]\nThe tags for the resource.\n\n(dict) --An arbitary key/value pair used to add searchable metadata to secure tunnel resources.\n\nkey (string) -- [REQUIRED]The key of the tag.\n\nvalue (string) -- [REQUIRED]The value of the tag.\n\n\n\n\n
:rtype: dict
ReturnsResponse Syntax
{}
Response Structure
(dict) --
Exceptions
IoTSecureTunneling.Client.exceptions.ResourceNotFoundException
:return: {}
:returns:
(dict) --
"""
pass
def untag_resource(resourceArn=None, tagKeys=None):
"""
Removes a tag from a resource.
See also: AWS API Documentation
Exceptions
:example: response = client.untag_resource(
resourceArn='string',
tagKeys=[
'string',
]
)
:type resourceArn: string
:param resourceArn: [REQUIRED]\nThe resource ARN.\n
:type tagKeys: list
:param tagKeys: [REQUIRED]\nThe keys of the tags to remove.\n\n(string) --\n\n
:rtype: dict
ReturnsResponse Syntax
{}
Response Structure
(dict) --
Exceptions
IoTSecureTunneling.Client.exceptions.ResourceNotFoundException
:return: {}
:returns:
(dict) --
"""
pass
| 25.946071 | 590 | 0.64891 | 1,970 | 16,839 | 5.525381 | 0.182234 | 0.012862 | 0.014332 | 0.015434 | 0.590354 | 0.561782 | 0.514194 | 0.474966 | 0.448599 | 0.419109 | 0 | 0.008829 | 0.26011 | 16,839 | 648 | 591 | 25.986111 | 0.864837 | 0.946137 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
2f8944e96654d7a1acf74e743847bff56c4805f2 | 232 | py | Python | iam/models/__init__.py | LiuYiwai/simple-IAM | 681f42b03f1472e60b746419ba3dd03412cde55d | [
"MIT"
] | 9 | 2020-05-22T06:47:46.000Z | 2021-08-18T06:50:07.000Z | iam/models/__init__.py | LiuYiwai/simple-IAM | 681f42b03f1472e60b746419ba3dd03412cde55d | [
"MIT"
] | 5 | 2020-10-12T08:10:31.000Z | 2021-03-05T16:21:13.000Z | iam/models/__init__.py | LiuYiwai/simple-IAM | 681f42b03f1472e60b746419ba3dd03412cde55d | [
"MIT"
] | 5 | 2020-05-22T06:47:45.000Z | 2020-12-10T12:43:40.000Z | from .decode_module import DecodeModule
from .encode_module import EncodeModule
from .fc_resnet import FC_ResNet
from .feature_pyramid import FeaturePyramid
__all__ = ['FC_ResNet', 'EncodeModule', 'DecodeModule', 'FeaturePyramid']
| 33.142857 | 73 | 0.823276 | 27 | 232 | 6.703704 | 0.481481 | 0.132597 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.099138 | 232 | 6 | 74 | 38.666667 | 0.866029 | 0 | 0 | 0 | 0 | 0 | 0.202586 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.8 | 0 | 0.8 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
c81f31061b4aeaba1dcb02451aeac69a5a58c275 | 1,648 | py | Python | _assignments/intermediate/dataclass/dataclass_postinit_a.py | sages-pl/2022-01-pythonsqlalchemy-aptiv | 1d6d856608e9dbe25b139e8968c48b7f46753b84 | [
"MIT"
] | null | null | null | _assignments/intermediate/dataclass/dataclass_postinit_a.py | sages-pl/2022-01-pythonsqlalchemy-aptiv | 1d6d856608e9dbe25b139e8968c48b7f46753b84 | [
"MIT"
] | null | null | null | _assignments/intermediate/dataclass/dataclass_postinit_a.py | sages-pl/2022-01-pythonsqlalchemy-aptiv | 1d6d856608e9dbe25b139e8968c48b7f46753b84 | [
"MIT"
] | null | null | null | """
* Assignment: Dataclass PostInit Syntax
* Complexity: easy
* Lines of code: 3 lines
* Time: 5 min
English:
1. Use Dataclass to define class `Point` with attributes:
a. `x: int` with default value `0`
b. `y: int` with default value `0`
2. When `x` or `y` has negative value raise en exception
`ValueError('Coordinate cannot be negative')`
3. Use `datalass` and validation in `__post_init__()`
4. Run doctests - all must succeed
Polish:
1. Użyj Dataclass do zdefiniowania klasy `Point` z atrybutami:
a. `x: int` z domyślną wartością `0`
b. `y: int` z domyślną wartością `0`
2. Gdy `x` lub `y` mają wartość ujemną podnieś wyjątek
`ValueError('Coordinate cannot be negative')`
3. Użyj `datalass` i walidacji w `__post_init__()`
4. Uruchom doctesty - wszystkie muszą się powieść
Tests:
>>> import sys; sys.tracebacklimit = 0
>>> from inspect import isclass
>>> from dataclasses import is_dataclass
>>> assert isclass(Point)
>>> assert is_dataclass(Point)
>>> assert hasattr(Point, 'x')
>>> assert hasattr(Point, 'y')
>>> Point()
Point(x=0, y=0)
>>> Point(x=0, y=0)
Point(x=0, y=0)
>>> Point(x=1, y=2)
Point(x=1, y=2)
>>> Point(x=-1, y=0)
Traceback (most recent call last):
ValueError: Coordinate cannot be negative
>>> Point(x=0, y=-1)
Traceback (most recent call last):
ValueError: Coordinate cannot be negative
"""
from dataclasses import dataclass
# class: Use Dataclass to define class `Point` with attributes: `x` and `y`
@dataclass
class Point:
x: int = 0
y: int = 0
| 26.15873 | 75 | 0.632888 | 233 | 1,648 | 4.424893 | 0.407725 | 0.052376 | 0.100873 | 0.108632 | 0.412221 | 0.330747 | 0.258972 | 0.258972 | 0.173618 | 0.154219 | 0 | 0.02486 | 0.243325 | 1,648 | 62 | 76 | 26.580645 | 0.801925 | 0.9375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.2 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
c82e6d9145743627a8869f403f6198d654bfe82a | 1,573 | py | Python | pycdo/model/connectors.py | aaronhackney/pycdo | 0c0b938b74dbc0ab45a1ed7926c2d5e2f8651e7a | [
"MIT"
] | null | null | null | pycdo/model/connectors.py | aaronhackney/pycdo | 0c0b938b74dbc0ab45a1ed7926c2d5e2f8651e7a | [
"MIT"
] | 1 | 2022-03-17T22:38:44.000Z | 2022-03-17T22:38:44.000Z | pycdo/model/connectors.py | aaronhackney/pycdo | 0c0b938b74dbc0ab45a1ed7926c2d5e2f8651e7a | [
"MIT"
] | null | null | null | from typing import Optional
from pycdo.model.cdo import CDOContext
from pydantic import Field, BaseModel
from datetime import datetime
class LarPublicKey(BaseModel):
encoded_key: Optional[str] = Field(alias="encodedKey")
version: Optional[int]
key_id: Optional[str] = Field(alias="keyId")
class Connector(CDOContext):
rabbit_mq_details: Optional[dict] = Field(alias="rabbitMQDetails")
tenant_uid: Optional[str] = Field(alias="tenantUid")
last_heartbeat_time: Optional[datetime] = Field(alias="last_heartbeat_time")
service_connectivity_state: Optional[str] = Field(alias="service_connectivity_state")
ip_address: Optional[str] = Field(alias="ipAddress")
container_ip_address: Optional[str] = Field(alias="containerIpAddress")
lar_public_key: Optional[LarPublicKey] = Field(alias="larPublicKey")
lar_status: Optional[str] = Field(alias="larStatus")
on_prem_lar_configured: Optional[bool] = Field(alias="onPremLarConfigured")
lar_version: Optional[str] = Field(alias="larVersion")
lar_image: Optional[str] = Field(alias="larImage")
sha256: Optional[str]
lar_metadata: Optional[dict] = Field(alias="larMetadata")
lar_migrations: Optional[dict] = Field(alias="larMigrations")
default_lar: Optional[bool] = Field(alias="defaultLar")
cdg: Optional[bool]
sns_sqs_details: Optional[dict] = Field(alias="snsSqsDetails")
latest_aegis_signature_key: Optional[dict] = Field(alias="latestAegisSignatureKey")
latest_aegis_encryption_key: Optional[dict] = Field(alias="latestAegisEncryptionKey")
| 47.666667 | 89 | 0.75588 | 183 | 1,573 | 6.306011 | 0.393443 | 0.164645 | 0.124783 | 0.163778 | 0.145581 | 0.051993 | 0 | 0 | 0 | 0 | 0 | 0.002177 | 0.123967 | 1,573 | 32 | 90 | 49.15625 | 0.835269 | 0 | 0 | 0 | 0 | 0 | 0.167196 | 0.046408 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.142857 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
c83154876fe63b5fafb6b42c2f3863f3c5b58a4d | 381 | py | Python | release/stubs.min/Rhino/DocObjects/__init___parts/RhinoObjectEventArgs.py | YKato521/ironpython-stubs | b1f7c580de48528490b3ee5791b04898be95a9ae | [
"MIT"
] | null | null | null | release/stubs.min/Rhino/DocObjects/__init___parts/RhinoObjectEventArgs.py | YKato521/ironpython-stubs | b1f7c580de48528490b3ee5791b04898be95a9ae | [
"MIT"
] | null | null | null | release/stubs.min/Rhino/DocObjects/__init___parts/RhinoObjectEventArgs.py | YKato521/ironpython-stubs | b1f7c580de48528490b3ee5791b04898be95a9ae | [
"MIT"
] | null | null | null | class RhinoObjectEventArgs(EventArgs):
# no doc
ObjectId = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""Get: ObjectId(self: RhinoObjectEventArgs) -> Guid
"""
TheObject = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""Get: TheObject(self: RhinoObjectEventArgs) -> RhinoObject
"""
| 23.8125 | 89 | 0.650919 | 39 | 381 | 6.358974 | 0.410256 | 0.241935 | 0.145161 | 0.193548 | 0.451613 | 0.451613 | 0.451613 | 0.451613 | 0.451613 | 0.451613 | 0 | 0 | 0.217848 | 381 | 15 | 90 | 25.4 | 0.832215 | 0.015748 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
c834ae3a49ff78c62562aa1c16969ecd84835e44 | 915 | py | Python | tests/test_attributes.py | Gaechi/BynamoDB | f936e0a173bf2b30dabd35e4e36cee647c5fe94b | [
"MIT"
] | 1 | 2015-01-06T07:07:52.000Z | 2015-01-06T07:07:52.000Z | tests/test_attributes.py | BalanceCareerInc/BynamoDB | f936e0a173bf2b30dabd35e4e36cee647c5fe94b | [
"MIT"
] | null | null | null | tests/test_attributes.py | BalanceCareerInc/BynamoDB | f936e0a173bf2b30dabd35e4e36cee647c5fe94b | [
"MIT"
] | null | null | null | from bynamodb.attributes import (NumberAttribute, StringAttribute,
NumberSetAttribute, StringSetAttribute)
def test_number_attribute_validation():
assert NumberAttribute.valid(123)
assert NumberAttribute.valid(123.4)
assert not NumberAttribute.valid('1234')
def test_string_attribute_validation():
assert StringAttribute.valid('1234')
assert StringAttribute.valid(u'1234')
assert not StringAttribute.valid(1234)
def test_empty_set_valid_for_set_attributes():
assert StringSetAttribute.valid(set())
assert NumberSetAttribute.valid(set())
def test_set_attributes_valid_with_expected_types():
assert StringSetAttribute.valid({'a', 'b'})
assert NumberSetAttribute.valid({1, 2})
def test_set_attributes_not_valid_for_unexpected_types():
assert not StringSetAttribute.valid({1, 2})
assert not NumberSetAttribute.valid({'a', 'b'})
| 30.5 | 72 | 0.75082 | 101 | 915 | 6.554455 | 0.316832 | 0.05287 | 0.075529 | 0.087613 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034839 | 0.153005 | 915 | 29 | 73 | 31.551724 | 0.819355 | 0 | 0 | 0 | 0 | 0 | 0.017486 | 0 | 0 | 0 | 0 | 0 | 0.631579 | 1 | 0.263158 | true | 0 | 0.052632 | 0 | 0.315789 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c84dcd386a661160653eb0c0b22fe37fd1bd0f3f | 403 | py | Python | cd4ml/problems/available_problems.py | lalvincz/CD4ML-Scenarios | 4cf61cb1d2ba5b0e955c7a0ba78273072f3b4af9 | [
"MIT"
] | null | null | null | cd4ml/problems/available_problems.py | lalvincz/CD4ML-Scenarios | 4cf61cb1d2ba5b0e955c7a0ba78273072f3b4af9 | [
"MIT"
] | null | null | null | cd4ml/problems/available_problems.py | lalvincz/CD4ML-Scenarios | 4cf61cb1d2ba5b0e955c7a0ba78273072f3b4af9 | [
"MIT"
] | null | null | null | import cd4ml.problems.groceries.problem as groceries_scenario
import cd4ml.problems.houses.problem as houses_scenario
import cd4ml.problems.iris.problem as iris_scenario
import cd4ml.problems.titanic.problem as titanic_scenario
PROBLEMS = {
'groceries': groceries_scenario.Problem,
'houses': houses_scenario.Problem,
'iris': iris_scenario.Problem,
'titanic': titanic_scenario.Problem
}
| 33.583333 | 61 | 0.80397 | 49 | 403 | 6.44898 | 0.204082 | 0.139241 | 0.240506 | 0.256329 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011173 | 0.111663 | 403 | 11 | 62 | 36.636364 | 0.871508 | 0 | 0 | 0 | 0 | 0 | 0.064516 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
c84dee7bdcc1a26079ac85ba168eeb907cd5db72 | 173 | py | Python | major/models.py | muh404med/TodosAPP | 512ca1e6487e7eee8a804da9e18818accb095bdc | [
"MIT"
] | 1 | 2022-03-09T08:24:32.000Z | 2022-03-09T08:24:32.000Z | major/models.py | muh404med/TodosAPP | 512ca1e6487e7eee8a804da9e18818accb095bdc | [
"MIT"
] | null | null | null | major/models.py | muh404med/TodosAPP | 512ca1e6487e7eee8a804da9e18818accb095bdc | [
"MIT"
] | null | null | null | from django.db import models
# Create your models here.
class TodoIem(models.Model):
text = models.TextField(max_length=500)
def __str__(self):
return self.text
| 13.307692 | 40 | 0.734104 | 25 | 173 | 4.88 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020979 | 0.17341 | 173 | 12 | 41 | 14.416667 | 0.832168 | 0.138728 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0.2 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
c854f49ae109baa1a1ae363cfa5d49197afcee1b | 819 | py | Python | uwa/source.py | mikelytaev/wave-propagation | eff0eb1fc843e4d206b05731e40047e1d810d76f | [
"MIT"
] | 15 | 2019-06-28T17:05:23.000Z | 2022-03-22T02:20:39.000Z | uwa/source.py | mikelytaev/wave-propagation | eff0eb1fc843e4d206b05731e40047e1d810d76f | [
"MIT"
] | null | null | null | uwa/source.py | mikelytaev/wave-propagation | eff0eb1fc843e4d206b05731e40047e1d810d76f | [
"MIT"
] | 3 | 2020-10-10T12:41:19.000Z | 2021-12-17T14:08:18.000Z | import cmath as cm
import numpy as np
class Source:
def __init__(self, freq_hz, depth):
self.freq_hz = freq_hz
self.depth = depth
def aperture(self, k0, z):
pass
def max_angle(self):
pass
class GaussSource(Source):
def __init__(self, *, freq_hz, depth, beam_width, eval_angle):
self.freq_hz = freq_hz
self.depth = depth
self.beam_width = beam_width
self.eval_angle = eval_angle
def aperture(self, k0, z):
ww = cm.sqrt(2 * cm.log(2)) / (k0 * cm.sin(self.beam_width * cm.pi / 180 / 2))
return 1 / (cm.sqrt(cm.pi) * ww) * np.exp(-1j * k0 * np.sin(self.eval_angle * cm.pi / 180) * z) * \
np.exp(-((z - self.depth) / ww) ** 2)
def max_angle(self):
return self.beam_width + abs(self.eval_angle)
| 24.818182 | 107 | 0.58486 | 127 | 819 | 3.566929 | 0.283465 | 0.07947 | 0.0883 | 0.075055 | 0.335541 | 0.256071 | 0.256071 | 0.13245 | 0 | 0 | 0 | 0.027211 | 0.282051 | 819 | 32 | 108 | 25.59375 | 0.743197 | 0 | 0 | 0.454545 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0.090909 | 0.090909 | 0.045455 | 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 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
c860defac1f8da9ced8cb4c36af709dc60b1a776 | 141 | py | Python | week06/lecture/examples/21_numbers.py | uldash/CS50x | c3ee0f42ad514b57a13c3ffbb96238b3ca3730e1 | [
"MIT"
] | null | null | null | week06/lecture/examples/21_numbers.py | uldash/CS50x | c3ee0f42ad514b57a13c3ffbb96238b3ca3730e1 | [
"MIT"
] | null | null | null | week06/lecture/examples/21_numbers.py | uldash/CS50x | c3ee0f42ad514b57a13c3ffbb96238b3ca3730e1 | [
"MIT"
] | null | null | null | import sys
numbers = [4, 6, 8, 2, 7, 5, 0]
if 0 in numbers:
print("Found")
sys.exit(0)
else:
print("Not found")
sys.exit(1) | 14.1 | 31 | 0.553191 | 26 | 141 | 3 | 0.692308 | 0.205128 | 0.307692 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.097087 | 0.269504 | 141 | 10 | 32 | 14.1 | 0.660194 | 0 | 0 | 0 | 0 | 0 | 0.098592 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.125 | 0 | 0.125 | 0.25 | 1 | 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 | 3 |
c8642bc69ae0d14f066f8d18a9559b0dea6e84db | 224 | py | Python | tests/test_returns.py | jingmouren/OptimalPortfolio | cb27cbc6f0832bfc531c085454afe1ca457ea95e | [
"MIT"
] | 279 | 2018-11-24T05:11:31.000Z | 2022-03-23T05:27:50.000Z | tests/test_returns.py | jingmouren/OptimalPortfolio | cb27cbc6f0832bfc531c085454afe1ca457ea95e | [
"MIT"
] | 4 | 2018-11-24T14:02:39.000Z | 2019-07-04T01:41:57.000Z | tests/test_returns.py | jingmouren/OptimalPortfolio | cb27cbc6f0832bfc531c085454afe1ca457ea95e | [
"MIT"
] | 87 | 2018-11-24T05:16:46.000Z | 2021-11-07T14:31:40.000Z | import pandas as pd
import numpy as np
import optimalportfolio.returns as ret_estimators
from tests.test_utilities import get_asset_data, get_market_data
asset_data = get_asset_data()
market_data = get_market_data()
| 16 | 64 | 0.821429 | 35 | 224 | 4.914286 | 0.514286 | 0.156977 | 0.139535 | 0.197674 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.138393 | 224 | 13 | 65 | 17.230769 | 0.891192 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 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 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
c071f8339129010c252baddd615588b80801d7de | 635 | py | Python | pipeline_control/tests/offline/conftest.py | aws-samples/financial-crimes-discovery-using-graph-database | 546b1b0dd3cad4af7f674fa1f0a6749d18b66902 | [
"MIT-0"
] | null | null | null | pipeline_control/tests/offline/conftest.py | aws-samples/financial-crimes-discovery-using-graph-database | 546b1b0dd3cad4af7f674fa1f0a6749d18b66902 | [
"MIT-0"
] | null | null | null | pipeline_control/tests/offline/conftest.py | aws-samples/financial-crimes-discovery-using-graph-database | 546b1b0dd3cad4af7f674fa1f0a6749d18b66902 | [
"MIT-0"
] | null | null | null | # Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
import logging
from .global_fixtures.gfixtures_infrastructure import *
from .global_fixtures.gfixtures_job_configurations import *
from .global_fixtures.gfixtures_post_inference import *
from .global_fixtures.gfixtures_rdfox_job import *
from .global_fixtures.gfixtures_side_effect_patches import *
from .test_variables import *
logger = logging.getLogger("tests")
logger.setLevel(logging.INFO)
log = logging.getLogger("pynamodb")
log.setLevel(logging.INFO)
log2 = logging.getLogger("botocore")
log2.setLevel(logging.INFO)
| 30.238095 | 73 | 0.818898 | 81 | 635 | 6.222222 | 0.518519 | 0.099206 | 0.178571 | 0.267857 | 0.261905 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012111 | 0.089764 | 635 | 20 | 74 | 31.75 | 0.859862 | 0.16063 | 0 | 0 | 0 | 0 | 0.039623 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.538462 | 0 | 0.538462 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
c07282365a3879b07ddfc944a6592485f5c7a4d5 | 1,536 | py | Python | mazes/generation/npc.py | sholloway/mazes | 2b9df256b6de8068cbe60f09fb8a388fcbfc5823 | [
"MIT"
] | null | null | null | mazes/generation/npc.py | sholloway/mazes | 2b9df256b6de8068cbe60f09fb8a388fcbfc5823 | [
"MIT"
] | null | null | null | mazes/generation/npc.py | sholloway/mazes | 2b9df256b6de8068cbe60f09fb8a388fcbfc5823 | [
"MIT"
] | null | null | null | from collections.abc import Callable
from generation.direction import Direction
from generation.structures import Point
from generation.maze import Maze
class Agent:
"""A generic, autonomous agent."""
_location: Point # The maze coordinate of where the agent currently is.
_last_location: Point # The last place the agent remembers it was.
_facing: Direction # The direction the agent is facing.
_crest: str # The color to represent the agent.
def __init__(self, crest='blue') -> None:
"""Create a new instance of an agent."""
self._crest = crest
self._location = Point(0,0)
self._last_location = Point(0,0)
def face(self, direction: Direction) -> None:
"""Set the direction the agent is facing."""
self._facing = direction
@property
def crest(self) -> str:
return self._crest
@property
def facing(self) -> Direction:
return self._facing
def move_to(self, new_location: Point):
"""Tell the agent to walk to the new location in the maze."""
self._last_location = self.location
self._location = new_location
@property
def location(self) -> Point:
return self._location
@property
def last_location(self) -> Point:
return self._last_location
def maze_strategy(self, strategy: Callable[..., None]) -> None:
"""Assign a maze traversal algorithm to the agent."""
self._maze_strategy = strategy
def explore(self, maze: Maze) -> None:
"""Perform one step of the assigned maze traversal strategy."""
self._maze_strategy(self, maze)
| 30.117647 | 73 | 0.705078 | 209 | 1,536 | 5.033493 | 0.287081 | 0.053232 | 0.045627 | 0.038023 | 0.104563 | 0.053232 | 0 | 0 | 0 | 0 | 0 | 0.003234 | 0.194661 | 1,536 | 50 | 74 | 30.72 | 0.847211 | 0.279948 | 0 | 0.117647 | 0 | 0 | 0.003731 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.264706 | false | 0 | 0.117647 | 0.117647 | 0.647059 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
c07feb4fe6d2f802fb8b206a8c21347466db754c | 1,673 | py | Python | packages/mccomposite/python/mccomposite/AbstractBinding.py | mcvine/mcvine | 42232534b0c6af729628009bed165cd7d833789d | [
"BSD-3-Clause"
] | 5 | 2017-01-16T03:59:47.000Z | 2020-06-23T02:54:19.000Z | packages/mccomposite/python/mccomposite/AbstractBinding.py | mcvine/mcvine | 42232534b0c6af729628009bed165cd7d833789d | [
"BSD-3-Clause"
] | 293 | 2015-10-29T17:45:52.000Z | 2022-01-07T16:31:09.000Z | packages/mccomposite/python/mccomposite/AbstractBinding.py | mcvine/mcvine | 42232534b0c6af729628009bed165cd7d833789d | [
"BSD-3-Clause"
] | 1 | 2019-05-25T00:53:31.000Z | 2019-05-25T00:53:31.000Z | #!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Jiao Lin
# California Institute of Technology
# (C) 2007 All Rights Reserved
#
# {LicenseText}
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
class AbstractBinding:
def compositescatterer(self, shape, elements, geometer):
raise NotImplementedError
def scatterercontainer(self):
raise NotImplementedError
def geometer(self):
raise NotImplementedError
def position(self, x,y,z):
"""create binding's representation of position vector
"""
raise NotImplementedError
def orientation(self, rotmat):
"""convert rotation matrix numpy instance to binding\'s representation
of rotation matrix
"""
raise NotImplementedError
def unite(self, shapes):
raise NotImplementedError
def intersect(self, shapes):
raise NotImplementedError
def subtract(self, shape1, shape2):
raise NotImplementedError
def dilate(self, shape, scale):
raise NotImplementedError
def rotate(self, shape, rotmat):
raise NotImplementedError
def translate(self, shape, vector):
raise NotImplementedError
def block(self, diagonal):
raise NotImplementedError
def sphere(self, radius):
raise NotImplementedError
def cylinder(self, radius, height):
raise NotImplementedError
pass # end of AbstractBinding
# version
__id__ = "$Id$"
# End of file
| 21.727273 | 80 | 0.563658 | 138 | 1,673 | 6.804348 | 0.471014 | 0.357827 | 0.373802 | 0.066028 | 0.078807 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004975 | 0.279139 | 1,673 | 76 | 81 | 22.013158 | 0.773632 | 0.318589 | 0 | 0.451613 | 0 | 0 | 0.00365 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.451613 | false | 0.032258 | 0 | 0 | 0.483871 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c0ba39c110d8682ee277d6e899742f9fe8b52555 | 864 | py | Python | blebox_uniapi_slozo/sensor.py | slozo/blebox_uniapi | 6c90a31ce7fe4e22e0cf0c95e3ee85de05782bcb | [
"Apache-2.0"
] | 2 | 2020-06-05T23:05:57.000Z | 2020-06-07T13:04:50.000Z | blebox_uniapi_slozo/sensor.py | slozo/blebox_uniapi | 6c90a31ce7fe4e22e0cf0c95e3ee85de05782bcb | [
"Apache-2.0"
] | 83 | 2020-03-13T03:08:13.000Z | 2021-04-26T02:04:17.000Z | blebox_uniapi_slozo/sensor.py | slozo/blebox_uniapi | 6c90a31ce7fe4e22e0cf0c95e3ee85de05782bcb | [
"Apache-2.0"
] | 7 | 2021-05-11T13:14:48.000Z | 2022-02-16T12:17:45.000Z | from .feature import Feature
class Sensor(Feature):
@property
def unit(self):
return self._unit
class Temperature(Sensor):
def __init__(self, product, alias, methods):
self._unit = "celsius"
self._device_class = "temperature"
super().__init__(product, alias, methods)
@property
def current(self):
return self._current
# TODO: use as attribute in product config
def _read_temperature(self, field):
product = self._product
if product.last_data is not None:
raw = self.raw_value(field)
if raw is not None: # no reading
alias = self._alias
return round(product.expect_int(alias, raw, 12500, -5500) / 100.0, 1)
return None
def after_update(self):
self._current = self._read_temperature("temperature")
| 27 | 85 | 0.622685 | 103 | 864 | 4.990291 | 0.456311 | 0.042802 | 0.054475 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022727 | 0.287037 | 864 | 31 | 86 | 27.870968 | 0.811688 | 0.059028 | 0 | 0.086957 | 0 | 0 | 0.035802 | 0 | 0 | 0 | 0 | 0.032258 | 0 | 1 | 0.217391 | false | 0 | 0.043478 | 0.086957 | 0.521739 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
c0cc21ba73492b769cff3dfa203d6d8caad1cbd5 | 781 | py | Python | getmodule/analyze.py | small-java-world/growth_curve_of_horse | ea23b3ad50393a4e183fa90ca8008ac232e85f7f | [
"Apache-2.0"
] | null | null | null | getmodule/analyze.py | small-java-world/growth_curve_of_horse | ea23b3ad50393a4e183fa90ca8008ac232e85f7f | [
"Apache-2.0"
] | null | null | null | getmodule/analyze.py | small-java-world/growth_curve_of_horse | ea23b3ad50393a4e183fa90ca8008ac232e85f7f | [
"Apache-2.0"
] | null | null | null | from getmodule.race_analyze_executer import RaceAnalyzeExecuter
def main():
target_sires = ['ディープインパクト', 'キングカメハメハ', 'ステイゴールド', 'ハーツクライ', 'クロフネ', 'スクリーンヒーロー']
for sire_name in target_sires:
race_analyze_executer = RaceAnalyzeExecuter(sire_name)
# 年データ(非累積)の集計
race_analyze_executer.execute(False, False)
# 年月データ(非累積)の集計
race_analyze_executer.execute(True, False)
race_analyze_executer.execute(True, False, '牡')
race_analyze_executer.execute(True, False, '牝')
# 年月データ(累積)の集計
race_analyze_executer.execute(True, True)
race_analyze_executer.execute(True, True, '牡')
race_analyze_executer.execute(True, True, '牝')
if __name__ == "__main__":
main()
| 33.956522 | 86 | 0.653009 | 88 | 781 | 5.454545 | 0.363636 | 0.20625 | 0.35625 | 0.379167 | 0.520833 | 0.520833 | 0 | 0 | 0 | 0 | 0 | 0 | 0.239437 | 781 | 22 | 87 | 35.5 | 0.808081 | 0.049936 | 0 | 0 | 0 | 0 | 0.074526 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.071429 | false | 0 | 0.071429 | 0 | 0.142857 | 0 | 0 | 0 | 0 | null | 1 | 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 | 3 |
c0e49402f52530aac1f38bd10dd54aafa355a116 | 1,592 | py | Python | test/tools/test_tools_memories.py | gitloon/sopel | 8cf460fc9ee5c53c36cdfffcf019e6df4801515e | [
"EFL-2.0"
] | null | null | null | test/tools/test_tools_memories.py | gitloon/sopel | 8cf460fc9ee5c53c36cdfffcf019e6df4801515e | [
"EFL-2.0"
] | 2 | 2022-02-09T21:53:02.000Z | 2022-02-09T21:54:52.000Z | test/tools/test_tools_memories.py | gitloon/sopel | 8cf460fc9ee5c53c36cdfffcf019e6df4801515e | [
"EFL-2.0"
] | null | null | null | """Tests for Sopel Memory data-structures"""
from __future__ import annotations
from sopel.tools import identifiers, memories
def test_sopel_identifier_memory_str():
user = identifiers.Identifier('Exirel')
memory = memories.SopelIdentifierMemory()
test_value = 'king'
memory['Exirel'] = test_value
assert user in memory
assert 'Exirel' in memory
assert 'exirel' in memory
assert 'exi' not in memory
assert '#channel' not in memory
assert memory[user] == test_value
assert memory['Exirel'] == test_value
assert memory['exirel'] == test_value
def test_sopel_identifier_memory_id():
user = identifiers.Identifier('Exirel')
memory = memories.SopelIdentifierMemory()
test_value = 'king'
memory[user] = test_value
assert user in memory
assert 'Exirel' in memory
assert 'exirel' in memory
assert 'exi' not in memory
assert '#channel' not in memory
assert memory[user] == test_value
assert memory['Exirel'] == test_value
assert memory['exirel'] == test_value
def test_sopel_identifier_memory_channel_str():
channel = identifiers.Identifier('#adminchannel')
memory = memories.SopelIdentifierMemory()
test_value = 'perfect'
memory['#adminchannel'] = test_value
assert channel in memory
assert '#adminchannel' in memory
assert '#AdminChannel' in memory
assert 'adminchannel' not in memory
assert 'Exirel' not in memory
assert memory[channel] == test_value
assert memory['#adminchannel'] == test_value
assert memory['#AdminChannel'] == test_value
| 28.428571 | 53 | 0.707915 | 188 | 1,592 | 5.824468 | 0.159574 | 0.123288 | 0.191781 | 0.093151 | 0.819178 | 0.693151 | 0.693151 | 0.624658 | 0.553425 | 0.553425 | 0 | 0 | 0.197864 | 1,592 | 55 | 54 | 28.945455 | 0.857478 | 0.023869 | 0 | 0.560976 | 0 | 0 | 0.128553 | 0 | 0 | 0 | 0 | 0 | 0.585366 | 1 | 0.073171 | false | 0 | 0.04878 | 0 | 0.121951 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c0e4d058155d426a8aca7d6a05fd23b5476118a5 | 1,101 | py | Python | setup.py | dev-japo/potion-client | c9d34770138a0fd9e86f9ceff4a8281ba3b8bdfd | [
"MIT"
] | 14 | 2015-03-28T01:59:51.000Z | 2022-01-28T23:28:27.000Z | setup.py | dev-japo/potion-client | c9d34770138a0fd9e86f9ceff4a8281ba3b8bdfd | [
"MIT"
] | 19 | 2015-09-28T15:50:23.000Z | 2022-01-12T14:58:58.000Z | setup.py | dev-japo/potion-client | c9d34770138a0fd9e86f9ceff4a8281ba3b8bdfd | [
"MIT"
] | 13 | 2015-09-28T08:02:05.000Z | 2022-01-07T20:44:29.000Z | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import codecs
from setuptools import setup
setup(
name='Potion-client',
version='2.5.1',
packages=[str('potion_client')], # https://bugs.python.org/issue13943
url='https://github.com/biosustain/potion-client',
license='MIT',
author='Lars Schöning',
author_email='lars@lyschoening.de',
description='A client for APIs written in Flask-Potion',
long_description=codecs.open('README.rst', encoding='utf-8').read(),
install_requires=[
'jsonschema>=2.4',
'requests>=2.5',
'six'
],
test_suite='nose.collector',
tests_require=[
'responses',
'nose>=1.3'
],
classifiers=[
'Development Status :: 4 - Beta',
'Topic :: Internet',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'License :: OSI Approved :: MIT License'
]
)
| 28.230769 | 74 | 0.597639 | 122 | 1,101 | 5.303279 | 0.614754 | 0.146832 | 0.193199 | 0.160742 | 0.083462 | 0 | 0 | 0 | 0 | 0 | 0 | 0.031138 | 0.241599 | 1,101 | 38 | 75 | 28.973684 | 0.743713 | 0.050863 | 0 | 0.058824 | 0 | 0 | 0.476008 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.088235 | 0 | 0.088235 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c0e89d58404902b53bf407e1b510ff03624d3125 | 1,370 | py | Python | docs/plugins/copy-cname.py | tanangular/litedom | 6728a612c124bb9ad5c55abc10b86a8bcb7c31fe | [
"MIT"
] | 268 | 2019-04-22T17:44:53.000Z | 2019-06-25T15:30:16.000Z | docs/plugins/copy-cname.py | w33zy/relift-html | 2b88c6757afa8dff6f22d3d58c72756b8ab481f1 | [
"MIT"
] | 16 | 2019-07-02T13:47:08.000Z | 2021-07-26T11:17:51.000Z | docs/plugins/copy-cname.py | w33zy/relift-html | 2b88c6757afa8dff6f22d3d58c72756b8ab481f1 | [
"MIT"
] | 13 | 2019-07-02T10:11:04.000Z | 2021-01-06T15:47:22.000Z | #coding:utf-8
# Define no-op plugin methods
def pre_build_page(page, context, data):
"""
Called prior to building a page.
:param page: The page about to be built
:param context: The context for this page (you can modify this, but you must return it)
:param data: The raw body for this page (you can modify this).
:returns: Modified (or not) context and data.
"""
return context, data
def post_build_page(page):
"""
Called after building a page.
:param page: The page that was just built.
:returns: None
"""
pass
def pre_build_static(static):
"""
Called before building (copying to the build folder) a static file.
:param static: The static file about to be built.
:returns: None
"""
pass
def post_build_static(static):
"""
Called after building (copying to the build folder) a static file.
:param static: The static file that was just built.
:returns: None
"""
pass
def pre_build(site):
"""
Called prior to building the site, after loading configuration and plugins.
A good time to register your externals.
:param site: The site about to be built.
:returns: None
"""
pass
def post_build(site):
"""
Called after building the site.
:param site: The site that was just built.
:returns: None
"""
pass
| 21.076923 | 91 | 0.649635 | 197 | 1,370 | 4.467005 | 0.309645 | 0.068182 | 0.090909 | 0.113636 | 0.501136 | 0.501136 | 0.501136 | 0.338636 | 0.338636 | 0.338636 | 0 | 0.000994 | 0.265693 | 1,370 | 64 | 92 | 21.40625 | 0.873757 | 0.681752 | 0 | 0.416667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0.416667 | 0 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
c0fbdca518f1d8733cde6a69a50b17f5acd2338e | 164 | py | Python | tests/linter.py | priyashah23/Covid-Smart-Alarm | ef2659b2c5f131fe743d249628c9404c610c420a | [
"MIT"
] | null | null | null | tests/linter.py | priyashah23/Covid-Smart-Alarm | ef2659b2c5f131fe743d249628c9404c610c420a | [
"MIT"
] | null | null | null | tests/linter.py | priyashah23/Covid-Smart-Alarm | ef2659b2c5f131fe743d249628c9404c610c420a | [
"MIT"
] | null | null | null | """
This module uses pylint to check the code format
"""
import pylint.lint
pylint_opts = ['../main.py', '../notification.py']
pylint.lint.Run(pylint_opts)
| 20.5 | 51 | 0.676829 | 23 | 164 | 4.73913 | 0.695652 | 0.183486 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.158537 | 164 | 7 | 52 | 23.428571 | 0.789855 | 0.292683 | 0 | 0 | 0 | 0 | 0.277228 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
8d06586439fda90ce63fa98d5233a3dc3b2e655b | 1,086 | py | Python | setup.py | kvoss/lsystem | 6980022e5296121f1caf236ec2e8d2ece004e787 | [
"BSD-2-Clause"
] | 7 | 2016-12-14T12:18:43.000Z | 2020-01-19T13:40:27.000Z | setup.py | kvoss/lsystem | 6980022e5296121f1caf236ec2e8d2ece004e787 | [
"BSD-2-Clause"
] | 1 | 2021-06-12T03:30:46.000Z | 2021-11-23T01:00:32.000Z | setup.py | kvoss/lsystem | 6980022e5296121f1caf236ec2e8d2ece004e787 | [
"BSD-2-Clause"
] | 3 | 2016-06-05T16:47:59.000Z | 2019-10-21T16:36:46.000Z | from distutils.core import setup
CONFIG = {
'name' : 'lsystems',
'description' : 'Implementation of L-Systems',
'version' : '0.1.1',
'author' : 'Krzysztof Voss',
'author_email' : 'k.voss@usask.ca',
'license' : 'BSD',
'platforms' : ['POSIX',],
'keywords' : 'LSystem, turtle, fractals, rewrite',
'py_modules' : ['lsystem'],
'url' : 'https://github.com/kvoss/lsystem',
'download_url' : 'https://github.com/kvoss/lsystem',
'classifiers' : [
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
],
}
setup(**CONFIG)
| 31.941176 | 62 | 0.518416 | 99 | 1,086 | 5.656566 | 0.555556 | 0.271429 | 0.357143 | 0.185714 | 0.2 | 0.103571 | 0 | 0 | 0 | 0 | 0 | 0.021592 | 0.31768 | 1,086 | 33 | 63 | 32.909091 | 0.734143 | 0 | 0 | 0 | 0 | 0 | 0.586175 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.037037 | 0 | 0.037037 | 0 | 0 | 0 | 0 | null | 1 | 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 | 3 |
239a87c6113ca7db3f904de9ede0b7ef945d8627 | 846 | py | Python | ParadoxTrading/Indicator/General/__init__.py | gsamarakoon/ParadoxTrading | 2c4024e60b14bf630fd141ccd4c77f197b7c901a | [
"MIT"
] | 95 | 2018-01-14T14:35:35.000Z | 2021-03-17T02:10:24.000Z | ParadoxTrading/Indicator/General/__init__.py | yutiansut/ParadoxTrading | b915d1491663443bedbb048017abeed3f7dcd4e2 | [
"MIT"
] | 2 | 2018-01-14T14:35:51.000Z | 2018-07-06T02:57:49.000Z | ParadoxTrading/Indicator/General/__init__.py | yutiansut/ParadoxTrading | b915d1491663443bedbb048017abeed3f7dcd4e2 | [
"MIT"
] | 25 | 2018-01-14T14:38:08.000Z | 2020-07-15T16:03:04.000Z | from .AdaBBands import AdaBBands
from .AdaKalman import AdaKalman
from .ATR import ATR
from .BBands import BBands
from .BIAS import BIAS
from .CCI import CCI
from .Diff import Diff
from .EFF import EFF
from .EMA import EMA
from .FastBBands import FastBBands
from .FastMA import FastMA
from .FastSTD import FastSTD
from .FastVolatility import FastVolatility
from .GARCH import GARCH
from .Kalman import Kalman
from .KDJ import KDJ
from .Kurtosis import Kurtosis
from .LogReturn import LogReturn
from .MA import MA
from .MACD import MACD
from .MAX import MAX
from .MIN import MIN
from .Plunge import Plunge
from .ReturnRate import ReturnRate
from .RSI import RSI
from .RSRS import RSRS
from .SAR import SAR
from .SharpRate import SharpRate
from .SimMA import SimMA
from .STD import STD
from .Volatility import Volatility
from .ZigZag import ZigZag
| 25.636364 | 42 | 0.810875 | 128 | 846 | 5.359375 | 0.265625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1513 | 846 | 32 | 43 | 26.4375 | 0.955432 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
23b89e4a92fb7b77379915d4168af16ae0a411e2 | 630 | py | Python | BurstCube/tests/test_plotSim.py | lepalmer/Simulation | 423b400b6124f6418f2903cc5f0a6ce553465602 | [
"MIT"
] | null | null | null | BurstCube/tests/test_plotSim.py | lepalmer/Simulation | 423b400b6124f6418f2903cc5f0a6ce553465602 | [
"MIT"
] | 1 | 2018-07-18T20:06:34.000Z | 2018-07-18T20:06:34.000Z | BurstCube/tests/test_plotSim.py | lepalmer/Simulation | 423b400b6124f6418f2903cc5f0a6ce553465602 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import numpy as np
from numpy.testing import assert_allclose
try:
from BurstCube.plotSim import getGBMdata
except ImportError:
pass
def test_getGBMdata():
gbmdata = getGBMdata()
aeff = np.array([6.043869, 7.1733994, 9.051345, 11.009052,
13.555708, 17.315489, 23.22683, 30.780512,
43.367252, 58.89598, 80.0014, 97.346825,
106.105095, 120.00855, 102.37214, 123.06248,
132.68503, 131.2247, 75.82555, 42.783394,
30.818037, 32.459995])
assert_allclose(aeff, gbmdata['aeff'], 1e-3)
| 26.25 | 65 | 0.595238 | 82 | 630 | 4.536585 | 0.841463 | 0.075269 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.381696 | 0.288889 | 630 | 23 | 66 | 27.391304 | 0.448661 | 0.031746 | 0 | 0 | 0 | 0 | 0.006568 | 0 | 0 | 0 | 0 | 0 | 0.133333 | 1 | 0.066667 | false | 0.066667 | 0.266667 | 0 | 0.333333 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
23d2f3444e6d7f8919a7c6036fc89a47f65d6509 | 899 | py | Python | main.py | zhaipro/TMA | 07601d2fa9279bfdd2cc3a511d9d7545ab6b5ebc | [
"MIT"
] | null | null | null | main.py | zhaipro/TMA | 07601d2fa9279bfdd2cc3a511d9d7545ab6b5ebc | [
"MIT"
] | null | null | null | main.py | zhaipro/TMA | 07601d2fa9279bfdd2cc3a511d9d7545ab6b5ebc | [
"MIT"
] | 1 | 2020-01-15T05:38:24.000Z | 2020-01-15T05:38:24.000Z | # coding: utf-8
from math import cos, atan2, acos
import numpy as np
DIM = 1024
DM1 = DIM - 1
def _sq(x):
return x * x
def _cb(x):
return abs(x * x * x)
def _cr(x):
return x ** (1 / 3)
# 来自 Martin Büttner 的作品
def RD(i, j): # NOQA
return _sq(cos(atan2(j - 512, i - 512) / 2)) * 255
def GR(i, j): # NOQA
return _sq(cos(atan2(j - 512, i - 512) / 2 - 2 * acos(-1) / 3)) * 255
def BL(i, j): # NOQA
return _sq(cos(atan2(j - 512, i - 512) / 2 + 2 * acos(-1) / 3)) * 255
if __name__ == '__main__':
img = np.zeros((DIM, DIM, 3), dtype=np.uint8)
for i in range(DIM):
for j in range(DIM):
img[i, j, 2] = int(RD(i, j)) & 255
img[i, j, 1] = int(GR(i, j)) & 255
img[i, j, 0] = int(BL(i, j)) & 255
fp = open('MathPic.ppm', 'wb')
fp.write(f'P6\n{DIM} {DIM}\n255\n'.encode())
fp.write(img)
fp.close()
| 19.12766 | 73 | 0.503893 | 165 | 899 | 2.660606 | 0.369697 | 0.041002 | 0.041002 | 0.082005 | 0.302961 | 0.302961 | 0.257403 | 0.257403 | 0.257403 | 0.257403 | 0 | 0.107029 | 0.303671 | 899 | 46 | 74 | 19.543478 | 0.594249 | 0.055617 | 0 | 0 | 0 | 0 | 0.051008 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.074074 | 0.222222 | 0.518519 | 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 | 1 | 0 | 0 | 3 |
23f6f57933a4a2ade2aba11f5cc1d29e9a90ec6d | 817 | py | Python | backend/cukiernia/migrations/0003_auto_20210411_1234.py | MatMark/ZIwG | 76cda0d1f72d3f5220ad13457d5a1ea0a0b9771a | [
"MIT"
] | 3 | 2021-03-16T11:02:13.000Z | 2021-03-16T11:03:58.000Z | backend/cukiernia/migrations/0003_auto_20210411_1234.py | MatMark/ZIwG | 76cda0d1f72d3f5220ad13457d5a1ea0a0b9771a | [
"MIT"
] | null | null | null | backend/cukiernia/migrations/0003_auto_20210411_1234.py | MatMark/ZIwG | 76cda0d1f72d3f5220ad13457d5a1ea0a0b9771a | [
"MIT"
] | null | null | null | # Generated by Django 3.2 on 2021-04-11 12:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cukiernia', '0002_remove_product_related_product_junction_id'),
]
operations = [
migrations.RemoveField(
model_name='relatedproductjunction',
name='related',
),
migrations.AddField(
model_name='relatedproductjunction',
name='related_first',
field=models.ManyToManyField(related_name='related_first', to='cukiernia.Product'),
),
migrations.AddField(
model_name='relatedproductjunction',
name='related_second',
field=models.ManyToManyField(related_name='related_second', to='cukiernia.Product'),
),
]
| 29.178571 | 96 | 0.631579 | 74 | 817 | 6.77027 | 0.5 | 0.10978 | 0.185629 | 0.209581 | 0.499002 | 0.41517 | 0.239521 | 0 | 0 | 0 | 0 | 0.029851 | 0.261934 | 817 | 27 | 97 | 30.259259 | 0.800995 | 0.052632 | 0 | 0.380952 | 1 | 0 | 0.281088 | 0.146373 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.047619 | 0 | 0.190476 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
9b00c283416aa9769b5d5523a804919de74efa85 | 1,061 | py | Python | src/genetic_packing/chromosome.py | ri-rewe-digital/robotics-packaging | 5f3e76152912f80d97ac2fb8e96f99afb9437f16 | [
"Apache-2.0"
] | 2 | 2020-09-03T12:58:56.000Z | 2020-09-03T13:01:07.000Z | src/genetic_packing/chromosome.py | ri-rewe-digital/robotics-packaging | 5f3e76152912f80d97ac2fb8e96f99afb9437f16 | [
"Apache-2.0"
] | null | null | null | src/genetic_packing/chromosome.py | ri-rewe-digital/robotics-packaging | 5f3e76152912f80d97ac2fb8e96f99afb9437f16 | [
"Apache-2.0"
] | null | null | null | import math
class BoxGenome:
def __init__(self, box_id, score):
self.id = box_id
self.score = score
class Chromosome:
def __init__(self, number_of_boxes: int):
self.number_of_boxes = number_of_boxes
self.genes = []
def calculate_box_packing_sequence(self):
bps = [BoxGenome(index, score) for (index, score) in enumerate(self.genes[:self.number_of_boxes])]
bps.sort(key=lambda box: box.score)
return bps
def get_vbo(self):
return self.genes[self.number_of_boxes:]
def __getitem__(self, item):
return self.genes[item]
def __len__(self):
return len(self.genes)
def append(self, gene):
self.genes.append(gene)
def decode_orientation(self, box_idx, orientations):
gene = self.genes[self.number_of_boxes + box_idx]
decoded_gene = math.ceil(gene * len(orientations))
orientation = orientations[max(decoded_gene, 1) - 1]
return orientation
def set_genes(self, genes: []):
self.genes = genes[:]
| 26.525 | 106 | 0.645617 | 139 | 1,061 | 4.640288 | 0.316547 | 0.125581 | 0.12093 | 0.131783 | 0.12093 | 0.12093 | 0 | 0 | 0 | 0 | 0 | 0.002506 | 0.247879 | 1,061 | 39 | 107 | 27.205128 | 0.805764 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.321429 | false | 0 | 0.035714 | 0.107143 | 0.607143 | 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 | 1 | 0 | 0 | 3 |
9b17f0267c34b37a1a8ca8cf2f403f47818edc9a | 552 | py | Python | changesets/exceptions.py | SmartElect/SmartElect | d6d35f2fa8f60e756ad5247f8f0a5f05830e92f8 | [
"Apache-2.0"
] | 23 | 2015-10-28T14:08:23.000Z | 2021-09-11T21:38:41.000Z | changesets/exceptions.py | SmartElect/SmartElect | d6d35f2fa8f60e756ad5247f8f0a5f05830e92f8 | [
"Apache-2.0"
] | 4 | 2019-12-05T20:36:10.000Z | 2020-06-05T18:41:54.000Z | changesets/exceptions.py | SmartElect/SmartElect | d6d35f2fa8f60e756ad5247f8f0a5f05830e92f8 | [
"Apache-2.0"
] | 11 | 2015-10-28T15:49:56.000Z | 2021-09-14T14:18:36.000Z | """
Custom exceptions for things that can go wrong in the
execution of changesets.
These are used more for documentation than functionality
at the moment.
"""
class ChangesetException(Exception):
pass
class NotEnoughApprovals(ChangesetException):
pass
class NotPermittedToApprove(ChangesetException):
pass
class NotPermittedToQueue(ChangesetException):
pass
class NotInApprovableStatus(ChangesetException):
pass
class NotApprovedBy(ChangesetException):
pass
class NotAnAllowedStatus(ChangesetException):
pass
| 15.333333 | 56 | 0.78442 | 52 | 552 | 8.326923 | 0.615385 | 0.124711 | 0.311778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.163043 | 552 | 35 | 57 | 15.771429 | 0.937229 | 0.273551 | 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 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
9b24be666644ea7893be9539c843a0f8685e2d3c | 767 | py | Python | 1736/main.py | pauvrepetit/leetcode | 6ad093cf543addc4dfa52d72a8e3c0d05a23b771 | [
"MIT"
] | null | null | null | 1736/main.py | pauvrepetit/leetcode | 6ad093cf543addc4dfa52d72a8e3c0d05a23b771 | [
"MIT"
] | null | null | null | 1736/main.py | pauvrepetit/leetcode | 6ad093cf543addc4dfa52d72a8e3c0d05a23b771 | [
"MIT"
] | null | null | null | # 1736. 替换隐藏数字得到的最晚时间
#
# 20210724
# huao
class Solution:
def maximumTime(self, time: str) -> str:
h1 = time[0]
h2 = time[1]
m1 = time[3]
m2 = time[4]
if h1 == '?' and h2 == '?':
h1 = '2'
h2 = '3'
elif h1 == '?':
h2 = int(h2)
h1 = '1' if h2 >= 4 else '2'
h2 = str(h2)
elif h2 == '?':
h1 = int(h1)
h2 = '3' if h1 == 2 else '9'
h1 = str(h1)
else:
pass
if m1 == '?' and m2 == '?':
m1 = '5'
m2 = '9'
elif m1 == '?':
m1 = '5'
elif m2 == '?':
m2 = '9'
else:
pass
return h1 + h2 + ":" + m1 + m2
| 20.72973 | 44 | 0.315515 | 87 | 767 | 2.781609 | 0.333333 | 0.049587 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.169399 | 0.522816 | 767 | 36 | 45 | 21.305556 | 0.491803 | 0.043025 | 0 | 0.275862 | 0 | 0 | 0.026063 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.034483 | false | 0.068966 | 0 | 0 | 0.103448 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
f1ae56ae25819632857678508588e2e88996eb54 | 116 | py | Python | Using Fuzzy Query without Mapping/ES_Config.py | Wolvarun9295/AutoComplete--Flask-Elasticsearch-PySpark | 60986892f3270746551d0092a8836c89333792e4 | [
"MIT"
] | 1 | 2022-02-17T20:27:48.000Z | 2022-02-17T20:27:48.000Z | Using Fuzzy Query without Mapping/ES_Config.py | Wolvarun9295/AutoComplete--Flask-Elasticsearch-PySpark | 60986892f3270746551d0092a8836c89333792e4 | [
"MIT"
] | null | null | null | Using Fuzzy Query without Mapping/ES_Config.py | Wolvarun9295/AutoComplete--Flask-Elasticsearch-PySpark | 60986892f3270746551d0092a8836c89333792e4 | [
"MIT"
] | null | null | null | from elasticsearch import Elasticsearch
es = Elasticsearch([{'host': 'localhost', 'port': 9200}])
index = 'movies' | 23.2 | 57 | 0.715517 | 12 | 116 | 6.916667 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.039216 | 0.12069 | 116 | 5 | 58 | 23.2 | 0.77451 | 0 | 0 | 0 | 0 | 0 | 0.196581 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
f1c300b28eb1ba31f7f76c24238bc649f8ad370f | 267 | py | Python | noodles/patterns/__init__.py | BvB93/noodles | 7547471baa18a11b8020c017388a7e208d194ef4 | [
"Apache-2.0"
] | 22 | 2016-07-26T20:42:08.000Z | 2022-02-08T16:04:25.000Z | noodles/patterns/__init__.py | BvB93/noodles | 7547471baa18a11b8020c017388a7e208d194ef4 | [
"Apache-2.0"
] | 71 | 2015-12-24T18:44:32.000Z | 2022-02-11T11:31:08.000Z | noodles/patterns/__init__.py | BvB93/noodles | 7547471baa18a11b8020c017388a7e208d194ef4 | [
"Apache-2.0"
] | 8 | 2016-12-22T10:14:28.000Z | 2020-06-05T21:01:51.000Z | from .control_flow_statements import (
conditional)
from .find_first import (find_first)
from .functional_patterns import (all, any, filter, fold, map, zip_with)
__all__ = [
'all', 'any', 'filter', 'fold', 'find_first', 'conditional', 'map',
'zip_with']
| 29.666667 | 72 | 0.692884 | 34 | 267 | 5.088235 | 0.5 | 0.156069 | 0.138728 | 0.184971 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.157303 | 267 | 8 | 73 | 33.375 | 0.768889 | 0 | 0 | 0 | 0 | 0 | 0.179775 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.428571 | 0 | 0.428571 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 3 |
f1c4a62592288941c835aefd93042fd3f76ef841 | 393 | py | Python | iterators/custom_iterator/ReverseOrderIterator.py | thecomputerguy/full-speed-python | 6ef6e5006e5a89e67c430cb5320e088e8a3410b0 | [
"MIT"
] | null | null | null | iterators/custom_iterator/ReverseOrderIterator.py | thecomputerguy/full-speed-python | 6ef6e5006e5a89e67c430cb5320e088e8a3410b0 | [
"MIT"
] | null | null | null | iterators/custom_iterator/ReverseOrderIterator.py | thecomputerguy/full-speed-python | 6ef6e5006e5a89e67c430cb5320e088e8a3410b0 | [
"MIT"
] | null | null | null | class ReverseOrderIterator():
def __init__(self, n):
self.n = n
def __iter__(self):
return self
def __next__(self):
list = []
for element in range(self.n, -1, -1):
list.append(element)
return list
def next(self):
return self.__next__()
iter = ReverseOrderIterator(10)
print(iter.next()) | 18.714286 | 45 | 0.534351 | 43 | 393 | 4.511628 | 0.418605 | 0.07732 | 0.14433 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01581 | 0.356234 | 393 | 21 | 46 | 18.714286 | 0.750988 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0 | 0.142857 | 0.571429 | 0.071429 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
f1d840fd5777b17704038cf03248ee0879d84e8c | 241 | py | Python | scripts/set_up_server.py | ofey404/yaftp-ui | 47aa58828db91654bf9f890b1ba83fc4fcea8708 | [
"BSD-2-Clause"
] | null | null | null | scripts/set_up_server.py | ofey404/yaftp-ui | 47aa58828db91654bf9f890b1ba83fc4fcea8708 | [
"BSD-2-Clause"
] | null | null | null | scripts/set_up_server.py | ofey404/yaftp-ui | 47aa58828db91654bf9f890b1ba83fc4fcea8708 | [
"BSD-2-Clause"
] | null | null | null | import yaftp
yaftp.YAFTPServer(
address=("127.0.0.1", 2121),
local_dir="tests/server_data",
auth={
"USER": "PASSWORD",
"OFEY": "404",
"ANONYMOUS": "" # Blank means login without password
}
).serve() | 21.909091 | 62 | 0.564315 | 27 | 241 | 4.962963 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.073034 | 0.261411 | 241 | 11 | 63 | 21.909091 | 0.679775 | 0.141079 | 0 | 0 | 0 | 0 | 0.262136 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.1 | 0.1 | 0 | 0.1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
f1f5716cff30edd106b2e0ea59a3cca06540c6c8 | 110 | py | Python | Python/Basicos/Uri1005_Media1.py | bragabriel/Beecrowd | a71dd9926b422b5e82ae84bb5ccd76cf3ebd292b | [
"MIT"
] | null | null | null | Python/Basicos/Uri1005_Media1.py | bragabriel/Beecrowd | a71dd9926b422b5e82ae84bb5ccd76cf3ebd292b | [
"MIT"
] | null | null | null | Python/Basicos/Uri1005_Media1.py | bragabriel/Beecrowd | a71dd9926b422b5e82ae84bb5ccd76cf3ebd292b | [
"MIT"
] | null | null | null | a = float(input())
b = float(input())
media = ((a*3.5) + (b*7.5)) / 11
print('MEDIA = {:.5f}'.format(media)) | 18.333333 | 37 | 0.527273 | 19 | 110 | 3.052632 | 0.631579 | 0.344828 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.075269 | 0.154545 | 110 | 6 | 37 | 18.333333 | 0.548387 | 0 | 0 | 0 | 0 | 0 | 0.126126 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f1f90513fa870f13cc77c4bc674bcbd7e81cbc71 | 3,448 | py | Python | myvenv/Lib/site-packages/suds/transport/https.py | Fa67/saleor-shop | 76110349162c54c8bfcae61983bb59ba8fb0f778 | [
"BSD-3-Clause"
] | null | null | null | myvenv/Lib/site-packages/suds/transport/https.py | Fa67/saleor-shop | 76110349162c54c8bfcae61983bb59ba8fb0f778 | [
"BSD-3-Clause"
] | 5 | 2020-03-24T16:37:25.000Z | 2021-06-10T21:24:54.000Z | upibo-venv/Lib/site-packages/suds/transport/https.py | smbpgroup/upibo | 625dcda9f9692c62aeb9fe8f7123a5d407c610ae | [
"BSD-3-Clause"
] | null | null | null | # This program is free software; you can redistribute it and/or modify it under
# the terms of the (LGPL) 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 Library Lesser General Public License
# for more details at ( http://www.gnu.org/licenses/lgpl.html ).
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# written by: Jeff Ortel ( jortel@redhat.com )
"""
Contains classes for authenticated HTTP transport implementations.
"""
from suds.transport import *
from suds.transport.http import HttpTransport
import urllib.request, urllib.error, urllib.parse
class HttpAuthenticated(HttpTransport):
"""
Provides basic HTTP authentication that follows the RFC-2617 specification.
As defined by specifications, credentials are provided to the server upon
request (HTTP/1.0 401 Authorization Required) by the server only.
@ivar pm: The password manager.
@ivar handler: The authentication handler.
"""
def __init__(self, **kwargs):
"""
@param kwargs: Keyword arguments.
- B{proxy} - An HTTP proxy to be specified on requests.
The proxy is defined as {protocol:proxy,}
- type: I{dict}
- default: {}
- B{timeout} - Set the URL open timeout (seconds).
- type: I{float}
- default: 90
- B{username} - The username used for HTTP authentication.
- type: I{str}
- default: None
- B{password} - The password used for HTTP authentication.
- type: I{str}
- default: None
"""
HttpTransport.__init__(self, **kwargs)
self.pm = urllib.request.HTTPPasswordMgrWithDefaultRealm()
def open(self, request):
self.addcredentials(request)
return HttpTransport.open(self, request)
def send(self, request):
self.addcredentials(request)
return HttpTransport.send(self, request)
def addcredentials(self, request):
credentials = self.credentials()
if None not in credentials:
u = credentials[0]
p = credentials[1]
self.pm.add_password(None, request.url, u, p)
def credentials(self):
return self.options.username, self.options.password
def u2handlers(self):
handlers = HttpTransport.u2handlers(self)
handlers.append(urllib.request.HTTPBasicAuthHandler(self.pm))
return handlers
class WindowsHttpAuthenticated(HttpAuthenticated):
"""
Provides Windows (NTLM) based HTTP authentication.
@author: Christopher Bess
"""
def u2handlers(self):
try:
from ntlm import HTTPNtlmAuthHandler
except ImportError:
raise Exception("Cannot import python-ntlm module")
handlers = HttpTransport.u2handlers(self)
handlers.append(HTTPNtlmAuthHandler.HTTPNtlmAuthHandler(self.pm))
return handlers
| 34.48 | 79 | 0.656903 | 399 | 3,448 | 5.654135 | 0.463659 | 0.024379 | 0.025266 | 0.034574 | 0.156915 | 0.131206 | 0.087766 | 0.039007 | 0.039007 | 0 | 0 | 0.012603 | 0.263631 | 3,448 | 99 | 80 | 34.828283 | 0.875935 | 0.517111 | 0 | 0.235294 | 0 | 0 | 0.021873 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.205882 | false | 0.088235 | 0.176471 | 0.029412 | 0.588235 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
f1f9f691835cab03618a77083a7fd18ca3534f4b | 354 | py | Python | npcirclepack/node.py | bill-bateman/npcirclepack | 7bb54ce39c8cf5b8c13abb61a805a04e8d96a8f5 | [
"0BSD"
] | null | null | null | npcirclepack/node.py | bill-bateman/npcirclepack | 7bb54ce39c8cf5b8c13abb61a805a04e8d96a8f5 | [
"0BSD"
] | null | null | null | npcirclepack/node.py | bill-bateman/npcirclepack | 7bb54ce39c8cf5b8c13abb61a805a04e8d96a8f5 | [
"0BSD"
] | null | null | null |
class Node():
def __init__(self, x, y, r):
self.x = x
self.y = y
self.r = r
self.next = None
self.prev = None
pass
@classmethod
def from_np(cls, index, pos):
return cls(pos[index][0], pos[index][1], pos[index][2])
def __str__(self):
return f"({self.x},{self.y},{self.r})" | 22.125 | 63 | 0.5 | 53 | 354 | 3.169811 | 0.45283 | 0.089286 | 0.071429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012712 | 0.333333 | 354 | 16 | 64 | 22.125 | 0.699153 | 0 | 0 | 0 | 0 | 0 | 0.079096 | 0.079096 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0.076923 | 0 | 0.153846 | 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 | 1 | 0 | 0 | 0 | 3 |
f1fbfec38af0fdb5d231c26da6a960a009054986 | 3,056 | py | Python | tests/test_cli.py | robertopreste/pypicsum | 6908245e4d451cbbbc627e9fdaa8b132a1ba1f55 | [
"MIT"
] | 2 | 2020-01-19T09:44:19.000Z | 2020-01-20T04:06:29.000Z | tests/test_cli.py | robertopreste/pypicsum | 6908245e4d451cbbbc627e9fdaa8b132a1ba1f55 | [
"MIT"
] | null | null | null | tests/test_cli.py | robertopreste/pypicsum | 6908245e4d451cbbbc627e9fdaa8b132a1ba1f55 | [
"MIT"
] | 1 | 2020-01-19T10:09:03.000Z | 2020-01-19T10:09:03.000Z | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Created by Roberto Preste
import pytest
import os
from click.testing import CliRunner
from pypicsum import cli
from tests.diff_finder import equal_imgs
IMGDIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "imgs")
TESTIMG = os.path.join(IMGDIR, "test_img.png")
def test_img_500x500_id_3(img_500x500_id_3):
"""Test retrieval of a 500x500 img with id 3."""
runner = CliRunner()
result = runner.invoke(cli.main, ["-W", "500", "-H", "500",
"-i", "3", "-s", TESTIMG])
assert result.exit_code == 0
assert equal_imgs(img_500x500_id_3, TESTIMG)
def test_img_800x600_id_5(img_800x600_id_5):
"""Test retrieval of a 800x600 img with id 5."""
runner = CliRunner()
result = runner.invoke(cli.main, ["-W", "800", "-H", "600",
"-i", "5", "-s", TESTIMG])
assert result.exit_code == 0
assert equal_imgs(img_800x600_id_5, TESTIMG)
def test_img_500x500_id_3_grayscale(img_500x500_id_3_grayscale):
"""Test retrieval of a 500x500 img in grayscale with id 3."""
runner = CliRunner()
result = runner.invoke(cli.main, ["-W", "500", "-H", "500",
"-i", "3", "-g", "-s", TESTIMG])
assert result.exit_code == 0
assert equal_imgs(img_500x500_id_3_grayscale, TESTIMG)
def test_img_500x500_id_3_blur(img_500x500_id_3_blur):
"""Test retrieval of a 500x500 img blurred with id 3."""
runner = CliRunner()
result = runner.invoke(cli.main, ["-W", "500", "-H", "500",
"-i", "3", "-b", "5",
"-s", TESTIMG])
assert result.exit_code == 0
assert equal_imgs(img_500x500_id_3_blur, TESTIMG)
def test_img_500x500_id_3_grayscale_blur(img_500x500_id_3_grayscale_blur):
"""Test retrieval of a 500x500 img in grayscale and blurred with id 3."""
runner = CliRunner()
result = runner.invoke(cli.main, ["-W", "500", "-H", "500",
"-i", "3", "-b", "3", "-g",
"-s", TESTIMG])
assert result.exit_code == 0
assert equal_imgs(img_500x500_id_3_grayscale_blur, TESTIMG)
def test_img_800x600_id_5_jpg(img_800x600_id_5_jpg):
"""Test retrieval of a 800x600 img with id 5 and jpg format."""
runner = CliRunner()
result = runner.invoke(cli.main, ["-W", "800", "-H", "600",
"-i", "5", "-s", TESTIMG, "-e", "jpg"])
assert result.exit_code == 0
assert equal_imgs(img_800x600_id_5_jpg, TESTIMG)
def test_img_800x600_id_5_jpeg(img_800x600_id_5_jpeg):
"""Test retrieval of a 800x600 img with id 5 and jpg format."""
runner = CliRunner()
result = runner.invoke(cli.main, ["-W", "800", "-H", "600",
"-i", "5", "-s", TESTIMG, "-e", "jpeg"])
assert result.exit_code == 0
assert equal_imgs(img_800x600_id_5_jpeg, TESTIMG)
def teardown_function():
os.remove(TESTIMG)
| 37.268293 | 78 | 0.594895 | 427 | 3,056 | 4 | 0.173302 | 0.028103 | 0.084309 | 0.091335 | 0.816159 | 0.763466 | 0.71897 | 0.635831 | 0.550351 | 0.53103 | 0 | 0.112533 | 0.258508 | 3,056 | 81 | 79 | 37.728395 | 0.641218 | 0.145615 | 0 | 0.433962 | 0 | 0 | 0.05521 | 0 | 0 | 0 | 0 | 0 | 0.264151 | 1 | 0.150943 | false | 0 | 0.09434 | 0 | 0.245283 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7b1b5a6bf9a68e600e72ed55ee7c5cbbd0d4c100 | 42 | py | Python | npm/__init__.py | alexsilva/django-npm | 8d5c55c0219fda074ceabdd93b3806e65a008d9e | [
"MIT"
] | null | null | null | npm/__init__.py | alexsilva/django-npm | 8d5c55c0219fda074ceabdd93b3806e65a008d9e | [
"MIT"
] | null | null | null | npm/__init__.py | alexsilva/django-npm | 8d5c55c0219fda074ceabdd93b3806e65a008d9e | [
"MIT"
] | 1 | 2019-10-17T15:13:13.000Z | 2019-10-17T15:13:13.000Z | default_app_config = 'npm.apps.NPMConfig'
| 21 | 41 | 0.809524 | 6 | 42 | 5.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.071429 | 42 | 1 | 42 | 42 | 0.820513 | 0 | 0 | 0 | 0 | 0 | 0.428571 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 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 | 3 |
7b2d0759be93fb62ead5a18ffd157de9f84743ac | 367 | py | Python | WebAXEL/migrations/squashed_migrations/0005_auto_20191229_0112.py | xhackax47/AXEL_WEB | 917cdbdd79ae364327135e09abce9d058dc1271a | [
"MIT"
] | 1 | 2020-01-17T10:51:21.000Z | 2020-01-17T10:51:21.000Z | WebAXEL/migrations/squashed_migrations/0005_auto_20191229_0112.py | xhackax47/AXEL_WEB | 917cdbdd79ae364327135e09abce9d058dc1271a | [
"MIT"
] | 8 | 2021-03-30T12:35:54.000Z | 2022-03-12T00:11:34.000Z | WebAXEL/migrations/squashed_migrations/0005_auto_20191229_0112.py | xhackax47/AXEL_WEB | 917cdbdd79ae364327135e09abce9d058dc1271a | [
"MIT"
] | null | null | null | # Generated by Django 3.0.1 on 2019-12-29 00:12
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('WebAXEL', '0004_auto_20191228_1611'),
]
operations = [
migrations.DeleteModel(
name='Choice',
),
migrations.DeleteModel(
name='Question',
),
]
| 18.35 | 47 | 0.574932 | 36 | 367 | 5.777778 | 0.777778 | 0.201923 | 0.240385 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.123016 | 0.313352 | 367 | 19 | 48 | 19.315789 | 0.702381 | 0.122616 | 0 | 0.307692 | 1 | 0 | 0.1375 | 0.071875 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.076923 | 0 | 0.307692 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
9e2941058d7b8a517e85613495c3d6cdc10a7e4e | 1,723 | py | Python | pypicloud/access/remote_user.py | HDScorpio/pypicloud | f58ac8316ab4bd97c38b088a87ed587d2cc43773 | [
"MIT"
] | null | null | null | pypicloud/access/remote_user.py | HDScorpio/pypicloud | f58ac8316ab4bd97c38b088a87ed587d2cc43773 | [
"MIT"
] | null | null | null | pypicloud/access/remote_user.py | HDScorpio/pypicloud | f58ac8316ab4bd97c38b088a87ed587d2cc43773 | [
"MIT"
] | null | null | null | from __future__ import unicode_literals
import logging
from pyramid.settings import aslist
from .base import IAccessBackend
LOG = logging.getLogger(__name__)
class RemoteUserAccessBackend(IAccessBackend):
"""
This backend allows you to authenticate against a remote LDAP server.
"""
@classmethod
def configure(cls, settings):
kwargs = super(RemoteUserAccessBackend, cls).configure(settings)
kwargs['admins'] = aslist(settings.get('auth.admins', []))
return kwargs
def __init__(self, request=None, **kwargs):
self.admins = kwargs.pop('admins')
super(RemoteUserAccessBackend, self).__init__(request, **kwargs)
def _get_password_hash(self, username):
raise RuntimeError("REMOTE_USER should never call _get_password_hash")
def verify_user(self, username, password):
# Should never call
return False
def is_admin(self, username):
if not username:
return False
return username in self.admins
def user_data(self, username=None):
if username is None:
return []
else:
return {
"username": username,
"admin": self.is_admin(username),
"groups": self.groups(username),
}
def groups(self, username=None):
return []
def group_members(self, group):
return []
def group_permissions(self, package):
return {}
def user_permissions(self, package):
return {}
def user_package_permissions(self, username):
return []
def group_package_permissions(self, group):
return []
def check_health(self):
return True, ""
| 25.338235 | 78 | 0.631457 | 181 | 1,723 | 5.812155 | 0.375691 | 0.068441 | 0.039924 | 0.034221 | 0.06654 | 0.06654 | 0 | 0 | 0 | 0 | 0 | 0 | 0.275682 | 1,723 | 67 | 79 | 25.716418 | 0.842949 | 0.051074 | 0 | 0.2 | 0 | 0 | 0.05559 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.288889 | false | 0.066667 | 0.088889 | 0.177778 | 0.688889 | 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 | 1 | 0 | 0 | 0 | 3 |
9e70eded3ad4f24b60aa30c60c884cd061cc6f78 | 341 | py | Python | src/cifar10/test.py | blyucs/enas | 7763358eefdd3e1b514b1e6aa9c4059c73bff125 | [
"Apache-2.0"
] | null | null | null | src/cifar10/test.py | blyucs/enas | 7763358eefdd3e1b514b1e6aa9c4059c73bff125 | [
"Apache-2.0"
] | null | null | null | src/cifar10/test.py | blyucs/enas | 7763358eefdd3e1b514b1e6aa9c4059c73bff125 | [
"Apache-2.0"
] | null | null | null | import numpy as np
import tensorflow as tf
with tf.compat.v1.variable_scope("aux_head"):
aux_logits = tf.Variable(0)
print(aux_logits.name)
with tf.compat.v1.variable_scope("proj"):
aux_logits = aux_logits+1
print(aux_logits.name)
with tf.compat.v1.variable_scope("avg_pool"):
aux_logits = tf.Variable(0)
print(aux_logits.name)
| 26.230769 | 46 | 0.759531 | 58 | 341 | 4.258621 | 0.362069 | 0.255061 | 0.145749 | 0.17004 | 0.708502 | 0.708502 | 0.59919 | 0.59919 | 0.59919 | 0.364372 | 0 | 0.019868 | 0.11437 | 341 | 12 | 47 | 28.416667 | 0.798013 | 0 | 0 | 0.454545 | 0 | 0 | 0.058651 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.181818 | 0 | 0.181818 | 0.272727 | 0 | 0 | 0 | null | 1 | 0 | 1 | 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 | 3 |
9e86854575c8f2ae0462560658decba376fd2254 | 519 | py | Python | posts/serializers.py | ajmasia/wordplease | 0fcea3783c74f2e2faf48ffd31ce7bed76dfb789 | [
"Unlicense"
] | null | null | null | posts/serializers.py | ajmasia/wordplease | 0fcea3783c74f2e2faf48ffd31ce7bed76dfb789 | [
"Unlicense"
] | null | null | null | posts/serializers.py | ajmasia/wordplease | 0fcea3783c74f2e2faf48ffd31ce7bed76dfb789 | [
"Unlicense"
] | null | null | null | from rest_framework.serializers import ModelSerializer
from posts.models import Post
class PostListSerializer(ModelSerializer):
class Meta:
model = Post
fields = ['id', 'title', 'snippet_text', 'image']
class NewPostSerializer(ModelSerializer):
class Meta:
model = Post
fields = ['title', 'snippet_text', 'body', 'image', 'publication_date', 'categories']
class PostDetailSerializer(ModelSerializer):
class Meta:
model = Post
fields = '__all__'
| 17.896552 | 93 | 0.66474 | 49 | 519 | 6.877551 | 0.530612 | 0.178042 | 0.21365 | 0.25816 | 0.347181 | 0.347181 | 0 | 0 | 0 | 0 | 0 | 0 | 0.231214 | 519 | 28 | 94 | 18.535714 | 0.844612 | 0 | 0 | 0.428571 | 0 | 0 | 0.160232 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.571429 | 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 | 1 | 0 | 0 | 3 |
9e95beefc021f89de89c1f0f03ca25eba3d6184a | 140 | py | Python | readthedocs/organizations/apps.py | nijel/readthedocs.org | 4869667a3f0b56d440142187583f4bf79b9bce07 | [
"MIT"
] | 1 | 2020-08-10T01:14:08.000Z | 2020-08-10T01:14:08.000Z | readthedocs/organizations/apps.py | nijel/readthedocs.org | 4869667a3f0b56d440142187583f4bf79b9bce07 | [
"MIT"
] | 11 | 2020-07-24T23:17:24.000Z | 2022-03-12T00:43:42.000Z | readthedocs/organizations/apps.py | nijel/readthedocs.org | 4869667a3f0b56d440142187583f4bf79b9bce07 | [
"MIT"
] | 1 | 2021-07-09T14:02:39.000Z | 2021-07-09T14:02:39.000Z | """Organizations app."""
from django.apps import AppConfig
class OrganizationsConfig(AppConfig):
name = 'readthedocs.organizations'
| 15.555556 | 38 | 0.757143 | 13 | 140 | 8.153846 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.135714 | 140 | 8 | 39 | 17.5 | 0.876033 | 0.128571 | 0 | 0 | 0 | 0 | 0.215517 | 0.215517 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
9eb3a6d1ab258ae0448aa935e1179c49a6831f72 | 677 | py | Python | generator/scripts/shared.py | ht32-rs/ht32-rs | 51a534f7eaa548cd5e7974bf24548e874503d984 | [
"Apache-2.0",
"MIT"
] | null | null | null | generator/scripts/shared.py | ht32-rs/ht32-rs | 51a534f7eaa548cd5e7974bf24548e874503d984 | [
"Apache-2.0",
"MIT"
] | null | null | null | generator/scripts/shared.py | ht32-rs/ht32-rs | 51a534f7eaa548cd5e7974bf24548e874503d984 | [
"Apache-2.0",
"MIT"
] | 2 | 2020-05-23T18:28:18.000Z | 2020-06-14T15:15:57.000Z | """
patch.py
Copyright 2020 Henrik Böving
Shared script functions
"""
from sys import version_info
import yaml
from generator import resource
if version_info.minor <= 6:
# py <=3.6 doesn't include importlib_resources as standard library, use a backport.
import importlib_resources as resources
else:
from importlib import resources
def read_device_table():
"""
Reads the device part table file.
"""
# since yaml.safe_load is expecting a file stream...
# inspection always gets this one wrong...
# noinspection PyTypeChecker
with resources.open_text(resource, "ht32_part_table.yaml") as ifile:
return yaml.safe_load(ifile)
| 22.566667 | 87 | 0.726736 | 92 | 677 | 5.228261 | 0.663043 | 0.045738 | 0.08316 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016605 | 0.199409 | 677 | 29 | 88 | 23.344828 | 0.870849 | 0.440177 | 0 | 0 | 0 | 0 | 0.056818 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | true | 0 | 0.5 | 0 | 0.7 | 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 | 1 | 0 | 0 | 3 |
7b59115b496fb3e9bd376eccb7dff0806b43ddf7 | 716 | py | Python | tests/test_empty.py | BvB93/Nano-Utils | 32e3a9d8715aa59134edd2b10c6c807cd548d18b | [
"Apache-2.0"
] | null | null | null | tests/test_empty.py | BvB93/Nano-Utils | 32e3a9d8715aa59134edd2b10c6c807cd548d18b | [
"Apache-2.0"
] | 29 | 2020-06-02T19:32:48.000Z | 2022-03-28T22:56:00.000Z | tests/test_empty.py | BvB93/Nano-Utils | 32e3a9d8715aa59134edd2b10c6c807cd548d18b | [
"Apache-2.0"
] | 1 | 2020-08-16T20:55:31.000Z | 2020-08-16T20:55:31.000Z | """Tests for :mod:`nanoutils.empty`."""
from collections import abc
from nanoutils import EMPTY_SEQUENCE, EMPTY_MAPPING, EMPTY_COLLECTION, EMPTY_SET, EMPTY_CONTAINER
from assertionlib import assertion
def test_empty() -> None:
"""Tests for :mod:`nanoutils.empty`."""
assertion.isinstance(EMPTY_SEQUENCE, abc.Sequence)
assertion.isinstance(EMPTY_MAPPING, abc.Mapping)
assertion.isinstance(EMPTY_COLLECTION, abc.Collection)
assertion.isinstance(EMPTY_SET, abc.Set)
assertion.isinstance(EMPTY_CONTAINER, abc.Container)
assertion.not_(EMPTY_SEQUENCE)
assertion.not_(EMPTY_MAPPING)
assertion.not_(EMPTY_COLLECTION)
assertion.not_(EMPTY_SET)
assertion.not_(EMPTY_CONTAINER)
| 34.095238 | 97 | 0.773743 | 85 | 716 | 6.270588 | 0.247059 | 0.178236 | 0.225141 | 0.075047 | 0.093809 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.124302 | 716 | 20 | 98 | 35.8 | 0.85008 | 0.093575 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.785714 | 1 | 0.071429 | true | 0 | 0.214286 | 0 | 0.285714 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7b6797a4bf843f257001eacf18b0edea783ffbdf | 478 | py | Python | mimeopen/appnotfound.py | tnhung2011/mimeopen2 | f2246614205bca8cabd5b40f24bf387bd57c9adc | [
"Apache-2.0"
] | 3 | 2017-01-02T01:54:15.000Z | 2021-12-23T01:56:46.000Z | mimeopen/appnotfound.py | tnhung2011/mimeopen2 | f2246614205bca8cabd5b40f24bf387bd57c9adc | [
"Apache-2.0"
] | 1 | 2021-12-23T01:55:08.000Z | 2021-12-23T01:55:08.000Z | mimeopen/appnotfound.py | tnhung2011/mimeopen2 | f2246614205bca8cabd5b40f24bf387bd57c9adc | [
"Apache-2.0"
] | 2 | 2020-09-28T16:11:26.000Z | 2021-12-23T01:06:30.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""application not found exception
design for application not found exception
created: 2016/3/17
author: smileboywtu
"""
class AppNotFound(Exception):
"""app not found
"""
def __init__(self, msg, *args, **kwargs):
"""init the object
"""
self.msg = msg
self.args = args
self.kwargs = kwargs
def __str__(self):
"""show message
"""
return self.msg
| 17.071429 | 45 | 0.573222 | 55 | 478 | 4.836364 | 0.618182 | 0.090226 | 0.142857 | 0.210526 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.023669 | 0.292887 | 478 | 27 | 46 | 17.703704 | 0.763314 | 0.468619 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0 | 0 | 0.571429 | 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 | 1 | 0 | 0 | 3 |
7bb635328a76b12222c99cb27dc4ad71b48366db | 566 | py | Python | vintools/_tools/__init__.py | mvinyard/vintools | 496889c8a89a41cc481b6903453de23bd4a50500 | [
"MIT"
] | 2 | 2021-08-20T01:34:56.000Z | 2021-12-20T01:40:33.000Z | vintools/_tools/__init__.py | mvinyard/vintools | 496889c8a89a41cc481b6903453de23bd4a50500 | [
"MIT"
] | null | null | null | vintools/_tools/__init__.py | mvinyard/vintools | 496889c8a89a41cc481b6903453de23bd4a50500 | [
"MIT"
] | 1 | 2021-08-28T01:24:20.000Z | 2021-08-28T01:24:20.000Z | # tools __init__.py
__author__ = ", ".join(["Michael E. Vinyard"])
__email__ = ", ".join(["vinyard@g.harvard.edu",])
# functions
from ._csv_to_markdown_table._csv_to_markdown_table import create_md_table
from ._csv_to_markdown_table._csv_to_markdown_table import quicktable
# tools imported as class objects
from ._cDNA_detector._cDNA_detector import _cDNA_detector as cDNA_detector
from ._DESeq2._batch_DESeq2 import _run_batch_DESeq2 as DESeq2
from ._deepTools._deepTools_Module import _deepTools as deepTools
from ._PoolQ._PoolQ_Module import _PoolQ as PoolQ
| 35.375 | 74 | 0.823322 | 81 | 566 | 5.123457 | 0.419753 | 0.048193 | 0.125301 | 0.173494 | 0.221687 | 0.221687 | 0.221687 | 0.221687 | 0.221687 | 0.221687 | 0 | 0.007859 | 0.100707 | 566 | 15 | 75 | 37.733333 | 0.807466 | 0.10424 | 0 | 0 | 0 | 0 | 0.085487 | 0.04175 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.75 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
7bbc29f285851bc03dc7b453b2bb448da15434cf | 131 | py | Python | app_blog/validation_rules/category_rules.py | DubstepWar/flask-blog-test | bc1bf2b662d75f73d37dd1f7f1cdc337b99cb76f | [
"MIT"
] | null | null | null | app_blog/validation_rules/category_rules.py | DubstepWar/flask-blog-test | bc1bf2b662d75f73d37dd1f7f1cdc337b99cb76f | [
"MIT"
] | null | null | null | app_blog/validation_rules/category_rules.py | DubstepWar/flask-blog-test | bc1bf2b662d75f73d37dd1f7f1cdc337b99cb76f | [
"MIT"
] | null | null | null | from typing import Dict
create_category_rules: Dict = {
'name': {
'type': 'string',
'required': True
},
}
| 14.555556 | 31 | 0.541985 | 13 | 131 | 5.307692 | 0.923077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.312977 | 131 | 8 | 32 | 16.375 | 0.766667 | 0 | 0 | 0 | 0 | 0 | 0.167939 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.142857 | 0 | 0.142857 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c8e864f02e1fd392dbf5236d3c579579e581c0f0 | 66 | py | Python | wsgi/config.py | lpolasek/inscripcionTEDx | 70fe3abd9d931f24378c1729962fd2efc3e22de5 | [
"BSD-2-Clause"
] | null | null | null | wsgi/config.py | lpolasek/inscripcionTEDx | 70fe3abd9d931f24378c1729962fd2efc3e22de5 | [
"BSD-2-Clause"
] | null | null | null | wsgi/config.py | lpolasek/inscripcionTEDx | 70fe3abd9d931f24378c1729962fd2efc3e22de5 | [
"BSD-2-Clause"
] | null | null | null | MAIL_USERNAME = 'MY_MAIL@gmail.com'
MAIL_PASSWORD = 'MY_PASSWORD'
| 22 | 35 | 0.787879 | 10 | 66 | 4.8 | 0.6 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.090909 | 66 | 2 | 36 | 33 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0.424242 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
c8eb663c519409a20a2d8f5eeebda3cdba88d697 | 1,362 | py | Python | tests/utils_test.py | phillipgreenii/loan_payoff_tools | 4ffb8a83f7fe6bf7eb37eb7165b3959422d3a515 | [
"MIT"
] | null | null | null | tests/utils_test.py | phillipgreenii/loan_payoff_tools | 4ffb8a83f7fe6bf7eb37eb7165b3959422d3a515 | [
"MIT"
] | 3 | 2015-05-03T02:16:49.000Z | 2015-05-08T21:25:01.000Z | tests/utils_test.py | phillipgreenii/loan_payoff_tools | 4ffb8a83f7fe6bf7eb37eb7165b3959422d3a515 | [
"MIT"
] | null | null | null | '''
loan_payoff_tools: Test module.
Meant for use with py.test.
Write each test as a function named test_<something>.
Read more here: http://pytest.org/
Copyright 2014, Phillip Green II
Licensed under MIT
'''
import unittest
import loan_payoff_tools.utils as utils
class UtilsTestCase(unittest.TestCase):
def test_round_up_with_0_places(self):
self.assertEqual(utils.round_up(100), 100)
self.assertEqual(utils.round_up(4.5), 5)
self.assertEqual(utils.round_up(3.2), 4)
self.assertEqual(utils.round_up(0.02), 1)
def test_round_up_with_2_places(self):
self.assertEqual(utils.round_up(100, 2), 100)
self.assertEqual(utils.round_up(4.5, 2), 4.5)
self.assertEqual(utils.round_up(3.2, 2), 3.2)
self.assertEqual(utils.round_up(0.02, 2), 0.02)
self.assertEqual(utils.round_up(0.004, 2), 0.01)
self.assertEqual(utils.round_up(0.045, 2), 0.05)
self.assertEqual(utils.round_up(0.032, 2), 0.04)
def test_round_up_with_neg_2_places(self):
self.assertEqual(utils.round_up(100, -2), 100)
self.assertEqual(utils.round_up(4.5, -2), 100)
self.assertEqual(utils.round_up(3334, -2), 3400)
self.assertEqual(utils.round_up(212, -2), 300)
self.assertEqual(utils.round_up(3490, -2), 3500)
if __name__ == '__main__':
unittest.main()
| 31.674419 | 56 | 0.681351 | 217 | 1,362 | 4.069124 | 0.308756 | 0.150623 | 0.362401 | 0.453001 | 0.638732 | 0.516421 | 0.421291 | 0.319366 | 0.169875 | 0.169875 | 0 | 0.097758 | 0.181351 | 1,362 | 42 | 57 | 32.428571 | 0.69417 | 0.148311 | 0 | 0 | 0 | 0 | 0.006944 | 0 | 0 | 0 | 0 | 0 | 0.666667 | 1 | 0.125 | false | 0 | 0.083333 | 0 | 0.25 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
740468a26f2cc5663887b063caf541a79692a2f5 | 133 | py | Python | withtool/subprocess.py | renanivo/with | a9d13cdd70abf6a8ac736532bfdfa07d675ecfef | [
"MIT"
] | 24 | 2016-01-19T20:14:02.000Z | 2021-07-17T01:10:44.000Z | withtool/subprocess.py | renanivo/with | a9d13cdd70abf6a8ac736532bfdfa07d675ecfef | [
"MIT"
] | 36 | 2016-02-19T16:55:20.000Z | 2021-03-11T14:45:02.000Z | withtool/subprocess.py | renanivo/with | a9d13cdd70abf6a8ac736532bfdfa07d675ecfef | [
"MIT"
] | 3 | 2016-10-13T13:34:50.000Z | 2021-04-30T02:26:44.000Z | import subprocess
def run(command):
try:
subprocess.check_call(command, shell=True)
except Exception:
pass
| 14.777778 | 50 | 0.654135 | 15 | 133 | 5.733333 | 0.866667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.270677 | 133 | 8 | 51 | 16.625 | 0.886598 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0.166667 | 0.166667 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
cda934fb1d71d349b3a4257e50190c32e21516b9 | 2,989 | py | Python | tests/test_config.py | audeering/audb | 6174d8c03676dd3a868572393c3cb8c295da6f04 | [
"MIT"
] | 1 | 2022-03-17T10:36:23.000Z | 2022-03-17T10:36:23.000Z | tests/test_config.py | audeering/audb | 6174d8c03676dd3a868572393c3cb8c295da6f04 | [
"MIT"
] | 143 | 2021-04-07T13:00:00.000Z | 2022-03-29T08:53:59.000Z | tests/test_config.py | audeering/audb | 6174d8c03676dd3a868572393c3cb8c295da6f04 | [
"MIT"
] | null | null | null | import os
import pytest
import audb
import audeer
def test_config_file():
audeer.mkdir(pytest.ROOT)
config_file = os.path.join(pytest.ROOT, '.audb.yaml')
# Try loading non-existing file
config = audb.core.config.load_configuration_file(config_file)
assert config == {}
# Add a custom cache entry
# and check if combining with global config works
with open(config_file, 'w') as cf:
cf.write('cache_root: ~/user\n')
config = audb.core.config.load_configuration_file(config_file)
assert config == {'cache_root': '~/user'}
global_config = audb.core.config.load_configuration_file(
audb.core.config.global_config_file
)
global_config.update(config)
assert global_config['cache_root'] == '~/user'
assert global_config['shared_cache_root'] == audb.config.SHARED_CACHE_ROOT
# Fail for wrong repositories entries
with open(config_file, 'w') as cf:
cf.write('repositories:\n')
error_msg = (
"You cannot specify an empty 'repositories:' section "
f"in the configuration file '{audb.core.define.USER_CONFIG_FILE}'."
)
with pytest.raises(ValueError, match=error_msg):
audb.core.config.load_configuration_file(config_file)
with open(config_file, 'w') as cf:
cf.write('repositories:\n')
error_msg = "You cannot specify an empty 'repositories:' section"
with pytest.raises(ValueError, match=error_msg):
audb.core.config.load_configuration_file(config_file)
with open(config_file, 'w') as cf:
cf.write('repositories:\n')
cf.write(' - host: some-host\n')
cf.write(' backend: some-backend\n')
error_msg = "Your repository is missing a 'name' entry"
with pytest.raises(ValueError, match=error_msg):
audb.core.config.load_configuration_file(config_file)
with open(config_file, 'w') as cf:
cf.write('repositories:\n')
cf.write(' - name: my-repo\n')
error_msg = "Your repository is missing a 'host' entry."
with pytest.raises(ValueError, match=error_msg):
audb.core.config.load_configuration_file(config_file)
with open(config_file, 'w') as cf:
cf.write('repositories:\n')
cf.write(' - name: my-repo\n')
cf.write(' host: some-host\n')
error_msg = "Your repository is missing a 'backend' entry"
with pytest.raises(ValueError, match=error_msg):
audb.core.config.load_configuration_file(config_file)
# Load custom repository
with open(config_file, 'w') as cf:
cf.write('repositories:\n')
cf.write(' - name: my-repo\n')
cf.write(' host: some-host\n')
cf.write(' backend: some-backend\n')
config = audb.core.config.load_configuration_file(config_file)
assert config == {
'repositories': [
{
'name': 'my-repo',
'host': 'some-host',
'backend': 'some-backend',
},
]
}
| 33.58427 | 78 | 0.643694 | 390 | 2,989 | 4.776923 | 0.187179 | 0.101986 | 0.075148 | 0.086957 | 0.706388 | 0.706388 | 0.706388 | 0.68438 | 0.63285 | 0.616747 | 0 | 0 | 0.230512 | 2,989 | 88 | 79 | 33.965909 | 0.81 | 0.053864 | 0 | 0.492537 | 0 | 0 | 0.247697 | 0.013466 | 0 | 0 | 0 | 0 | 0.074627 | 1 | 0.014925 | false | 0 | 0.059701 | 0 | 0.074627 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 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 | 3 |
cde29f17db2c1a146f0cf512fbb3d5166ed2b41e | 980 | py | Python | flask-service/AipBody.py | dmhsq/image-recognition-flask-uniapp | a1fe6a8d68c2a5178e107bd0665f14456a907a36 | [
"Apache-2.0"
] | 17 | 2021-02-25T05:40:02.000Z | 2022-02-28T03:28:19.000Z | flask-service/AipBody.py | dmhsq/image-recognition-flask-uniapp | a1fe6a8d68c2a5178e107bd0665f14456a907a36 | [
"Apache-2.0"
] | null | null | null | flask-service/AipBody.py | dmhsq/image-recognition-flask-uniapp | a1fe6a8d68c2a5178e107bd0665f14456a907a36 | [
"Apache-2.0"
] | 9 | 2021-02-03T05:49:04.000Z | 2022-01-25T03:13:02.000Z | from aip import AipBodyAnalysis
'''人体检测'''
""" 你的 APPID AK SK """
APP_ID = 'xxxxxx'
API_KEY = 'xxxxxxxx'
SECRET_KEY = 'xxxxxxxx'
client = AipBodyAnalysis(APP_ID, API_KEY, SECRET_KEY)
""" 读取图片 """
def get_file_content(filePath):
with open(filePath, 'rb') as fp:
return fp.read()
def delBody(type,image):
if(type == 1):
return __analysis(image)
if(type == 2):
return __attr(image)
if(type == 3):
return __num(image)
if(type == 4):
return __gesture(image)
if(type == 5):
return __seg(image)
""" 调用人体关键点识别 """
def __analysis(image):
return client.bodyAnalysis(image)
""" 调用人体检测与属性识别 """
def __attr(image):
return client.bodyAttr(image)
""" 调用人流量统计 """
def __num(image):
return client.bodyNum(image)
""" 调用手势识别 """
def __gesture(image):
return client.gesture(image)
""" 调用人像分割 """
def __seg(image):
return client.bodySeg(image) | 18.846154 | 54 | 0.592857 | 115 | 980 | 4.808696 | 0.46087 | 0.063291 | 0.099458 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006906 | 0.261224 | 980 | 52 | 55 | 18.846154 | 0.756906 | 0 | 0 | 0 | 0 | 0 | 0.02974 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.241379 | false | 0 | 0.034483 | 0.172414 | 0.655172 | 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 | 1 | 0 | 0 | 3 |
cdfa2e6db6641a0b605c0562fc00bfca819e3048 | 853 | py | Python | national-rail/stations_and_services_scraper/data_scrape.py | weizhi-luo/commute | a1d3e412df11971bb26db6316cf43bda29274dea | [
"MIT"
] | null | null | null | national-rail/stations_and_services_scraper/data_scrape.py | weizhi-luo/commute | a1d3e412df11971bb26db6316cf43bda29274dea | [
"MIT"
] | null | null | null | national-rail/stations_and_services_scraper/data_scrape.py | weizhi-luo/commute | a1d3e412df11971bb26db6316cf43bda29274dea | [
"MIT"
] | null | null | null | """Functions for scraping data"""
from typing import Iterable
from data_access import DataAccess
from data_model import OriginAndCallingPointNames, StationAndServices
def scrape_stations_and_services(data_access: DataAccess,
services_origin_and_calling_point_names:
Iterable[OriginAndCallingPointNames])\
-> Iterable[StationAndServices]:
"""Scrape stations and services data from national rail
:param data_access: Access to national rail data
:param services_origin_and_calling_point_names: Services' origin and
calling point names
:return: A collection of `StationAndServices`
"""
return list(map(data_access.get_station_and_services,
services_origin_and_calling_point_names))
| 40.619048 | 73 | 0.681125 | 86 | 853 | 6.453488 | 0.395349 | 0.072072 | 0.122523 | 0.172973 | 0.34955 | 0.245045 | 0 | 0 | 0 | 0 | 0 | 0 | 0.270809 | 853 | 20 | 74 | 42.65 | 0.892283 | 0.368113 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
b51a9a9f3c4a9cb4ec0ef48ddee1fc90172722c1 | 99 | py | Python | saleor/waitingblock/apps.py | Kenstogram/opensale | 5102f461fa90f2eeb13b9a0a94ef9cb86bd3a3ba | [
"BSD-3-Clause"
] | 6 | 2019-01-06T08:39:20.000Z | 2022-03-04T18:07:47.000Z | waitingblock/apps.py | Kenstogram/Waitingblock | 230ea234b4b51a05868a0773ab7d9bd7e8b7e94a | [
"MIT"
] | 11 | 2018-11-05T17:20:54.000Z | 2022-02-10T08:01:49.000Z | saleor/waitingblock/apps.py | Kenstogram/opensale | 5102f461fa90f2eeb13b9a0a94ef9cb86bd3a3ba | [
"BSD-3-Clause"
] | 1 | 2018-11-07T11:00:48.000Z | 2018-11-07T11:00:48.000Z | from django.apps import AppConfig
class WaitingblockConfig(AppConfig):
name = 'waitingblock'
| 16.5 | 36 | 0.777778 | 10 | 99 | 7.7 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.151515 | 99 | 5 | 37 | 19.8 | 0.916667 | 0 | 0 | 0 | 0 | 0 | 0.121212 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
b51e463c117370c1038792a6bc3999966e329cf6 | 131 | py | Python | meiduo_mall/apps/areas/urls.py | Gh-Helina/Meiduo_mall | 334b961b38a200bbccafc35c7e269ac837f1c8ea | [
"MIT"
] | null | null | null | meiduo_mall/apps/areas/urls.py | Gh-Helina/Meiduo_mall | 334b961b38a200bbccafc35c7e269ac837f1c8ea | [
"MIT"
] | null | null | null | meiduo_mall/apps/areas/urls.py | Gh-Helina/Meiduo_mall | 334b961b38a200bbccafc35c7e269ac837f1c8ea | [
"MIT"
] | null | null | null | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^areas/$',views.AreaView.as_view(),name='arears'),
] | 26.2 | 60 | 0.70229 | 19 | 131 | 4.789474 | 0.789474 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.122137 | 131 | 5 | 61 | 26.2 | 0.791304 | 0 | 0 | 0 | 0 | 0 | 0.106061 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
b5307107869a2b51e1705a591a5ab4215976fde5 | 457 | py | Python | src/pactor/nodes_symbol.py | kstrempel/pactor | bc12dd6253bec7c08f691697108dcabd2a1c0e00 | [
"MIT"
] | 1 | 2021-03-19T21:36:35.000Z | 2021-03-19T21:36:35.000Z | src/pactor/nodes_symbol.py | kstrempel/pactor | bc12dd6253bec7c08f691697108dcabd2a1c0e00 | [
"MIT"
] | null | null | null | src/pactor/nodes_symbol.py | kstrempel/pactor | bc12dd6253bec7c08f691697108dcabd2a1c0e00 | [
"MIT"
] | null | null | null | from uuid import uuid4
from pactor.vm import VM
from pactor.node_parent import AstNode
SYMBOLS = {"default" : uuid4()}
class SymbolNode(AstNode):
def __init__(self, name, ctx):
super().__init__(ctx)
self.__name = name
if not name in SYMBOLS:
SYMBOLS[name] = uuid4()
def run(self, vm: VM):
vm.stack.append(self)
def __repr__(self):
return ':' + self.__name
@property
def value(self):
return SYMBOLS[self.__name] | 21.761905 | 38 | 0.667396 | 63 | 457 | 4.539683 | 0.460317 | 0.111888 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008333 | 0.212254 | 457 | 21 | 39 | 21.761905 | 0.786111 | 0 | 0 | 0 | 0 | 0 | 0.017467 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.235294 | false | 0 | 0.176471 | 0.117647 | 0.588235 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
b538b24f64be200cb59f427ccedd910f02637367 | 50 | py | Python | cognite/correlation/__init__.py | cognitedata/correlation | d8ffcf2c687e9c7d27ef2c14c64379498afb5940 | [
"Apache-2.0"
] | 1 | 2019-08-22T21:21:49.000Z | 2019-08-22T21:21:49.000Z | cognite/correlation/__init__.py | cognitedata/correlation | d8ffcf2c687e9c7d27ef2c14c64379498afb5940 | [
"Apache-2.0"
] | 3 | 2019-07-11T08:12:56.000Z | 2021-06-02T00:09:51.000Z | cognite/correlation/__init__.py | cognitedata/correlation | d8ffcf2c687e9c7d27ef2c14c64379498afb5940 | [
"Apache-2.0"
] | 1 | 2022-03-02T03:30:26.000Z | 2022-03-02T03:30:26.000Z | from .correlation import *
__version__ = "0.1.5"
| 12.5 | 26 | 0.7 | 7 | 50 | 4.428571 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.071429 | 0.16 | 50 | 3 | 27 | 16.666667 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0.1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
b54a9de646c4842661d2478ff8b39617c6122a21 | 217 | py | Python | modules/cqdx.py | Iangecko/arbys | 5b2e4b4e511d5721d6a1cc447b8fbf9be43fa909 | [
"MIT"
] | 9 | 2018-10-01T05:57:17.000Z | 2019-11-10T22:46:26.000Z | modules/cqdx.py | Iangecko/arbys | 5b2e4b4e511d5721d6a1cc447b8fbf9be43fa909 | [
"MIT"
] | 7 | 2018-09-25T14:30:24.000Z | 2019-07-26T02:30:15.000Z | modules/cqdx.py | Iangecko/arbys | 5b2e4b4e511d5721d6a1cc447b8fbf9be43fa909 | [
"MIT"
] | 8 | 2018-09-25T21:06:26.000Z | 2019-07-24T17:15:56.000Z | from client import client
import discord
@client.command(trigger="cqdx")
async def command(command: str, message: discord.Message):
await message.channel.send("https://www.youtube.com/watch?v=5_bHuCwKmkI")
return
| 24.111111 | 74 | 0.778802 | 31 | 217 | 5.419355 | 0.741935 | 0.142857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005076 | 0.092166 | 217 | 8 | 75 | 27.125 | 0.847716 | 0 | 0 | 0 | 0 | 0 | 0.21659 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 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 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
b55466c35541804d512050a5f60c2c1e9336c336 | 560 | py | Python | src/onegov/town6/views/page.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | src/onegov/town6/views/page.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | src/onegov/town6/views/page.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | from onegov.core.security import Public
from onegov.org.models import News, Topic
from onegov.org.views.page import view_topic, view_news
from onegov.town6 import TownApp
from onegov.town6.layout import PageLayout, NewsLayout
@TownApp.html(model=Topic, template='topic.pt', permission=Public)
def town_view_topic(self, request):
return view_topic(self, request, PageLayout(self, request))
@TownApp.html(model=News, template='news.pt', permission=Public)
def town_view_news(self, request):
return view_news(self, request, NewsLayout(self, request))
| 35 | 66 | 0.792857 | 81 | 560 | 5.382716 | 0.345679 | 0.151376 | 0.059633 | 0.09633 | 0.133028 | 0.133028 | 0 | 0 | 0 | 0 | 0 | 0.003976 | 0.101786 | 560 | 15 | 67 | 37.333333 | 0.862823 | 0 | 0 | 0 | 0 | 0 | 0.026786 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0 | 0.454545 | 0.181818 | 0.818182 | 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 | 1 | 0 | 0 | 3 |
b558c30d7c99e560ea2d78499e0a42c5f7898de5 | 398 | py | Python | 0x03-caching/1-main.py | JoseAVallejo12/holbertonschool-web_back_end | eb514784772352b8e4873d1f648726815ab69592 | [
"MIT"
] | null | null | null | 0x03-caching/1-main.py | JoseAVallejo12/holbertonschool-web_back_end | eb514784772352b8e4873d1f648726815ab69592 | [
"MIT"
] | null | null | null | 0x03-caching/1-main.py | JoseAVallejo12/holbertonschool-web_back_end | eb514784772352b8e4873d1f648726815ab69592 | [
"MIT"
] | null | null | null | #!/usr/bin/python3
""" 1-main """
FIFOCache = __import__('1-fifo_cache').FIFOCache
my_cache = FIFOCache()
my_cache.put("A", "Hello")
my_cache.put("B", "World")
my_cache.put("C", "Holberton")
my_cache.put("D", "School")
my_cache.print_cache()
my_cache.put("E", "Battery")
my_cache.print_cache()
my_cache.put("C", "Street")
my_cache.print_cache()
my_cache.put("F", "Mission")
my_cache.print_cache()
| 23.411765 | 48 | 0.701005 | 65 | 398 | 3.969231 | 0.384615 | 0.325581 | 0.271318 | 0.263566 | 0.313953 | 0.313953 | 0.313953 | 0 | 0 | 0 | 0 | 0.00813 | 0.072864 | 398 | 16 | 49 | 24.875 | 0.691057 | 0.062814 | 0 | 0.307692 | 0 | 0 | 0.174863 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.076923 | 0 | 0.076923 | 0.307692 | 0 | 0 | 0 | null | 1 | 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 | 3 |
b56a72986b751ce938e4cfe476b09514077b9337 | 154 | py | Python | TvFY/series/apps.py | cihankarluk/TvFY | 7a9fd7ae5d7a656ecc1fc4381c219f87afbf4151 | [
"MIT"
] | 2 | 2020-10-23T18:57:24.000Z | 2021-03-19T08:47:02.000Z | TvFY/series/apps.py | cihankarluk/TvFY | 7a9fd7ae5d7a656ecc1fc4381c219f87afbf4151 | [
"MIT"
] | null | null | null | TvFY/series/apps.py | cihankarluk/TvFY | 7a9fd7ae5d7a656ecc1fc4381c219f87afbf4151 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class SeriesConfig(AppConfig):
name = "TvFY.series"
def ready(self):
from TvFY.series import signals
| 17.111111 | 39 | 0.701299 | 19 | 154 | 5.684211 | 0.736842 | 0.185185 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.220779 | 154 | 8 | 40 | 19.25 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0.071429 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
b5a3480ed1a4b66807dc8829d067ae09429d3a48 | 98 | py | Python | tests/__init__.py | awtkns/openapi-perf | 63151ee87383efabea6d6b4fb5c05c6c621c7f0f | [
"MIT"
] | 9 | 2021-04-17T03:52:39.000Z | 2022-03-03T08:05:17.000Z | tests/__init__.py | awtkns/openapi-perf | 63151ee87383efabea6d6b4fb5c05c6c621c7f0f | [
"MIT"
] | 8 | 2021-04-23T21:11:35.000Z | 2022-01-28T10:52:46.000Z | tests/__init__.py | awtkns/openapi-perf | 63151ee87383efabea6d6b4fb5c05c6c621c7f0f | [
"MIT"
] | null | null | null | from pathlib import Path
RESULTS_DIR = str(Path(__file__).parent.absolute()) + "/sample_results"
| 24.5 | 71 | 0.765306 | 13 | 98 | 5.307692 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.102041 | 98 | 3 | 72 | 32.666667 | 0.784091 | 0 | 0 | 0 | 0 | 0 | 0.153061 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
b5b93e6a15b25cca58ccd89c40d44c69448a193f | 71 | py | Python | ureactme/__init__.py | ureactme/python-ureactme | 6bf55d6c72b1276a75b933e958302a8cce5861f1 | [
"MIT"
] | 2 | 2016-05-18T18:29:40.000Z | 2016-05-19T08:12:48.000Z | ureactme/__init__.py | ureactme/python-ureactme | 6bf55d6c72b1276a75b933e958302a8cce5861f1 | [
"MIT"
] | null | null | null | ureactme/__init__.py | ureactme/python-ureactme | 6bf55d6c72b1276a75b933e958302a8cce5861f1 | [
"MIT"
] | null | null | null | from .client import Client
api_key = None
url = 'http://app.ureact.me'
| 17.75 | 28 | 0.71831 | 12 | 71 | 4.166667 | 0.916667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.140845 | 71 | 3 | 29 | 23.666667 | 0.819672 | 0 | 0 | 0 | 0 | 0 | 0.28169 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
a91920f557939aad423d1f74f324ce8083d37aeb | 102 | py | Python | ilpexp/problem/strings/__init__.py | logic-and-learning-lab/Popper-experiments | 94d7499e32c3c9b01da5fd53cddef8a8afa8d509 | [
"MIT"
] | 3 | 2022-01-30T09:51:17.000Z | 2022-03-13T20:04:09.000Z | ilpexp/problem/strings/__init__.py | logic-and-learning-lab/Popper-experiments | 94d7499e32c3c9b01da5fd53cddef8a8afa8d509 | [
"MIT"
] | 5 | 2022-01-30T09:38:12.000Z | 2022-01-31T08:34:49.000Z | ilpexp/problem/strings/__init__.py | logic-and-learning-lab/Popper-experiments | 94d7499e32c3c9b01da5fd53cddef8a8afa8d509 | [
"MIT"
] | null | null | null | from .string import StringProblem
DEFAULT_STRING_PROBLEMS = [StringProblem(i) for i in range(1, 328)] | 34 | 67 | 0.794118 | 15 | 102 | 5.266667 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.044444 | 0.117647 | 102 | 3 | 67 | 34 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
a91ccf5601845d30acd7abeddc72dea2283534e1 | 5,497 | py | Python | TreeDataView.py | vsantiago113/TkTable | 626f3b0099fa5e7d54b4381956a74b33ced240e3 | [
"MIT"
] | 10 | 2019-05-10T01:47:21.000Z | 2021-11-11T03:13:22.000Z | TreeDataView.py | vsantiago113/TkTable | 626f3b0099fa5e7d54b4381956a74b33ced240e3 | [
"MIT"
] | 1 | 2020-04-24T01:45:54.000Z | 2020-04-24T01:45:54.000Z | TreeDataView.py | vsantiago113/TkTable | 626f3b0099fa5e7d54b4381956a74b33ced240e3 | [
"MIT"
] | 6 | 2018-03-28T11:19:31.000Z | 2021-07-13T01:41:29.000Z | import tkinter as tk
from tkinter import ttk, font
class TreeDataView(tk.Frame):
def __init__(self, master, headers, height=False, scrollbar_x=True, scrollbar_y=True, selectmode=None,
left_click=None, right_click=None, double_click=None, return_key=None, **options):
tk.Frame.__init__(self, master)
def sortby(tree, col, descending):
# Sort tree contents when a column is clicked on.
# grab values to sort
data = [(tree.set(child, col), child) for child in tree.get_children('')]
# reorder data
data.sort(reverse=descending)
for indx, item in enumerate(data):
tree.move(item[1], '', indx)
# switch the heading so that it will sort in the opposite direction
tree.heading(col, command=lambda func=col: sortby(tree, col, int(not descending)))
container = tk.Frame(self)
container.pack(fill='both', expand=True)
if selectmode is None:
mode = 'extended'
else:
mode = selectmode
self.tree = ttk.Treeview(container, columns=headers, show='headings', selectmode=mode)
vsb = ttk.Scrollbar(container, orient='vertical', command=self.tree.yview)
hsb = ttk.Scrollbar(container, orient='horizontal', command=self.tree.xview)
self.tree.configure(yscrollcommand=vsb.set, xscrollcommand=hsb.set)
self.tree.grid(column=0, row=0, sticky='nsew', in_=container)
if bool(height) is True:
self.tree.configure(height=height)
if bool(scrollbar_y) is True:
vsb.grid(column=1, row=0, sticky='ns', in_=container)
if bool(scrollbar_x) is True:
hsb.grid(column=0, row=1, sticky='ew', in_=container)
container.grid_columnconfigure(0, weight=1)
container.grid_rowconfigure(0, weight=1)
for column in headers:
self.tree.heading(column, text=column, anchor='w', command=lambda c=column: sortby(self.tree, c, 0))
self.tree.column(column, width=font.Font().measure(column.title()))
if left_click:
self.tree.bind('<<TreeviewSelect>>', left_click)
if double_click:
self.tree.bind('<Double-Button-1>', double_click)
if right_click:
self.tree.bind('<Button-3>', right_click)
if return_key:
self.tree.bind('<Return>', return_key)
for index, _ in enumerate(headers):
self.tree.column(headers[index], minwidth=50, stretch=True)
# Build in functions for ttk.TreeView
def bbox(self, *arg, **kw):
return self.tree.bbox(*arg, **kw)
def get_children(self, **kw):
return self.tree.get_children(**kw)
def set_children(self, *args):
self.tree.set_children(*args)
def column(self, *args, **kwargs):
return self.tree.column(*args, **kwargs)
def delete(self, *arg):
self.tree.delete(*arg)
def detach(self, *arg):
self.tree.detach(*arg)
def exists(self, *arg):
return self.tree.exists(*arg)
def focus(self, **kw):
return self.tree.focus(**kw)
def heading(self, *args, **kwargs):
return self.tree.heading(*args, **kwargs)
def identify(self, *args):
return self.tree.identify(*args)
def identify_row(self, *arg):
return self.tree.identify_row(*arg)
def identify_column(self, *arg):
return self.tree.identify_column(*arg)
def identify_region(self, *args):
return self.tree.identify_region(*args)
def identify_element(self, *args):
return self.tree.identify_element(*args)
def index(self, *arg):
return self.tree.index(*arg)
def insert(self, *args, **kwargs):
return self.tree.insert(*args, **kwargs)
def item(self, *args, **kwargs):
return self.tree.item(*args, **kwargs)
def move(self, *args, **kwargs):
self.tree.move(*args, **kwargs)
def next(self, *arg):
return self.tree.next(*arg)
def parent(self, *arg):
return self.tree.parent(*arg)
def prev(self, *arg):
return self.tree.prev(*arg)
def reattach(self, *args):
self.tree.reattach(*args)
def see(self, *arg):
self.tree.see(*arg)
def selection(self):
return self.tree.selection()
def selection_set(self, *args):
self.tree.selection_set(*args)
def selection_add(self, *args):
self.tree.selection_add(*args)
def selection_remove(self, *args):
self.tree.selection_remove(*args)
def selection_toggle(self, *args):
self.tree.selection_toggle(*args)
def set(self, *args, **kwargs):
return self.tree.set(*args, **kwargs)
def tag_configure(self, *args, **kwargs):
return self.tree.tag_configure(*args, **kwargs)
def tag_has(self, *arg, **kw):
return self.tree.tag_has(*arg, **kw)
def xview(self, *args):
return self.tree.xview(*args)
def yview(self, *args):
return self.tree.yview(*args)
# Custom Functions
def insert_data(self, data):
self.tree.insert('', 'end', values=data)
def clear(self):
for item in self.tree.get_children():
self.tree.delete(item)
def get_all_items(self):
items = []
for item in self.tree.get_children():
items.append(self.tree.item(item, 'values'))
return items
| 30.370166 | 112 | 0.607422 | 708 | 5,497 | 4.631356 | 0.217514 | 0.126868 | 0.098201 | 0.036292 | 0.215615 | 0.127478 | 0.017078 | 0 | 0 | 0 | 0 | 0.003919 | 0.257231 | 5,497 | 180 | 113 | 30.538889 | 0.799167 | 0.036202 | 0 | 0.016667 | 0 | 0 | 0.020601 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.316667 | false | 0 | 0.016667 | 0.191667 | 0.541667 | 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 | 1 | 0 | 0 | 3 |
a92c4239472254aab7684aacb714f3be2e4c62fb | 589 | py | Python | examples/units_and_coordinates/constants_reference.py | RhnSharma/sunpy | 03700193d287156ca1922eb27c4c2ad50040e53f | [
"BSD-2-Clause"
] | 628 | 2015-01-14T17:34:10.000Z | 2022-03-29T06:07:50.000Z | examples/units_and_coordinates/constants_reference.py | RhnSharma/sunpy | 03700193d287156ca1922eb27c4c2ad50040e53f | [
"BSD-2-Clause"
] | 3,983 | 2015-01-03T11:16:21.000Z | 2022-03-31T16:55:38.000Z | examples/units_and_coordinates/constants_reference.py | RhnSharma/sunpy | 03700193d287156ca1922eb27c4c2ad50040e53f | [
"BSD-2-Clause"
] | 582 | 2015-01-14T10:09:24.000Z | 2022-03-29T06:07:12.000Z | """
===============
sunpy Constants
===============
The example shows all of the solar physics specific constants provided by sunpy.
"""
from sunpy.sun import constants as con
##############################################################################
# All constants are stored in a dictionary. A list of all available keys
# which describe each constant can be had with the following command.
print(con.constants.keys())
##############################################################################
# The following command will display all 34 constants.
print(con.print_all())
| 28.047619 | 80 | 0.52292 | 62 | 589 | 4.951613 | 0.629032 | 0.078176 | 0.123779 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003854 | 0.118846 | 589 | 20 | 81 | 29.45 | 0.587669 | 0.546689 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0.666667 | 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 | 1 | 0 | 3 |
a92d524e9ff8ae636219154d4240c08c6d321088 | 1,434 | py | Python | floodgate/client_state_machine/layer2_decoration_event/reply.py | muzudho/e-gov-vote-kifuwarabe-player-client | f33987ce5ffa4fc51f625787ed0e300fd9a2f02a | [
"MIT"
] | null | null | null | floodgate/client_state_machine/layer2_decoration_event/reply.py | muzudho/e-gov-vote-kifuwarabe-player-client | f33987ce5ffa4fc51f625787ed0e300fd9a2f02a | [
"MIT"
] | null | null | null | floodgate/client_state_machine/layer2_decoration_event/reply.py | muzudho/e-gov-vote-kifuwarabe-player-client | f33987ce5ffa4fc51f625787ed0e300fd9a2f02a | [
"MIT"
] | null | null | null | from app import app
from floodgate.client_state_machine.layer1_transition_map.reply import ReplyState as _TransitionState
from floodgate.client_state_machine.layer2_decoration_event.clean_up_vote import clean_up_vote
def create():
"""ステート生成"""
return _DecoratedState()
class _DecoratedState(_TransitionState):
def __init__(self):
super().__init__()
def on_exit(self, context):
app.log.write_by_internal(
f"[DEBUG] exit/[Reply] (diagram.py 168) context.my_turn={context.my_turn} context.current_turn={context.current_turn}")
if context.my_turn == context.current_turn:
# 初手を考えます
app.log.write_by_internal(
f"(175) exit/[Reply] で初手を考えます")
m = context.go_func()
context.client_socket.send_line(f'{m}\n')
app.log.write_by_internal(
f"(178) 初手を指します m=[{m}]")
def on_agree(self, req):
"""対局条件を読み終わったところでAgreeします"""
app.log.write_by_internal(
f"[DEBUG] [Listen]on_agree (listen.py 17)")
# 常に AGREE を返します
req.context.agree_func()
def on_start(self, req):
"""自分の手番へ"""
clean_up_vote(req)
if req.context.my_turn == req.context.current_turn:
# TODO 自分の手番なら、初手を考えます
pass
else:
pass
def on_reject_c(self, req):
pass
def on_reject_s(self, req):
pass
| 29.265306 | 131 | 0.620642 | 179 | 1,434 | 4.670391 | 0.407821 | 0.029904 | 0.052632 | 0.062201 | 0.26555 | 0.191388 | 0.064593 | 0 | 0 | 0 | 0 | 0.012416 | 0.269874 | 1,434 | 48 | 132 | 29.875 | 0.786055 | 0.057183 | 0 | 0.25 | 0 | 0.03125 | 0.155172 | 0.056972 | 0 | 0 | 0 | 0.020833 | 0 | 1 | 0.21875 | false | 0.125 | 0.09375 | 0 | 0.375 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
a938ced24bcecc1034b2c5d027791b13011abf40 | 656 | py | Python | WeatherStationSensorsReader/controllers/fake_controller.py | weather-station-project/weather-station-sensors-reader | cda7902ee382248b41d14b9a2c0543817decbb4a | [
"MIT"
] | null | null | null | WeatherStationSensorsReader/controllers/fake_controller.py | weather-station-project/weather-station-sensors-reader | cda7902ee382248b41d14b9a2c0543817decbb4a | [
"MIT"
] | null | null | null | WeatherStationSensorsReader/controllers/fake_controller.py | weather-station-project/weather-station-sensors-reader | cda7902ee382248b41d14b9a2c0543817decbb4a | [
"MIT"
] | null | null | null | from controllers.controller import Controller
from dao.fake_dao import FakeDao
from sensors.fake_sensor import FakeSensor
class FakeController(Controller):
""" Represents the controller without any real sensor """
def __init__(self, server, database, user, password):
super(FakeController, self).__init__(sensor=FakeSensor(), dao=FakeDao(server=server,
database=database,
user=user,
password=password))
| 46.857143 | 97 | 0.501524 | 50 | 656 | 6.38 | 0.5 | 0.087774 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.439024 | 656 | 13 | 98 | 50.461538 | 0.866848 | 0.074695 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0.222222 | 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 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
a96562757896e76f8a6dbe52c1e7f8a00c05467f | 386 | py | Python | pages/models.py | paqman85/txtjokes | d5b9faa1fd3f797c2feee277b8cd428cc05a17ed | [
"MIT"
] | 1 | 2020-12-08T19:00:33.000Z | 2020-12-08T19:00:33.000Z | pages/models.py | paqman85/txtjokes | d5b9faa1fd3f797c2feee277b8cd428cc05a17ed | [
"MIT"
] | 3 | 2021-03-30T13:47:03.000Z | 2021-09-22T19:03:46.000Z | pages/models.py | paqman85/txtjokes | d5b9faa1fd3f797c2feee277b8cd428cc05a17ed | [
"MIT"
] | 1 | 2020-04-24T14:39:03.000Z | 2020-04-24T14:39:03.000Z | from django.db import models
from django.core.validators import RegexValidator
class PhoneModel(models.Model):
phone_regex = RegexValidator(regex=r'^\+?1?\d{9,15}$', message="Phone number must be entered in the format: '+999999999'. Up to 15 digits allowed.")
phone_number = models.CharField(validators=[phone_regex], max_length=17, blank=True) # validators should be a list
| 42.888889 | 152 | 0.756477 | 56 | 386 | 5.142857 | 0.714286 | 0.069444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.050445 | 0.126943 | 386 | 8 | 153 | 48.25 | 0.804154 | 0.069948 | 0 | 0 | 0 | 0 | 0.272472 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
a97af09351d2c4e31a93a13e4c5eb082aad1d75c | 127 | py | Python | lab_session/networkx_tuto.py | sowmyamanojna/BT3051-Data-Structures-and-Algorithms | 09c17e42c2e173a6ab10339f08fbc1505db8ea56 | [
"MIT"
] | 1 | 2021-05-13T13:10:42.000Z | 2021-05-13T13:10:42.000Z | lab_session/networkx_tuto.py | sowmyamanojna/BT3051-Data-Structures-and-Algorithms | 09c17e42c2e173a6ab10339f08fbc1505db8ea56 | [
"MIT"
] | null | null | null | lab_session/networkx_tuto.py | sowmyamanojna/BT3051-Data-Structures-and-Algorithms | 09c17e42c2e173a6ab10339f08fbc1505db8ea56 | [
"MIT"
] | null | null | null | import networkx as nx
import matplotlib.pyplot as plt
G = nx.Graph()
plt.show(G)
a = nx.complete_graph(5)
plt.show(nx.Graph()) | 18.142857 | 31 | 0.732283 | 24 | 127 | 3.833333 | 0.541667 | 0.152174 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009009 | 0.125984 | 127 | 7 | 32 | 18.142857 | 0.81982 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
a97cc5cdae31b9a1f616b934813529565a976a4e | 321 | py | Python | ch2/1.py | alexzhf/kid-training | ae9a4660f84f31bc988959d6e40635d621361838 | [
"MIT"
] | 1 | 2020-01-22T05:07:10.000Z | 2020-01-22T05:07:10.000Z | ch2/1.py | alexzhf/kid-training | ae9a4660f84f31bc988959d6e40635d621361838 | [
"MIT"
] | null | null | null | ch2/1.py | alexzhf/kid-training | ae9a4660f84f31bc988959d6e40635d621361838 | [
"MIT"
] | null | null | null | teacher = "Mr. Zhang"
print(teacher)
print("53+28")
print(53+28)
first = 5
second = 3
print(first + second)
third = first + second
print(third)
teacher_a="Mr. Zhang"
teacher_b=teacher_a
print(teacher_a)
print(teacher_b)
teacher_a="Mr.Yu"
print(teacher_a)
print(teacher_b)
score=7
score = score + 1
print(score)
| 10.7 | 22 | 0.713396 | 54 | 321 | 4.092593 | 0.314815 | 0.271493 | 0.176471 | 0.271493 | 0.235294 | 0.235294 | 0 | 0 | 0 | 0 | 0 | 0.043796 | 0.146417 | 321 | 29 | 23 | 11.068966 | 0.762774 | 0 | 0 | 0.210526 | 0 | 0 | 0.087227 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.526316 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
a97f1181765e2053184f8884da2f6c33de8ef084 | 349 | py | Python | diagnnose/models/wrappers/__init__.py | Kalsir/diagNNose | 06363ffe8050f792c8e6bfd8c13e51c68d327f32 | [
"MIT"
] | 35 | 2019-06-12T13:50:39.000Z | 2020-11-10T22:29:19.000Z | diagnnose/models/wrappers/__init__.py | Kalsir/diagNNose | 06363ffe8050f792c8e6bfd8c13e51c68d327f32 | [
"MIT"
] | 50 | 2019-04-07T20:22:54.000Z | 2020-11-14T12:58:27.000Z | diagnnose/models/wrappers/__init__.py | Kalsir/diagNNose | 06363ffe8050f792c8e6bfd8c13e51c68d327f32 | [
"MIT"
] | 5 | 2020-11-17T19:52:36.000Z | 2021-02-15T11:57:03.000Z | """Model wrappers define the behaviour of a specific model architecture.
These wrapper classes should inherit from :class:`LanguageModel`, or one
of its subclasses, and adhere to the signature of the ``forward`` method
that is defined for it.
"""
from .awd_lstm import AWDLSTM
from .forward_lstm import ForwardLSTM
from .google_lm import GoogleLM
| 31.727273 | 72 | 0.793696 | 52 | 349 | 5.269231 | 0.769231 | 0.072993 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.146132 | 349 | 10 | 73 | 34.9 | 0.919463 | 0.687679 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
a980e54b6736ecb55321a9724b4c96855bcfd841 | 1,001 | py | Python | councilmatic_core/migrations/0049_auto_20191114_1142.py | datamade/django-councilmatic | 5b074f376667766e4b6dbf093871d294bb35fc51 | [
"MIT"
] | 26 | 2015-12-05T03:36:49.000Z | 2022-03-05T12:17:59.000Z | councilmatic_core/migrations/0049_auto_20191114_1142.py | datamade/django-councilmatic | 5b074f376667766e4b6dbf093871d294bb35fc51 | [
"MIT"
] | 181 | 2015-10-14T18:01:19.000Z | 2021-06-30T13:52:47.000Z | councilmatic_core/migrations/0049_auto_20191114_1142.py | datamade/django-councilmatic | 5b074f376667766e4b6dbf093871d294bb35fc51 | [
"MIT"
] | 18 | 2015-10-22T09:01:24.000Z | 2020-10-22T19:33:09.000Z | # Generated by Django 2.1.14 on 2019-11-14 19:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('councilmatic_core', '0048_post_shape'),
]
operations = [
migrations.AlterModelOptions(
name='membership',
options={'base_manager_name': 'objects'},
),
migrations.AlterField(
model_name='bill',
name='slug',
field=models.SlugField(unique=True),
),
migrations.AlterField(
model_name='event',
name='slug',
field=models.SlugField(max_length=200, unique=True),
),
migrations.AlterField(
model_name='organization',
name='slug',
field=models.SlugField(max_length=200, unique=True),
),
migrations.AlterField(
model_name='person',
name='slug',
field=models.SlugField(unique=True),
),
]
| 26.342105 | 64 | 0.552448 | 92 | 1,001 | 5.891304 | 0.5 | 0.147601 | 0.184502 | 0.214022 | 0.48524 | 0.48524 | 0.431734 | 0.291513 | 0.291513 | 0.291513 | 0 | 0.03869 | 0.328671 | 1,001 | 37 | 65 | 27.054054 | 0.767857 | 0.045954 | 0 | 0.548387 | 1 | 0 | 0.114376 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.032258 | 0 | 0.129032 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a99533db9f5251680f153b7a09fe8941395ed438 | 1,829 | py | Python | onegram/actions.py | pauloromeira/onegram | 8294e237e8b8aa70c783347e42ea03d24098c48e | [
"MIT"
] | 150 | 2018-03-17T20:38:43.000Z | 2020-11-18T14:08:06.000Z | onegram/actions.py | pauloromeira/onegram | 8294e237e8b8aa70c783347e42ea03d24098c48e | [
"MIT"
] | 14 | 2018-04-08T11:39:59.000Z | 2019-08-10T14:16:23.000Z | onegram/actions.py | pauloromeira/onegram | 8294e237e8b8aa70c783347e42ea03d24098c48e | [
"MIT"
] | 11 | 2018-03-22T04:34:29.000Z | 2021-06-10T10:55:35.000Z | from .constants import URLS
from .session import sessionaware
from .queries import _user_id, _post_id
@sessionaware
def follow(session, user):
return _user_action(session, user)
@sessionaware
def unfollow(session, user):
return _user_action(session, user)
@sessionaware
def like(session, post):
return _post_action(session, post)
@sessionaware
def unlike(session, post):
return _post_action(session, post)
@sessionaware
def comment(session, commentary, post=None):
comment_text = (commentary['text'] if
isinstance(commentary, dict) else commentary)
payload = {'comment_text': comment_text}
return _post_action(session, post or commentary, payload=payload)
@sessionaware
def uncomment(session, commentary, post=None):
comment_id = (commentary['id'] if
isinstance(commentary, dict) else commentary)
return _post_action(session, post or commentary, comment_id=comment_id)
@sessionaware
def save(session, post):
return _post_action(session, post)
@sessionaware
def unsave(session, post):
return _post_action(session, post)
#######################################################################
# HELPERS #
#######################################################################
def _user_action(session, user, **kw):
user_id = _user_id(session, user)
data = _action(session, user_id=user_id, **kw)
data['user_id'] = user_id
return data
def _post_action(session, post, **kw):
post_id = _post_id(post)
data = _action(session, post_id=post_id, **kw)
data['post_id'] = post_id
return data
def _action(session, payload={}, **kw):
action = session.current_function_name
url = URLS[action](**kw)
return session.action(url, data=payload)
| 28.578125 | 75 | 0.634226 | 208 | 1,829 | 5.341346 | 0.177885 | 0.163816 | 0.122412 | 0.132313 | 0.472547 | 0.414941 | 0.342934 | 0.238524 | 0.238524 | 0 | 0 | 0 | 0.192455 | 1,829 | 63 | 76 | 29.031746 | 0.7522 | 0.003827 | 0 | 0.391304 | 0 | 0 | 0.019802 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.23913 | false | 0 | 0.065217 | 0.130435 | 0.543478 | 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 | 1 | 0 | 0 | 3 |
a99f8691a65b39eb1b664c15eceaaec49936454c | 192 | py | Python | door/urls.py | Riphiphip/website | dc5bf64f24d5cf78661686af0281705f4d1d2576 | [
"MIT"
] | null | null | null | door/urls.py | Riphiphip/website | dc5bf64f24d5cf78661686af0281705f4d1d2576 | [
"MIT"
] | null | null | null | door/urls.py | Riphiphip/website | dc5bf64f24d5cf78661686af0281705f4d1d2576 | [
"MIT"
] | null | null | null | from django.urls import path
from . import views
urlpatterns = [
path('', views.DoorView.as_view(), name='door_post'),
path('json', views.DoorJsonView.as_view(), name='get_json'),
]
| 24 | 64 | 0.682292 | 26 | 192 | 4.884615 | 0.615385 | 0.094488 | 0.15748 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.145833 | 192 | 7 | 65 | 27.428571 | 0.77439 | 0 | 0 | 0 | 0 | 0 | 0.109375 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
8d19af22ff0cdffed4b405a7bd94c5a6fb6e793e | 51 | py | Python | toascii/gradients.py | Iapetus-11/2ascii | 7b77c22819f26ab8b8fa85b55fe1c022b0590bb4 | [
"MIT"
] | 16 | 2020-11-17T14:20:19.000Z | 2022-03-27T16:25:05.000Z | toascii/gradients.py | Iapetus-11/2ascii | 7b77c22819f26ab8b8fa85b55fe1c022b0590bb4 | [
"MIT"
] | null | null | null | toascii/gradients.py | Iapetus-11/2ascii | 7b77c22819f26ab8b8fa85b55fe1c022b0590bb4 | [
"MIT"
] | 2 | 2021-10-11T21:26:41.000Z | 2022-03-11T08:44:02.000Z | BLOCK = " ░▒▓█"
HIGH = " `-~+#@"
LOW = " ¨'³•µðEÆ"
| 12.75 | 17 | 0.333333 | 8 | 51 | 2.875 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025641 | 0.235294 | 51 | 3 | 18 | 17 | 0.410256 | 0 | 0 | 0 | 0 | 0 | 0.411765 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8d3b1dc34c779d4d63c2b839304e565267bee1a0 | 4,692 | py | Python | src/server/MessageHandlers/Reply.py | JSchneidler/python-irc | f993c28e6a87b16c9e23c3f1b91fdd1f42ee2b2c | [
"MIT"
] | null | null | null | src/server/MessageHandlers/Reply.py | JSchneidler/python-irc | f993c28e6a87b16c9e23c3f1b91fdd1f42ee2b2c | [
"MIT"
] | null | null | null | src/server/MessageHandlers/Reply.py | JSchneidler/python-irc | f993c28e6a87b16c9e23c3f1b91fdd1f42ee2b2c | [
"MIT"
] | null | null | null | from lib.User import User
from lib.Channel import Channel
class Reply:
code: str
text: str
def __init__(self, code: str, text: str) -> None:
self.code = code
self.text = text
def welcome(nick: str, username: str, host: str) -> Reply:
return Reply(
"001",
f":Welcome to the Internet Relay Network {nick}!{username}@{host}",
)
def yourHost(serverName: str, version: str) -> Reply:
return Reply("002", f":Your host is {serverName}, running version {version}")
def created(date: str) -> Reply:
return Reply("003", f":This server was created {date}")
def myInfo(serverName: str, version: str, userModes: str, channelModes: str) -> Reply:
return Reply("004", f":{serverName} {version} {userModes} {channelModes}")
def needMoreParams(command: str) -> Reply:
return Reply("461", f"{command} :Not enough parameters")
def alreadyRegistered() -> Reply:
return Reply("462", ":Unauthorized command (already registered)")
def noNickGiven() -> Reply:
return Reply("431", ":No nickname given")
def nickInUse(nick: str) -> Reply:
return Reply("433", f"{nick} :Nickname is already in use")
def erroneusNick(nick: str) -> Reply:
return Reply("432", f"{nick} :Erroneous nickname")
def channelModeIs(channel: Channel) -> Reply:
return Reply("324", f"{channel.name} {channel.getSimpleModes()}")
def motdStart(server: str) -> Reply:
return Reply("375", f":- {server} Message of the day - ")
def motd(text: str) -> Reply:
return Reply("372", f":- {text}")
def endOfMotd() -> Reply:
return Reply("376", ":End of MOTD command")
def youreOper() -> Reply:
return Reply("381", ":You are now an IRC operator")
def usersStart() -> Reply:
return Reply("392", ":UserID Terminal Host")
def users(user: User, clientIdentifier: str) -> Reply:
return Reply("393", f":{user.username} * {clientIdentifier}")
def endOfUsers() -> Reply:
return Reply("394", ":End of users")
def noUsers() -> Reply:
return Reply("395", ":Nobody logged in")
def userModeIs(mode: str) -> Reply:
return Reply("221", mode)
def lUserClient(users: int, services: int) -> Reply:
return Reply("251", f":There are {users} users and {services} services on 1 server")
def lUserOp(ops: int) -> Reply:
return Reply("252", f"{ops} :operator(s) online")
def lUserUnknown(unknown: int) -> Reply:
return Reply("253", f"{unknown} :unknown connection(s)")
def lUserChannels(channels: int) -> Reply:
return Reply("254", f"{channels} :channels formed")
def lUserMe(me: int) -> Reply:
return Reply("255", f":I have {me} clients and 0 servers")
def noSuchNick(nick: str) -> Reply:
return Reply("401", f"{nick} :No such nick/channel")
def noSuchChannel(channelName: str) -> Reply:
return Reply("403", f"{channelName} :No such channel")
def usersDisabled() -> Reply:
return Reply("446", ":USERS has been disabled")
def passwordMismatch() -> Reply:
return Reply("464", ":Password incorrect")
def badChannelKey(channelName: str) -> Reply:
return Reply("475", f"{channelName} :Cannot join channel (+k)")
def userHost(user: User, clientIdentifier: str) -> Reply:
isOperator = "*" if user.isOperator() else None
isAway = "-" if user.isAway() else None
return Reply(
"302",
f":{user.nick}{isOperator}={isAway}{clientIdentifier}",
)
def channelList(channel: Channel) -> Reply:
return Reply("322", f"{channel.name} {len(channel.getAllUsers())} :{channel.topic}")
def channelListEnd() -> Reply:
return Reply("323", ":End of LIST")
def topic(channel: Channel) -> Reply:
if channel.topic:
return Reply("332", f"{channel.name} :{channel.topic}")
else:
return Reply("331", f"{channel.name} :No topic is set")
def names(channel: Channel) -> Reply:
operators = list(map(lambda opName: f"@{opName}", channel.getOperators().keys()))
users = list(channel.getUsers().keys())
return Reply("353", f"= {channel.name} :{' '.join(operators + users)}")
def endOfNames(channelName: str) -> Reply:
return Reply("366", f"{channelName} :End of NAMES list")
def time(server: str, time: str) -> Reply:
return Reply("391", f"{server} :{time}")
def unknownMode(channel: Channel, mode: str) -> Reply:
return Reply("472", f"{mode} :is unknown mode char to me for {channel.name}")
def noChannelModes(channelName: str) -> Reply:
return Reply("477", f"{channelName} :Channel doesn't support modes")
def unknownModeFlag() -> Reply:
return Reply("501", ":Unknown MODE flag")
def usersDontMatch() -> Reply:
return Reply("502", ":Cannot change mode for other users")
| 25.225806 | 88 | 0.648764 | 598 | 4,692 | 5.083612 | 0.334448 | 0.148355 | 0.194737 | 0.1125 | 0.118092 | 0 | 0 | 0 | 0 | 0 | 0 | 0.03274 | 0.186275 | 4,692 | 185 | 89 | 25.362162 | 0.763489 | 0 | 0 | 0.019802 | 0 | 0 | 0.309676 | 0.027494 | 0 | 0 | 0 | 0 | 0 | 1 | 0.405941 | false | 0.019802 | 0.019802 | 0.366337 | 0.861386 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.