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
e7e04c12223f178e65c4b0bd6810680e5a8475e1
703
py
Python
rndt/catalogue/views.py
pasing/geonode-rndt
214a0d17d4b93ae22257550d209c27cad4885692
[ "BSD-2-Clause" ]
null
null
null
rndt/catalogue/views.py
pasing/geonode-rndt
214a0d17d4b93ae22257550d209c27cad4885692
[ "BSD-2-Clause" ]
56
2021-01-19T10:06:06.000Z
2021-09-10T15:31:47.000Z
rndt/catalogue/views.py
pasing/geonode-rndt
214a0d17d4b93ae22257550d209c27cad4885692
[ "BSD-2-Clause" ]
1
2022-03-20T11:18:01.000Z
2022-03-20T11:18:01.000Z
from geonode.catalogue.views import csw_global_dispatch def csw_dispatcher(request, pa_code): return csw_global_dispatch( request, layer_filter=LayerFilters(pa_code).filter_layers, config_updater=RndtCswConfigurer(pa_code).config_updater) class LayerFilters: def __init__(self, pa_code): self.pa_code = pa_code def filter_layers(self, layers): return layers.filter(uuid__startswith=self.pa_code) class RndtCswConfigurer: def __init__(self, pa_code): self.pa_code = pa_code def config_updater(self, d: dict) -> dict: old_url = d['server']['url'] d['server']['url'] = f'{old_url}/{self.pa_code}' return d
26.037037
65
0.685633
93
703
4.817204
0.344086
0.147321
0.133929
0.058036
0.160714
0.160714
0.160714
0.160714
0.160714
0.160714
0
0
0.209104
703
26
66
27.038462
0.805755
0
0
0.222222
0
0
0.059744
0.034139
0
0
0
0
0
1
0.277778
false
0
0.055556
0.111111
0.611111
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
99c371ba9dc00af01e966883aae7c926df72ad76
24,886
py
Python
QRServer/common/messages.py
Fruktus/QuadradiusPreservationProject
6ae90cfaa015ce0e585ea723887747481f831505
[ "MIT" ]
11
2021-01-07T15:40:29.000Z
2022-03-25T00:53:50.000Z
QRServer/common/messages.py
Fruktus/QuadradiusPreservationProject
6ae90cfaa015ce0e585ea723887747481f831505
[ "MIT" ]
3
2021-02-03T10:12:05.000Z
2022-01-30T10:26:04.000Z
QRServer/common/messages.py
Fruktus/QuadradiusPreservationProject
6ae90cfaa015ce0e585ea723887747481f831505
[ "MIT" ]
3
2021-01-30T21:46:11.000Z
2022-03-25T00:53:53.000Z
from datetime import datetime from typing import List, Optional from QRServer.common import powers from QRServer.common.classes import GameResultHistory, RankingEntry, LobbyPlayer delim = '~' class Message: args: List[str] def __init__(self, args: List[str]) -> None: self.args = args for arg in self.args: if not isinstance(arg, str): raise ValueError('Wrong argument type: {}'.format(type(arg))) def to_data(self) -> bytes: return delim.join(self.args).encode('ascii') + b'\x00' def __str__(self) -> str: return self.__repr__() def __repr__(self) -> str: return '{}({})'.format(self.__class__.__name__, self.args.__repr__()) ################################################################################ # REQUESTS ################################################################################ class RequestMessage(Message): prefix = None argc = None def __init__(self, args: List[str]) -> None: super().__init__(args) prefix = self.__class__.prefix argc = self.__class__.argc if prefix is None or argc is None: raise AttributeError() if not _valid(args, prefix, argc): raise ValueError("Invalid args for {}: {}".format(__class__, args)) @staticmethod def from_data(data: bytes): return _parse_data(data.decode('ascii')) class DisconnectRequest(RequestMessage): prefix = ['<DISCONNECTED>'] argc = [1] def __init__(self, args: List[str]) -> None: super().__init__(args) @staticmethod def from_args(args: List[str]): return __class__(args) class PolicyFileRequest(RequestMessage): prefix = ['<policy-file-request/>'] argc = [1] def __init__(self, args: List[str]) -> None: super().__init__(args) @staticmethod def from_args(args: List[str]): return __class__(args) class HelloLobbyRequest(RequestMessage): prefix = ['<QR_L>'] argc = [1] def __init__(self, args: List[str]) -> None: super().__init__(args) @staticmethod def from_args(args: List[str]): return __class__(args) def get_swf_version(self): return int(self.args[1]) class JoinLobbyRequest(RequestMessage): prefix = ['<L>'] argc = [3] def __init__(self, args: List[str]) -> None: super().__init__(args) @staticmethod def from_args(args: List[str]): return __class__(args) def get_username(self): return self.args[1] def get_password(self): return self.args[2] class HelloGameRequest(RequestMessage): prefix = ['<QR_G>'] argc = [1] def __init__(self, args: List[str]) -> None: super().__init__(args) @staticmethod def from_args(args: List[str]): return __class__(args) class JoinGameRequest(RequestMessage): prefix = ['<L>'] argc = [6] def __init__(self, args: List[str]) -> None: super().__init__(args) @staticmethod def from_args(args: List[str]): return __class__(args) def get_username(self): return self.args[1] def get_auth(self): return self.args[2] def get_opponent_username(self): return self.args[3] def get_opponent_auth(self): return self.args[4] def get_password(self): return self.args[5] class ServerRecentRequest(RequestMessage): prefix = ['<SERVER>', '<RECENT>'] argc = [2] @staticmethod def from_args(args: List[str]): return __class__(args) def __init__(self, args: List[str]) -> None: super().__init__(args) class ServerRankingRequest(RequestMessage): prefix = ['<SERVER>', '<RANKING>'] argc = [4] def __init__(self, args: List[str]) -> None: super().__init__(args) self._year = int(self.args[2]) self._month = int(self.args[3]) @staticmethod def from_args(args: List[str]): return __class__(args) def get_year(self) -> int: return self._year def get_month(self) -> int: return self._month class ServerAliveRequest(RequestMessage): prefix = ['<SERVER>', '<ALIVE?>'] argc = [2] def __init__(self, args: List[str]) -> None: super().__init__(args) @staticmethod def from_args(args: List[str]): return __class__(args) class ServerPingRequest(RequestMessage): prefix = ['<SERVER>', '<PING>'] argc = [2] def __init__(self, args: List[str]) -> None: super().__init__(args) @staticmethod def from_args(args: List[str]): return __class__(args) class SetCommentRequest(RequestMessage): prefix = ['<SERVER>', '<COMMENT>'] argc = [4] def __init__(self, args: List[str]) -> None: super().__init__(args) self._idx = int(self.args[2]) self._comment = self.args[3] @staticmethod def from_args(args: List[str]): return __class__(args) def get_idx(self) -> int: return self._idx def get_comment(self) -> str: return self._comment ################################################################################ # RESPONSES ################################################################################ class ResponseMessage(Message): def __init__(self, args: List[str]) -> None: super().__init__(args) class CrossDomainPolicyAllowAllResponse(ResponseMessage): def __init__(self) -> None: super().__init__(['<cross-domain-policy><allow-access-from domain="*" to-ports="*" /></cross-domain-policy>']) class PlayerCountResponse(ResponseMessage): def __init__(self, player_count: int) -> None: super().__init__(['<S>', '<SERVER>', '<PLAYERS_COUNT>', str(player_count)]) class BroadcastCommentResponse(ResponseMessage): def __init__(self, who: int, comment: str) -> None: super().__init__(['<B>', '<COMMENT>', str(who), comment]) class OldSwfResponse(ResponseMessage): def __init__(self) -> None: super().__init__(['<S>', '<SERVER>', '<OLD_SWF>']) class NameTakenResponse(ResponseMessage): def __init__(self, taken: bool) -> None: super().__init__(['<S>', '<SERVER>', '<NAME_TAKEN>', '<YES>' if taken else '<NO>']) class ServerAliveResponse(ResponseMessage): def __init__(self) -> None: super().__init__(['<S>', '<SERVER>', '<ALIVE>']) class GameServerAliveResponse(ResponseMessage): def __init__(self) -> None: super().__init__(['<SERVER>', '<ALIVE>']) class LobbyDuplicateResponse(ResponseMessage): def __init__(self) -> None: super().__init__(['<L>', '<DUPLICATE>']) class LobbyBadMemberResponse(ResponseMessage): def __init__(self) -> None: super().__init__(['<L>', '<BAD_MEMBER>']) class LastLoggedResponse(ResponseMessage): def __init__(self, player: str, time: datetime, motd: str) -> None: super().__init__([ '<S>', '<SERVER>', '<LAST_LOGGED>', player, str(self.__last_logged_minutes(time)), motd]) def __last_logged_minutes(self, time: datetime): diff = datetime.now() - time return int(diff.total_seconds()) // 60 class LastPlayedResponse(ResponseMessage): def __init__(self, recent_games: List[GameResultHistory]) -> None: super().__init__([ '<S>', '<SERVER>', '<LAST_PLAYED>', *reversed(self.__serialize_entries(recent_games))]) def __serialize_entries(self, recent_games: List[GameResultHistory]): if recent_games is None or len(recent_games) == 0: return ['No recent battles# # '] + [self.__serialize_entry(None)] * 14 to_serialize: List[Optional[GameResultHistory]] = recent_games[0:15] while len(to_serialize) < 15: to_serialize.append(None) return [self.__serialize_entry(e) for e in to_serialize] def __serialize_entry(self, entry: Optional[GameResultHistory]): if entry is None: return ' # # ' duration_sec = (entry.finish - entry.start).total_seconds() minutes, seconds = divmod(duration_sec, 60) data = [ '{} beat {}'.format(entry.player_won, entry.player_lost), '{}-{}'.format(entry.won_score, entry.lost_score), '{:.0f}:{:02.0f}'.format(minutes, seconds), ] return '#'.join(data) class ServerRankingResponse(ResponseMessage): def __init__(self, this_month: bool, ranking: List[RankingEntry]) -> None: super().__init__([ '<S>', '<SERVER>', '<RANKING(thisMonth)>' if this_month else '<RANKING>', *self.__serialize_entries(ranking)]) def __serialize_entries(self, entries: List[RankingEntry]): to_serialize: List[Optional[RankingEntry]] = entries[0:100] return [x for e in to_serialize for x in self.__serialize_entry(e)] def __serialize_entry(self, entry: RankingEntry): return [ entry.player, str(entry.wins), str(entry.games), ] class LobbyStateResponse(ResponseMessage): def __init__(self, players: List[LobbyPlayer]) -> None: super().__init__(['<L>', *self.__serialize_players(players)]) def __serialize_players(self, players: List[LobbyPlayer]): to_serialize: List[Optional[LobbyPlayer]] = players[0:13] return [x for e in to_serialize for x in self.__serialize_player(e)] def __serialize_player(self, player: LobbyPlayer): if player is None: player = LobbyPlayer() player.username = '<EMPTY>' return [ player.username, player.comment, str(player.score), *map(str, player.awards), ] class OpponentDeadResponse(ResponseMessage): def __init__(self) -> None: super().__init__(['<S>', '<SERVER>', '<OPPDEAD>']) ################################################################################ # GENERIC MESSAGES ################################################################################ class UsePowerMessage(RequestMessage, ResponseMessage): prefix = ['<S>', '<USE_POWER>'] argc = [4, 5] def __init__(self, power_name: str, piece: int, arg: Optional[str] = None) -> None: args = [*self.prefix, power_name, str(piece)] + ([arg] if arg is not None else []) super().__init__(args) if not powers.is_valid(power_name): raise ValueError('Invalid power: {}'.format(power_name)) def get_power_name(self): return self.args[2] def get_piece(self): return int(self.args[3]) def get_power_arg(self): try: return self.args[4] except IndexError: return None @staticmethod def from_args(args: List[str]): return UsePowerMessage(args[2], int(args[3]), args[4] if len(args) > 4 else None) class GameChatMessage(RequestMessage, ResponseMessage): prefix = ['<S>', '<CHAT>'] argc = [3] def __init__(self, text: str) -> None: args = [*self.prefix, text] super().__init__(args) @staticmethod def from_args(args: List[str]): return GameChatMessage(args[2]) def get_text(self): return self.args[2] class LobbyChatMessage(RequestMessage, ResponseMessage): prefix = ['<B>', '<CHAT>'] argc = [4] def __init__(self, idx: int, text: str) -> None: args = [*self.prefix, str(idx), text] super().__init__(args) @staticmethod def from_args(args: List[str]): return LobbyChatMessage(int(args[2]), args[3]) def get_idx(self): return int(self.args[2]) def get_text(self): return self.args[3] class GrabPieceMessage(RequestMessage, ResponseMessage): prefix = ['<S>', '<GRAB_PIECE>'] argc = [3] def __init__(self, piece: int) -> None: args = [*self.prefix, str(piece)] super().__init__(args) @staticmethod def from_args(args: List[str]): return GrabPieceMessage(int(args[2])) def get_piece(self): return int(self.args[2]) class ReleasePieceMessage(RequestMessage, ResponseMessage): prefix = ['<S>', '<RELEASE_PIECE>'] argc = [3] def __init__(self, piece: int) -> None: args = [*self.prefix, str(piece)] super().__init__(args) @staticmethod def from_args(args: List[str]): return ReleasePieceMessage(int(args[2])) def get_piece(self): return int(self.args[2]) class SwitchPlayerMessage(RequestMessage, ResponseMessage): prefix = ['<S>', '<SWITCH_PLAYER>'] argc = [3] def __init__(self, piece: int) -> None: args = [*self.prefix, str(piece)] super().__init__(args) @staticmethod def from_args(args: List[str]): return SwitchPlayerMessage(int(args[2])) def get_piece(self): return int(self.args[2]) class RecursiveDoneMessage(RequestMessage, ResponseMessage): prefix = ['<S>', '<RECURSIVE_DONE>'] argc = [3] def __init__(self, piece: int) -> None: args = [*self.prefix, str(piece)] super().__init__(args) @staticmethod def from_args(args: List[str]): return RecursiveDoneMessage(int(args[2])) def get_piece(self): return int(self.args[2]) class RemovePlayerMessage(RequestMessage, ResponseMessage): prefix = ['<S>', '<REMOVE_PLAYER>'] argc = [3] def __init__(self, piece: int) -> None: args = [*self.prefix, str(piece)] super().__init__(args) @staticmethod def from_args(args: List[str]): return RemovePlayerMessage(int(args[2])) def get_piece(self): return int(self.args[2]) class PowerNoEffectMessage(RequestMessage, ResponseMessage): prefix = ['<S>', '<NO_EFFECT_OPP>'] argc = [3] def __init__(self, power_id: int) -> None: args = [*self.prefix, str(power_id)] super().__init__(args) @staticmethod def from_args(args: List[str]): return PowerNoEffectMessage(int(args[2])) def get_power_id(self): return int(self.args[2]) class NukeMessage(RequestMessage, ResponseMessage): prefix = ['<S>', '<NUKE>'] argc = [2] def __init__(self) -> None: args = [*self.prefix] super().__init__(args) @staticmethod def from_args(args: List[str]): return __class__() class JumpOnPieceMessage(RequestMessage, ResponseMessage): prefix = ['<S>', '<JUMP_ON_PIECE_ANIMATION>'] argc = [4] def __init__(self, piece: int, target_piece: int) -> None: args = [*self.prefix, str(piece), str(target_piece)] super().__init__(args) @staticmethod def from_args(args: List[str]): return JumpOnPieceMessage(int(args[2]), int(args[3])) def get_piece(self): return int(self.args[2]) def get_target_piece(self): return int(self.args[3]) class GetPowerSquareMessage(RequestMessage, ResponseMessage): prefix = ['<S>', '<GET_POWER_SQUARE>'] argc = [4] def __init__(self, square_piece: int, player_piece: int) -> None: args = [*self.prefix, str(square_piece), str(player_piece)] super().__init__(args) @staticmethod def from_args(args: List[str]): return GetPowerSquareMessage(int(args[2]), int(args[3])) def get_square_piece(self): return int(self.args[2]) def get_player_piece(self): return int(self.args[3]) class SettingsLoadedMessage(RequestMessage, ResponseMessage): prefix = ['<S>', '<SETTINGS>', '<LOADED>'] argc = [4] def __init__(self, version: int) -> None: args = [*self.prefix, str(version)] super().__init__(args) @staticmethod def from_args(args: List[str]): return SettingsLoadedMessage(int(args[3])) def get_version(self): return int(self.args[3]) class AssignPowerSquareMessage(RequestMessage, ResponseMessage): prefix = ['<S>', '<ASSIGN_POWER_SQUARE>'] argc = [4] def __init__(self, power_id: int, piece: int) -> None: args = [*self.prefix, str(power_id), str(piece)] super().__init__(args) @staticmethod def from_args(args: List[str]): return AssignPowerSquareMessage(int(args[2]), int(args[3])) def get_power_id(self): return int(self.args[2]) def get_piece(self): return int(self.args[3]) class AssignNextPowerCountMessage(RequestMessage, ResponseMessage): prefix = ['<S>', '<ASSIGN_NEXT_POWER_COUNT>'] argc = [3] def __init__(self, count: int) -> None: args = [*self.prefix, str(count)] super().__init__(args) @staticmethod def from_args(args: List[str]): return AssignNextPowerCountMessage(int(args[2])) def get_count(self): return int(self.args[2]) class NewGridCoordMessage(RequestMessage, ResponseMessage): prefix = ['<S>', '<NEW_GRID_CORD>'] argc = [6] def __init__(self, piece: int, column: int, row: int, step: int) -> None: args = [*self.prefix, str(piece), str(column), str(row), str(step)] super().__init__(args) @staticmethod def from_args(args: List[str]): return NewGridCoordMessage(int(args[2]), int(args[3]), int(args[4]), int(args[5])) def get_piece(self): return int(self.args[2]) def get_column(self): return int(self.args[3]) def get_row(self): return int(self.args[4]) def get_step(self): return int(self.args[5]) class ResignMessage(RequestMessage, ResponseMessage): prefix = ['<S>', '<SETTINGS>', '<RESIGN>'] argc = [3] def __init__(self) -> None: args = [*self.prefix] super().__init__(args) @staticmethod def from_args(args: List[str]): return __class__() class ChallengeMessage(RequestMessage, ResponseMessage): prefix = ['<S>', None, None, '<SHALLWEPLAYAGAME?>'] argc = [4] def __init__(self, challenged_idx: int, challenger_idx: int) -> None: args = [self.prefix[0], str(challenged_idx), str(challenger_idx), self.prefix[3]] super().__init__(args) @staticmethod def from_args(args: List[str]): return ChallengeMessage(int(args[1]), int(args[2])) def get_challenged_idx(self): return int(self.args[1]) def get_challenger_idx(self): return int(self.args[2]) class ChallengeAuthMessage(RequestMessage, ResponseMessage): prefix = ['<S>', None, None, '<AUTHENTICATION>'] argc = [5] def __init__(self, challenged_idx: int, challenger_idx: int, auth: str) -> None: args = [self.prefix[0], str(challenged_idx), str(challenger_idx), self.prefix[3], auth] super().__init__(args) @staticmethod def from_args(args: List[str]): return ChallengeAuthMessage(int(args[1]), int(args[2]), args[4]) def get_challenged_idx(self): return int(self.args[1]) def get_challenger_idx(self): return int(self.args[2]) def get_auth(self): return self.args[4] class SettingsReadyOffMessage(RequestMessage, ResponseMessage): prefix = ['<S>', '<SETTINGS>', '<READY_OFF>'] argc = [3] def __init__(self) -> None: args = [*self.prefix] super().__init__(args) @staticmethod def from_args(args: List[str]): return SettingsReadyOffMessage() class SettingsArenaSizeMessage(RequestMessage, ResponseMessage): prefix = ['<S>', '<SETTINGS>', '<ARENA_SIZE>'] argc = [4] valid_sizes = ['small', 'medium', '9x9', 'large', 'extraLarge'] def __init__(self, size: str) -> None: args = [*self.prefix, size] super().__init__(args) if size not in self.valid_sizes: raise ValueError('Invalid size: {}'.format(size)) @staticmethod def from_args(args: List[str]): return SettingsArenaSizeMessage(args[3]) def get_size(self): return self.args[3] class SettingsSquadronSizeMessage(RequestMessage, ResponseMessage): prefix = ['<S>', '<SETTINGS>', '<SQUADRON_SIZE>'] argc = [4] valid_sizes = ['small', 'medium', 'large', 'extraLarge'] def __init__(self, size: str) -> None: args = [*self.prefix, size] super().__init__(args) if size not in self.valid_sizes: raise ValueError('Invalid size: {}'.format(size)) @staticmethod def from_args(args: List[str]): return SettingsSquadronSizeMessage(args[3]) def get_size(self): return self.args[3] class SettingsTimerMessage(RequestMessage, ResponseMessage): prefix = ['<S>', '<SETTINGS>', '<TIMER>'] argc = [4] valid_times = [240000, 120000, 60000, 30000, 15000, 500000000] def __init__(self, time: int) -> None: args = [*self.prefix, str(time)] super().__init__(args) if time not in self.valid_times: raise ValueError('Invalid time: {}'.format(time)) @staticmethod def from_args(args: List[str]): return SettingsTimerMessage(int(args[3])) def get_time(self): return int(self.args[3]) class SettingsTopBottomMessage(RequestMessage, ResponseMessage): prefix = ['<S>', '<SETTINGS>', '<TOP_BOTTOM>'] argc = [4] def __init__(self, is_top_bottom: bool) -> None: args = [*self.prefix, 'true' if is_top_bottom else 'false'] super().__init__(args) @staticmethod def from_args(args: List[str]): return SettingsTopBottomMessage(args[3] == 'true') def is_top_bottom(self): return self.args[3] == 'true' class SettingsColorMessage(RequestMessage, ResponseMessage): prefix = ['<S>', '<SETTINGS>', '<COLOR>'] argc = [5] def __init__(self, decoration_color: int, text_color: str) -> None: args = [*self.prefix, str(decoration_color), text_color] super().__init__(args) @staticmethod def from_args(args: List[str]): return SettingsColorMessage(int(args[3]), args[4]) def get_decoration_color(self): return int(self.args[3]) def get_text_color(self): return self.args[4] class SettingsReadyOnMessage(RequestMessage, ResponseMessage): prefix = ['<S>', '<SETTINGS>', '<READY_ON>'] argc = [7] def __init__(self, grid_size: int, player_size: int, decoration_color: int, text_color: str) -> None: args = [*self.prefix, str(grid_size), str(player_size), str(decoration_color), text_color] super().__init__(args) @staticmethod def from_args(args: List[str]): return SettingsReadyOnMessage(int(args[3]), int(args[4]), int(args[5]), args[6]) def get_grid_size(self): return int(self.args[3]) def get_player_size(self): return int(self.args[4]) def get_decoration_color(self): return int(self.args[5]) def get_text_color(self): return self.args[6] class SettingsReadyOnAgainMessage(RequestMessage, ResponseMessage): prefix = ['<S>', '<SETTINGS>', '<READY_ON>'] argc = [3] def __init__(self) -> None: args = [*self.prefix] super().__init__(args) @staticmethod def from_args(args: List[str]): return SettingsReadyOnAgainMessage() ################################################################################ # UTILS ################################################################################ __message_classes = [ DisconnectRequest, PolicyFileRequest, HelloLobbyRequest, JoinLobbyRequest, HelloGameRequest, JoinGameRequest, SetCommentRequest, GameChatMessage, LobbyChatMessage, UsePowerMessage, ServerRecentRequest, ServerRankingRequest, ServerAliveRequest, ServerPingRequest, GrabPieceMessage, ReleasePieceMessage, SwitchPlayerMessage, RecursiveDoneMessage, RemovePlayerMessage, PowerNoEffectMessage, NukeMessage, ResignMessage, JumpOnPieceMessage, GetPowerSquareMessage, SettingsLoadedMessage, AssignPowerSquareMessage, AssignNextPowerCountMessage, NewGridCoordMessage, ChallengeMessage, ChallengeAuthMessage, SettingsReadyOffMessage, SettingsArenaSizeMessage, SettingsSquadronSizeMessage, SettingsTimerMessage, SettingsTopBottomMessage, SettingsColorMessage, SettingsReadyOnMessage, SettingsReadyOnAgainMessage, ] def _parse_data(data: str) -> Optional[Message]: args = data.split(delim) for clazz in __message_classes: if _valid(args, clazz.prefix, clazz.argc): try: return clazz.from_args(args) except ValueError: return None return None def _valid(args: List[str], prefix: List[str], argc: List[int]): if len(args) not in argc: return False for p, a in zip(prefix, args): if p is not None and p != a: return False return True
26.75914
118
0.609419
2,729
24,886
5.260535
0.102235
0.038451
0.042143
0.06088
0.519016
0.449429
0.414739
0.382558
0.334216
0.306562
0
0.010235
0.226593
24,886
929
119
26.787944
0.735647
0.001648
0
0.475591
0
0.001575
0.053306
0.006446
0
0
0
0
0
1
0.247244
false
0.00315
0.006299
0.146457
0.640945
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
99c57e868bb222a9876b75c64c718fc54d3bfb05
376
py
Python
spec/graph_spec.py
rwnx/bunnyplot
31f4824d683f6fb835fc3caafa58884a2f7e4730
[ "MIT" ]
1
2021-05-03T00:35:19.000Z
2021-05-03T00:35:19.000Z
spec/graph_spec.py
rwnx/bunnyplot
31f4824d683f6fb835fc3caafa58884a2f7e4730
[ "MIT" ]
null
null
null
spec/graph_spec.py
rwnx/bunnyplot
31f4824d683f6fb835fc3caafa58884a2f7e4730
[ "MIT" ]
null
null
null
from mamba import description, before, context, it, _it from expects import expect, equal, raise_error from unittest.mock import MagicMock, Mock, patch, AsyncMock, call from bunnyplot.graph import build_graph with description(build_graph) as self: with _it("should build a DiGraph"): pass with _it("should contain the correct nodes and edges"): pass
31.333333
65
0.744681
53
376
5.169811
0.641509
0.072993
0.087591
0
0
0
0
0
0
0
0
0
0.18883
376
12
66
31.333333
0.898361
0
0
0.222222
0
0
0.169761
0
0
0
0
0
0
1
0
true
0.222222
0.444444
0
0.444444
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
1
0
0
0
0
3
99c5953213429c2273a7c5a309d0599032f156de
223
py
Python
plottr/utils/testdata/__init__.py
koubitlabuiuc/plottr
c4c31a13fb7f2cf86abda1df26f67380fdcaa72b
[ "MIT" ]
19
2020-10-20T15:45:02.000Z
2022-03-15T06:39:44.000Z
plottr/utils/testdata/__init__.py
koubitlabuiuc/plottr
c4c31a13fb7f2cf86abda1df26f67380fdcaa72b
[ "MIT" ]
103
2020-04-17T15:18:50.000Z
2022-03-28T14:18:15.000Z
plottr/utils/testdata/__init__.py
koubitlabuiuc/plottr
c4c31a13fb7f2cf86abda1df26f67380fdcaa72b
[ "MIT" ]
22
2020-04-17T12:52:49.000Z
2022-02-15T21:21:44.000Z
from .testdata import ( get_2d_scalar_cos_data, get_1d_scalar_cos_data, generate_2d_scalar_simple, two_1d_traces, two_compatible_noisy_2d_sets, three_compatible_3d_sets, three_incompatible_3d_sets, one_2d_set )
37.166667
78
0.843049
36
223
4.527778
0.583333
0.09816
0.159509
0
0
0
0
0
0
0
0
0.040404
0.112108
223
5
79
44.6
0.782828
0
0
0
1
0
0
0
0
0
0
0
0
1
0
true
0
0.2
0
0.2
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
1
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
99fb5618e26b8472d6ca6be9b71d3313436174d6
588
py
Python
rldb/db/repo__openai_baselines_ea68f3b/algo__ppo2/entries.py
seungjaeryanlee/sotarl
8c471c4666d6210c68f3cb468e439a2b168c785d
[ "MIT" ]
45
2019-05-13T17:39:33.000Z
2022-03-07T23:44:13.000Z
rldb/db/repo__openai_baselines_ea68f3b/algo__ppo2/entries.py
seungjaeryanlee/sotarl
8c471c4666d6210c68f3cb468e439a2b168c785d
[ "MIT" ]
2
2019-03-29T01:41:59.000Z
2019-07-02T02:48:31.000Z
rldb/db/repo__openai_baselines_ea68f3b/algo__ppo2/entries.py
seungjaeryanlee/sotarl
8c471c4666d6210c68f3cb468e439a2b168c785d
[ "MIT" ]
2
2020-04-07T20:57:30.000Z
2020-07-08T12:55:15.000Z
entries = [ { 'env-title': 'mujoco-half-cheetah', 'score': 1668.58, }, { 'env-title': 'mujoco-hopper', 'score': 2316.16, }, { 'env-title': 'mujoco-inverted-pendulum', 'score': 809.43, }, { 'env-title': 'mujoco-swimmer', 'score': 111.19, }, { 'env-title': 'mujoco-inverted-double-pendulum', 'score': 7102.91, }, { 'env-title': 'mujoco-reacher', 'score': -6.71, }, { 'env-title': 'mujoco-walker2d', 'score': 3424.95, }, ]
18.967742
55
0.431973
54
588
4.703704
0.518519
0.220472
0.385827
0.173228
0
0
0
0
0
0
0
0.101604
0.363946
588
30
56
19.6
0.57754
0
0
0
0
0
0.387755
0.093537
0
0
0
0
0
1
0
false
0
0
0
0
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
82329348f10559af8e45862232c03e1b154e1ec2
88
py
Python
src/Python/Turtle/05C-sum.py
programmer1017/MathTech
5d7a9692d77a4a379824f691ae1cba3b0d2d4d59
[ "MIT" ]
null
null
null
src/Python/Turtle/05C-sum.py
programmer1017/MathTech
5d7a9692d77a4a379824f691ae1cba3b0d2d4d59
[ "MIT" ]
null
null
null
src/Python/Turtle/05C-sum.py
programmer1017/MathTech
5d7a9692d77a4a379824f691ae1cba3b0d2d4d59
[ "MIT" ]
null
null
null
s = 0 for x in range(1, 10+1): s = s+x print("x:", x, "sum:", s)
14.666667
36
0.352273
17
88
1.823529
0.588235
0
0
0
0
0
0
0
0
0
0
0.1
0.431818
88
5
37
17.6
0.52
0
0
0
0
0
0.068182
0
0
0
0
0
0
1
0
false
0
0
0
0
0.25
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
4156edad6b90b5da5f9b4b0bc3608c2b37a4afd7
697
py
Python
lists.py
projeto7c0/7c0-capturas
bd8464afe02caf05d7d6d1eaf31b40bb9afaf3ba
[ "MIT" ]
1
2021-08-24T23:17:46.000Z
2021-08-24T23:17:46.000Z
lists.py
projeto7c0/7c0
bd8464afe02caf05d7d6d1eaf31b40bb9afaf3ba
[ "MIT" ]
null
null
null
lists.py
projeto7c0/7c0
bd8464afe02caf05d7d6d1eaf31b40bb9afaf3ba
[ "MIT" ]
null
null
null
import twitter from database import insere_lista from database import get_all_lists from database import recupera_ids_total from database import insere_membros from database import atualiza_membros from database import prepara_atualizacao from database import deleta_membros def get_new_tweets(twitter_list): topo = recupera_ids_total(twitter_list) tweets = twitter.list_tweets(topo, twitter_list) insere_lista(tweets, twitter_list) def get_all(): return get_all_lists() def get_members(twitter_list): members = twitter.list_members(twitter_list) prepara_atualizacao() insere_membros(members, twitter_list) atualiza_membros(members) deleta_membros()
24.892857
52
0.803443
93
697
5.688172
0.258065
0.187146
0.238185
0.090737
0.102079
0.102079
0
0
0
0
0
0
0.146341
697
27
53
25.814815
0.889076
0
0
0
0
0
0
0
0
0
0
0
0
1
0.15
false
0
0.4
0.05
0.6
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
418b5e59f50cf7af1e4a26ef3b4f2498a6aa2d99
3,626
py
Python
knackpy/formatters.py
cityofaustin/knack-py
cf236649f9347218b2f29e7babd2f531cb39fc6e
[ "CC0-1.0" ]
50
2017-08-13T16:19:14.000Z
2022-02-24T05:11:35.000Z
knackpy/formatters.py
cityofaustin/knack-py
cf236649f9347218b2f29e7babd2f531cb39fc6e
[ "CC0-1.0" ]
52
2018-01-16T17:33:03.000Z
2022-03-10T21:02:47.000Z
knackpy/formatters.py
cityofaustin/knack-py
cf236649f9347218b2f29e7babd2f531cb39fc6e
[ "CC0-1.0" ]
15
2018-03-19T21:23:53.000Z
2022-02-24T05:11:37.000Z
import datetime from typing import Union def default(value: object): """Formatter functions handle Knack values by returning a formatted (aka, humanized) value. The `default()` formatter handles any field type for which another formatter function has not been defined. If the input value is a list, it returns a comma separated string of list values. Otherwise, it simply returns the input value without additional formatting. You'll notice that each formatter function's name matches its field type. If you want to write a custom formatter, do that. See also: knackpy.Fields """ if isinstance(value, list): return ", ".join(str(v) for v in value) return value def address(value: dict): """ return a string of comma-separated address elements, if present. 'latitude' and 'longitude' keys are ignored. """ keys = ["street", "street2", "city", "state", "zip", "country"] values = [value.get(key) for key in keys if value.get(key)] return ", ".join(values) if values else None def multiple_choice(value: Union[list, str]): """ Handle a single string or list of strings """ if isinstance(value, list): # account for this odd [None] value for empty multi-select fields if value == [None]: return None # we use string formatting to handle the possibility that the list contains ints return ", ".join([f"{val}" for val in value]) return value def signature(value: dict): return value.get("base30") def email(value: dict): return value.get("email") def link(value: dict): return value.get("url") def phone(value: dict): return value.get("full") def image(value): # somtimes a dict, sometimes a str try: return value["url"] except TypeError: return value def file(value): # stack says it's ok to use `file` as a name: # https://stackoverflow.com/questions/24942358/is-file-a-keyword-in-python#:~:text=1%20Answer&text=It%20can%20be%20seen%20as,by%20the%20open()%20function. # noqa try: return value["url"] except TypeError: return value def date_time(value, timezone=datetime.timezone.utc): """ Given a unix timestamp and a timezone, return the timestamp in ISO format in local time with TZ offset str. Expecting a Knack datetime field value like so: ``` "date_time": { "am_pm": "PM", "date": "09/11/2019", "date_formatted": "09/11/2019", "hours": "04", "iso_timestamp": "2019-09-11T16:14:00.000Z", "minutes": "14", "time": 974, "timestamp": "09/11/2019 04:14 pm", "unix_timestamp": 1568218440000, } ``` """ mills_timestamp = value.get("unix_timestamp") timestamp = mills_timestamp / 1000 dt_utc = datetime.datetime.fromtimestamp(timestamp, tz=datetime.timezone.utc) dt_local = dt_utc.astimezone(timezone) return dt_local.isoformat() def timer(value): # we're handling somthing that looks like this: # '<span>09/11/19</span>&nbsp;4:14pm to 5:14pm = 1:00 hours' return value.replace("<span>", "").replace("</span>", "").replace("&nbsp;", "; ") def connection(value): """ Return a string of comma-separated values """ if not value: return None else: # expecting a list of dicts like so: # [{'id': '5e7b63a0c279e606c645be7d', 'identifier': 'Some String'}] identifiers = [conn["identifier"] for conn in value] return ", ".join(str(v) for v in identifiers)
30.216667
165
0.634032
485
3,626
4.71134
0.416495
0.052954
0.032823
0.035011
0.140919
0.083151
0.057768
0.040263
0.040263
0
0
0.046367
0.244622
3,626
119
166
30.470588
0.787879
0.491175
0
0.291667
0
0
0.067616
0
0
0
0
0
0
1
0.25
false
0
0.041667
0.104167
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
41aa34ea92828757ebfd1804c5a596c402db1257
514
py
Python
libs/yowsup/yowsup/yowsup/layers/protocol_chatstate/protocolentities/test_chatstate_outgoing.py
akshitpradhan/TomHack
837226e7b38de1140c19bc2d478eeb9e379ed1fd
[ "MIT" ]
22
2017-07-14T20:01:17.000Z
2022-03-08T14:22:39.000Z
libs/yowsup/yowsup/yowsup/layers/protocol_chatstate/protocolentities/test_chatstate_outgoing.py
akshitpradhan/TomHack
837226e7b38de1140c19bc2d478eeb9e379ed1fd
[ "MIT" ]
6
2017-07-14T21:03:50.000Z
2021-06-10T19:08:32.000Z
libs/yowsup/yowsup/yowsup/layers/protocol_chatstate/protocolentities/test_chatstate_outgoing.py
akshitpradhan/TomHack
837226e7b38de1140c19bc2d478eeb9e379ed1fd
[ "MIT" ]
13
2017-07-14T20:13:14.000Z
2020-11-12T08:06:05.000Z
from yowsup.layers.protocol_chatstate.protocolentities.chatstate_outgoing import OutgoingChatstateProtocolEntity from yowsup.structs.protocolentity import ProtocolEntityTest import unittest entity = OutgoingChatstateProtocolEntity(OutgoingChatstateProtocolEntity.STATE_PAUSED, "jid@s.whatsapp.net") class OutgoingChatstateProtocolEntityTest(ProtocolEntityTest, unittest.TestCase): def setUp(self): self.ProtocolEntity = OutgoingChatstateProtocolEntity self.node = entity.toProtocolTreeNode()
46.727273
112
0.848249
42
514
10.309524
0.666667
0.046189
0
0
0
0
0
0
0
0
0
0
0.09144
514
10
113
51.4
0.927195
0
0
0
0
0
0.035019
0
0
0
0
0
0
1
0.125
false
0
0.375
0
0.625
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
41bdd135dd301e7b0332e09ffec2bea8b2cdbba2
111
py
Python
exercicios-e-exemplos/palindrome.py
outrofelipe/Python-para-zumbis
3bf1361c41ec6a8fa2bdc1a745230e630b73edd8
[ "MIT" ]
3
2016-12-23T13:20:43.000Z
2018-04-24T23:10:59.000Z
exercicios-e-exemplos/palindrome.py
outrofelipe/Python-para-zumbis
3bf1361c41ec6a8fa2bdc1a745230e630b73edd8
[ "MIT" ]
null
null
null
exercicios-e-exemplos/palindrome.py
outrofelipe/Python-para-zumbis
3bf1361c41ec6a8fa2bdc1a745230e630b73edd8
[ "MIT" ]
1
2017-07-13T23:53:34.000Z
2017-07-13T23:53:34.000Z
palavra = input ('Palavra: ') print('É palímdromo') if palavra == palavra[::-1] else print('Não é palíndromo')
37
80
0.675676
15
111
5
0.666667
0
0
0
0
0
0
0
0
0
0
0.010417
0.135135
111
2
81
55.5
0.770833
0
0
0
0
0
0.333333
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
3
68ce34925c492fe07243c7ca20553228bdb8d80e
242
py
Python
tests/0561_array_partition_i_test.py
paulo-erichsen/leetcode
78543363f7f938bdbda75de9cdab645daa29466a
[ "MIT" ]
null
null
null
tests/0561_array_partition_i_test.py
paulo-erichsen/leetcode
78543363f7f938bdbda75de9cdab645daa29466a
[ "MIT" ]
null
null
null
tests/0561_array_partition_i_test.py
paulo-erichsen/leetcode
78543363f7f938bdbda75de9cdab645daa29466a
[ "MIT" ]
null
null
null
import importlib module = importlib.import_module("algorithms.0561_array_partition_i") def test_valid_parentheses(): s = module.Solution() assert s.arrayPairSum([1, 4, 3, 2]) == 4 assert s.arrayPairSum([7, 3, 1, 0, 0, 6]) == 7
24.2
69
0.681818
36
242
4.416667
0.638889
0.08805
0.238994
0
0
0
0
0
0
0
0
0.079602
0.169421
242
9
70
26.888889
0.711443
0
0
0
0
0
0.136364
0.136364
0
0
0
0
0.333333
1
0.166667
false
0
0.333333
0
0.5
0
0
0
0
null
0
1
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
68eb38086c79a5e62a555e0209a7d4d47815f3c2
90
py
Python
coding/requests-status-code/code.py
mowshon/python-quiz
215fb23dbb0fa42b438f988e49172b87b48bade3
[ "MIT" ]
2
2020-07-17T21:08:26.000Z
2020-08-16T03:12:07.000Z
coding/requests-status-code/code.py
mowshon/python-quiz
215fb23dbb0fa42b438f988e49172b87b48bade3
[ "MIT" ]
2
2021-06-08T22:04:35.000Z
2022-01-13T03:03:32.000Z
coding/requests-status-code/code.py
mowshon/python-quiz
215fb23dbb0fa42b438f988e49172b87b48bade3
[ "MIT" ]
null
null
null
import requests response = requests.get('https://google.com') print(response.status_code)
22.5
45
0.788889
12
90
5.833333
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.066667
90
4
46
22.5
0.833333
0
0
0
0
0
0.197802
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0.333333
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
68efa55254af6e6cbbe709fee6269d6cefb94873
878
py
Python
privatechat/chatapp/tests.py
krishna-vasudev/ChitChat
41ace3f64ca553672da8716c7fa8b2e66863f2a6
[ "MIT" ]
4
2021-08-23T18:54:51.000Z
2022-02-17T18:43:52.000Z
privatechat/chatapp/tests.py
krishna-vasudev/ChitChat
41ace3f64ca553672da8716c7fa8b2e66863f2a6
[ "MIT" ]
null
null
null
privatechat/chatapp/tests.py
krishna-vasudev/ChitChat
41ace3f64ca553672da8716c7fa8b2e66863f2a6
[ "MIT" ]
2
2021-08-19T06:32:40.000Z
2022-03-09T16:22:07.000Z
from django.test import TestCase from chatapp.models import Message # Create your tests here. class MessagemodelTest(TestCase): def setUp(self): self.testing_message=Message(sender="testsender",receiver="testreceiver",message="Testing Testing") self.testing_message.save() def tearDown(self): self.testing_message.delete() def test_read_Message(self): self.assertEqual(self.testing_message.sender,"testsender") self.assertEqual(self.testing_message.receiver,"testreceiver") self.assertEqual(self.testing_message.message,"Testing Testing") self.assertEqual(self.testing_message.file_status,False) def test_update_Message(self): self.testing_message.message="new Testing Testing" self.testing_message.save() self.assertEqual(self.testing_message.message,"new Testing Testing")
33.769231
107
0.736902
102
878
6.196078
0.313725
0.174051
0.28481
0.205696
0.52057
0.311709
0.132911
0
0
0
0
0
0.161731
878
25
108
35.12
0.858696
0.026196
0
0.117647
0
0
0.13161
0
0
0
0
0
0.294118
1
0.235294
false
0
0.117647
0
0.411765
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
1
0
0
0
0
0
0
0
3
ec0c9750d5406cde924a5fa0b81ed1492cfc1498
692
py
Python
multiuploader/urls.py
dicos/django-multiuploader
5fc7c782486bfab367e372b90efadb9c61e6e257
[ "MIT" ]
null
null
null
multiuploader/urls.py
dicos/django-multiuploader
5fc7c782486bfab367e372b90efadb9c61e6e257
[ "MIT" ]
null
null
null
multiuploader/urls.py
dicos/django-multiuploader
5fc7c782486bfab367e372b90efadb9c61e6e257
[ "MIT" ]
null
null
null
from django.conf.urls import patterns, url urlpatterns = patterns('', url(r'^multiuploader_delete_multiple/$', 'multiuploader.views.multiuploader_delete_multiple', name='multiuploader_delete_multiple'), url(r'^multiuploader_delete/(?P<pk>\w+)/$', 'multiuploader.views.multiuploader_delete', name='multiuploader_delete'), url(r'^multiuploader/$', 'multiuploader.views.multiuploader', name='multiuploader'), url(r'^multiuploader_noajax/$', 'multiuploader.views.multiuploader', kwargs={"noajax": True}, name='multiploader_noajax'), url(r'^multiuploader_file/(?P<pk>\w*)/$', 'multiuploader.views.multi_show_uploaded', name='multiuploader_file_link') )
49.428571
96
0.731214
74
692
6.621622
0.351351
0.232653
0.173469
0.093878
0.089796
0
0
0
0
0
0
0
0.101156
692
13
97
53.230769
0.787781
0
0
0
0
0
0.640173
0.533237
0
0
0
0
0
1
0
false
0
0.083333
0
0.083333
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
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
ec12a91d0deecb8955f6918d2c9ebcebbad172a2
250
py
Python
ancilla/ancilla/foundation/node/events/__init__.py
frenzylabs/ancilla
3469272f17e1a5092d033cdc099f86f3052e744f
[ "Apache-2.0" ]
7
2020-03-31T19:52:59.000Z
2021-05-21T08:38:47.000Z
ancilla/ancilla/foundation/node/events/__init__.py
frenzylabs/ancilla
3469272f17e1a5092d033cdc099f86f3052e744f
[ "Apache-2.0" ]
15
2020-04-01T13:52:07.000Z
2020-04-01T13:52:11.000Z
ancilla/ancilla/foundation/node/events/__init__.py
frenzylabs/ancilla
3469272f17e1a5092d033cdc099f86f3052e744f
[ "Apache-2.0" ]
null
null
null
from .base import Event, State, Connection, Service from .event_pack import EventPack from .file import FileEvent from .node import NodeEvent from .layerkeep import LayerkeepEvent # from .camera import Camera # from .printer import Printer
31.25
56
0.78
32
250
6.0625
0.53125
0
0
0
0
0
0
0
0
0
0
0
0.172
250
8
57
31.25
0.937198
0.24
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
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
ec2756f75a8cde1fffe8ae28ed212760616a2e24
1,210
py
Python
test_dataretriever.py
mountolive/binance-futures-data-retriever
78022d746db7cedea68563dad33086a8c4446605
[ "MIT" ]
2
2020-10-05T08:57:04.000Z
2020-12-10T02:24:00.000Z
test_dataretriever.py
mountolive/binance-futures-data-retriever
78022d746db7cedea68563dad33086a8c4446605
[ "MIT" ]
null
null
null
test_dataretriever.py
mountolive/binance-futures-data-retriever
78022d746db7cedea68563dad33086a8c4446605
[ "MIT" ]
null
null
null
import unittest from dataretriever import DataRetriever class TestDataRetriever(unittest.TestCase): def setUp(self): self._validate_data = DataRetriever()._validate_data def test_validate_data_incorrect_dates(self): self.assertFalse(self._validate_data('BTCUSDT', 'bad', 'worst', '1m', 10)) def test_validate_data_incorrect_pair(self): self.assertFalse(self._validate_data('', '2020-09-11', '2020-10-11', '1m', 10)) def test_validate_data_incorrect_timeframe(self): self.assertFalse(self._validate_data('BTCUSDT', '2020-09-11', '2020-10-11', 'bad', 10)) def test_validate_data_inverted_times(self): self.assertFalse(self._validate_data('BTCUSDT', '2020-09-11', '2020-01-11', '1m', 10)) def test_validate_data_correct_dates(self): self.assertTrue(self._validate_data('BTCUSDT', '2020-09-11', '2020-10-11', '1m', 10)) def test_validate_data_correct_dates(self): self.assertTrue(self._validate_data('BTCUSDT', '01:00', '02:00', '1m', 10)) if __name__ == '__main__': unittest.main()
39.032258
87
0.623967
143
1,210
4.944056
0.251748
0.237624
0.158416
0.161245
0.69024
0.620934
0.571429
0.454031
0.454031
0.454031
0
0.096844
0.240496
1,210
30
88
40.333333
0.67247
0
0
0.181818
0
0
0.127273
0
0
0
0
0
0.272727
1
0.318182
false
0
0.090909
0
0.454545
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
1
0
0
0
0
0
0
0
3
ec337125a60b9cdbf44a5d8f4853f2349598edf0
252
py
Python
request.py
arshadkazmi42/is-broken-link-github
6202cbdc50a8482a0474403146d28ab8782fde3f
[ "MIT" ]
null
null
null
request.py
arshadkazmi42/is-broken-link-github
6202cbdc50a8482a0474403146d28ab8782fde3f
[ "MIT" ]
1
2021-10-19T18:54:56.000Z
2021-10-19T18:54:56.000Z
request.py
arshadkazmi42/is-broken-link-github
6202cbdc50a8482a0474403146d28ab8782fde3f
[ "MIT" ]
2
2021-11-01T20:22:05.000Z
2022-01-05T04:49:45.000Z
import requests DEFAULT_REQUEST_TIMEOUT = 30 class Request: def __init__(self, url): self.url = url def get(self, headers, timeout=DEFAULT_REQUEST_TIMEOUT): return requests.get(self.url, headers=headers, timeout=10)
15.75
66
0.686508
32
252
5.15625
0.46875
0.127273
0.254545
0
0
0
0
0
0
0
0
0.020513
0.22619
252
15
67
16.8
0.825641
0
0
0
0
0
0
0
0
0
0
0
0
1
0.285714
false
0
0.142857
0.142857
0.714286
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
ec344663b44d43f999481baf8540da63c96e8ed1
246
py
Python
app/data_access/shoppingDAL.py
muhammeedsari/stream-fake-data-kafka-to-mongodb-in-python
218d64b28d97e9f4fd20aca721cc8adbfd8ef6cf
[ "MIT" ]
null
null
null
app/data_access/shoppingDAL.py
muhammeedsari/stream-fake-data-kafka-to-mongodb-in-python
218d64b28d97e9f4fd20aca721cc8adbfd8ef6cf
[ "MIT" ]
null
null
null
app/data_access/shoppingDAL.py
muhammeedsari/stream-fake-data-kafka-to-mongodb-in-python
218d64b28d97e9f4fd20aca721cc8adbfd8ef6cf
[ "MIT" ]
null
null
null
from re import T from app.models.mongodb.shopping_mongodb_model import ShoppingMongodbModel from app.data_access.base.baseDAL import BaseDal class ShoppingDal(BaseDal[ShoppingMongodbModel[T]]): def __init__(self): super().__init__()
30.75
74
0.792683
31
246
5.935484
0.645161
0.076087
0
0
0
0
0
0
0
0
0
0
0.121951
246
8
75
30.75
0.851852
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0.5
0
0.833333
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
ec362c5ea13862670a2a71da7e9b929f260406ba
175
py
Python
tardsquad_discord_bot/client.py
Tardsquad/tardsquad-discord-bot
851eed29e4f3c2fcffc151ab5b5fb0758b9c02d8
[ "MIT" ]
3
2021-12-18T00:35:47.000Z
2021-12-19T01:19:04.000Z
tardsquad_discord_bot/client.py
erikw/tardsquad-discord-bot
295ca24729fb5849d12623e6fd76047c3b564c58
[ "MIT" ]
3
2022-02-01T08:07:23.000Z
2022-02-01T08:07:23.000Z
tardsquad_discord_bot/client.py
erikw/tardsquad-discord-bot
295ca24729fb5849d12623e6fd76047c3b564c58
[ "MIT" ]
1
2021-12-17T20:10:02.000Z
2021-12-17T20:10:02.000Z
from discord.ext import commands class TardsquadClient(commands.Bot): def __init__(self, *args, **kwargs): super().__init__(*args, command_prefix="!", **kwargs)
25
61
0.691429
20
175
5.6
0.8
0
0
0
0
0
0
0
0
0
0
0
0.154286
175
6
62
29.166667
0.756757
0
0
0
0
0
0.005714
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.75
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
6b5d677e8db09712105c8e9677dbe869e55e9b84
368
py
Python
tensortrade/orders/criteria/timed_steps.py
diazagasatya/tensortrade
fedc3bf69a88025cd5e3a5c498d0fc2d14cc8d59
[ "Apache-2.0" ]
null
null
null
tensortrade/orders/criteria/timed_steps.py
diazagasatya/tensortrade
fedc3bf69a88025cd5e3a5c498d0fc2d14cc8d59
[ "Apache-2.0" ]
null
null
null
tensortrade/orders/criteria/timed_steps.py
diazagasatya/tensortrade
fedc3bf69a88025cd5e3a5c498d0fc2d14cc8d59
[ "Apache-2.0" ]
null
null
null
from tensortrade.orders.criteria import Criteria class TimedSteps(Criteria): def __init__(self, duration: int): self.duration = duration def check(self, order: 'Order', exchange: 'Exchange'): return (exchange.clock.step - order.step) >= self.duration def __str__(self): return "<Timed: duration= {}steps>".format(self.duration)
28.307692
66
0.679348
42
368
5.761905
0.52381
0.198347
0
0
0
0
0
0
0
0
0
0
0.192935
368
12
67
30.666667
0.814815
0
0
0
0
0
0.105978
0
0
0
0
0
0
1
0.375
false
0
0.125
0.25
0.875
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
6b5fa14d227fec683309e02d3b06d316c6d6dd65
202
py
Python
savetheyak/app.py
anschwa/savetheyak
6e8102068f8f353445afa7c916b23310b0fad1de
[ "MIT" ]
19
2015-02-11T09:48:27.000Z
2020-03-08T04:01:16.000Z
savetheyak/app.py
anschwa/savetheyak
6e8102068f8f353445afa7c916b23310b0fad1de
[ "MIT" ]
3
2015-01-17T18:50:09.000Z
2018-04-12T21:31:38.000Z
savetheyak/app.py
anschwa/savetheyak
6e8102068f8f353445afa7c916b23310b0fad1de
[ "MIT" ]
11
2015-07-28T14:37:43.000Z
2019-11-12T10:57:43.000Z
from flask import Flask from flask_flatpages import FlatPages from flask_frozen import Freezer app = Flask(__name__) app.config.from_pyfile('settings.py') pages = FlatPages(app) freezer = Freezer(app)
22.444444
37
0.806931
29
202
5.37931
0.448276
0.173077
0
0
0
0
0
0
0
0
0
0
0.113861
202
8
38
25.25
0.871508
0
0
0
0
0
0.054455
0
0
0
0
0
0
1
0
false
0
0.428571
0
0.428571
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
6b70f4da7347b82e562654b036ce1cc1f661271e
598
py
Python
chapter2/exercise.py
Sirneij/Eloquent-JavaScript-s-solutions-in-J-s-C-
9e7581a7687ff855b914bf6371e706188646febc
[ "MIT" ]
1
2019-10-30T22:12:45.000Z
2019-10-30T22:12:45.000Z
chapter2/exercise.py
Sirneij/Eloquent-JavaScript-s-solutions-in-J-s-C-
9e7581a7687ff855b914bf6371e706188646febc
[ "MIT" ]
null
null
null
chapter2/exercise.py
Sirneij/Eloquent-JavaScript-s-solutions-in-J-s-C-
9e7581a7687ff855b914bf6371e706188646febc
[ "MIT" ]
null
null
null
# Exercise One hash = "#" for i in range(0, 7): print(hash) hash = hash + "#" # Exercise two for i in range(1, 101): if i % 3 == 0: if i % 5 == 0: print("FizzBuzz") else: print("Fizz") elif i % 5 == 0: print("Buzz") else: print(i) # Exercise three size = 8 chess_board = "" for i in range(0, size): for j in range(0, size): if (i + j) % 2 == 0: chess_board = chess_board + " " else: chess_board = chess_board + "#" chess_board = chess_board + "\n" print(chess_board)
17.085714
43
0.479933
83
598
3.361446
0.349398
0.286738
0.215054
0.286738
0.229391
0.143369
0
0
0
0
0
0.045576
0.376254
598
34
44
17.588235
0.702413
0.06689
0
0.125
0
0
0.039711
0
0
0
0
0
0
1
0
false
0
0
0
0
0.25
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
6b75f664683cf978464816470b0588c7cba3ec46
380
py
Python
server/wc/wc.py
InnovAnon-Inc/py-bingo
5a4d29599f563be0862f848249d4756fffbb0762
[ "Unlicense" ]
null
null
null
server/wc/wc.py
InnovAnon-Inc/py-bingo
5a4d29599f563be0862f848249d4756fffbb0762
[ "Unlicense" ]
null
null
null
server/wc/wc.py
InnovAnon-Inc/py-bingo
5a4d29599f563be0862f848249d4756fffbb0762
[ "Unlicense" ]
null
null
null
from abc import ABCMeta from abc import abstractmethod class WC(object, metaclass=ABCMeta): def __init__(self, board, isSelected): self.board = board self.isSelected = isSelected @abstractmethod def isWin(self): raise Exception() @staticmethod def transpose(board): return list(zip(*board)) @staticmethod def reverse(board): return [row[::-1] for row in board]
27.142857
58
0.739474
49
380
5.653061
0.55102
0.050542
0.093863
0
0
0
0
0
0
0
0
0.003115
0.155263
380
13
59
29.230769
0.859813
0
0
0.166667
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.166667
0.166667
0.583333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
6b936d0430d27bbd33e7e7a90f9ce0192e2d0de2
85
py
Python
VacationPy/api_keys.py
bjouellette/python-api-challenge
855c31769893596211ef072df8412cd47a557e19
[ "ADSL" ]
1
2022-01-27T00:04:14.000Z
2022-01-27T00:04:14.000Z
WeatherPy/api_keys.py
bjouellette/python-api-challenge
855c31769893596211ef072df8412cd47a557e19
[ "ADSL" ]
null
null
null
WeatherPy/api_keys.py
bjouellette/python-api-challenge
855c31769893596211ef072df8412cd47a557e19
[ "ADSL" ]
null
null
null
# OpenWeatherMap API Key weather_api_key = "reset" # Google API Key g_key = "reset"
14.166667
25
0.729412
13
85
4.538462
0.538462
0.305085
0
0
0
0
0
0
0
0
0
0
0.176471
85
5
26
17
0.842857
0.435294
0
0
0
0
0.222222
0
0
0
0
0
0
1
0
false
0
0
0
0
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
6bc87b8901d66f9c8e574c70b6fa32f64f868a2a
171
py
Python
tests.py
rmorla/http2-sidechannel
5a4738d31a026e9c8ae9d3b638315daff682a67e
[ "Unlicense" ]
null
null
null
tests.py
rmorla/http2-sidechannel
5a4738d31a026e9c8ae9d3b638315daff682a67e
[ "Unlicense" ]
null
null
null
tests.py
rmorla/http2-sidechannel
5a4738d31a026e9c8ae9d3b638315daff682a67e
[ "Unlicense" ]
null
null
null
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys import subprocess from test.process_tests import firefox1 if __name__ == "__main__": firefox1()
14.25
39
0.701754
23
171
4.826087
0.826087
0
0
0
0
0
0
0
0
0
0
0.028169
0.169591
171
11
40
15.545455
0.753521
0.251462
0
0
0
0
0.063492
0
0
0
0
0
0
1
0
true
0
0.666667
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
1
0
1
0
0
0
0
3
6bd699137f5011d7b135c27e58a006384fe1fcd6
3,245
py
Python
netapp/wfa/endpoint.py
ebirn/python-netapp-wfa
e72a50f4c5ce15f44e893688e94b3506f4d63ee4
[ "MIT" ]
2
2016-11-21T10:05:35.000Z
2017-09-20T05:37:30.000Z
netapp/wfa/endpoint.py
ebirn/python-netapp-wfa
e72a50f4c5ce15f44e893688e94b3506f4d63ee4
[ "MIT" ]
null
null
null
netapp/wfa/endpoint.py
ebirn/python-netapp-wfa
e72a50f4c5ce15f44e893688e94b3506f4d63ee4
[ "MIT" ]
1
2018-05-11T17:36:22.000Z
2018-05-11T17:36:22.000Z
import requests from requests.auth import HTTPBasicAuth import xml.etree.ElementTree as ET def configure(user, password, endpoint='https://localhost/', ssl_verify=None): """initial configuration of WFA endpoint and authentication """ Service.configure(user=user, password=password, endpoint=endpoint, ssl_verify=ssl_verify) class Service: _endpoint = 'https://localhost/' _user = None _password = None _ssl_verify = True """constructor for WFA connection, endpoint, credentials""" @classmethod def configure(cls, user, password, endpoint, ssl_verify): cls._endpoint = endpoint cls._user = user cls._password = password if ssl_verify is not None: cls._ssl_verify = ssl_verify return def __init__(self): pass def _get_auth(self): """create authentication credentials for REST endpoint""" return HTTPBasicAuth(self._user, self._password) class Endpoint(Service): def __init__(self, uri): super(Endpoint, self).__init__() self._uri = uri self._headers = dict() self._headers['user-agent'] = 'wfa-client/0.0.1' self._headers['Accept'] = 'application/xml' pass @property def url(self): return self._endpoint + self._uri def _process_response(self, response): """do initial xml processing of response body, at this point we are assuming it is parseable xml""" #print("raw response: =========================================================") #print(response.content) #print("=======================================================================") root = ET.fromstring(response.content) from netapp.wfa.types import Serializer ser = Serializer() return ser.to_object(root) def _build_xml_payload(self, data): """create an XML payload that is sent to server""" str_data = ET.tostring(data.to_payload(), encoding="unicode", short_empty_elements=True) return str_data def _request_url(self, verb, url, data=None, params=None): if url is None: url = self.url body = None if data is not None: body = self._build_xml_payload(data) print("request: %s to %s" %(verb, url)) res = requests.request(verb, url, data=body, auth=self._get_auth(), headers=self._headers, params=params, verify=self._ssl_verify, ) # raise an esception if you can, i.e. if bad status code res.raise_for_status() # should already do some xml processing at this stage return self._process_response(res) def http_get(self, url=None, params=None): res = self._request_url('GET', url=url, params=params) return res def http_post(self, data, url=None, params=None): res = self._request_url('POST', url=url, data=data, params=params) return res def http_delete(self, data, url=None, params=None): res = self._request_url('DELETE', url=url, data=data, params=params) return res def http_put(self, data, url=None, params=None): res = self._request_url('PUT', url=url, data=data, params=params) return res
32.777778
140
0.619414
401
3,245
4.825436
0.291771
0.04186
0.036176
0.035142
0.158656
0.158656
0.144186
0.144186
0.108527
0.108527
0
0.001214
0.238213
3,245
99
141
32.777778
0.781553
0.166102
0
0.095238
0
0
0.046893
0
0
0
0
0
0
1
0.206349
false
0.126984
0.063492
0.015873
0.52381
0.015873
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
6bd95e7eba54709473300dc9fb5e5ca3292f0c3b
755
py
Python
pytglib/api/types/chat_event_invites_toggled.py
iTeam-co/pytglib
e5e75e0a85f89b77762209b32a61b0a883c0ae61
[ "MIT" ]
6
2019-10-30T08:57:27.000Z
2021-02-08T14:17:43.000Z
pytglib/api/types/chat_event_invites_toggled.py
iTeam-co/python-telegram
e5e75e0a85f89b77762209b32a61b0a883c0ae61
[ "MIT" ]
1
2021-08-19T05:44:10.000Z
2021-08-19T07:14:56.000Z
pytglib/api/types/chat_event_invites_toggled.py
iTeam-co/python-telegram
e5e75e0a85f89b77762209b32a61b0a883c0ae61
[ "MIT" ]
5
2019-12-04T05:30:39.000Z
2021-05-21T18:23:32.000Z
from ..utils import Object class ChatEventInvitesToggled(Object): """ The can_invite_users permission of a supergroup chat was toggled Attributes: ID (:obj:`str`): ``ChatEventInvitesToggled`` Args: can_invite_users (:obj:`bool`): New value of can_invite_users permission Returns: ChatEventAction Raises: :class:`telegram.Error` """ ID = "chatEventInvitesToggled" def __init__(self, can_invite_users, **kwargs): self.can_invite_users = can_invite_users # bool @staticmethod def read(q: dict, *args) -> "ChatEventInvitesToggled": can_invite_users = q.get('can_invite_users') return ChatEventInvitesToggled(can_invite_users)
22.878788
69
0.655629
79
755
5.987342
0.506329
0.171247
0.266385
0.10148
0
0
0
0
0
0
0
0
0.251656
755
32
70
23.59375
0.837168
0.386755
0
0
0
0
0.151589
0.112469
0
0
0
0
0
1
0.222222
false
0
0.111111
0
0.666667
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
0
1
0
0
3
6be58e746332abc330a1d827f9d6017ec074ac80
799
py
Python
webdriver/webScrapper.py
SatoshiKiddo/Pasantia---Pruebas-C-E-Web
530a86a5a62ad56411de8c398d7a9e089cf4487d
[ "MIT" ]
null
null
null
webdriver/webScrapper.py
SatoshiKiddo/Pasantia---Pruebas-C-E-Web
530a86a5a62ad56411de8c398d7a9e089cf4487d
[ "MIT" ]
null
null
null
webdriver/webScrapper.py
SatoshiKiddo/Pasantia---Pruebas-C-E-Web
530a86a5a62ad56411de8c398d7a9e089cf4487d
[ "MIT" ]
null
null
null
import requests import csv from bs4 import BeautifulSoup class WebScrapper(object): def __init__ (self, url, params=""): self.url= url self.response="" self.params=params def get_request(self): self.response= requests.get(self.url, self.params) return self.response def post_request(self): self.response= requests.post(self.url, self.params) return self.response def put_request(self): self.response= requests.put(self.url, self.params) return self.response def delete_request(self): self.response= requests.delete(self.url, self.params) return self.response def html_analysis(self): self.html= BeautifulSoup(self.response, 'html.parser') return self.html
25.774194
62
0.653317
98
799
5.234694
0.244898
0.233918
0.116959
0.179337
0.538012
0.296296
0.296296
0.296296
0
0
0
0.001661
0.246558
799
30
63
26.633333
0.850498
0
0
0.173913
0
0
0.013767
0
0
0
0
0
0
1
0.26087
false
0
0.130435
0
0.652174
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
1
0
0
0
0
0
0
0
3
6be6a5dc37292954addcda2b57a39a543225ba90
78
py
Python
venv/lib/python3.6/site-packages/whitenoise/__init__.py
karolskora1993/FaceDetectionAPI
afd3038abae197cda2083ddbe1d9fae170d95f29
[ "MIT" ]
null
null
null
venv/lib/python3.6/site-packages/whitenoise/__init__.py
karolskora1993/FaceDetectionAPI
afd3038abae197cda2083ddbe1d9fae170d95f29
[ "MIT" ]
null
null
null
venv/lib/python3.6/site-packages/whitenoise/__init__.py
karolskora1993/FaceDetectionAPI
afd3038abae197cda2083ddbe1d9fae170d95f29
[ "MIT" ]
null
null
null
from .base import WhiteNoise __version__ = '4.0b4' __all__ = ['WhiteNoise']
13
28
0.717949
9
78
5.333333
0.888889
0
0
0
0
0
0
0
0
0
0
0.045455
0.153846
78
5
29
15.6
0.681818
0
0
0
0
0
0.192308
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
6be8d1a3dbe3946f78cc56c2888d2f2bfbf4e36f
91
py
Python
l22_aero_code/src/plot_csv.py
vas0x59/ior2020_uav_L22_AERO
55780923a637109f07f270ca6acbaf0f7669065c
[ "MIT" ]
4
2020-07-04T18:34:23.000Z
2021-09-17T10:50:12.000Z
l22_aero_code/src/plot_csv.py
vas0x59/ior2020_uav_L22_AERO
55780923a637109f07f270ca6acbaf0f7669065c
[ "MIT" ]
null
null
null
l22_aero_code/src/plot_csv.py
vas0x59/ior2020_uav_L22_AERO
55780923a637109f07f270ca6acbaf0f7669065c
[ "MIT" ]
2
2020-06-27T15:11:17.000Z
2020-10-08T00:31:26.000Z
import cv2 import pandas as pd import numpy as np csv = pd.read_csv("test_csv.csv")
7.583333
33
0.703297
17
91
3.647059
0.588235
0
0
0
0
0
0
0
0
0
0
0.014085
0.21978
91
11
34
8.272727
0.859155
0
0
0
0
0
0.139535
0
0
0
0
0
0
1
0
false
0
0.75
0
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
6bfa1e7ca10a7cf4b6a63e57bcb79b01ebf178bd
3,231
py
Python
backend/survey/admin.py
beehyv/workforcehealthtracker
ab0f921938e1ee50158c9d2c72a66c534d435eee
[ "Apache-2.0" ]
2
2020-05-10T05:20:04.000Z
2020-05-21T15:29:55.000Z
backend/survey/admin.py
beehyv/workforcehealthtracker
ab0f921938e1ee50158c9d2c72a66c534d435eee
[ "Apache-2.0" ]
null
null
null
backend/survey/admin.py
beehyv/workforcehealthtracker
ab0f921938e1ee50158c9d2c72a66c534d435eee
[ "Apache-2.0" ]
2
2020-05-13T18:21:37.000Z
2020-05-21T15:29:58.000Z
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # # Built and managed with Open Source Love by BeeHyv Software Solutions Pvt Ltd. Hyderabad # www.beehyv.com from django.contrib import admin # Register your models here. from survey.models import SurveyInstance, Survey, SurveyQuestion, SurveyAnswer class BaseSurveyAdmin(admin.ModelAdmin): def get_actions(self, request): actions = super().get_actions(request) if 'delete_selected' in actions and not request.user.is_admin: del actions['delete_selected'] return actions def has_delete_permission(self, request, obj=None): return request.user.is_admin def has_add_permission(self, request): return request.user.is_admin class SurveyAdmin(BaseSurveyAdmin): list_display = ('survey_name', 'question_list') def has_change_permission(self, request, obj=None): return request.user.is_admin def has_add_permission(self, request): return request.user.is_admin def has_delete_permission(self, request, obj=None): return request.user.is_admin class SurveryInstanceAdmin(BaseSurveyAdmin): list_display = ('id', 'survey_date', 'result_id',) ordering = ('-sent_time',) def has_change_permission(self, request, obj=None): return request.user.is_admin def has_add_permission(self, request): return request.user.is_admin def has_delete_permission(self, request, obj=None): return request.user.is_admin class SurveyQuestionAdmin(BaseSurveyAdmin): list_display = ('survey_name', 'question_text', 'question_type') def has_change_permission(self, request, obj=None): return request.user.is_admin def has_add_permission(self, request): return request.user.is_admin def has_delete_permission(self, request, obj=None): return request.user.is_admin class SurveyAnswerAdmin(BaseSurveyAdmin): list_display = ('survey_instance', 'question_text', 'answer') def has_change_permission(self, request, obj=None): return request.user.is_admin def has_add_permission(self, request): return request.user.is_admin def has_delete_permission(self, request, obj=None): return request.user.is_admin admin.site.register(Survey, SurveyAdmin) admin.site.register(SurveyInstance, SurveryInstanceAdmin) admin.site.register(SurveyQuestion, SurveyQuestionAdmin) admin.site.register(SurveyAnswer, SurveyAnswerAdmin)
37.137931
91
0.738781
420
3,231
5.538095
0.32381
0.070937
0.083835
0.116079
0.410146
0.410146
0.370163
0.370163
0.370163
0.370163
0
0.001509
0.17982
3,231
86
92
37.569767
0.876226
0.282266
0
0.571429
0
0
0.06838
0
0
0
0
0
0
1
0.306122
false
0
0.040816
0.285714
0.857143
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
d40e59a2df91e684fe54511db5dc22be5e1da82f
523
py
Python
build.py
mariusmitrofan/structlog-sentry-logger
86fd6a60d3f7c9459116526ca75fb684a5906efe
[ "Apache-2.0" ]
9
2020-10-21T15:45:29.000Z
2022-02-27T00:04:47.000Z
build.py
mariusmitrofan/structlog-sentry-logger
86fd6a60d3f7c9459116526ca75fb684a5906efe
[ "Apache-2.0" ]
189
2020-11-01T21:44:50.000Z
2022-03-30T02:15:05.000Z
build.py
mariusmitrofan/structlog-sentry-logger
86fd6a60d3f7c9459116526ca75fb684a5906efe
[ "Apache-2.0" ]
3
2021-12-09T18:33:44.000Z
2021-12-09T19:13:22.000Z
import mypyc.build def build(setup_kwargs: dict) -> None: """ This function is mandatory in order to build the extensions. """ setup_kwargs.update( { "ext_modules": mypyc.build.mypycify( [ "--disallow-untyped-defs", "structlog_sentry_logger/__init__.py", "structlog_sentry_logger/_config.py", "structlog_sentry_logger/structlog_sentry.py", ] ), } )
26.15
66
0.508604
46
523
5.456522
0.652174
0.239044
0.250996
0.183267
0
0
0
0
0
0
0
0
0.393881
523
19
67
27.526316
0.791798
0.114723
0
0
0
0
0.326622
0.302013
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
d437ece6a00ef642d1e70a40cb85f4bb4559f424
186
py
Python
mgbudgetapp/urls.py
machaktom/mastersgym
15a38b315d4e720cfc099495281cc48c2bbe72f2
[ "Apache-2.0" ]
null
null
null
mgbudgetapp/urls.py
machaktom/mastersgym
15a38b315d4e720cfc099495281cc48c2bbe72f2
[ "Apache-2.0" ]
1
2016-12-23T14:18:11.000Z
2016-12-23T14:18:11.000Z
mgbudgetapp/urls.py
machaktom/mastersgym
15a38b315d4e720cfc099495281cc48c2bbe72f2
[ "Apache-2.0" ]
null
null
null
from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.index, name='index'), url(r'^(?P<fighter_id>[0-9]+)/$', views.fighter, name='fighter'), ]
20.666667
69
0.623656
27
186
4.259259
0.592593
0.069565
0
0
0
0
0
0
0
0
0
0.012658
0.150538
186
8
70
23.25
0.71519
0
0
0
0
0
0.209677
0.134409
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
d449d3e8b5f1c0b611d53696738c18adbf0eb5c3
1,169
py
Python
parser/fase2/team17/Traduccion/InterpreteF2/DML/select/selectCompuesto.py
Gabriel-15/tytus
fb00718bf3fcc5211a3604fba1a551f44bdc6deb
[ "MIT" ]
35
2020-12-07T03:11:43.000Z
2021-04-15T17:38:16.000Z
parser/fase2/team17/Traduccion/InterpreteF2/DML/select/selectCompuesto.py
Gabriel-15/tytus
fb00718bf3fcc5211a3604fba1a551f44bdc6deb
[ "MIT" ]
47
2020-12-09T01:29:09.000Z
2021-01-13T05:37:50.000Z
parser/fase2/team17/Traduccion/InterpreteF2/DML/select/selectCompuesto.py
Gabriel-15/tytus
fb00718bf3fcc5211a3604fba1a551f44bdc6deb
[ "MIT" ]
556
2020-12-07T03:13:31.000Z
2021-06-17T17:41:10.000Z
from InterpreteF2.NodoAST import NodoArbol from InterpreteF2.Tabla_de_simbolos import Tabla_de_simbolos from InterpreteF2.Arbol import Arbol from InterpreteF2.Valor.Valor import Valor from InterpreteF2.Primitivos.TIPO import TIPO from InterpreteF2.Primitivos.COMPROBADOR_deTipos import COMPROBADOR_deTipos class SelectCompuesto(NodoArbol): def __init__(self, string1_, string2_, string3_, line, coliumn): super().__init__(line, coliumn) self.string1 = string1_ self.string2 = string2_ self.string3 = string3_ def analizar_semanticamente(self, entorno: Tabla_de_simbolos, arbol: Arbol): pass def traducir(self, entorno: Tabla_de_simbolos, arbol: Arbol): arbol.addC3D('heap = ' + '\'' + str(self.string1) + ' ' + str(self.string2) + ' ' + str(self.string3) + ';\'') temp = arbol.getTemp() arbol.addC3D(temp + ' = inter()') return temp def execute(self, entorno: Tabla_de_simbolos, arbol: Arbol): pass def getString(self, entorno: Tabla_de_simbolos, arbol: Arbol): pass def getValueAbstract(self, entorno: Tabla_de_simbolos, arbol: Arbol): pass
35.424242
118
0.701454
134
1,169
5.88806
0.298507
0.062104
0.13308
0.114068
0.259823
0.259823
0.259823
0.214195
0.163498
0
0
0.02139
0.200171
1,169
33
119
35.424242
0.82246
0
0
0.16
0
0
0.074359
0
0
0
0
0
0
1
0.24
false
0.16
0.24
0
0.56
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
d4563c8dc802d672527c5f94c0ee46ae261fc50f
275
py
Python
generate_numbers.py
serdyukov1980/push_swap-auto_tester
3d2d61aa2196223262203467a4791781985e1847
[ "MIT" ]
1
2021-12-05T12:59:32.000Z
2021-12-05T12:59:32.000Z
generate_numbers.py
serdyukov1980/push_swap-auto_tester
3d2d61aa2196223262203467a4791781985e1847
[ "MIT" ]
null
null
null
generate_numbers.py
serdyukov1980/push_swap-auto_tester
3d2d61aa2196223262203467a4791781985e1847
[ "MIT" ]
null
null
null
import random import sys if len(sys.argv) > 1: for _ in range(int(sys.argv[1])): # quantity of numbers to sort print(str(random.randint(-2147483648, 2147483647)) + " ") # full int range #print(str(random.randint(-9000000, 9000000)) + " ") # small range
45.833333
83
0.643636
38
275
4.631579
0.631579
0.079545
0.090909
0.238636
0
0
0
0
0
0
0
0.165138
0.207273
275
6
84
45.833333
0.642202
0.389091
0
0
0
0
0.006098
0
0
0
0
0
0
1
0
false
0
0.4
0
0.4
0.2
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
d4566de13e7118d6cc842ee4ae875224431459ad
572
py
Python
test/run/t428.py
timmartin/skulpt
2e3a3fbbaccc12baa29094a717ceec491a8a6750
[ "MIT" ]
2,671
2015-01-03T08:23:25.000Z
2022-03-31T06:15:48.000Z
test/run/t428.py
timmartin/skulpt
2e3a3fbbaccc12baa29094a717ceec491a8a6750
[ "MIT" ]
972
2015-01-05T08:11:00.000Z
2022-03-29T13:47:15.000Z
test/run/t428.py
timmartin/skulpt
2e3a3fbbaccc12baa29094a717ceec491a8a6750
[ "MIT" ]
845
2015-01-03T19:53:36.000Z
2022-03-29T18:34:22.000Z
print ( True or False ) == True print ( True or True ) == True print ( False or False ) == False print ( True and False ) == False print ( True and True ) == True print ( False and False ) == False print ( not True ) == False print ( not False ) == True print ( not True or False ) == ( (not True) or False ) print ( not False or False ) == ( (not False) or False ) print ( not True and True ) == ( (not True) and True ) print ( not False and True ) == ( (not False) and True ) print ( not True and not False or False ) == ( ( (not True) and (not False) ) or False )
30.105263
88
0.613636
89
572
3.94382
0.067416
0.159544
0.17094
0.17094
0.319088
0.14245
0.14245
0
0
0
0
0
0.253497
572
18
89
31.777778
0.822014
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0
0
0
1
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
0
1
0
3
d464f967cb3906a36a90029f965f80f2992ff161
668
py
Python
exercise3.py
nikhadif/Advanced-Programming
e5bf4f5014c17c252bc0cb93c9d44c7c615b79c0
[ "MIT" ]
1
2020-11-21T16:57:40.000Z
2020-11-21T16:57:40.000Z
exercise3.py
nikhadif/Advanced-Programming
e5bf4f5014c17c252bc0cb93c9d44c7c615b79c0
[ "MIT" ]
null
null
null
exercise3.py
nikhadif/Advanced-Programming
e5bf4f5014c17c252bc0cb93c9d44c7c615b79c0
[ "MIT" ]
null
null
null
points_str = input("Enter the lead in points: ") points_remaining_int = int(points_str) lead_calculation_float= float(points_remaining_int - 3) has_ball_str = input("Does the lead team have the ball (Yes or No): ") if has_ball_str == "Yes": lead_calculation_float=lead_calculation_float + 0.5 else: lead_calculation_float=lead_calculation_float - 0.5 if lead_calculation_float < 0: lead_calculation_float = 0 lead_calculation_float= lead_calculation_float**2 seconds_remaining_int = int(input("Enter the number of seconds remaining: ")) if lead_calculation_float > seconds_remaining_int: print("Lead is safe.") else: print("Lead is not safe.")
27.833333
77
0.770958
102
668
4.715686
0.313725
0.31185
0.4158
0.174636
0.345114
0.345114
0.303534
0.174636
0
0
0
0.013913
0.139222
668
23
78
29.043478
0.822609
0
0
0.125
0
0
0.215569
0
0
0
0
0
0
1
0
false
0
0
0
0
0.125
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
d483daa01185b4151ca9d964a2ce75dbd02b9d87
5,534
py
Python
pyvisgraph/graph.py
TaipanRex/oceanspp
9472e0df7ca7bfa5f45932ca348222bdc1f7e688
[ "MIT" ]
181
2016-10-16T14:06:01.000Z
2022-02-02T02:47:37.000Z
pyvisgraph/graph.py
TaipanRex/oceanspp
9472e0df7ca7bfa5f45932ca348222bdc1f7e688
[ "MIT" ]
51
2016-10-16T12:26:21.000Z
2022-01-20T08:23:03.000Z
pyvisgraph/graph.py
TaipanRex/oceanspp
9472e0df7ca7bfa5f45932ca348222bdc1f7e688
[ "MIT" ]
56
2016-10-20T22:26:35.000Z
2021-08-04T22:10:18.000Z
""" The MIT License (MIT) Copyright (c) 2016 Christian August Reksten-Monsen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ from collections import defaultdict class Point(object): __slots__ = ('x', 'y', 'polygon_id') def __init__(self, x, y, polygon_id=-1): self.x = float(x) self.y = float(y) self.polygon_id = polygon_id def __eq__(self, point): return point and self.x == point.x and self.y == point.y def __ne__(self, point): return not self.__eq__(point) def __lt__(self, point): """ This is only needed for shortest path calculations where heapq is used. When there are two points of equal distance, heapq will instead evaluate the Points, which doesnt work in Python 3 and throw a TypeError.""" return hash(self) < hash(point) def __str__(self): return "(%.2f, %.2f)" % (self.x, self.y) def __hash__(self): return self.x.__hash__() ^ self.y.__hash__() def __repr__(self): return "Point(%.2f, %.2f)" % (self.x, self.y) class Edge(object): __slots__ = ('p1', 'p2') def __init__(self, point1, point2): self.p1 = point1 self.p2 = point2 def get_adjacent(self, point): if point == self.p1: return self.p2 return self.p1 def __contains__(self, point): return self.p1 == point or self.p2 == point def __eq__(self, edge): if self.p1 == edge.p1 and self.p2 == edge.p2: return True if self.p1 == edge.p2 and self.p2 == edge.p1: return True return False def __ne__(self, edge): return not self.__eq__(edge) def __str__(self): return "({}, {})".format(self.p1, self.p2) def __repr__(self): return "Edge({!r}, {!r})".format(self.p1, self.p2) def __hash__(self): return self.p1.__hash__() ^ self.p2.__hash__() class Graph(object): """ A Graph is represented by a dict where the keys are Points in the Graph and the dict values are sets containing Edges incident on each Point. A separate set *edges* contains all Edges in the graph. The input must be a list of polygons, where each polygon is a list of in-order (clockwise or counter clockwise) Points. If only one polygon, it must still be a list in a list, i.e. [[Point(0,0), Point(2,0), Point(2,1)]]. *polygons* dictionary: key is a integer polygon ID and values are the edges that make up the polygon. Note only polygons with 3 or more Points will be classified as a polygon. Non-polygons like just one Point will be given a polygon ID of -1 and not maintained in the dict. """ def __init__(self, polygons): self.graph = defaultdict(set) self.edges = set() self.polygons = defaultdict(set) pid = 0 for polygon in polygons: if polygon[0] == polygon[-1] and len(polygon) > 1: polygon.pop() for i, point in enumerate(polygon): sibling_point = polygon[(i + 1) % len(polygon)] edge = Edge(point, sibling_point) if len(polygon) > 2: point.polygon_id = pid sibling_point.polygon_id = pid self.polygons[pid].add(edge) self.add_edge(edge) if len(polygon) > 2: pid += 1 def get_adjacent_points(self, point): return [edge.get_adjacent(point) for edge in self[point]] def get_points(self): return list(self.graph) def get_edges(self): return self.edges def add_edge(self, edge): self.graph[edge.p1].add(edge) self.graph[edge.p2].add(edge) self.edges.add(edge) def __contains__(self, item): if isinstance(item, Point): return item in self.graph if isinstance(item, Edge): return item in self.edges return False def __getitem__(self, point): if point in self.graph: return self.graph[point] return set() def __str__(self): res = "" for point in self.graph: res += "\n" + str(point) + ": " for edge in self.graph[point]: res += str(edge) return res def __repr__(self): return self.__str__()
33.539394
79
0.606072
759
5,534
4.249012
0.28195
0.027907
0.018605
0.015814
0.044961
0.021705
0
0
0
0
0
0.014267
0.303397
5,534
164
80
33.743902
0.822309
0.361764
0
0.152174
0
0
0.022372
0
0
0
0
0
0
1
0.26087
false
0
0.01087
0.152174
0.608696
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
d488e8d8b99e945845aabde46494343b51007c88
244
py
Python
chart app/models.py
saidasaduakas/chartapp
999c9e5323b3fe5e17cb115d3f9af7a5ec8ded55
[ "MIT" ]
null
null
null
chart app/models.py
saidasaduakas/chartapp
999c9e5323b3fe5e17cb115d3f9af7a5ec8ded55
[ "MIT" ]
null
null
null
chart app/models.py
saidasaduakas/chartapp
999c9e5323b3fe5e17cb115d3f9af7a5ec8ded55
[ "MIT" ]
null
null
null
from django.db import models class Product(models.Model): category = models.CharField(max_length=100, null=False, blank=False) num_of_prod =models.FloatField() def __str__(self): return f'{self.category}-{self.num_of_prod}'
34.857143
72
0.72541
35
244
4.8
0.714286
0.059524
0.107143
0
0
0
0
0
0
0
0
0.014493
0.151639
244
7
73
34.857143
0.797101
0
0
0
0
0
0.138776
0.138776
0
0
0
0
0
1
0.166667
false
0
0.166667
0.166667
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
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
2e0df6f638a557eafd926b8c1963a4d76c24813e
256
py
Python
biobb_structure_utils/utils/__init__.py
bioexcel/biobb_structure_utils
4bd86b001f944ff35c779e25221fe8d775f8a1bf
[ "Apache-2.0" ]
1
2021-09-30T18:50:45.000Z
2021-09-30T18:50:45.000Z
biobb_structure_utils/utils/__init__.py
bioexcel/biobb_structure_utils
4bd86b001f944ff35c779e25221fe8d775f8a1bf
[ "Apache-2.0" ]
9
2020-08-04T13:23:14.000Z
2022-03-18T11:32:04.000Z
biobb_structure_utils/utils/__init__.py
bioexcel/biobb_structure_utils
4bd86b001f944ff35c779e25221fe8d775f8a1bf
[ "Apache-2.0" ]
2
2021-09-30T18:50:48.000Z
2021-11-28T14:10:41.000Z
name = "utils" __all__ = ["cat_pdb", "extract_atoms", "extract_chain", "extract_heteroatoms", "extract_model", "extract_molecule", "remove_ligand", "remove_pdb_water", "renumber_structure", "sort_gro_residues", "str_check_add_hydrogens", "structure_check"]
128
241
0.777344
31
256
5.774194
0.741935
0
0
0
0
0
0
0
0
0
0
0
0.0625
256
2
241
128
0.745833
0
0
0
0
0
0.731518
0.089494
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
2e11e28c5f1185cc9d68c8d87fd77f68ee0d1717
199
py
Python
SCRIPTS/script14.py
oasys-kit/ShadowOui-Tutorial
50e9416efdd57ffad11cb3c866aa143a9254bd33
[ "MIT" ]
4
2018-11-01T14:24:06.000Z
2021-02-16T18:25:16.000Z
SCRIPTS/script14.py
oasys-kit/ShadowOui-Tutorial
50e9416efdd57ffad11cb3c866aa143a9254bd33
[ "MIT" ]
1
2019-05-30T20:29:30.000Z
2019-05-30T20:29:30.000Z
SCRIPTS/script14.py
oasys-kit/ShadowOui-Tutorial
50e9416efdd57ffad11cb3c866aa143a9254bd33
[ "MIT" ]
5
2019-06-13T03:42:28.000Z
2021-12-04T17:04:32.000Z
#create file myaperture.dat needed for source optimization f = open("myaperture.dat",'w') f.write(" 50.0 -0.002 0.002 -0.002 0.002") f.close() print("File written to disk: myaperture.dat")
33.166667
58
0.678392
34
199
3.970588
0.588235
0.118519
0.111111
0.177778
0.118519
0.118519
0
0
0
0
0
0.113772
0.160804
199
5
59
39.8
0.694611
0.286432
0
0
0
0
0.652482
0
0
0
0
0
0
1
0
false
0
0
0
0
0.25
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
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
2e158a4ebb8f62e26c42f93446cafdd85d0ff8bf
1,493
py
Python
django/inclusion/managers.py
betagouv/data-inclusion
3423c55cb760899abe61125966e2053d8089fec7
[ "MIT" ]
null
null
null
django/inclusion/managers.py
betagouv/data-inclusion
3423c55cb760899abe61125966e2053d8089fec7
[ "MIT" ]
null
null
null
django/inclusion/managers.py
betagouv/data-inclusion
3423c55cb760899abe61125966e2053d8089fec7
[ "MIT" ]
null
null
null
from django.db import models from django.db.models import F, Max, OuterRef, Subquery from django.db.models.lookups import Exact class StructureReportQuerySet(models.QuerySet): def with_is_latest_by_source(self): return self.alias( id_latest=Subquery( self.values("source", "id_in_source") .annotate(latest=Max("created_at")) .filter(latest=OuterRef("created_at")) .values("id") ) ).annotate(is_latest=Exact(F("id"), F("id_latest"))) def latests_by_source(self): return self.alias( id_latest=Subquery( self.values("source", "id_in_source") .annotate(latest=Max("created_at")) .filter(latest=OuterRef("created_at")) .values("id") ) ).filter(id=F("id_latest")) def antennes(self): return self.filter(parent_report__isnull=False) def sieges(self): return self.filter(parent_report__isnull=True) class StructureReportManager(models.Manager): def get_queryset(self): return StructureReportQuerySet(self.model) def with_is_latest_by_source(self): return self.get_queryset().with_is_latest_by_source() def latests_by_source(self): return self.get_queryset().latests_by_source() def antennes(self): return self.get_queryset().antennes() def sieges(self): return self.get_queryset().sieges()
30.469388
61
0.628265
175
1,493
5.12
0.24
0.100446
0.125
0.080357
0.65625
0.508929
0.508929
0.352679
0.352679
0.294643
0
0
0.25653
1,493
48
62
31.104167
0.807207
0
0
0.540541
0
0
0.066979
0
0
0
0
0
0
1
0.243243
false
0
0.081081
0.243243
0.621622
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
2e298120fa97cde97b8df7ba6b80ff42b5625622
665
py
Python
tests/test_parse_go.py
bio2bel/interpro
fd9856ff4eec110e120ff73570f50b55c5df1005
[ "MIT" ]
null
null
null
tests/test_parse_go.py
bio2bel/interpro
fd9856ff4eec110e120ff73570f50b55c5df1005
[ "MIT" ]
13
2017-07-25T20:23:52.000Z
2019-01-12T10:18:38.000Z
tests/test_parse_go.py
bio2bel/interpro
fd9856ff4eec110e120ff73570f50b55c5df1005
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """Tests for the InterPro-GO file parser.""" import unittest from bio2bel_interpro.parser.interpro_to_go import get_interpro_go_mappings from tests.constants import TEST_INTERPRO_GO_MAPPINGS_PATH class TestTreeParser(unittest.TestCase): """Methods to test that the parser for the InterPro tree works properly.""" @classmethod def setUpClass(cls): """Set up this class with GO mappings.""" cls.interpro_go_mapping = get_interpro_go_mappings(path=TEST_INTERPRO_GO_MAPPINGS_PATH) def test_length(self): """Test the number of mappings.""" self.assertEqual(3, len(self.interpro_go_mapping))
30.227273
95
0.735338
91
665
5.131868
0.483516
0.149893
0.154176
0.141328
0.111349
0
0
0
0
0
0
0.005425
0.168421
665
21
96
31.666667
0.83906
0.294737
0
0
0
0
0
0
0
0
0
0
0.111111
1
0.222222
false
0
0.333333
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
0
1
0
0
3
2e525e3f4a1a8dbbd467b50c7b4e314d428d2c4f
442
py
Python
nuclear/parser/context.py
igrek51/glue
6726ba977a21e58b354a5c97f68639f84184be7a
[ "MIT" ]
6
2020-06-24T20:03:06.000Z
2021-09-21T10:05:17.000Z
nuclear/parser/context.py
igrek51/cliglue
6726ba977a21e58b354a5c97f68639f84184be7a
[ "MIT" ]
2
2021-09-19T15:28:02.000Z
2021-09-21T17:29:38.000Z
nuclear/parser/context.py
igrek51/cliglue
6726ba977a21e58b354a5c97f68639f84184be7a
[ "MIT" ]
2
2020-06-24T21:21:35.000Z
2021-08-01T17:24:38.000Z
from dataclasses import dataclass from typing import Optional, List, Any, Dict from nuclear.args.container import ArgsContainer from nuclear.builder.rule import SubcommandRule, CliRule from nuclear.builder.typedef import Action @dataclass class RunContext(object): args_container: ArgsContainer action: Optional[Action] active_subcommands: List[SubcommandRule] active_rules: List[CliRule] internal_vars: Dict[str, Any]
27.625
56
0.798643
53
442
6.584906
0.528302
0.094556
0.103152
0
0
0
0
0
0
0
0
0
0.138009
442
15
57
29.466667
0.916011
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.416667
0
0.916667
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
2e823db4df417254339b2e759f12fe1805031041
98
py
Python
29-packages/pkg/module2.py
ehsankorhani/python-lessons
a1974cb2b43b73751fc4737e3e3aa830aa16a644
[ "MIT" ]
null
null
null
29-packages/pkg/module2.py
ehsankorhani/python-lessons
a1974cb2b43b73751fc4737e3e3aa830aa16a644
[ "MIT" ]
null
null
null
29-packages/pkg/module2.py
ehsankorhani/python-lessons
a1974cb2b43b73751fc4737e3e3aa830aa16a644
[ "MIT" ]
null
null
null
make = "Ford" model = "Everest" def start_engine(): print (f'{make} {model} engine started')
16.333333
44
0.642857
13
98
4.769231
0.769231
0
0
0
0
0
0
0
0
0
0
0
0.183673
98
5
45
19.6
0.775
0
0
0
0
0
0.408163
0
0
0
0
0
0
1
0.25
false
0
0
0
0.25
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
3
5cef1374102c6ce20b9012ac6dbb72d79c98b001
379
py
Python
tests/test_user.py
Munyiwamwangi/Pitch
621448a9cacd7e8445ddb53a9fcf5d3652929490
[ "MIT" ]
null
null
null
tests/test_user.py
Munyiwamwangi/Pitch
621448a9cacd7e8445ddb53a9fcf5d3652929490
[ "MIT" ]
5
2020-10-27T22:04:08.000Z
2021-06-08T20:13:11.000Z
tests/test_user.py
Munyiwamwangi/BlogSaferspace
b513bd9301039f2a7abf857dcd4b8001c7ee77b1
[ "MIT" ]
null
null
null
import unittest from app import User class UserTest(unittest.TestCase): def setUp(self): self.new_user = User(password = 'password') def test_login_scope(self): with self.assertRaises(AttributeError): self.new_user.password def test_password_verification(self): self.assertTrue(self.new_user.verify_password('password'))
29.153846
66
0.693931
45
379
5.666667
0.488889
0.082353
0.129412
0
0
0
0
0
0
0
0
0
0.21372
379
13
66
29.153846
0.855705
0
0
0
0
0
0.042105
0
0
0
0
0
0.2
1
0.3
false
0.4
0.2
0
0.6
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
3
5cef346ac689ecbff0c41f19b1dac3079ba475ef
396
py
Python
CrawlWorker/spiders/serverfault.py
jarvisji/CrawlWorker
cbfea701129e05e5c0a287f276b84bcd8ef0eb89
[ "Apache-2.0" ]
null
null
null
CrawlWorker/spiders/serverfault.py
jarvisji/CrawlWorker
cbfea701129e05e5c0a287f276b84bcd8ef0eb89
[ "Apache-2.0" ]
null
null
null
CrawlWorker/spiders/serverfault.py
jarvisji/CrawlWorker
cbfea701129e05e5c0a287f276b84bcd8ef0eb89
[ "Apache-2.0" ]
null
null
null
__author__ = 'Ting' from CrawlWorker.spiders.stackoverflow import StackOverflowSpider class ServerFaultSpider(StackOverflowSpider): name = 'ServerFaultSpider' allowed_domains = ['serverfault.com'] def __init__(self, op=None, **kwargs): StackOverflowSpider.__init__(self, op, **kwargs) def get_feed_start_urls(self): return ['http://serverfault.com/questions']
28.285714
65
0.732323
39
396
7.025641
0.717949
0.10219
0.072993
0
0
0
0
0
0
0
0
0
0.156566
396
14
66
28.285714
0.820359
0
0
0
0
0
0.171285
0
0
0
0
0
0
1
0.222222
false
0
0.111111
0.111111
0.777778
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
cf32e2daf2bfcb97e605b04cbefde67c1d177832
345
py
Python
CoresFuncoes.py
Wollacy/Python
afd6dadad290aee0698d4513cd9b168309df810c
[ "MIT" ]
null
null
null
CoresFuncoes.py
Wollacy/Python
afd6dadad290aee0698d4513cd9b168309df810c
[ "MIT" ]
null
null
null
CoresFuncoes.py
Wollacy/Python
afd6dadad290aee0698d4513cd9b168309df810c
[ "MIT" ]
null
null
null
## Adicionando Cores ##\033[formatação:corTexto:corFundom print('\033[0;30;41mOlá mundo!') print('\033[4;33;44mOlá mundo!') print('\033[1;35;43mOlá mundo!') print('\033[30;42mOlá mundo!\033[0;0;0m') print('\033[mOlá mundo!') print('\033[7;33;44mOlá mundo!') ## Verifica quantidade de caracteres em uma string s='Prova de Python' print(len(s))
24.642857
50
0.704348
57
345
4.263158
0.561404
0.197531
0.213992
0
0
0
0
0
0
0
0
0.161905
0.086957
345
14
51
24.642857
0.609524
0.286957
0
0
0
0
0.645833
0
0
0
0
0
0
1
0
false
0
0
0
0
0.875
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
1
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
3
cf5eb3e63c98928be67b833886c852d58f8a9b7c
3,679
py
Python
bm-instance-agent/bm_instance_agent/tests/unit/test_manager.py
zstackio/zstack-utility
919d686d46c68836cbcad51ab0b8bf53bc88abda
[ "ECL-2.0", "Apache-2.0" ]
55
2017-02-10T07:55:21.000Z
2021-09-01T00:59:36.000Z
bm-instance-agent/bm_instance_agent/tests/unit/test_manager.py
zstackio/zstack-utility
919d686d46c68836cbcad51ab0b8bf53bc88abda
[ "ECL-2.0", "Apache-2.0" ]
106
2017-02-13T09:58:27.000Z
2022-02-15T09:51:48.000Z
bm-instance-agent/bm_instance_agent/tests/unit/test_manager.py
zstackio/zstack-utility
919d686d46c68836cbcad51ab0b8bf53bc88abda
[ "ECL-2.0", "Apache-2.0" ]
68
2017-02-13T11:02:01.000Z
2021-12-16T11:02:01.000Z
import mock from bm_instance_agent import exception as bm_exception from bm_instance_agent import manager from bm_instance_agent.systems import base as driver_base from bm_instance_agent.tests import base from bm_instance_agent.tests.unit import fake class TestManager(base.TestCase): @mock.patch('bm_instance_agent.systems.base.SystemDriverBase.ping') @mock.patch('bm_instance_agent.systems.base.SystemDriverBase.' 'update_password') @mock.patch('bm_instance_agent.manager.AgentManager._load_driver') def test_ping_bm_uuid_not_corrent(self, mock_driv, mock_driv_update_password, mock_ping): mock_driv.return_value = driver_base.SystemDriverBase() mock_driv_update_password.return_value = None mock_ping.return_value = None mgmt = manager.AgentManager() mgmt.ping(fake.BM_INSTANCE1) self.assertRaises(bm_exception.BmInstanceUuidConflict, mgmt.update_password, fake.BM_INSTANCE2, 'newPassword') manager.DRIVER = None @mock.patch('os.name', 'posix') @mock.patch('cpuinfo.get_cpu_info') @mock.patch('distro.major_version') @mock.patch('distro.id') def test_load_driver_centos_system( self, mock_id, mock_major, mock_cpuinfo): mock_id.return_value = 'centos' mock_major.return_value = '8' mock_cpuinfo.return_value = fake.CPUINFO_X86 mgmt = manager.AgentManager() self.assertEqual('centos', mgmt.driver.driver_name) manager.DRIVER = None @mock.patch('os.name', 'posix') @mock.patch('cpuinfo.get_cpu_info') @mock.patch('distro.major_version') @mock.patch('distro.id') def test_load_driver_centos_v7_x86( self, mock_id, mock_major, mock_cpuinfo): mock_id.return_value = 'centos' mock_major.return_value = '7' mock_cpuinfo.return_value = fake.CPUINFO_X86 mgmt = manager.AgentManager() self.assertEqual('centos_v7_x86', mgmt.driver.driver_name) manager.DRIVER = None @mock.patch('os.name', 'posix') @mock.patch('cpuinfo.get_cpu_info') @mock.patch('distro.major_version') @mock.patch('distro.id') def test_load_driver_centos_v7_arm( self, mock_id, mock_major, mock_cpuinfo): mock_id.return_value = 'centos' mock_major.return_value = '7' mock_cpuinfo.return_value = fake.CPUINFO_ARM mgmt = manager.AgentManager() self.assertEqual('centos_v7_arm', mgmt.driver.driver_name) manager.DRIVER = None @mock.patch('os.name', 'posix') @mock.patch('cpuinfo.get_cpu_info') @mock.patch('distro.major_version') @mock.patch('distro.id') def test_load_driver_linux( self, mock_id, mock_major, mock_cpuinfo): mock_id.return_value = 'ubuntu' mock_major.return_value = '18' mock_cpuinfo.return_value = fake.CPUINFO_X86 mgmt = manager.AgentManager() self.assertEqual('linux', mgmt.driver.driver_name) manager.DRIVER = None @mock.patch('os.name', 'nt') @mock.patch('cpuinfo.get_cpu_info') @mock.patch('distro.major_version') @mock.patch('distro.id') def test_load_driver_windows_system( self, mock_id, mock_major, mock_cpuinfo): mock_id.return_value = '' mock_major.return_value = '' mock_cpuinfo.return_value = fake.CPUINFO_X86 mgmt = manager.AgentManager() self.assertEqual('windows', mgmt.driver.driver_name) manager.DRIVER = None
36.425743
71
0.658331
450
3,679
5.073333
0.144444
0.09067
0.065703
0.041612
0.74551
0.713097
0.688568
0.651336
0.606658
0.606658
0
0.008194
0.237021
3,679
100
72
36.79
0.80513
0
0
0.529412
0
0
0.150041
0.041044
0
0
0
0
0.070588
1
0.070588
false
0.058824
0.070588
0
0.152941
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
3
cf7d21618c339305ddfcff0e939d31c375526df6
55
py
Python
blog/__init__.py
lambsteak/usefulpython
7f5b8c23e2ee58228210b44ced6ebe8b79cb9888
[ "MIT" ]
29
2018-03-29T02:56:11.000Z
2021-12-25T16:49:29.000Z
blog/__init__.py
lambsteak/usefulpython
7f5b8c23e2ee58228210b44ced6ebe8b79cb9888
[ "MIT" ]
5
2020-06-05T17:05:49.000Z
2022-01-13T00:37:26.000Z
blog/__init__.py
lambsteak/usefulpython
7f5b8c23e2ee58228210b44ced6ebe8b79cb9888
[ "MIT" ]
5
2018-03-29T07:37:56.000Z
2021-02-16T18:54:55.000Z
default_app_config = 'techpsyched.blog.apps.BlogConfig'
55
55
0.854545
7
55
6.428571
1
0
0
0
0
0
0
0
0
0
0
0
0.036364
55
1
55
55
0.849057
0
0
0
0
0
0.571429
0.571429
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
d85909e7ae8e7ac765352971e2cb52837cf08262
1,098
py
Python
u-boot-2019.01+gitAUTOINC+333c3e72d3-g333c3e72d3/tools/binman/etype/x86_start16_spl.py
rlourette/TI_SDK_u-boot-2019.01
3000a07c021e84d717e6792a74efcf895a7d7188
[ "MIT" ]
8
2020-09-06T12:49:00.000Z
2022-03-09T04:02:06.000Z
u-boot-2019.01+gitAUTOINC+333c3e72d3-g333c3e72d3/tools/binman/etype/x86_start16_spl.py
rlourette/TI_SDK_u-boot-2019.01
3000a07c021e84d717e6792a74efcf895a7d7188
[ "MIT" ]
null
null
null
u-boot-2019.01+gitAUTOINC+333c3e72d3-g333c3e72d3/tools/binman/etype/x86_start16_spl.py
rlourette/TI_SDK_u-boot-2019.01
3000a07c021e84d717e6792a74efcf895a7d7188
[ "MIT" ]
7
2020-09-08T15:14:34.000Z
2021-06-24T18:03:49.000Z
# SPDX-License-Identifier: GPL-2.0+ # Copyright (c) 2016 Google, Inc # Written by Simon Glass <sjg@chromium.org> # # Entry-type module for the 16-bit x86 start-up code for U-Boot SPL # from entry import Entry from blob import Entry_blob class Entry_x86_start16_spl(Entry_blob): """x86 16-bit start-up code for SPL Properties / Entry arguments: - filename: Filename of spl/u-boot-x86-16bit-spl.bin (default 'spl/u-boot-x86-16bit-spl.bin') x86 CPUs start up in 16-bit mode, even if they are 64-bit CPUs. This code must be placed at a particular address. This entry holds that code. It is typically placed at offset CONFIG_SYS_X86_START16. The code is responsible for changing to 32-bit mode and starting SPL, which in turn changes to 64-bit mode and jumps to U-Boot (for 64-bit U-Boot). For 32-bit U-Boot, the 'x86_start16' entry type is used instead. """ def __init__(self, section, etype, node): Entry_blob.__init__(self, section, etype, node) def GetDefaultFilename(self): return 'spl/u-boot-x86-16bit-spl.bin'
35.419355
78
0.704007
185
1,098
4.081081
0.475676
0.046358
0.031788
0.043709
0.150993
0.087417
0.087417
0
0
0
0
0.059633
0.205829
1,098
30
79
36.6
0.806193
0.689435
0
0
0
0
0.096886
0.096886
0
0
0
0
0
1
0.285714
false
0
0.285714
0.142857
0.857143
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
d86128c8e44cf28ab31b68a71defd6b42273875a
396
py
Python
tests/unit/test_handler.py
mt5225/lambda_T
82f041cda8c64bbcbddfa5b137630d4f19b84d8f
[ "MIT" ]
null
null
null
tests/unit/test_handler.py
mt5225/lambda_T
82f041cda8c64bbcbddfa5b137630d4f19b84d8f
[ "MIT" ]
null
null
null
tests/unit/test_handler.py
mt5225/lambda_T
82f041cda8c64bbcbddfa5b137630d4f19b84d8f
[ "MIT" ]
null
null
null
from http import HTTPStatus from service.my_handler import my_handler from aws_lambda_powertools.utilities.typing import LambdaContext def generate_context() -> LambdaContext: context = LambdaContext() context._aws_request_id = '888888' return context def test_handler_200_ok(): response = my_handler({}, generate_context()) assert response['statusCode'] == HTTPStatus.OK
26.4
64
0.770202
47
396
6.212766
0.553191
0.092466
0.184932
0
0
0
0
0
0
0
0
0.026627
0.146465
396
14
65
28.285714
0.837278
0
0
0
1
0
0.040404
0
0
0
0
0
0.1
1
0.2
false
0
0.3
0
0.6
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
0
0
0
1
0
0
3
d868695a4db7fd8a8741ef2eeeb00aff02bf1b94
254
py
Python
players/urls.py
ThrowsException/CLeagueHero
7f85c942e7f326b0b3d40fecf10f1277d9b11e38
[ "MIT" ]
1
2019-05-28T12:50:08.000Z
2019-05-28T12:50:08.000Z
players/urls.py
ThrowsException/CLeagueHero
7f85c942e7f326b0b3d40fecf10f1277d9b11e38
[ "MIT" ]
null
null
null
players/urls.py
ThrowsException/CLeagueHero
7f85c942e7f326b0b3d40fecf10f1277d9b11e38
[ "MIT" ]
null
null
null
from django.conf.urls import patterns, url urlpatterns = patterns('', url(r'^me/$', 'players.views.me', name='me'), url(r'^update_me/$', 'players.views.update_me', name='update_me') )
36.285714
88
0.5
28
254
4.428571
0.5
0.193548
0.225806
0
0
0
0
0
0
0
0
0
0.334646
254
6
89
42.333333
0.733728
0
0
0
0
0
0.26378
0.090551
0
0
0
0
0
1
0
false
0
0.2
0
0.2
0
1
0
0
null
0
1
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
d8742b309974e725fcec33bf554ecccb30b9d577
1,254
py
Python
reorder-12sheet.py
byewokko/pdf-imposition
4f9a6705e9245c30579f5cf5ddd9c6cd59ddaacc
[ "MIT" ]
null
null
null
reorder-12sheet.py
byewokko/pdf-imposition
4f9a6705e9245c30579f5cf5ddd9c6cd59ddaacc
[ "MIT" ]
null
null
null
reorder-12sheet.py
byewokko/pdf-imposition
4f9a6705e9245c30579f5cf5ddd9c6cd59ddaacc
[ "MIT" ]
null
null
null
""" # Reorders pages so that 2x3x2 of them fit on one large printer's sheet """ from PyPDF2 import PdfFileWriter, PdfFileReader import sys fname = sys.argv[1] o = PdfFileWriter() with open(fname,"rb") as si, open(fname[:-4]+"-12.pdf","wb") as so: i = PdfFileReader(si) tot = i.getNumPages() n = 0 while n < tot: o.addPage(i.getPage(n)) o.addPage(i.getPage(n+1)) if n + 4 < tot: o.addPage(i.getPage(n+4)) o.addPage(i.getPage(n+5)) else: o.addPage(i.getPage(n)) o.addPage(i.getPage(n+1)) if n + 8 < tot: o.addPage(i.getPage(n+8)) o.addPage(i.getPage(n+9)) else: o.addPage(i.getPage(n)) o.addPage(i.getPage(n+1)) o.addPage(i.getPage(n+2)) o.addPage(i.getPage(n+3)) if n + 6 < tot: o.addPage(i.getPage(n+6)) o.addPage(i.getPage(n+7)) else: o.addPage(i.getPage(n)) o.addPage(i.getPage(n+1)) if n + 10 < tot: o.addPage(i.getPage(n+10)) o.addPage(i.getPage(n+11)) else: o.addPage(i.getPage(n)) o.addPage(i.getPage(n+1)) n += 12 o.write(so)
26.125
71
0.501595
192
1,254
3.276042
0.276042
0.254372
0.286169
0.508744
0.612083
0.449921
0.317965
0.317965
0.317965
0.317965
0
0.039663
0.336523
1,254
47
72
26.680851
0.716346
0.056619
0
0.358974
0
0
0.009362
0
0
0
0
0
0
1
0
false
0
0.051282
0
0.051282
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
d888c33f541742f5286f4e32e26b96e05613756b
1,199
py
Python
okonomiyaki/utils/testing.py
enthought/okonomiyaki
51b8b4fa8d17255e13c097402691726545cf5b4c
[ "BSD-3-Clause" ]
1
2021-06-01T16:35:00.000Z
2021-06-01T16:35:00.000Z
okonomiyaki/utils/testing.py
enthought/okonomiyaki
51b8b4fa8d17255e13c097402691726545cf5b4c
[ "BSD-3-Clause" ]
249
2015-02-24T19:06:53.000Z
2021-07-30T09:01:53.000Z
okonomiyaki/utils/testing.py
enthought/okonomiyaki
51b8b4fa8d17255e13c097402691726545cf5b4c
[ "BSD-3-Clause" ]
4
2015-02-19T21:29:12.000Z
2016-01-14T21:02:39.000Z
class Patcher(object): """ A dumb class to allow a mock.patch object to be used as a decorator and a context manager Typical usage:: import mock import sys my_mock = Patcher(mock.patch("sys.platform", "win32")) @my_mock def func1(): print(sys.platform) def func2(): with my_mock: print(sys.platform) """ def __init__(self, patcher): self._patcher = patcher def __call__(self, func): return self._patcher(func) def __enter__(self): return self._patcher.__enter__() def __exit__(self, *a, **kw): return self._patcher.__exit__(*a, **kw) class MultiPatcher(object): """ Like Patcher, but applies a list of patchers. """ def __init__(self, patchers): self._patchers = patchers def __call__(self, func): ret = func for patcher in self._patchers: ret = patcher(ret) return ret def __enter__(self): return [patcher.__enter__() for patcher in self._patchers] def __exit__(self, *a, **kw): for patcher in self._patchers: patcher.__exit__(*a, **kw)
23.509804
79
0.581318
143
1,199
4.461538
0.321678
0.086207
0.079937
0.075235
0.15674
0
0
0
0
0
0
0.004854
0.312761
1,199
50
80
23.98
0.769417
0.316931
0
0.363636
0
0
0
0
0
0
0
0
0
1
0.363636
false
0
0
0.181818
0.681818
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
d893838c8d5d8af4f9a9201049a46dcc149f4ba5
5,892
py
Python
tests/test_param.py
ssize-t/inlinec
20eca6bf8556a77906ba5f420f09006d6daf4355
[ "Apache-2.0" ]
22
2020-10-10T18:25:04.000Z
2021-11-09T18:56:34.000Z
tests/test_param.py
ssize-t/inlinec
20eca6bf8556a77906ba5f420f09006d6daf4355
[ "Apache-2.0" ]
1
2020-11-10T03:50:05.000Z
2020-11-10T03:50:05.000Z
tests/test_param.py
ssize-t/inlinec
20eca6bf8556a77906ba5f420f09006d6daf4355
[ "Apache-2.0" ]
2
2020-10-10T16:09:42.000Z
2021-03-10T16:43:11.000Z
# coding: inlinec from inlinec import inlinec from pytest import raises def test_char_arg(): @inlinec def test_char_arg(a): _Bool test_char_arg(char a) { return a == 'a'; } assert test_char_arg('a') def test_int_arg(): @inlinec def test_int_arg(a): _Bool test_int_arg(int a) { return a == 1; } assert test_int_arg(1) def test_bool_arg(): @inlinec def test_bool_arg(t): _Bool test_bool_arg(_Bool t) { return t == 1; } assert test_bool_arg(True) assert not test_bool_arg(False) def test_wchar_t_arg(): @inlinec def test_wchar_t_arg(t): #include<wchar.h> _Bool test_wchar_t_arg(wchar_t t) { return t == L'\x57'; } assert test_wchar_t_arg('W') def test_uchar_arg(): @inlinec def test_byte_arg(b): _Bool test_byte_arg(unsigned char b) { return b == 0; } assert test_byte_arg(0) def test_short_arg(): @inlinec def test_short_arg(c): _Bool test_short_arg(short c) { return c == 32767; } assert test_short_arg(32767) with raises(OverflowError): test_short_arg(99999) with raises(OverflowError): test_short_arg(-99999) def test_ushort_arg(): @inlinec def test_ushort_arg(c): _Bool test_ushort_arg(unsigned short c) { return c == 32767; } assert test_ushort_arg(32767) with raises(OverflowError): assert test_ushort_arg(-32767) def test_int_arg(): @inlinec def test_int_arg(i): _Bool test_int_arg(int i) { return i == 123456; } assert test_int_arg(123456) def test_uint_arg(): @inlinec def test_uint_arg(i): _Bool test_uint_arg(unsigned int i) { return i == 123456; } test_uint_arg(123456) with raises(OverflowError): test_uint_arg(-123456) def test_long_arg(): @inlinec def test_long_arg(i): _Bool test_long_arg(long i) { return i == 2147483647; } test_long_arg(2147483647) def test_ulong_arg(): @inlinec def test_ulong_arg(i): _Bool test_ulong_arg(unsigned long i) { return i == 4294967295; } test_ulong_arg(4294967295); with raises(OverflowError): test_ulong_arg(-1) def test_long_long_arg(): @inlinec def test_long_long_arg(i): _Bool test_long_long_arg(long long i) { return i == 9223372036854775806; } test_long_long_arg(9223372036854775806) def test_ulong_long_arg(): @inlinec def test_ulong_long_arg(i): _Bool test_ulong_long_arg(unsigned long long i) { return i == 18446744073709551613UL; } test_ulong_long_arg(18446744073709551613) with raises(OverflowError): test_ulong_long_arg(-1) def test_size_t_arg(): @inlinec def test_size_t_arg(i): typedef long unsigned int size_t; _Bool test_size_t_arg(size_t i) { return i == 9223372036854775806; } test_size_t_arg(9223372036854775806) with raises(OverflowError): test_size_t_arg(-1) def test_ssize_t_arg(): @inlinec def test_ssize_t_arg(i): # include<sys/types.h> _Bool test_ssize_t_arg(ssize_t i) { return i == -1; } test_ssize_t_arg(-1) def test_float_arg(): @inlinec def test_float_arg(f): _Bool test_float_arg(float f) { return f == 340282346638528859811704183484516925440.0000000000000000; } test_float_arg(340282346638528859811704183484516925440.0000000000000000) def test_double_arg(): @inlinec def test_double_arg(d): _Bool test_double_arg(double d) { return d == 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000000000000; } test_double_arg(179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000000000000) def test_long_double_arg(): @inlinec def test_long_double_arg(ld): _Bool test_long_double_arg(long double ld) { return ld == 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000000000000; } test_long_double_arg(179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000000000000) def test_c_char_p_arg(): @inlinec def test_c_char_p_arg(s): #include<string.h> _Bool test_c_char_p_arg(char *s) { return strcmp(s, "Hello, world!"); } test_c_char_p_arg("Hello, world!") def test_wchar_p_arg(): @inlinec def test_wchar_p_arg(t): #include<wchar.h> _Bool test_wchar_p_arg(wchar_t *t) { return wcscmp(t, L"Helloo"); } assert test_wchar_p_arg('Hello')
27.924171
351
0.691276
616
5,892
6.222403
0.113636
0.07305
0.067832
0.088703
0.453692
0.27472
0.068354
0.032872
0.017219
0
0
0.365033
0.23795
5,892
210
352
28.057143
0.488641
0.014426
0
0.221519
0
0
0.007585
0
0
0
0
0
0.06962
0
null
null
0
0.012658
null
null
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
1
0
0
0
0
0
0
0
0
3
d8b32f9758badc5aec84fac56ea73d1f7e2641c2
56
py
Python
django_rq_jobs/__init__.py
Koed00/Django-RQ-Jobs
b25ffd15c91858406494ae0c29babf00c268db18
[ "MIT" ]
null
null
null
django_rq_jobs/__init__.py
Koed00/Django-RQ-Jobs
b25ffd15c91858406494ae0c29babf00c268db18
[ "MIT" ]
null
null
null
django_rq_jobs/__init__.py
Koed00/Django-RQ-Jobs
b25ffd15c91858406494ae0c29babf00c268db18
[ "MIT" ]
null
null
null
default_app_config = 'django_rq_jobs.apps.RQJobsConfig'
28
55
0.857143
8
56
5.5
1
0
0
0
0
0
0
0
0
0
0
0
0.053571
56
1
56
56
0.830189
0
0
0
0
0
0.571429
0.571429
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
d8b476a333f0be2c84e733db55f81d187c2d0ced
2,286
py
Python
timetomodel/utils/time_utils.py
Flix6x/timetomodel
2994e4199339debb155b98c70942206f8df3ee5a
[ "MIT" ]
null
null
null
timetomodel/utils/time_utils.py
Flix6x/timetomodel
2994e4199339debb155b98c70942206f8df3ee5a
[ "MIT" ]
null
null
null
timetomodel/utils/time_utils.py
Flix6x/timetomodel
2994e4199339debb155b98c70942206f8df3ee5a
[ "MIT" ]
null
null
null
from typing import List from datetime import datetime, timedelta import pytz from pandas.tseries.frequencies import to_offset def tz_aware_utc_now() -> datetime: return datetime.utcnow().replace(tzinfo=pytz.utc) def get_most_recent_quarter(dt: datetime = None) -> datetime: if dt is None: dt = ( tz_aware_utc_now() ) # TODO: maybe we should be able to configure a timezone? return dt.replace(minute=dt.minute - (dt.minute % 15), second=0, microsecond=0) def get_closest_quarter(dt: datetime = None) -> datetime: cdt = get_most_recent_quarter(dt) if dt - cdt > timedelta(minutes=7, seconds=30): # round up return cdt + timedelta(minutes=15) return cdt def day_lags(lags): """Translate day lags into 15-minute lags""" return [l * 96 for l in lags] def to_15_min_lags(lags: List[timedelta]) -> List[int]: """Translate timedelta lags into 15-minute lags.""" return [int(lag.days * 96 + lag.seconds / 900) for lag in lags] def timedelta_to_pandas_freq_str(resolution: timedelta) -> str: """Translate a timedelta to a frequency name string used by Pandas. Unlike timedelta objects, calendar rules matter here, so safest is to pass UTC or naive datetimes. See also https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#dateoffset-objects """ return to_offset(resolution).freqstr def naive_utc_from(dt: datetime) -> datetime: """Return a naive datetime, that is localised to UTC if it has a timezone.""" if not hasattr(dt, "tzinfo") or dt.tzinfo is None: # let's hope this is the UTC time you expect return dt else: return dt.astimezone(pytz.utc).replace(tzinfo=None) def round_datetime(dt, by_seconds=60): """Round a datetime by some number of seconds. Can be made nicer by e.g. Pendulum""" dt_naive = naive_utc_from(dt) seconds = (dt_naive - dt_naive.min).total_seconds() rounding = (seconds + by_seconds / 2) // by_seconds * by_seconds return dt + timedelta(0, rounding - seconds, -dt.microsecond) def timedelta_fits_into(short_td, long_td): """Return true if multiple short timedeltas fit exactly into long timedelta""" return long_td.total_seconds() % short_td.total_seconds() == 0
34.119403
103
0.699038
341
2,286
4.55132
0.395894
0.020619
0.012887
0.016753
0.093428
0.033505
0
0
0
0
0
0.014746
0.199038
2,286
66
104
34.636364
0.832878
0.2979
0
0
0
0
0.003849
0
0
0
0
0.015152
0
1
0.257143
false
0
0.114286
0.028571
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
1
0
0
1
0
0
0
0
1
0
0
3
2b124c24ae55bbf49825c9bbc827021463b20b2e
311
py
Python
number_triangle/number_triangle_scene.py
LedMeExplain/manim-contrib
73440b378daad7c9338224d72fedb2ff9898fe4c
[ "MIT" ]
1
2021-07-26T04:35:43.000Z
2021-07-26T04:35:43.000Z
number_triangle/number_triangle_scene.py
LedMeExplain/manim-contrib
73440b378daad7c9338224d72fedb2ff9898fe4c
[ "MIT" ]
null
null
null
number_triangle/number_triangle_scene.py
LedMeExplain/manim-contrib
73440b378daad7c9338224d72fedb2ff9898fe4c
[ "MIT" ]
null
null
null
from manim import * from number_triangle import PascalTriangle, NumberTriangle # from numpy import np class PascalScene(Scene): def construct(self): self.add(PascalTriangle(10)) class NumberScene(Scene): def construct(self): self.add(NumberTriangle(lambda n, k: str((n+k) % 4), 10))
22.214286
65
0.70418
40
311
5.45
0.575
0.073395
0.155963
0.192661
0.256881
0.256881
0
0
0
0
0
0.019763
0.186495
311
13
66
23.923077
0.841897
0.064309
0
0.25
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.75
0
0
0
0
null
0
0
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
2b59c26c31f9448324fb9a0fde0ed5c793cf807a
901
py
Python
scripts/slave/recipe_modules/ios/test_api.py
bopopescu/chromium-build
f8e42c70146c1b668421ee6358dc550a955770a3
[ "BSD-3-Clause" ]
null
null
null
scripts/slave/recipe_modules/ios/test_api.py
bopopescu/chromium-build
f8e42c70146c1b668421ee6358dc550a955770a3
[ "BSD-3-Clause" ]
null
null
null
scripts/slave/recipe_modules/ios/test_api.py
bopopescu/chromium-build
f8e42c70146c1b668421ee6358dc550a955770a3
[ "BSD-3-Clause" ]
1
2020-07-22T09:16:32.000Z
2020-07-22T09:16:32.000Z
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from copy import deepcopy from recipe_engine import recipe_test_api class iOSTestApi(recipe_test_api.RecipeTestApi): @recipe_test_api.mod_test_data @staticmethod def build_config(config): return deepcopy(config) def make_test_build_config(self, config): return self.build_config(config) @recipe_test_api.mod_test_data @staticmethod def parent_build_config(config): return deepcopy(config) def make_test_build_config_for_parent(self, config): return self.parent_build_config(config) @recipe_test_api.mod_test_data @staticmethod def child_build_configs(configs): return deepcopy(configs) def make_test_build_configs_for_children(self, configs): return self.child_build_configs(configs)
28.15625
72
0.795782
131
901
5.167939
0.389313
0.097489
0.096012
0.070901
0.397341
0.397341
0.397341
0.397341
0.339734
0.339734
0
0.005175
0.142064
901
31
73
29.064516
0.870634
0.172031
0
0.380952
0
0
0
0
0
0
0
0
0
1
0.285714
false
0
0.095238
0.285714
0.714286
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
2b706f21f69642298371d3d1278743d1389cbb84
308
py
Python
exercices/built-in-functions/exercises/6.py
cfascina/python-learning
1bc1d4032fb68456a092229de94b5207db7e9143
[ "MIT" ]
null
null
null
exercices/built-in-functions/exercises/6.py
cfascina/python-learning
1bc1d4032fb68456a092229de94b5207db7e9143
[ "MIT" ]
null
null
null
exercices/built-in-functions/exercises/6.py
cfascina/python-learning
1bc1d4032fb68456a092229de94b5207db7e9143
[ "MIT" ]
null
null
null
# Use enumerate() and other skills to return the count of the number of items in # the list whose value equals its index. def count_match_index(numbers): return len([number for index, number in enumerate(numbers) if index == number]) result = count_match_index([0, 2, 2, 1, 5, 5, 6, 10]) print(result)
34.222222
83
0.724026
53
308
4.132075
0.622642
0.091324
0.136986
0
0
0
0
0
0
0
0
0.035433
0.175325
308
8
84
38.5
0.826772
0.37987
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0
0.25
0.5
0.25
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
3
992caa52e7d50a4288abd2f68d45fd18bd10e6bb
3,425
py
Python
candidates.py
dtandev/dw-olsztyn-project
20b0ac1e13f7ed45abaa01074765e96b2bbe2b66
[ "MIT" ]
null
null
null
candidates.py
dtandev/dw-olsztyn-project
20b0ac1e13f7ed45abaa01074765e96b2bbe2b66
[ "MIT" ]
null
null
null
candidates.py
dtandev/dw-olsztyn-project
20b0ac1e13f7ed45abaa01074765e96b2bbe2b66
[ "MIT" ]
null
null
null
def candidates(): candidatesDictionary = { #Initials : [First_name, Last_name, Club, Last_seen, 'TV_station', Total_time, Last_screenshot] 'AD': ['Andrzej', 'Duda', 'Bezpartyjny', 'b/d', 'b/d', 'b/d', 'https://upload.wikimedia.org/wikipedia/commons/thumb/8/8b/Prezydent_Rzeczypospolitej_Polskiej_Andrzej_Duda.jpg/240px-Prezydent_Rzeczypospolitej_Polskiej_Andrzej_Duda.jpg'], 'MKB' : ['Małgorzata', 'Kidawa-Błońska', 'Platforma Obywatelska', 'b/d', 'b/d', 'b/d', 'https://upload.wikimedia.org/wikipedia/commons/thumb/b/b1/Kidawa-B%C5%82o%C5%84ska_%28cropped%29.jpg/240px-Kidawa-B%C5%82o%C5%84ska_%28cropped%29.jpg'], 'SH' : ['Szymon', 'Hołownia', 'Bezpartyjny', 'b/d', 'b/d', 'b/d', 'https://upload.wikimedia.org/wikipedia/commons/thumb/0/00/02019_%283%29_Szymon_Ho%C5%82ownia.jpg/166px-02019_%283%29_Szymon_Ho%C5%82ownia.jpg'], 'RB' : ['Robert', 'Biedroń', 'Wiosna / Nowa Lewica','b/d', 'b/d', 'b/d', 'https://upload.wikimedia.org/wikipedia/commons/thumb/e/e0/Robert_wiki.png/240px-Robert_wiki.png'], 'WKK' : ['Władysław', 'Kosiniak-Kamysz', 'Polskie Stronnictwo Ludowe', 'b/d', 'b/d', 'b/d', 'https://upload.wikimedia.org/wikipedia/commons/thumb/2/2c/W%C5%82adys%C5%82aw_Kosiniak-Kamysz_Sejm_2016.JPG/163px-W%C5%82adys%C5%82aw_Kosiniak-Kamysz_Sejm_2016.JPG'], 'KB' : ['Krzysztof', 'Bosak', 'Konfederacja / Ruch Narodowy', 'b/d', 'b/d', 'b/d', 'https://upload.wikimedia.org/wikipedia/commons/thumb/a/a9/JKRUK_20190927_KRZYSZTOF_BOSAK_KIELCE_IMGP2283.jpg/209px-JKRUK_20190927_KRZYSZTOF_BOSAK_KIELCE_IMGP2283.jpg'], 'PLM' : ['Piotr', ' Liroy-Marzec', 'Skuteczni', 'b/d', 'b/d', 'b/d', 'https://upload.wikimedia.org/wikipedia/commons/thumb/b/b2/Piotr_Liroy-Marzec_Sejm_2016a.jpg/168px-Piotr_Liroy-Marzec_Sejm_2016a.jpg'], 'LS' : ['Leszek', 'Samborski', 'Odpowiedzialność', 'b/d', 'b/d', 'b/d', 'https://portalniezalezny.pl/wp-content/uploads/2016/05/leszek_samobrski.jpg'], 'PB' : ['Piotr', 'Bakun', 'Bezpartyjny', 'b/d', 'b/d', 'b/d', 'https://scontent.fwaw5-1.fna.fbcdn.net/v/t1.0-9/43248180_340778723157575_4132832989245603840_n.png?_nc_cat=100&_nc_oc=AQmnsAjKoKb3pMRLc0q626fo64-Nr_dxI9DQl4QVONXckCPINnh77CJHUY_T5fJElL8&_nc_ht=scontent.fwaw5-1.fna&oh=5c22ef03e08609abaee81b7739d6c552&oe=5F02CDF5'], 'SZ' : ['Stanisław', 'Żółtek', 'Kongres Nowej Prawicy / PolEXIT', 'b/d', 'b/d', 'b/d', 'https://upload.wikimedia.org/wikipedia/commons/thumb/c/c0/Stanis%C5%82aw_%C5%BB%C3%B3%C5%82tek.JPG/180px-Stanis%C5%82aw_%C5%BB%C3%B3%C5%82tek.JPG'], 'WP' : ['Wojciech', 'Podjacki', 'Liga Obrony Suwerenności', 'b/d', 'b/d', 'b/d', 'https://upload.wikimedia.org/wikipedia/commons/thumb/2/27/Wojciech_Podjacki.JPG/800px-Wojciech_Podjacki.JPG'], #'MP' : ['Mirosław', ' Piotrowski', 'Ruch Prawdziwa Europa - Europa Christi', 'b/d', 'b/d', 'b/d', 'https://upload.wikimedia.org/wikipedia/commons/thumb/1/15/Miros%C5%82aw_Piotrowski_%28Martin_Rulsch%29_1.jpg/152px-Miros%C5%82aw_Piotrowski_%28Martin_Rulsch%29_1.jpg'], #'AV' : ['Andrzej', ' Voigt', 'Bezpartyjny', 'b/d', 'b/d', 'b/d', ''] } return candidatesDictionary def candidates_color_mapping(candidates): colors = px.colors.qualitative.Light24 candidatesNames = ['{} {}'.format(candidates[candidate][0], candidates[candidate][1]) for candidate in candidates] candidates_color_map = dict(zip(candidatesNames, colors)) return candidates_color_map
142.708333
335
0.706861
489
3,425
4.795501
0.390593
0.033262
0.033262
0.04435
0.495522
0.495522
0.431557
0.38209
0.347122
0.284009
0
0.089855
0.093431
3,425
24
336
142.708333
0.665378
0.125255
0
0
0
0.5
0.705411
0
0
0
0
0
0
1
0.1
false
0
0
0
0.2
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
996e85b7c3034dd5d34c311c2d344fa86800b4dd
11,483
py
Python
solum/tests/deployer/handlers/test_heat.py
ed-/solum
2d23edb7fb53e1bdeff510710824658575d166c4
[ "Apache-2.0" ]
null
null
null
solum/tests/deployer/handlers/test_heat.py
ed-/solum
2d23edb7fb53e1bdeff510710824658575d166c4
[ "Apache-2.0" ]
null
null
null
solum/tests/deployer/handlers/test_heat.py
ed-/solum
2d23edb7fb53e1bdeff510710824658575d166c4
[ "Apache-2.0" ]
null
null
null
# Copyright 2014 - Rackspace Hosting # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import json import mock from oslo.config import cfg from solum.deployer.handlers import heat as heat_handler from solum.objects import assembly from solum.tests import base from solum.tests import fakes from solum.tests import utils STATES = assembly.States class HandlerTest(base.BaseTestCase): def setUp(self): super(HandlerTest, self).setUp() self.ctx = utils.dummy_context() def test_create(self): handler = heat_handler.Handler() handler.echo = mock.MagicMock() handler.echo({}, 'foo') handler.echo.assert_called_once_with({}, 'foo') @mock.patch('solum.common.catalog.get') @mock.patch('solum.objects.registry') @mock.patch('solum.common.clients.OpenStackClients') def test_deploy(self, mock_clients, mock_registry, mock_get_templ): handler = heat_handler.Handler() fake_assembly = fakes.FakeAssembly() mock_registry.Assembly.get_by_id.return_value = fake_assembly fake_template = json.dumps({'description': 'test'}) mock_get_templ.return_value = fake_template handler._find_id_if_stack_exists = mock.MagicMock(return_value=(None)) stacks = mock_clients.return_value.heat.return_value.stacks stacks.create.return_value = {"stack": { "id": "fake_id", "links": [{"href": "http://fake.ref", "rel": "self"}]}} neutron = mock_clients.return_value.neutron neutron.return_value.list_networks.return_value = { "networks": [{"router:external": True, "id": "public_net_id"}, {"router:external": False, "id": "private_net_id", "subnets": ["private_subnet_id"]}]} handler._update_assembly_status = mock.MagicMock() handler.deploy(self.ctx, 77, 'created_image_id') parameters = {'image': 'created_image_id', 'app_name': 'faker', 'private_net': 'private_net_id', 'public_net': 'public_net_id', 'private_subnet': 'private_subnet_id'} stacks = mock_clients.return_value.heat.return_value.stacks stacks.create.assert_called_once_with(stack_name='faker-test_uuid', template=fake_template, parameters=parameters) neutron = mock_clients.return_value.neutron neutron.return_value.list_networks.assert_called_once_with() assign_and_create_mock = mock_registry.Component.assign_and_create comp_name = 'Heat_Stack_for_%s' % fake_assembly.name assign_and_create_mock.assert_called_once_with(self.ctx, fake_assembly, comp_name, 'Heat Stack', 'Heat Stack test', 'http://fake.ref', 'fake_id') @mock.patch('solum.common.catalog.get') @mock.patch('solum.objects.registry') @mock.patch('solum.common.clients.OpenStackClients') def test_comp_name_error(self, mock_clients, mock_registry, mock_get_templ): handler = heat_handler.Handler() fake_assembly = fakes.FakeAssembly() mock_registry.Assembly.get_by_id.return_value = fake_assembly fake_template = json.dumps({'description': 'test'}) mock_get_templ.return_value = fake_template handler._find_id_if_stack_exists = mock.MagicMock(return_value=(None)) stacks = mock_clients.return_value.heat.return_value.stacks stacks.create.return_value = {"stack": { "id": "fake_id", "links": [{"href": "http://fake.ref", "rel": "self"}]}} handler._update_assembly_status = mock.MagicMock() handler.deploy(self.ctx, 77, 'created_image_id') assign_and_create_mock = mock_registry.Component.assign_and_create comp_name = 'Heat Stack for %s' % fake_assembly.name self.assertRaises(AssertionError, assign_and_create_mock.assert_called_once_with, comp_name) @mock.patch('solum.common.catalog.get') @mock.patch('solum.objects.registry') @mock.patch('solum.common.clients.OpenStackClients') @mock.patch('solum.deployer.handlers.heat.cfg.CONF.api.image_format') def test_deploy_docker(self, image_format, mock_clients, mock_registry, mock_get_templ): handler = heat_handler.Handler() image_format.return_value = "docker" fake_assembly = fakes.FakeAssembly() mock_registry.Assembly.get_by_id.return_value = fake_assembly fake_template = json.dumps({'description': 'test'}) mock_get_templ.return_value = fake_template handler._find_id_if_stack_exists = mock.MagicMock(return_value=(None)) stacks = mock_clients.return_value.heat.return_value.stacks stacks.create.return_value = {"stack": { "id": "fake_id", "links": [{"href": "http://fake.ref", "rel": "self"}]}} handler._update_assembly_status = mock.MagicMock() handler.deploy(self.ctx, 77, 'created_image_id') parameters = {'image': 'created_image_id', 'app_name': 'faker'} stacks.create.assert_called_once_with(stack_name='faker-test_uuid', template=fake_template, parameters=parameters) assign_and_create_mock = mock_registry.Component.assign_and_create comp_name = 'Heat_Stack_for_%s' % fake_assembly.name assign_and_create_mock.assert_called_once_with(self.ctx, fake_assembly, comp_name, 'Heat Stack', 'Heat Stack test', 'http://fake.ref', 'fake_id') @mock.patch('solum.common.clients.OpenStackClients') def test_update_assembly_status(self, mock_clients): handler = heat_handler.Handler() fake_assembly = fakes.FakeAssembly() stack = mock.MagicMock() stack.status = 'COMPLETE' mock_clients.heat().stacks.get.return_value = stack handler._parse_server_url = mock.MagicMock(return_value=('xyz')) handler._update_assembly_status(self.ctx, fake_assembly, mock_clients, 'fake_id') self.assertEqual(fake_assembly.status, 'READY') fake_assembly.save.assert_called_once_with(self.ctx) @mock.patch('solum.common.clients.OpenStackClients') def test_update_assembly_status_failed(self, mock_clients): handler = heat_handler.Handler() fake_assembly = fakes.FakeAssembly() stack = mock.MagicMock() stack.status = 'FAILED' mock_clients.heat().stacks.get.return_value = stack handler._update_assembly_status(self.ctx, fake_assembly, mock_clients, 'fake_id') self.assertEqual(fake_assembly.status, 'ERROR') fake_assembly.save.assert_called_once_with(self.ctx) def test_parse_server_url(self): handler = heat_handler.Handler() heat_output = mock.MagicMock() heat_output._info = {"id": "fake_id", "outputs": [{"output_value": "192.168.78.21", "description": "IP", "output_key": "public_ip"}, {"output_value": "http://192.168.78.21:5000", "description": "URL", "output_key": "URL"}]} host_url = handler._parse_server_url(heat_output) self.assertEqual(host_url, "http://192.168.78.21:5000") @mock.patch('solum.common.clients.OpenStackClients') def test_find_id_if_stack_exists(self, mock_clients): handler = heat_handler.Handler() assem = mock.MagicMock assem.heat_stack_component = mock.MagicMock assem.heat_stack_component.heat_stack_id = '123' id = handler._find_id_if_stack_exists(mock_clients, assem) self.assertEqual(id, '123') @mock.patch('solum.objects.registry') @mock.patch('solum.common.clients.OpenStackClients') def test_destroy_success(self, mock_client, mock_registry): fake_assem = fakes.FakeAssembly() mock_registry.Assembly.get_by_id.return_value = fake_assem handler = heat_handler.Handler() handler._find_id_if_stack_exists = mock.MagicMock(return_value='42') handler._get_stack_id_from_heat = mock.MagicMock(return_value=None) cfg.CONF.deployer.max_attempts = 1 cfg.CONF.deployer.wait_interval = 0 cfg.CONF.deployer.growth_factor = 1.2 handler.destroy(self.ctx, fake_assem.id) mock_client.heat.stacks.delete.assert_called_once() fake_assem.destroy.assert_called_once() @mock.patch('solum.objects.registry') @mock.patch('solum.common.clients.OpenStackClients') def test_destroy_error(self, mock_client, mock_registry): fake_assem = fakes.FakeAssembly() mock_registry.Assembly.get_by_id.return_value = fake_assem handler = heat_handler.Handler() handler._find_id_if_stack_exists = mock.MagicMock(return_value='42') cfg.CONF.deployer.max_attempts = 1 cfg.CONF.deployer.wait_interval = 0 cfg.CONF.deployer.growth_factor = 1.2 handler.destroy(self.ctx, fake_assem.id) mock_client.heat.stacks.delete.assert_called_once() fake_assem.save.assert_called_once_with(self.ctx) self.assertEqual(STATES.ERROR_STACK_DELETE_FAILED, fake_assem.status) @mock.patch('solum.objects.registry') @mock.patch('solum.common.clients.OpenStackClients') def test_destroy_absent(self, mock_client, mock_registry): fake_assem = fakes.FakeAssembly() mock_registry.Assembly.get_by_id.return_value = fake_assem handler = heat_handler.Handler() handler._find_id_if_stack_exists = mock.MagicMock(return_value=None) handler.destroy(self.ctx, fake_assem.id) assert not mock_client.heat.stacks.delete.called fake_assem.destroy.assert_called_once()
46.678862
78
0.610642
1,274
11,483
5.202512
0.153061
0.059747
0.040133
0.03621
0.749397
0.728576
0.703983
0.683917
0.670489
0.644387
0
0.008582
0.289646
11,483
245
79
46.869388
0.803972
0.048506
0
0.646766
0
0
0.133706
0.054161
0
0
0
0
0.104478
1
0.059701
false
0
0.039801
0
0.104478
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
9972ea18a5d874d5198a2ae3b6c8f8b760448ddf
236
py
Python
exercicios/PythonExercicios/ex034.py
Roberto-Sartore/Python
98f91f13cf78d761893c4a1f3264ed999244d32b
[ "MIT" ]
null
null
null
exercicios/PythonExercicios/ex034.py
Roberto-Sartore/Python
98f91f13cf78d761893c4a1f3264ed999244d32b
[ "MIT" ]
null
null
null
exercicios/PythonExercicios/ex034.py
Roberto-Sartore/Python
98f91f13cf78d761893c4a1f3264ed999244d32b
[ "MIT" ]
null
null
null
sal = float(input('Qual é o salario do funcionario? R$ ')) if sal > 1250: alm = sal + (sal * 10 / 100) if sal <= 1250: alm = sal + (sal * 15 /100) print('Quem ganhava R$ {:.2f} passa a ganhar R$ {:.2f} agora.'.format(sal, alm))
33.714286
80
0.580508
40
236
3.425
0.625
0.072993
0.131387
0.175182
0.262774
0.262774
0
0
0
0
0
0.10989
0.228814
236
6
81
39.333333
0.642857
0
0
0
0
0
0.381356
0
0
0
0
0
0
1
0
false
0.166667
0
0
0
0.166667
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
1
0
0
0
0
0
3
9978742273724d83bb2ed7afd1e77cd65f539221
102
gyp
Python
binding.gyp
lukechu10/Smart-TicTacToe
472a37df06c37c833c67f31697f21d129a8ef46e
[ "MIT" ]
1
2019-05-06T16:19:41.000Z
2019-05-06T16:19:41.000Z
binding.gyp
lukechu10/Smart-TicTacToe
472a37df06c37c833c67f31697f21d129a8ef46e
[ "MIT" ]
null
null
null
binding.gyp
lukechu10/Smart-TicTacToe
472a37df06c37c833c67f31697f21d129a8ef46e
[ "MIT" ]
null
null
null
{ "targets": [ { "target_name": "game", "sources": [ "game.cpp" ] } ] }
12.75
32
0.352941
7
102
5
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.421569
102
8
33
12.75
0.59322
0
0
0
0
0
0.385417
0
0
0
0
0
0
1
0
true
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
99871f4cb8237c6397fd4e5e489b557178902b44
289
py
Python
leadsmanager/leads/models.py
timoluxinne/Fullstack-Lead-Manager
0d505b825984c49908e293f5fdb7a1ff5bffbde1
[ "MIT" ]
1
2021-05-15T16:40:06.000Z
2021-05-15T16:40:06.000Z
leadsmanager/leads/models.py
timoluxinne/Fullstack-Lead-Manager
0d505b825984c49908e293f5fdb7a1ff5bffbde1
[ "MIT" ]
null
null
null
leadsmanager/leads/models.py
timoluxinne/Fullstack-Lead-Manager
0d505b825984c49908e293f5fdb7a1ff5bffbde1
[ "MIT" ]
null
null
null
from django.db import models # Create your models here. class Lead(models.Model): name = models.CharField(max_length=200) email = models.EmailField(max_length=200, unique=True) message = models.CharField(max_length=200) created_at = models.DateTimeField(auto_now_add=True)
36.125
58
0.761246
41
289
5.219512
0.658537
0.126168
0.168224
0.224299
0.252336
0
0
0
0
0
0
0.036145
0.138408
289
8
59
36.125
0.823293
0.083045
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.166667
0
1
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
9993aa53284a3663a6c0c0bec9eda6d27d0132a0
6,204
py
Python
Sindri/db_utils.py
mrcsbrn/TCC_software
17a5335aed17d4740c3bbd0ef828b0fc5dcea1da
[ "MIT" ]
11
2019-10-17T02:01:51.000Z
2022-03-17T17:39:34.000Z
Sindri/db_utils.py
mrcsbrn/TCC_software
17a5335aed17d4740c3bbd0ef828b0fc5dcea1da
[ "MIT" ]
2
2019-07-25T22:16:16.000Z
2020-03-28T01:59:59.000Z
Sindri/db_utils.py
mrcsbrn/TCC_software
17a5335aed17d4740c3bbd0ef828b0fc5dcea1da
[ "MIT" ]
5
2019-07-15T18:19:36.000Z
2021-12-24T08:06:24.000Z
import db class Compound: def __init__(self, cdict): self._cdict = cdict def getSubstanceID(self): return self._cdict["substance_id"] def getName(self): return self._testString(self._cdict["Name"]) def getFormula(self): return self._testString(self._cdict["Formula"]) def getCAS(self): return self._testString(self._cdict["CAS"]) def getMolWt(self): return self._testValue(self._cdict["Mol. Wt."]) def getTfp(self): return self._testValue(self._cdict["Tfp_K"]) def getTb(self): return self._testValue(self._cdict["Tb_K"]) def getTc(self): return self._testValue(self._cdict["Tc_K"]) def getPc(self): return self._testValue(self._cdict["Pc_bar"]) * 1e5 def getVc(self): return self._testValue(self._cdict["Vc_cm3/mol"]) / 100 ** 3 def getZc(self): return self._testValue(self._cdict["Zc"]) def getOmega(self): return self._testValue(self._cdict["omega"]) def getTcpMin(self): return self._testValue(self._cdict["Tcpmin_K"]) def getTcpMax(self): return self._testValue(self._cdict["Tcpmax_K"]) def geta0(self): return self._testValue(self._cdict["a0"]) def geta1(self): return self._testValue(self._cdict["a1"]) def geta2(self): return self._testValue(self._cdict["a2"]) def geta3(self): return self._testValue(self._cdict["a3"]) def geta4(self): return self._testValue(self._cdict["a4"]) def getCpCoeffs(self): return self.geta0(), self.geta1(), self.geta2(), self.geta3(), self.geta4() def hasAllCpCoeffs(self): try: a = self.geta0() + 1.0 a = self.geta1() + 1.0 a = self.geta2() + 1.0 a = self.geta3() + 1.0 a = self.geta4() + 1.0 return True except: return False def hasAntoine(self): if self.getAntoineA() and self.getAntoineB() and self.getAntoineC(): return True return False def getAntoineCoeffs(self): return ( self.getAntoineA(), self.getAntoineB(), self.getAntoineC(), self.getAntoineTmin(), self.getAntoineTmax(), ) def getCpIG(self): return self._testValue(self._cdict["CpIG"]) def getCpliq(self): return self._testValue(self._cdict["Cpliq"]) def getAntoineA(self): return self._testValue(self._cdict["ANTOINE_A"]) def getAntoineB(self): return self._testValue(self._cdict["ANTOINE_B"]) def getAntoineC(self): return self._testValue(self._cdict["ANTOINE_C"]) def getAntoinePvmin(self): return self._testValue(self._cdict["Pvmin_bar"]) * 1e5 def getAntoinePvmax(self): return self._testValue(self._cdict["Pvmax_bar"]) * 1e5 def getAntoineTmin(self): return self._testValue(self._cdict["Tmin_K"]) def getAntoineTmax(self): return self._testValue(self._cdict["Tmax_K"]) def _testValue(self, val): try: val = float(val) _tmp = val + 1.0 ret = val except: ret = False return ret def _testString(self, s): if len(s) > 0: return s else: return False def get_compound_properties(name, formula): """ Search for 'name' and 'formula' in the database and returns a dictionary of the result. Parameters ---------- name : str Name of the compound to be searched. formula : str Formula of the compound to be searched. Returns ------- compound_dict : dict A dictionary containing the correspondent values for the substance in the database. The dictionary has the following keys: "Formula", "Name", "CAS", "Mol. Wt.", "Tfp_K", "Tb_K", "Tc_K", "Pc_bar", "Vc_cm3/mol", "Zc", "omega", "Tcpmin_K", "Tcpmax_K", "a0", "a1", "a2", "a3", "a4", "CpIG", "Cpliq", "ANTOINE_A", "ANTOINE_B", "ANTOINE_C", "Pvmin_bar", "Tmin_K", "Pvmax_bar", "Tmax_K" If the compound has no value on a specific key, the value stored is '""' or 'None'. """ db.init() # verificar problemas com isso aqui table_name = "v_all_properties_including_correlations" query = ( "SELECT * FROM " + table_name + " WHERE formula LIKE '%" + formula + "%'" + " AND name LIKE '%" + name + "%'" ) db.cursor.execute(query) results = db.cursor.fetchall() res = results[0] substance_id = db.cursor.execute( "SELECT substance_id from substance " + " WHERE formula LIKE '%" + formula + "%'" + " AND name LIKE '%" + name + "%'" ).fetchone()[0] dict_names = [ "substance_id", "Formula", "Name", "CAS", "Mol. Wt.", "Tfp_K", "Tb_K", "Tc_K", "Pc_bar", "Vc_cm3/mol", # 8 "Zc", "omega", # 10 "Tcpmin_K", # 11 "Tcpmax_K", # 11 "a0", # 12 "a1", "a2", "a3", "a4", # 16 "CpIG", "Cpliq", "ANTOINE_A", "ANTOINE_B", "ANTOINE_C", "Pvmin_bar", "Tmin_K", "Pvmax_bar", "Tmax_K", ] res2 = [substance_id] for i in range(len(res)): if i == 11: tmin = None tmax = None if res[i] and "-" in res[i]: temps = res[i].split("-") tmin = float(temps[0]) tmax = float(temps[1]) res2.append(tmin) res2.append(tmax) else: res2.append(res[i]) mydict = dict(zip(dict_names, res2)) return Compound(mydict)
24.234375
91
0.516119
680
6,204
4.530882
0.238235
0.087634
0.136319
0.179163
0.394677
0.394677
0.128205
0.09023
0.065563
0.065563
0
0.019456
0.353804
6,204
255
92
24.329412
0.749065
0.161509
0
0.137725
0
0
0.099542
0.007764
0
0
0
0
0
1
0.215569
false
0
0.005988
0.179641
0.45509
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
1
0
0
0
3
513a899a658135e0b2c33cee7432d5b67c8a245b
4,126
py
Python
server/server/queue/framework.py
benetech/Winnow2.0
bc428d7f74bd7db71b6d70ab15dc7a5c37786c46
[ "MIT" ]
26
2019-12-16T21:22:14.000Z
2022-03-25T16:05:32.000Z
server/server/queue/framework.py
benetech/Winnow2.0
bc428d7f74bd7db71b6d70ab15dc7a5c37786c46
[ "MIT" ]
325
2019-10-28T16:24:45.000Z
2022-03-31T13:12:15.000Z
server/server/queue/framework.py
benetech/Winnow2.0
bc428d7f74bd7db71b6d70ab15dc7a5c37786c46
[ "MIT" ]
9
2019-10-09T16:20:38.000Z
2021-12-22T18:44:45.000Z
import abc import os from typing import Tuple, List, Iterable, Union, Optional, TextIO from server.queue.model import TaskStatus, Task, Request class BaseObserver: """Basic task queue observer, ignores all events by default.""" def on_task_sent(self, task: Task): """Fires when a task message is published.""" pass def on_task_started(self, task: Task): """Fires just before the worker executes the task.""" pass def on_task_succeeded(self, task: Task): """Fires if the task executed successfully.""" pass def on_task_failed(self, task: Task): """Fires if the execution of the task failed.""" pass def on_task_revoked(self, task: Task): """Fires if the task has been revoked.""" pass def on_task_meta_updated(self, task: Task): """Fires when task runtime metadata is updated.""" pass def on_task_deleted(self, task_id: str): """Fires when task is deleted from the queue.""" pass # Status filter spec is either an iterable of statuses or a single status. StatusFilterSpec = Union[Iterable[TaskStatus], TaskStatus] class TaskQueue(abc.ABC): """Abstract base class for pipeline task queue.""" @abc.abstractmethod def dispatch(self, request: Request) -> Task: """Dispatch a new task.""" @abc.abstractmethod def terminate(self, task_id: str): """Terminate task by id.""" @abc.abstractmethod def delete(self, task_id: str): """Delete task by id.""" @abc.abstractmethod def get_task(self, task_id: str) -> Optional[Task]: """Get task by id.""" @abc.abstractmethod def list_tasks(self, status: Optional[StatusFilterSpec] = None, offset=0, limit=None) -> Tuple[List, int]: """List tasks with the given status.""" @abc.abstractmethod def exists(self, task_id: str) -> bool: """Check if task with the given id exists.""" @abc.abstractmethod def observe(self, observer: BaseObserver): """Add observer to the queue notification list.""" @abc.abstractmethod def stop_observing(self, observer: BaseObserver): """Remove observer from the queue notification list.""" @abc.abstractmethod def listen(self): """Listen for queue events and notify observers. This is a blocking method, it should be executed in a background thread. """ class LogStream(abc.ABC): """Abstract base class for task logs stream.""" @property @abc.abstractmethod def active(self) -> bool: """Check if the stream is active. Active stream will send data updates as they get available.""" @abc.abstractmethod def mark_finished(self): """The stream will automatically stop itself once no more data is available in the file.""" raise NotImplementedError() @abc.abstractmethod def stop(self): """Stop the stream. Once stopped stream will not broadcast any updates, all resources (open file descriptors, etc.) will be released.""" pass class TaskLogStorage(abc.ABC): """Abstract base class for log storage implementations.""" @abc.abstractmethod def get_logs(self, task_id: str) -> Optional[TextIO]: """Get task logs as file-like object.""" @abc.abstractmethod def delete_logs(self, task_id: str): """Delete task logs.""" @abc.abstractmethod def connect(self, queue: TaskQueue): """Receive updates from task queue.""" @abc.abstractmethod def stream_logs(self, task_id, callback, offset=0, whence=os.SEEK_SET) -> Optional[LogStream]: """Start a new task logs stream.""" @abc.abstractmethod def serve_streams(self): """Broadcast log updates. This is a blocking method, you probably want to execute it in a background thread.""" class TaskQueueError(Exception): """Error in task queue operation.""" class TaskQueueUnavailable(Exception): """The request cannot be served property because queue is not available or overloaded."""
29.056338
110
0.653175
522
4,126
5.101533
0.325671
0.108524
0.127676
0.034172
0.227563
0.137439
0.052572
0
0
0
0
0.000638
0.239942
4,126
141
111
29.262411
0.848533
0.382937
0
0.403226
0
0
0
0
0
0
0
0
0
1
0.387097
false
0.129032
0.064516
0
0.548387
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
513e9d7e4bf6529102f6258e7f339e3c94c167b4
216
py
Python
Statistics/Median.py
melaniemercado/CalculatorProject
3fec4cb33283b3c078a6050e403d0cb4fff0d6d9
[ "MIT" ]
null
null
null
Statistics/Median.py
melaniemercado/CalculatorProject
3fec4cb33283b3c078a6050e403d0cb4fff0d6d9
[ "MIT" ]
null
null
null
Statistics/Median.py
melaniemercado/CalculatorProject
3fec4cb33283b3c078a6050e403d0cb4fff0d6d9
[ "MIT" ]
null
null
null
def median(pool): copy = sorted(pool) size = len(copy) if size % 2 == 1: return int(copy[int((size-1) / 2)]) else: return (int(copy[int((size) / 2)-1]) + int(copy[int(size / 2)])) / 2
27
76
0.509259
34
216
3.235294
0.382353
0.136364
0.272727
0.381818
0.509091
0
0
0
0
0
0
0.051613
0.282407
216
7
77
30.857143
0.658065
0
0
0
0
0
0
0
0
0
0
0
0
1
0.142857
false
0
0
0
0.428571
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
51576515f062794d037c07aedefc9f8d36f7bfe6
973
py
Python
tests/test_helpers.py
dd4e/pyedid
a9e66a86b4683f51b20a230f7218b192874d6069
[ "MIT" ]
8
2020-04-08T07:08:49.000Z
2021-11-16T12:40:00.000Z
tests/test_helpers.py
dd4e/pyedid
a9e66a86b4683f51b20a230f7218b192874d6069
[ "MIT" ]
2
2021-03-28T21:37:59.000Z
2021-04-03T18:06:43.000Z
tests/test_helpers.py
dd4e/pyedid
a9e66a86b4683f51b20a230f7218b192874d6069
[ "MIT" ]
2
2020-04-08T07:09:02.000Z
2020-06-11T08:22:21.000Z
'''Edid helpers test module''' from pyedid import get_edid_from_xrandr_verbose from .data import PART_OF_XRANDR_VERBOSE_OUTPUT def test_edid_from_xrandr_verbose_bytes(): edids = get_edid_from_xrandr_verbose(PART_OF_XRANDR_VERBOSE_OUTPUT) assert isinstance(edids, list) assert len(edids) == 2 for edid in edids: assert isinstance(edid, bytes) # edid header assert edid[:8] == b'\x00\xff\xff\xff\xff\xff\xff\x00' def test_edid_from_xrandr_verbose_str(): edids = get_edid_from_xrandr_verbose(PART_OF_XRANDR_VERBOSE_OUTPUT.decode()) assert isinstance(edids, list) assert len(edids) == 2 for edid in edids: assert isinstance(edid, bytes) # edid header assert edid[:8] == b'\x00\xff\xff\xff\xff\xff\xff\x00' def test_edid_from_xrandr_verbose_bad_input(): empty = get_edid_from_xrandr_verbose("foo\nbar\nsome not edid data") assert isinstance(empty, list) assert len(empty) == 0
29.484848
80
0.719424
145
973
4.524138
0.268966
0.198171
0.109756
0.224085
0.785061
0.67378
0.631098
0.631098
0.631098
0.631098
0
0.016393
0.184995
973
32
81
30.40625
0.810845
0.05036
0
0.5
0
0
0.100327
0.069793
0
0
0
0
0.5
1
0.15
false
0
0.1
0
0.25
0
0
0
0
null
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
3
515e642d01e05dade3ab7a5837de3596e8640165
78
py
Python
exercicios/ex023.py
evertoncorreadias/aulas
3a99a7c4223caa7cbda7a891b619875135847e9d
[ "MIT" ]
null
null
null
exercicios/ex023.py
evertoncorreadias/aulas
3a99a7c4223caa7cbda7a891b619875135847e9d
[ "MIT" ]
null
null
null
exercicios/ex023.py
evertoncorreadias/aulas
3a99a7c4223caa7cbda7a891b619875135847e9d
[ "MIT" ]
null
null
null
#quantidade de caracteres do string frase=('curso em video') print(len(frase))
26
35
0.769231
12
78
5
0.916667
0
0
0
0
0
0
0
0
0
0
0
0.102564
78
3
36
26
0.857143
0.435897
0
0
0
0
0.318182
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
3
51629fbad223e233d930b743d999a9fe855d0677
76
py
Python
fuzz/__init__.py
samirelanduk/fuzz
c2b75009686ca9775d8bfaa4e489e7e1db5ac22b
[ "MIT" ]
1
2020-04-21T21:38:04.000Z
2020-04-21T21:38:04.000Z
fuzz/__init__.py
samirelanduk/fuzz
c2b75009686ca9775d8bfaa4e489e7e1db5ac22b
[ "MIT" ]
null
null
null
fuzz/__init__.py
samirelanduk/fuzz
c2b75009686ca9775d8bfaa4e489e7e1db5ac22b
[ "MIT" ]
null
null
null
from .values import Value __author__ = "Sam Ireland" __version__ = "0.1.1"
15.2
26
0.723684
11
76
4.272727
0.909091
0
0
0
0
0
0
0
0
0
0
0.046875
0.157895
76
4
27
19
0.6875
0
0
0
0
0
0.210526
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
5163a9a45d4733a8433efa929ac9d21b9fb2278e
680
py
Python
tests/test_imports.py
Jc2k/bleak
feee9d61bad3f0e323bb9c1be5ea54374ff66a3f
[ "MIT" ]
753
2018-08-01T08:46:21.000Z
2022-03-31T22:58:12.000Z
tests/test_imports.py
Jc2k/bleak
feee9d61bad3f0e323bb9c1be5ea54374ff66a3f
[ "MIT" ]
587
2018-04-27T09:47:58.000Z
2022-03-31T14:55:57.000Z
tests/test_imports.py
Jc2k/bleak
feee9d61bad3f0e323bb9c1be5ea54374ff66a3f
[ "MIT" ]
180
2018-09-28T09:34:58.000Z
2022-03-30T19:19:34.000Z
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for `bleak` package.""" import os import platform _IS_CI = os.environ.get("CI", "false").lower() == "true" def test_import(): """Test by importing the client and assert correct client by OS.""" if platform.system() == "Linux": from bleak import BleakClient assert BleakClient.__name__ == "BleakClientBlueZDBus" elif platform.system() == "Windows": from bleak import BleakClient assert BleakClient.__name__ == "BleakClientWinRT" elif platform.system() == "Darwin": from bleak import BleakClient assert BleakClient.__name__ == "BleakClientCoreBluetooth"
25.185185
71
0.658824
74
680
5.851351
0.567568
0.096998
0.103926
0.180139
0.325635
0.325635
0.325635
0
0
0
0
0.001862
0.210294
680
26
72
26.153846
0.804469
0.192647
0
0.230769
0
0
0.165736
0.044693
0
0
0
0
0.230769
1
0.076923
false
0
0.461538
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
5aa69a1e5c3c0a8378ae0d437821bfdc42fbd1aa
13
py
Python
bee/__init__.py
emrahatalay/bee
ed3d8982f1033f46f09bff5e820300c87d71cbba
[ "MIT" ]
null
null
null
bee/__init__.py
emrahatalay/bee
ed3d8982f1033f46f09bff5e820300c87d71cbba
[ "MIT" ]
null
null
null
bee/__init__.py
emrahatalay/bee
ed3d8982f1033f46f09bff5e820300c87d71cbba
[ "MIT" ]
null
null
null
name = "bee"
6.5
12
0.538462
2
13
3.5
1
0
0
0
0
0
0
0
0
0
0
0
0.230769
13
1
13
13
0.7
0
0
0
0
0
0.230769
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
5ab0ca6b646522b56d1c50e0006a8ae1f9f0f8e9
2,321
py
Python
txapply/_combinators.py
jml/txapply
7e2e927e60df88e50efb05eeb6159eb807d3a99c
[ "MIT" ]
1
2016-02-03T10:43:32.000Z
2016-02-03T10:43:32.000Z
txapply/_combinators.py
jml/txapply
7e2e927e60df88e50efb05eeb6159eb807d3a99c
[ "MIT" ]
null
null
null
txapply/_combinators.py
jml/txapply
7e2e927e60df88e50efb05eeb6159eb807d3a99c
[ "MIT" ]
null
null
null
""" Helpers for adding callbacks and errbacks. """ from functools import wraps def nop(*args, **kwargs): """ Do nothing. """ def transparent(value, function, *args, **kwargs): """ Invoke ``function`` with ``value`` and other arguments, return ``value``. Use this to add a function to a callback chain without disrupting the value of the callback chain:: d = defer.succeed(42) d.addCallback(transparent, print) d.addCallback(lambda x: x == 42) """ function(value, *args, **kwargs) return value def transparently(function): """ Wrap ``function`` so that it is called, but that the first parameter is returned. """ @wraps(function) def decorated(value, *args, **kwargs): function(value, *args, **kwargs) return value return decorated def ignore(value, function, *args, **kwargs): """ Invoke ``function`` with ``*args`` and ``*kwargs``. Use this to add a function to a callback chain that just ignores the previous value in the chain:: >>> d = defer.succeed(42) >>> d.addCallback(ignore, print, 37) 37 """ return function(*args, **kwargs) def ignored(function): """ Wrap ``function`` so that it discards its first parameter. """ @wraps(function) def decorated(value, *args, **kwargs): return function(*args, **kwargs) return decorated def combine(value, function, *args, **kwargs): """ Call ``function``, return its result and ``value`` as a tuple. ``function`` is invoked with ``value``, ``*args`` and ``**kwargs`` and then we return a 2-tuple of whatever ``function`` returned and ``value``. Use this to add a function to a callback chain that combines its return value with the previous value:: >>> d = defer.succeed(42) >>> d.addCallback(combine, lambda: 47) >>> d.addCallback(print) (37, 42) """ y = function(value, *args, **kwargs) return (y, value) def combined(function): """ Wrap ``function`` so that it returns a tuple of its return value and its first parameter. """ @wraps(function) def decorated(value, *args, **kwargs): y = function(value, *args, **kwargs) return (y, value) return decorated
24.691489
77
0.606635
285
2,321
4.940351
0.277193
0.09233
0.074574
0.074574
0.482955
0.482955
0.355824
0.223722
0.172585
0.172585
0
0.011008
0.256355
2,321
93
78
24.956989
0.804751
0.525636
0
0.703704
0
0
0
0
0
0
0
0
0
1
0.37037
false
0
0.037037
0.037037
0.740741
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
5ac0944fb42b29977f571909174f17a789fc09eb
303
py
Python
mapper/dataset/latents_dataset.py
johndpope/text2image_manipulation
ce32ed0e3055441002155f605bbd3d3f3421326d
[ "MIT" ]
null
null
null
mapper/dataset/latents_dataset.py
johndpope/text2image_manipulation
ce32ed0e3055441002155f605bbd3d3f3421326d
[ "MIT" ]
null
null
null
mapper/dataset/latents_dataset.py
johndpope/text2image_manipulation
ce32ed0e3055441002155f605bbd3d3f3421326d
[ "MIT" ]
null
null
null
from torch.utils.data import Dataset class LatentsDataset(Dataset): def __init__(self, latents, opts): self.latents = latents self.opts = opts def __len__(self): return self.latents.shape[0] def __getitem__(self, index): w_ori = self.latents[index] t = "blonde hair" return [w_ori, t]
21.642857
36
0.716172
44
303
4.613636
0.545455
0.216749
0
0
0
0
0
0
0
0
0
0.003968
0.168317
303
13
37
23.307692
0.801587
0
0
0
0
0
0.036304
0
0
0
0
0
0
1
0.272727
false
0
0.090909
0.090909
0.636364
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
5ac272a1eee042bbc1d42326e4039196b805cd73
224
py
Python
backend/backend/eats/serializers.py
PrzemyslawSalek/9eats
b748ba2166a065c8d04e043069a1ddf5641322ca
[ "MIT" ]
null
null
null
backend/backend/eats/serializers.py
PrzemyslawSalek/9eats
b748ba2166a065c8d04e043069a1ddf5641322ca
[ "MIT" ]
null
null
null
backend/backend/eats/serializers.py
PrzemyslawSalek/9eats
b748ba2166a065c8d04e043069a1ddf5641322ca
[ "MIT" ]
null
null
null
from .models import Eats from rest_framework import serializers class EatsSerializers(serializers.ModelSerializer): class Meta: model = Eats fields = ['id', 'name', 'price', 'ingredients', 'timestamp']
24.888889
68
0.696429
23
224
6.73913
0.782609
0
0
0
0
0
0
0
0
0
0
0
0.196429
224
8
69
28
0.861111
0
0
0
0
0
0.138393
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
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
5acf452261bf381222f37bd4d0526037ecbf2bca
328
py
Python
jsontasks.py
init-helpful/jsontasks
2cfc0b9b7e5f0ece9d753037f2d6dacf2c165f6e
[ "MIT" ]
null
null
null
jsontasks.py
init-helpful/jsontasks
2cfc0b9b7e5f0ece9d753037f2d6dacf2c165f6e
[ "MIT" ]
null
null
null
jsontasks.py
init-helpful/jsontasks
2cfc0b9b7e5f0ece9d753037f2d6dacf2c165f6e
[ "MIT" ]
null
null
null
import os class TaskManager: def __init__(self): self.tasks = [] def read_from_file(self, file_name, direcory_to_read): pass def get_task(self): pass def gather_tasks_from_directory(self, directory_path): pass def new_task(self, task_dictionary=os.getcwd()): pass
19.294118
58
0.643293
43
328
4.534884
0.534884
0.107692
0
0
0
0
0
0
0
0
0
0
0.271341
328
17
59
19.294118
0.8159
0
0
0.333333
0
0
0
0
0
0
0
0
0
1
0.416667
false
0.333333
0.083333
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
5ad027454c3e77bc99af7e6a2ce8bc6f62a3080f
364
py
Python
py/build.py
Cyclic3/CipheyCore
63cc5fa79b68602e92fd1e16abdbd16b53fcbc53
[ "MIT" ]
35
2020-05-30T10:25:14.000Z
2022-03-09T05:46:28.000Z
py/build.py
Cyclic3/CipheyCore
63cc5fa79b68602e92fd1e16abdbd16b53fcbc53
[ "MIT" ]
12
2020-08-01T16:52:49.000Z
2021-12-25T22:04:42.000Z
py/build.py
Cyclic3/CipheyCore
63cc5fa79b68602e92fd1e16abdbd16b53fcbc53
[ "MIT" ]
14
2020-08-06T01:36:08.000Z
2022-02-02T09:53:18.000Z
try: from wheel.bdist_wheel import bdist_wheel as _bdist_wheel class bdist_wheel(_bdist_wheel): def finalize_options(self): _bdist_wheel.finalize_options(self) self.root_is_pure = False except ImportError: bdist_wheel = None def build(setup_kwargs): setup_kwargs.update({"cmdclass": {'bdist_wheel': bdist_wheel}})
28
67
0.708791
47
364
5.106383
0.489362
0.375
0.1875
0.166667
0
0
0
0
0
0
0
0
0.206044
364
12
68
30.333333
0.83045
0
0
0
0
0
0.052198
0
0
0
0
0
0
1
0.2
false
0
0.2
0
0.5
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
85087982968ee9e527a3ee2385b3fab385ab9e76
920
bzl
Python
container/ubuntu16_04/layers/bazel/version.bzl
bansalvinayak/bazel-toolchains
5e4c884b0507a399141d3cc018f11edbd29034e8
[ "Apache-2.0" ]
null
null
null
container/ubuntu16_04/layers/bazel/version.bzl
bansalvinayak/bazel-toolchains
5e4c884b0507a399141d3cc018f11edbd29034e8
[ "Apache-2.0" ]
null
null
null
container/ubuntu16_04/layers/bazel/version.bzl
bansalvinayak/bazel-toolchains
5e4c884b0507a399141d3cc018f11edbd29034e8
[ "Apache-2.0" ]
null
null
null
BAZEL_VERSION_SHA256S = { "0.14.1": "7b14e4fc76bf85c4abf805833e99f560f124a3b96d56e0712c693e94e19d1376", "0.15.0": "7f6748b48a7ea6bdf00b0e1967909ce2181ebe6f377638aa454a7d09a0e3ea7b", "0.15.2": "13eae0f09565cf17fc1c9ce1053b9eac14c11e726a2215a79ebaf5bdbf435241", "0.16.1": "17ab70344645359fd4178002f367885e9019ae7507c9c1ade8220f3628383444", } # This is the map from supported Bazel versions to the Bazel version used to # generate the published toolchain configs that the former should be used with. # This is needed because, in most cases, patch updates in Bazel do not result in # changes in toolchain configs, so we do not publish duplicated toolchain # configs. So, for example, Bazel 0.15.2 should still use published toolchain # configs generated with Bazel 0.15.0. BAZEL_VERSION_TO_CONFIG_VERSION = { "0.14.1": "0.14.1", "0.15.0": "0.15.0", "0.15.2": "0.15.0", "0.16.1": "0.16.1", }
46
81
0.753261
120
920
5.725
0.433333
0.034935
0.029112
0.021834
0.016012
0
0
0
0
0
0
0.288973
0.142391
920
19
82
48.421053
0.581749
0.452174
0
0
0
0
0.65996
0.515091
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
517f1d86ce819642a85763e215147bf154620b74
362
py
Python
src/16.py
peter-hunt/project-euler-solution
ce5be80043e892e3a95604bd5ebec9dc88c7c037
[ "MIT" ]
null
null
null
src/16.py
peter-hunt/project-euler-solution
ce5be80043e892e3a95604bd5ebec9dc88c7c037
[ "MIT" ]
null
null
null
src/16.py
peter-hunt/project-euler-solution
ce5be80043e892e3a95604bd5ebec9dc88c7c037
[ "MIT" ]
null
null
null
""" Power digit sum 2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. What is the sum of the digits of the number 2^1000? """ exponent = 1000 def initial_func(exponent): return sum(int(digit) for digit in f'{2 ** exponent}') def improved_func(exponent): pass # 1366 print(initial_func(exponent)) # print(improved_func(exponent))
15.73913
65
0.674033
61
362
3.934426
0.540984
0.2
0.066667
0
0
0
0
0
0
0
0
0.101045
0.207182
362
22
66
16.454545
0.735192
0.475138
0
0
0
0
0.082873
0
0
0
0
0
0
1
0.333333
false
0.166667
0
0.166667
0.5
0.166667
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
1
0
0
0
3
519bf01aa823ec84c060b052b0d22f8754674e3f
98
py
Python
Python/pyworkout/modules_and_packages/ex37_mod3.py
honchardev/Fun
ca7c0076e9bb3017c5d7e89aa7d5bd54a83c8ecc
[ "MIT" ]
null
null
null
Python/pyworkout/modules_and_packages/ex37_mod3.py
honchardev/Fun
ca7c0076e9bb3017c5d7e89aa7d5bd54a83c8ecc
[ "MIT" ]
3
2020-03-24T16:26:35.000Z
2020-04-15T19:40:41.000Z
Python/pyworkout/modules_and_packages/ex37_mod3.py
honchardev/Fun
ca7c0076e9bb3017c5d7e89aa7d5bd54a83c8ecc
[ "MIT" ]
null
null
null
from stuff import * def main(): print(f'{a=} {c=}') if __name__ == '__main__': main()
9.8
26
0.530612
13
98
3.384615
0.846154
0
0
0
0
0
0
0
0
0
0
0
0.255102
98
9
27
10.888889
0.60274
0
0
0
0
0
0.173469
0
0
0
0
0
0
1
0.2
true
0
0.2
0
0.4
0.2
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
51fb9125fdc2cfda6f5c8ba9a842e1575209eb62
195
py
Python
code/list.py
hyosung11/Python
60290ac909ffb200811f54a9f4a0081010f9cb92
[ "MTLL" ]
4
2020-04-10T14:34:01.000Z
2022-02-18T04:53:12.000Z
code/list.py
hyosung11/Python
60290ac909ffb200811f54a9f4a0081010f9cb92
[ "MTLL" ]
4
2021-03-31T19:24:33.000Z
2022-01-13T02:10:21.000Z
code/list.py
hyosung11/Python
60290ac909ffb200811f54a9f4a0081010f9cb92
[ "MTLL" ]
1
2022-02-18T04:53:11.000Z
2022-02-18T04:53:11.000Z
class SuperList(list): def __len__(self): return 1000 super_list1 = SuperList() print(len(super_list1)) super_list1.append(5) print(super_list1[0]) print(issubclass(list, object))
16.25
31
0.723077
27
195
4.925926
0.592593
0.300752
0
0
0
0
0
0
0
0
0
0.060241
0.148718
195
12
31
16.25
0.740964
0
0
0
0
0
0
0
0
0
0
0
0
1
0.125
false
0
0
0.125
0.375
0.375
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
0
0
0
3
51ffe31048e6d8ead31852fe5b4432abb9f90f66
129
py
Python
blog_django_graphql_react_relay/film_api/film_database/actors/apps.py
ghjan/blog-projects
aa6925724e457bec276d98cf7b55b5cdaf2ab5f4
[ "MIT" ]
66
2017-11-18T06:41:39.000Z
2021-09-02T15:47:08.000Z
blog_django_graphql_react_relay/film_api/film_database/actors/apps.py
ghjan/blog-projects
aa6925724e457bec276d98cf7b55b5cdaf2ab5f4
[ "MIT" ]
2
2018-05-28T14:06:05.000Z
2020-03-21T14:05:07.000Z
blog_django_graphql_react_relay/film_api/film_database/actors/apps.py
ghjan/blog-projects
aa6925724e457bec276d98cf7b55b5cdaf2ab5f4
[ "MIT" ]
35
2017-11-05T23:48:15.000Z
2021-09-15T12:15:39.000Z
from django.apps import AppConfig class ActorsConfig(AppConfig): name = 'film_database.actors' verbose_name = 'Actors'
18.428571
33
0.744186
15
129
6.266667
0.8
0
0
0
0
0
0
0
0
0
0
0
0.170543
129
6
34
21.5
0.878505
0
0
0
0
0
0.20155
0
0
0
0
0
0
1
0
false
0
0.25
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
0
0
1
0
0
3
a4026c0aee5cc75446e9ab19a48a3883c12abca9
2,120
py
Python
vision/library/inputs/camera_input.py
lcmonteiro/space-vision-py
38022c99218de0e1e93ec0bae8d143fa0c787f1d
[ "MIT" ]
1
2019-12-14T20:00:17.000Z
2019-12-14T20:00:17.000Z
vision/library/inputs/camera_input.py
lcmonteiro/space-vision-py
38022c99218de0e1e93ec0bae8d143fa0c787f1d
[ "MIT" ]
null
null
null
vision/library/inputs/camera_input.py
lcmonteiro/space-vision-py
38022c99218de0e1e93ec0bae8d143fa0c787f1d
[ "MIT" ]
null
null
null
# ################################################################################################# # ------------------------------------------------------------------------------------------------- # File: camera_input.py # Author: Luis Monteiro # # Created on nov 8, 2019, 22:00 PM # ------------------------------------------------------------------------------------------------- # ################################################################################################# # external from cv2 import VideoCapture # internal from vision.library import VisionInput # ############################################################################# # ----------------------------------------------------------------------------- # Camera Input # ----------------------------------------------------------------------------- # ############################################################################# class CameraInput(VisionInput): # ----------------------------------------------------- # initialization # ----------------------------------------------------- def __init__(self, source=0): self.__resource = VideoCapture(int(source)) # ----------------------------------------------------- # check status # ----------------------------------------------------- def good(self): return self.__resource.isOpened() # ----------------------------------------------------- # read frame # ----------------------------------------------------- def read(self): good, frame = self.__resource.read() if not good: raise RuntimeError("camera::read frame failed") return frame # ################################################################################################# # ------------------------------------------------------------------------------------------------- # End # ------------------------------------------------------------------------------------------------- # #################################################################################################
45.106383
99
0.189151
73
2,120
5.342466
0.643836
0.092308
0
0
0
0
0
0
0
0
0
0.005864
0.115094
2,120
47
100
45.106383
0.202026
0.485377
0
0
0
0
0.048263
0
0
0
0
0
0
1
0.25
false
0
0.166667
0.083333
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
cfc0a04d8f2c0aad66525c406659ab28ab181b50
5,196
py
Python
pokemon_v2/admin.py
Marchuck/pokeapi
35114a5c9a72ed1fd5bef0381178dc8ce638b0a6
[ "BSD-3-Clause" ]
9
2015-03-31T13:21:45.000Z
2021-03-29T13:43:24.000Z
pokemon_v2/admin.py
Pan-Masa/pokeapi
35114a5c9a72ed1fd5bef0381178dc8ce638b0a6
[ "BSD-3-Clause" ]
1
2015-12-06T07:43:46.000Z
2015-12-06T07:43:46.000Z
pokemon_v2/admin.py
Pan-Masa/pokeapi
35114a5c9a72ed1fd5bef0381178dc8ce638b0a6
[ "BSD-3-Clause" ]
2
2015-12-17T00:20:27.000Z
2019-07-24T06:31:21.000Z
from __future__ import unicode_literals from django.contrib import admin from .models import * admin.site.register(Ability) admin.site.register(AbilityName) admin.site.register(AbilityEffectText) admin.site.register(AbilityFlavorText) admin.site.register(AbilityChange) admin.site.register(AbilityChangeEffectText) admin.site.register(Berry) admin.site.register(BerryFirmness) admin.site.register(BerryFirmnessName) admin.site.register(BerryFlavor) admin.site.register(Characteristic) admin.site.register(CharacteristicDescription) admin.site.register(ContestCombo) admin.site.register(ContestEffectEffectText) admin.site.register(ContestEffectFlavorText) admin.site.register(ContestEffect) admin.site.register(ContestType) admin.site.register(ContestTypeName) admin.site.register(EggGroup) admin.site.register(EggGroupName) admin.site.register(EncounterCondition) admin.site.register(EncounterConditionValue) admin.site.register(EncounterConditionName) admin.site.register(EncounterConditionValueName) admin.site.register(EncounterConditionValueMap) admin.site.register(EncounterMethod) admin.site.register(EncounterMethodName) admin.site.register(EncounterSlot) admin.site.register(Encounter) admin.site.register(EvolutionChain) admin.site.register(EvolutionTrigger) admin.site.register(EvolutionTriggerName) admin.site.register(Experience) admin.site.register(Gender) admin.site.register(Generation) admin.site.register(GenerationName) admin.site.register(GrowthRate) admin.site.register(GrowthRateDescription) admin.site.register(ItemCategory) admin.site.register(ItemCategoryName) admin.site.register(ItemAttribute) admin.site.register(ItemAttributeMap) admin.site.register(ItemAttributeDescription) admin.site.register(ItemFlavorText) admin.site.register(ItemFlingEffect) admin.site.register(ItemFlingEffectEffectText) admin.site.register(ItemGameIndex) admin.site.register(ItemName) admin.site.register(ItemPocketName) admin.site.register(ItemPocket) admin.site.register(ItemEffectText) admin.site.register(Item) admin.site.register(Language) admin.site.register(LanguageName) admin.site.register(LocationAreaEncounterRate) admin.site.register(LocationAreaName) admin.site.register(LocationArea) admin.site.register(LocationGameIndex) admin.site.register(LocationName) admin.site.register(Location) admin.site.register(Machine) admin.site.register(MoveBattleStyle) admin.site.register(MoveBattleStyleName) admin.site.register(MoveChange) admin.site.register(MoveDamageClass) admin.site.register(MoveDamageClassDescription) admin.site.register(MoveEffectChange) admin.site.register(MoveEffectChangeEffectText) admin.site.register(MoveEffectEffectText) admin.site.register(MoveEffect) admin.site.register(MoveAttributeDescription) admin.site.register(MoveAttributeMap) admin.site.register(MoveAttributeName) admin.site.register(MoveAttribute) admin.site.register(MoveFlavorText) admin.site.register(MoveLearnMethod) admin.site.register(MoveLearnMethodName) admin.site.register(MoveMeta) admin.site.register(MoveMetaAilment) admin.site.register(MoveMetaAilmentName) admin.site.register(MoveMetaCategoryDescription) admin.site.register(MoveMetaCategory) admin.site.register(MoveMetaStatChange) admin.site.register(MoveName) admin.site.register(MoveTargetDescription) admin.site.register(MoveTarget) admin.site.register(Move) admin.site.register(NatureBattleStylePreference) admin.site.register(NatureName) admin.site.register(NaturePokeathlonStat) admin.site.register(Nature) admin.site.register(PalParkArea) admin.site.register(PalParkAreaName) admin.site.register(PalPark) admin.site.register(PokeathlonStatName) admin.site.register(PokeathlonStat) admin.site.register(Pokedex) admin.site.register(PokedexVersionGroup) admin.site.register(PokedexDescription) admin.site.register(Pokemon) admin.site.register(PokemonAbility) admin.site.register(PokemonColor) admin.site.register(PokemonColorName) admin.site.register(PokemonDexNumber) admin.site.register(PokemonEggGroup) admin.site.register(PokemonEvolution) admin.site.register(PokemonForm) admin.site.register(PokemonFormName) admin.site.register(PokemonFormGeneration) admin.site.register(PokemonGameIndex) admin.site.register(PokemonHabitat) admin.site.register(PokemonHabitatName) admin.site.register(PokemonItem) admin.site.register(PokemonMove) admin.site.register(PokemonShape) admin.site.register(PokemonShapeName) admin.site.register(PokemonSpecies) admin.site.register(PokemonSpeciesName) admin.site.register(PokemonSpeciesDescription) admin.site.register(PokemonSpeciesFlavorText) admin.site.register(PokemonStat) admin.site.register(PokemonType) admin.site.register(Region) admin.site.register(RegionName) admin.site.register(StatName) admin.site.register(Stat) admin.site.register(SuperContestEffect) admin.site.register(SuperContestCombo) admin.site.register(SuperContestEffectFlavorText) admin.site.register(Type) admin.site.register(TypeName) admin.site.register(TypeGameIndex) admin.site.register(TypeEfficacy) admin.site.register(Version) admin.site.register(VersionName) admin.site.register(VersionGroup) admin.site.register(VersionGroupMoveLearnMethod) admin.site.register(VersionGroupRegion)
30.745562
49
0.859122
565
5,196
7.892035
0.263717
0.278538
0.526127
0
0
0
0
0
0
0
0
0
0.034065
5,196
168
50
30.928571
0.888424
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.021277
0
0.021277
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
cfe2cce7f3d7e82543534a89149fab941b3c3490
57
py
Python
autokey/data/Bspc/node_to_desktop_9.py
Curiosidad-Racional/.config
af5a8901510e4b87dff1be024d3d29987c148f3f
[ "MIT" ]
2
2021-05-29T18:11:26.000Z
2021-10-21T20:53:16.000Z
autokey/data/Bspc/node_to_desktop_9.py
Curiosidad-Racional/.config
af5a8901510e4b87dff1be024d3d29987c148f3f
[ "MIT" ]
null
null
null
autokey/data/Bspc/node_to_desktop_9.py
Curiosidad-Racional/.config
af5a8901510e4b87dff1be024d3d29987c148f3f
[ "MIT" ]
null
null
null
system.exec_command("bspc node -d '^9'", getOutput=False)
57
57
0.736842
9
57
4.555556
1
0
0
0
0
0
0
0
0
0
0
0.018868
0.070175
57
1
57
57
0.754717
0
0
0
0
0
0.293103
0
0
0
0
0
0
1
0
true
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
cfe7c9cdf43446dd90f66a9719d2b629c6146442
873
py
Python
ejercicios_python/Clase09/practica9-5.py
hcgalvan/UNSAM-Python-programming
c4b3f5ae0702dc03ea6010cb8051c7eec6aef42f
[ "MIT" ]
null
null
null
ejercicios_python/Clase09/practica9-5.py
hcgalvan/UNSAM-Python-programming
c4b3f5ae0702dc03ea6010cb8051c7eec6aef42f
[ "MIT" ]
null
null
null
ejercicios_python/Clase09/practica9-5.py
hcgalvan/UNSAM-Python-programming
c4b3f5ae0702dc03ea6010cb8051c7eec6aef42f
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ Created on Thu Oct 21 18:24:11 2021 @author: User """ # Objetos, pilas y colas class Rectangulo(): def __init__(self, x, y): self.x = x self.y = y def base(self): return def altura(self): return def area(self): return def desplazar(self, desplazamiento): return def rotar(self, x): return def __str__(self): return f'({self.x}, {self.y})' # Used with `repr()` def __repr__(self): return class Punto(): def __init__(self, x, y): self.x = x self.y = y def __str__(self): return f'({self.x}, {self.y})' # Used with `repr()` def __repr__(self): return f'Punto({self.x}, {self.y})' def __add__(self, b): return Punto(self.x + b.x, self.y + b.y)
18.978261
48
0.504009
118
873
3.491525
0.330508
0.109223
0.087379
0.072816
0.400485
0.400485
0.400485
0.400485
0.400485
0.400485
0
0.022807
0.347079
873
45
49
19.4
0.7
0.153494
0
0.642857
0
0
0.089286
0
0
0
0
0
0
1
0.428571
false
0
0
0.357143
0.857143
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
cff6ae750f314d590d84c095d5ad3ff9c1d5070c
1,529
py
Python
cms_opencomparison/views.py
ataka-team/django-cms-opencomparison
72de77295a4fbd3aa5746120f26aaf94557338fc
[ "MIT" ]
1
2016-04-14T11:19:27.000Z
2016-04-14T11:19:27.000Z
cms_opencomparison/views.py
ataka-team/django-cms-opencomparison
72de77295a4fbd3aa5746120f26aaf94557338fc
[ "MIT" ]
null
null
null
cms_opencomparison/views.py
ataka-team/django-cms-opencomparison
72de77295a4fbd3aa5746120f26aaf94557338fc
[ "MIT" ]
null
null
null
from django.http import HttpResponseRedirect, HttpResponse from django.shortcuts import render_to_response, get_object_or_404 from cms_opencomparison import models import httplib def get_grid(request, grid_id): grid = None try: grid = models.Grid.objects.get(pk=grid_id) h = None if grid.is_ssl(): h = httplib.HTTPSConnection(grid.get_hostname(),grid.get_port()) else: h = httplib.HTTPConnection(grid.get_hostname(),grid.get_port()) headers = { 'User-Agent': 'django_cms_opencomparison', } print grid.get_grid_url() + grid.slug h.request('GET', grid.get_grid_url() + grid.slug + "/", "", headers) res = h.getresponse() res = res.read() except Exception, e: print e res = '' return HttpResponse( res, mimetype='application/json') def get_package(request, grid_id, package_slug): grid = None try: grid = models.Grid.objects.get(pk=grid_id) h = None if grid.is_ssl(): h = httplib.HTTPSConnection(grid.get_hostname(),grid.get_port()) else: h = httplib.HTTPConnection(grid.get_hostname(),grid.get_port()) headers = { 'User-Agent': 'django_cms_opencomparison', } h.request('GET', grid.get_package_url() + package_slug + "/", "", headers) res = h.getresponse() res = res.read() except Exception, e: res = '' return HttpResponse( res, mimetype='application/json')
25.483333
80
0.614781
183
1,529
4.95082
0.284153
0.084989
0.066225
0.083885
0.735099
0.703091
0.65894
0.65894
0.554084
0.554084
0
0.002657
0.261609
1,529
59
81
25.915254
0.799823
0
0
0.73913
0
0
0.07199
0.032723
0
0
0
0
0
0
null
null
0
0.086957
null
null
0.043478
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
3
cffd6986c385bbd6935b56c2dd80f37e82aa783a
770
py
Python
pyredner_tensorflow/device.py
saipraveenb25/redner
628efadb5499959756c9ca5dc1e556d4b973940f
[ "MIT" ]
1
2022-01-27T08:48:10.000Z
2022-01-27T08:48:10.000Z
pyredner_tensorflow/device.py
saipraveenb25/redner
628efadb5499959756c9ca5dc1e556d4b973940f
[ "MIT" ]
null
null
null
pyredner_tensorflow/device.py
saipraveenb25/redner
628efadb5499959756c9ca5dc1e556d4b973940f
[ "MIT" ]
null
null
null
import tensorflow as tf use_gpu = tf.test.is_gpu_available( cuda_only=True, min_cuda_compute_capability=None ) cpu_device_id = 0 gpu_device_id = 0 def get_device_name(): global use_gpu global cpu_device_id global gpu_device_id return '/device:gpu:' + str(gpu_device_id) if use_gpu else '/device:cpu:' + str(cpu_device_id) def set_use_gpu(v): global use_gpu use_gpu = v def get_use_gpu(): global use_gpu return use_gpu def set_cpu_device_id(did): global cpu_device_id cpu_device_id = did def get_cpu_device_id(): global cpu_device_id return cpu_device_id def set_gpu_device_id(did): global gpu_device_id gpu_device_id = did def get_gpu_device_id(): global gpu_device_id return gpu_device_id
19.74359
98
0.736364
134
770
3.791045
0.231343
0.283465
0.194882
0.100394
0.255906
0.122047
0.122047
0
0
0
0
0.003241
0.198701
770
38
99
20.263158
0.820097
0
0
0.3
0
0
0.031169
0
0
0
0
0
0
1
0.233333
false
0
0.033333
0
0.4
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
32084234f241415b8940b08b1ba40191213cbef1
1,284
py
Python
architectures/providers/aws/devtools.py
marinmuso/architectures
d824056e6e69cdb06db31562a1fb71af058892c0
[ "MIT" ]
15
2021-01-18T02:46:12.000Z
2021-08-23T20:10:22.000Z
architectures/providers/aws/devtools.py
marinmuso/architectures
d824056e6e69cdb06db31562a1fb71af058892c0
[ "MIT" ]
77
2021-01-11T05:01:30.000Z
2021-08-15T22:39:19.000Z
architectures/providers/aws/devtools.py
marinmuso/architectures
d824056e6e69cdb06db31562a1fb71af058892c0
[ "MIT" ]
2
2021-01-10T19:28:13.000Z
2021-08-12T19:06:45.000Z
# Do not modify this file directly. It is auto-generated with Python. from architectures.providers import _Aws class _Devtools(_Aws): _service_type = "devtools" _icon_dir = "icons/aws/devtools" class XRay(_Devtools): _icon = "x-ray.png" _default_label = "X Ray" class CommandLineInterface(_Devtools): _icon = "command-line-interface.png" _default_label = "Command Line Interface" class ToolsAndSdks(_Devtools): _icon = "tools-and-sdks.png" _default_label = "Tools And Sdks" class Codepipeline(_Devtools): _icon = "codepipeline.png" _default_label = "Codepipeline" class Codebuild(_Devtools): _icon = "codebuild.png" _default_label = "Codebuild" class Cloud9(_Devtools): _icon = "cloud9.png" _default_label = "Cloud9" class CloudDevelopmentKit(_Devtools): _icon = "cloud-development-kit.png" _default_label = "Cloud Development Kit" class Codestar(_Devtools): _icon = "codestar.png" _default_label = "Codestar" class DeveloperTools(_Devtools): _icon = "developer-tools.png" _default_label = "Developer Tools" class Codecommit(_Devtools): _icon = "codecommit.png" _default_label = "Codecommit" class Codedeploy(_Devtools): _icon = "codedeploy.png" _default_label = "Codedeploy"
25.176471
69
0.718069
143
1,284
6.090909
0.34965
0.165327
0.189437
0
0
0
0
0
0
0
0
0.002841
0.17757
1,284
51
70
25.176471
0.82197
0.052181
0
0
1
0
0.274671
0.041941
0
0
0
0
0
1
0
false
0
0.027027
0
1
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
0
0
0
1
0
0
3
32217e5684c8167e7e42fd0428b081b44b836f74
245
py
Python
abi/core/rnn_utils.py
wulfebw/automotive_behavior_inference
0d146acce4b7be05b281c56442f8addb3c8793f0
[ "MIT" ]
null
null
null
abi/core/rnn_utils.py
wulfebw/automotive_behavior_inference
0d146acce4b7be05b281c56442f8addb3c8793f0
[ "MIT" ]
null
null
null
abi/core/rnn_utils.py
wulfebw/automotive_behavior_inference
0d146acce4b7be05b281c56442f8addb3c8793f0
[ "MIT" ]
null
null
null
import abi.core.rnn_cells as rnn_cells def _build_recurrent_cell(hidden_dim, dropout_keep_prob): return rnn_cells.LayerNormLSTMCell( hidden_dim, use_recurrent_dropout=True, dropout_keep_prob=dropout_keep_prob )
27.222222
57
0.755102
33
245
5.121212
0.575758
0.142012
0.266272
0
0
0
0
0
0
0
0
0
0.191837
245
9
58
27.222222
0.853535
0
0
0
0
0
0
0
0
0
0
0
0
1
0.142857
false
0
0.142857
0.142857
0.428571
0
0
0
0
null
0
1
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
1
0
0
0
3
5c559fe03783f9b0d9a348c6aa76714f96a7a3da
855
py
Python
books/python-3-oop-packt/Chapter6_data_structures/6_16_dictsorted.py
phiratio/lpthw
a32240d4355fb331805d515f96e1d009914e5c47
[ "MIT" ]
73
2016-09-15T23:07:04.000Z
2022-03-05T15:09:48.000Z
books/python-3-oop-packt/Chapter6_data_structures/6_16_dictsorted.py
phiratio/lpthw
a32240d4355fb331805d515f96e1d009914e5c47
[ "MIT" ]
34
2019-12-16T16:53:24.000Z
2022-01-13T02:29:30.000Z
books/python-3-oop-packt/Chapter6_data_structures/6_16_dictsorted.py
phiratio/lpthw
a32240d4355fb331805d515f96e1d009914e5c47
[ "MIT" ]
51
2016-10-07T20:47:51.000Z
2021-12-22T21:00:24.000Z
from collections import KeysView, ItemsView, ValuesView class DictSorted(dict): def __new__(*args, **kwargs): new_dict = dict.__new__(*args, **kwargs) new_dict.ordered_keys = [] return new_dict def __setitem__(self, key, value): '''self[key] = value syntax''' if key not in self.ordered_keys: self.ordered_keys.append(key) super().__setitem__(key, value) def setdefault(self, key, value): if key not in self.ordered_keys: self.ordered_keys.append(key) return super().setdefault(key, value) def keys(self): return KeysView(self) def values(self): return ValuesView(self) def items(self): return ItemsView(self) def __iter__(self): '''for x in self syntax''' return self.ordered_keys.__iter__()
27.580645
55
0.617544
104
855
4.759615
0.307692
0.133333
0.151515
0.064646
0.278788
0.19798
0.19798
0.19798
0.19798
0.19798
0
0
0.271345
855
30
56
28.5
0.794543
0.052632
0
0.181818
0
0
0
0
0
0
0
0
0
1
0.318182
false
0
0.045455
0.136364
0.681818
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
5c5c957ccca788f296fed4501ddae304d8a0e12e
1,377
py
Python
sios.py
HCP-xuniL-YPkcalB-rM/sios
0a18d348087e8e2e7b2cece85f12a6e73115f030
[ "MIT" ]
2
2018-08-10T17:17:24.000Z
2018-08-12T10:59:34.000Z
sios.py
HCP-xuniL-YPkcalB-rM/sios
0a18d348087e8e2e7b2cece85f12a6e73115f030
[ "MIT" ]
null
null
null
sios.py
HCP-xuniL-YPkcalB-rM/sios
0a18d348087e8e2e7b2cece85f12a6e73115f030
[ "MIT" ]
null
null
null
#!/usr/bin/python3.6 _author_ = "Mr.BlackPY" #Showing Information Of System [sios Project] #GNU/LINUX import sys,os,datetime version = "0.2" print("-----------------------------") print("Platform name:") print(sys.platform) print("-----------------------------") print("os name:") print(os.name) print("-----------------------------") print("os Path:") print(os.getenv('PATH')) print("-----------------------------") print("Shell:") print(os.getenv('SHELL')) print("-----------------------------") print("Language and encoding:") print(os.getenv('LC_NAME')) print("-----------------------------") print("SSH agent pid:") print(os.getenv('SSH_AGENT_PID')) print("-----------------------------") print("current Path:") print(os.getcwd()) print("-----------------------------") print("current date & time:") now = datetime.datetime.now() print(now) print("-----------------------------") print("current user:") print(os.getlogin()) print("-----------------------------") print("Session manager:") print(os.getenv('SESSION_MANAGER')) print("-----------------------------") print("Term:") print(os.getenv('TERM')) print("-----------------------------") print("Text domain dir:") print(os.getenv('TEXTDOMAINDIR')) print("-----------------------------") print("Home:") print(os.getenv('HOME')) print("-----------------------------") #Creator: Mr.BlackPY
17.43038
45
0.464779
133
1,377
4.766917
0.383459
0.205047
0.164038
0.050473
0
0
0
0
0
0
0
0.003147
0.076979
1,377
78
46
17.653846
0.495673
0.066086
0
0.318182
0
0
0.50234
0.316693
0
0
0
0
0
1
0
false
0
0.022727
0
0.022727
0.909091
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
3
5c6a6162ab23faf5e04c2b3c51bc5229cdd40982
335
py
Python
database.py
ANUBHAVNATANI/BuildCodeBlocksAPI
580733bd51595c844dbb4c10436cfbf8a4489fa5
[ "MIT" ]
1
2020-09-18T05:12:26.000Z
2020-09-18T05:12:26.000Z
database.py
ANUBHAVNATANI/BuildCodeBlocksAPI
580733bd51595c844dbb4c10436cfbf8a4489fa5
[ "MIT" ]
null
null
null
database.py
ANUBHAVNATANI/BuildCodeBlocksAPI
580733bd51595c844dbb4c10436cfbf8a4489fa5
[ "MIT" ]
1
2019-05-30T17:48:03.000Z
2019-05-30T17:48:03.000Z
import pyrebase config = { "apiKey": "API key of the firebase database", "authDomain": "AuthDomain of the firebase database", "databaseURL": "Database Url of the firebase database", "storageBucket": "Stroage Bucket Url of the firebase database", } firebase = pyrebase.initialize_app(config) db = firebase.database()
25.769231
67
0.719403
39
335
6.153846
0.487179
0.333333
0.216667
0.35
0.2
0
0
0
0
0
0
0
0.176119
335
12
68
27.916667
0.869565
0
0
0
0
0
0.558209
0
0
0
0
0
0
1
0
false
0
0.111111
0
0.111111
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
5c83c28f8042d89a1228d0f44a050f69ae40294f
168
py
Python
irclib/__pkginfo__.py
TotallyNotRobots/py-irclib
ff23b8ae6942d4ecf6a3ac8362c32da36fac0fd0
[ "MIT" ]
1
2019-05-18T21:47:10.000Z
2019-05-18T21:47:10.000Z
irclib/__pkginfo__.py
TotallyNotRobots/py-irclib
ff23b8ae6942d4ecf6a3ac8362c32da36fac0fd0
[ "MIT" ]
190
2018-02-21T18:24:16.000Z
2022-03-30T20:01:40.000Z
irclib/__pkginfo__.py
TotallyNotRobots/py-irclib
ff23b8ae6942d4ecf6a3ac8362c32da36fac0fd0
[ "MIT" ]
4
2018-02-19T06:05:09.000Z
2020-04-17T21:10:30.000Z
"""Library package info""" author = "linuxdaemon" version_info = (0, 3, 0) version = ".".join(map(str, version_info)) __all__ = ("author", "version_info", "version")
21
47
0.660714
21
168
4.952381
0.571429
0.317308
0
0
0
0
0
0
0
0
0
0.020548
0.130952
168
7
48
24
0.691781
0.119048
0
0
0
0
0.260563
0
0
0
0
0
0
1
0
false
0
0
0
0
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
5c8d097c05557d71133b8f6b9bff5c6078a51b99
496
py
Python
pycode2/ex49/ex48_project/game.py
v-sukt/misc_code
ac5ea0a55a070c88c410d14511c25d332fc675d5
[ "Apache-2.0" ]
null
null
null
pycode2/ex49/ex48_project/game.py
v-sukt/misc_code
ac5ea0a55a070c88c410d14511c25d332fc675d5
[ "Apache-2.0" ]
null
null
null
pycode2/ex49/ex48_project/game.py
v-sukt/misc_code
ac5ea0a55a070c88c410d14511c25d332fc675d5
[ "Apache-2.0" ]
null
null
null
"""The module has following classes: - Room""" class Room(object): '''Takes name and description of the object and initializes paths.\nProvides methods \n\t go(direction) and,\n\t add_paths(paths)''' def __init__(self, name, description): self.name = name self.description = description self.paths = {} def go(self, direction): return self.paths.get(direction, None) def add_paths(self, paths): return self.paths.update(paths)
29.176471
137
0.647177
64
496
4.921875
0.453125
0.114286
0.095238
0
0
0
0
0
0
0
0
0
0.235887
496
16
138
31
0.831135
0.354839
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0.222222
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
5caee0a6e6ae36064b33654fd204e39eda6ea1e6
8,031
py
Python
tests/ref_jobs/basic_job_ref.py
eodcgmbh/eodc-openeo-bindings
4e80eba036771a0c81359e1ac66862f1eead407b
[ "MIT" ]
null
null
null
tests/ref_jobs/basic_job_ref.py
eodcgmbh/eodc-openeo-bindings
4e80eba036771a0c81359e1ac66862f1eead407b
[ "MIT" ]
7
2020-02-18T17:12:31.000Z
2020-09-24T07:19:04.000Z
tests/ref_jobs/basic_job_ref.py
eodcgmbh/eodc-openeo-bindings
4e80eba036771a0c81359e1ac66862f1eead407b
[ "MIT" ]
null
null
null
import glob from eodatareaders.eo_data_reader import EODataProcessor ### dc_0 ### # node input files filepaths = ['/s2a_prd_msil1c/2018/06/08/S2A_MSIL1C_20180608T101021_N0206_R022_T32TPS_20180608T135059.zip', '/s2a_prd_msil1c/2018/06/11/S2A_MSIL1C_20180611T102021_N0206_R065_T32TPS_20180611T123241.zip', '/s2a_prd_msil1c/2018/06/18/S2A_MSIL1C_20180618T101021_N0206_R022_T32TPS_20180618T135619.zip', '/s2a_prd_msil1c/2018/06/21/S2A_MSIL1C_20180621T102021_N0206_R065_T32TPS_20180621T140615.zip', '/s2b_prd_msil1c/2018/06/06/S2B_MSIL1C_20180606T102019_N0206_R065_T32TPS_20180606T172808.zip', '/s2b_prd_msil1c/2018/06/13/S2B_MSIL1C_20180613T101019_N0206_R022_T32TPS_20180613T122213.zip', '/s2b_prd_msil1c/2018/06/16/S2B_MSIL1C_20180616T102019_N0206_R065_T32TPS_20180616T154713.zip'] # node input pickled dc files dc_filepaths = None # node input parameters params = [{'name': 'set_output_folder', 'out_dirpath': './basic_job/dc_0/'}, {'name': 'filter_bands', 'bands': ['B08', 'B04', 'B02']}, {'name': 'crop', 'extent': (11.279182434082033, 46.464349400461145, 11.406898498535158, 46.522729291844286), 'crs': 'EPSG:4326'}, {'name': 'to_pickle', 'filepath': './basic_job/dc_0/dc_0.dc;str'}] # evaluate node dc_0 = EODataProcessor(filepaths=filepaths, dc_filepaths=dc_filepaths, user_params=params) ### blue_4 ### # node input files filepaths = None # node input pickled dc files dc_filepaths = ['./basic_job/dc_0/dc_0.dc'] # node input parameters params = [{'name': 'set_output_folder', 'out_dirpath': './basic_job/blue_4/'}, {'name': 'reduce', 'dimension': 'band', 'f_input': {'f_name': 'array_element', 'index': '2;int'}}, {'name': 'to_pickle', 'filepath': './basic_job/blue_4/blue_4.dc;str'}] # evaluate node blue_4 = EODataProcessor(filepaths=filepaths, dc_filepaths=dc_filepaths, user_params=params) ### p2_7 ### # node input files filepaths = None # node input pickled dc files dc_filepaths = ['./basic_job/blue_4/blue_4.dc'] # node input parameters params = [{'name': 'set_output_folder', 'out_dirpath': './basic_job/p2_7/'}, {'name': 'reduce', 'dimension': 'band', 'f_input': {'f_name': 'product', 'extra_values': '[-7.5];list'}}, {'name': 'to_pickle', 'filepath': './basic_job/p2_7/p2_7.dc;str'}] # evaluate node p2_7 = EODataProcessor(filepaths=filepaths, dc_filepaths=dc_filepaths, user_params=params) ### red_3 ### # node input files filepaths = None # node input pickled dc files dc_filepaths = ['./basic_job/dc_0/dc_0.dc'] # node input parameters params = [{'name': 'set_output_folder', 'out_dirpath': './basic_job/red_3/'}, {'name': 'reduce', 'dimension': 'band', 'f_input': {'f_name': 'array_element', 'index': '1;int'}}, {'name': 'to_pickle', 'filepath': './basic_job/red_3/red_3.dc;str'}] # evaluate node red_3 = EODataProcessor(filepaths=filepaths, dc_filepaths=dc_filepaths, user_params=params) ### p1_6 ### # node input files filepaths = None # node input pickled dc files dc_filepaths = ['./basic_job/red_3/red_3.dc'] # node input parameters params = [{'name': 'set_output_folder', 'out_dirpath': './basic_job/p1_6/'}, {'name': 'reduce', 'dimension': 'band', 'f_input': {'f_name': 'product', 'extra_values': '[6];list'}}, {'name': 'to_pickle', 'filepath': './basic_job/p1_6/p1_6.dc;str'}] # evaluate node p1_6 = EODataProcessor(filepaths=filepaths, dc_filepaths=dc_filepaths, user_params=params) ### nir_2 ### # node input files filepaths = None # node input pickled dc files dc_filepaths = ['./basic_job/dc_0/dc_0.dc'] # node input parameters params = [{'name': 'set_output_folder', 'out_dirpath': './basic_job/nir_2/'}, {'name': 'reduce', 'dimension': 'band', 'f_input': {'f_name': 'array_element', 'index': '0;int'}}, {'name': 'to_pickle', 'filepath': './basic_job/nir_2/nir_2.dc;str'}] # evaluate node nir_2 = EODataProcessor(filepaths=filepaths, dc_filepaths=dc_filepaths, user_params=params) ### sum_8 ### # node input files filepaths = None # node input pickled dc files dc_filepaths = ['./basic_job/nir_2/nir_2.dc', './basic_job/p1_6/p1_6.dc', './basic_job/p2_7/p2_7.dc'] # node input parameters params = [{'name': 'set_output_folder', 'out_dirpath': './basic_job/sum_8/'}, {'name': 'reduce', 'dimension': 'band', 'f_input': {'f_name': 'sum', 'extra_values': '[10000];list'}}, {'name': 'to_pickle', 'filepath': './basic_job/sum_8/sum_8.dc;str'}] # evaluate node sum_8 = EODataProcessor(filepaths=filepaths, dc_filepaths=dc_filepaths, user_params=params) ### sub_5 ### # node input files filepaths = None # node input pickled dc files dc_filepaths = ['./basic_job/nir_2/nir_2.dc', './basic_job/red_3/red_3.dc'] # node input parameters params = [{'name': 'set_output_folder', 'out_dirpath': './basic_job/sub_5/'}, {'name': 'reduce', 'dimension': 'band', 'f_input': {'f_name': 'subtract', 'y': 'setfloat;str'}}, {'name': 'to_pickle', 'filepath': './basic_job/sub_5/sub_5.dc;str'}] # evaluate node sub_5 = EODataProcessor(filepaths=filepaths, dc_filepaths=dc_filepaths, user_params=params) ### div_9 ### # node input files filepaths = None # node input pickled dc files dc_filepaths = ['./basic_job/sub_5/sub_5.dc', './basic_job/sum_8/sum_8.dc'] # node input parameters params = [{'name': 'set_output_folder', 'out_dirpath': './basic_job/div_9/'}, {'name': 'reduce', 'dimension': 'band', 'f_input': {'f_name': 'divide', 'y': 'setfloat;str'}}, {'name': 'to_pickle', 'filepath': './basic_job/div_9/div_9.dc;str'}] # evaluate node div_9 = EODataProcessor(filepaths=filepaths, dc_filepaths=dc_filepaths, user_params=params) ### p3_10 ### # node input files filepaths = None # node input pickled dc files dc_filepaths = ['./basic_job/div_9/div_9.dc'] # node input parameters params = [{'name': 'set_output_folder', 'out_dirpath': './basic_job/p3_10/'}, {'name': 'reduce', 'dimension': 'band', 'f_input': {'f_name': 'product', 'extra_values': '[2.5];list'}}, {'name': 'save_raster', 'in_place': 'True;bool', 'format_type': 'Gtiff'}, {'name': 'to_pickle', 'filepath': './basic_job/p3_10/p3_10.dc;str'}] # evaluate node p3_10 = EODataProcessor(filepaths=filepaths, dc_filepaths=dc_filepaths, user_params=params) ### evi_1 ### # node input files filepaths = None # node input pickled dc files dc_filepaths = ['./basic_job/p3_10/p3_10.dc'] # node input parameters params = [{'name': 'set_output_folder', 'out_dirpath': './basic_job/evi_1/'}, {'name': 'save_raster', 'format_type': 'VRT'}, {'name': 'to_pickle', 'filepath': './basic_job/evi_1/evi_1.dc;str'}] # evaluate node evi_1 = EODataProcessor(filepaths=filepaths, dc_filepaths=dc_filepaths, user_params=params) ### min_12 ### # node input files filepaths = None # node input pickled dc files dc_filepaths = ['./basic_job/evi_1/evi_1.dc'] # node input parameters params = [{'name': 'set_output_folder', 'out_dirpath': './basic_job/min_12/'}, {'name': 'reduce', 'dimension': 'time', 'f_input': {'f_name': 'min'}}, {'name': 'save_raster', 'in_place': 'True;bool', 'format_type': 'Gtiff'}, {'name': 'to_pickle', 'filepath': './basic_job/min_12/min_12.dc;str'}] # evaluate node min_12 = EODataProcessor(filepaths=filepaths, dc_filepaths=dc_filepaths, user_params=params) ### mintime_11 ### # node input files filepaths = None # node input pickled dc files dc_filepaths = ['./basic_job/min_12/min_12.dc'] # node input parameters params = [{'name': 'set_output_folder', 'out_dirpath': './basic_job/mintime_11/'}, {'name': 'save_raster', 'format_type': 'VRT'}, {'name': 'to_pickle', 'filepath': './basic_job/mintime_11/mintime_11.dc;str'}] # evaluate node mintime_11 = EODataProcessor(filepaths=filepaths, dc_filepaths=dc_filepaths, user_params=params) ### save_13 ### # node input files filepaths = None # node input pickled dc files dc_filepaths = ['./basic_job/mintime_11/mintime_11.dc'] # node input parameters params = [{'name': 'set_output_folder', 'out_dirpath': './basic_job/result/'}, {'name': 'save_raster'}, {'name': 'get_cube_metadata'}, {'name': 'to_pickle', 'filepath': './basic_job/result/save_13.dc;str'}] # evaluate node save_13 = EODataProcessor(filepaths=filepaths, dc_filepaths=dc_filepaths, user_params=params)
46.964912
677
0.716972
1,166
8,031
4.631218
0.114065
0.066667
0.103704
0.05963
0.790926
0.787593
0.75537
0.666667
0.647778
0.632963
0
0.079895
0.094509
8,031
170
678
47.241176
0.662679
0.154028
0
0.275862
0
0
0.50263
0.231024
0
0
0
0
0
1
0
false
0
0.034483
0
0.034483
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
5cb2b78ac63f62f3ed1491c5e35a34507cb9ade3
4,483
py
Python
CSI2999/CellCheck/models.py
sydneyhill3901/CSI2999
820f05f82c43c30b3fc37659dda2ab599a9ab3da
[ "MIT" ]
null
null
null
CSI2999/CellCheck/models.py
sydneyhill3901/CSI2999
820f05f82c43c30b3fc37659dda2ab599a9ab3da
[ "MIT" ]
136
2020-02-14T22:04:58.000Z
2021-09-22T18:46:36.000Z
CSI2999/CellCheck/models.py
sydneyhill3901/CSI2999
820f05f82c43c30b3fc37659dda2ab599a9ab3da
[ "MIT" ]
null
null
null
from django.db import models import django.core.exceptions #TODO: Add query methods for use in views """ Notes: - Each model class (ie. child class of models.Model) corresponds to one sql table - In python a class is defined as a child of a parent by putting the parent in the parentheses after the class name is defined - by default model classes generate an id column w/ Not Null and Primary Key settings """ class Phone(models.Model): PhoneName = models.CharField(max_length = 40) # I am gonna set this to 160 for now, might need to make larger CnetURL = models.CharField(max_length = 160) WiredURL = models.CharField(max_length = 160) PCMagURL = models.CharField(max_length = 160) VergeURL = models.CharField(max_length = 160) phoneImageURL = models.CharField(max_length = 160) Manufacturer = models.CharField(max_length = 160, default="") # A date field so we know when the phone was released ReleaseDate = models.CharField(max_length = 40) def getName(self): return self.PhoneName def getID(self): return self.id def getImageURL(self): return self.phoneImageURL def __str__(self): return self.PhoneName class Site(models.Model): # Having this as a table means we only have to store foreign keys # in rating table entries rather than redundant strings, saving space # also more extensible for the "future" SiteName = models.CharField(max_length = 40) def __str__(self): return self.SiteName def getId(self): return self.pk class Rating(models.Model): # Need to store reviews as floats b/c some sites scores are to 1st decimal point Rating = models.DecimalField(max_digits=3, decimal_places=1) # This is how you make a foreign key in django. Note the cascading delete Phone = models.ForeignKey(Phone, on_delete=models.CASCADE) Site = models.ForeignKey(Site, on_delete=models.CASCADE) def __str__(self): return f"{self.Site}'s rating for the: {self.Phone}" class ProList(models.Model): Phone = models.ForeignKey(Phone, on_delete=models.CASCADE) Site = models.ForeignKey(Site, on_delete=models.CASCADE) Pros = models.TextField(max_length = 200) def __str__(self): return f"{self.Site}'s pros for phone {self.Phone}" class ConList(models.Model): Phone = models.ForeignKey(Phone, on_delete=models.CASCADE) Site = models.ForeignKey(Site, on_delete=models.CASCADE) Cons = models.TextField(max_length = 200) def __str__(self): return f"{self.Site}'s cons for phone {self.Phone}" class CNETDetailedScore(models.Model): phone = models.ForeignKey(Phone, on_delete=models.CASCADE) Design = models.PositiveSmallIntegerField() Features = models.PositiveSmallIntegerField() Performance = models.PositiveSmallIntegerField() Camera = models.PositiveSmallIntegerField() Battery = models.PositiveSmallIntegerField() def getDesign(self): return self.Design def getFeatures(self): return self.Features def getPerformance(self): return self.Performance def getCamera(self): return self.Camera def getBattery(self): return self.Battery def __str__(self): return f"CNET Detailed Scores\nDesign: {self.Design}\nFeatures: {self.Features}\nPerformance: {self.Performance}\nCamera: {self.Camera}\nBattery: {self.Battery}" class UserReview(models.Model): # Store user scores for a given Site = models.ForeignKey(Site, on_delete=models.CASCADE) Phone = models.ForeignKey(Phone, on_delete=models.CASCADE) UsefulCount = models.IntegerField() Rating = models.DecimalField(max_digits=3, decimal_places=1) IsPositive = models.BooleanField(default = True) # Right now this defaults to true. If we decide to store negative reviews, can be overriden Content = models.TextField(max_length=400, default="") Title = models.CharField(max_length=100, default="") def __str__(self): return f"{self.Site}'s {'positive' if self.IsPositive else 'negative'} user review for {self.Phone}" def createUserReviewDict(self): return { "revTitle": self.Title, "content": '"' + self.Content + '"', "rating": self.Rating, "usefulCount": self.UsefulCount, } class AvgUserScore(models.Model): # Average user scores for a given phone on an ecommerce site Site = models.ForeignKey(Site, on_delete=models.CASCADE) Phone = models.ForeignKey(Phone, on_delete=models.CASCADE) AvgScore = models.DecimalField(max_digits=3, decimal_places=1) def getAvg(self): return self.AvgScore def __str__(self): return f"{self.Site}'s average score for {self.Phone} : {self.AvgScore}"
32.963235
163
0.752175
624
4,483
5.304487
0.3125
0.057402
0.050755
0.069789
0.389124
0.277946
0.260423
0.260423
0.224169
0.195166
0
0.012014
0.145884
4,483
135
164
33.207407
0.852442
0.146331
0
0.252874
0
0.022989
0.131752
0.029437
0
0
0
0.007407
0
1
0.218391
false
0
0.022989
0.218391
0.942529
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
5cb5507f27137a82eff273a00218a5dc5b3f6d5d
2,581
py
Python
tests/setup_test_objects.py
michaelgugino/pylw
ec2400f97d69814b9cc758a821500b835483e66b
[ "Apache-2.0" ]
3
2015-12-10T00:38:42.000Z
2020-04-27T17:27:30.000Z
tests/setup_test_objects.py
michaelgugino/pylw
ec2400f97d69814b9cc758a821500b835483e66b
[ "Apache-2.0" ]
null
null
null
tests/setup_test_objects.py
michaelgugino/pylw
ec2400f97d69814b9cc758a821500b835483e66b
[ "Apache-2.0" ]
2
2015-12-10T00:16:24.000Z
2020-04-27T17:27:36.000Z
import pylw import pylw.app, pylw.resource import cStringIO import json body = '{"var1" : "value 1"}' test_input_buff = cStringIO.StringIO(body) test_post_env = { 'wsgi.input' : test_input_buff, 'CONTENT_LENGTH' : str(len(test_input_buff.getvalue())), 'HTTP_COOKIE' : 'cookie1=value1;', 'QUERY_STRING' : 'x=1&y=2', 'REQUEST_METHOD' : 'POST' } test_get_env = { 'wsgi.input' : '', 'CONTENT_LENGTH' : '0', 'HTTP_COOKIE' : 'cookie1=value1;', 'QUERY_STRING' : 'x=1&y=2', 'REQUEST_METHOD' : 'GET' } class EnvInput(object): def __init__(self, type, path): if type == 'POST': self.test_input_buff = cStringIO.StringIO(body) self.env = { 'wsgi.input' : self.test_input_buff, 'CONTENT_LENGTH' : str(len(self.test_input_buff.getvalue())), 'HTTP_COOKIE' : 'cookie1=value1;', 'QUERY_STRING' : str(u'x=1&y=2'), 'REQUEST_METHOD' : type, 'PATH_INFO' : path } elif type == 'GET': self.test_input_buff = cStringIO.StringIO('') self.env = { 'wsgi.input' : self.test_input_buff, 'CONTENT_LENGTH' : str(len(self.test_input_buff.getvalue())), 'HTTP_COOKIE' : 'cookie1=value1;', 'QUERY_STRING' : str(u'x=1&y=2'), 'REQUEST_METHOD' : type, 'PATH_INFO' : path } class TestHomeResource(pylw.resource.DefaultResource): def on_get(self,req,resp,user_objects=None): resp.status = '200 OK' resp.body = 'this is hard coded home' #resp.add_cookie('testk','value1') resp.add_header('Content-Type','text/html') def on_post(self,req,resp,user_objects=None): resp.status = '200 OK' resp.body = 'this is hard coded post home' #resp.add_cookie('testk','value1') resp.add_header('Content-Type','text/html') class TestVarResource(pylw.resource.DefaultResource): def on_get(self,req,resp,user_objects=None): resp.status = '200 OK' resp.body = json.dumps(req.url_vars) #resp.add_cookie('testk','value1') resp.add_header('Content-Type','text/html') class BadResource(pylw.resource.DefaultResource): def on_get(self,req,resp,user_objects=None): resp.status = '200 OK' resp.body = json.dumps(nonexisten_var) #resp.add_cookie('testk','value1') resp.add_header('Content-Type','text/html') #test_app = pylw.app.App(secret_key="my-new-secret-key")
31.47561
77
0.592019
322
2,581
4.546584
0.245342
0.055328
0.079918
0.069672
0.784153
0.784153
0.711749
0.689891
0.689891
0.689891
0
0.018267
0.257652
2,581
81
78
31.864198
0.745825
0.072453
0
0.47541
0
0
0.22771
0
0
0
0
0
0
1
0.081967
false
0
0.065574
0
0.213115
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