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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f6f1ab8abc3de63eb67bd4fb6ecdf7929e0eb532 | 152 | py | Python | mambotokea/apps.py | synthiakageni/neighborhood | d7a04b17af83f864aad54c24b62c27b5c51b89e9 | [
"Unlicense"
] | null | null | null | mambotokea/apps.py | synthiakageni/neighborhood | d7a04b17af83f864aad54c24b62c27b5c51b89e9 | [
"Unlicense"
] | null | null | null | mambotokea/apps.py | synthiakageni/neighborhood | d7a04b17af83f864aad54c24b62c27b5c51b89e9 | [
"Unlicense"
] | null | null | null | from django.apps import AppConfig
class MambotokeaConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'mambotokea'
| 21.714286 | 56 | 0.769737 | 17 | 152 | 6.764706 | 0.882353 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.144737 | 152 | 6 | 57 | 25.333333 | 0.884615 | 0 | 0 | 0 | 0 | 0 | 0.256579 | 0.190789 | 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 |
f6fcd7c8c7c33dffd6c6a9cf42c636bf31c54cba | 316 | py | Python | players/distribute_bot.py | Siedler/Owela | cdaa3218846d78cf93a90ff6c4740ac3020275ee | [
"Apache-2.0"
] | null | null | null | players/distribute_bot.py | Siedler/Owela | cdaa3218846d78cf93a90ff6c4740ac3020275ee | [
"Apache-2.0"
] | null | null | null | players/distribute_bot.py | Siedler/Owela | cdaa3218846d78cf93a90ff6c4740ac3020275ee | [
"Apache-2.0"
] | null | null | null | from players.player import *
class DistributeBot(Player):
def select_move(self, game, player) -> int:
"""
This bot tries to distribute it's stones onto as many fields as possible
"""
return self.find_highest_value_move(game, player, lambda game: game.used_fields_count(player))
| 31.6 | 102 | 0.686709 | 43 | 316 | 4.906977 | 0.744186 | 0.094787 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.224684 | 316 | 9 | 103 | 35.111111 | 0.861224 | 0.227848 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 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 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
100a7b080cdbf52878aa7c6844fdf3401e872bb9 | 88 | py | Python | src/apps/feed/apps.py | COAStatistics/aprp | 8b06116a32001b040868a3cfa44e7d1f3bfb4742 | [
"MIT"
] | 2 | 2020-07-11T23:20:54.000Z | 2021-07-14T03:15:28.000Z | src/apps/feed/apps.py | COAStatistics/aprp | 8b06116a32001b040868a3cfa44e7d1f3bfb4742 | [
"MIT"
] | 38 | 2018-09-26T15:11:34.000Z | 2022-03-18T08:05:02.000Z | src/apps/feed/apps.py | COAStatistics/aprp | 8b06116a32001b040868a3cfa44e7d1f3bfb4742 | [
"MIT"
] | 6 | 2018-08-24T05:50:32.000Z | 2019-03-12T01:22:44.000Z | from django.apps import AppConfig
class FeedConfig(AppConfig):
name = 'apps.feed'
| 14.666667 | 33 | 0.738636 | 11 | 88 | 5.909091 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.170455 | 88 | 5 | 34 | 17.6 | 0.890411 | 0 | 0 | 0 | 0 | 0 | 0.102273 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
63f5ddbc9887f335dda503ea0140f4ddd64cfa19 | 2,079 | py | Python | scattertext/termscoring/CohensD.py | shettyprithvi/scattertext | a15613b6feef3ddc56c03aadb8e1e629d28a427d | [
"Apache-2.0"
] | null | null | null | scattertext/termscoring/CohensD.py | shettyprithvi/scattertext | a15613b6feef3ddc56c03aadb8e1e629d28a427d | [
"Apache-2.0"
] | null | null | null | scattertext/termscoring/CohensD.py | shettyprithvi/scattertext | a15613b6feef3ddc56c03aadb8e1e629d28a427d | [
"Apache-2.0"
] | null | null | null | import numpy as np
from scattertext.termscoring.CohensDCalculator import CohensDCalculator
from scattertext.termscoring.CorpusBasedTermScorer import CorpusBasedTermScorer
class CohensD(CorpusBasedTermScorer, CohensDCalculator):
'''
Cohen's d scores
term_scorer = (CohensD(corpus).set_categories('Positive', ['Negative'], ['Plot']))
html = st.produce_frequency_explorer(
corpus,
category='Positive',
not_categories=['Negative'],
neutral_categories=['Plot'],
term_scorer=term_scorer,
metadata=rdf['movie_name'],
grey_threshold=0,
show_neutral=True
)
file_name = 'rotten_fresh_fre.html'
open(file_name, 'wb').write(html.encode('utf-8'))
IFrame(src=file_name, width=1300, height=700)
'''
def _set_scorer_args(self, **kwargs):
pass
def get_scores(self, *args):
return self.get_score_df()['cohens_d']
def get_score_df(self, correction_method=None):
'''
:param correction_method: str or None, correction method from statsmodels.stats.multitest.multipletests
'fdr_bh' is recommended.
:return: pd.DataFrame
'''
# From https://people.kth.se/~lang/Effect_size.pdf
# Shinichi Nakagawa1 and Innes C. Cuthill. Effect size, confidence interval and statistical
# significance: a practical guide for biologists. 2007. In Biological Reviews 82.
#
# Modification: when calculating variance, an empty document is added to each set
X = self._get_X().astype(np.float64)
X = X / X.sum(axis=1)
X[np.isnan(X)] = 0
cat_X, ncat_X = self._get_cat_and_ncat(X)
score_df = (self
.get_cohens_d_df(cat_X, ncat_X, correction_method)
.set_index(np.array(self.corpus_.get_terms())))
return score_df
def get_name(self):
return "Cohen's d"
class HedgesR(CohensD):
def get_scores(self, *args):
return self.get_score_df()['hedges_r']
def get_name(self):
return "Hedge's r"
| 31.984615 | 111 | 0.649832 | 258 | 2,079 | 5.027132 | 0.527132 | 0.02313 | 0.02313 | 0.024672 | 0.092521 | 0.061681 | 0.061681 | 0.061681 | 0.061681 | 0.061681 | 0 | 0.012682 | 0.241462 | 2,079 | 64 | 112 | 32.484375 | 0.809765 | 0.448773 | 0 | 0.166667 | 0 | 0 | 0.03301 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.041667 | 0.125 | 0.166667 | 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 |
120a45612206c3716bbb2710afc7af0a7cdb80e4 | 3,402 | py | Python | projects/InterpretationReID/interpretationreid/config/add_config.py | SheldongChen/AMD.github.io | 5f3018f239127949b2d3995162ffe033dcf8051a | [
"Apache-2.0"
] | 17 | 2021-11-01T01:14:06.000Z | 2022-03-02T14:59:39.000Z | projects/InterpretationReID/interpretationreid/config/add_config.py | SheldongChen/AMD.github.io | 5f3018f239127949b2d3995162ffe033dcf8051a | [
"Apache-2.0"
] | 2 | 2021-12-22T07:56:13.000Z | 2022-03-18T10:26:21.000Z | projects/InterpretationReID/interpretationreid/config/add_config.py | SheldongChen/AMD.github.io | 5f3018f239127949b2d3995162ffe033dcf8051a | [
"Apache-2.0"
] | 2 | 2022-02-18T07:42:38.000Z | 2022-02-18T10:16:26.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
@File : add_config.py
@Author: Xiaodong Chen
@Date : 2020/8/30 21:50
@E-mail : 1241660907@qq.com or sheldongchen@gmail.com
'''
from fastreid.config import CfgNode as CN
def add_interpretation_config(cfg):
_C = cfg
_C.DATALOADER.ATT_RESAMPLE = False
_C.VISUAL = CN()
_C.VISUAL.OPEN = False
_C.VISUAL.GAP_QUERY = 100
_C.INTERPRETATION = CN()
_C.INTERPRETATION.FREEZE_LAYERS = [''] # freeze layers of pretrain model
_C.INTERPRETATION.PRETRAIN_MODEL = ''
_C.INTERPRETATION.ATT_PRETRAIN_DICT = ''
_C.INTERPRETATION.MODEL = CN()
_C.INTERPRETATION.MODEL.SHARE_LAYER = 3 # [0,5] , int
_C.INTERPRETATION.LOSS = CN()
_C.INTERPRETATION.LOSS.att = 10.0
_C.INTERPRETATION.LOSS.att_decay = False
_C.INTERPRETATION.LOSS.interpretation = 1.0
_C.INTERPRETATION.LOSS.att_lamda = 0.0 # [-inf , 0]ß
_C.INTERPRETATION.LOSS.threshold = 0.9
#_C.INTERPRETATION.LOSS.q_att = 1.0 # [-inf , 0]ß
# Cfg of Interpretation Network : g(I)
_C.INTERPRETATION.I_MODEL = CN()
_C.INTERPRETATION.I_MODEL.BACKBONE = CN()
_C.INTERPRETATION.I_MODEL.BACKBONE.ADD_PARAMETER = False
_C.INTERPRETATION.I_MODEL.BACKBONE.NAME = "build_resnet_backbone"
_C.INTERPRETATION.I_MODEL.BACKBONE.DEPTH = "50x"
_C.INTERPRETATION.I_MODEL.BACKBONE.LAST_STRIDE = 1
# Normalization method for the convolution layers.
_C.INTERPRETATION.I_MODEL.BACKBONE.NORM = "BN"
# Mini-batch split of Ghost BN
_C.INTERPRETATION.I_MODEL.BACKBONE.NORM_SPLIT = 1
# If use IBN block in backbone
_C.INTERPRETATION.I_MODEL.BACKBONE.WITH_IBN = False
# If use SE block in backbone
_C.INTERPRETATION.I_MODEL.BACKBONE.WITH_SE = False
# If use Non-local block in backbone
_C.INTERPRETATION.I_MODEL.BACKBONE.WITH_NL = False
# If use ImageNet pretrain model
_C.INTERPRETATION.I_MODEL.BACKBONE.PRETRAIN = True
# Pretrain model path
_C.INTERPRETATION.I_MODEL.BACKBONE.PRETRAIN_PATH = ''
# ---------------------------------------------------------------------------- #
# REID HEADS options
# ---------------------------------------------------------------------------- #
_C.INTERPRETATION.I_MODEL.HEADS = CN()
_C.INTERPRETATION.I_MODEL.HEADS.NAME = "ADD_AttrHead"
# Normalization method for the convolution layers.
_C.INTERPRETATION.I_MODEL.HEADS.NORM = "BN"
# Mini-batch split of Ghost BN
_C.INTERPRETATION.I_MODEL.HEADS.NORM_SPLIT = 1
# Number of identity
_C.INTERPRETATION.I_MODEL.HEADS.NUM_CLASSES = 23 # _C.INTERPRETATION.NUM_ATT = 23 # num of attribute
# Input feature dimension
_C.INTERPRETATION.I_MODEL.HEADS.IN_FEAT = 2048
# Reduction dimension in head
_C.INTERPRETATION.I_MODEL.HEADS.REDUCTION_DIM = 512
# Triplet feature using feature before(after) bnneck
_C.INTERPRETATION.I_MODEL.HEADS.NECK_FEAT = "before" # options: before, after
# Pooling layer type
_C.INTERPRETATION.I_MODEL.HEADS.POOL_LAYER = "fastavgpool"
# Classification layer type
_C.INTERPRETATION.I_MODEL.HEADS.CLS_LAYER = "linear" # "arcSoftmax" or "circleSoftmax"
# Margin and Scale for margin-based classification layer
_C.INTERPRETATION.I_MODEL.HEADS.MARGIN = 0.15
_C.INTERPRETATION.I_MODEL.HEADS.SCALE = 128
_C.INTERPRETATION.I_MODEL.HEADS.WITH_BNNECK = False
| 32.09434 | 106 | 0.677249 | 443 | 3,402 | 4.968397 | 0.325056 | 0.272603 | 0.189005 | 0.248069 | 0.448433 | 0.293957 | 0.199909 | 0.168105 | 0.168105 | 0.102681 | 0 | 0.022589 | 0.180188 | 3,402 | 105 | 107 | 32.4 | 0.766583 | 0.328924 | 0 | 0 | 0 | 0 | 0.028163 | 0.009388 | 0 | 0 | 0 | 0 | 0 | 1 | 0.022222 | false | 0 | 0.022222 | 0 | 0.044444 | 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 |
121fa760fd1620821b34f21806f44d0e9b088dd8 | 1,220 | py | Python | apps/CVitae/serializers.py | michaelhenry/CVitae | f73f5126adc42aae695f56d3a1c2cf2fa9f10389 | [
"MIT"
] | null | null | null | apps/CVitae/serializers.py | michaelhenry/CVitae | f73f5126adc42aae695f56d3a1c2cf2fa9f10389 | [
"MIT"
] | 2 | 2018-02-12T15:23:19.000Z | 2018-02-25T10:13:44.000Z | apps/CVitae/serializers.py | michaelhenry/CVitae | f73f5126adc42aae695f56d3a1c2cf2fa9f10389 | [
"MIT"
] | null | null | null | from rest_framework import serializers
from .models import (Job, Project, Company, Profile, Skill, Education)
class JobSerializer(serializers.ModelSerializer):
class Meta:
model = Job
fields = (
'id',
'name',
'description',
'company',
)
class ProjectSerializer(serializers.ModelSerializer):
class Meta:
model = Project
fields = (
'id',
'name',
'description',
'start_date',
'end_date',
'photo',
)
class CompanySerializer(serializers.ModelSerializer):
class Meta:
model = Company
fields = (
'id',
'name',
'description',
)
class SkillSerializer(serializers.ModelSerializer):
class Meta:
model = Skill
fields = (
'id',
'name',
'description',
'level',
)
class EducationSerializer(serializers.ModelSerializer):
class Meta:
model = Education
fields = (
'id',
'name_of_school',
'description',
'start_date',
'end_date',
)
class ProfileSerializer(serializers.ModelSerializer):
class Meta:
model = Profile
fields = (
'id',
'display_name',
'job_title',
'email',
) | 15.641026 | 70 | 0.579508 | 102 | 1,220 | 6.843137 | 0.352941 | 0.223496 | 0.266476 | 0.30086 | 0.421203 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.305738 | 1,220 | 78 | 71 | 15.641026 | 0.824085 | 0 | 0 | 0.534483 | 0 | 0 | 0.144144 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.034483 | 0 | 0.241379 | 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 |
122024d0f0e6cc341fbe97626c0c2e01f00e1cfb | 249 | py | Python | is my number divisible by 3 and 5.py | jermainedavies/JermainesFirstPrograms | caeaea6ba0b6a0a7e82f78f5e3b9df1647f22fde | [
"Unlicense"
] | null | null | null | is my number divisible by 3 and 5.py | jermainedavies/JermainesFirstPrograms | caeaea6ba0b6a0a7e82f78f5e3b9df1647f22fde | [
"Unlicense"
] | null | null | null | is my number divisible by 3 and 5.py | jermainedavies/JermainesFirstPrograms | caeaea6ba0b6a0a7e82f78f5e3b9df1647f22fde | [
"Unlicense"
] | null | null | null | user_num = int(input("which number would you like to check?"))
def devisible_by_both():
if user_num %3 == 0 and user_num %5 == 0:
print("your number is divisible by both")
else:
print("your number is not divisible by both") | 35.571429 | 62 | 0.650602 | 41 | 249 | 3.829268 | 0.634146 | 0.133758 | 0.191083 | 0.216561 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021164 | 0.240964 | 249 | 7 | 63 | 35.571429 | 0.809524 | 0 | 0 | 0 | 0 | 0 | 0.42 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0 | 0 | 0.166667 | 0.333333 | 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 |
12303b2c5638cf3c4ed1f342fe7597e2b41d21c8 | 224 | py | Python | notebooks/solutions/02-ex02-solutions.py | thomasjpfan/ml-workshop-advanced | 36665098428f6d71732d129d4f561e33321d9c06 | [
"MIT"
] | 14 | 2020-09-27T01:37:31.000Z | 2022-02-05T21:36:02.000Z | notebooks/solutions/02-ex02-solutions.py | thomasjpfan/ml-workshop-advanced | 36665098428f6d71732d129d4f561e33321d9c06 | [
"MIT"
] | null | null | null | notebooks/solutions/02-ex02-solutions.py | thomasjpfan/ml-workshop-advanced | 36665098428f6d71732d129d4f561e33321d9c06 | [
"MIT"
] | 18 | 2020-10-28T17:00:48.000Z | 2021-12-16T03:38:35.000Z | base_rf.fit(X_train, y_train)
under_rf.fit(X_train, y_train)
over_rf.fit(X_train, y_train)
plot_roc_and_precision_recall_curves([
("original", base_rf),
("undersampling", under_rf),
("oversampling", over_rf),
]) | 24.888889 | 38 | 0.732143 | 36 | 224 | 4.083333 | 0.472222 | 0.102041 | 0.122449 | 0.22449 | 0.346939 | 0.346939 | 0 | 0 | 0 | 0 | 0 | 0 | 0.116071 | 224 | 9 | 39 | 24.888889 | 0.742424 | 0 | 0 | 0 | 0 | 0 | 0.146667 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
12343c30072d9a6ca37717a88f2fa14585789647 | 261 | py | Python | Mac/Tools/macfreeze/macgenerate.py | deadsnakes/python2.4 | f493d5415b662e99a73d017bcafe2148c5bc8fb5 | [
"PSF-2.0"
] | null | null | null | Mac/Tools/macfreeze/macgenerate.py | deadsnakes/python2.4 | f493d5415b662e99a73d017bcafe2148c5bc8fb5 | [
"PSF-2.0"
] | null | null | null | Mac/Tools/macfreeze/macgenerate.py | deadsnakes/python2.4 | f493d5415b662e99a73d017bcafe2148c5bc8fb5 | [
"PSF-2.0"
] | null | null | null | """macgenerate - Generate the out for macfreeze"""
def generate(program, module_dict):
for name in module_dict.keys():
print 'Include %-20s\t'%name,
module = module_dict[name]
print module.gettype(), '\t', repr(module)
return 0
| 29 | 50 | 0.639847 | 34 | 261 | 4.823529 | 0.617647 | 0.182927 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014851 | 0.226054 | 261 | 8 | 51 | 32.625 | 0.79703 | 0 | 0 | 0 | 1 | 0 | 0.080569 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.333333 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
123569050bd8498260f9383bb7f14609f1f00ffd | 139 | py | Python | twitterapp/settings.py | kiwiheretic/logos-v2 | 22739221a6d431322c809b7e17aba54f37eb9617 | [
"Apache-2.0"
] | 4 | 2015-02-20T08:11:59.000Z | 2019-05-15T23:48:11.000Z | twitterapp/settings.py | kiwiheretic/logos-v2 | 22739221a6d431322c809b7e17aba54f37eb9617 | [
"Apache-2.0"
] | 58 | 2015-01-11T02:10:09.000Z | 2022-03-20T01:20:15.000Z | twitterapp/settings.py | kiwiheretic/logos-v2 | 22739221a6d431322c809b7e17aba54f37eb9617 | [
"Apache-2.0"
] | 1 | 2016-06-15T00:49:44.000Z | 2016-06-15T00:49:44.000Z | # The view that is shown for normal use of this app
# Button name for front page
SUPERUSER_SETTINGS_VIEW = 'twitterapp.views.site_setup'
| 23.166667 | 55 | 0.784173 | 23 | 139 | 4.608696 | 0.913043 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.165468 | 139 | 5 | 56 | 27.8 | 0.913793 | 0.546763 | 0 | 0 | 0 | 0 | 0.45 | 0.45 | 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 |
125020b3db4dc8e3cfff6c4c559f3668e489b993 | 1,311 | py | Python | 7.0/acadox.py | vezril/IEEEXtreme | b0952cbe4a47a00f387f9f849bd6b632d6507126 | [
"MIT"
] | null | null | null | 7.0/acadox.py | vezril/IEEEXtreme | b0952cbe4a47a00f387f9f849bd6b632d6507126 | [
"MIT"
] | null | null | null | 7.0/acadox.py | vezril/IEEEXtreme | b0952cbe4a47a00f387f9f849bd6b632d6507126 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import sys
x = raw_input()
x = x.split(' ')
limit = 65535
digit = []
for n in x:
if n == '~':
if len(digit) != 1:
print 'ERROR'
sys.exit(0)
else:
r = ~ digit[0]
try:
digit.pop()
except:
pass
digit.append(r)
elif n in ['+', '-', '|', '&', 'X']:
try:
if n == '+':
r = digit[0] + digit[1]
elif n == '-':
r = digit[0] - digit[1]
elif n == '&':
r = digit[0] & digit[1]
elif n == '|':
r = digit[0] | digit[1]
elif n == 'X':
r = digit[0] ^ digit[1]
elif n == '~':
r = ~ digit[0]
else:
print 'ERROR'
sys.exit(0)
except:
print 'ERROR'
sys.exit(0)
try:
digit.pop()
except:
pass
try:
digit.pop()
except:
pass
digit.append(r)
else:
digit.append(int(n, 16))
if r > limit:
r = 'FFFF'
elif r < 0:
r = '0000'
else:
r = ('0000' + hex(r)[2:])
r = r[-4:len(r)]
print r.upper()
| 20.169231 | 40 | 0.326468 | 143 | 1,311 | 2.986014 | 0.272727 | 0.098361 | 0.114754 | 0.093677 | 0.562061 | 0.437939 | 0.384075 | 0.384075 | 0.229508 | 0.229508 | 0 | 0.053883 | 0.518688 | 1,311 | 64 | 41 | 20.484375 | 0.622821 | 0.015256 | 0 | 0.5 | 0 | 0 | 0.031008 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.053571 | 0.017857 | null | null | 0.071429 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
1255de85f2b1ef078ecb010a5367ef3c8b00de91 | 645 | py | Python | app/surat/views.py | Ekhel/Surya | f7950f91f7492bd40164a28faaa26303641f11e5 | [
"MIT"
] | null | null | null | app/surat/views.py | Ekhel/Surya | f7950f91f7492bd40164a28faaa26303641f11e5 | [
"MIT"
] | null | null | null | app/surat/views.py | Ekhel/Surya | f7950f91f7492bd40164a28faaa26303641f11e5 | [
"MIT"
] | null | null | null | from django.contrib.auth import (login as auth_login, authenticate)
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from .models import surat_masuk
@login_required
def index(request):
return render(request,'master/dashboard.html')
@login_required
def suratmasuk(request):
contex = {
'item':surat_masuk.objects.all()
}
return render(request,'surat_masuk/r-surat-masuk.html',contex)
@login_required
def createsuratmasuk(request):
return render(request, 'surat_masuk/c-surat-masuk.html')
| 29.318182 | 68 | 0.782946 | 84 | 645 | 5.904762 | 0.392857 | 0.120968 | 0.096774 | 0.084677 | 0.116935 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.124031 | 645 | 21 | 69 | 30.714286 | 0.877876 | 0 | 0 | 0.166667 | 0 | 0 | 0.131783 | 0.125581 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0.111111 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
89e3c1b162fe2b573788b359231f71cc8b24a42f | 319 | py | Python | pymath/primes/steps_in_primes/__init__.py | JASTYN/pythonmaster | 46638ab09d28b65ce5431cd0759fe6df272fb85d | [
"Apache-2.0",
"MIT"
] | 3 | 2017-05-02T10:28:13.000Z | 2019-02-06T09:10:11.000Z | pymath/primes/steps_in_primes/__init__.py | JASTYN/pythonmaster | 46638ab09d28b65ce5431cd0759fe6df272fb85d | [
"Apache-2.0",
"MIT"
] | 2 | 2017-06-21T20:39:14.000Z | 2020-02-25T10:28:57.000Z | pymath/primes/steps_in_primes/__init__.py | JASTYN/pythonmaster | 46638ab09d28b65ce5431cd0759fe6df272fb85d | [
"Apache-2.0",
"MIT"
] | 2 | 2016-07-29T04:35:22.000Z | 2017-01-18T17:05:36.000Z | from ..is_prime import is_prime
def step(g, m, n):
if (n - m) < g:
return None
if (n - m) == g and (is_prime(m) and is_prime(n)):
return [m, n]
for x in range(m, n + 1):
second = x + g
if is_prime(x) and is_prime(second):
return [x, second]
return None
| 17.722222 | 54 | 0.504702 | 55 | 319 | 2.818182 | 0.345455 | 0.270968 | 0.193548 | 0.064516 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004926 | 0.363636 | 319 | 17 | 55 | 18.764706 | 0.758621 | 0 | 0 | 0.181818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0.090909 | 0 | 0.545455 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
89f39819e6cee5aa9736c85f80ae7e312588f9ec | 917 | py | Python | data/test/python/89f39819e6cee5aa9736c85f80ae7e312588f9ec__init__.py | harshp8l/deep-learning-lang-detection | 2a54293181c1c2b1a2b840ddee4d4d80177efb33 | [
"MIT"
] | 84 | 2017-10-25T15:49:21.000Z | 2021-11-28T21:25:54.000Z | data/test/python/89f39819e6cee5aa9736c85f80ae7e312588f9ec__init__.py | vassalos/deep-learning-lang-detection | cbb00b3e81bed3a64553f9c6aa6138b2511e544e | [
"MIT"
] | 5 | 2018-03-29T11:50:46.000Z | 2021-04-26T13:33:18.000Z | data/test/python/89f39819e6cee5aa9736c85f80ae7e312588f9ec__init__.py | vassalos/deep-learning-lang-detection | cbb00b3e81bed3a64553f9c6aa6138b2511e544e | [
"MIT"
] | 24 | 2017-11-22T08:31:00.000Z | 2022-03-27T01:22:31.000Z | from grano.core import app
from grano.util import jsonify
from grano.views.network_api import api as network_api
from grano.views.entity_api import api as entity_api
from grano.views.relation_api import api as relation_api
from grano.views.schema_api import api as schema_api
from grano.views.query_api import api as query_api
from grano.views.home import section as home_section
from grano.views.account import section as account_section
app.register_blueprint(network_api, url_prefix='/api/1')
app.register_blueprint(entity_api, url_prefix='/api/1')
app.register_blueprint(relation_api, url_prefix='/api/1')
app.register_blueprint(schema_api, url_prefix='/api/1')
app.register_blueprint(query_api, url_prefix='/api/1')
app.register_blueprint(account_section, url_prefix='')
app.register_blueprint(home_section, url_prefix='')
@app.route('/api/1')
def apiroot():
return jsonify({'api': 'ok', 'version': 1})
| 36.68 | 58 | 0.803708 | 149 | 917 | 4.724832 | 0.194631 | 0.115057 | 0.139205 | 0.099432 | 0.255682 | 0.255682 | 0.255682 | 0.255682 | 0 | 0 | 0 | 0.008373 | 0.088332 | 917 | 24 | 59 | 38.208333 | 0.833732 | 0 | 0 | 0 | 0 | 0 | 0.052345 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.052632 | true | 0 | 0.473684 | 0.052632 | 0.578947 | 0.368421 | 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 |
89f8443aea7ed9062498727bf25158392cc837ef | 629 | py | Python | rgd/geodata/migrations/0004_auto_20210302_2017.py | Erotemic/ResonantGeoData | ff9aec9daf73353bcc95a9d30e98fcc5cdffc6e0 | [
"Apache-2.0"
] | null | null | null | rgd/geodata/migrations/0004_auto_20210302_2017.py | Erotemic/ResonantGeoData | ff9aec9daf73353bcc95a9d30e98fcc5cdffc6e0 | [
"Apache-2.0"
] | null | null | null | rgd/geodata/migrations/0004_auto_20210302_2017.py | Erotemic/ResonantGeoData | ff9aec9daf73353bcc95a9d30e98fcc5cdffc6e0 | [
"Apache-2.0"
] | null | null | null | # Generated by Django 3.2a1 on 2021-03-02 20:17
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('geodata', '0003_auto_20210301_1639'),
]
operations = [
migrations.RemoveField(
model_name='imageentry',
name='failure_reason',
),
migrations.RemoveField(
model_name='imageentry',
name='metadata',
),
migrations.RemoveField(
model_name='imageentry',
name='status',
),
migrations.DeleteModel(
name='Thumbnail',
),
]
| 21.689655 | 47 | 0.54849 | 53 | 629 | 6.377358 | 0.641509 | 0.186391 | 0.230769 | 0.266272 | 0.390533 | 0.390533 | 0 | 0 | 0 | 0 | 0 | 0.075061 | 0.343402 | 629 | 28 | 48 | 22.464286 | 0.743341 | 0.071542 | 0 | 0.454545 | 1 | 0 | 0.166667 | 0.039519 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.045455 | 0 | 0.181818 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d616d9bb7c7b15ad27c91bda79afbe3a5b807b33 | 381 | py | Python | src/test/python/cseh/test_signal_elb_healthcheck.py | konz/cfn-signal-elb-healthcheck | a357836e36c88fdf1172f797f6771d12ab02e7de | [
"Apache-2.0"
] | null | null | null | src/test/python/cseh/test_signal_elb_healthcheck.py | konz/cfn-signal-elb-healthcheck | a357836e36c88fdf1172f797f6771d12ab02e7de | [
"Apache-2.0"
] | null | null | null | src/test/python/cseh/test_signal_elb_healthcheck.py | konz/cfn-signal-elb-healthcheck | a357836e36c88fdf1172f797f6771d12ab02e7de | [
"Apache-2.0"
] | null | null | null | from unittest import TestCase
import cseh
from mock import patch
class TestSignalElbHealthcheck(TestCase):
@patch("cseh.get_instance_metadata")
def test_get_region_strips_availability_zone_to_region(self, get_instance_metadata):
get_instance_metadata.return_value = { "availability-zone": "eu-west-1b" }
self.assertEqual(cseh.get_region(), "eu-west-1") | 29.307692 | 88 | 0.769029 | 49 | 381 | 5.673469 | 0.55102 | 0.118705 | 0.205036 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006079 | 0.136483 | 381 | 13 | 89 | 29.307692 | 0.838906 | 0 | 0 | 0 | 0 | 0 | 0.162304 | 0.068063 | 0 | 0 | 0 | 0 | 0.125 | 1 | 0.125 | false | 0 | 0.375 | 0 | 0.625 | 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 |
d618613ae15c86c3a5b1062d0d0336bc9e9e830c | 466 | py | Python | src/openapi_dataclasses/types/openapi/header.py | cal-pratt/openapi-dataclasses | 106a0c7466dfd29beed1fa1734182f59d9c94393 | [
"MIT"
] | null | null | null | src/openapi_dataclasses/types/openapi/header.py | cal-pratt/openapi-dataclasses | 106a0c7466dfd29beed1fa1734182f59d9c94393 | [
"MIT"
] | null | null | null | src/openapi_dataclasses/types/openapi/header.py | cal-pratt/openapi-dataclasses | 106a0c7466dfd29beed1fa1734182f59d9c94393 | [
"MIT"
] | null | null | null | from dataclasses import dataclass
@dataclass
class OpenApiHeader:
"""
The Header Object follows the structure of the Parameter Object with the following changes:
1. name MUST NOT be specified, it is given in the corresponding headers map.
2. in MUST NOT be specified, it is implicitly in header.
3. All traits that are affected by the location MUST be applicable to a location of header
(for example, style).
"""
| 29.125 | 98 | 0.697425 | 66 | 466 | 4.924242 | 0.681818 | 0.043077 | 0.055385 | 0.110769 | 0.135385 | 0.135385 | 0 | 0 | 0 | 0 | 0 | 0.008696 | 0.259657 | 466 | 15 | 99 | 31.066667 | 0.933333 | 0.774678 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 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 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
d640ac6282107ba41642de3b43441fa6e48fb07c | 92 | py | Python | src/telescope_msk/app_info.py | hmrc/aws-lambda-telescope-msk | efa9963e2988722e73a6bfbc73d10b0aeca3b70a | [
"Apache-2.0"
] | null | null | null | src/telescope_msk/app_info.py | hmrc/aws-lambda-telescope-msk | efa9963e2988722e73a6bfbc73d10b0aeca3b70a | [
"Apache-2.0"
] | 1 | 2021-10-04T11:15:50.000Z | 2021-10-04T11:15:50.000Z | src/telescope_msk/app_info.py | hmrc/aws-lambda-telescope-msk | efa9963e2988722e73a6bfbc73d10b0aeca3b70a | [
"Apache-2.0"
] | 1 | 2021-04-10T23:26:13.000Z | 2021-04-10T23:26:13.000Z | APP_NAME = "telescope-msk"
APP_VERSION = "0.1.0"
METRICS_PREFIX = "telemetry.telescope.msk"
| 23 | 42 | 0.75 | 14 | 92 | 4.714286 | 0.714286 | 0.363636 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.036145 | 0.097826 | 92 | 3 | 43 | 30.666667 | 0.759036 | 0 | 0 | 0 | 0 | 0 | 0.445652 | 0.25 | 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 |
d64f73a280c213eae9dedc0ec2ad27bdef942b0f | 298 | py | Python | camelCase.py | monkee52/NCSSChallenge | e8849085e0578268dc5ce022b39c7d499884d810 | [
"BSD-2-Clause"
] | null | null | null | camelCase.py | monkee52/NCSSChallenge | e8849085e0578268dc5ce022b39c7d499884d810 | [
"BSD-2-Clause"
] | null | null | null | camelCase.py | monkee52/NCSSChallenge | e8849085e0578268dc5ce022b39c7d499884d810 | [
"BSD-2-Clause"
] | null | null | null | # Enter your code for "camelCase" here.
def to_camel(ident):
def a(x):
return x
def b(x):
return x[0].upper() + x[1::]
def c():
yield a
while True:
yield b
d = c()
return "".join(d.__next__()(x) for x in ident.split("_"))
| 17.529412 | 61 | 0.473154 | 44 | 298 | 3.068182 | 0.590909 | 0.103704 | 0.118519 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010753 | 0.375839 | 298 | 16 | 62 | 18.625 | 0.715054 | 0.124161 | 0 | 0 | 0 | 0 | 0.003861 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.363636 | false | 0 | 0 | 0.181818 | 0.636364 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
c3853e84d7cabf221cc29b5c55148f9e1b9c1230 | 258 | py | Python | hackathonbaobab2020/execution/__init__.py | baobabsoluciones/hackathonbaobab2020 | ada30525cca061daad4bd420aa45dd4cfc7b790e | [
"MIT"
] | null | null | null | hackathonbaobab2020/execution/__init__.py | baobabsoluciones/hackathonbaobab2020 | ada30525cca061daad4bd420aa45dd4cfc7b790e | [
"MIT"
] | 2 | 2020-12-03T22:37:45.000Z | 2021-01-28T19:43:42.000Z | hackathonbaobab2020/execution/__init__.py | baobabsoluciones/hackathonbaobab2020 | ada30525cca061daad4bd420aa45dd4cfc7b790e | [
"MIT"
] | 5 | 2020-11-20T15:37:58.000Z | 2021-01-29T10:22:07.000Z | from .run_batch import *
import warnings
try:
from .benchmark import *
except ImportError:
warnings.warn(
"To use the benchmark functions, you need to install the benchmark dependencies: \n`pip install hackathonbaobab2020[benchmark]`"
)
| 25.8 | 136 | 0.732558 | 31 | 258 | 6.064516 | 0.677419 | 0.12766 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019324 | 0.197674 | 258 | 9 | 137 | 28.666667 | 0.888889 | 0 | 0 | 0 | 0 | 0.125 | 0.488372 | 0.120155 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
c3905b54c582858a8de8a03ba1e9dead4f5cbe15 | 473 | py | Python | tests/sfhs/test_exponential.py | AfonsoV/easyGalaxy | f7b5dd7160c11be473e7811ffdf53de2fd777d8b | [
"MIT"
] | 14 | 2017-10-05T14:16:30.000Z | 2020-11-19T07:07:35.000Z | tests/sfhs/test_exponential.py | clannadxu/easyGalaxy | 0608b17d84d00c2bdc069ebfb83024bf8d15e309 | [
"MIT"
] | 4 | 2017-10-26T09:29:05.000Z | 2019-04-02T15:40:32.000Z | tests/sfhs/test_exponential.py | clannadxu/easyGalaxy | 0608b17d84d00c2bdc069ebfb83024bf8d15e309 | [
"MIT"
] | 8 | 2018-01-15T07:36:42.000Z | 2021-08-24T07:46:50.000Z | import unittest
import ezgal.sfhs
import numpy as np
class test_exponential(unittest.TestCase):
def test_exponential_0(self):
self.assertAlmostEqual(ezgal.sfhs.exponential(0, 1), 1.0, 7)
def test_exponential_1(self):
self.assertAlmostEqual(ezgal.sfhs.exponential(1, 1), 0.3678794, 7)
def test_exponential_2(self):
self.assertAlmostEqual(ezgal.sfhs.exponential(2, 1), 0.1353353, 7)
if __name__ == '__main__':
unittest.main()
| 21.5 | 74 | 0.710359 | 64 | 473 | 5.015625 | 0.359375 | 0.11215 | 0.168224 | 0.280374 | 0.420561 | 0.420561 | 0 | 0 | 0 | 0 | 0 | 0.076726 | 0.173362 | 473 | 21 | 75 | 22.52381 | 0.744246 | 0 | 0 | 0 | 0 | 0 | 0.016913 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.583333 | 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 |
c3907e929b66829fa4d49d7ff49469c5243bd1bd | 202 | py | Python | Solutions/7kyu/7kyu_batman_quotes.py | citrok25/Codewars-1 | dc641c5079e2e8b5955eb027fd15427e5bdb2e26 | [
"MIT"
] | 46 | 2017-08-24T09:27:57.000Z | 2022-02-25T02:24:33.000Z | Solutions/7kyu/7kyu_batman_quotes.py | abbhishek971/Codewars | 9e761811db724da1e8aae44594df42b4ee879a16 | [
"MIT"
] | null | null | null | Solutions/7kyu/7kyu_batman_quotes.py | abbhishek971/Codewars | 9e761811db724da1e8aae44594df42b4ee879a16 | [
"MIT"
] | 35 | 2017-08-01T22:09:48.000Z | 2022-02-18T17:21:37.000Z | class BatmanQuotes(object):
@staticmethod
def get_quote(quotes, hero):
index = int(sorted(hero)[0])
return {'B':'Batman: ','R':'Robin: ','J':'Joker: '}[hero[0]] + quotes[index]
| 28.857143 | 84 | 0.579208 | 25 | 202 | 4.64 | 0.8 | 0.086207 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012422 | 0.20297 | 202 | 6 | 85 | 33.666667 | 0.708075 | 0 | 0 | 0 | 0 | 0 | 0.123762 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0 | 0.6 | 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 |
c3c4188a6d3d78b60f8ac0492b4bec20db945627 | 220 | py | Python | src/pydeb/_meta.py | nyyManni/pydeb | 6b03fd8a0f03f7d1f5387bc59947c033c12b2a2d | [
"MIT"
] | null | null | null | src/pydeb/_meta.py | nyyManni/pydeb | 6b03fd8a0f03f7d1f5387bc59947c033c12b2a2d | [
"MIT"
] | null | null | null | src/pydeb/_meta.py | nyyManni/pydeb | 6b03fd8a0f03f7d1f5387bc59947c033c12b2a2d | [
"MIT"
] | null | null | null | __all__ = ['__author__', '__license__', '__version__', '__credits__', '__maintainer__']
__author__ = 'Henrik Nyman'
__license__ = 'MIT'
__version__ = '0.1'
__credits__ = ['Henrik Nyman']
__maintainer__ = 'Henrik Nyman'
| 27.5 | 87 | 0.722727 | 20 | 220 | 5.75 | 0.55 | 0.286957 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010309 | 0.118182 | 220 | 7 | 88 | 31.428571 | 0.582474 | 0 | 0 | 0 | 0 | 0 | 0.45 | 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 |
7f0f93445d1ee2aff60cbfdc6c27f0b288b77ea7 | 830 | py | Python | krazon/exceptions.py | bryanforbes/Krazon | 496aa554a0bc3b911771bbeb02783ae6832e9aa2 | [
"BSD-3-Clause"
] | 1 | 2018-06-22T22:55:17.000Z | 2018-06-22T22:55:17.000Z | krazon/exceptions.py | bryanforbes/Krazon | 496aa554a0bc3b911771bbeb02783ae6832e9aa2 | [
"BSD-3-Clause"
] | null | null | null | krazon/exceptions.py | bryanforbes/Krazon | 496aa554a0bc3b911771bbeb02783ae6832e9aa2 | [
"BSD-3-Clause"
] | null | null | null | from __future__ import annotations
from discord.ext import commands
class ClipNotFound(commands.CommandError):
def __init__(self, name: str) -> None:
super().__init__(message=f'No clip named `{name}` found')
class FilenameExists(commands.CommandError):
def __init__(self, filename: str) -> None:
super().__init__(message=f'A file named `{filename}` has already been uploaded. '
'Rename the file and try again.')
class MustBeConnected(commands.CommandError):
def __init__(self) -> None:
super().__init__(message='You must be connected to a voice channel to play a clip')
class TooManyMembers(commands.CommandError):
def __init__(self) -> None:
super().__init__(message='Cannot connect to voice channel to play the clip: too many members connected')
| 33.2 | 112 | 0.7 | 103 | 830 | 5.291262 | 0.495146 | 0.146789 | 0.168807 | 0.198165 | 0.388991 | 0.275229 | 0.187156 | 0.187156 | 0.187156 | 0 | 0 | 0 | 0.196386 | 830 | 24 | 113 | 34.583333 | 0.817091 | 0 | 0 | 0.133333 | 0 | 0 | 0.291566 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.266667 | false | 0 | 0.133333 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
61394104ab8a92f2ceec31ae226b734c6ae91021 | 1,386 | py | Python | Asynconf 2020/algo/ex5.py | BhasherBEL/ProgrammingChallenges | e697c7f7e3d8177b9ee615918f3c78b645b927d0 | [
"MIT"
] | null | null | null | Asynconf 2020/algo/ex5.py | BhasherBEL/ProgrammingChallenges | e697c7f7e3d8177b9ee615918f3c78b645b927d0 | [
"MIT"
] | 1 | 2020-12-09T12:00:56.000Z | 2020-12-09T12:00:56.000Z | Asynconf 2020/algo/ex5.py | BhasherBEL/ProgrammingChallenges | e697c7f7e3d8177b9ee615918f3c78b645b927d0 | [
"MIT"
] | 1 | 2020-12-09T11:38:49.000Z | 2020-12-09T11:38:49.000Z | import re
def analyze(text: str) -> str:
"""Automatically analyzes the content of the letter to Santa Claus.
Args:
text (str): Original letter
Returns:
str: simplified letter
"""
age = re.search(r'(\d+)ans', text).group(1)
name = re.search(r'jem\'?appelle(.+?)(?: |(j\'?ai))', text).group(1)
address = re.search(r'j\'?habite(.+?)(?:\.|$)', text).group(1)
gift = re.findall(r'j\'?aimeraisavoirun(.+?)pour', text)
return f'[Lettre de {name} {age} ans]\nAdresse{address}\nCadeau: {", ".join(gift)}'
print(analyze("BonjourjemappelleMatheojai6ansetjaimeraisavoirunvelopour pouvoiraller me balader. ensuite j'aimerais bien une nouvelle console nintendo pourjoueràpokemonbleu que je n'ai pas aussi. Par contre j'ai déjà le jeu doncpasbesoin merciperenoel j'habite rue des papillons"))
print('\n')
print(analyze("Cetteannéejaimeraisavoiruntelephonepour m'amuser,jem'appelleClara etjai bientot5anset jaiété tres sage, jaimeraisavoirunchatpourmamuseravec lui ça me fera tres plaisir. j'habite avenue des marmottes"))
print('\n')
print(analyze("Salut papa noel, c'est moi jemappelleElsaj'ai 4ans et j'habite route des papillons. jaimeraisavoirunboite de legopour constructure plein de choses ! merci papa noeletaussi sion peutavoirun deuxiemecadeau jaimeraisavoiruncamion de pompierpourjouer avec mon frere il a 5 ans et il s'apel leo.")) | 55.44 | 308 | 0.733045 | 183 | 1,386 | 5.551913 | 0.650273 | 0.027559 | 0.026575 | 0.035433 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005897 | 0.143579 | 1,386 | 25 | 308 | 55.44 | 0.850042 | 0.10101 | 0 | 0.166667 | 0 | 0.333333 | 0.695902 | 0.204918 | 0 | 0 | 0 | 0 | 0 | 1 | 0.083333 | false | 0 | 0.083333 | 0 | 0.25 | 0.416667 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
613c05b33b2f11f79924641d266395a7a0aa1e2e | 1,207 | py | Python | envi/archs/msp430/__init__.py | vEpiphyte/vivisect | 14947a53c6781175f0aa83d49cc16c524a2e23a3 | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 2020-12-23T19:23:17.000Z | 2020-12-23T19:23:17.000Z | envi/archs/msp430/__init__.py | vEpiphyte/vivisect | 14947a53c6781175f0aa83d49cc16c524a2e23a3 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | envi/archs/msp430/__init__.py | vEpiphyte/vivisect | 14947a53c6781175f0aa83d49cc16c524a2e23a3 | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 2020-12-23T19:23:58.000Z | 2020-12-23T19:23:58.000Z | """
msp430 module
"""
############
# Author: Don C. Weber
# Started: 05/23/2009
#
import envi
from envi.archs.msp430.regs import *
from envi.archs.msp430.disasm import *
from envi.archs.msp430.const import *
class Msp430Module(envi.ArchitectureModule):
def __init__(self):
envi.ArchitectureModule.__init__(self, "msp430", maxinst=4)
self._arch_dis = Msp430Disasm()
def archGetRegCtx(self):
return Msp430RegisterContext()
def archGetNopInstr(self):
return '\x03\x43' # NOP is emulated with: MOV #0, R3
def archGetRegisterGroups(self):
groups = envi.ArchitectureModule.archGetRegisterGroups(self)
general= ('general', registers, )
groups.append(general)
return groups
def getPointerSize(self):
return 2
def pointerString(self, va):
return '0x{:04x}'.format(va)
def archParseOpcode(self, bytes, offset=0, va=0):
return self._arch_dis.disasm(bytes, offset, va)
def getEmulator(self):
return Msp430Emulator()
def getArchDefaultCall(self):
return 'msp430call'
# NOTE: This one must be after the definition of Msp430Module
from envi.archs.msp430.emu import *
| 23.666667 | 68 | 0.669428 | 138 | 1,207 | 5.768116 | 0.507246 | 0.062814 | 0.065327 | 0.095477 | 0.062814 | 0 | 0 | 0 | 0 | 0 | 0 | 0.060317 | 0.217067 | 1,207 | 50 | 69 | 24.14 | 0.782011 | 0.122618 | 0 | 0 | 0 | 0 | 0.037718 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.321429 | false | 0 | 0.178571 | 0.25 | 0.821429 | 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 |
617a402859ff4834f7dfe9b61a9f652c8cf7e29b | 261 | py | Python | system.py | shjnb/system_one | 8e5f70e502b72555e58a9cb75d14ef00eadba909 | [
"Apache-2.0"
] | null | null | null | system.py | shjnb/system_one | 8e5f70e502b72555e58a9cb75d14ef00eadba909 | [
"Apache-2.0"
] | null | null | null | system.py | shjnb/system_one | 8e5f70e502b72555e58a9cb75d14ef00eadba909 | [
"Apache-2.0"
] | null | null | null | # 从app包中导入变量app(它是作为app包成员的变量)
from app import app, db
from app.models import User, Post
@app.shell_context_processor
def make_shell_context():
return {'db': db, 'User': User, 'Post': Post}
if __name__ == '__main__':
app.run(debug=True)
| 20.076923 | 50 | 0.678161 | 35 | 261 | 4.714286 | 0.6 | 0.084848 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.195402 | 261 | 12 | 51 | 21.75 | 0.785714 | 0.10728 | 0 | 0 | 0 | 0 | 0.082192 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | true | 0 | 0.285714 | 0.142857 | 0.571429 | 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 | 0 | 1 | 1 | 0 | 0 | 3 |
61872a27768311c97b6699dc072cad405573452c | 178 | py | Python | api_ui/serializers.py | mihail-ivanov/base-vue-api | a2ef8ae360d3d26425093aefaf521082cf3684c5 | [
"MIT"
] | null | null | null | api_ui/serializers.py | mihail-ivanov/base-vue-api | a2ef8ae360d3d26425093aefaf521082cf3684c5 | [
"MIT"
] | null | null | null | api_ui/serializers.py | mihail-ivanov/base-vue-api | a2ef8ae360d3d26425093aefaf521082cf3684c5 | [
"MIT"
] | null | null | null |
from rest_framework import serializers
class UserSerializer(serializers.Serializer):
email = serializers.EmailField()
username = serializers.CharField(max_length=100)
| 22.25 | 52 | 0.797753 | 18 | 178 | 7.777778 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019355 | 0.129213 | 178 | 7 | 53 | 25.428571 | 0.883871 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
61b053b23ccf88b08d43b1f289692ece12c9a556 | 544 | py | Python | src/docker_composer/runner/cmd/images.py | michascholl/docker-composer | d190f1db766e216654a4259785b9aaf802a9c64d | [
"Apache-2.0"
] | 4 | 2021-01-18T11:35:24.000Z | 2021-08-30T16:19:39.000Z | src/docker_composer/runner/cmd/images.py | michascholl/docker-composer | d190f1db766e216654a4259785b9aaf802a9c64d | [
"Apache-2.0"
] | null | null | null | src/docker_composer/runner/cmd/images.py | michascholl/docker-composer | d190f1db766e216654a4259785b9aaf802a9c64d | [
"Apache-2.0"
] | 1 | 2022-02-19T10:38:59.000Z | 2022-02-19T10:38:59.000Z | # DO NOT EDIT: Autogenerated by src/docker_composer/_utils/generate_class.py
# for docker-compose version 1.25.0, build unknown
from typing import List, Optional
import attr
from docker_composer.base import DockerBaseRunner
@attr.s(auto_attribs=True)
class DockerComposeImages(DockerBaseRunner):
"""
List images used by the created containers.
Usage: images [options] [SERVICE...]
"""
quiet: Optional[bool] = None
"""Only display IDs"""
_cmd: str = "images"
_options: List[str] = [
"quiet",
]
| 21.76 | 76 | 0.691176 | 67 | 544 | 5.507463 | 0.731343 | 0.075881 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009195 | 0.200368 | 544 | 24 | 77 | 22.666667 | 0.83908 | 0.376838 | 0 | 0 | 1 | 0 | 0.037288 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.3 | 0 | 0.7 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
61b765a89a63194c8888185127c05dd269d6eef7 | 396 | py | Python | src/config/yaml_conf_parser.py | Twente-Mining/tezos-reward-distributor | 8df0745fdb44cbd765084303882545202d2427f3 | [
"MIT"
] | null | null | null | src/config/yaml_conf_parser.py | Twente-Mining/tezos-reward-distributor | 8df0745fdb44cbd765084303882545202d2427f3 | [
"MIT"
] | null | null | null | src/config/yaml_conf_parser.py | Twente-Mining/tezos-reward-distributor | 8df0745fdb44cbd765084303882545202d2427f3 | [
"MIT"
] | null | null | null | import yaml
from config.config_parser import ConfigParser
class YamlConfParser(ConfigParser):
def __init__(self, yaml_text, verbose=None) -> None:
super().__init__(yaml_text, verbose)
def parse(self):
self.set_conf_obj(yaml.safe_load(self.conf_text))
return self.get_conf_obj()
def validate(self):
return True
def process(self):
pass | 20.842105 | 57 | 0.679293 | 51 | 396 | 4.941176 | 0.529412 | 0.063492 | 0.119048 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.227273 | 396 | 19 | 58 | 20.842105 | 0.823529 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0.083333 | 0.166667 | 0.083333 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
61c8ff5fad4f7a02863b56f0a945e3432823b7c9 | 286 | py | Python | src/rctgen/impl/activity_block_meta_t.py | mballance/pyrctgen | eb47ed2039d36ab236b63e795b313feb499820bd | [
"Apache-2.0"
] | 1 | 2022-03-10T04:12:11.000Z | 2022-03-10T04:12:11.000Z | src/rctgen/impl/activity_block_meta_t.py | mballance/pyrctgen | eb47ed2039d36ab236b63e795b313feb499820bd | [
"Apache-2.0"
] | null | null | null | src/rctgen/impl/activity_block_meta_t.py | mballance/pyrctgen | eb47ed2039d36ab236b63e795b313feb499820bd | [
"Apache-2.0"
] | null | null | null | '''
Created on Mar 19, 2022
@author: mballance
'''
class ActivityBlockMetaT(type):
def __init__(self, name, bases, dct):
pass
def __enter__(self):
print("ActivityBlockMetaT.__enter__")
def __exit__(self, t, v, tb):
pass
| 15.888889 | 45 | 0.566434 | 30 | 286 | 4.866667 | 0.766667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030928 | 0.321678 | 286 | 18 | 46 | 15.888889 | 0.721649 | 0.15035 | 0 | 0.285714 | 0 | 0 | 0.118644 | 0.118644 | 0 | 0 | 0 | 0 | 0 | 1 | 0.428571 | false | 0.285714 | 0 | 0 | 0.571429 | 0.142857 | 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 |
4ee744a4296552506d7c85593bc239640f00db0b | 37 | py | Python | src/modules/index/controller.py | RemLampa/emotion-server | 9e881718d8949068f4bb32d5baa748c19043e2cb | [
"MIT"
] | null | null | null | src/modules/index/controller.py | RemLampa/emotion-server | 9e881718d8949068f4bb32d5baa748c19043e2cb | [
"MIT"
] | null | null | null | src/modules/index/controller.py | RemLampa/emotion-server | 9e881718d8949068f4bb32d5baa748c19043e2cb | [
"MIT"
] | null | null | null | response = {'index': 'Hello World!'}
| 18.5 | 36 | 0.621622 | 4 | 37 | 5.75 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.135135 | 37 | 1 | 37 | 37 | 0.71875 | 0 | 0 | 0 | 0 | 0 | 0.459459 | 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 |
4eff9333827648c6428aeae6707a96a283ec040b | 1,333 | py | Python | rippl/bills/migrations/0002_auto_20170109_2142.py | gnmerritt/dailyrippl | 9a0f9615ba597a475dbd6305b589827cb2d97b03 | [
"MIT"
] | 6 | 2016-12-03T20:30:43.000Z | 2017-01-10T01:50:09.000Z | rippl/bills/migrations/0002_auto_20170109_2142.py | gnmerritt/dailyrippl | 9a0f9615ba597a475dbd6305b589827cb2d97b03 | [
"MIT"
] | 24 | 2016-11-30T02:31:13.000Z | 2020-02-25T22:47:27.000Z | rippl/bills/migrations/0002_auto_20170109_2142.py | gnmerritt/dailyrippl | 9a0f9615ba597a475dbd6305b589827cb2d97b03 | [
"MIT"
] | 1 | 2016-12-25T21:42:31.000Z | 2016-12-25T21:42:31.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-09 21:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bills', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='bill',
name='chamber',
field=models.CharField(choices=[('S', 'Senate'), ('H', 'House')], max_length=3, null=True),
),
migrations.AlterField(
model_name='bill',
name='official_title',
field=models.TextField(default=''),
),
migrations.AlterField(
model_name='bill',
name='popular_title',
field=models.CharField(default='', max_length=127),
),
migrations.AlterField(
model_name='bill',
name='summary',
field=models.TextField(default=''),
),
migrations.AlterField(
model_name='bill',
name='sunlight_id',
field=models.CharField(default='', max_length=63),
),
migrations.AlterField(
model_name='bill',
name='url',
field=models.CharField(default='', help_text='Permalink with more info', max_length=127),
),
]
| 28.978261 | 103 | 0.549137 | 128 | 1,333 | 5.5625 | 0.5 | 0.168539 | 0.210674 | 0.244382 | 0.488764 | 0.488764 | 0.179775 | 0.179775 | 0.179775 | 0.179775 | 0 | 0.032751 | 0.312828 | 1,333 | 45 | 104 | 29.622222 | 0.744541 | 0.051013 | 0 | 0.526316 | 1 | 0 | 0.105388 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.052632 | 0 | 0.131579 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f613a6a8024559c755ac8ea22e39cbe8630262ec | 588 | py | Python | asendia_us/asendia_us_lib/shipping_rate_request.py | Purplship/purplship-carriers | dcd044320b86e9af5fe3ef15c36ebf7828b2851b | [
"MIT"
] | 2 | 2021-04-12T22:40:28.000Z | 2021-04-21T18:28:31.000Z | asendia_us/asendia_us_lib/shipping_rate_request.py | Purplship/purplship-carriers | dcd044320b86e9af5fe3ef15c36ebf7828b2851b | [
"MIT"
] | 2 | 2021-01-29T07:14:31.000Z | 2021-02-18T18:29:23.000Z | asendia_us/asendia_us_lib/shipping_rate_request.py | Purplship/purplship-carriers | dcd044320b86e9af5fe3ef15c36ebf7828b2851b | [
"MIT"
] | 3 | 2020-09-09T17:04:46.000Z | 2021-03-05T00:32:32.000Z | from attr import s
from typing import Optional
@s(auto_attribs=True)
class ShippingRateRequest:
accountNumber: Optional[str] = None
subAccountNumber: Optional[str] = None
processingLocation: Optional[str] = None
recipientPostalCode: Optional[str] = None
recipientCountryCode: Optional[str] = None
totalPackageWeight: Optional[float] = None
weightUnit: Optional[str] = None
dimLength: Optional[float] = None
dimWidth: Optional[float] = None
dimHeight: Optional[float] = None
dimUnit: Optional[str] = None
productCode: Optional[str] = None
| 30.947368 | 46 | 0.72449 | 62 | 588 | 6.854839 | 0.419355 | 0.207059 | 0.282353 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.185374 | 588 | 18 | 47 | 32.666667 | 0.887265 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.125 | 0 | 0.9375 | 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 |
f61e29c1e80f540d580ccd4734dee6aedfb8a840 | 228 | py | Python | apps/verifications/urls.py | rui1106/LemonShop | 282e07358492a0e5912e508858ccb9c9cde63503 | [
"CC0-1.0"
] | null | null | null | apps/verifications/urls.py | rui1106/LemonShop | 282e07358492a0e5912e508858ccb9c9cde63503 | [
"CC0-1.0"
] | null | null | null | apps/verifications/urls.py | rui1106/LemonShop | 282e07358492a0e5912e508858ccb9c9cde63503 | [
"CC0-1.0"
] | null | null | null | from django.urls import path
from apps.verifications.views import ImageCodeView, SmsCodeView
urlpatterns = [
path('image_codes/<uuid>/', ImageCodeView.as_view()),
path('sms_codes/<mobile>/', SmsCodeView.as_view()),
]
| 22.8 | 63 | 0.732456 | 27 | 228 | 6.037037 | 0.666667 | 0.07362 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.122807 | 228 | 9 | 64 | 25.333333 | 0.815 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 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 |
f620ae7ca79c18d6e2a4826df4a795c27dda8d26 | 768 | py | Python | arucoDetection/src/svgfig/svgfig/interactive.py | LavaHawk0123/Artmis-Drone | b78dcbb28ecdce4d82fc4addb60367e4cc266349 | [
"MIT"
] | null | null | null | arucoDetection/src/svgfig/svgfig/interactive.py | LavaHawk0123/Artmis-Drone | b78dcbb28ecdce4d82fc4addb60367e4cc266349 | [
"MIT"
] | null | null | null | arucoDetection/src/svgfig/svgfig/interactive.py | LavaHawk0123/Artmis-Drone | b78dcbb28ecdce4d82fc4addb60367e4cc266349 | [
"MIT"
] | null | null | null | import curve, defaults, glyphs, pathdata, plot, svg, trans
# Only bring into the namespace the functions and classes that the user will need
# This distinguishes user interface from internal functions
# (Though the user can still access them, it intentionally requires more typing)
# Internal class members are preceeded by an underscore
from defaults import BBox
from svg import SVG, template, load, load_stream, rgb, randomid, shortcut
from glyphs import latex
from trans import clone, tonumber, transform, evaluate, Delay, Freeze, Pin, window, rotation, transformation_angle, transformation_jacobian
from pathdata import poly, bezier, velocity, foreback, smooth
from curve import Curve, format_number, unicode_number, ticks, logticks
from plot import Fig, Canvas
| 51.2 | 139 | 0.809896 | 107 | 768 | 5.766355 | 0.691589 | 0.035656 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.140625 | 768 | 14 | 140 | 54.857143 | 0.934848 | 0.351563 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
f6247a9b86cbc94ed455caa8389e21b176422390 | 1,859 | py | Python | Longest Palindromic Substring/main.py | PromasterGuru/Leetcode-Solutions | 46a74369f78dbd89e664a4460c25c190bb5f4dbc | [
"MIT"
] | null | null | null | Longest Palindromic Substring/main.py | PromasterGuru/Leetcode-Solutions | 46a74369f78dbd89e664a4460c25c190bb5f4dbc | [
"MIT"
] | null | null | null | Longest Palindromic Substring/main.py | PromasterGuru/Leetcode-Solutions | 46a74369f78dbd89e664a4460c25c190bb5f4dbc | [
"MIT"
] | null | null | null | class Solution:
def expandFromMiddle(self, s:str, l:int, r:int):
while (l >= 0 and r < len(s) and s[l] == s[r]):
l -= 1
r += 1
return (r - l - 1)
def longestPalindrome(self, s: str) -> str:
if len(s) < 1: return 0
start = 0
end = 0
for i in range(len(s)):
l1 = self.expandFromMiddle(s, i, i)
l2 = self.expandFromMiddle(s, i, i+1)
ls = max(l1,l2)
if ls > end - start:
start = i - ((ls - 1)//2)
end = i + (ls//2)
return s[start: end+1]
if __name__ == "__main__":
sol = Solution()
s = "babab"
s = "cbbd"
# s = 'bb'
# s = "babc"
# s = "aca"
# s = "defggbac"
# s = 'a'
s = "babad"
# s = "ccc"
s = "abb"
# s = "reifadyqgztixemwswtccodfnchcovrmiooffbbijkecuvlvukecutasfxqcqygltrogrdxlrslbnzktlanycgtniprjlospzhhgdrqcwlukbpsrumxguskubokxcmswjnssbkutdhppsdckuckcbwbxpmcmdicfjxaanoxndlfpqwneytatcbyjmimyawevmgirunvmdvxwdjbiqszwhfhjmrpexfwrbzkipxfowcbqjckaotmmgkrbjvhihgwuszdrdiijkgjoljjdubcbowvxslctleblfmdzmvdkqdxtiylabrwaccikkpnpsgcotxoggdydqnuogmxttcycjorzrtwtcchxrbbknfmxnonbhgbjjypqhbftceduxgrnaswtbytrhuiqnxkivevhprcvhggugrmmxolvfzwadlnzdwbtqbaveoongezoymdrhywxcxvggsewsxckucmncbrljskgsgtehortuvbtrsfisyewchxlmxqccoplhlzwutoqoctgfnrzhqctxaqacmirrqdwsbdpqttmyrmxxawgtjzqjgffqwlxqxwxrkgtzqkgdulbxmfcvxcwoswystiyittdjaqvaijwscqobqlhskhvoktksvmguzfankdigqlegrxxqpoitdtykfltohnzrcgmlnhddcfmawiriiiblwrttveedkxzzagdzpwvriuctvtrvdpqzcdnrkgcnpwjlraaaaskgguxzljktqvzzmruqqslutiipladbcxdwxhmvevsjrdkhdpxcyjkidkoznuagshnvccnkyeflpyjzlcbmhbytxnfzcrnmkyknbmtzwtaceajmnuyjblmdlbjdjxctvqcoqkbaszvrqvjgzdqpvmucerumskjrwhywjkwgligkectzboqbanrsvynxscpxqxtqhthdytfvhzjdcxgckvgfbldsfzxqdozxicrwqyprgnadfxsionkzzegmeynye"
print(sol.longestPalindrome(s))
| 53.114286 | 1,002 | 0.727273 | 119 | 1,859 | 11.294118 | 0.369748 | 0.008929 | 0.011905 | 0.032738 | 0.034226 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011379 | 0.196342 | 1,859 | 34 | 1,003 | 54.676471 | 0.88822 | 0.569661 | 0 | 0 | 0 | 0 | 0.031566 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0.08 | false | 0 | 0 | 0 | 0.2 | 0.04 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f67a7e72ebf56cedf4000f2075f26246171cab8d | 303 | py | Python | ok_cart/services/cart_group.py | LowerDeez/ok-cart | d483e0eecc228e72138efc08cab95291be64a8bb | [
"MIT"
] | 3 | 2021-05-07T06:20:41.000Z | 2021-10-20T06:15:30.000Z | ok_cart/services/cart_group.py | LowerDeez/ok-cart | d483e0eecc228e72138efc08cab95291be64a8bb | [
"MIT"
] | null | null | null | ok_cart/services/cart_group.py | LowerDeez/ok-cart | d483e0eecc228e72138efc08cab95291be64a8bb | [
"MIT"
] | null | null | null | from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ..models import CartGroup
__all__ = (
'delete_cart_group',
)
def delete_cart_group(*, cart_group: 'CartGroup'):
if cart_group.base:
cart_group.base.delete()
cart_group.relations.all().delete()
cart_group.delete()
| 16.833333 | 50 | 0.69967 | 39 | 303 | 5.051282 | 0.384615 | 0.319797 | 0.304569 | 0.182741 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.191419 | 303 | 17 | 51 | 17.823529 | 0.804082 | 0 | 0 | 0 | 0 | 0 | 0.085809 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0.181818 | 0 | 0.272727 | 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 |
9c890913ae4243c20c9f20a76072c4861cc2a19e | 233 | py | Python | test_pkg.py | rtmigo/neatest_py | f5c5339bb2ab62fbc7e5bacc34ed308789b2dbde | [
"MIT"
] | 3 | 2021-05-16T01:15:17.000Z | 2022-02-09T12:00:29.000Z | test_pkg.py | rtmigo/neatest_py | f5c5339bb2ab62fbc7e5bacc34ed308789b2dbde | [
"MIT"
] | null | null | null | test_pkg.py | rtmigo/neatest_py | f5c5339bb2ab62fbc7e5bacc34ed308789b2dbde | [
"MIT"
] | null | null | null | from chkpkg import Package
if __name__ == "__main__":
with Package() as pkg:
pkg.run_python_code('import neatest; neatest.print_version()')
pkg.run_shell_code('neatest --version')
print("\nPackage is OK!")
| 23.3 | 70 | 0.669528 | 30 | 233 | 4.766667 | 0.666667 | 0.083916 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.201717 | 233 | 9 | 71 | 25.888889 | 0.768817 | 0 | 0 | 0 | 0 | 0 | 0.344828 | 0.099138 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 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 |
9c98c7f9a01165391e4d35cdc902d93191bb7e53 | 141 | py | Python | python3.6/module/argv.py | MisterZhouZhou/python3demo | da0b6771cc12e8e1066a115c3f72a90c100108ac | [
"Apache-2.0"
] | 3 | 2019-03-04T08:39:57.000Z | 2019-12-06T08:29:47.000Z | python3.6/module/argv.py | MisterZhouZhou/python3demo | da0b6771cc12e8e1066a115c3f72a90c100108ac | [
"Apache-2.0"
] | null | null | null | python3.6/module/argv.py | MisterZhouZhou/python3demo | da0b6771cc12e8e1066a115c3f72a90c100108ac | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python3
# 文件名: using_sys.py
import sys
print('命令行参数如下:')
for i in sys.argv:
print(i)
print('\n\nPython 路径为: ',sys.path, '\n') | 17.625 | 40 | 0.64539 | 25 | 141 | 3.6 | 0.72 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008264 | 0.141844 | 141 | 8 | 40 | 17.625 | 0.735537 | 0.248227 | 0 | 0 | 0 | 0 | 0.247619 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0.6 | 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 |
9cbd29739e6cca7d4bee7e4b6217d054d4454510 | 447 | py | Python | mediaman/core/index/abstract.py | MattCCS/MediaMan | 388c0d16da437b0ede4f0903a01e41dc8e927ae6 | [
"BSD-3-Clause-Clear"
] | 1 | 2019-05-06T19:51:08.000Z | 2019-05-06T19:51:08.000Z | mediaman/core/index/abstract.py | MattCCS/MediaMan | 388c0d16da437b0ede4f0903a01e41dc8e927ae6 | [
"BSD-3-Clause-Clear"
] | 1 | 2021-02-08T20:22:34.000Z | 2021-02-08T20:22:34.000Z | mediaman/core/index/abstract.py | MattCCS/MediaMan | 388c0d16da437b0ede4f0903a01e41dc8e927ae6 | [
"BSD-3-Clause-Clear"
] | null | null | null |
from mediaman.core.clients.abstract import abstract
class AbstractIndex(abstract.AbstractClient):
def __init__(self, service):
self.service = service
def name(self):
return self.service.__class__.__name__
def nickname(self):
return self.service.nickname()
def __repr__(self):
return f"{self.__class__.__name__}({repr(self.service)})"
def has(self, file_id):
raise RuntimeError()
| 21.285714 | 65 | 0.675615 | 51 | 447 | 5.431373 | 0.45098 | 0.198556 | 0.101083 | 0.151625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.217002 | 447 | 20 | 66 | 22.35 | 0.791429 | 0 | 0 | 0 | 0 | 0 | 0.105381 | 0.105381 | 0 | 0 | 0 | 0 | 0 | 1 | 0.416667 | false | 0 | 0.083333 | 0.25 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
9cc218c7fc02a4dab8e2511a3e8fca9468d10ccb | 28 | py | Python | portfolio/Python/scrapy/americanrv/__init__.py | 0--key/lib | ba7a85dda2b208adc290508ca617bdc55a5ded22 | [
"Apache-2.0"
] | null | null | null | portfolio/Python/scrapy/americanrv/__init__.py | 0--key/lib | ba7a85dda2b208adc290508ca617bdc55a5ded22 | [
"Apache-2.0"
] | null | null | null | portfolio/Python/scrapy/americanrv/__init__.py | 0--key/lib | ba7a85dda2b208adc290508ca617bdc55a5ded22 | [
"Apache-2.0"
] | 5 | 2016-03-22T07:40:46.000Z | 2021-05-30T16:12:21.000Z | ACCOUNT_NAME = 'American RV' | 28 | 28 | 0.785714 | 4 | 28 | 5.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.107143 | 28 | 1 | 28 | 28 | 0.84 | 0 | 0 | 0 | 0 | 0 | 0.37931 | 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 |
9cc9417422f81e0be06683c3b8079c4192d0feb7 | 210 | py | Python | src/NRInsightsApi/__init__.py | vikramnr/newrelic-insights-api | ef286eb6cc8fe27e9713c6fa5da5e623f8371f63 | [
"MIT"
] | null | null | null | src/NRInsightsApi/__init__.py | vikramnr/newrelic-insights-api | ef286eb6cc8fe27e9713c6fa5da5e623f8371f63 | [
"MIT"
] | null | null | null | src/NRInsightsApi/__init__.py | vikramnr/newrelic-insights-api | ef286eb6cc8fe27e9713c6fa5da5e623f8371f63 | [
"MIT"
] | null | null | null | from .insert_data import insert_data
from .get_data import get_data
# if somebody does "from somepackage import *", this is what they will
# be able to access:
__all__ = [
'insert_data',
'get_data',
]
| 21 | 70 | 0.719048 | 32 | 210 | 4.40625 | 0.59375 | 0.212766 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.195238 | 210 | 9 | 71 | 23.333333 | 0.83432 | 0.414286 | 0 | 0 | 0 | 0 | 0.158333 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
9ccae0495fce471b07a45a219afe8b07e455d757 | 167 | py | Python | update_ec2_dns_function/update_ec2_dns/aws.py | vladvasiliu/UpdateEC2DNS | 63b76f138605a786e0b40295866f7cf13977fb3d | [
"BSD-3-Clause"
] | null | null | null | update_ec2_dns_function/update_ec2_dns/aws.py | vladvasiliu/UpdateEC2DNS | 63b76f138605a786e0b40295866f7cf13977fb3d | [
"BSD-3-Clause"
] | null | null | null | update_ec2_dns_function/update_ec2_dns/aws.py | vladvasiliu/UpdateEC2DNS | 63b76f138605a786e0b40295866f7cf13977fb3d | [
"BSD-3-Clause"
] | null | null | null | import boto3
def get_ec2_public_ip(instance_id: str):
ec2 = boto3.resource("ec2")
instance = ec2.Instance(instance_id)
return instance.public_ip_address
| 20.875 | 40 | 0.748503 | 24 | 167 | 4.916667 | 0.541667 | 0.135593 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.042857 | 0.161677 | 167 | 7 | 41 | 23.857143 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0.017964 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.6 | 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 |
9ccb9ce27a2c12a506deb5eeffe74f252eda3b95 | 2,298 | py | Python | customer_sequence/models/res_partner.py | Yousif-Mobark/odoo11_cutom | 35a09266a1d4d74569316886019c11ce41e9216b | [
"Apache-2.0"
] | null | null | null | customer_sequence/models/res_partner.py | Yousif-Mobark/odoo11_cutom | 35a09266a1d4d74569316886019c11ce41e9216b | [
"Apache-2.0"
] | null | null | null | customer_sequence/models/res_partner.py | Yousif-Mobark/odoo11_cutom | 35a09266a1d4d74569316886019c11ce41e9216b | [
"Apache-2.0"
] | 1 | 2020-04-18T02:42:54.000Z | 2020-04-18T02:42:54.000Z | # -*- coding: utf-8 -*-
from odoo import models, fields, api
class ResPartner(models.Model):
_inherit = 'res.partner'
unique_id = fields.Char(string='Unique Id', help="The Unique Sequence no", readonly=True, default='/')
@api.model
def create(self, values):
res = super(ResPartner, self).create(values)
company_seq = self.env['res.users'].browse(self._uid).company_id
if res.customer and res.unique_id == '/':
if company_seq.next_code:
res.unique_id = company_seq.next_code
res.name = '[' + str(company_seq.next_code) + ']' + str(res.name)
company_seq.write({'next_code': company_seq.next_code + 1})
else:
res.unique_id = company_seq.customer_code
res.name = '[' + str(company_seq.customer_code) + ']' + str(res.name)
company_seq.write({'next_code': company_seq.customer_code + 1})
if res.supplier == True and res.unique_id == '/':
if company_seq.supp_code < 10:
res.unique_id = '000' + str(company_seq.supp_code)
res.name = '[' + '000' + str(company_seq.supp_code) + ']' + str(res.name)
company_seq.write({'supp_code': company_seq.supp_code + 1})
elif company_seq.supp_code < 100:
res.unique_id = '00' + str(company_seq.supp_code)
res.name = '[' + '00' + str(company_seq.supp_code) + ']' + str(res.name)
company_seq.write({'supp_code': company_seq.supp_code + 1})
elif company_seq.supp_code < 1000:
res.unique_id = '0' + str(company_seq.supp_code)
res.name = '[' + '0' + str(company_seq.supp_code) + ']' + str(res.name)
company_seq.write({'supp_code': company_seq.supp_code + 1})
elif company_seq.supp_code > 1000:
res.unique_id = company_seq.supp_code
res.name = '[' + str(company_seq.supp_code) + ']' + str(res.name)
company_seq.write({'supp_code': company_seq.supp_code + 1})
else:
res.unique_id = company_seq.supp_code
res.name = '[' + '0001' + ']' + str(res.name)
company_seq.write({'supp_code': 2})
return res
| 49.956522 | 106 | 0.563534 | 292 | 2,298 | 4.174658 | 0.202055 | 0.26251 | 0.195242 | 0.251025 | 0.688269 | 0.661198 | 0.611977 | 0.50041 | 0.445447 | 0.395406 | 0 | 0.022811 | 0.294169 | 2,298 | 45 | 107 | 51.066667 | 0.72873 | 0.009138 | 0 | 0.205128 | 0 | 0 | 0.064615 | 0 | 0.102564 | 0 | 0 | 0 | 0 | 1 | 0.025641 | false | 0 | 0.025641 | 0 | 0.153846 | 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 |
9cd94a580e75810ef128f72f6fc461b4adc6ee62 | 104 | py | Python | src/webpy1/src/fetch/fet_global_vars.py | ptphp/PyLib | 07ac99cf2deb725475f5771b123b9ea1375f5e65 | [
"Apache-2.0"
] | 1 | 2020-02-17T08:18:29.000Z | 2020-02-17T08:18:29.000Z | src/webpy1/src/fetch/fet_global_vars.py | ptphp/PyLib | 07ac99cf2deb725475f5771b123b9ea1375f5e65 | [
"Apache-2.0"
] | null | null | null | src/webpy1/src/fetch/fet_global_vars.py | ptphp/PyLib | 07ac99cf2deb725475f5771b123b9ea1375f5e65 | [
"Apache-2.0"
] | null | null | null | #coding=UTF-8
'''
Created on 2011-7-7
@author: Administrator
'''
import Queue
fetch_quere=Queue.Queue() | 13 | 25 | 0.730769 | 16 | 104 | 4.6875 | 0.8125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.075269 | 0.105769 | 104 | 8 | 25 | 13 | 0.731183 | 0.538462 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
9cffc75ee41096072f0ecc52248c93678ad45ee4 | 479 | py | Python | core-python-classes-and-oo/multiple_inheritance_and_method_resolution_order/method_resolution_order/main.py | hassonor/core-python | 92672aa72c1474061df5247a2dd4dfd9fab1642a | [
"MIT"
] | 1 | 2022-03-09T20:58:33.000Z | 2022-03-09T20:58:33.000Z | core-python-classes-and-oo/multiple_inheritance_and_method_resolution_order/method_resolution_order/main.py | hassonor/core-python | 92672aa72c1474061df5247a2dd4dfd9fab1642a | [
"MIT"
] | null | null | null | core-python-classes-and-oo/multiple_inheritance_and_method_resolution_order/method_resolution_order/main.py | hassonor/core-python | 92672aa72c1474061df5247a2dd4dfd9fab1642a | [
"MIT"
] | null | null | null | from simple_list import *
from diamond import *
print(SortedIntList.__mro__) # The Method Resolution Order for a class is stored on __mro__
print(D.__mro__)
"""
(<class 'simple_list.SortedIntList'>, <class 'simple_list.IntList'>, <class 'simple_list.SortedList'>,
<class 'simple_list.SimpleList'>, <class 'object'>)
(<class 'diamond.D'>, <class 'diamond.B'>, <class 'diamond.C'>, <class 'diamond.A'>, <class 'object'>)
"""
d = D()
print(d.func()) # -> Will Print 'B.func'
| 29.9375 | 103 | 0.688935 | 65 | 479 | 4.815385 | 0.415385 | 0.159744 | 0.191693 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125261 | 479 | 15 | 104 | 31.933333 | 0.747017 | 0.173278 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.5 | 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 | 0 | 1 | 0 | 3 |
1442671f90439d2dd5e96fdc15ac84ea6f49f5c4 | 295 | py | Python | fractal.py | catzilla-007/fractal-overload | 5d173124aaefdb84539248e22275fd2ee39522d8 | [
"MIT"
] | null | null | null | fractal.py | catzilla-007/fractal-overload | 5d173124aaefdb84539248e22275fd2ee39522d8 | [
"MIT"
] | null | null | null | fractal.py | catzilla-007/fractal-overload | 5d173124aaefdb84539248e22275fd2ee39522d8 | [
"MIT"
] | null | null | null | from abc import ABC, abstractmethod
from image import Image
class Fractal(ABC):
def __init__(self, image: Image):
self._image = image
@abstractmethod
def _fractalize(self, point_a, point_b, level):
pass
@abstractmethod
def draw(self, level):
pass
| 18.4375 | 51 | 0.657627 | 36 | 295 | 5.166667 | 0.472222 | 0.096774 | 0.150538 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.264407 | 295 | 15 | 52 | 19.666667 | 0.857143 | 0 | 0 | 0.363636 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0.181818 | 0.181818 | 0 | 0.545455 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
1447ff5689e316b188c6a2a92ad90f5c58d95882 | 1,602 | py | Python | earth_enterprise/src/server/wsgi/search/common/exceptions.py | ezeeyahoo/earthenterprise | b6cac9e6228946f2f17d1edb75e118aeb3e8e8c9 | [
"Apache-2.0"
] | 2,661 | 2017-03-20T22:12:50.000Z | 2022-03-30T09:43:19.000Z | earth_enterprise/src/server/wsgi/search/common/exceptions.py | ezeeyahoo/earthenterprise | b6cac9e6228946f2f17d1edb75e118aeb3e8e8c9 | [
"Apache-2.0"
] | 1,531 | 2017-03-24T17:20:32.000Z | 2022-03-16T18:11:14.000Z | earth_enterprise/src/server/wsgi/search/common/exceptions.py | ezeeyahoo/earthenterprise | b6cac9e6228946f2f17d1edb75e118aeb3e8e8c9 | [
"Apache-2.0"
] | 990 | 2017-03-24T11:54:28.000Z | 2022-03-22T11:51:47.000Z | #!/usr/bin/env python2.7
#
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Module for all exception's which search services may raise."""
from search.common import utils
class Error(Exception):
"""Generic error."""
def ToString(self, error_prefix):
"""Builds error message string escaping it for HTML.
Args:
error_prefix: an error prefix.
Returns:
HTML escaped error message.
"""
if error_prefix:
return utils.HtmlEscape(
"{0}: {1}".format(error_prefix, str("\n".join(self.args))))
else:
return utils.HtmlEscape("Error: {0}".format(str("\n".join(self.args))))
def __str__(self):
return self.ToString("Error")
class BadQueryException(Error):
"""BadQueryException error."""
def __str__(self):
return self.ToString("BadQueryException")
# Places search service pool exception.
class PoolConnectionException(Error):
"""PoolConnectionException error."""
def __str__(self):
return self.ToString("PoolConnectionException")
def main():
pass
if __name__ == "__main__":
main()
| 25.03125 | 77 | 0.704744 | 210 | 1,602 | 5.261905 | 0.538095 | 0.054299 | 0.027149 | 0.043439 | 0.114027 | 0.085068 | 0.059729 | 0 | 0 | 0 | 0 | 0.009924 | 0.182272 | 1,602 | 63 | 78 | 25.428571 | 0.833588 | 0.543695 | 0 | 0.15 | 0 | 0 | 0.112108 | 0.03438 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.05 | 0.05 | 0.15 | 0.7 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
145308d356d0c4d7a3162679c7a2f20134a85bca | 1,327 | py | Python | redash/settings/dynamic_settings.py | feeltheajf/redash | 05c22337822661e56f53a20e29b7797270eaeda9 | [
"BSD-2-Clause"
] | 2 | 2019-11-11T17:00:14.000Z | 2020-05-10T16:27:17.000Z | redash/settings/dynamic_settings.py | feeltheajf/redash | 05c22337822661e56f53a20e29b7797270eaeda9 | [
"BSD-2-Clause"
] | 2 | 2021-02-01T08:02:42.000Z | 2021-03-03T09:00:57.000Z | redash/settings/dynamic_settings.py | feeltheajf/redash | 05c22337822661e56f53a20e29b7797270eaeda9 | [
"BSD-2-Clause"
] | null | null | null | # Replace this method with your own implementation in case you want to limit the time limit on certain queries or users.
def query_time_limit(is_scheduled, user_id, org_id):
from redash import settings
if is_scheduled:
return settings.SCHEDULED_QUERY_TIME_LIMIT
else:
return settings.ADHOC_QUERY_TIME_LIMIT
def periodic_jobs():
"""Schedule any custom periodic jobs here. For example:
from time import timedelta
from somewhere import some_job, some_other_job
return [
{"func": some_job, "interval": timedelta(hours=1)},
{"func": some_other_job, "interval": timedelta(days=1)}
]
"""
pass
# This provides the ability to override the way we store QueryResult's data column.
# Reference implementation: redash.models.DBPersistence
QueryResultPersistence = None
def ssh_tunnel_auth():
"""
To enable data source connections via SSH tunnels, provide your SSH authentication
pkey here. Return a string pointing at your **private** key's path (which will be used
to extract the public key), or a `paramiko.pkey.PKey` instance holding your **public** key.
"""
return {
# 'ssh_pkey': 'path_to_private_key', # or instance of `paramiko.pkey.PKey`
# 'ssh_private_key_password': 'optional_passphrase_of_private_key',
} | 34.025641 | 120 | 0.714393 | 181 | 1,327 | 5.060773 | 0.552486 | 0.039301 | 0.045852 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001896 | 0.204974 | 1,327 | 39 | 121 | 34.025641 | 0.866351 | 0.686511 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.083333 | 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 |
1470056f42d72ad7f14f2a1c2d326b964403a060 | 199 | py | Python | twitter/urls.py | vladcalin/konnector | eab327c3b4e9e519d770dd42b516a420f50a4571 | [
"MIT"
] | null | null | null | twitter/urls.py | vladcalin/konnector | eab327c3b4e9e519d770dd42b516a420f50a4571 | [
"MIT"
] | null | null | null | twitter/urls.py | vladcalin/konnector | eab327c3b4e9e519d770dd42b516a420f50a4571 | [
"MIT"
] | 1 | 2020-03-26T12:55:54.000Z | 2020-03-26T12:55:54.000Z | from django.urls import path
from twitter.views import CreateTwitterIntegrationView
urlpatterns = [
path('create/', CreateTwitterIntegrationView.as_view(), name='create_twitter_integration')
]
| 24.875 | 94 | 0.80402 | 20 | 199 | 7.85 | 0.7 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.105528 | 199 | 7 | 95 | 28.428571 | 0.882022 | 0 | 0 | 0 | 0 | 0 | 0.165829 | 0.130653 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
1473668a6fa734c66fecfdbd34498071dbbd7cf2 | 187 | py | Python | Escape_Room.py | HarryGN/Canadian-Computing-Contest- | 0570e503c4ed7cbc91a1af9203bac84c1d3ecfca | [
"MIT"
] | null | null | null | Escape_Room.py | HarryGN/Canadian-Computing-Contest- | 0570e503c4ed7cbc91a1af9203bac84c1d3ecfca | [
"MIT"
] | null | null | null | Escape_Room.py | HarryGN/Canadian-Computing-Contest- | 0570e503c4ed7cbc91a1af9203bac84c1d3ecfca | [
"MIT"
] | null | null | null | M = input()
N = input()
input_list = []
for i in range(int(M)):
input_list.append(input().split())
if input_list ==
[["3", "10", "8", "14"],
["1", "11", "12", "12"],
[6 2 3 9]]
| 15.583333 | 38 | 0.491979 | 32 | 187 | 2.78125 | 0.6875 | 0.303371 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.114865 | 0.208556 | 187 | 11 | 39 | 17 | 0.486486 | 0 | 0 | 0 | 0 | 0 | 0.07027 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
14891927db12e5a3cc09c93b74024569f2598aef | 343 | py | Python | geesedb/interpreter/translate.py | informagi/GeeseDB | b502830cafbcba8676e7e779d13d5bc14ba842f9 | [
"MIT"
] | 12 | 2021-07-05T12:33:20.000Z | 2021-10-11T20:44:12.000Z | geesedb/interpreter/translate.py | informagi/GeeseDB | b502830cafbcba8676e7e779d13d5bc14ba842f9 | [
"MIT"
] | 7 | 2021-07-28T20:40:36.000Z | 2021-10-12T12:31:51.000Z | geesedb/interpreter/translate.py | informagi/GeeseDB | b502830cafbcba8676e7e779d13d5bc14ba842f9 | [
"MIT"
] | null | null | null | from .parser import Parser
# This class was used in the paper for translating, all the translating logic is now implemented in Parser
# So this class is a wrapper for that one.
class Translator:
def __init__(self, database):
self.parser = Parser(database)
def translate(self, query):
return self.parser.parse(query)
| 28.583333 | 106 | 0.723032 | 50 | 343 | 4.88 | 0.62 | 0.07377 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.212828 | 343 | 11 | 107 | 31.181818 | 0.903704 | 0.422741 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.166667 | 0.166667 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
1491b82df80e962af699cd761ae9f3fa8419077a | 516 | py | Python | Section17_Heranca_e_Polimorfismo/super.py | thiagofreitascarneiro/Python_OOP | 037621e334ec7159fe0da937db8418eba6321bdd | [
"MIT"
] | null | null | null | Section17_Heranca_e_Polimorfismo/super.py | thiagofreitascarneiro/Python_OOP | 037621e334ec7159fe0da937db8418eba6321bdd | [
"MIT"
] | null | null | null | Section17_Heranca_e_Polimorfismo/super.py | thiagofreitascarneiro/Python_OOP | 037621e334ec7159fe0da937db8418eba6321bdd | [
"MIT"
] | null | null | null | '''
POO - O método super()
O método super() se refere á super classe.
'''
class Animal:
def __init__(self, nome, especie):
self.__nome = nome
self.__especie = especie
def faz_som(self, som):
print(f'O {self.__nome} fala {som}')
class Gato(Animal):
def __init__(self, nome, especie, raca):
#Animal.__init__(self, nome, especie)
super().__init__(nome, especie)
self.__raca = raca
felix = Gato('Felix', 'Felino', 'Angorá')
felix.faz_som('miau')
| 17.2 | 45 | 0.606589 | 67 | 516 | 4.283582 | 0.38806 | 0.139373 | 0.125436 | 0.198606 | 0.195122 | 0.195122 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | 516 | 29 | 46 | 17.793103 | 0.741602 | 0.199612 | 0 | 0 | 0 | 0 | 0.116625 | 0 | 0 | 0 | 0 | 0.068966 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.416667 | 0.083333 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
14a9dc26d600dca7a97adc0c9d6653657f978df6 | 25 | py | Python | jigsaw/constants.py | autognc/jigsaw | 1eee82bbbccecc9dddd140cfef87b6126fa36af9 | [
"MIT"
] | 3 | 2019-03-13T20:44:22.000Z | 2019-03-27T22:07:41.000Z | jigsaw/constants.py | autognc/jigsaw | 1eee82bbbccecc9dddd140cfef87b6126fa36af9 | [
"MIT"
] | 23 | 2019-03-12T22:38:06.000Z | 2020-04-04T00:59:38.000Z | jigsaw/constants.py | autognc/jigsaw | 1eee82bbbccecc9dddd140cfef87b6126fa36af9 | [
"MIT"
] | null | null | null | METADATA_PREFIX = 'meta_' | 25 | 25 | 0.8 | 3 | 25 | 6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.08 | 25 | 1 | 25 | 25 | 0.782609 | 0 | 0 | 0 | 0 | 0 | 0.192308 | 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 |
14b3e8f2e1df5951ed644a63844817db28ef229c | 1,290 | py | Python | pw32n/sprite_images.py | jjinux/pyweek32-neverending | 718027bcc3e02a5c28afb7f7a37d0a32c0f85f86 | [
"MIT"
] | null | null | null | pw32n/sprite_images.py | jjinux/pyweek32-neverending | 718027bcc3e02a5c28afb7f7a37d0a32c0f85f86 | [
"MIT"
] | null | null | null | pw32n/sprite_images.py | jjinux/pyweek32-neverending | 718027bcc3e02a5c28afb7f7a37d0a32c0f85f86 | [
"MIT"
] | null | null | null | from typing import NamedTuple
class SpriteImage(NamedTuple):
filename: str
width: float
# These are really just image filenames, etc. Hence, they end in IMAGE. The ones that are meant
# to serve as background tiles end in TILE_IMAGE.
PLAYER_IMAGE = SpriteImage(
":resources:images/animated_characters/female_adventurer/femaleAdventurer_idle.png",
width=128,
)
GRASS_TILE_IMAGE = SpriteImage(
":resources:images/topdown_tanks/tileGrass2.png", width=64
)
BOX_CRATE_TILE_IMAGE = SpriteImage(
":resources:images/tiles/boxCrate_double.png", width=128
)
GRASS_SIDE_VIEW_TILE_IMAGE = SpriteImage(
":resources:images/tiles/grassMid.png", width=128
)
ZOMBIE_IMAGE = SpriteImage(
":resources:images/animated_characters/zombie/zombie_idle.png", width=128
)
MALE_PERSON_IMAGE = SpriteImage(
":resources:images/animated_characters/male_person/malePerson_idle.png", width=128
)
FEMALE_PERSON_IMAGE = SpriteImage(
":resources:images/animated_characters/female_person/femalePerson_idle.png",
width=128,
)
MALE_ADVENTURER_IMAGE = SpriteImage(
":resources:images/animated_characters/male_adventurer/maleAdventurer_idle.png",
width=128,
)
ROBOT_IMAGE = SpriteImage(
":resources:images/animated_characters/robot/robot_idle.png", width=128
)
| 25.8 | 95 | 0.775969 | 160 | 1,290 | 6.025 | 0.38125 | 0.149378 | 0.233402 | 0.289419 | 0.496888 | 0.421162 | 0.236515 | 0 | 0 | 0 | 0 | 0.023894 | 0.124031 | 1,290 | 49 | 96 | 26.326531 | 0.829204 | 0.109302 | 0 | 0.088235 | 0 | 0 | 0.473822 | 0.473822 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.029412 | 0 | 0.117647 | 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 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
1ad377aee883cd3addf5b86941c29cafd748d82b | 118 | py | Python | govhack2014/__init__.py | brendam/govhack2014 | fbae78495fac5e8c125895dd62baf34750a67aab | [
"MIT"
] | 2 | 2015-01-28T10:19:35.000Z | 2015-06-16T04:00:32.000Z | govhack2014/__init__.py | makehackvoid/govhack2014 | 82e7a2e7343311d44e2bd7d77a212496aa8054b9 | [
"MIT"
] | null | null | null | govhack2014/__init__.py | makehackvoid/govhack2014 | 82e7a2e7343311d44e2bd7d77a212496aa8054b9 | [
"MIT"
] | null | null | null | from flask import Flask
app = Flask(__name__)
app.config.from_object('settings')
import govhack2014.routes # noqa
| 16.857143 | 34 | 0.771186 | 16 | 118 | 5.375 | 0.6875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.039216 | 0.135593 | 118 | 6 | 35 | 19.666667 | 0.803922 | 0.033898 | 0 | 0 | 0 | 0 | 0.071429 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
1ae183ae13fad3b4f11735f7b5c9959a10aea3e8 | 422 | py | Python | web_project/migrations/0004_auto_20200922_2003.py | miker392/Stock-Watcher | 4c2dbccc8e8abbad3ae16e54e1b7cfd9ed35d345 | [
"MIT"
] | null | null | null | web_project/migrations/0004_auto_20200922_2003.py | miker392/Stock-Watcher | 4c2dbccc8e8abbad3ae16e54e1b7cfd9ed35d345 | [
"MIT"
] | null | null | null | web_project/migrations/0004_auto_20200922_2003.py | miker392/Stock-Watcher | 4c2dbccc8e8abbad3ae16e54e1b7cfd9ed35d345 | [
"MIT"
] | 1 | 2021-11-08T01:38:18.000Z | 2021-11-08T01:38:18.000Z | # Generated by Django 3.1.1 on 2020-09-23 01:03
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('web_project', '0003_stock_change'),
]
operations = [
migrations.RemoveField(
model_name='stock',
name='high',
),
migrations.RemoveField(
model_name='stock',
name='low',
),
]
| 19.181818 | 47 | 0.549763 | 42 | 422 | 5.404762 | 0.690476 | 0.185022 | 0.229075 | 0.264317 | 0.343612 | 0.343612 | 0 | 0 | 0 | 0 | 0 | 0.067616 | 0.334123 | 422 | 21 | 48 | 20.095238 | 0.740214 | 0.106635 | 0 | 0.4 | 1 | 0 | 0.12 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.066667 | 0 | 0.266667 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
1ae748d6e3ca22f37d22eb1084781f8a10d2b27e | 174 | py | Python | apps/ots/ots_util.py | yt7589/iching | 6673da38f4c80e7fd297c86fedc5616aee8ac09b | [
"Apache-2.0"
] | 32 | 2020-04-14T08:32:18.000Z | 2022-02-09T07:05:08.000Z | apps/ots/ots_util.py | trinh-hoang-hiep/iching | e1feae5741c3cbde535d7a275b01d4f0cf9e21ed | [
"Apache-2.0"
] | 1 | 2020-04-08T10:42:15.000Z | 2020-04-15T01:38:03.000Z | apps/ots/ots_util.py | trinh-hoang-hiep/iching | e1feae5741c3cbde535d7a275b01d4f0cf9e21ed | [
"Apache-2.0"
] | 4 | 2020-08-25T03:56:46.000Z | 2021-05-11T05:55:51.000Z | #
class OtsUtil(object):
STEP_THRESHOLD = 408
step = 0
@staticmethod
def log(msg):
if OtsUtil.step >= OtsUtil.STEP_THRESHOLD:
print(msg) | 17.4 | 50 | 0.591954 | 20 | 174 | 5.05 | 0.65 | 0.257426 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.033333 | 0.310345 | 174 | 10 | 51 | 17.4 | 0.808333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0 | 0 | 0.571429 | 0.142857 | 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 | 0 | 1 | 0 | 0 | 3 |
1ae7f26daf57c6f92197e04098c02a617042337d | 139 | py | Python | str21.py | ABHISHEKSUBHASHSWAMI/String-Manipulation | e22efdbe76069e0280cc1acdeeabc4b663ac4f36 | [
"MIT"
] | null | null | null | str21.py | ABHISHEKSUBHASHSWAMI/String-Manipulation | e22efdbe76069e0280cc1acdeeabc4b663ac4f36 | [
"MIT"
] | null | null | null | str21.py | ABHISHEKSUBHASHSWAMI/String-Manipulation | e22efdbe76069e0280cc1acdeeabc4b663ac4f36 | [
"MIT"
] | null | null | null | #Program to Remove Punctuations From a String
string="Wow! What a beautiful nature!"
new_string=string.replace("!","")
print(new_string)
| 19.857143 | 45 | 0.755396 | 20 | 139 | 5.15 | 0.7 | 0.23301 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.115108 | 139 | 6 | 46 | 23.166667 | 0.837398 | 0.316547 | 0 | 0 | 0 | 0 | 0.319149 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 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 |
1af84e32603b9e3aa1cd0ec716942c3a31973315 | 749 | py | Python | molsysmt/tools/file_gro/__init__.py | dprada/molsysmt | 83f150bfe3cfa7603566a0ed4aed79d9b0c97f5d | [
"MIT"
] | null | null | null | molsysmt/tools/file_gro/__init__.py | dprada/molsysmt | 83f150bfe3cfa7603566a0ed4aed79d9b0c97f5d | [
"MIT"
] | null | null | null | molsysmt/tools/file_gro/__init__.py | dprada/molsysmt | 83f150bfe3cfa7603566a0ed4aed79d9b0c97f5d | [
"MIT"
] | null | null | null | from .is_file_gro import is_file_gro
from .to_file_mol2 import to_file_mol2
from .to_molsysmt_MolSys import to_molsysmt_MolSys
from .to_molsysmt_Topology import to_molsysmt_Topology
from .to_molsysmt_Trajectory import to_molsysmt_Trajectory
from .to_parmed_Structure import to_parmed_Structure
from .to_mdanalysis_Universe import to_mdanalysis_Universe
from .to_mdtraj_Topology import to_mdtraj_Topology
from .to_mdtraj_Trajectory import to_mdtraj_Trajectory
from .to_mdtraj_GroTrajectoryFile import to_mdtraj_GroTrajectoryFile
from .to_openmm_Topology import to_openmm_Topology
from .to_openmm_Modeller import to_openmm_Modeller
from .to_openmm_GromacsGroFile import to_openmm_GromacsGroFile
from .to_nglview_NGLWidget import to_nglview_NGLWidget
| 46.8125 | 68 | 0.905207 | 112 | 749 | 5.553571 | 0.196429 | 0.125402 | 0.067524 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00289 | 0.076101 | 749 | 15 | 69 | 49.933333 | 0.895954 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
2100a825b81abf1ae8d76c45a765eb6393aee0f6 | 3,392 | py | Python | codedigger/contest/cron.py | jyothiprakashpanaik/Backend | 9ab1b57436a0a1a6197777c0b36c842e71121d3a | [
"Apache-2.0"
] | 17 | 2020-10-07T22:40:37.000Z | 2022-01-20T07:19:09.000Z | codedigger/contest/cron.py | jyothiprakashpanaik/Backend | 9ab1b57436a0a1a6197777c0b36c842e71121d3a | [
"Apache-2.0"
] | 42 | 2021-06-03T01:58:04.000Z | 2022-01-31T14:49:22.000Z | codedigger/contest/cron.py | jyothiprakashpanaik/Backend | 9ab1b57436a0a1a6197777c0b36c842e71121d3a | [
"Apache-2.0"
] | 25 | 2020-10-06T17:55:19.000Z | 2021-12-09T07:56:50.000Z | # Cron Job -
# Problem Assign -- Contest with isProblem False -- Assign Problem
# Result Assign -- Contest with isResult False
# contest end -- (startTime + duration) <= time.now
#Email
from django.core.mail import send_mail
from codedigger.settings import EMAIL_HOST_USER
## Short Code Contest
# from .utils import login, clean, penalty
# from .models import CodeforcesContest, CodeforcesContestSubmission, CodeforcesContestParticipation
# import requests, random, re
# from codeforces.cron import save_user
# from codeforces.models import user as CodeforcesUser
# from bs4 import BeautifulSoup as bs
# def update_penalty(contest, cookie) :
# contestId = contest.contestId
# groupId = contest.groupId
# page = 0
# prevHandle = None
# while(page < 100):
# page+=1
# url = "https://codeforces.com/group/"+groupId+"/contest/"+str(contestId)+"/standings/page/"+str(page)
# res = requests.get(url , headers = {'Cookie' : cookie})
# soup = bs(res.content,features="html5lib")
# participants = soup.find('table' , {'class' :'standings'}).findAll('tr')
# NProblems = len(participants[0].findAll('th'))-4
# isBreak = False
# isFirst = True
# for participant in participants[1:-1] :
# column = participant.findAll('td')
# user_handle = clean(column[1].find('a').text)
# if isFirst:
# if user_handle == prevHandle:
# isBreak = True
# break
# else :
# prevHandle = user_handle
# isFirst = False
# contest_user,created = CodeforcesUser.objects.get_or_create(handle = user_handle)
# if created :
# url = "https://codeforces.com/api/user.info?handles="+user_handle
# res = requests.get(url)
# if res.status_code == 200:
# data = res.json()
# if data['status'] == 'OK':
# save_user(contest_user , data['result'][0])
# contest_participant,created = CodeforcesContestParticipation.objects.get_or_create(
# contest=contest,
# user=contest_user,
# participantId=participant['participantid'],
# defaults={
# 'isOfficial' : clean(column[0].text) != '',
# 'isVirtual' : column[1].find('sup') != None
# })
# for i in range(NProblems):
# sub = CodeforcesContestSubmission.objects.filter(participant=contest_participant, problemIndex = i)
# newSub = CodeforcesContestSubmission(participant=contest_participant, problemIndex = i)
# if column[4+i].find('span' , {'class' : 'cell-accepted'})!=None and column[4+i]['title'][:3]=='GNU':
# subId = participant.findAll('td')[4+i]['acceptedsubmissionid']
# if sub.exists() and str(sub[0].submissionId) == subId :
# continue
# if sub.exists() :
# sub[0].isSolved = True
# sub[0].submissionId = subId
# sub[0].lang = column[4+i]['title']
# sub[0].penalty = penalty(cookie, contestId, subId, groupId)
# sub[0].save()
# else :
# newSub.isSolved = True
# newSub.submissionId = subId
# newSub.lang = column[4+i]['title']
# newSub.penalty = penalty(cookie, contestId, subId, groupId)
# newSub.save()
# else :
# newSub.isSolved = False
# if not sub.exists() :
# newSub.save()
# if isBreak:
# break
# def update_codeforces_short_code_contests() :
# cookie = login()
# codeforcescontest = CodeforcesContest.objects.filter(Type = "Short Code")
# for contest in codeforcescontest :
# update_penalty(contest, cookie)
| 34.612245 | 106 | 0.661557 | 389 | 3,392 | 5.699229 | 0.347044 | 0.010825 | 0.014434 | 0.017591 | 0.090212 | 0.036987 | 0 | 0 | 0 | 0 | 0 | 0.010953 | 0.192512 | 3,392 | 97 | 107 | 34.969072 | 0.798467 | 0.92158 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
2104a2dcd13d391f2bd978cfa87ed1e77062241b | 20 | py | Python | utils/__init__.py | chapternewscu/tensorflow_visual_attention | 9c297152a8141f0a30c1089f94fad2836f43dbc2 | [
"MIT"
] | 86 | 2016-10-15T13:38:17.000Z | 2021-12-05T15:49:21.000Z | utils/__init__.py | chapternewscu/tensorflow_visual_attention | 9c297152a8141f0a30c1089f94fad2836f43dbc2 | [
"MIT"
] | 7 | 2016-12-06T01:43:09.000Z | 2021-08-11T20:24:17.000Z | utils/__init__.py | chapternewscu/tensorflow_visual_attention | 9c297152a8141f0a30c1089f94fad2836f43dbc2 | [
"MIT"
] | 42 | 2016-12-06T06:53:47.000Z | 2021-12-05T15:49:22.000Z | __author__='gmwang'
| 10 | 19 | 0.8 | 2 | 20 | 6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.05 | 20 | 1 | 20 | 20 | 0.631579 | 0 | 0 | 0 | 0 | 0 | 0.3 | 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 |
210b42a826c5661dad3f58d7f5abf60327f2e465 | 567 | py | Python | iterators_and_generators/exercise/fibonacci_generator.py | ivan-yosifov88/python_oop | 82b210e427cb80dbab3b9a5c3fceab431ee60164 | [
"MIT"
] | 1 | 2021-05-21T20:28:55.000Z | 2021-05-21T20:28:55.000Z | iterators_and_generators/exercise/fibonacci_generator.py | ivan-yosifov88/python_oop | 82b210e427cb80dbab3b9a5c3fceab431ee60164 | [
"MIT"
] | null | null | null | iterators_and_generators/exercise/fibonacci_generator.py | ivan-yosifov88/python_oop | 82b210e427cb80dbab3b9a5c3fceab431ee60164 | [
"MIT"
] | null | null | null | def fibonacci():
number = 0
previous_number = 1
while True:
if number == 0:
yield number
number += previous_number
if number == 1:
yield number
number += previous_number
if number == 2:
yield previous_number
if number > 1:
yield number
cutternt_number = previous_number
previous_number = number
number = cutternt_number + previous_number
generator = fibonacci()
for i in range(5):
print(next(generator))
| 20.25 | 54 | 0.546737 | 58 | 567 | 5.189655 | 0.344828 | 0.325581 | 0.332226 | 0.219269 | 0.581395 | 0.375415 | 0.375415 | 0 | 0 | 0 | 0 | 0.02029 | 0.391534 | 567 | 27 | 55 | 21 | 0.852174 | 0 | 0 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.05 | false | 0 | 0 | 0 | 0.05 | 0.05 | 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 |
2113885ee3025e6e071f27f9e85492f3547d3084 | 185 | py | Python | pelican_flickrtag/__init__.py | streeter/pelican-flickrtag | d93bf38ef040529f5f78c367f8bf365672f31d9b | [
"MIT"
] | 2 | 2015-02-04T21:17:42.000Z | 2020-07-15T11:16:20.000Z | pelican_flickrtag/__init__.py | streeter/pelican-flickrtag | d93bf38ef040529f5f78c367f8bf365672f31d9b | [
"MIT"
] | 5 | 2015-03-02T20:56:08.000Z | 2021-01-21T11:23:42.000Z | pelican_flickrtag/__init__.py | streeter/pelican-flickrtag | d93bf38ef040529f5f78c367f8bf365672f31d9b | [
"MIT"
] | 4 | 2015-02-16T17:48:50.000Z | 2016-08-16T23:35:11.000Z | __title__ = 'pelican-flickrtag'
__version__ = '0.6.0'
__author__ = 'Chris Streeter'
__license__ = 'MIT'
__copyright__ = 'Copyright 2017'
from pelican_flickrtag.plugin import register
| 20.555556 | 45 | 0.772973 | 21 | 185 | 5.809524 | 0.809524 | 0.262295 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.04321 | 0.124324 | 185 | 8 | 46 | 23.125 | 0.709877 | 0 | 0 | 0 | 0 | 0 | 0.286486 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.166667 | 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 |
2114682838adc9142e7c70f14ab7bb91eafeac95 | 516 | py | Python | demo/demo-user-input.py | Duplexes/py_console | 4f1f5a2513bf7b9bff280d4249547634e6587d5c | [
"MIT"
] | 13 | 2021-06-15T02:57:19.000Z | 2021-11-10T08:52:13.000Z | demo/demo-user-input.py | Duplexes/pyconsole | 4f1f5a2513bf7b9bff280d4249547634e6587d5c | [
"MIT"
] | null | null | null | demo/demo-user-input.py | Duplexes/pyconsole | 4f1f5a2513bf7b9bff280d4249547634e6587d5c | [
"MIT"
] | 1 | 2021-09-25T18:31:52.000Z | 2021-09-25T18:31:52.000Z | from pyco import user_input
from pyco.color import Fore, Back, Style
user_input("Plain prompt: ")
user_input(Fore.GREEN + "Prompt in green: ")
user_input(Fore.BRIGHT_RED + "Prompt in bright red, user input in cyan: ", input_color=Fore.CYAN)
user_input(Fore.BLUE + Back.BRIGHT_WHITE + "Prompt in blue on a bright white background, user input in bright magenta with an underline: ", input_color=Fore.BRIGHT_MAGENTA + Style.UNDERLINE)
user_input("This prompt and the following user input has been logged: ", log=True)
| 57.333333 | 190 | 0.775194 | 84 | 516 | 4.630952 | 0.404762 | 0.208226 | 0.100257 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.131783 | 516 | 8 | 191 | 64.5 | 0.868304 | 0 | 0 | 0 | 0 | 0 | 0.434109 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.285714 | 0 | 0.285714 | 0 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2133fd2e88b25ccc7463775a121ac3488d77fab7 | 187 | py | Python | 01-contest-aquecimento/questao-f.py | userddssilva/ESTCMP00216 | 745ae85c31f83033dea021b2ccd3475565d1e201 | [
"MIT"
] | null | null | null | 01-contest-aquecimento/questao-f.py | userddssilva/ESTCMP00216 | 745ae85c31f83033dea021b2ccd3475565d1e201 | [
"MIT"
] | null | null | null | 01-contest-aquecimento/questao-f.py | userddssilva/ESTCMP00216 | 745ae85c31f83033dea021b2ccd3475565d1e201 | [
"MIT"
] | null | null | null | text = input().split(' ')
new_text = ''
for word in text:
if len(word) > 4:
if word[:2] in word[2:]:
word = word[2:]
new_text += ' ' + word
print(new_text[1:]) | 23.375 | 32 | 0.502674 | 29 | 187 | 3.137931 | 0.448276 | 0.230769 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.038168 | 0.299465 | 187 | 8 | 33 | 23.375 | 0.656489 | 0 | 0 | 0 | 0 | 0 | 0.010638 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.125 | 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 |
2146c600ccf65de3ace0428b827d5d6a81be62de | 749 | py | Python | qcloudsdklive/CreateLVBShotRequest.py | f3n9/qcloudcli | b965a4f0e6cdd79c1245c1d0cd2ca9c460a56f19 | [
"Apache-2.0"
] | null | null | null | qcloudsdklive/CreateLVBShotRequest.py | f3n9/qcloudcli | b965a4f0e6cdd79c1245c1d0cd2ca9c460a56f19 | [
"Apache-2.0"
] | null | null | null | qcloudsdklive/CreateLVBShotRequest.py | f3n9/qcloudcli | b965a4f0e6cdd79c1245c1d0cd2ca9c460a56f19 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from qcloudsdkcore.request import Request
class CreateLVBShotRequest(Request):
def __init__(self):
super(CreateLVBShotRequest, self).__init__(
'live', 'qcloudcliV1', 'CreateLVBShot', 'live.api.qcloud.com')
def get_channelId(self):
return self.get_params().get('channelId')
def set_channelId(self, channelId):
self.add_param('channelId', channelId)
def get_endTime(self):
return self.get_params().get('endTime')
def set_endTime(self, endTime):
self.add_param('endTime', endTime)
def get_startTime(self):
return self.get_params().get('startTime')
def set_startTime(self, startTime):
self.add_param('startTime', startTime)
| 26.75 | 74 | 0.666222 | 85 | 749 | 5.635294 | 0.329412 | 0.037578 | 0.087683 | 0.106472 | 0.162839 | 0.162839 | 0 | 0 | 0 | 0 | 0 | 0.003344 | 0.201602 | 749 | 27 | 75 | 27.740741 | 0.797659 | 0.028037 | 0 | 0 | 0 | 0 | 0.133609 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.411765 | false | 0 | 0.058824 | 0.176471 | 0.705882 | 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 |
2148dd33b83da7a75d4cbab31a8c6b9c8cfb4509 | 473 | tac | Python | semantics_and_generate/samples/for4.tac | AHEADer/my_decaf_compiler | 42ba9f140c5fda3cd2b4fdb727745d2cfd39c923 | [
"MIT"
] | 1 | 2018-01-03T03:35:38.000Z | 2018-01-03T03:35:38.000Z | semantics_and_generate/samples/for4.tac | AHEADer/my_decaf_compiler | 42ba9f140c5fda3cd2b4fdb727745d2cfd39c923 | [
"MIT"
] | null | null | null | semantics_and_generate/samples/for4.tac | AHEADer/my_decaf_compiler | 42ba9f140c5fda3cd2b4fdb727745d2cfd39c923 | [
"MIT"
] | null | null | null | main:
BeginFunc 56 ;
_tmp0 = 0 ;
i = _tmp0 ;
_L0:
_tmp1 = 5 ;
_tmp2 = i < _tmp1 ;
IfZ _tmp2 Goto _L1 ;
PushParam i ;
LCall _PrintInt ;
PopParams 4 ;
_tmp3 = 3 ;
_tmp4 = i == _tmp3 ;
IfZ _tmp4 Goto _L2 ;
Goto _L1 ;
Goto _L3 ;
_L2:
_L3:
_tmp5 = " ok\n" ;
PushParam _tmp5 ;
LCall _PrintString ;
PopParams 4 ;
_tmp6 = 1 ;
_tmp7 = i + _tmp6 ;
i = _tmp7 ;
Goto _L0 ;
_L1:
_tmp8 = "done" ;
PushParam _tmp8 ;
LCall _PrintString ;
PopParams 4 ;
EndFunc ;
| 14.333333 | 21 | 0.606765 | 66 | 473 | 3.893939 | 0.5 | 0.116732 | 0.194553 | 0.202335 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.106195 | 0.283298 | 473 | 32 | 22 | 14.78125 | 0.651917 | 0 | 0 | 0.15625 | 0 | 0 | 0.019027 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
dcc118accb58d39f65de58b85ed848707e809cd6 | 593 | py | Python | tests/factories/person_factory.py | practo/federation | e316201d9b96ea1a7f6d3e9df63747b9c7c8a99e | [
"MIT"
] | null | null | null | tests/factories/person_factory.py | practo/federation | e316201d9b96ea1a7f6d3e9df63747b9c7c8a99e | [
"MIT"
] | null | null | null | tests/factories/person_factory.py | practo/federation | e316201d9b96ea1a7f6d3e9df63747b9c7c8a99e | [
"MIT"
] | null | null | null | import random
from datetime import datetime
import factory
from tests.factories import faker
from faker import Factory
from config.db import db
from federation_api.people.model import Person
class PersonFactory(factory.alchemy.SQLAlchemyModelFactory):
class Meta:
model = Person
sqlalchemy_session = db.session
email = factory.LazyAttribute(lambda x: faker.email())
phone = factory.LazyAttribute(lambda x: faker.phone_number())
account_id = factory.LazyAttribute(lambda x: random.randint(1000, 9999))
name = factory.LazyAttribute(lambda x: faker.name())
| 31.210526 | 76 | 0.763912 | 74 | 593 | 6.067568 | 0.459459 | 0.178174 | 0.231626 | 0.240535 | 0.213808 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016032 | 0.158516 | 593 | 18 | 77 | 32.944444 | 0.883768 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.466667 | 0 | 0.866667 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
dcc61064fd8549037bc9e804b64b1d3e3db9524a | 16,897 | py | Python | code/model_utils.py | mayukh18/anonymousairpollution | f0e3ca60d46f941e690f64c435f9a40f879c09dc | [
"MIT"
] | null | null | null | code/model_utils.py | mayukh18/anonymousairpollution | f0e3ca60d46f941e690f64c435f9a40f879c09dc | [
"MIT"
] | null | null | null | code/model_utils.py | mayukh18/anonymousairpollution | f0e3ca60d46f941e690f64c435f9a40f879c09dc | [
"MIT"
] | null | null | null | # all imports here
import math
import random
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder
import torch
from torch import nn
from torch.nn import functional as F
from torch.utils.data import TensorDataset, DataLoader
from torch.optim.lr_scheduler import _LRScheduler
from torch.autograd import Variable
from datetime import datetime
from tqdm import tqdm
import sklearn
from copy import deepcopy
class LSTM(nn.Module):
def __init__(self, num_classes, input_size, hidden_size, num_layers, bidirectional = False):
super(LSTM, self).__init__()
self.num_classes = num_classes
self.num_layers = num_layers
self.input_size = input_size
self.hidden_size = hidden_size
self.seq_length = SEQ_LENGTH
self.bidrectional = bidirectional
self.lstm = nn.LSTM(input_size=input_size, hidden_size=hidden_size,
num_layers=num_layers, batch_first=True, bidirectional = bidirectional)
self.fc = nn.Linear(hidden_size, num_classes)
def forward(self, x):
h_0 = Variable(torch.zeros(
self.num_layers, x.size(0), self.hidden_size)).cuda()
c_0 = Variable(torch.zeros(
self.num_layers, x.size(0), self.hidden_size)).cuda()
# Propagate input through LSTM
ula, (h_out, _) = self.lstm(x, (h_0, c_0))
#h_out = h_out.view(-1, self.hidden_size)
out = self.fc(ula)
return out
import torch.nn as nn
import math
device = 'cuda'
class MultiHeadAttention(nn.Module):
'''Multi-head self-attention module'''
def __init__(self, D, H):
super(MultiHeadAttention, self).__init__()
self.H = H # number of heads
self.D = D # dimension
self.wq = nn.Linear(D, D*H)
self.wk = nn.Linear(D, D*H)
self.wv = nn.Linear(D, D*H)
self.dense = nn.Linear(D*H, D)
def concat_heads(self, x):
'''(B, H, S, D) => (B, S, D*H)'''
B, H, S, D = x.shape
x = x.permute((0, 2, 1, 3)).contiguous() # (B, S, H, D)
x = x.reshape((B, S, H*D)) # (B, S, D*H)
return x
def split_heads(self, x):
'''(B, S, D*H) => (B, H, S, D)'''
B, S, D_H = x.shape
x = x.reshape(B, S, self.H, self.D) # (B, S, H, D)
x = x.permute((0, 2, 1, 3)) # (B, H, S, D)
return x
def forward(self, x, mask):
q = self.wq(x) # (B, S, D*H)
k = self.wk(x) # (B, S, D*H)
v = self.wv(x) # (B, S, D*H)
q = self.split_heads(q) # (B, H, S, D)
k = self.split_heads(k) # (B, H, S, D)
v = self.split_heads(v) # (B, H, S, D)
attention_scores = torch.matmul(q, k.transpose(-1, -2)) #(B,H,S,S)
attention_scores = attention_scores / math.sqrt(self.D)
# add the mask to the scaled tensor.
if mask is not None:
attention_scores += (mask * -1e9)
attention_weights = nn.Softmax(dim=-1)(attention_scores)
scaled_attention = torch.matmul(attention_weights, v) # (B, H, S, D)
concat_attention = self.concat_heads(scaled_attention) # (B, S, D*H)
output = self.dense(concat_attention) # (B, S, D)
return output, attention_weights
class MultiHeadAttention(nn.Module):
'''Multi-head self-attention module'''
def __init__(self, D, H):
super(MultiHeadAttention, self).__init__()
self.H = H # number of heads
self.D = D # dimension
self.wq = nn.Linear(D, D*H)
self.wk = nn.Linear(D, D*H)
self.wv = nn.Linear(D, D*H)
self.dense = nn.Linear(D*H, D)
def concat_heads(self, x):
'''(B, H, S, D) => (B, S, D*H)'''
B, H, S, D = x.shape
x = x.permute((0, 2, 1, 3)).contiguous() # (B, S, H, D)
x = x.reshape((B, S, H*D)) # (B, S, D*H)
return x
def split_heads(self, x):
'''(B, S, D*H) => (B, H, S, D)'''
B, S, D_H = x.shape
x = x.reshape(B, S, self.H, self.D) # (B, S, H, D)
x = x.permute((0, 2, 1, 3)) # (B, H, S, D)
return x
def forward(self, x, mask):
q = self.wq(x) # (B, S, D*H)
k = self.wk(x) # (B, S, D*H)
v = self.wv(x) # (B, S, D*H)
q = self.split_heads(q) # (B, H, S, D)
k = self.split_heads(k) # (B, H, S, D)
v = self.split_heads(v) # (B, H, S, D)
attention_scores = torch.matmul(q, k.transpose(-1, -2)) #(B,H,S,S)
attention_scores = attention_scores / math.sqrt(self.D)
# add the mask to the scaled tensor.
if mask is not None:
attention_scores += (mask * -1e9)
attention_weights = nn.Softmax(dim=-1)(attention_scores)
scaled_attention = torch.matmul(attention_weights, v) # (B, H, S, D)
concat_attention = self.concat_heads(scaled_attention) # (B, S, D*H)
output = self.dense(concat_attention) # (B, S, D)
return output, attention_weights
class MultiHeadAttentionCosformerNew(nn.Module):
'''Multi-head self-attention module'''
def __init__(self, D, H):
super(MultiHeadAttentionCosformerNew, self).__init__()
self.H = H # number of heads
self.D = D # dimension
self.wq = nn.Linear(D, D*H)
self.wk = nn.Linear(D, D*H)
self.wv = nn.Linear(D, D*H)
self.dense = nn.Linear(D*H, D)
def concat_heads(self, x):
'''(B, H, S, D) => (B, S, D*H)'''
B, H, S, D = x.shape
x = x.permute((0, 2, 1, 3)).contiguous() # (B, S, H, D)
x = x.reshape((B, S, H*D)) # (B, S, D*H)
return x
def split_heads(self, x):
'''(B, S, D*H) => (B, H, S, D)'''
B, S, D_H = x.shape
x = x.reshape(B, S, self.H, self.D) # (B, S, H, D)
x = x.permute((0, 2, 1, 3)) # (B, H, S, D)
return x
def forward(self, x, mask):
q = self.wq(x) # (B, S, D*H)
k = self.wk(x) # (B, S, D*H)
v = self.wv(x) # (B, S, D*H)
q = self.split_heads(q).permute(0,2,1,3) # (B, S, H, D)
k = self.split_heads(k).permute(0,2,1,3) # (B, S, H, D)
v = self.split_heads(v).permute(0,2,1,3) # (B, S, H, D)
B = q.shape[0]
S = q.shape[1]
q = torch.nn.functional.elu(q) + 1 # Sigmoid torch.nn.ReLU()
k = torch.nn.functional.elu(k) + 1 # Sigmoid torch.nn.ReLU()
# q, k, v -> [batch_size, seq_len, n_heads, d_head]
cos = (torch.cos(1.57*torch.arange(S)/S).unsqueeze(0)).repeat(B,1).cuda()
sin = (torch.sin(1.57*torch.arange(S)/S).unsqueeze(0)).repeat(B,1).cuda()
# cos, sin -> [batch_size, seq_len]
q_cos = torch.einsum('bsnd,bs->bsnd', q, cos)
q_sin = torch.einsum('bsnd,bs->bsnd', q, sin)
k_cos = torch.einsum('bsnd,bs->bsnd', k, cos)
k_sin = torch.einsum('bsnd,bs->bsnd', k, sin)
# q_cos, q_sin, k_cos, k_sin -> [batch_size, seq_len, n_heads, d_head]
kv_cos = torch.einsum('bsnx,bsnz->bnxz', k_cos, v)
# kv_cos -> [batch_size, n_heads, d_head, d_head]
qkv_cos = torch.einsum('bsnx,bnxz->bsnz', q_cos, kv_cos)
# qkv_cos -> [batch_size, seq_len, n_heads, d_head]
kv_sin = torch.einsum('bsnx,bsnz->bnxz', k_sin, v)
# kv_sin -> [batch_size, n_heads, d_head, d_head]
qkv_sin = torch.einsum('bsnx,bnxz->bsnz', q_sin, kv_sin)
# qkv_sin -> [batch_size, seq_len, n_heads, d_head]
# denominator
denominator = 1.0 / (torch.einsum('bsnd,bnd->bsn', q_cos, k_cos.sum(axis=1))
+ torch.einsum('bsnd,bnd->bsn',
q_sin, k_sin.sum(axis=1))
+ 1e-5)
# denominator -> [batch_size, seq_len, n_heads]
O = torch.einsum('bsnz,bsn->bsnz', qkv_cos +
qkv_sin, denominator).contiguous()
# output -> [batch_size, seq_len, n_heads, d_head]
concat_attention = self.concat_heads(O.permute(0,2,1,3)) # (B, S, D*H)
output = self.dense(concat_attention) # (B, S, D)
return output, None
class MultiHeadAttentionCosSquareformerNew(nn.Module):
'''Multi-head self-attention module'''
def __init__(self, D, H):
super(MultiHeadAttentionCosSquareformerNew, self).__init__()
self.H = H # number of heads
self.D = D # dimension
self.wq = nn.Linear(D, D*H)
self.wk = nn.Linear(D, D*H)
self.wv = nn.Linear(D, D*H)
self.dense = nn.Linear(D*H, D)
def concat_heads(self, x):
'''(B, H, S, D) => (B, S, D*H)'''
B, H, S, D = x.shape
x = x.permute((0, 2, 1, 3)).contiguous() # (B, S, H, D)
x = x.reshape((B, S, H*D)) # (B, S, D*H)
return x
def split_heads(self, x):
'''(B, S, D*H) => (B, H, S, D)'''
B, S, D_H = x.shape
x = x.reshape(B, S, self.H, self.D) # (B, S, H, D)
x = x.permute((0, 2, 1, 3)) # (B, H, S, D)
return x
def forward(self, x, mask):
q = self.wq(x) # (B, S, D*H)
k = self.wk(x) # (B, S, D*H)
v = self.wv(x) # (B, S, D*H)
q = self.split_heads(q).permute(0,2,1,3) # (B, S, H, D)
k = self.split_heads(k).permute(0,2,1,3) # (B, S, H, D)
v = self.split_heads(v).permute(0,2,1,3) # (B, S, H, D)
B = q.shape[0]
S = q.shape[1]
q = torch.nn.functional.elu(q) + 1 # Sigmoid torch.nn.ReLU()
k = torch.nn.functional.elu(k) + 1 # Sigmoid torch.nn.ReLU()
# q, k, v -> [batch_size, seq_len, n_heads, d_head]
cos = (torch.cos(3.1415*torch.arange(S)/S).unsqueeze(0)).repeat(B,1).cuda()
sin = (torch.sin(3.1415*torch.arange(S)/S).unsqueeze(0)).repeat(B,1).cuda()
# cos, sin -> [batch_size, seq_len]
q_cos = torch.einsum('bsnd,bs->bsnd', q, cos)
q_sin = torch.einsum('bsnd,bs->bsnd', q, sin)
k_cos = torch.einsum('bsnd,bs->bsnd', k, cos)
k_sin = torch.einsum('bsnd,bs->bsnd', k, sin)
# q_cos, q_sin, k_cos, k_sin -> [batch_size, seq_len, n_heads, d_head]
kv_cos = torch.einsum('bsnx,bsnz->bnxz', k_cos, v)
# kv_cos -> [batch_size, n_heads, d_head, d_head]
qkv_cos = torch.einsum('bsnx,bnxz->bsnz', q_cos, kv_cos)
# qkv_cos -> [batch_size, seq_len, n_heads, d_head]
kv_sin = torch.einsum('bsnx,bsnz->bnxz', k_sin, v)
# kv_sin -> [batch_size, n_heads, d_head, d_head]
qkv_sin = torch.einsum('bsnx,bnxz->bsnz', q_sin, kv_sin)
# qkv_sin -> [batch_size, seq_len, n_heads, d_head]
kv = torch.einsum('bsnx,bsnz->bnxz', k, v)
# kv -> [batch_size, n_heads, d_head, d_head]
qkv = torch.einsum('bsnx,bnxz->bsnz', q, kv)
# qkv_cos -> [batch_size, seq_len, n_heads, d_head]
# denominator
denominator = 1.0 / (torch.einsum('bsnd,bnd->bsn', q, k.sum(axis=1)) + torch.einsum('bsnd,bnd->bsn', q_cos, k_cos.sum(axis=1))
+ torch.einsum('bsnd,bnd->bsn',
q_sin, k_sin.sum(axis=1))
+ 1e-5)
# denominator -> [batch_size, seq_len, n_heads]
O = torch.einsum('bsnz,bsn->bsnz', qkv + qkv_cos +
qkv_sin, denominator).contiguous()
# output -> [batch_size, seq_len, n_heads, d_head]
concat_attention = self.concat_heads(O.permute(0,2,1,3)) # (B, S, D*H)
output = self.dense(concat_attention) # (B, S, D)
return output, None
# Positional encodings
def get_angles(pos, i, D):
angle_rates = 1 / np.power(10000, (2 * (i // 2)) / np.float32(D))
return pos * angle_rates
def positional_encoding(D, position=20, dim=3, device=device):
angle_rads = get_angles(np.arange(position)[:, np.newaxis],
np.arange(D)[np.newaxis, :],
D)
# apply sin to even indices in the array; 2i
angle_rads[:, 0::2] = np.sin(angle_rads[:, 0::2])
# apply cos to odd indices in the array; 2i+1
angle_rads[:, 1::2] = np.cos(angle_rads[:, 1::2])
if dim == 3:
pos_encoding = angle_rads[np.newaxis, ...]
elif dim == 4:
pos_encoding = angle_rads[np.newaxis,np.newaxis, ...]
return torch.tensor(pos_encoding, device=device)
class TransformerLayer(nn.Module):
def __init__(self, D, H, hidden_mlp_dim, dropout_rate, attention_type='cosine_square'):
super(TransformerLayer, self).__init__()
self.dropout_rate = dropout_rate
self.mlp_hidden = nn.Linear(D, hidden_mlp_dim)
self.mlp_out = nn.Linear(hidden_mlp_dim, D)
self.layernorm1 = nn.LayerNorm(D, eps=1e-9)
self.layernorm2 = nn.LayerNorm(D, eps=1e-9)
self.dropout1 = nn.Dropout(dropout_rate)
self.dropout2 = nn.Dropout(dropout_rate)
if attention_type == 'cosine':
self.mha = MultiHeadAttentionCosformerNew(D, H)
elif attention_type == 'cosine_square':
self.mha = MultiHeadAttentionCosSquareformerNew(D, H)
else:
self.mha = MultiHeadAttention(D,H)
def forward(self, x, look_ahead_mask):
attn, attn_weights = self.mha(x, look_ahead_mask) # (B, S, D)
attn = self.dropout1(attn) # (B,S,D)
attn = self.layernorm1(attn + x) # (B,S,D)
mlp_act = torch.relu(self.mlp_hidden(attn))
mlp_act = self.mlp_out(mlp_act)
mlp_act = self.dropout2(mlp_act)
output = self.layernorm2(mlp_act + attn) # (B, S, D)
return output, attn_weights
class Transformer(nn.Module):
'''Transformer Decoder Implementating several Decoder Layers.
'''
def __init__(self, num_layers, D, H, hidden_mlp_dim, inp_features, out_features, dropout_rate, attention_type='cosine_square', SL=20):
super(Transformer, self).__init__()
self.attention_type = attention_type
self.sqrt_D = torch.tensor(math.sqrt(D))
self.num_layers = num_layers
self.input_projection = nn.Linear(inp_features, D) # multivariate input
self.output_projection = nn.Linear(D, out_features) # multivariate output
self.pos_encoding = positional_encoding(D, position=SL)
self.dec_layers = nn.ModuleList([TransformerLayer(D, H, hidden_mlp_dim,
dropout_rate=dropout_rate, attention_type=self.attention_type
) for _ in range(num_layers)])
self.dropout = nn.Dropout(dropout_rate)
def forward(self, x, mask):
B, S, D = x.shape
# attention_weights = {}
x = self.input_projection(x)
x *= self.sqrt_D
x += self.pos_encoding[:, :S, :]
x = self.dropout(x)
for i in range(self.num_layers):
x, _ = self.dec_layers[i](x=x,
look_ahead_mask=mask)
# attention_weights['decoder_layer{}'.format(i + 1)] = block
x = self.output_projection(x)
return x, None # attention_weights # (B,S,S)
class TransLSTM(nn.Module):
'''Transformer Decoder Implementating several Decoder Layers.
'''
def __init__(self, num_layers, D, H, hidden_mlp_dim, inp_features, out_features, dropout_rate, LSTM_module, attention_type='regular'):
super(TransLSTM, self).__init__()
self.attention_type = attention_type
self.sqrt_D = torch.tensor(math.sqrt(D))
self.num_layers = num_layers
self.input_projection = nn.Linear(inp_features, D) # multivariate input
self.output_projection = nn.Linear(D, 4) # multivariate output
self.fc = nn.Linear(4*2, out_features)
self.pos_encoding = positional_encoding(D)
self.dec_layers = nn.ModuleList([TransformerLayer(D, H, hidden_mlp_dim,
dropout_rate=dropout_rate, attention_type=self.attention_type
) for _ in range(num_layers)])
self.dropout = nn.Dropout(dropout_rate)
self.LSTM = LSTM_module
def forward(self, x, mask):
x_l = self.LSTM(x)
B, S, D = x.shape
attention_weights = {}
x = self.input_projection(x)
x *= self.sqrt_D
x += self.pos_encoding[:, :S, :]
x = self.dropout(x)
for i in range(self.num_layers):
x, block = self.dec_layers[i](x=x,
look_ahead_mask=mask)
attention_weights['decoder_layer{}'.format(i + 1)] = block
x = self.output_projection(x)
x = torch.cat((x,x_l),axis=2)
x = self.fc(x)
return x, attention_weights # (B,S,S) | 37.716518 | 138 | 0.556134 | 2,527 | 16,897 | 3.550455 | 0.086268 | 0.014712 | 0.014044 | 0.014267 | 0.755127 | 0.727708 | 0.700847 | 0.689701 | 0.689701 | 0.685689 | 0 | 0.014396 | 0.292892 | 16,897 | 448 | 139 | 37.716518 | 0.736525 | 0.166953 | 0 | 0.641447 | 0 | 0 | 0.030072 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.085526 | false | 0 | 0.0625 | 0 | 0.233553 | 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 |
dccc93c12e5761da69e2fc92dbc86e44ec77fd66 | 1,740 | py | Python | test/test_entity_graph_api.py | docktermj/senzing-python-rest-client | 396c4842c72c93a4a9d7cf0cefc027f73892a518 | [
"Apache-2.0"
] | null | null | null | test/test_entity_graph_api.py | docktermj/senzing-python-rest-client | 396c4842c72c93a4a9d7cf0cefc027f73892a518 | [
"Apache-2.0"
] | null | null | null | test/test_entity_graph_api.py | docktermj/senzing-python-rest-client | 396c4842c72c93a4a9d7cf0cefc027f73892a518 | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
"""
Senzing REST API
This is the Senzing REST API. It describes the REST interface to Senzing API functions available via REST. It leverages the Senzing native API which is documented at [https://docs.senzing.com](https://docs.senzing.com) # noqa: E501
OpenAPI spec version: 1.6.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import swagger_client
from api.entity_graph_api import EntityGraphApi # noqa: E501
from swagger_client.rest import ApiException
class TestEntityGraphApi(unittest.TestCase):
"""EntityGraphApi unit test stubs"""
def setUp(self):
self.api = api.entity_graph_api.EntityGraphApi() # noqa: E501
def tearDown(self):
pass
def test_find_network_by_entity_id(self):
"""Test case for find_network_by_entity_id
Finds the entity network around one or more entities identified by their entity IDs or by the data source codes and record ID's of their constituent records. This attempts to find paths between the specified entities. If no paths exist, then island networks are returned with each island network containing up to a specified number of related entities. # noqa: E501
"""
pass
def test_find_path_by_entity_id(self):
"""Test case for find_path_by_entity_id
Finds a path between two entities identified by entity ID or by data sources and record IDs of constituent records. You may provide entity IDs or data source and record IDs to identify the from/to entities in the path, but you may not mix and match. # noqa: E501
"""
pass
if __name__ == '__main__':
unittest.main()
| 36.25 | 376 | 0.728736 | 258 | 1,740 | 4.771318 | 0.445736 | 0.032494 | 0.040617 | 0.030869 | 0.087734 | 0.047116 | 0.047116 | 0.047116 | 0 | 0 | 0 | 0.013818 | 0.20977 | 1,740 | 47 | 377 | 37.021277 | 0.881455 | 0.648276 | 0 | 0.1875 | 0 | 0 | 0.015009 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.1875 | 0.3125 | 0 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 3 |
dce2fe30fa33ce0da80eb536b162542456e62fbd | 666 | py | Python | code/util/calculater.py | SFEcoder/datascience | 583356d516d9a30db5a349a584ccf659216b83e6 | [
"Apache-2.0"
] | null | null | null | code/util/calculater.py | SFEcoder/datascience | 583356d516d9a30db5a349a584ccf659216b83e6 | [
"Apache-2.0"
] | null | null | null | code/util/calculater.py | SFEcoder/datascience | 583356d516d9a30db5a349a584ccf659216b83e6 | [
"Apache-2.0"
] | null | null | null | import numpy as np
# 获取排序号的一组数的第x四分位数
def get4NumByX(x, numss):
nums = sorted(numss)
if x == 1:
raw = 0.25 * (len(nums) + 1)
if int(raw) == raw:
return nums[int(raw) - 1]
return 0.25 * nums[int(raw) - 1] + 0.75 * nums[int(raw)]
elif x == 2:
raw = 0.5 * (len(nums) + 1)
if int(raw) == raw:
return nums[int(raw) - 1]
return 0.5 * nums[int(raw) - 1] + 0.5 * nums[1 + int(raw) - 1]
elif x == 3:
raw = 0.75 * (len(nums) + 1)
if raw == int(raw):
return nums[int(raw) - 1]
return 0.75 * nums[int(raw) - 1] + 0.25 * nums[int(raw)]
return -1
| 25.615385 | 70 | 0.468468 | 106 | 666 | 2.943396 | 0.226415 | 0.230769 | 0.25641 | 0.211538 | 0.567308 | 0.362179 | 0.362179 | 0.362179 | 0.275641 | 0.275641 | 0 | 0.093458 | 0.357357 | 666 | 25 | 71 | 26.64 | 0.635514 | 0.024024 | 0 | 0.263158 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.052632 | false | 0 | 0.052632 | 0 | 0.473684 | 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 |
0d1d333d778dd0834f07adfecc583a42d12cd2ea | 213 | py | Python | modelflow/model_run_numba.py | IbHansen/modelflow2 | 7e8f115904971307f8231cafe6a899c50ee49b56 | [
"X11"
] | null | null | null | modelflow/model_run_numba.py | IbHansen/modelflow2 | 7e8f115904971307f8231cafe6a899c50ee49b56 | [
"X11"
] | null | null | null | modelflow/model_run_numba.py | IbHansen/modelflow2 | 7e8f115904971307f8231cafe6a899c50ee49b56 | [
"X11"
] | null | null | null | # -*- coding: utf-8 -*-
"""
This script runs a model with numba
@author: hanseni
"""
import sys
from modelclass import model
mmodel, basedf = model.modelload(sys.argv[1],run=1,ljit=1,stringjit=False)
| 16.384615 | 79 | 0.671362 | 31 | 213 | 4.612903 | 0.806452 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022989 | 0.183099 | 213 | 12 | 80 | 17.75 | 0.798851 | 0.375587 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.666667 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
0d51c32b71f89e25b39f6e162b0038464d9a5200 | 159 | py | Python | other_tests/lambda.py | nuua-io/Nuua | d74bec22d09d25f2bc0ced8d7c9a154ff84a874d | [
"MIT"
] | 43 | 2018-11-17T02:08:09.000Z | 2022-03-03T14:50:02.000Z | other_tests/lambda.py | nuua-io/Nuua | d74bec22d09d25f2bc0ced8d7c9a154ff84a874d | [
"MIT"
] | 2 | 2019-08-07T03:16:51.000Z | 2021-05-17T03:05:08.000Z | other_tests/lambda.py | nuua-io/Nuua | d74bec22d09d25f2bc0ced8d7c9a154ff84a874d | [
"MIT"
] | 3 | 2019-01-07T18:43:35.000Z | 2021-07-21T12:12:23.000Z | def test():
a = 10
fun1 = lambda: a
fun1()
print(a)
a += 1
fun1()
print(a)
return fun1
fun = test()
print(f"Fun: {fun()}")
| 9.9375 | 22 | 0.45283 | 23 | 159 | 3.130435 | 0.478261 | 0.25 | 0.277778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.07 | 0.371069 | 159 | 15 | 23 | 10.6 | 0.65 | 0 | 0 | 0.363636 | 0 | 0 | 0.075472 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0 | 0 | 0.181818 | 0.272727 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
0d54984afca639765fdd2530446e43882a283ae6 | 1,466 | py | Python | lab/numpy/random.py | patel-zeel/lab | cc0df2c03196863041e78fa4179445341e86958c | [
"MIT"
] | null | null | null | lab/numpy/random.py | patel-zeel/lab | cc0df2c03196863041e78fa4179445341e86958c | [
"MIT"
] | null | null | null | lab/numpy/random.py | patel-zeel/lab | cc0df2c03196863041e78fa4179445341e86958c | [
"MIT"
] | null | null | null | import warnings
import numpy as np
from . import dispatch, B, Numeric
from ..shape import unwrap_dimension
from ..types import NPDType, NPRandomState, Int
__all__ = []
@dispatch
def create_random_state(_: NPDType, seed: Int = 0):
return np.random.RandomState(seed=seed)
@dispatch
def global_random_state(_: NPDType):
return np.random.random.__self__
@dispatch
def set_global_random_state(state: NPRandomState):
np.random.random.__self__.set_state(state.get_state())
def _warn_dtype(dtype):
if B.issubdtype(dtype, np.integer):
warnings.warn("Casting random number of type float to type integer.")
@dispatch
def rand(state: NPRandomState, dtype: NPDType, *shape: Int):
_warn_dtype(dtype)
return state, B.cast(dtype, state.rand(*shape))
@dispatch
def rand(dtype: NPDType, *shape: Int):
return rand(global_random_state(dtype), dtype, *shape)[1]
@dispatch
def randn(state: NPRandomState, dtype: NPDType, *shape: Int):
_warn_dtype(dtype)
return state, B.cast(dtype, state.randn(*shape))
@dispatch
def randn(dtype: NPDType, *shape: Int):
return randn(global_random_state(dtype), dtype, *shape)[1]
@dispatch
def choice(state: NPRandomState, a: Numeric, n: Int):
inds = state.choice(unwrap_dimension(B.shape(a)[0]), n, replace=True)
choices = a[inds]
return state, choices[0] if n == 1 else choices
@dispatch
def choice(a: Numeric, n: Int):
return choice(global_random_state(a), a, n)[1]
| 22.90625 | 77 | 0.718963 | 208 | 1,466 | 4.889423 | 0.25 | 0.097345 | 0.083579 | 0.078663 | 0.291052 | 0.239921 | 0.239921 | 0.239921 | 0.239921 | 0.153392 | 0 | 0.005654 | 0.155525 | 1,466 | 63 | 78 | 23.269841 | 0.815832 | 0 | 0 | 0.275 | 0 | 0 | 0.035471 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.125 | 0.125 | 0.575 | 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 |
b4aba623b69c947bb7ce8476f90c7de1180a1017 | 1,700 | py | Python | market/models.py | E-chess/page | e0e118bc1c7c1dd67577f7c845f18da57596da96 | [
"MIT"
] | null | null | null | market/models.py | E-chess/page | e0e118bc1c7c1dd67577f7c845f18da57596da96 | [
"MIT"
] | null | null | null | market/models.py | E-chess/page | e0e118bc1c7c1dd67577f7c845f18da57596da96 | [
"MIT"
] | null | null | null | from flask_login import UserMixin
from market import db, login_manager, bcrypt
@login_manager.user_loader
def load_user(user_id):
return User.query.get(int(user_id))
class User(db.Model, UserMixin):
id = db.Column(db.Integer(), primary_key=True)
username = db.Column(db.String(length=30), nullable=False, unique=True)
email_address = db.Column(db.String(length=50), nullable=False, unique=True)
password_hash = db.Column(db.String(length=60), nullable=False)
budget = db.Column(db.Integer(), nullable=False, default=1)
@property
def prettier_budget(self):
if len(str(self.budget)) >= 4:
return f'{str(self.budget)[:-3]},{str(self.budget)[-3:]}$'
else:
return f"{self.budget}$"
@property
def password(self):
return self.password
@password.setter
def password(self, plain_text_password):
self.password_hash = bcrypt.generate_password_hash(
plain_text_password).decode('utf-8')
def check_password_correction(self, attempted_password):
return bcrypt.check_password_hash(self.password_hash,
attempted_password)
def can_purchase(self, item_obj):
return self.budget >= item_obj.price
class Item(db.Model):
id = db.Column(db.Integer(), primary_key=True)
id_api = db.Column(db.String(), nullable=False, unique=True)
name = db.Column(db.String(length=30), nullable=False, unique=True)
price = db.Column(db.Integer(), nullable=False)
description = db.Column(db.String(), nullable=False)
def __repr__(self):
return f'Item {self.name}'
| 33.333333 | 81 | 0.647647 | 221 | 1,700 | 4.828054 | 0.316742 | 0.074977 | 0.093721 | 0.089972 | 0.301781 | 0.260544 | 0.149953 | 0.149953 | 0.088097 | 0.088097 | 0 | 0.009886 | 0.226471 | 1,700 | 50 | 82 | 34 | 0.801521 | 0 | 0 | 0.108108 | 0 | 0 | 0.050303 | 0.029091 | 0 | 0 | 0 | 0 | 0 | 1 | 0.189189 | false | 0.27027 | 0.054054 | 0.135135 | 0.756757 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 3 |
b4d5f281eaeb44a0dffb5c307a79538e17c7429b | 141 | py | Python | Curso/Challenges/URI/1006Average2.py | DavidBitner/Aprendizado-Python | e1dcf18f9473c697fc2302f34a2d3e025ca6c969 | [
"MIT"
] | null | null | null | Curso/Challenges/URI/1006Average2.py | DavidBitner/Aprendizado-Python | e1dcf18f9473c697fc2302f34a2d3e025ca6c969 | [
"MIT"
] | null | null | null | Curso/Challenges/URI/1006Average2.py | DavidBitner/Aprendizado-Python | e1dcf18f9473c697fc2302f34a2d3e025ca6c969 | [
"MIT"
] | null | null | null | a = float(input())
b = float(input())
c = float(input())
media = (a * 2 + b * 3 + c * 5) / (2 + 3 + 5)
print("MEDIA = {:.1f}".format(media))
| 23.5 | 45 | 0.496454 | 24 | 141 | 2.916667 | 0.5 | 0.428571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.063636 | 0.219858 | 141 | 5 | 46 | 28.2 | 0.572727 | 0 | 0 | 0 | 0 | 0 | 0.099291 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.2 | 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 |
b4e4948bc615cda1c2ea87bf55a5e8b3ffe3c63c | 388 | py | Python | maple/backend/docker/system.py | akashdhruv/maple | 11e562f51b18b2251ea507c629a1981b031d2f35 | [
"MIT"
] | null | null | null | maple/backend/docker/system.py | akashdhruv/maple | 11e562f51b18b2251ea507c629a1981b031d2f35 | [
"MIT"
] | 5 | 2021-12-24T08:55:42.000Z | 2022-02-13T16:59:30.000Z | maple/backend/docker/system.py | akashdhruv/maple | 11e562f51b18b2251ea507c629a1981b031d2f35 | [
"MIT"
] | null | null | null | """Python API for docker interface in maple"""
import subprocess
def login():
"""
Login to docker account
"""
subprocess.run("docker login", shell=True, check=True)
def prune():
"""
Prune system
"""
subprocess.run("rm -f -v $maple_home/context/Dockerfile*", shell=True, check=True)
subprocess.run("docker system prune -a", shell=True, check=True)
| 20.421053 | 86 | 0.64433 | 50 | 388 | 4.98 | 0.52 | 0.156627 | 0.168675 | 0.216867 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.206186 | 388 | 18 | 87 | 21.555556 | 0.808442 | 0.198454 | 0 | 0 | 0 | 0 | 0.269091 | 0.112727 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | true | 0 | 0.166667 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b4fcfd933815b018c1522dab0badc60ac035feef | 247 | py | Python | src/binocular_sample.py | zoekdestep/condensed-binocular | ea3f3bad3d69525bbf16994d1c6d40666b86c06e | [
"MIT"
] | 5 | 2020-10-13T06:46:27.000Z | 2020-11-06T04:35:15.000Z | src/binocular_sample.py | zoekdestep/condensed-binocular | ea3f3bad3d69525bbf16994d1c6d40666b86c06e | [
"MIT"
] | null | null | null | src/binocular_sample.py | zoekdestep/condensed-binocular | ea3f3bad3d69525bbf16994d1c6d40666b86c06e | [
"MIT"
] | null | null | null | # Basic example of how to log to AML and/or Appinsights:
import Condensed_Binocular
reporting = Condensed_Binocular()
reporting.report_metric("dummy value", 0.1, description="a random value to show reporting capabilities", report_to_parent=True)
| 41.166667 | 127 | 0.809717 | 36 | 247 | 5.416667 | 0.75 | 0.184615 | 0.276923 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009132 | 0.11336 | 247 | 5 | 128 | 49.4 | 0.881279 | 0.218623 | 0 | 0 | 0 | 0 | 0.293194 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 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 |
3707ec2fcd41ececc45d706c0a1de88ab28647e5 | 2,015 | py | Python | tests/test_renderer/test_coparser.py | Argmaster/pygerber | 4761a5aa60ff1d11512fb44aabd103246d9a3019 | [
"MIT"
] | 3 | 2021-08-30T07:07:59.000Z | 2021-09-29T22:14:43.000Z | tests/test_renderer/test_coparser.py | Argmaster/pygerber | 4761a5aa60ff1d11512fb44aabd103246d9a3019 | [
"MIT"
] | 1 | 2021-09-26T13:28:49.000Z | 2021-09-26T13:28:49.000Z | tests/test_renderer/test_coparser.py | Argmaster/pygerber | 4761a5aa60ff1d11512fb44aabd103246d9a3019 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from unittest import TestCase, main
from pygerber.coparser import CoParser
from pygerber.exceptions import FeatureNotSupportedError
class CoParserTest(TestCase):
def test_set_default_format(self):
coparser = CoParser() # default set in __init__
self.assertEqual(coparser.format.length, 9)
self.assertEqual(coparser.format.INT_FORMAT, 3)
self.assertEqual(coparser.format.DEC_FORMAT, 6)
def test_manual_format_change(self):
coparser = CoParser()
coparser.set_mode("I")
coparser.set_zeros("D")
self.assertEqual(coparser.format.mode, "I")
self.assertEqual(coparser.format.zeros, "D")
def test_parse_coordinates_unsigned_L_short(self):
coparser = CoParser()
self.assertEqual(coparser.parse("-300"), -0.0003)
self.assertEqual(coparser.parse("+300"), 0.0003)
self.assertEqual(coparser.parse("300"), 0.0003)
def test_parse_coordinates_L_long(self):
coparser = CoParser()
self.assertEqual(coparser.parse("10000300"), 10.0003)
self.assertEqual(coparser.parse("+10000300"), 10.0003)
self.assertEqual(coparser.parse("-10000300"), -10.0003)
self.assertEqual(coparser.dump(-10.0003), "-10000300")
self.assertEqual(coparser.dump(0.0003), "300")
def test_parser_coordinates_D(self):
coparser = CoParser() # 3.6
coparser.set_zeros("D")
self.assertEqual(coparser.parse("010000300"), 10.0003)
self.assertEqual(coparser.parse("-000000300"), -0.0003)
def test_parser_coordinates_T(self):
coparser = CoParser() # 3.6
coparser.set_zeros("T")
self.assertEqual(coparser.parse("0100003"), 10.0003)
self.assertEqual(coparser.parse("-0000003"), -0.0003)
def test_dump_not_supported(self):
coparser = CoParser()
coparser.set_zeros("D")
self.assertRaises(FeatureNotSupportedError, coparser.dump, 0.1)
if __name__ == "__main__":
main()
| 35.982143 | 71 | 0.670471 | 235 | 2,015 | 5.565957 | 0.251064 | 0.194954 | 0.29893 | 0.214067 | 0.441132 | 0.386086 | 0.334098 | 0.254587 | 0.196483 | 0.196483 | 0 | 0.093943 | 0.197022 | 2,015 | 55 | 72 | 36.636364 | 0.714462 | 0.026303 | 0 | 0.232558 | 0 | 0 | 0.050077 | 0 | 0 | 0 | 0 | 0 | 0.418605 | 1 | 0.162791 | false | 0 | 0.069767 | 0 | 0.255814 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
371fec87299c8e05db1b506bca628128d687177b | 180 | py | Python | Dmitry_Shevelev/h2_task6.py | Perekalskiyigor/Sirius | 2dcf792b072fa2f3fe4c2e900a9d4b6d0c2bd9b8 | [
"MIT"
] | null | null | null | Dmitry_Shevelev/h2_task6.py | Perekalskiyigor/Sirius | 2dcf792b072fa2f3fe4c2e900a9d4b6d0c2bd9b8 | [
"MIT"
] | null | null | null | Dmitry_Shevelev/h2_task6.py | Perekalskiyigor/Sirius | 2dcf792b072fa2f3fe4c2e900a9d4b6d0c2bd9b8 | [
"MIT"
] | null | null | null | n: int = int(input("Население Вселенной>")) # Вводим переменную
alive_n: int = n // 2 + n % 2 # Считаем выживших, округляя в большую сторону
print(alive_n) # Выводим это кол-во
| 45 | 77 | 0.694444 | 28 | 180 | 4.392857 | 0.714286 | 0.065041 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013605 | 0.183333 | 180 | 3 | 78 | 60 | 0.823129 | 0.45 | 0 | 0 | 0 | 0 | 0.210526 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
3722a0e8f1c5bfe50e5330d2d5ffb6d8160895b2 | 330 | py | Python | SRC/Chapter_01-Meet-Python/01_hello.py | archeranimesh/tth-python-basics-3 | accbc894324d084124ec001817edf4dc3afffa78 | [
"MIT"
] | null | null | null | SRC/Chapter_01-Meet-Python/01_hello.py | archeranimesh/tth-python-basics-3 | accbc894324d084124ec001817edf4dc3afffa78 | [
"MIT"
] | null | null | null | SRC/Chapter_01-Meet-Python/01_hello.py | archeranimesh/tth-python-basics-3 | accbc894324d084124ec001817edf4dc3afffa78 | [
"MIT"
] | null | null | null | # Variables
first_name = "Ada"
# print function followed by variable name.
print("Hello,", first_name)
print(first_name, "is learning Python")
# print takes multiple arguments.
print("These", "will be", "joined together by spaces")
# input statement.
first_name = input("What is your first name? ")
print("Hello,", first_name)
| 23.571429 | 54 | 0.730303 | 46 | 330 | 5.130435 | 0.565217 | 0.228814 | 0.118644 | 0.161017 | 0.194915 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.139394 | 330 | 13 | 55 | 25.384615 | 0.830986 | 0.30303 | 0 | 0.333333 | 0 | 0 | 0.422222 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.666667 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
37283e5f9f27843979b43e1ca797dcee23b402ab | 402 | py | Python | intake/source/tests/plugin_searchpath/not_intake_foo/__init__.py | ah-/intake | 1c971a9e579a18be603b4a74a71dbc111afbcb0c | [
"BSD-2-Clause"
] | null | null | null | intake/source/tests/plugin_searchpath/not_intake_foo/__init__.py | ah-/intake | 1c971a9e579a18be603b4a74a71dbc111afbcb0c | [
"BSD-2-Clause"
] | null | null | null | intake/source/tests/plugin_searchpath/not_intake_foo/__init__.py | ah-/intake | 1c971a9e579a18be603b4a74a71dbc111afbcb0c | [
"BSD-2-Clause"
] | null | null | null | from intake.source.base import Plugin
class OtherFooPlugin(Plugin):
def __init__(self):
super(OtherFooPlugin, self).__init__(name='otherfoo', version='0.1',
container='dataframe',
partition_access=False)
def open(self, **kwargs):
return 'open_worked' # Don't actually use this plugin
| 33.5 | 76 | 0.552239 | 39 | 402 | 5.435897 | 0.794872 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007692 | 0.353234 | 402 | 11 | 77 | 36.545455 | 0.807692 | 0.074627 | 0 | 0 | 0 | 0 | 0.083784 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.125 | 0.125 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
373074fa35705d280cca9ff8613ebbb993aa1658 | 117 | py | Python | example/django/apps.py | estudio89/maestro-python | 331079cb3f0c10de2e19210cbade793544510f33 | [
"BSD-3-Clause"
] | null | null | null | example/django/apps.py | estudio89/maestro-python | 331079cb3f0c10de2e19210cbade793544510f33 | [
"BSD-3-Clause"
] | null | null | null | example/django/apps.py | estudio89/maestro-python | 331079cb3f0c10de2e19210cbade793544510f33 | [
"BSD-3-Clause"
] | null | null | null | from django.apps import AppConfig
class TodosAppConfig(AppConfig):
name = 'example.django'
label = 'todos'
| 16.714286 | 33 | 0.717949 | 13 | 117 | 6.461538 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.188034 | 117 | 6 | 34 | 19.5 | 0.884211 | 0 | 0 | 0 | 0 | 0 | 0.162393 | 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 |
37320fbeffe2ad03cfc82564433f0257a021256b | 273 | py | Python | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/unsafe/__init__.py | jeikabu/lumberyard | 07228c605ce16cbf5aaa209a94a3cb9d6c1a4115 | [
"AML"
] | 8 | 2019-10-07T16:33:47.000Z | 2020-12-07T03:59:58.000Z | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/unsafe/__init__.py | jeikabu/lumberyard | 07228c605ce16cbf5aaa209a94a3cb9d6c1a4115 | [
"AML"
] | 1 | 2019-05-01T20:39:46.000Z | 2019-05-07T03:43:29.000Z | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/unsafe/__init__.py | jeikabu/lumberyard | 07228c605ce16cbf5aaa209a94a3cb9d6c1a4115 | [
"AML"
] | 5 | 2020-08-27T20:44:18.000Z | 2021-08-21T22:54:11.000Z | """
This subpackage is intented for low-level extension developers and compiler
developers. Regular user SHOULD NOT use code in this module.
This contains compilable utility functions that can interact directly with
the compiler to implement low-level internal code.
"""
| 34.125 | 75 | 0.809524 | 39 | 273 | 5.666667 | 0.820513 | 0.072398 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.150183 | 273 | 7 | 76 | 39 | 0.952586 | 0.967033 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2e9729050ee961d982b7395f8def7983796cb902 | 98 | py | Python | output/models/ms_data/element/elem_u024_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 1 | 2021-08-14T17:59:21.000Z | 2021-08-14T17:59:21.000Z | output/models/ms_data/element/elem_u024_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 4 | 2020-02-12T21:30:44.000Z | 2020-04-15T20:06:46.000Z | output/models/ms_data/element/elem_u024_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | null | null | null | from output.models.ms_data.element.elem_u024_xsd.elem_u024 import Root
__all__ = [
"Root",
]
| 16.333333 | 70 | 0.744898 | 15 | 98 | 4.333333 | 0.8 | 0.246154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.071429 | 0.142857 | 98 | 5 | 71 | 19.6 | 0.702381 | 0 | 0 | 0 | 0 | 0 | 0.040816 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 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 |
2eb7960699c55e26414d5c61aa0377449a526d93 | 957 | py | Python | src/linalg/applications.py | KevinL10/linalg | 2fbb8f66ccabf149790d947a4a8537b9e4fa9cb4 | [
"MIT"
] | 1 | 2022-03-18T06:09:45.000Z | 2022-03-18T06:09:45.000Z | src/linalg/applications.py | KevinL10/linalg | 2fbb8f66ccabf149790d947a4a8537b9e4fa9cb4 | [
"MIT"
] | null | null | null | src/linalg/applications.py | KevinL10/linalg | 2fbb8f66ccabf149790d947a4a8537b9e4fa9cb4 | [
"MIT"
] | null | null | null | import math
from vector import *
from matrix import *
# angle between v and w (in radians)
def angle_between(v, w):
return math.acos(v.dot(w) / (v.length() * w.length()))
# cauchy schwarz inequality (v dot w <= ||v|| * ||w||)
def cauchy_schwarz(v, w):
return v.dot(w) <= v.length() * w.length()
# triangle inequality (||v + w|| <= ||v|| + ||w||)
def triangle_inequality(v, w):
return (v + w).length() <= v.length() + w.length()
# matrices for sum and difference of 3 numbers
def difference_sum_matrices():
v = Vector([1, 4, 9])
sumMatrix = Matrix([[1, 0, 0], [1, 1, 0], [1, 1, 1]])
diffMatrix = Matrix([[1, 0, 0], [-1, 1, 0], [0, -1, 1]])
assert diffMatrix * (sumMatrix * v) == v
# identity matrix * vector
def identity_mul():
identity = Matrix.identity(3)
v = Vector([2, -4, 5])
assert v == identity * v
def rotate_by_45():
v = Vector([5, 7])
return Matrix([[1/math.sqrt(2), -1/math.sqrt(2)], [1/math.sqrt(2), 1/math.sqrt(2)]]) * v | 25.184211 | 89 | 0.602926 | 160 | 957 | 3.55625 | 0.275 | 0.024605 | 0.02109 | 0.070299 | 0.184534 | 0.179262 | 0.179262 | 0.070299 | 0.070299 | 0.070299 | 0 | 0.048408 | 0.179728 | 957 | 38 | 89 | 25.184211 | 0.676433 | 0.215256 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.095238 | 1 | 0.285714 | false | 0 | 0.142857 | 0.142857 | 0.619048 | 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 |
2ececbb4330b5f12c60fcf1f37b55cb8d60211bc | 218 | py | Python | coop_cms/apps/email_auth/apps.py | ljean/coop_cms | 531f65ceb9ad82c113597d15b764dbcf51264794 | [
"BSD-3-Clause"
] | 3 | 2016-01-29T10:55:09.000Z | 2022-03-08T16:02:12.000Z | coop_cms/apps/email_auth/apps.py | ljean/coop_cms | 531f65ceb9ad82c113597d15b764dbcf51264794 | [
"BSD-3-Clause"
] | 11 | 2015-03-07T17:30:24.000Z | 2016-07-13T09:40:43.000Z | coop_cms/apps/email_auth/apps.py | ljean/coop_cms | 531f65ceb9ad82c113597d15b764dbcf51264794 | [
"BSD-3-Clause"
] | 5 | 2018-08-30T09:03:22.000Z | 2019-09-10T13:01:56.000Z | # -*- coding: utf-8 -*-
"""
Email authentication
"""
from django.apps import AppConfig
class EmailAuthAppConfig(AppConfig):
name = 'coop_cms.apps.email_auth'
verbose_name = "coop CMS > Email authentication"
| 18.166667 | 52 | 0.706422 | 25 | 218 | 6.04 | 0.68 | 0.251656 | 0.145695 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005495 | 0.165138 | 218 | 11 | 53 | 19.818182 | 0.824176 | 0.197248 | 0 | 0 | 0 | 0 | 0.329341 | 0.143713 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
2edd8b497d50d4838e4b8bb00c4b92b73eb01881 | 107 | py | Python | LPYTHON-Exercies/vnstockai/livestockclawler/apps.py | lpython2006e/python-samples | b94ba67ce0d7798ecf796dadae206aa75da58301 | [
"MIT"
] | null | null | null | LPYTHON-Exercies/vnstockai/livestockclawler/apps.py | lpython2006e/python-samples | b94ba67ce0d7798ecf796dadae206aa75da58301 | [
"MIT"
] | null | null | null | LPYTHON-Exercies/vnstockai/livestockclawler/apps.py | lpython2006e/python-samples | b94ba67ce0d7798ecf796dadae206aa75da58301 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class LivestockclawlerConfig(AppConfig):
name = 'livestockclawler'
| 17.833333 | 40 | 0.794393 | 10 | 107 | 8.5 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.140187 | 107 | 5 | 41 | 21.4 | 0.923913 | 0 | 0 | 0 | 0 | 0 | 0.149533 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
2ee34b33d45d9f93bd2d7c902600f8b2c087ad33 | 148 | py | Python | facility/apps.py | developsun/medicalAppBackend | 7aabe50f91c72fa10ea2221dd6901388857993d6 | [
"MIT"
] | null | null | null | facility/apps.py | developsun/medicalAppBackend | 7aabe50f91c72fa10ea2221dd6901388857993d6 | [
"MIT"
] | null | null | null | facility/apps.py | developsun/medicalAppBackend | 7aabe50f91c72fa10ea2221dd6901388857993d6 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class FacilityConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'facility'
| 21.142857 | 56 | 0.763514 | 17 | 148 | 6.529412 | 0.882353 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.148649 | 148 | 6 | 57 | 24.666667 | 0.880952 | 0 | 0 | 0 | 0 | 0 | 0.25 | 0.195946 | 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 |
2ee6b0cd463d33d7e10f60559a46f7143ca379d1 | 379 | py | Python | tests/integrated/test_full_integrated.py | Rapid-Design-of-Systems-Laboratory/beluga-legacy | d14713d8211b64293c4427005cf02fbd58630598 | [
"MIT"
] | 1 | 2019-03-26T03:00:03.000Z | 2019-03-26T03:00:03.000Z | tests/integrated/test_full_integrated.py | Rapid-Design-of-Systems-Laboratory/beluga-legacy | d14713d8211b64293c4427005cf02fbd58630598 | [
"MIT"
] | null | null | null | tests/integrated/test_full_integrated.py | Rapid-Design-of-Systems-Laboratory/beluga-legacy | d14713d8211b64293c4427005cf02fbd58630598 | [
"MIT"
] | 1 | 2019-07-14T22:53:52.000Z | 2019-07-14T22:53:52.000Z | import beluga.Beluga as Beluga
def test_brachistochrone(problem_brachistochrone):
"""!
\brief Run classical Brachistochrone problem.
\author Michael Grant
\version 0.1
\date 06/30/15
"""
# TODO: Add assert statements to actually validate the solution
# TODO: Validate sol.x, sol.y, and sol.u
Beluga.run(problem_brachistochrone)
| 29.153846 | 67 | 0.683377 | 47 | 379 | 5.446809 | 0.723404 | 0.171875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027586 | 0.234829 | 379 | 12 | 68 | 31.583333 | 0.855172 | 0.55409 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.083333 | 0 | 1 | 0.333333 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
2c1457f3cf0cfe006802ff028797278a14b607d2 | 333 | py | Python | src/HABApp/mqtt/events/mqtt_filters.py | DerOetzi/HABApp | a123fbfa9928ebb3cda9a84f6984dcba593c8236 | [
"Apache-2.0"
] | 44 | 2018-12-13T08:46:44.000Z | 2022-03-07T03:23:21.000Z | src/HABApp/mqtt/events/mqtt_filters.py | DerOetzi/HABApp | a123fbfa9928ebb3cda9a84f6984dcba593c8236 | [
"Apache-2.0"
] | 156 | 2019-03-02T20:53:31.000Z | 2022-03-23T13:13:58.000Z | src/HABApp/mqtt/events/mqtt_filters.py | DerOetzi/HABApp | a123fbfa9928ebb3cda9a84f6984dcba593c8236 | [
"Apache-2.0"
] | 18 | 2019-03-08T07:13:21.000Z | 2022-03-22T19:52:31.000Z | from HABApp.core.events import ValueChangeEventFilter, ValueUpdateEventFilter
from . import MqttValueChangeEvent, MqttValueUpdateEvent
class MqttValueUpdateEventFilter(ValueUpdateEventFilter):
_EVENT_TYPE = MqttValueUpdateEvent
class MqttValueChangeEventFilter(ValueChangeEventFilter):
_EVENT_TYPE = MqttValueChangeEvent
| 30.272727 | 77 | 0.864865 | 23 | 333 | 12.347826 | 0.608696 | 0.176056 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.096096 | 333 | 10 | 78 | 33.3 | 0.943522 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 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 | 0 | 0 | 0 | 3 |
2c2b0b78e2f9f3feb9832d543bc3e131871f5ce6 | 341 | py | Python | web/schema/session_schemas.py | bbougon/crm-pilates | 47de4bad3d48208f9b499139fcddb7f8955b2509 | [
"MIT"
] | null | null | null | web/schema/session_schemas.py | bbougon/crm-pilates | 47de4bad3d48208f9b499139fcddb7f8955b2509 | [
"MIT"
] | 2 | 2021-05-26T20:47:29.000Z | 2021-07-11T23:18:55.000Z | web/schema/session_schemas.py | bbougon/crm-pilates | 47de4bad3d48208f9b499139fcddb7f8955b2509 | [
"MIT"
] | 1 | 2021-06-30T15:20:54.000Z | 2021-06-30T15:20:54.000Z | from datetime import datetime
from uuid import UUID
from pydantic import BaseModel
class SessionCheckin(BaseModel):
classroom_id: UUID
session_date: datetime
attendee: UUID
class SessionCheckout(BaseModel):
attendee: UUID
class AttendeeSessionCancellation(BaseModel):
classroom_id: UUID
session_date: datetime
| 17.05 | 45 | 0.777126 | 37 | 341 | 7.054054 | 0.405405 | 0.137931 | 0.153257 | 0.183908 | 0.329502 | 0.329502 | 0.329502 | 0 | 0 | 0 | 0 | 0 | 0.178886 | 341 | 19 | 46 | 17.947368 | 0.932143 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.25 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
25896efe3a299c9d7020c4092fcd87f29eace4ca | 2,205 | py | Python | restAPI/serializers.py | GarlandQ/project-2-photoshare-api | 76430894bb83b0d9e786c0d4bf2b9ac2b3cc87dd | [
"Apache-2.0"
] | null | null | null | restAPI/serializers.py | GarlandQ/project-2-photoshare-api | 76430894bb83b0d9e786c0d4bf2b9ac2b3cc87dd | [
"Apache-2.0"
] | null | null | null | restAPI/serializers.py | GarlandQ/project-2-photoshare-api | 76430894bb83b0d9e786c0d4bf2b9ac2b3cc87dd | [
"Apache-2.0"
] | null | null | null | from rest_framework import serializers
from users.models import Profile
from feed.models import Post, Comment
from django.shortcuts import get_object_or_404
class ProfileSerializer(serializers.HyperlinkedModelSerializer):
url = serializers.HyperlinkedIdentityField(
view_name="profile-detail", read_only=True
)
user = serializers.CharField(source="user.username", read_only=True)
class Meta:
model = Profile
fields = ["id", "user", "image", "bio", "url"]
class CommentSerializer(serializers.HyperlinkedModelSerializer):
user = serializers.CharField(source="user.username", read_only=True)
class Meta:
model = Comment
fields = ["user", "comment", "comment_date"]
read_only_fields = ["comment_date"]
class PostUserSerializer(serializers.HyperlinkedModelSerializer):
url = serializers.HyperlinkedIdentityField(
view_name="profile-detail", read_only=True
)
user = serializers.CharField(source="user.username")
class Meta:
model = Profile
fields = ["id", "user", "url"]
class PostSerializer(serializers.HyperlinkedModelSerializer):
user = PostUserSerializer(source="user.profile", read_only=True)
comments = CommentSerializer(many=True, read_only=True)
url = serializers.HyperlinkedIdentityField(view_name="post-detail", read_only=True)
class Meta:
model = Post
fields = [
"id",
"user",
"picture",
"date_posted",
"comments",
"description",
"url",
]
read_only_fields = ["date_posted"]
class PostDetailSerializer(serializers.HyperlinkedModelSerializer):
user = PostUserSerializer(source="user.profile", read_only=True)
comments = CommentSerializer(many=True, read_only=True)
url = serializers.HyperlinkedIdentityField(view_name="post-detail", read_only=True)
class Meta:
model = Post
fields = [
"id",
"user",
"picture",
"date_posted",
"comments",
"description",
"url",
]
read_only_fields = ["picture", "date_posted"]
| 28.269231 | 87 | 0.646259 | 207 | 2,205 | 6.73913 | 0.231884 | 0.074552 | 0.086022 | 0.12043 | 0.726882 | 0.726882 | 0.726882 | 0.689606 | 0.689606 | 0.689606 | 0 | 0.001805 | 0.246259 | 2,205 | 77 | 88 | 28.636364 | 0.837545 | 0 | 0 | 0.637931 | 0 | 0 | 0.133787 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.068966 | 0 | 0.431034 | 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 |
258fddd6d67b959467d399de816ca3fcb091983f | 4,060 | py | Python | exercises/en/test_06_08b.py | UBC-MDS/exploratory-data-viz | 83b704ce10d1ff5e10bfd4cdfa872ac52993fd54 | [
"CC-BY-4.0"
] | null | null | null | exercises/en/test_06_08b.py | UBC-MDS/exploratory-data-viz | 83b704ce10d1ff5e10bfd4cdfa872ac52993fd54 | [
"CC-BY-4.0"
] | 88 | 2020-12-04T06:56:51.000Z | 2021-05-10T22:02:45.000Z | exercises/en/test_06_08b.py | UBC-MDS/exploratory-data-viz | 83b704ce10d1ff5e10bfd4cdfa872ac52993fd54 | [
"CC-BY-4.0"
] | 4 | 2021-01-13T09:30:57.000Z | 2021-08-03T20:49:31.000Z | def test():
# Here we can either check objects created in the solution code, or the
# string value of the solution, available as __solution__. A helper for
# printing formatted messages is available as __msg__. See the testTemplate
# in the meta.json for details.
# If an assertion fails, the message will be displayed
assert not world_df is None, "Your answer for world_df does not exist. Have you loaded the TopoJSON data to the correct variable name?"
assert "topo_feature" in __solution__, "The loaded data should be in TopoJSON format. In order to read TopoJSON file correctly, you need to use the alt.topo_feature() function."
assert (
"quantitative" in __solution__ or
"pop_density:Q" in __solution__
), "Make sure you use pop_density column from gapminder_df for the color encoding. Hint: since pop_density column does not exist in world_df, Altair can't infer its data type and you need to specify that it is quantitative data."
assert type(world_df) == alt.UrlData, "world_df does not appear to be an Altair UrlData object. Have you assigned the Altair UrlData object for the TopoJSON data to the correct variable?"
assert world_df.url == data.world_110m.url, "Make sure you are loading the data from correct url."
assert (world_df.format != alt.utils.schemapi.Undefined and
world_df.format.type == 'topojson'
), "The loaded data should be in TopoJSON format. In order to read TopoJSON file correctly, you need to use the alt.topo_feature() function."
assert world_df.format.feature == "countries", "Make sure to specify 'countries' feature when loading the TopoJSON file using alt.topo_feature()."
assert not pop_dense_plot is None, "Your answer for pop_dense_plot does not exist. Have you assigned the plot to the correct variable name?"
assert type(pop_dense_plot) == alt.Chart, "pop_dense_plot does not appear to be an Altair Chart object. Have you assigned the Altair Chart object for the plot to the correct variable?"
assert pop_dense_plot.mark == 'geoshape', "Make sure you are using mark_geoshape for pop_dense_plot."
assert pop_dense_plot.encoding.color != alt.utils.schemapi.Undefined and (
pop_dense_plot.encoding.color.shorthand in {'pop_density:quantitative', 'pop_density:Q'} or
(pop_dense_plot.encoding.color.shorthand == 'pop_density' and pop_dense_plot.encoding.color.type == 'quantitative') or
pop_dense_plot.encoding.color.field in {'pop_density:quantitative', 'pop_density:Q'} or
(pop_dense_plot.encoding.color.field == 'pop_density' and pop_dense_plot.encoding.color.type == 'quantitative')
), "Make sure you use pop_density column from gapminder_df for the color encoding. Hint: since pop_density column does not exist in world_df, Altair can't infer its data type and you need to specify that it is quantitative data."
assert pop_dense_plot.encoding.color.scale != alt.utils.schemapi.Undefined and (
pop_dense_plot.encoding.color.scale.scheme != alt.utils.schemapi.Undefined
), "Make sure to specify a colour scheme."
assert pop_dense_plot.encoding.color.scale.domainMid == 81, "Make sure you set the domainMid of the color scale as the global median (81)."
assert type(pop_dense_plot.transform) == list and (
len(pop_dense_plot.transform) == 1 and
pop_dense_plot.transform[0]['from'] != alt.utils.schemapi.Undefined and
pop_dense_plot.transform[0]['from'].fields == ['pop_density'] and
pop_dense_plot.transform[0]['from'].key
), "Make sure you use .transform_lookup() to lookup the column 'pop_density' from the gapminder_df data using 'id' as the connecting column. Hint: 'pop_density' should be inside a list."
assert pop_dense_plot.projection != alt.utils.schemapi.Undefined and (
pop_dense_plot.projection.scale == 80
), "Make sure you use 'equalEarth' projection. Hint: you can use .project() method with type argument to specify projection type."
__msg__.good("You're correct, well done!")
| 82.857143 | 233 | 0.742611 | 626 | 4,060 | 4.65016 | 0.228435 | 0.063209 | 0.094813 | 0.068705 | 0.579526 | 0.518379 | 0.450361 | 0.349021 | 0.321539 | 0.321539 | 0 | 0.00389 | 0.176847 | 4,060 | 48 | 234 | 84.583333 | 0.867145 | 0.072906 | 0 | 0.055556 | 0 | 0.222222 | 0.551091 | 0.012773 | 0 | 0 | 0 | 0 | 0.416667 | 1 | 0.027778 | true | 0 | 0 | 0 | 0.027778 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2590d3bc780b4146ff7f23d380a633901e96a1ff | 142 | py | Python | MiniProjects/Python-Challenges/Password_Gen.py | GitInitDev/ZohoUniv | 966704837e65f58b52492b56d08e7958df3d220a | [
"Unlicense"
] | null | null | null | MiniProjects/Python-Challenges/Password_Gen.py | GitInitDev/ZohoUniv | 966704837e65f58b52492b56d08e7958df3d220a | [
"Unlicense"
] | null | null | null | MiniProjects/Python-Challenges/Password_Gen.py | GitInitDev/ZohoUniv | 966704837e65f58b52492b56d08e7958df3d220a | [
"Unlicense"
] | null | null | null | import random
char = 'qwertyuiopasdfghjklzxcvbnm!@#$%^&*(()'
stren = 10
password = "".join(random.sample(char , stren))
print (password)
| 23.666667 | 48 | 0.669014 | 14 | 142 | 6.785714 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016393 | 0.140845 | 142 | 5 | 49 | 28.4 | 0.762295 | 0 | 0 | 0 | 0 | 0 | 0.270073 | 0.270073 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.4 | 0.2 | 0 | 0.2 | 0.2 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
2596a121f75c0a84a57c9d2da30a7e882330ffb8 | 551 | py | Python | lamp/utils.py | Den4200/lamp | 85219d207863032b64e30d07c7ea05c4a5251ad9 | [
"MIT"
] | null | null | null | lamp/utils.py | Den4200/lamp | 85219d207863032b64e30d07c7ea05c4a5251ad9 | [
"MIT"
] | 3 | 2021-06-08T21:21:16.000Z | 2022-01-13T02:33:12.000Z | lamp/utils.py | Den4200/lamp | 85219d207863032b64e30d07c7ea05c4a5251ad9 | [
"MIT"
] | null | null | null | class SimpleSpriteList:
def __init__(self) -> None:
self.sprites = list()
def draw(self) -> None:
for sprite in self.sprites:
sprite.draw()
def update(self) -> None:
for sprite in self.sprites:
sprite.update()
def append(self, sprite) -> None:
self.sprites.append(sprite)
def remove(self, sprite) -> None:
self.sprites.remove(sprite)
def pop(self, index: int = -1):
self.sprites.pop(index)
def clear(self) -> None:
self.sprites.clear()
| 22.04 | 37 | 0.571688 | 66 | 551 | 4.712121 | 0.30303 | 0.247588 | 0.192926 | 0.122187 | 0.392283 | 0.231511 | 0.231511 | 0.231511 | 0 | 0 | 0 | 0.002597 | 0.30127 | 551 | 24 | 38 | 22.958333 | 0.805195 | 0 | 0 | 0.117647 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.411765 | false | 0 | 0 | 0 | 0.470588 | 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 |
d31dae9adebf377650654bacbc575ce6a85d5f52 | 989 | py | Python | spconv/pytorch/__init__.py | xiaobaishu0097/spconv | 4ef83629ea763477217a405f274fc870037eb93a | [
"Apache-2.0"
] | 909 | 2019-01-19T03:46:36.000Z | 2022-03-31T11:43:30.000Z | spconv/pytorch/__init__.py | xiaobaishu0097/spconv | 4ef83629ea763477217a405f274fc870037eb93a | [
"Apache-2.0"
] | 437 | 2019-01-21T04:58:21.000Z | 2022-03-31T02:02:04.000Z | spconv/pytorch/__init__.py | xiaobaishu0097/spconv | 4ef83629ea763477217a405f274fc870037eb93a | [
"Apache-2.0"
] | 277 | 2019-01-23T15:40:00.000Z | 2022-03-31T21:52:07.000Z | import platform
from pathlib import Path
import numpy as np
import torch
from spconv.pytorch import ops
from spconv.pytorch.conv import (SparseConv2d, SparseConv3d, SparseConvTranspose2d,
SparseConvTranspose3d, SparseInverseConv2d,
SparseInverseConv3d, SubMConv2d, SubMConv3d)
from spconv.pytorch.core import SparseConvTensor
from spconv.pytorch.identity import Identity
from spconv.pytorch.modules import SparseModule, SparseSequential
from spconv.pytorch.ops import ConvAlgo
from spconv.pytorch.pool import SparseMaxPool2d, SparseMaxPool3d
from spconv.pytorch.tables import AddTable, ConcatTable, JoinTable
class ToDense(SparseModule):
"""convert SparseConvTensor to NCHW dense tensor.
"""
def forward(self, x: SparseConvTensor):
return x.dense()
class RemoveGrid(SparseModule):
"""remove pre-allocated grid buffer.
"""
def forward(self, x: SparseConvTensor):
x.grid = None
return x
| 30.90625 | 83 | 0.743175 | 105 | 989 | 7 | 0.514286 | 0.108844 | 0.185034 | 0.040816 | 0.084354 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012516 | 0.192113 | 989 | 31 | 84 | 31.903226 | 0.907384 | 0.085945 | 0 | 0.095238 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.095238 | false | 0 | 0.571429 | 0.047619 | 0.857143 | 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 |
d32e981812eefc70b5f5249b4c36a24094b40e77 | 766 | py | Python | udacity/cs101-intro-cs/code/lesson2/problem-set/find_last.py | mi1980/projecthadoop3 | 32c83ceb14aef04c22ab9e428104f651ea8962e7 | [
"MIT"
] | null | null | null | udacity/cs101-intro-cs/code/lesson2/problem-set/find_last.py | mi1980/projecthadoop3 | 32c83ceb14aef04c22ab9e428104f651ea8962e7 | [
"MIT"
] | null | null | null | udacity/cs101-intro-cs/code/lesson2/problem-set/find_last.py | mi1980/projecthadoop3 | 32c83ceb14aef04c22ab9e428104f651ea8962e7 | [
"MIT"
] | 2 | 2018-02-25T03:35:30.000Z | 2018-08-18T12:14:05.000Z | # Define a procedure, find_last, that takes as input
# two strings, a search string and a target string,
# and returns the last position in the search string
# where the target string appears, or -1 if there
# are no occurrences.
#
# Example: find_last('aaaa', 'a') returns 3
# Make sure your procedure has a return statement.
def find_last(a,b):
if (a.find(b) == -1):
return -1
location = a.find(b)
while (a.find(b, location) != -1):
location = a.find(b, location) + 1
return location - 1
print find_last('aaaa', 'a')
#>>> 3
print find_last('aaaaa', 'aa')
#>>> 3
print find_last('aaaa', 'b')
#>>> -1
print find_last("111111111", "1")
#>>> 8
print find_last("222222222", "")
#>>> 9
print find_last("", "3")
#>>> -1
print find_last("", "")
#>>> 0 | 19.15 | 52 | 0.637076 | 123 | 766 | 3.886179 | 0.398374 | 0.167364 | 0.190377 | 0.087866 | 0.110879 | 0 | 0 | 0 | 0 | 0 | 0 | 0.054313 | 0.182768 | 766 | 40 | 53 | 19.15 | 0.709265 | 0.453003 | 0 | 0 | 0 | 0 | 0.091584 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.5 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.