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
c006713430a1286921b26ba7d255820f476df821
202
py
Python
gamefixes/203650.py
spacecowgirl314/protonfixes
418bbd0582ba5b76d0f591ef0368c284cc992572
[ "BSD-2-Clause" ]
null
null
null
gamefixes/203650.py
spacecowgirl314/protonfixes
418bbd0582ba5b76d0f591ef0368c284cc992572
[ "BSD-2-Clause" ]
null
null
null
gamefixes/203650.py
spacecowgirl314/protonfixes
418bbd0582ba5b76d0f591ef0368c284cc992572
[ "BSD-2-Clause" ]
null
null
null
""" Game fix for Sonic the Hedgehog 4: Episode II """ #pylint: disable=C0103 from protonfixes import util def main(): """ lock to 60 fps """ util.set_environment('DXVK_FRAME_RATE', '60')
16.833333
49
0.658416
29
202
4.482759
0.931034
0
0
0
0
0
0
0
0
0
0
0.05625
0.207921
202
11
50
18.363636
0.75625
0.430693
0
0
0
0
0.168317
0
0
0
0
0
0
1
0.333333
true
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
1
0
0
0
0
4
c06b43734c960b7d87d2c63553d616b5846c0ab5
101
py
Python
typings/argcomplete/__init__.py
lawpeople/polish-law
4e15386b4bcde0538c52a46e48fff2e785b6303e
[ "MIT" ]
null
null
null
typings/argcomplete/__init__.py
lawpeople/polish-law
4e15386b4bcde0538c52a46e48fff2e785b6303e
[ "MIT" ]
5
2021-12-25T18:49:21.000Z
2022-01-03T01:13:04.000Z
typings/argcomplete/__init__.py
lawpeople/polish-law
4e15386b4bcde0538c52a46e48fff2e785b6303e
[ "MIT" ]
null
null
null
import argparse def autocomplete(argument_parser: argparse.ArgumentParser | None) -> None: ...
16.833333
74
0.732673
10
101
7.3
0.8
0
0
0
0
0
0
0
0
0
0
0
0.158416
101
5
75
20.2
0.858824
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
0
0
0
0
4
2204e0db1aba987491c23dcfa047f9713bfb7788
27
py
Python
python/testData/intentions/transformConditionalExpression.py
jnthn/intellij-community
8fa7c8a3ace62400c838e0d5926a7be106aa8557
[ "Apache-2.0" ]
2
2019-04-28T07:48:50.000Z
2020-12-11T14:18:08.000Z
python/testData/intentions/transformConditionalExpression.py
Cyril-lamirand/intellij-community
60ab6c61b82fc761dd68363eca7d9d69663cfa39
[ "Apache-2.0" ]
173
2018-07-05T13:59:39.000Z
2018-08-09T01:12:03.000Z
python/testData/intentions/transformConditionalExpression.py
Cyril-lamirand/intellij-community
60ab6c61b82fc761dd68363eca7d9d69663cfa39
[ "Apache-2.0" ]
2
2020-03-15T08:57:37.000Z
2020-04-07T04:48:14.000Z
x = a if <caret>cond else b
27
27
0.666667
7
27
2.571429
1
0
0
0
0
0
0
0
0
0
0
0
0.222222
27
1
27
27
0.857143
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
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
1
0
0
0
0
0
0
0
0
4
220ab68ec24527cd6935fbb3fe061c2ab0767f2e
132
py
Python
carp_api/__main__.py
Drachenfels/carp-api
b7f280a645d5116d85dc7cd1d177b449704457de
[ "MIT" ]
null
null
null
carp_api/__main__.py
Drachenfels/carp-api
b7f280a645d5116d85dc7cd1d177b449704457de
[ "MIT" ]
null
null
null
carp_api/__main__.py
Drachenfels/carp-api
b7f280a645d5116d85dc7cd1d177b449704457de
[ "MIT" ]
null
null
null
"""Alias for carp_api.run for the command line. """ if __name__ == "__main__": from .cli import main main(as_module=True)
16.5
47
0.666667
20
132
3.9
0.85
0
0
0
0
0
0
0
0
0
0
0
0.204545
132
7
48
18.857143
0.742857
0.333333
0
0
0
0
0.098765
0
0
0
0
0
0
1
0
true
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
1
0
1
0
0
0
0
4
225ec4d4d911dd75de2bc4d6d621012cc33b6c7d
161
py
Python
app/models/phone.py
olivierpons/evalr
7c76474ad41769804965a11550501321d7b1889b
[ "MIT" ]
null
null
null
app/models/phone.py
olivierpons/evalr
7c76474ad41769804965a11550501321d7b1889b
[ "MIT" ]
null
null
null
app/models/phone.py
olivierpons/evalr
7c76474ad41769804965a11550501321d7b1889b
[ "MIT" ]
null
null
null
from django.db import models from app.models.base import BaseModel class Phone(BaseModel): phone = models.CharField(max_length=30, blank=True, null=True)
20.125
66
0.770186
24
161
5.125
0.708333
0
0
0
0
0
0
0
0
0
0
0.014388
0.136646
161
7
67
23
0.870504
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
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
1
0
0
4
97ed582cd28708654c59628d98f27dc09ead932a
1,977
py
Python
model/careteam.py
beda-software/fhir-py-experements
363cfb894fa6f971b9be19340cae1b0a3a4377d8
[ "MIT" ]
null
null
null
model/careteam.py
beda-software/fhir-py-experements
363cfb894fa6f971b9be19340cae1b0a3a4377d8
[ "MIT" ]
null
null
null
model/careteam.py
beda-software/fhir-py-experements
363cfb894fa6f971b9be19340cae1b0a3a4377d8
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Generated from FHIR 4.0.1-9346c8cc45 (http://hl7.org/fhir/StructureDefinition/CareTeam) on 2020-02-03. # 2020, SMART Health IT. import sys from dataclasses import dataclass, field from typing import ClassVar, Optional, List from .annotation import Annotation from .backboneelement import BackboneElement from .codeableconcept import CodeableConcept from .contactpoint import ContactPoint from .domainresource import DomainResource from .fhirreference import FHIRReference from .identifier import Identifier from .period import Period @dataclass class CareTeamParticipant(BackboneElement): """ Members of the team. Identifies all people and organizations who are expected to be involved in the care team. """ resource_type: ClassVar[str] = "CareTeamParticipant" role: Optional[List[CodeableConcept]] = None member: Optional[FHIRReference] = None onBehalfOf: Optional[FHIRReference] = None period: Optional[Period] = None @dataclass class CareTeam(DomainResource): """ Planned participants in the coordination and delivery of care for a patient or group. The Care Team includes all the people and organizations who plan to participate in the coordination and delivery of care for a patient. """ resource_type: ClassVar[str] = "CareTeam" identifier: Optional[List[Identifier]] = None status: Optional[str] = None category: Optional[List[CodeableConcept]] = None name: Optional[str] = None subject: Optional[FHIRReference] = None encounter: Optional[FHIRReference] = None period: Optional[Period] = None participant: Optional[List[CareTeamParticipant]] = None reasonCode: Optional[List[CodeableConcept]] = None reasonReference: Optional[List[FHIRReference]] = None managingOrganization: Optional[List[FHIRReference]] = None telecom: Optional[List[ContactPoint]] = None note: Optional[List[Annotation]] = None
34.684211
105
0.748609
224
1,977
6.598214
0.410714
0.081191
0.067659
0.062923
0.127199
0.127199
0.127199
0.060893
0.060893
0.060893
0
0.014572
0.16692
1,977
57
106
34.684211
0.882817
0.255438
0
0.117647
1
0
0.018934
0
0
0
0
0
0
1
0
true
0
0.323529
0
0.941176
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
1
0
1
0
0
4
3f0446252a05812843192cd265a71a15c09f0038
397
py
Python
src/TB3Util/tb3bank.py
csvance/tb3util
63191c4e9fddec809d3943f9ee402eae0e2d4659
[ "MIT" ]
null
null
null
src/TB3Util/tb3bank.py
csvance/tb3util
63191c4e9fddec809d3943f9ee402eae0e2d4659
[ "MIT" ]
null
null
null
src/TB3Util/tb3bank.py
csvance/tb3util
63191c4e9fddec809d3943f9ee402eae0e2d4659
[ "MIT" ]
null
null
null
#Represents the entire memory bank of the TB-3 (64 patterns in total) class TB3Bank: BANK_SIZE = 64 def __init__(self,patterns=None): if(patterns != None): self.patterns = patterns else: self.patterns = [] def get_patterns(self): return self.patterns def get_pattern(self,index): return self.patterns[index] def add_pattern(self,pattern): self.patterns.append(pattern)
22.055556
69
0.722922
57
397
4.894737
0.473684
0.258065
0.107527
0.129032
0
0
0
0
0
0
0
0.018237
0.171285
397
17
70
23.352941
0.829787
0.171285
0
0
0
0
0
0
0
0
0
0
0
1
0.307692
false
0
0
0.153846
0.615385
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
3f12448b794265e12e69b5215599d48b8986ae51
79
py
Python
vendor/packages/sqlalchemy/lib/sqlalchemy/dialects/maxdb/__init__.py
jgmize/kitsune
8f23727a9c7fcdd05afc86886f0134fb08d9a2f0
[ "BSD-3-Clause" ]
2
2016-05-09T09:17:35.000Z
2016-08-03T16:30:16.000Z
lib/sqlalchemy/dialects/maxdb/__init__.py
clones/sqlalchemy
c9f08aa78a48ba53dd221d3c5de54e5956ecf806
[ "MIT" ]
null
null
null
lib/sqlalchemy/dialects/maxdb/__init__.py
clones/sqlalchemy
c9f08aa78a48ba53dd221d3c5de54e5956ecf806
[ "MIT" ]
null
null
null
from sqlalchemy.dialects.maxdb import base, sapdb base.dialect = sapdb.dialect
26.333333
49
0.822785
11
79
5.909091
0.727273
0
0
0
0
0
0
0
0
0
0
0
0.101266
79
3
50
26.333333
0.915493
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
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
1
0
1
0
0
0
0
4
3f351e0092f7585c3528a8662f49ebfd24cdaf50
1,107
py
Python
modules/wireless/mana-toolkit.py
nimert007/The-Penetration-Testers-Framework-PTF-
d8f7ae02b6655df93e1cabbca8481b5df55bd4c0
[ "FTL" ]
4
2020-09-03T02:26:23.000Z
2022-02-25T06:57:25.000Z
modules/wireless/mana-toolkit.py
Ben0xA/ptf
ebcc7a192c1286b962a826ec8e6f48334926b675
[ "FTL" ]
null
null
null
modules/wireless/mana-toolkit.py
Ben0xA/ptf
ebcc7a192c1286b962a826ec8e6f48334926b675
[ "FTL" ]
1
2021-03-01T17:28:53.000Z
2021-03-01T17:28:53.000Z
#!/usr/bin/env python ####################################### # Installation module for mana-toolkit ####################################### # AUTHOR OF MODULE NAME AUTHOR="jklaz" # DESCRIPTION OF THE MODULE DESCRIPTION="This module will install/update the mana-toolkit" # INSTALL TYPE GIT, SVN, FILE DOWNLOAD # OPTIONS = GIT, SVN, FILE INSTALL_TYPE="GIT" # LOCATION OF THE FILE OR GIT/SVN REPOSITORY REPOSITORY_LOCATION="https://github.com/sensepost/mana" # WHERE DO YOU WANT TO INSTALL IT INSTALL_LOCATION="mana" # DEPENDS FOR DEBIAN INSTALLS DEBIAN="libnl-dev,isc-dhcp-server,tinyproxy,libssl-dev,apache2,macchanger,python-dnspython,python-pcapy,dsniff,stunnel4,python-scapy" # DEPENDS FOR FEDORA INSTALLS FEDORA="git,libnl,dhcp-forwarder,tinyproxy,openssl,httpd,macchanger,python-dns,pcapy,dsniff,stunnel,scapy,sslsplit" #In order to check new versions of sslstrip+ and net-creds BYPASS_UPDATE="YES" # COMMANDS TO RUN AFTER AFTER_COMMANDS="git clone --depth 1 https://github.com/sensepost/mana {INSTALL_LOCATION},cd {INSTALL_LOCATION},git submodule init,git submodule update,make,make install"
33.545455
169
0.735321
152
1,107
5.309211
0.546053
0.022305
0.034696
0.057001
0.066915
0
0
0
0
0
0
0.003
0.096658
1,107
32
170
34.59375
0.804
0.34056
0
0
0
0.333333
0.746875
0.426563
0
0
0
0
0
1
0
false
0.111111
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
null
0
0
0
0
0
0
0
1
0
0
0
0
0
4
3f5b26bc9b90be90e0fce4f8a1c79d2cbe33d4dc
157
py
Python
settings.py
carlosalbertm/tweet-bot
181d0190d342df02f52220e561172ec24d74e3f9
[ "MIT" ]
null
null
null
settings.py
carlosalbertm/tweet-bot
181d0190d342df02f52220e561172ec24d74e3f9
[ "MIT" ]
null
null
null
settings.py
carlosalbertm/tweet-bot
181d0190d342df02f52220e561172ec24d74e3f9
[ "MIT" ]
null
null
null
APP_KEY = 'your APP_KEY' APP_SECRET = 'your APP_SECRET' OAUTH_TOKEN = 'your OAUTH_TOKEN' OAUTH_TOKEN_SECRET = 'your OAUTH_TOKEN_SECRET' ROUTE = 'your ROUTE'
26.166667
46
0.77707
25
157
4.48
0.28
0.357143
0.25
0
0
0
0
0
0
0
0
0
0.127389
157
5
47
31.4
0.817518
0
0
0
0
0
0.484076
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
58aab4906cb0fc125b5a7885fa921da1b27bd083
136
py
Python
Questionnaire/templatetags/index.py
CHESyrian/Estebyan
015c0a8e95d033af04ba949942da79a4f5a90488
[ "MIT" ]
null
null
null
Questionnaire/templatetags/index.py
CHESyrian/Estebyan
015c0a8e95d033af04ba949942da79a4f5a90488
[ "MIT" ]
null
null
null
Questionnaire/templatetags/index.py
CHESyrian/Estebyan
015c0a8e95d033af04ba949942da79a4f5a90488
[ "MIT" ]
null
null
null
from django import template register = template.Library() @register.filter(name='index') def index(value, ndx): return value[ndx]
17
30
0.735294
18
136
5.555556
0.722222
0.16
0
0
0
0
0
0
0
0
0
0
0.139706
136
7
31
19.428571
0.854701
0
0
0
0
0
0.036765
0
0
0
0
0
0
1
0.2
false
0
0.2
0.2
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
1
1
0
0
4
58ad1489d447baa8bd631b553d8b936fdeb1dd95
49
py
Python
data/studio21_generated/introductory/2915/starter_code.py
vijaykumawat256/Prompt-Summarization
614f5911e2acd2933440d909de2b4f86653dc214
[ "Apache-2.0" ]
null
null
null
data/studio21_generated/introductory/2915/starter_code.py
vijaykumawat256/Prompt-Summarization
614f5911e2acd2933440d909de2b4f86653dc214
[ "Apache-2.0" ]
null
null
null
data/studio21_generated/introductory/2915/starter_code.py
vijaykumawat256/Prompt-Summarization
614f5911e2acd2933440d909de2b4f86653dc214
[ "Apache-2.0" ]
null
null
null
def check_availability(schedule, current_time):
24.5
47
0.836735
6
49
6.5
1
0
0
0
0
0
0
0
0
0
0
0
0.081633
49
2
48
24.5
0.866667
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
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
1
0
0
0
0
0
0
0
0
4
58fdb157389043cee52fdafa4a52de11e417fe06
243
py
Python
bblfsh/__init__.py
ncordon/python-client
bb48ac68a156418606039bf3a81ff61c45bfb3ca
[ "Apache-2.0" ]
14
2017-07-10T08:21:55.000Z
2019-03-21T07:19:29.000Z
bblfsh/__init__.py
ncordon/python-client
bb48ac68a156418606039bf3a81ff61c45bfb3ca
[ "Apache-2.0" ]
100
2017-06-14T20:49:46.000Z
2019-07-02T10:01:46.000Z
bblfsh/__init__.py
ncordon/python-client
bb48ac68a156418606039bf3a81ff61c45bfb3ca
[ "Apache-2.0" ]
26
2017-06-14T13:30:29.000Z
2019-07-04T14:02:00.000Z
from bblfsh.client import BblfshClient from bblfsh.pyuast import decode, iterator, uast from bblfsh.tree_order import TreeOrder from bblfsh.aliases import * from bblfsh.roles import role_id, role_name from bblfsh.result_context import context
34.714286
48
0.847737
36
243
5.611111
0.527778
0.29703
0
0
0
0
0
0
0
0
0
0
0.111111
243
6
49
40.5
0.935185
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
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
1
0
0
0
0
4
451cba144ed4ed5673fdd04bdb70d77d84cba3c5
202
py
Python
sitetables/__init__.py
idlesign/django-sitetables
9ed851f646c5517234eb40304cfa38fa71c57884
[ "BSD-3-Clause" ]
4
2020-08-15T14:42:29.000Z
2022-01-16T16:09:20.000Z
sitetables/__init__.py
idlesign/django-sitetables
9ed851f646c5517234eb40304cfa38fa71c57884
[ "BSD-3-Clause" ]
null
null
null
sitetables/__init__.py
idlesign/django-sitetables
9ed851f646c5517234eb40304cfa38fa71c57884
[ "BSD-3-Clause" ]
null
null
null
VERSION = (0, 2, 1) """Application version number tuple.""" VERSION_STR = '.'.join(map(str, VERSION)) """Application version number string.""" default_app_config = 'sitetables.apps.SitetablesConfig'
22.444444
55
0.717822
24
202
5.916667
0.708333
0.253521
0.338028
0
0
0
0
0
0
0
0
0.01676
0.113861
202
9
55
22.444444
0.776536
0
0
0
0
0
0.268293
0.260163
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
4525f5d640830a0a6e890a23f89117e16bd1e2f9
153
py
Python
Sumit Awasthi/W2Q3.py
asumit499/Python-BootCamp
0b99f9cb862189d13ad291eac12a8be6c46357f5
[ "MIT" ]
4
2022-03-20T10:59:53.000Z
2022-03-25T18:28:04.000Z
Sumit Awasthi/W2Q3.py
asumit499/Python-BootCamp
0b99f9cb862189d13ad291eac12a8be6c46357f5
[ "MIT" ]
null
null
null
Sumit Awasthi/W2Q3.py
asumit499/Python-BootCamp
0b99f9cb862189d13ad291eac12a8be6c46357f5
[ "MIT" ]
15
2022-03-12T11:49:10.000Z
2022-03-15T06:22:55.000Z
i = input("Enter a number: ") d = '0369' if i[-1] in d: print('Last digit is divisible by 3.') else: print('Last digit is not divisible by 3.')
21.857143
46
0.607843
28
153
3.321429
0.678571
0.193548
0.301075
0.344086
0
0
0
0
0
0
0
0.059829
0.235294
153
6
47
25.5
0.735043
0
0
0
0
0
0.535948
0
0
0
0
0
0
1
0
false
0
0
0
0
0.333333
1
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
4
18d860750e44460c84a605bafe4d8bb1d1c9fe6e
869
py
Python
Regulations/Programmed.py
sybila/eBCSgen
d3e66c84eb908c989d22efbee20e41766948bdec
[ "MIT" ]
1
2020-11-09T15:51:35.000Z
2020-11-09T15:51:35.000Z
Regulations/Programmed.py
sybila/eBCSgen
d3e66c84eb908c989d22efbee20e41766948bdec
[ "MIT" ]
33
2020-01-29T09:51:45.000Z
2022-03-30T10:09:32.000Z
Regulations/Programmed.py
sybila/eBCSgen
d3e66c84eb908c989d22efbee20e41766948bdec
[ "MIT" ]
1
2020-09-07T11:24:22.000Z
2020-09-07T11:24:22.000Z
from Regulations.Base import BaseRegulation class Programmed(BaseRegulation): """ Regulation defined as successor function for every rule. Only set of successor rules is allowed to be used in the next step. """ def __init__(self, regulation): super().__init__(regulation) self.memory = 1 def __str__(self): return "Successors: " + str(self.regulation) def __repr__(self): # TODO return "type programmed\n" + str(self.regulation) def filter(self, current_state, candidates): if len(current_state.memory.history) == 0: return candidates last_rule = current_state.memory.history[-1] if last_rule in self.regulation: return {rule: values for rule, values in candidates.items() if rule.label in self.regulation[last_rule]} return candidates
32.185185
116
0.663982
106
869
5.235849
0.5
0.126126
0.061261
0.072072
0
0
0
0
0
0
0
0.004601
0.249712
869
26
117
33.423077
0.846626
0.149597
0
0.125
0
0
0.040334
0
0
0
0
0.038462
0
1
0.25
false
0
0.0625
0.125
0.6875
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
1
0
0
0
1
1
0
0
4
18dd37d1f8c91313f5666131557fdf9c37c0566c
299
py
Python
snapshot_field/compat.py
Apkawa/django-snapshot-field
431055e7c78bbb40e54de54ceb2005f8ce618e31
[ "MIT" ]
null
null
null
snapshot_field/compat.py
Apkawa/django-snapshot-field
431055e7c78bbb40e54de54ceb2005f8ce618e31
[ "MIT" ]
1
2019-12-16T10:33:47.000Z
2019-12-16T10:33:47.000Z
snapshot_field/compat.py
Apkawa/django-snapshot-field
431055e7c78bbb40e54de54ceb2005f8ce618e31
[ "MIT" ]
null
null
null
def get_label_lower(opts): if hasattr(opts, 'label_lower'): return opts.label_lower model_label = opts.model_name app_label = opts.app_label return "{app_label}.{model_label}".format(app_label=app_label, model_label=model_label)
37.375
70
0.622074
38
299
4.526316
0.315789
0.232558
0.261628
0.209302
0
0
0
0
0
0
0
0
0.287625
299
7
71
42.714286
0.807512
0
0
0
0
0
0.120401
0.083612
0
0
0
0
0
1
0.142857
false
0
0
0
0.428571
0
0
0
0
null
1
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
4
18f8d982a78185aa8a3b75f434d4d705ab678910
281
py
Python
build/python/tests/lib/lib.py
allansrc/fuchsia
a2c235b33fc4305044d496354a08775f30cdcf37
[ "BSD-2-Clause" ]
210
2019-02-05T12:45:09.000Z
2022-03-28T07:59:06.000Z
build/python/tests/lib/lib.py
allansrc/fuchsia
a2c235b33fc4305044d496354a08775f30cdcf37
[ "BSD-2-Clause" ]
56
2021-06-03T03:16:25.000Z
2022-03-20T01:07:44.000Z
build/python/tests/lib/lib.py
allansrc/fuchsia
a2c235b33fc4305044d496354a08775f30cdcf37
[ "BSD-2-Clause" ]
73
2019-03-06T18:55:23.000Z
2022-03-26T12:04:51.000Z
#!/usr/bin/env python3.8 # Copyright 2021 The Fuchsia Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. def f(): print('lib.f') def truthy(): return True def falsy(): return False
15.611111
72
0.683274
46
281
4.173913
0.869565
0
0
0
0
0
0
0
0
0
0
0.027397
0.220641
281
17
73
16.529412
0.849315
0.633452
0
0
0
0
0.050505
0
0
0
0
0
0
1
0.5
true
0
0
0.333333
0.833333
0.166667
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
0
1
1
0
0
4
e13b8d455ff041bc1df5883e471b8508bb84b71b
93
py
Python
emojiauth/apps.py
mahrous-amer/FYP
0888aa64b53b4dcbd6f214b6b65cff1d5c868254
[ "MIT" ]
2
2020-07-12T11:54:37.000Z
2020-07-15T09:30:12.000Z
emojiauth/apps.py
mahrous-amer/FYP
0888aa64b53b4dcbd6f214b6b65cff1d5c868254
[ "MIT" ]
5
2020-12-13T16:31:20.000Z
2021-11-05T14:02:07.000Z
emojiauth/apps.py
mahrous-amer/FYP
0888aa64b53b4dcbd6f214b6b65cff1d5c868254
[ "MIT" ]
null
null
null
from django.apps import AppConfig class emojiauthConfig(AppConfig): name = 'emojiauth'
15.5
33
0.763441
10
93
7.1
0.9
0
0
0
0
0
0
0
0
0
0
0
0.16129
93
5
34
18.6
0.910256
0
0
0
0
0
0.096774
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
1
0
0
4
e150b7c805368d7177ea3742c599a9c074723593
121
py
Python
setup.py
the-blue-alliance/gdcv-backend
ec77c1c4a9bf3c8de0581d351b3df0baf8d5cebf
[ "MIT" ]
4
2018-02-03T21:10:40.000Z
2022-02-17T10:51:54.000Z
setup.py
the-blue-alliance/gdcv-backend
ec77c1c4a9bf3c8de0581d351b3df0baf8d5cebf
[ "MIT" ]
1
2020-01-27T18:10:19.000Z
2020-01-27T18:10:19.000Z
setup.py
the-blue-alliance/gdcv-backend
ec77c1c4a9bf3c8de0581d351b3df0baf8d5cebf
[ "MIT" ]
2
2018-02-07T20:23:02.000Z
2018-02-22T22:48:18.000Z
from setuptools import setup, find_packages setup(name='gdcv', version='0.1.0', packages=find_packages(), )
17.285714
43
0.677686
16
121
5
0.6875
0.3
0
0
0
0
0
0
0
0
0
0.030303
0.181818
121
6
44
20.166667
0.777778
0
0
0
0
0
0.07438
0
0
0
0
0
0
1
0
true
0
0.2
0
0.2
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
1
0
0
0
0
0
0
4
e1a12eb3a4d430c8d1d8738efc299a3c882d9c60
142
py
Python
beholder/analyzer/site.py
eryktr/beholder
31bf6a5bf20176fb990dc2e0f84043000bdfe188
[ "MIT" ]
null
null
null
beholder/analyzer/site.py
eryktr/beholder
31bf6a5bf20176fb990dc2e0f84043000bdfe188
[ "MIT" ]
null
null
null
beholder/analyzer/site.py
eryktr/beholder
31bf6a5bf20176fb990dc2e0f84043000bdfe188
[ "MIT" ]
null
null
null
from pathlib import Path from typing import NamedTuple class Site(NamedTuple): addr: str reference_path: Path update_path: Path
15.777778
29
0.746479
19
142
5.473684
0.631579
0.153846
0
0
0
0
0
0
0
0
0
0
0.211268
142
8
30
17.75
0.928571
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
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
1
0
1
0
0
0
0
4
e1a6bd4939e57786d0e1984eff4a15b5cbc615e4
259
py
Python
tests/functional/test_contracts.py
defidipshit/ape
5e003ee5003ca2491aeba9d0d262a8e9e138e084
[ "Apache-2.0" ]
1
2022-01-25T21:26:01.000Z
2022-01-25T21:26:01.000Z
tests/functional/test_contracts.py
violetsummerzine/ape
8b39dc3d068dea98ec68e17c5b5446dfa8f9a7e3
[ "Apache-2.0" ]
null
null
null
tests/functional/test_contracts.py
violetsummerzine/ape
8b39dc3d068dea98ec68e17c5b5446dfa8f9a7e3
[ "Apache-2.0" ]
null
null
null
from ape import Contract from ape.api import Address def test_init_at_unknown_address(): address = "0x274b028b03A250cA03644E6c578D81f019eE1323" contract = Contract(address) assert type(contract) == Address assert contract.address == address
25.9
58
0.772201
28
259
7
0.5
0.229592
0.214286
0
0
0
0
0
0
0
0
0.138249
0.162162
259
9
59
28.777778
0.764977
0
0
0
0
0
0.162162
0.162162
0
0
0.162162
0
0.285714
1
0.142857
false
0
0.285714
0
0.428571
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
e1ba2813652b4227441884b44c130fc0ff921014
252
py
Python
01-logica-de-programacao-e-algoritmos/Aula 06/5 Trabalhando com metodos em strings/5.4 Substituindo Strings/ex01.py
rafaelbarretomg/Uninter
1f84b0103263177122663e991db3a8aeb106a959
[ "MIT" ]
null
null
null
01-logica-de-programacao-e-algoritmos/Aula 06/5 Trabalhando com metodos em strings/5.4 Substituindo Strings/ex01.py
rafaelbarretomg/Uninter
1f84b0103263177122663e991db3a8aeb106a959
[ "MIT" ]
null
null
null
01-logica-de-programacao-e-algoritmos/Aula 06/5 Trabalhando com metodos em strings/5.4 Substituindo Strings/ex01.py
rafaelbarretomg/Uninter
1f84b0103263177122663e991db3a8aeb106a959
[ "MIT" ]
null
null
null
# substituindo com o metodo replace s1 = 'Um mafagafinho, dois mafagafinhos, tres mafagafinhos...' print(s1.replace('mafagafinho', 'gatinho')) # podemos adicionar a quantidade substituicao que sera feitas print(s1.replace('mafagafinho', 'gatinho', 1))
42
62
0.765873
31
252
6.225806
0.709677
0.072539
0.145078
0.259067
0.331606
0
0
0
0
0
0
0.017857
0.111111
252
5
63
50.4
0.84375
0.369048
0
0
0
0
0.583333
0
0
0
0
0.2
0
1
0
false
0
0
0
0
0.666667
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
1
0
0
0
0
0
0
0
0
1
0
4
e1bbddb2c89376d1cb097d0c8fb45b32e0bca871
291
py
Python
web-api/berries/views.py
Egor4ik325/anyberry
87787f82f1cec0f32d9d7c7384e7b2771f34af3c
[ "MIT" ]
1
2021-09-12T16:28:52.000Z
2021-09-12T16:28:52.000Z
web-api/berries/views.py
Egor4ik325/anyberry
87787f82f1cec0f32d9d7c7384e7b2771f34af3c
[ "MIT" ]
2
2021-09-06T08:31:56.000Z
2021-09-06T08:35:25.000Z
web-api/berries/views.py
Egor4ik325/anyberry
87787f82f1cec0f32d9d7c7384e7b2771f34af3c
[ "MIT" ]
null
null
null
from rest_framework.viewsets import ReadOnlyModelViewSet from .serializers import BerrySerializer from .models import Berry class BerryViewSet(ReadOnlyModelViewSet): """Berry API view/presentation (READONLY).""" serializer_class = BerrySerializer queryset = Berry.berries.all()
32.333333
56
0.797251
29
291
7.931034
0.689655
0
0
0
0
0
0
0
0
0
0
0
0.127148
291
9
57
32.333333
0.905512
0.134021
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
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
1
0
0
4
e1bc0879b60d0cb1b4cc67972defbea7da7e3d55
93
py
Python
pysml/__init__.py
stillwwater/pysml
7e388738d4b8e78dbc40fc9b3ec42d580ff75033
[ "MIT" ]
null
null
null
pysml/__init__.py
stillwwater/pysml
7e388738d4b8e78dbc40fc9b3ec42d580ff75033
[ "MIT" ]
null
null
null
pysml/__init__.py
stillwwater/pysml
7e388738d4b8e78dbc40fc9b3ec42d580ff75033
[ "MIT" ]
null
null
null
from .kmeans import kmeans from .cluster import Estimator __all__ = ['Estimator', 'kmeans']
18.6
33
0.752688
11
93
6
0.545455
0
0
0
0
0
0
0
0
0
0
0
0.139785
93
4
34
23.25
0.825
0
0
0
0
0
0.16129
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
bed0b72d889e18d15dca063a317cf4e8174cbe57
216
py
Python
easyus/core/views.py
xiahuang119/easyus
aaa6b7f1356d32988b334d87bb440850ac74e3e3
[ "BSD-3-Clause" ]
null
null
null
easyus/core/views.py
xiahuang119/easyus
aaa6b7f1356d32988b334d87bb440850ac74e3e3
[ "BSD-3-Clause" ]
null
null
null
easyus/core/views.py
xiahuang119/easyus
aaa6b7f1356d32988b334d87bb440850ac74e3e3
[ "BSD-3-Clause" ]
null
null
null
from django.views.generic import TemplateView from django.views.decorators.cache import cache_page class HomeView(TemplateView): template_name = 'pages/home.html' home = cache_page(60 * 10)(HomeView.as_view())
27
52
0.787037
30
216
5.533333
0.666667
0.120482
0.180723
0
0
0
0
0
0
0
0
0.020833
0.111111
216
7
53
30.857143
0.84375
0
0
0
0
0
0.069444
0
0
0
0
0
0
1
0
false
0
0.4
0
0.8
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
1
0
0
4
beeba70fbc8a5a322610f07c70ecc75ffcead775
2,843
py
Python
dashboard/core/models.py
Aditya-0912/recon
6e310cdd56caf678af54c27f2c3c97f56fb08119
[ "MIT" ]
null
null
null
dashboard/core/models.py
Aditya-0912/recon
6e310cdd56caf678af54c27f2c3c97f56fb08119
[ "MIT" ]
null
null
null
dashboard/core/models.py
Aditya-0912/recon
6e310cdd56caf678af54c27f2c3c97f56fb08119
[ "MIT" ]
null
null
null
from django.db import models class Employee(models.Model): name = models.CharField(max_length=150) position = models.CharField(max_length=150) office = models.CharField(max_length=150) age = models.PositiveIntegerField() start_date = models.DateField() salary = models.PositiveIntegerField() def __str__(self): return self.name class reco_data(models.Model): Reference_ID = models.CharField(max_length=150) Receipt_No = models.CharField(max_length=150) Order_ID = models.CharField(max_length=150) Branch_name = models.CharField(max_length=150) Branch_code = models.CharField(max_length=150) Transaction_date = models.CharField(max_length=150) Channel_Partner =models.CharField(max_length=150) Amount =models.CharField(max_length=150) unmatched_data_count=models.CharField(max_length=150) class merchant_data(models.Model): branch_name = models.CharField(max_length=150) branch_Code = models.CharField(max_length=150) Business_Date = models.CharField(max_length=150) ReceiptNo = models.CharField(max_length=150) ReferenceID = models.CharField(max_length=150) OrderId = models.CharField(max_length=150) ProfitCenterType =models.CharField(max_length=150) comments =models.CharField(max_length=150) entry_date =models.CharField(max_length=150) net_amount =models.CharField(max_length=150) class transaction_data(models.Model): ID_No = models.CharField(max_length=150) Order_ref_ID = models.CharField(max_length=150) External_Platform_ID = models.CharField(max_length=150) Channel = models.CharField(max_length=150) Created_Date = models.CharField(max_length=150) Order_State = models.CharField(max_length=150) Request_Delivery_Time =models.CharField(max_length=150) Time_Slot_Start =models.CharField(max_length=150) Time_Slot_End =models.CharField(max_length=150) Payment_Mode =models.CharField(max_length=150) Payment_Transaction_ID =models.CharField(max_length=150) Customer_Name =models.CharField(max_length=150) Customer_ID =models.CharField(max_length=150) Store_Name =models.CharField(max_length=150) Store_ID =models.CharField(max_length=150) Store_ref_ID =models.CharField(max_length=150) Total_Amount =models.CharField(max_length=150) Merchant_Total =models.CharField(max_length=150) Sub_total_Amount =models.CharField(max_length=150) Discount =models.CharField(max_length=150) Aggregator_Discount =models.CharField(max_length=150) Merchant_Discount =models.CharField(max_length=150) Taxes =models.CharField(max_length=150) Charges =models.CharField(max_length=150) Fulfillment_mode =models.CharField(max_length=150) Wallet_credit_amount =models.CharField(max_length=150) City =models.CharField(max_length=150)
42.432836
60
0.772072
379
2,843
5.522427
0.192612
0.351171
0.421405
0.561873
0.766842
0.58624
0.236025
0.070712
0.070712
0.070712
0
0.059442
0.130144
2,843
66
61
43.075758
0.786899
0
0
0
0
0
0
0
0
0
0
0
0
1
0.016949
false
0
0.016949
0.016949
1
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
1
0
0
4
8305fd93dad770461d846d8bf9c0d47dd3a2a377
116
py
Python
test_kivy/test_kvv/Ba/tela.py
robertoweller/python
b01939810f7eb388f4b79bfad00abc5fb293d8dd
[ "MIT" ]
2
2020-02-08T01:28:00.000Z
2020-02-08T01:28:03.000Z
Data_Conversion/tela.py
robertoweller/GUI-Chess-Implementation-in-Python
f6ea3a93971a0177066c725233d3a2ed39023296
[ "MIT" ]
null
null
null
Data_Conversion/tela.py
robertoweller/GUI-Chess-Implementation-in-Python
f6ea3a93971a0177066c725233d3a2ed39023296
[ "MIT" ]
null
null
null
def tam(): '''Futuramente facilitar o mudo de como mundar o tamanho das peças.''' tel = 1.25 return tel
23.2
74
0.637931
18
116
4.111111
0.888889
0
0
0
0
0
0
0
0
0
0
0.034884
0.258621
116
4
75
29
0.825581
0.551724
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
8332b5d62a1bfba43b18e11880e72b5c2b7ee7f7
931
py
Python
DailyProgrammer/DP20171113A.py
DayGitH/Python-Challenges
bc32f1332a92fcc2dfa6f5ea4d95f8a8d64c3edf
[ "MIT" ]
2
2020-12-23T18:59:22.000Z
2021-04-14T13:16:09.000Z
DailyProgrammer/DP20171113A.py
DayGitH/Python-Challenges
bc32f1332a92fcc2dfa6f5ea4d95f8a8d64c3edf
[ "MIT" ]
null
null
null
DailyProgrammer/DP20171113A.py
DayGitH/Python-Challenges
bc32f1332a92fcc2dfa6f5ea4d95f8a8d64c3edf
[ "MIT" ]
null
null
null
""" [2017-11-13] Challenge #340 [Easy] First Recurring Character https://www.reddit.com/r/dailyprogrammer/comments/7cnqtw/20171113_challenge_340_easy_first_recurring/ # Description Write a program that outputs the first recurring character in a string. # Formal Inputs & Outputs ## Input Description A string of alphabetical characters. Example: ABCDEBC ## Output description The first recurring character from the input. From the above example: B # Challenge Input IKEUNFUVFV PXLJOUDJVZGQHLBHGXIW *l1J?)yn%R[}9~1"=k7]9;0[$ # Bonus Return the index (0 or 1 based, but please specify) where the original character is found in the string. # Credit This challenge was suggested by user /u/HydratedCabbage, many thanks! Have a good challenge idea? Consider submitting it to /r/dailyprogrammer_ideas and there's a good chance we'll use it. """ def main(): pass if __name__ == "__main__": main()
27.382353
118
0.747583
134
931
5.089552
0.664179
0.082111
0.101173
0.061584
0.087977
0
0
0
0
0
0
0.040155
0.170784
931
33
119
28.212121
0.843264
0.92159
0
0
0
0
0.125
0
0
0
0
0
0
1
0.25
true
0.25
0
0
0.25
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
1
1
1
0
0
0
0
0
4
833b6ff8f9dbf498fbdb9fc26dae5e0a7b65dff5
192
py
Python
topCoder/srms/600s/srm631/div2/taro_grid.py
gauravsingh58/algo
397859a53429e7a585e5f6964ad24146c6261326
[ "WTFPL" ]
1
2020-09-30T19:53:08.000Z
2020-09-30T19:53:08.000Z
topCoder/srms/600s/srm631/div2/taro_grid.py
gauravsingh58/algo
397859a53429e7a585e5f6964ad24146c6261326
[ "WTFPL" ]
null
null
null
topCoder/srms/600s/srm631/div2/taro_grid.py
gauravsingh58/algo
397859a53429e7a585e5f6964ad24146c6261326
[ "WTFPL" ]
1
2020-10-15T09:10:57.000Z
2020-10-15T09:10:57.000Z
from itertools import groupby class TaroGrid: def getNumber(self, grid): return max(len(list(g)) for e in zip(*grid) for k, g in groupby(e))
24
42
0.541667
26
192
4
0.769231
0
0
0
0
0
0
0
0
0
0
0
0.369792
192
7
43
27.428571
0.859504
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0.166667
0.166667
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
4
8362fc95d7c9194ceab85999eb4e98859dc061d9
1,974
py
Python
dbacademy/dbrest/permissions/__init__.py
databricks-academy/dbacademy-rest
ce20c871c963ee0936cd778f66802b6babacc02f
[ "CC0-1.0" ]
null
null
null
dbacademy/dbrest/permissions/__init__.py
databricks-academy/dbacademy-rest
ce20c871c963ee0936cd778f66802b6babacc02f
[ "CC0-1.0" ]
null
null
null
dbacademy/dbrest/permissions/__init__.py
databricks-academy/dbacademy-rest
ce20c871c963ee0936cd778f66802b6babacc02f
[ "CC0-1.0" ]
null
null
null
from dbacademy.dbrest import DBAcademyRestClient class SqlProxy(): def __init__(self, client: DBAcademyRestClient, token: str, endpoint: str): self.client = client # Client API exposing other operations to this class self.token = token # The authentication token self.endpoint = endpoint # The API endpoint def endpoints(self): from dbacademy.dbrest.permissions.sql_endpoints import SqlEndpointsClient return SqlEndpointsClient(self.client, self.token, self.endpoint) def queries(self): from dbacademy.dbrest.permissions.sql_permissions_client import SqlPermissionsClient return SqlPermissionsClient(self.client, self.token, self.endpoint, "query", "queries") def dashboards(self): from dbacademy.dbrest.permissions.sql_permissions_client import SqlPermissionsClient return SqlPermissionsClient(self.client, self.token, self.endpoint, "dashboard", "dashboards") def data_sources(self): from dbacademy.dbrest.permissions.sql_permissions_client import SqlPermissionsClient return SqlPermissionsClient(self.client, self.token, self.endpoint, "data_source", "data_sources") def alerts(self): from dbacademy.dbrest.permissions.sql_permissions_client import SqlPermissionsClient return SqlPermissionsClient(self.client, self.token, self.endpoint, "alert", "alerts") class PermissionsClient(): def __init__(self, client: DBAcademyRestClient, token: str, endpoint: str): self.client = client # Client API exposing other operations to this class self.token = token # The authentication token self.endpoint = endpoint # The API endpoint def jobs(self): from dbacademy.dbrest.permissions.jobs import JobsPermissionsClient return JobsPermissionsClient(self.client, self.token, self.endpoint) def sql(self): return SqlProxy(self.client, self.token, self.endpoint)
48.146341
106
0.732523
212
1,974
6.726415
0.188679
0.077139
0.107293
0.093268
0.765778
0.741935
0.69425
0.646564
0.646564
0.646564
0
0
0.188956
1,974
40
107
49.35
0.890693
0.093718
0
0.387097
0
0
0.036476
0
0
0
0
0
0
1
0.290323
false
0
0.225806
0.032258
0.806452
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
55cb7f6c7d9b3beaaef6195d2a21e2bd9f21f3a0
176
py
Python
src/optimization/optimize.py
ds-wook/jobcare-recommendation
5abb09901e504304a5cd9793da26f5328ba186a1
[ "Apache-2.0" ]
7
2022-01-28T16:19:15.000Z
2022-02-16T09:02:57.000Z
src/optimization/optimize.py
ds-wook/jobcare-recommendation
5abb09901e504304a5cd9793da26f5328ba186a1
[ "Apache-2.0" ]
null
null
null
src/optimization/optimize.py
ds-wook/jobcare-recommendation
5abb09901e504304a5cd9793da26f5328ba186a1
[ "Apache-2.0" ]
null
null
null
import numpy as np from sklearn.metrics import f1_score def optimize_f1(x: float, y_true: np.ndarray, y_pred: np.ndarray) -> float: return -f1_score(y_true, y_pred >= x)
25.142857
75
0.732955
32
176
3.8125
0.5625
0.114754
0
0
0
0
0
0
0
0
0
0.02027
0.159091
176
6
76
29.333333
0.804054
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.5
0.25
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
1
1
0
0
0
4
36059f46ddac76fc77bf46ca1660e4150980bc85
75
py
Python
DisMail/api/secmail/__init__.py
heisid/DisMail
9c12371261375e2bb3a22e9fbff53c4f32fcc3a0
[ "Unlicense" ]
8
2020-01-05T14:46:10.000Z
2021-04-10T15:56:35.000Z
DisMail/api/secmail/__init__.py
heisid/DisMail
9c12371261375e2bb3a22e9fbff53c4f32fcc3a0
[ "Unlicense" ]
4
2022-01-10T14:35:34.000Z
2022-02-14T05:31:22.000Z
DisMail/api/secmail/__init__.py
heisid/DisMail
9c12371261375e2bb3a22e9fbff53c4f32fcc3a0
[ "Unlicense" ]
2
2022-02-14T04:18:39.000Z
2022-02-14T05:14:54.000Z
from .account import SecmailAccount from .inbox import download_attachment
25
38
0.866667
9
75
7.111111
0.777778
0
0
0
0
0
0
0
0
0
0
0
0.106667
75
2
39
37.5
0.955224
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
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
1
0
1
0
0
0
0
4
36157c61b1c1e5ecb0b47a0a8f4594ca009c95a9
280
py
Python
tests/base.py
GottWall/stati-python-net
2f84fb6fb652cce7918b110c4f42010c909d9b85
[ "BSD-3-Clause" ]
1
2016-12-14T23:14:57.000Z
2016-12-14T23:14:57.000Z
tests/base.py
GottWall/stati-python-net
2f84fb6fb652cce7918b110c4f42010c909d9b85
[ "BSD-3-Clause" ]
null
null
null
tests/base.py
GottWall/stati-python-net
2f84fb6fb652cce7918b110c4f42010c909d9b85
[ "BSD-3-Clause" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- """ stati.tests ~~~~~~~~~~~ Unittests for stati :copyright: (c) 2014 by GottWall team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import unittest class BaseTestCase(unittest.TestCase): pass
17.5
68
0.675
37
280
5.108108
0.783784
0.074074
0.148148
0
0
0
0
0
0
0
0
0.021277
0.160714
280
15
69
18.666667
0.782979
0.725
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.333333
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
1
1
0
1
0
0
4
361d0c21a9faf019f4857420e90905e38c702e01
95
py
Python
library/git-config.py
SorenTech/secure-GitHub
c1b1a369f25dc746b87d9dbeec69d519da5eb96f
[ "MIT" ]
3
2021-04-15T17:07:18.000Z
2021-06-12T08:56:39.000Z
library/git-config.py
SorenTech/secure-GitHub
c1b1a369f25dc746b87d9dbeec69d519da5eb96f
[ "MIT" ]
null
null
null
library/git-config.py
SorenTech/secure-GitHub
c1b1a369f25dc746b87d9dbeec69d519da5eb96f
[ "MIT" ]
null
null
null
# Script to configure local git config to (a) prefer SSH and (b) default to signing all commits
95
95
0.768421
17
95
4.294118
0.882353
0
0
0
0
0
0
0
0
0
0
0
0.178947
95
1
95
95
0.935897
0.978947
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
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
4
362c1d7fe8a8fa607b21a0ee63f84b11f638e0d1
60
py
Python
lambdapool/version.py
rorodata/lambdapool
da7b514496f75484541ebcbcc596f1f72dab09bf
[ "Apache-2.0" ]
null
null
null
lambdapool/version.py
rorodata/lambdapool
da7b514496f75484541ebcbcc596f1f72dab09bf
[ "Apache-2.0" ]
null
null
null
lambdapool/version.py
rorodata/lambdapool
da7b514496f75484541ebcbcc596f1f72dab09bf
[ "Apache-2.0" ]
1
2019-12-30T12:46:24.000Z
2019-12-30T12:46:24.000Z
from lambdapool.agent import VERSION __version__ = VERSION
15
36
0.833333
7
60
6.571429
0.714286
0.608696
0
0
0
0
0
0
0
0
0
0
0.133333
60
3
37
20
0.884615
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
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
4
3646c146867ee6d30add2c6fd5b14be11820e95c
683
py
Python
app/models/auth.py
phaesoo/flask-jwt-auth
ca095fc8a9c1472cf0920449e503daf7a639edb1
[ "MIT" ]
3
2020-01-08T13:10:55.000Z
2020-02-27T16:19:29.000Z
app/models/auth.py
phaesoo/flask-jwt-auth-example
ca095fc8a9c1472cf0920449e503daf7a639edb1
[ "MIT" ]
1
2020-02-06T16:07:09.000Z
2020-02-06T16:07:09.000Z
app/models/auth.py
phaesoo/flask-jwt-auth-example
ca095fc8a9c1472cf0920449e503daf7a639edb1
[ "MIT" ]
null
null
null
from sqlalchemy import Column, Integer, String, DateTime from app.models import Base class AuthUser(Base): __tablename__ = 'auth_user' id = Column(Integer, primary_key=True) password = Column(String(128), nullable=False) last_login = Column(DateTime) is_superuser = Column(Integer, nullable=False) username = Column(String(150), nullable=False, unique=True) first_name = Column(String(30), nullable=False) last_name = Column(String(30), nullable=False) email = Column(String(254), nullable=False) is_staff = Column(Integer, nullable=False) is_active = Column(Integer, nullable=False) date_joined = Column(DateTime, nullable=False)
34.15
63
0.726208
86
683
5.616279
0.453488
0.242236
0.130435
0.161491
0.128364
0.128364
0
0
0
0
0
0.022767
0.163982
683
19
64
35.947368
0.823117
0
0
0
0
0
0.013177
0
0
0
0
0
0
1
0
false
0.066667
0.133333
0
1
0
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
4
3657404b21f1111337b7403555521908b1c4f747
535
py
Python
design/views.py
sumyuktha3/responsivedesign
103b8fedbbd656b2885356024082bdf8d1176284
[ "OLDAP-2.5", "OLDAP-2.6" ]
null
null
null
design/views.py
sumyuktha3/responsivedesign
103b8fedbbd656b2885356024082bdf8d1176284
[ "OLDAP-2.5", "OLDAP-2.6" ]
null
null
null
design/views.py
sumyuktha3/responsivedesign
103b8fedbbd656b2885356024082bdf8d1176284
[ "OLDAP-2.5", "OLDAP-2.6" ]
null
null
null
from django.shortcuts import render # Create your views here. def responsivehome(request): context = {} return render(request, 'design/responsivehome.html', context) def responsiveproduct(request): context = {} return render(request, 'design/responsiveproduct.html', context) def responsivepeople(request): context = {} return render(request, 'design/responsivepeople.html', context) def responsivecontactus(request): context = {} return render(request, 'design/responsivecontactus.html', context)
26.75
70
0.736449
53
535
7.433962
0.358491
0.142132
0.203046
0.263959
0.395939
0.395939
0
0
0
0
0
0
0.153271
535
19
71
28.157895
0.869757
0.042991
0
0.307692
0
0
0.223529
0.223529
0
0
0
0
0
1
0.307692
false
0
0.076923
0
0.692308
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
36b5ede3c326b5a2e4c28e42e587be713ef0c56a
528
py
Python
todo.py
thesyd1982/supreme-spork
2f16eff8cc89ae9d99b05c87b42e2eaeca2e4c94
[ "MIT" ]
1
2021-06-13T13:31:45.000Z
2021-06-13T13:31:45.000Z
todo.py
thesyd1982/supreme-spork
2f16eff8cc89ae9d99b05c87b42e2eaeca2e4c94
[ "MIT" ]
null
null
null
todo.py
thesyd1982/supreme-spork
2f16eff8cc89ae9d99b05c87b42e2eaeca2e4c94
[ "MIT" ]
null
null
null
"""TODO Ecrire un paquet de tools Ecrire un outil XSS Ecrire un README avec https://github.com/RichardLitt/standard-readme/blob/master/README.md Completer touts les script avec PayloadAllTheThing pour ajouter des payloads a chaque exploit Rassembler toutes les LFI dans une classe / pareil pour les RFI -Faire un analyser pour le dispatcher (analyser l'url, la page, recuperer des forms, ect...) (en sortie une liste de dictionnaire avec {'url':url,'exploit':['XSS','LFI','PHP_ASSERT']} -Faire un dispatcher pour le crawler """
52.8
183
0.776515
83
528
4.927711
0.674699
0.05868
0
0
0
0
0
0
0
0
0
0
0.130682
528
9
184
58.666667
0.891068
0.984848
0
null
0
null
0
0
null
0
0
0.111111
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
1
0
0
0
1
0
0
0
0
0
0
4
36c08eae6d26c527e24b5a592b74e1cd6833b740
184
py
Python
js/jquery_cookie/__init__.py
fanstatic/js.jquery_cookie
8cbd8a668330785f112801f50246fac499c231c9
[ "BSD-3-Clause" ]
null
null
null
js/jquery_cookie/__init__.py
fanstatic/js.jquery_cookie
8cbd8a668330785f112801f50246fac499c231c9
[ "BSD-3-Clause" ]
null
null
null
js/jquery_cookie/__init__.py
fanstatic/js.jquery_cookie
8cbd8a668330785f112801f50246fac499c231c9
[ "BSD-3-Clause" ]
null
null
null
import fanstatic import js.jquery library = fanstatic.Library('jquery_cookie', 'resources') cookie = fanstatic.Resource( library, 'jquery.cookie.js', depends=[js.jquery.jquery])
23
60
0.755435
22
184
6.272727
0.409091
0.115942
0.275362
0
0
0
0
0
0
0
0
0
0.108696
184
7
61
26.285714
0.841463
0
0
0
0
0
0.206522
0
0
0
0
0
0
1
0
false
0
0.4
0
0.4
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
36ce5363a2fdbabc845df5a9a78783c0f3407441
123
py
Python
examples/components/count_rows_and_log/run.py
Anbang-Hu/shrike
78189984c85696a9a9feaadb72aa471cf2409796
[ "MIT" ]
27
2021-05-27T00:01:24.000Z
2022-01-30T19:55:24.000Z
examples/components/count_rows_and_log/run.py
Anbang-Hu/shrike
78189984c85696a9a9feaadb72aa471cf2409796
[ "MIT" ]
284
2021-05-12T22:26:41.000Z
2022-02-23T21:18:34.000Z
examples/components/count_rows_and_log/run.py
Anbang-Hu/shrike
78189984c85696a9a9feaadb72aa471cf2409796
[ "MIT" ]
5
2021-06-02T04:51:47.000Z
2021-12-20T17:07:41.000Z
"""run.py for demo component""" from contoso.count_rows_and_log_script import main if __name__ == "__main__": main()
17.571429
50
0.723577
18
123
4.277778
0.888889
0
0
0
0
0
0
0
0
0
0
0
0.154472
123
6
51
20.5
0.740385
0.203252
0
0
0
0
0.086957
0
0
0
0
0
0
1
0
true
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
1
0
1
0
0
0
0
4
36da0e65890f324b68132ccc325019e9a50de78d
99
py
Python
pyungo/errors.py
veronicaguo/pyungo
69cb92a67797cac6ac937bd982389bcbeb10770d
[ "MIT" ]
8
2020-01-08T19:42:01.000Z
2021-12-28T08:30:56.000Z
pyungo/errors.py
veronicaguo/pyungo
69cb92a67797cac6ac937bd982389bcbeb10770d
[ "MIT" ]
2
2020-09-10T12:22:57.000Z
2022-02-17T05:21:22.000Z
pyungo/errors.py
veronicaguo/pyungo
69cb92a67797cac6ac937bd982389bcbeb10770d
[ "MIT" ]
1
2021-05-12T01:50:27.000Z
2021-05-12T01:50:27.000Z
""" errors module """ class PyungoError(Exception): """ pyungo custom exception """ pass
14.142857
35
0.626263
9
99
6.888889
0.888889
0
0
0
0
0
0
0
0
0
0
0
0.222222
99
6
36
16.5
0.805195
0.383838
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
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
1
1
0
0
0
0
0
4
36f1f84deb4adb17f0abc6b23822398fdd99e0a6
84
py
Python
src/words/lexer/__init__.py
DavidStrootman/ATP
72005be0ac75339bb5da037a7e98573e338d16db
[ "MIT" ]
2
2021-08-20T17:56:15.000Z
2021-08-21T01:04:08.000Z
src/words/lexer/__init__.py
DavidStrootman/Words
72005be0ac75339bb5da037a7e98573e338d16db
[ "MIT" ]
null
null
null
src/words/lexer/__init__.py
DavidStrootman/Words
72005be0ac75339bb5da037a7e98573e338d16db
[ "MIT" ]
null
null
null
"""This module provides lexing functionality for the Words programming language."""
42
83
0.797619
10
84
6.7
1
0
0
0
0
0
0
0
0
0
0
0
0.119048
84
1
84
84
0.905405
0.916667
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
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
4
36fa92a892743c80aadcf2f55fe3726efa72a00c
1,902
py
Python
Validation/RecoTrack/python/HLTmultiTrackValidator_cfi.py
PKUfudawei/cmssw
8fbb5ce74398269c8a32956d7c7943766770c093
[ "Apache-2.0" ]
1
2021-11-30T16:24:46.000Z
2021-11-30T16:24:46.000Z
Validation/RecoTrack/python/HLTmultiTrackValidator_cfi.py
PKUfudawei/cmssw
8fbb5ce74398269c8a32956d7c7943766770c093
[ "Apache-2.0" ]
4
2021-11-29T13:57:56.000Z
2022-03-29T06:28:36.000Z
Validation/RecoTrack/python/HLTmultiTrackValidator_cfi.py
PKUfudawei/cmssw
8fbb5ce74398269c8a32956d7c7943766770c093
[ "Apache-2.0" ]
1
2021-11-23T09:25:45.000Z
2021-11-23T09:25:45.000Z
import FWCore.ParameterSet.Config as cms from Validation.RecoTrack.associators_cff import * from Validation.RecoTrack.MultiTrackValidator_cfi import * hltMultiTrackValidator = multiTrackValidator.clone() hltMultiTrackValidator.ignoremissingtkcollection = cms.bool(True) hltMultiTrackValidator.dirName = 'HLT/Tracking/ValidationWRTtp/' hltMultiTrackValidator.label = ['hltPixelTracks'] hltMultiTrackValidator.beamSpot = 'hltOnlineBeamSpot' hltMultiTrackValidator.ptMinTP = 0.4 hltMultiTrackValidator.lipTP = 30.0 hltMultiTrackValidator.tipTP = 60.0 hltMultiTrackValidator.histoProducerAlgoBlock.generalTpSelector.ptMin = 0.9 hltMultiTrackValidator.histoProducerAlgoBlock.generalTpSelector.lip = 30.0 hltMultiTrackValidator.histoProducerAlgoBlock.generalTpSelector.tip = 60.0 hltMultiTrackValidator.histoProducerAlgoBlock.TpSelectorForEfficiencyVsEta = hltMultiTrackValidator.histoProducerAlgoBlock.generalTpSelector.clone() hltMultiTrackValidator.histoProducerAlgoBlock.TpSelectorForEfficiencyVsPhi = hltMultiTrackValidator.histoProducerAlgoBlock.generalTpSelector.clone() hltMultiTrackValidator.histoProducerAlgoBlock.TpSelectorForEfficiencyVsPt = hltMultiTrackValidator.histoProducerAlgoBlock.generalTpSelector.clone(ptMin=0.4) hltMultiTrackValidator.histoProducerAlgoBlock.TpSelectorForEfficiencyVsVTXR = hltMultiTrackValidator.histoProducerAlgoBlock.generalTpSelector.clone() hltMultiTrackValidator.histoProducerAlgoBlock.TpSelectorForEfficiencyVsVTXZ = hltMultiTrackValidator.histoProducerAlgoBlock.generalTpSelector.clone() hltMultiTrackValidator.parametersDefiner = 'hltLhcParametersDefinerForTP' ### for fake rate vs dR ### hltMultiTrackValidator.calculateDrSingleCollection = False hltMultiTrackValidator.ignoremissingtrackcollection = cms.untracked.bool(True) hltMultiTrackValidator.UseAssociators = True hltMultiTrackValidator.associators = ['hltTrackAssociatorByHits']
65.586207
158
0.879075
128
1,902
13.046875
0.445313
0.342515
0.292216
0.197605
0.250299
0.197605
0
0
0
0
0
0.010011
0.054679
1,902
28
159
67.928571
0.918799
0.009989
0
0
0
0
0.059733
0.0432
0
0
0
0
0
1
0
false
0
0.125
0
0.125
0
0
0
1
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
4
7fec67e988aff691088324a29ba663688024f373
1,059
py
Python
tools/leetcode.099.Recover Binary Search Tree/leetcode.099.Recover Binary Search Tree.submission9.py
tedye/leetcode
975d7e3b8cb9b6be9e80e07febf4bcf6414acd46
[ "MIT" ]
4
2015-10-10T00:30:55.000Z
2020-07-27T19:45:54.000Z
tools/leetcode.099.Recover Binary Search Tree/leetcode.099.Recover Binary Search Tree.submission9.py
tedye/leetcode
975d7e3b8cb9b6be9e80e07febf4bcf6414acd46
[ "MIT" ]
null
null
null
tools/leetcode.099.Recover Binary Search Tree/leetcode.099.Recover Binary Search Tree.submission9.py
tedye/leetcode
975d7e3b8cb9b6be9e80e07febf4bcf6414acd46
[ "MIT" ]
null
null
null
# Definition for a binary tree node # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: # @param root, a tree node # @return a tree node def recoverTree(self, root): cur = [] toExchange = [] self.helper(root,cur,toExchange) if toExchange: temp = toExchange[0].val toExchange[0].val = toExchange[1].val toExchange[1].val = temp return root def helper(self,root,cur,toExchange): if not root: return self.helper(root.left,cur,toExchange) if not cur: cur += [[root,root.val]] elif not toExchange and root.val < cur[0][1]: toExchange += [cur[0][0]] toExchange += [root] cur[0] = [root,root.val] elif root.val < cur[0][1]: toExchange[1] = root return else: cur[0] = [root,root.val] self.helper(root.right,cur,toExchange)
1,059
1,059
0.515581
126
1,059
4.301587
0.253968
0.119926
0.094096
0.077491
0.136531
0.081181
0
0
0
0
0
0.019345
0.365439
1,059
1
1,059
1,059
0.787202
0.983003
0
0.153846
0
0
0
0
0
0
0
0
0
1
0.076923
false
0
0
0
0.230769
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
7ff57125618b98d195fe0e051972eac2cdaecee4
183
py
Python
virtual/bin/django-admin.py
evantoh/neighborhood-watch
bb0babb96dacddbdbe9a19ee3d6480875510def9
[ "Unlicense" ]
2
2018-03-19T20:51:18.000Z
2018-03-19T20:51:21.000Z
virtual/bin/django-admin.py
evantoh/neighborhood-watch
bb0babb96dacddbdbe9a19ee3d6480875510def9
[ "Unlicense" ]
null
null
null
virtual/bin/django-admin.py
evantoh/neighborhood-watch
bb0babb96dacddbdbe9a19ee3d6480875510def9
[ "Unlicense" ]
null
null
null
#!/home/evans/python-projects/Django-projects/neighbor/virtual/bin/python3.6 from django.core import management if __name__ == "__main__": management.execute_from_command_line()
30.5
76
0.797814
24
183
5.625
0.833333
0
0
0
0
0
0
0
0
0
0
0.011905
0.081967
183
5
77
36.6
0.791667
0.409836
0
0
0
0
0.074766
0
0
0
0
0
0
1
0
true
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
1
0
1
0
0
0
0
4
3d27c189ea0820c93628c8e45169d3eefc170c9f
237
py
Python
dreamer/envs/env.py
huy-ha/dreamer-pytorch
98561a5fe4ee5323b955f5fc79bbebf483f08d58
[ "MIT" ]
null
null
null
dreamer/envs/env.py
huy-ha/dreamer-pytorch
98561a5fe4ee5323b955f5fc79bbebf483f08d58
[ "MIT" ]
null
null
null
dreamer/envs/env.py
huy-ha/dreamer-pytorch
98561a5fe4ee5323b955f5fc79bbebf483f08d58
[ "MIT" ]
null
null
null
from collections import namedtuple EnvInfo = namedtuple('EnvInfo', ['discount', 'game_score', 'traj_done', 'internal_state' ])
26.333333
38
0.405063
14
237
6.642857
0.857143
0.365591
0
0
0
0
0
0
0
0
0
0
0.514768
237
8
39
29.625
0.808696
0
0
0
0
0
0.202532
0
0
0
0
0
0
1
0
false
0
0.142857
0
0.142857
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
1
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
4
3d423c297a34128bba5503b41a43bd0c55202da7
120
py
Python
bgs_deploy/exc.py
MacHu-GWU/bgs_deploy-project
d241921749f8d742c03bc295501b3a21d6203bec
[ "MIT" ]
null
null
null
bgs_deploy/exc.py
MacHu-GWU/bgs_deploy-project
d241921749f8d742c03bc295501b3a21d6203bec
[ "MIT" ]
null
null
null
bgs_deploy/exc.py
MacHu-GWU/bgs_deploy-project
d241921749f8d742c03bc295501b3a21d6203bec
[ "MIT" ]
1
2020-08-17T08:00:33.000Z
2020-08-17T08:00:33.000Z
# -*- coding: utf-8 -*- class ArgumentTypeError(TypeError): pass class ArgumentValueError(ValueError): pass
12
37
0.683333
11
120
7.454545
0.818182
0
0
0
0
0
0
0
0
0
0
0.010309
0.191667
120
9
38
13.333333
0.835052
0.175
0
0.5
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
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
1
1
0
0
0
0
0
4
3d530c6caddea360021b04e3c6c400ed4ac5bdae
330
py
Python
tests/utils.py
coordt/concrete-settings
b444c3f1f8cdbe30135c1978876215e04ebc7622
[ "MIT" ]
5
2020-04-25T12:18:33.000Z
2021-03-26T18:51:33.000Z
tests/utils.py
coordt/concrete-settings
b444c3f1f8cdbe30135c1978876215e04ebc7622
[ "MIT" ]
13
2019-03-20T10:42:39.000Z
2021-07-07T08:01:05.000Z
tests/utils.py
coordt/concrete-settings
b444c3f1f8cdbe30135c1978876215e04ebc7622
[ "MIT" ]
3
2020-04-25T08:53:29.000Z
2021-07-06T19:15:52.000Z
import typing class Match: """A rudimentary mock call arguments matcher :param match_expr: a callable with single argument returning boolean """ def __init__(self, match_expr: typing.Callable[..., bool]): self.match_expr = match_expr def __eq__(self, other): return self.match_expr(other)
22
72
0.684848
42
330
5.071429
0.595238
0.211268
0.183099
0
0
0
0
0
0
0
0
0
0.224242
330
14
73
23.571429
0.832031
0.336364
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
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
1
0
0
0
4
e9f0c10c62818b108b1c21f8d4a3439220964092
532
py
Python
datajoint-python/datajoint/table_row_vector.py
JHocevar/datajoint-core
086b32229b68486e36383b0950370b8069bd20e3
[ "MIT" ]
null
null
null
datajoint-python/datajoint/table_row_vector.py
JHocevar/datajoint-core
086b32229b68486e36383b0950370b8069bd20e3
[ "MIT" ]
null
null
null
datajoint-python/datajoint/table_row_vector.py
JHocevar/datajoint-core
086b32229b68486e36383b0950370b8069bd20e3
[ "MIT" ]
null
null
null
from ._datajoint_core import ffi from .cffi_config import library_file lib = ffi.dlopen(library_file) class TableRowVector: def __init__(self): self._table_rows = lib.table_row_vector_new() def __enter__(self): return self def __exit__(self, exc_type, exc_value, traceback): lib.table_row_vector_free(self._table_rows) def get(self, index): return lib.table_row_vector_get(self._table_rows, index) def size(self): return lib.table_row_vector_size(self._table_rows)
24.181818
64
0.719925
76
532
4.526316
0.421053
0.104651
0.151163
0.197674
0.133721
0
0
0
0
0
0
0
0.197368
532
21
65
25.333333
0.805621
0
0
0
0
0
0
0
0
0
0
0
0
1
0.357143
false
0
0.142857
0.214286
0.785714
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
1827637b8e540435975cdf432a26fedfd3b1a1b8
99
py
Python
wagtail_legacy_hallo_editor/test/__init__.py
zerolab/wagtail-legacy-hallo-editor
cb17ff1fdb7327f80e632bd2646555859650e4d3
[ "MIT" ]
null
null
null
wagtail_legacy_hallo_editor/test/__init__.py
zerolab/wagtail-legacy-hallo-editor
cb17ff1fdb7327f80e632bd2646555859650e4d3
[ "MIT" ]
null
null
null
wagtail_legacy_hallo_editor/test/__init__.py
zerolab/wagtail-legacy-hallo-editor
cb17ff1fdb7327f80e632bd2646555859650e4d3
[ "MIT" ]
null
null
null
default_app_config = "wagtail_legacy_hallo_editor.test.apps.WagtailLegacyHalloEditorTestAppConfig"
49.5
98
0.909091
10
99
8.5
1
0
0
0
0
0
0
0
0
0
0
0
0.030303
99
1
99
99
0.885417
0
0
0
0
0
0.757576
0.757576
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
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
187fdb7a4b745003ac87aa699b18efea96e8e04c
2,263
py
Python
dataent/tests/test_translation.py
dataent/dataent
c41bd5942ffe5513f4d921c4c0595c84bbc422b4
[ "MIT" ]
null
null
null
dataent/tests/test_translation.py
dataent/dataent
c41bd5942ffe5513f4d921c4c0595c84bbc422b4
[ "MIT" ]
6
2020-03-24T17:15:56.000Z
2022-02-10T18:41:31.000Z
dataent/tests/test_translation.py
dataent/dataent
c41bd5942ffe5513f4d921c4c0595c84bbc422b4
[ "MIT" ]
null
null
null
# Copyright (c) 2015, Dataent Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import dataent, unittest, os import dataent.translate # class TestTranslations(unittest.TestCase): # def test_doctype(self, messages=None): # if not messages: # messages = dataent.translate.get_messages_from_doctype("Role") # self.assertTrue("Role Name" in messages) # # def test_page(self, messages=None): # if not messages: # messages = dataent.translate.get_messages_from_page("finder") # self.assertTrue("Finder" in messages) # # def test_report(self, messages=None): # if not messages: # messages = dataent.translate.get_messages_from_report("ToDo") # self.assertTrue("Test" in messages) # # def test_include_js(self, messages=None): # if not messages: # messages = dataent.translate.get_messages_from_include_files("dataent") # self.assertTrue("History" in messages) # # def test_server(self, messages=None): # if not messages: # messages = dataent.translate.get_server_messages("dataent") # self.assertTrue("Login" in messages) # self.assertTrue("Did not save" in messages) # # def test_all_app(self): # messages = dataent.translate.get_messages_for_app("dataent") # self.test_doctype(messages) # self.test_page(messages) # self.test_report(messages) # self.test_include_js(messages) # self.test_server(messages) # # def test_load_translations(self): # dataent.translate.clear_cache() # self.assertFalse(dataent.cache().hget("lang_full_dict", "de")) # # langdict = dataent.translate.get_full_dict("de") # self.assertEqual(langdict['Row'], 'Reihe') # # def test_write_csv(self): # tpath = dataent.get_pymodule_path("dataent", "translations", "de.csv") # if os.path.exists(tpath): # os.remove(tpath) # dataent.translate.write_translations_file("dataent", "de") # self.assertTrue(os.path.exists(tpath)) # self.assertEqual(dict(dataent.translate.read_csv_file(tpath)).get("Row"), "Reihe") # # def test_get_dict(self): # dataent.local.lang = "de" # self.assertEqual(dataent.get_lang_dict("doctype", "Role").get("Role"), "Rolle") # dataent.local.lang = "en" # # if __name__=="__main__": # dataent.connect("site1") # unittest.main()
34.287879
86
0.72426
292
2,263
5.393836
0.277397
0.111746
0.084444
0.102857
0.230476
0.208254
0.208254
0.208254
0.208254
0.208254
0
0.002534
0.128148
2,263
65
87
34.815385
0.795743
0.90411
0
0
0
0
0
0
0
0
0
0.015385
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
1
0
0
0
1
0
1
0
0
0
0
4
a133509917359b328b1d7b9402f0c9fc4359caf1
235
py
Python
tests/test_storm.py
stijnvanhoey/hydropy
af5f6354c2d7cb3ae2f78f8ca70c7e4570e41999
[ "BSD-2-Clause" ]
51
2015-04-09T12:51:49.000Z
2022-01-24T14:07:37.000Z
tests/test_storm.py
stijnvanhoey/hydropy
af5f6354c2d7cb3ae2f78f8ca70c7e4570e41999
[ "BSD-2-Clause" ]
16
2016-09-26T07:40:16.000Z
2017-04-05T19:51:46.000Z
tests/test_storm.py
stijnvanhoey/hydropy
af5f6354c2d7cb3ae2f78f8ca70c7e4570e41999
[ "BSD-2-Clause" ]
27
2015-04-11T01:10:46.000Z
2022-01-24T14:07:35.000Z
# -*- coding: utf-8 -*- """ test_storm.py """ from __future__ import absolute_import, print_function import unittest from hydropy import storm class TestStorm(unittest.TestCase): def test_storm_selectstorm(self): pass
14.6875
54
0.723404
29
235
5.551724
0.724138
0.111801
0
0
0
0
0
0
0
0
0
0.005155
0.174468
235
15
55
15.666667
0.824742
0.153191
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0.166667
0.5
0
0.833333
0.166667
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
1
0
0
4
a1558033b13903cba928249ba0850ba387b7461e
2,458
py
Python
instruments/base_instrument.py
coder6464/PYBOR
6351155cd0bca7da114323e3b1af120d6639d8d7
[ "MIT" ]
30
2017-06-08T09:03:07.000Z
2022-03-29T11:25:34.000Z
instruments/base_instrument.py
coder6464/PYBOR
6351155cd0bca7da114323e3b1af120d6639d8d7
[ "MIT" ]
1
2018-03-01T19:40:09.000Z
2018-03-01T19:40:09.000Z
instruments/base_instrument.py
coder6464/PYBOR
6351155cd0bca7da114323e3b1af120d6639d8d7
[ "MIT" ]
16
2017-07-03T11:20:37.000Z
2022-02-14T03:01:38.000Z
# Copyright © 2017 Ondrej Martinsky, All rights reserved # http://github.com/omartinsky/pybor # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. from yc_curve import * from yc_date import * def assert_is_set(variables): return all([var!='null'] for var in variables) def assert_is_not_set(variables): return all([var=='null'] for var in variables) def get_dataframe_row_cells(row): fcastL = row['Forecast Curve Left'] fcastR = row['Forecast Curve Right'] discL = row['Discount Curve Left'] discR = row['Discount Curve Right'] convL = row['Convention Left'] convR = row['Convention Right'] start = row['Start'] length = row['Length'] return fcastL, fcastR, discL, discR, convL, convR, start, length class Instrument: def __init__(self, name): self.name_ = name def get_name(self): return self.name_ def get_pillar_date(self): assert False, 'method must be implemented in child class %s' % type(self) def calc_par_rate(self, curvemap): assert False, 'method must be implemented in child class %s' % type(self) def drdp(self): return 1.e+2 def price_from_par_rate(self, x): # TODO rename quote_from_rate return x*1.e+2 def par_rate_from_price(self, x): # TODO rename rate_from_quote return x*1.e-2 def __str__(self): return self.name_
37.242424
82
0.699349
358
2,458
4.703911
0.435754
0.052257
0.005344
0.010689
0.14133
0.14133
0.125891
0.125891
0.125891
0.125891
0
0.005233
0.222539
2,458
65
83
37.815385
0.875458
0.47559
0
0.121212
0
0
0.17985
0
0
0
0
0.015385
0.121212
1
0.333333
false
0
0.060606
0.212121
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
0
1
1
0
0
4
a15c29a8561073cf345115a509373ce1727bb93b
119
py
Python
MyAdventureHeader.py
DidymusRex/PiCraft
07b7dad2e68a2473e4314c9b77cb82abce41ae97
[ "Unlicense" ]
null
null
null
MyAdventureHeader.py
DidymusRex/PiCraft
07b7dad2e68a2473e4314c9b77cb82abce41ae97
[ "Unlicense" ]
null
null
null
MyAdventureHeader.py
DidymusRex/PiCraft
07b7dad2e68a2473e4314c9b77cb82abce41ae97
[ "Unlicense" ]
null
null
null
#! /usr/bin/env python import mcpi.minecraft as minecraft import mcpi.block as block mc = minecraft.Minecraft.create()
23.8
34
0.781513
18
119
5.166667
0.611111
0.215054
0
0
0
0
0
0
0
0
0
0
0.117647
119
4
35
29.75
0.885714
0.176471
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
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
1
0
0
0
0
4
a175384f4fb60ce6283e4472bc9132e5bf99b744
437
py
Python
vae/activations.py
lleonart1984/VAE-modeling
9e46a758af77bafc603f43aeafc5cd0b7816bbca
[ "MIT" ]
null
null
null
vae/activations.py
lleonart1984/VAE-modeling
9e46a758af77bafc603f43aeafc5cd0b7816bbca
[ "MIT" ]
null
null
null
vae/activations.py
lleonart1984/VAE-modeling
9e46a758af77bafc603f43aeafc5cd0b7816bbca
[ "MIT" ]
null
null
null
import torch.nn as nn import torch.functional as F class ShiftedReLU(nn.Module): def __init__(self, offset=1): super().__init__() self.offset = offset def forward(self, x): return F.relu(x + self.offset) class ShiftedSoftplus(nn.Module): def __init__(self, offset=1): super().__init__() self.offset = offset def forward(self, x): return F.softplus(x - self.offset)
19
42
0.624714
58
437
4.431034
0.362069
0.233463
0.217899
0.116732
0.568093
0.568093
0.568093
0.568093
0.568093
0.568093
0
0.006154
0.256293
437
22
43
19.863636
0.784615
0
0
0.571429
0
0
0
0
0
0
0
0
0
1
0.285714
false
0
0.142857
0.142857
0.714286
0
0
0
0
null
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
1
0
0
0
4
a1abdb3c319083e9b451b3bbd41dacf0e827ebf0
79
py
Python
python/8Kyu/Semi-Optional.py
athasv/Codewars-data
5e106466e709fd776f23585ad9f652d0d65b48d3
[ "MIT" ]
null
null
null
python/8Kyu/Semi-Optional.py
athasv/Codewars-data
5e106466e709fd776f23585ad9f652d0d65b48d3
[ "MIT" ]
null
null
null
python/8Kyu/Semi-Optional.py
athasv/Codewars-data
5e106466e709fd776f23585ad9f652d0d65b48d3
[ "MIT" ]
null
null
null
def wrap(value): my_dict={} my_dict["value"] = value return my_dict
19.75
28
0.620253
12
79
3.833333
0.5
0.391304
0
0
0
0
0
0
0
0
0
0
0.240506
79
4
29
19.75
0.766667
0
0
0
0
0
0.0625
0
0
0
0
0
0
1
0.25
false
0
0
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
4
a1de45209feaefd001f33ebd894dcdcd87048356
112
py
Python
talks/old_talks/admin.py
alan-turing-institute/talks.ox
5e172b7bb7296fcfc2d5c1b5978ec98a6643d90a
[ "Apache-2.0" ]
5
2015-09-03T11:46:07.000Z
2022-01-12T10:15:50.000Z
talks/old_talks/admin.py
alan-turing-institute/talks.ox
5e172b7bb7296fcfc2d5c1b5978ec98a6643d90a
[ "Apache-2.0" ]
306
2015-01-05T10:16:56.000Z
2021-06-10T08:00:31.000Z
talks/old_talks/admin.py
alan-turing-institute/talks.ox
5e172b7bb7296fcfc2d5c1b5978ec98a6643d90a
[ "Apache-2.0" ]
5
2016-04-21T10:40:20.000Z
2021-01-05T09:15:23.000Z
from __future__ import absolute_import from django.contrib import admin from .models import OldTalk, OldSeries
22.4
38
0.848214
15
112
6
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.125
112
4
39
28
0.918367
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
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
1
0
1
0
0
0
0
4
a1f463d67e9dfcc313c1079e7bda0494a9286c90
2,446
py
Python
SCTF/2018 Quals/tracer/solver.py
PurpEth/solved-hacking-problem
6f289d1647eb9c091caa580c7aae673e3ba02952
[ "Unlicense" ]
1
2021-08-24T22:16:41.000Z
2021-08-24T22:16:41.000Z
SCTF/2018 Quals/tracer/solver.py
PurpEth/solved-hacking-problem
6f289d1647eb9c091caa580c7aae673e3ba02952
[ "Unlicense" ]
null
null
null
SCTF/2018 Quals/tracer/solver.py
PurpEth/solved-hacking-problem
6f289d1647eb9c091caa580c7aae673e3ba02952
[ "Unlicense" ]
null
null
null
''' g = r0 * b pub = r1 * g = r0 * r1 * b ct0 = r2 * g = r0 * r2 * b ct1 = pub * r2 + c = r0 * r1 * r2 * b + c ''' import binascii from fastecdsa.curve import P521 from fastecdsa.point import Point with open('pc.log', 'r') as f: content = f.read() lines = content.split('\n') start_index = [i for i, x in enumerate(lines) if x == "0000000000401ee8"] end_index = [i for i, x in enumerate(lines) if x == "0000000000402018"] g_x = 5405424750907042817849523452244787490362599682385950687385382709003948286406876796594535643748818283262121138737076141597966012285810985633370824005103944416 g_y = 984970155278863317776905647274559677791525657478616051760985477946504010716818161185200198096532903279219172158326801022992897407628359999389646296263358663 pub_x = 4892656645518573331106701586397878976390433610692116750215231364193992297525681417236426633145141081722252828121588677507009668068565040851265421535903327698 pub_y = 445589854414539227925716617203051677345304928733141270115246729820043468361633813613863577404936314503047208205373086044049612015283264631681675748037596649 ct0_x = 552855983191477065625173490798701617711704046550323641029043197505267412733020855489986706517083352349729506878848234582442903346393633912672334490115627032 ct0_y = 4448288254968185929975292935301106070977300148734716422986283428819999541940872803146014484885544656926366780738305965546200127900163602523408778848349228434 ct1_x = 1172894324150563774663811643608960517627766591027738626927811162713249354115380380370221946441154957962746746084983424309132270981703866563921333244571945068 ct1_y = 1326862342442789403618364073625262255428404701645852537809124740716613376400513445402466174855564161338377255072099047633392029230168238302039238121549772049 traced = [] for (line_start, line_end) in zip(start_index, end_index): now = 0 add_cand = 1 count = 0 for i in range(line_start, line_end): if lines[i] == "0000000000401f95": count += 1 if lines[i+1] == "0000000000401f97": # bit is set now += add_cand add_cand *= 2 traced.append(now) assert traced[2] == traced[3] base_point = Point(P521.gx, P521.gy, curve=P521) g_point = base_point * traced[0] assert g_x == g_point.x and g_y == g_point.y ct0 = Point(ct0_x, ct0_y, curve=P521) ct1 = Point(ct1_x, ct1_y, curve=P521) flag = ct1 - (ct0 * traced[1]) print binascii.unhexlify('%x' % flag.x)
42.172414
165
0.801308
207
2,446
9.323672
0.357488
0.004663
0.009326
0.010363
0.031088
0.031088
0.031088
0.031088
0.031088
0.031088
0
0.641616
0.129599
2,446
57
166
42.912281
0.264913
0.004088
0
0
0
0
0.032342
0
0
1
0
0
0.055556
0
null
null
0
0.083333
null
null
0.027778
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
1
0
0
0
1
0
0
0
0
0
0
0
0
4
a1feb3a004febc43dc7b3e1547d709ded93b0772
919
py
Python
parsec/commands/cmd_tools.py
innovate-invent/parsec
d269e4b3fe0f8814c6416b6d2a6202519b940c66
[ "Apache-2.0" ]
null
null
null
parsec/commands/cmd_tools.py
innovate-invent/parsec
d269e4b3fe0f8814c6416b6d2a6202519b940c66
[ "Apache-2.0" ]
null
null
null
parsec/commands/cmd_tools.py
innovate-invent/parsec
d269e4b3fe0f8814c6416b6d2a6202519b940c66
[ "Apache-2.0" ]
null
null
null
import click from parsec.commands.tools.get_tool_panel import cli as get_tool_panel from parsec.commands.tools.get_tools import cli as get_tools from parsec.commands.tools.install_dependencies import cli as install_dependencies from parsec.commands.tools.paste_content import cli as paste_content from parsec.commands.tools.put_url import cli as put_url from parsec.commands.tools.run_tool import cli as run_tool from parsec.commands.tools.show_tool import cli as show_tool from parsec.commands.tools.upload_file import cli as upload_file from parsec.commands.tools.upload_from_ftp import cli as upload_from_ftp @click.group() def cli(): pass cli.add_command(get_tool_panel) cli.add_command(get_tools) cli.add_command(install_dependencies) cli.add_command(paste_content) cli.add_command(put_url) cli.add_command(run_tool) cli.add_command(show_tool) cli.add_command(upload_file) cli.add_command(upload_from_ftp)
34.037037
82
0.849837
157
919
4.707006
0.171975
0.121786
0.219215
0.280108
0.190798
0
0
0
0
0
0
0
0.083787
919
26
83
35.346154
0.877672
0
0
0
0
0
0
0
0
0
0
0
0
1
0.045455
true
0.045455
0.454545
0
0.5
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
62a20dea2cf5009d615aa60cbe17e1816489a8ba
244
py
Python
src/conformity.py
terror/golf
9d38f8376c2ddbbb34360a3353ec6f4289736bd4
[ "Unlicense" ]
null
null
null
src/conformity.py
terror/golf
9d38f8376c2ddbbb34360a3353ec6f4289736bd4
[ "Unlicense" ]
null
null
null
src/conformity.py
terror/golf
9d38f8376c2ddbbb34360a3353ec6f4289736bd4
[ "Unlicense" ]
null
null
null
# https://open.kattis.com/problems/conformity import collections print((lambda ans: ans.count(ans[0])*ans[0])(sorted(collections.Counter([tuple(sorted(list(map(int, input().split())))) for i in range(int(input()))]).values(), reverse=True)))
40.666667
176
0.713115
36
244
4.833333
0.777778
0.045977
0
0
0
0
0
0
0
0
0
0.008734
0.061475
244
5
177
48.8
0.751092
0.17623
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0.5
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
1
0
4
62b844c26423e93a6a3d271a0019e1c905b1068a
273
py
Python
plugins/southidc_cms.py
cflq3/getcms
6cf07da0ea3ec644866df715cff1f311a46ee378
[ "MIT" ]
22
2016-09-01T08:27:07.000Z
2021-01-11T13:32:59.000Z
plugins/southidc_cms.py
cflq3/getcms
6cf07da0ea3ec644866df715cff1f311a46ee378
[ "MIT" ]
null
null
null
plugins/southidc_cms.py
cflq3/getcms
6cf07da0ea3ec644866df715cff1f311a46ee378
[ "MIT" ]
20
2015-11-07T19:09:48.000Z
2018-05-02T03:10:41.000Z
#!/usr/bin/env python # encoding: utf-8 def run(whatweb, pluginname): whatweb.recog_from_file(pluginname, "Script/FocusSlide.js", "southidc") whatweb.recog_from_content(pluginname, "southidc") whatweb.recog_from_file(pluginname,"Script/Html.js", "southidc")
27.3
75
0.74359
35
273
5.628571
0.571429
0.182741
0.243655
0.203046
0.365482
0.365482
0
0
0
0
0
0.004115
0.10989
273
9
76
30.333333
0.806584
0.131868
0
0
0
0
0.248927
0
0
0
0
0
0
1
0.25
false
0
0
0
0.25
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
4
62d340148a4d0c6c79fbfaa016779299ecedd303
85
py
Python
src/_mappers/exceptions.py
ditansu/mappers
b5860412bbf4274c0e7a7ef54e2fe087c6fbd3aa
[ "BSD-2-Clause" ]
null
null
null
src/_mappers/exceptions.py
ditansu/mappers
b5860412bbf4274c0e7a7ef54e2fe087c6fbd3aa
[ "BSD-2-Clause" ]
null
null
null
src/_mappers/exceptions.py
ditansu/mappers
b5860412bbf4274c0e7a7ef54e2fe087c6fbd3aa
[ "BSD-2-Clause" ]
2
2021-04-01T10:49:37.000Z
2021-07-14T10:08:55.000Z
class MapperError(Exception): """Broken mapper configuration error.""" pass
17
44
0.694118
8
85
7.375
1
0
0
0
0
0
0
0
0
0
0
0
0.188235
85
4
45
21.25
0.855072
0.4
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
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
1
1
0
0
0
0
0
4
62dcd0e38ff5258a7914b1c59387d042adcf7a47
139
py
Python
web_fragments/__init__.py
Jawayria/web-fragments
bbd8f7ea075697393bb5e0d9ce754a65fe585ae8
[ "Apache-2.0" ]
null
null
null
web_fragments/__init__.py
Jawayria/web-fragments
bbd8f7ea075697393bb5e0d9ce754a65fe585ae8
[ "Apache-2.0" ]
null
null
null
web_fragments/__init__.py
Jawayria/web-fragments
bbd8f7ea075697393bb5e0d9ce754a65fe585ae8
[ "Apache-2.0" ]
null
null
null
""" Web fragments. """ __version__ = '0.3.2' default_app_config = 'web_fragments.apps.WebFragmentsConfig' # pylint: disable=invalid-name
19.857143
92
0.741007
17
139
5.647059
0.882353
0.25
0
0
0
0
0
0
0
0
0
0.024194
0.107914
139
6
93
23.166667
0.75
0.316547
0
0
0
0
0.482759
0.425287
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
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
62eca037bda0fa480e9c909d372a0bd4cebba4d7
436
py
Python
tests/basics/generator1.py
geowor01/micropython
7fb13eeef4a85f21cae36f1d502bcc53880e1815
[ "MIT" ]
7
2019-10-18T13:41:39.000Z
2022-03-15T17:27:57.000Z
tests/basics/generator1.py
geowor01/micropython
7fb13eeef4a85f21cae36f1d502bcc53880e1815
[ "MIT" ]
null
null
null
tests/basics/generator1.py
geowor01/micropython
7fb13eeef4a85f21cae36f1d502bcc53880e1815
[ "MIT" ]
2
2020-06-23T09:10:15.000Z
2020-12-22T06:42:14.000Z
def f(x): print('a') y = x print('b') while y > 0: print('c') y -= 1 print('d') yield y print('e') print('f') return None for val in f(3): print(val) #gen = f(3) #print(gen) #print(gen.__next__()) #print(gen.__next__()) #print(gen.__next__()) #print(gen.__next__()) # test printing, but only the first chars that match CPython print(repr(f(0))[0:17]) print("PASS")
16.148148
60
0.536697
68
436
3.205882
0.514706
0.183486
0.220183
0.233945
0.220183
0.220183
0.220183
0.220183
0.220183
0
0
0.025237
0.272936
436
27
61
16.148148
0.662461
0.373853
0
0
0
0
0.037453
0
0
0
0
0
0
1
0.0625
false
0.0625
0
0
0.125
0.5625
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
1
0
0
0
1
0
4
62ed7a98fd95b864c4ab3eb072637d76f6020b24
146
py
Python
mmtbx/command_line/mp_geo.py
rimmartin/cctbx_project
644090f9432d9afc22cfb542fc3ab78ca8e15e5d
[ "BSD-3-Clause-LBNL" ]
null
null
null
mmtbx/command_line/mp_geo.py
rimmartin/cctbx_project
644090f9432d9afc22cfb542fc3ab78ca8e15e5d
[ "BSD-3-Clause-LBNL" ]
null
null
null
mmtbx/command_line/mp_geo.py
rimmartin/cctbx_project
644090f9432d9afc22cfb542fc3ab78ca8e15e5d
[ "BSD-3-Clause-LBNL" ]
null
null
null
from __future__ import division import sys from mmtbx.validation.molprobity import mp_geo if __name__ == "__main__": mp_geo.run(sys.argv[1:])
18.25
46
0.773973
22
146
4.5
0.727273
0.10101
0
0
0
0
0
0
0
0
0
0.007874
0.130137
146
7
47
20.857143
0.771654
0
0
0
0
0
0.055172
0
0
0
0
0
0
1
0
true
0
0.6
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
1
0
1
0
0
0
0
4
1a191e10bbc432ea02c19ef9d43950bdd728f591
745
py
Python
providers/services_areas/test/test_serializers.py
kamotos/mozio_providers
721111addc1a244032490877ed316d1099f6c48d
[ "Apache-2.0" ]
null
null
null
providers/services_areas/test/test_serializers.py
kamotos/mozio_providers
721111addc1a244032490877ed316d1099f6c48d
[ "Apache-2.0" ]
null
null
null
providers/services_areas/test/test_serializers.py
kamotos/mozio_providers
721111addc1a244032490877ed316d1099f6c48d
[ "Apache-2.0" ]
null
null
null
from django.test import TestCase from django.forms.models import model_to_dict from nose.tools import eq_, ok_ from services_areas.serializers import ServiceAreaSerializer from services_areas.test.factories import ServiceAreaFactory class TestCreateUserSerializer(TestCase): def setUp(self): self.service_area_data = model_to_dict(ServiceAreaFactory.build()) def test_serializer_with_empty_data(self): serializer = ServiceAreaSerializer(data={}) eq_(serializer.is_valid(), False) def test_serializer_with_valid_data(self): serializer = ServiceAreaSerializer(data=self.service_area_data) ok_(serializer.is_valid(True)) def test_provider_owns_created_service_area(self): pass
31.041667
74
0.775839
90
745
6.1
0.444444
0.060109
0.040073
0.069217
0.156648
0
0
0
0
0
0
0
0.154362
745
23
75
32.391304
0.871429
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0.0625
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
1
0
0
4
1a21451fbbb55bb32ad4aa217ed22fb9dd6ed4c9
11,690
py
Python
ckan/tests/test_authz.py
HHS/ckan
e8316c75926e8c955ae04623608611c25826cbe4
[ "Apache-2.0" ]
2
2021-02-19T20:06:52.000Z
2021-04-15T20:42:11.000Z
ckan/tests/test_authz.py
opencolorado/ckan
c31c8466f40f29edb63263bd36d714f6a9eb7994
[ "Apache-2.0" ]
null
null
null
ckan/tests/test_authz.py
opencolorado/ckan
c31c8466f40f29edb63263bd36d714f6a9eb7994
[ "Apache-2.0" ]
4
2016-12-17T22:26:06.000Z
2017-01-20T21:51:24.000Z
import sqlalchemy as sa from pylons import config from nose.tools import make_decorator, assert_equal import ckan.model as model import ckan.authz from ckan import plugins from ckan.model import Role from ckan.tests import * def uses_example_auth_plugin(func): def decorate(func): def wrapper(*args, **kwargs): def _plugin_setup(): from ckan.tests.test_plugins import install_ckantestplugin _saved_plugins_config = config.get('ckan.plugins', '') install_ckantestplugin() config['ckan.plugins'] = 'authorizer_plugin' plugins.load_all(config) return _saved_plugins_config def _plugin_teardown(_saved_plugins_config): plugins.unload_all() config['ckan.plugins'] = _saved_plugins_config plugins.load_all(config) _saved_plugins_config = _plugin_setup() func(*args, **kwargs) _plugin_teardown(_saved_plugins_config) wrapper = make_decorator(func)(wrapper) return wrapper return decorate(func) class TestBlacklister(object): def test_1(self): blacklister = ckan.authz.Blacklister() bad_username = u'83.222.23.234' # in test.ini good_username = u'124.168.141.31' good_username2 = u'testadmin' assert blacklister.is_blacklisted(bad_username) assert not blacklister.is_blacklisted(good_username) assert not blacklister.is_blacklisted(good_username2) class TestAuthorizer(object): @classmethod def setup_class(self): CreateTestData.create() model.repo.new_revision() model.Session.add(model.Package(name=u'testpkg')) model.Session.add(model.Package(name=u'testpkg2')) model.Session.add(model.Package(name=u'private_pkg')) model.Session.add(model.User(name=u'testadmin')) # Cannot setup testsysadmin user as it is alreade done in # the default test data. #model.Session.add(model.User(name=u'testsysadmin')) model.Session.add(model.User(name=u'notadmin')) model.Session.add(model.Group(name=u'testgroup')) model.Session.add(model.Group(name=u'testgroup2')) model.repo.commit_and_remove() model.repo.new_revision() pkg = model.Package.by_name(u'testpkg') pkg2 = model.Package.by_name(u'testpkg2') private_pkg = model.Package.by_name(u'private_pkg') pkg.add_relationship(u'depends_on', pkg2) pkg.add_relationship(u'depends_on', private_pkg) model.repo.commit_and_remove() pkg = model.Package.by_name(u'testpkg') grp = model.Group.by_name(u'testgroup') admin = model.User.by_name(u'testadmin') sysadmin = model.User.by_name(u'testsysadmin') notadmin = model.User.by_name(u'notadmin') model.add_user_to_role(admin, model.Role.ADMIN, pkg) model.add_user_to_role(admin, model.Role.ADMIN, grp) model.add_user_to_role(sysadmin, model.Role.ADMIN, model.System()) model.add_user_to_role(notadmin, model.Role.READER, pkg) model.add_user_to_role(notadmin, model.Role.READER, pkg2) model.repo.commit_and_remove() self.authorizer = ckan.authz.Authorizer() self.pkg = model.Package.by_name(u'testpkg') self.pkg2 = model.Package.by_name(u'testpkg2') self.private_pkg = model.Package.by_name(u'private_pkg') self.grp = model.Group.by_name(u'testgroup') self.grp2 = model.Group.by_name(u'testgroup2') self.admin = model.User.by_name(u'testadmin') self.sysadmin = model.User.by_name(u'testsysadmin') self.notadmin = model.User.by_name(u'notadmin') @classmethod def teardown_class(self): model.Session.remove() model.repo.rebuild_db() model.Session.remove() authorizer = ckan.authz.Authorizer() def test_pkg_admin(self): action = model.Action.PURGE assert self.authorizer.is_authorized(self.admin.name, action, self.pkg) assert not self.authorizer.is_authorized(self.admin.name, action, self.pkg2) assert not self.authorizer.is_authorized(u'blah', action, self.pkg) @uses_example_auth_plugin def test_pkg_admin_with_plugin(self): action = model.Action.PURGE assert self.authorizer.is_authorized(self.notadmin.name, action, self.pkg2) def test_grp_admin(self): action = model.Action.PURGE assert self.authorizer.is_authorized(self.admin.name, action, self.grp) assert not self.authorizer.is_authorized(self.admin.name, action, self.grp2) assert not self.authorizer.is_authorized(u'blah', action, self.grp) def test_pkg_sys_admin(self): action = model.Action.PURGE assert self.authorizer.is_authorized(self.sysadmin.name, action, self.pkg) assert self.authorizer.is_authorized(self.sysadmin.name, action, self.pkg2) assert not self.authorizer.is_authorized(u'blah', action, self.pkg) def test_grp_sys_admin(self): action = model.Action.PURGE assert self.authorizer.is_authorized(self.sysadmin.name, action, self.grp) assert self.authorizer.is_authorized(self.sysadmin.name, action, self.grp2) assert not self.authorizer.is_authorized(u'blah', action, self.grp) def test_blacklist_edit_pkg(self): action = model.Action.EDIT username = u'testadmin' bad_username = u'83.222.23.234' assert self.authorizer.is_authorized(self.admin.name, action, self.pkg) assert not self.authorizer.is_authorized(bad_username, action, self.pkg) def test_blacklist_edit_grp(self): action = model.Action.EDIT username = u'testadmin' bad_username = u'83.222.23.234' assert self.authorizer.is_authorized(self.admin.name, action, self.grp) assert not self.authorizer.is_authorized(bad_username, action, self.grp) def test_revision_purge(self): action = model.Action.PURGE isa = self.authorizer.is_authorized(self.sysadmin.name, action, model.Revision) assert isa, isa isnot = self.authorizer.is_authorized(self.notadmin.name, action, model.Revision) assert not isnot, isnot def test_authorized_query(self): assert self.authorizer.is_authorized(self.notadmin.name, model.Action.READ, self.pkg) assert not self.authorizer.is_authorized(self.notadmin.name, model.Action.READ, self.private_pkg) q = self.authorizer.authorized_query(self.notadmin.name, model.Package) pkgs = set([pkg.name for pkg in q.all()]) expected_pkgs = set([u'testpkg', u'testpkg2', u'annakarenina', u'warandpeace']) assert_equal(pkgs, expected_pkgs) def _assert_relationships(self, rels, expected_rels): rels = set([repr(rel) for rel in rels]) assert_equal(rels, set(expected_rels)) def test_package_relationships_as_notadmin(self): rels = self.authorizer.authorized_package_relationships( \ self.notadmin.name, self.pkg, None, action=model.Action.READ) self._assert_relationships(rels, ['<*PackageRelationship testpkg depends_on testpkg2>']) rels = self.authorizer.authorized_package_relationships( \ self.notadmin.name, self.pkg, self.pkg2, action=model.Action.READ) self._assert_relationships(rels, ['<*PackageRelationship testpkg depends_on testpkg2>']) def test_package_relationships_as_sysadmin(self): rels = self.authorizer.authorized_package_relationships( \ self.sysadmin.name, self.pkg, None, action=model.Action.READ) self._assert_relationships(rels, ['<*PackageRelationship testpkg depends_on testpkg2>', '<*PackageRelationship testpkg depends_on private_pkg>']) rels = self.authorizer.authorized_package_relationships( \ self.notadmin.name, self.pkg, self.pkg2, action=model.Action.READ) self._assert_relationships(rels, ['<*PackageRelationship testpkg depends_on testpkg2>']) class TestLockedDownAuthorizer(object): @classmethod def setup_class(self): CreateTestData.create() q = model.Session.query(model.UserObjectRole).filter(sa.or_(model.UserObjectRole.role==Role.EDITOR, model.UserObjectRole.role==Role.ANON_EDITOR, model.UserObjectRole.role==Role.READER)) q = q.filter(model.UserObjectRole.user==model.User.by_name(u"visitor")) for role in q: model.Session.delete(role) model.repo.commit_and_remove() model.repo.new_revision() model.Session.add(model.Package(name=u'testpkg')) model.Session.add(model.Package(name=u'testpkg2')) model.Session.add(model.User(name=u'testadmin')) # Cannot setup testsysadmin user as it is alreade done in # the default test data. #model.Session.add(model.User(name=u'testsysadmin')) model.Session.add(model.User(name=u'notadmin')) model.Session.add(model.Group(name=u'testgroup')) model.Session.add(model.Group(name=u'testgroup2')) model.repo.commit_and_remove() pkg = model.Package.by_name(u'testpkg') grp = model.Group.by_name(u'testgroup') admin = model.User.by_name(u'testadmin') sysadmin = model.User.by_name(u'testsysadmin') model.add_user_to_role(admin, model.Role.ADMIN, pkg) model.add_user_to_role(admin, model.Role.ADMIN, grp) model.add_user_to_role(sysadmin, model.Role.ADMIN, model.System()) model.repo.commit_and_remove() self.authorizer = ckan.authz.Authorizer() self.pkg = model.Package.by_name(u'testpkg') self.pkg2 = model.Package.by_name(u'testpkg2') self.grp = model.Group.by_name(u'testgroup') self.grp2 = model.Group.by_name(u'testgroup2') self.admin = model.User.by_name(u'testadmin') self.sysadmin = model.User.by_name(u'testsysadmin') self.notadmin = model.User.by_name(u'notadmin') @classmethod def teardown_class(self): model.Session.remove() model.repo.rebuild_db() model.Session.remove() authorizer = ckan.authz.Authorizer() def test_pkg_create(self): action = model.Action.PACKAGE_CREATE assert self.authorizer.is_authorized(self.admin.name, action, model.System()) assert self.authorizer.is_authorized(self.notadmin.name, action, model.System()) assert not self.authorizer.is_authorized(u'blah', action, model.System()) assert not self.authorizer.is_authorized(u'visitor', action, model.System()) def test_pkg_edit(self): #reproduce a bug action = model.Action.EDIT assert self.authorizer.is_authorized(self.notadmin.name, action, model.System()) def test_pkg_admin(self): action = model.Action.PURGE assert self.authorizer.is_authorized(self.admin.name, action, self.pkg) assert not self.authorizer.is_authorized(self.admin.name, action, self.pkg2) assert not self.authorizer.is_authorized(u'blah', action, self.pkg) def test_grp_sys_admin(self): action = model.Action.PURGE assert self.authorizer.is_authorized(self.sysadmin.name, action, self.grp) assert self.authorizer.is_authorized(self.sysadmin.name, action, self.grp2) assert not self.authorizer.is_authorized(u'blah', action, self.grp)
44.789272
153
0.672883
1,480
11,690
5.147973
0.099324
0.028219
0.0672
0.109201
0.786849
0.747867
0.73658
0.708229
0.679092
0.63486
0
0.00809
0.217536
11,690
260
154
44.961538
0.824861
0.024465
0
0.57277
0
0
0.074074
0.009215
0
0
0
0
0.201878
1
0.122066
false
0
0.042254
0
0.201878
0
0
0
0
null
0
0
0
0
1
1
1
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
4
a7f5879279c2a40911f3dda115af1803b765f681
73
py
Python
if_example.py
jakeflo88/pythonClass
8863bff6fb7ba0303f258d9a9ddd744bff66d581
[ "0BSD" ]
null
null
null
if_example.py
jakeflo88/pythonClass
8863bff6fb7ba0303f258d9a9ddd744bff66d581
[ "0BSD" ]
null
null
null
if_example.py
jakeflo88/pythonClass
8863bff6fb7ba0303f258d9a9ddd744bff66d581
[ "0BSD" ]
null
null
null
name = 'Bob' if name == 'Alice': print('Hi Alice') print('Done')
14.6
22
0.534247
10
73
3.9
0.7
0.512821
0
0
0
0
0
0
0
0
0
0
0.246575
73
4
23
18.25
0.709091
0
0
0
0
0
0.289855
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
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
1
0
4
a7f87e96dc8cf268ba4ecf49f70b043d2c65ce46
31,873
py
Python
tests/test_allauth_2f2a.py
jeremyagray/django-allauth-2f2a
da103bb098a9ef8e1735c48f5c145d564cda36d5
[ "Apache-2.0" ]
null
null
null
tests/test_allauth_2f2a.py
jeremyagray/django-allauth-2f2a
da103bb098a9ef8e1735c48f5c145d564cda36d5
[ "Apache-2.0" ]
1
2022-02-21T22:27:33.000Z
2022-03-20T14:01:09.000Z
tests/test_allauth_2f2a.py
jeremyagray/django-allauth-2f2a
da103bb098a9ef8e1735c48f5c145d564cda36d5
[ "Apache-2.0" ]
null
null
null
# ****************************************************************************** # # test_allauth_2f2a.py: allauth_2f2a tests # # SPDX-License-Identifier: Apache-2.0 # # django-allauth-2f2a, a 2fa adapter for django-allauth. # # ****************************************************************************** # # django-allauth-2f2a, a 2fa adapter for django-allauth. # # Copyright 2021 Jeremy A Gray <gray@flyquackswim.com>. # # 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. # # ****************************************************************************** # """allauth_2f2a tests.""" import base64 import re from urllib.parse import parse_qsl from urllib.parse import urlencode from urllib.parse import urlparse from urllib.parse import urlunparse from allauth.account.signals import user_logged_in from django.conf import settings from django.contrib import messages from django.contrib.auth import get_user_model from django.core.exceptions import ImproperlyConfigured from django.forms import ValidationError from django.test import TestCase from django.test import override_settings from django.urls import reverse from django_otp.oath import TOTP from pyfakefs.fake_filesystem_unittest import patchfs from allauth_2f2a import app_settings from allauth_2f2a.middleware import BaseRequire2FAMiddleware def normalize_url(url): """Sort the URL query string parameters.""" url = str(url) # Coerce reverse_lazy() URLs. scheme, netloc, path, params, query, fragment = urlparse(url) query_parts = sorted(parse_qsl(query)) return urlunparse( ( scheme, netloc, path, params, urlencode(query_parts), fragment, ) ) class Test2Factor(TestCase): """2fa tests.""" def setUp(self): """Set up Test2Factor().""" self.user_logged_in_count = 0 user_logged_in.connect(self._login_callback) def tearDown(self): """Reset after each test.""" # Set TWOFA_FORMS to default. setattr( app_settings, "TWOFA_FORMS", { "authenticate": "allauth_2f2a.forms.TOTPAuthenticateForm", "device": "allauth_2f2a.forms.TOTPDeviceForm", "remove": "allauth_2f2a.forms.TOTPDeviceRemoveForm", }, ) def _login_callback(self, sender, **kwargs): """Increment the login count.""" self.user_logged_in_count += 1 def test_standard_login(self): """Should login if 2fa is not configured.""" user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() resp = self.client.post( reverse("account_login"), {"login": "john", "password": "doe"}, ) self.assertRedirects( resp, settings.LOGIN_REDIRECT_URL, fetch_redirect_response=False, ) # Ensure the signal is received as expected. self.assertEqual(self.user_logged_in_count, 1) def test_2fa_login(self): """Should login when 2fa is configured.""" user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() totp_model = user.totpdevice_set.create() resp = self.client.post( reverse("account_login"), {"login": "john", "password": "doe"}, ) self.assertRedirects( resp, reverse("two-factor-authenticate"), fetch_redirect_response=False, ) # Now ensure that logging in actually works. totp = TOTP( totp_model.bin_key, totp_model.step, totp_model.t0, totp_model.digits, ) resp = self.client.post( reverse("two-factor-authenticate"), {"otp_token": totp.token()}, ) self.assertRedirects( resp, settings.LOGIN_REDIRECT_URL, fetch_redirect_response=False, ) # Ensure the signal is received as expected. self.assertEqual(self.user_logged_in_count, 1) def test_2fa_setup(self): """Should setup device and redirect to backup tokens.""" # Create a user. user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() # Login. response = self.client.post( reverse("account_login"), {"login": "john", "password": "doe"}, ) # GET the setup page. response = self.client.get( reverse("two-factor-setup"), ) # Find the device created by GET. device = user.totpdevice_set.filter(confirmed=False).first() # Calculate the token. totp = TOTP( device.bin_key, device.step, device.t0, device.digits, ) # POST the token to the setup page. response = self.client.post( reverse("two-factor-setup"), { "token": totp.token(), }, ) self.assertRedirects( response, reverse("two-factor-backup"), ) def test_2fa_already_setup(self): """Should redirect to backup tokens.""" # Create a user. user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() # Login. self.client.post( reverse("account_login"), {"login": "john", "password": "doe"}, ) # GET the setup page. self.client.get( reverse("two-factor-setup"), ) # Find the device created by GET. device = user.totpdevice_set.filter(confirmed=False).first() # Calculate the token. totp = TOTP( device.bin_key, device.step, device.t0, device.digits, ) # POST the token to the setup page. response = self.client.post( reverse("two-factor-setup"), { "token": totp.token(), }, ) self.assertRedirects( response, reverse("two-factor-backup"), ) # GET the setup page again. self.client.get( reverse("two-factor-setup"), ) # Since 2FA is configured, should redirect to backup token # generator. self.assertRedirects( response, reverse("two-factor-backup"), ) def test_2fa_generate_backup_tokens(self): """Should generate backup tokens.""" # Create a user. user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() # Login. self.client.post( reverse("account_login"), {"login": "john", "password": "doe"}, ) # GET the setup page. self.client.get( reverse("two-factor-setup"), ) # Find the device created by GET. device = user.totpdevice_set.filter(confirmed=False).first() # Calculate the token. totp = TOTP( device.bin_key, device.step, device.t0, device.digits, ) # POST the token to the setup page. response = self.client.post( reverse("two-factor-setup"), { "token": totp.token(), }, ) self.assertRedirects( response, reverse("two-factor-backup"), ) # POST to make new tokens. response = self.client.post( reverse("two-factor-backup"), ) self.assertContains( response, "Two-Factor Authentication Backup Tokens", ) def test_2fa_setup_bad_token(self): """Should raise ``django.forms.ValidationError``.""" # Create a user. user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() # Login. self.client.post( reverse("account_login"), {"login": "john", "password": "doe"}, ) # GET the setup page. self.client.get( reverse("two-factor-setup"), ) # POST the token to the setup page. response = self.client.post( reverse("two-factor-setup"), { "token": "123456", }, ) # Should rerender the form successfully. self.assertEqual( response.status_code, 200, ) # Should contain the error message. self.assertContains( response, "Setup Two-Factor Authentication", ) def test_2fa_remove(self): """Should remove device and redirect to backup tokens.""" # Create a user. user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() # Login. response = self.client.post( reverse("account_login"), {"login": "john", "password": "doe"}, ) # GET the setup page. response = self.client.get( reverse("two-factor-setup"), ) # Find the device created by GET. device = user.totpdevice_set.filter(confirmed=False).first() # Calculate the token. totp = TOTP( device.bin_key, device.step, device.t0, device.digits, ) # POST the token to the setup page. response = self.client.post( reverse("two-factor-setup"), { "token": totp.token(), }, ) # Should redirect to 2FA backup token generator. self.assertRedirects( response, reverse("two-factor-backup"), ) # POST a device removal request. response = self.client.post( reverse("two-factor-remove"), ) # Should redirect to 2FA setup. self.assertRedirects( response, reverse("two-factor-setup"), ) def test_2fa_login_custom_form(self): """Should login when 2fa is configured.""" setattr( app_settings, "TWOFA_FORMS", { "authentication": "tests.forms.CustomTOTPAuthenticateForm", "device": "allauth_2f2a.forms.TOTPDeviceForm", "remove": "allauth_2f2a.forms.TOTPDeviceRemoveForm", }, ) user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() totp_model = user.totpdevice_set.create() resp = self.client.post( reverse("account_login"), {"login": "john", "password": "doe"}, ) self.assertRedirects( resp, reverse("two-factor-authenticate"), fetch_redirect_response=False, ) # Now ensure that logging in actually works. totp = TOTP( totp_model.bin_key, totp_model.step, totp_model.t0, totp_model.digits, ) resp = self.client.post( reverse("two-factor-authenticate"), {"otp_token": totp.token()}, ) self.assertRedirects( resp, settings.LOGIN_REDIRECT_URL, fetch_redirect_response=False, ) # Ensure the signal is received as expected. self.assertEqual(self.user_logged_in_count, 1) def test_invalid_2fa_login(self): """Should not login when wrong 2fa code is provided.""" user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() user.totpdevice_set.create() resp = self.client.post( reverse("account_login"), {"login": "john", "password": "doe"}, ) self.assertRedirects( resp, reverse("two-factor-authenticate"), fetch_redirect_response=False, ) # Ensure that logging in does not work with invalid token resp = self.client.post( reverse("two-factor-authenticate"), {"otp_token": "invalid"}, ) self.assertEqual(resp.status_code, 200) def test_2fa_redirect(self): """Should redirect if 2fa is not necessry.""" user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() # Not logged in. resp = self.client.get(reverse("two-factor-authenticate")) self.assertRedirects( resp, reverse("account_login"), fetch_redirect_response=False, ) # Logged in. resp = self.client.post( reverse("account_login"), {"login": "john", "password": "doe"}, ) resp = self.client.get(reverse("two-factor-authenticate")) self.assertRedirects( resp, reverse("account_login"), fetch_redirect_response=False, ) def test_2fa_reset_flow(self): """Should redirect to login on 2fa interruption.""" user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() user.totpdevice_set.create() resp = self.client.post( reverse("account_login"), {"login": "john", "password": "doe"} ) self.assertRedirects( resp, reverse("two-factor-authenticate"), fetch_redirect_response=False ) # The user ID should be in the session. self.assertIn("allauth_2f2a_user_id", self.client.session) # Navigate to a different page. self.client.get(reverse("account_login")) # The middleware should reset the login flow. self.assertNotIn("allauth_2f2a_user_id", self.client.session) # Trying to continue with two-factor without logging in again will # redirect to login. resp = self.client.get(reverse("two-factor-authenticate")) self.assertRedirects( resp, reverse("account_login"), fetch_redirect_response=False ) def test_2fa_login_forwarding_get_parameters(self): """Should pass route parameters through 2fa views.""" user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() user.totpdevice_set.create() # Add a next to unnamed-view. resp = self.client.post( reverse("account_login") + "?existing=param&next=unnamed-view", {"login": "john", "password": "doe"}, follow=True, ) # Ensure that the unnamed-view is still being forwarded to. resp.redirect_chain[-1] = ( normalize_url(resp.redirect_chain[-1][0]), resp.redirect_chain[-1][1], ) self.assertRedirects( resp, normalize_url( reverse("two-factor-authenticate") + "?existing=param&next=unnamed-view", ), fetch_redirect_response=False, ) def test_2fa_login_forwarding_next_via_post(self): """Should respect ``next`` parameter on POST.""" user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() user.totpdevice_set.create() # Add a next to unnamed-view. resp = self.client.post( reverse("account_login") + "?existing=param", {"login": "john", "password": "doe", "next": "unnamed-view"}, follow=True, ) # Ensure that the unnamed-view is still being forwarded to, # preserving existing query params. resp.redirect_chain[-1] = ( normalize_url(resp.redirect_chain[-1][0]), resp.redirect_chain[-1][1], ) self.assertRedirects( resp, normalize_url( reverse("two-factor-authenticate") + "?existing=param&next=unnamed-view" ), fetch_redirect_response=False, ) def test_anonymous(self): """Anonymous users should not access 2fa views.""" # The authentication page redirects to the login page. url = reverse("two-factor-authenticate") resp = self.client.get(url) self.assertRedirects( resp, reverse("account_login"), fetch_redirect_response=False ) # Some pages redirect to the login page and then will redirect back. for url in [ "two-factor-setup", "two-factor-backup", "two-factor-remove", ]: url = reverse(url) resp = self.client.get(url) self.assertRedirects( resp, reverse("account_login") + "?next=" + url, fetch_redirect_response=False, ) def test_unnamed_view(self): """Should reset login if 2fa is interrupted.""" user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() user.totpdevice_set.create() resp = self.client.post( reverse("account_login"), {"login": "john", "password": "doe"} ) self.assertRedirects( resp, reverse("two-factor-authenticate"), fetch_redirect_response=False ) # The user ID should be in the session. self.assertIn("allauth_2f2a_user_id", self.client.session) # Navigate to a different (unnamed) page. resp = self.client.get("/unnamed-view") # The middleware should reset the login flow. self.assertNotIn("allauth_2f2a_user_id", self.client.session) # Trying to continue with two-factor without logging in again # will redirect to login. resp = self.client.get(reverse("two-factor-authenticate")) self.assertRedirects( resp, reverse("account_login"), fetch_redirect_response=False ) def test_backwards_compatible_url(self): """Should still work.""" user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() totp_model = user.totpdevice_set.create() resp = self.client.post( reverse("account_login"), {"login": "john", "password": "doe"}, ) self.assertRedirects( resp, reverse("two-factor-authenticate"), fetch_redirect_response=False, ) # Now ensure that logging in actually works. totp = TOTP( totp_model.bin_key, totp_model.step, totp_model.t0, totp_model.digits, ) # The old URL doesn't have a trailing slash. url = reverse("two-factor-authenticate").rstrip("/") resp = self.client.post(url, {"otp_token": totp.token()}) self.assertRedirects( resp, settings.LOGIN_REDIRECT_URL, fetch_redirect_response=False, ) # Ensure the signal is received as expected. self.assertEqual(self.user_logged_in_count, 1) def test_not_configured_redirect(self): """Should redirect if 2fa is not configured.""" user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() # Login. resp = self.client.post( reverse("account_login"), {"login": "john", "password": "doe"}, ) # The 2FA pages should redirect. for url_name in ["two-factor-backup", "two-factor-remove"]: resp = self.client.get(reverse(url_name)) self.assertRedirects( resp, reverse("two-factor-setup"), fetch_redirect_response=False, ) class Require2FA(BaseRequire2FAMiddleware): """Require 2fa if configured.""" def require_2fa(self, request): """Determine if 2fa is required if configured.""" return True class NoRequire2FA(BaseRequire2FAMiddleware): """Require 2fa if configured.""" def require_2fa(self, request): """Determine if 2fa is required if configured.""" return False class Require2FANonexistentAllowed(BaseRequire2FAMiddleware): """Require 2fa if configured.""" allowed_pages = [ "bob-is-your-uncle", "account_logout", "account_change_password", "account_reset_password", "two-factor-setup", ] def require_2fa(self, request): """Determine if 2fa is required if configured.""" return True class Require2FAWithMessage(BaseRequire2FAMiddleware): """Require 2fa if configured and add a message.""" def require_2fa(self, request): """Determine if 2fa is required and add a message.""" messages.info( request, "2fa required", extra_tags="2fa_required", ) return True @override_settings( # Don't redirect to an "allowed" URL. LOGIN_REDIRECT_URL="/unnamed-view", # Add the middleware that requires 2FA. MIDDLEWARE=settings.MIDDLEWARE + ("allauth_2f2a.middleware.BaseRequire2FAMiddleware",), ) class TestRequire2FAMiddlewareNotConfigured(TestCase): """Unconfigured 2fa middleware tests.""" def test_require2fa_not_implemented(self): """Should raise ``NotImplementedError``.""" user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() self.assertRaises( NotImplementedError, self.client.post, reverse("account_login"), {"login": "john", "password": "doe"}, follow=True, ) @override_settings( # Don't redirect to an "allowed" URL. LOGIN_REDIRECT_URL="/unnamed-view", # Add the middleware that requires 2FA. MIDDLEWARE=settings.MIDDLEWARE + ("tests.test_allauth_2f2a.Require2FA",), ) class TestRequire2FAMiddleware(TestCase): """2fa middleware tests.""" def test_no_2fa(self): """Should redirect to setup if 2fa is not configured.""" user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() resp = self.client.post( reverse("account_login"), {"login": "john", "password": "doe"}, follow=True, ) # The user is redirected to the 2FA setup page. self.assertRedirects( resp, reverse("two-factor-setup"), fetch_redirect_response=False, ) @override_settings( # Don't redirect to an "allowed" URL. LOGIN_REDIRECT_URL="/unnamed-view", # Add the middleware that requires 2FA. MIDDLEWARE=settings.MIDDLEWARE + ("tests.test_allauth_2f2a.NoRequire2FA",), ) def test_no_2fa_not_required(self): """Should redirect to ``LOGIN_REDIRECT_URL``.""" user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() resp = self.client.post( reverse("account_login"), {"login": "john", "password": "doe"}, follow=True, ) # The user is redirected to ``LOGIN_REDIRECT_URL``. self.assertRedirects( resp, settings.LOGIN_REDIRECT_URL, fetch_redirect_response=False, ) @override_settings( # Don't redirect to an "allowed" URL. LOGIN_REDIRECT_URL="/unnamed-view", # Add the middleware that requires 2FA. MIDDLEWARE=settings.MIDDLEWARE + ("tests.test_allauth_2f2a.Require2FANonexistentAllowed",), ) def test_no_2fa_nonexistent_allowed(self): """Should warn on nonexistent URL.""" user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() with self.assertWarns(UserWarning): self.client.post( reverse("account_login"), {"login": "john", "password": "doe"}, follow=True, ) def test_2fa(self): """Should login when 2fa is configured.""" user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() totp_model = user.totpdevice_set.create() resp = self.client.post( reverse("account_login"), {"login": "john", "password": "doe"}, ) self.assertRedirects( resp, reverse("two-factor-authenticate"), fetch_redirect_response=False, ) # Now ensure that logging in actually works. totp = TOTP( totp_model.bin_key, totp_model.step, totp_model.t0, totp_model.digits, ) resp = self.client.post( reverse("two-factor-authenticate"), {"otp_token": totp.token()}, ) # The user ends up on the normal redirect login page. self.assertRedirects( resp, settings.LOGIN_REDIRECT_URL, fetch_redirect_response=False, ) def test_2fa_already_configured(self): """Should access all URLs..""" # Create a user. user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() # Login. response = self.client.post( reverse("account_login"), {"login": "john", "password": "doe"}, ) # GET the setup page. response = self.client.get( reverse("two-factor-setup"), ) # Find the device created by GET. device = user.totpdevice_set.filter(confirmed=False).first() # Calculate the token. totp = TOTP( device.bin_key, device.step, device.t0, device.digits, ) # POST the token to the setup page. response = self.client.post( reverse("two-factor-setup"), { "token": totp.token(), }, ) # Should redirect to 2FA backup token generator. self.assertRedirects( response, reverse("two-factor-backup"), ) # Load a 2fa protected URL. response = self.client.get( settings.LOGIN_REDIRECT_URL, ) # Should load successfully. self.assertEqual( response.status_code, 200, ) @override_settings( INSTALLED_APPS=settings.INSTALLED_APPS + ("django.contrib.messages",), # This doesn't seem to stack nicely with the class-based one, # so add the middleware here. MIDDLEWARE=settings.MIDDLEWARE + ( "tests.test_allauth_2f2a.Require2FA", "django.contrib.messages.middleware.MessageMiddleware", ), ) def test_no_2fa_messages(self): """Should redirect to 2fa setup.""" user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() resp = self.client.post( reverse("account_login"), {"login": "john", "password": "doe"}, follow=True, ) # The user is redirected to the 2FA setup page. self.assertRedirects( resp, reverse("two-factor-setup"), fetch_redirect_response=False ) @override_settings( INSTALLED_APPS=settings.INSTALLED_APPS + ("django.contrib.messages",), MIDDLEWARE=settings.MIDDLEWARE + ( "tests.test_allauth_2f2a.Require2FAWithMessage", "django.contrib.messages.middleware.MessageMiddleware", ), ) def test_with_2fa_messages(self): """Should redirect to 2fa setup.""" user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() response = self.client.post( reverse("account_login"), {"login": "john", "password": "doe"}, follow=True, ) # The user is redirected to the 2FA setup page. self.assertRedirects( response, reverse("two-factor-setup"), fetch_redirect_response=False, ) class TestQRCodeGeneration(TestCase): """Tests for QR code generation via file or data: protocol.""" def tearDown(self): """Reset settings to default.""" setattr(app_settings, "QRCODE_TYPE", "data") def test_2fa_setup_data(self): """Test 2FA setup using 'data:' protocol.""" user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() self.client.post(reverse("account_login"), {"login": "john", "password": "doe"}) response = self.client.get(reverse("two-factor-setup")) # Should have the data: URI. self.assertRegex( response.content.decode(), r"data:image\/svg\+xml;base64,", ) # Should have a valid SVG image in the base64 string. # Get the base64 string. svg_match = re.search( r"\"data:image\/svg\+xml;base64,(.*?)\"", response.content.decode(), ) # Assert the string is base64 encoded. self.assertEqual( svg_match.group(1), base64.b64encode(base64.b64decode(svg_match.group(1))).decode(), ) # Assert the string is a valid SVG image. Well, SVGish at least. self.assertRegex( base64.b64decode(svg_match.group(1)).decode(), r"<svg.*?>", ) @patchfs def test_2fa_setup_file(self, fs): """Test 2FA setup using an SVG file.""" # Create the fake qrcodes directory. fs.create_dir("qrcodes") user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() setattr(app_settings, "QRCODE_TYPE", "file") self.client.post(reverse("account_login"), {"login": "john", "password": "doe"}) response = self.client.get(reverse("two-factor-setup")) self.assertRegex( response.content.decode(), r"qrcodes\/[a-f0-9]{32}\.svg", ) def test_2fa_setup_file_no_dir(self): """Test 2FA setup using an SVG file without the qr code directory.""" user = get_user_model().objects.create(username="john") user.set_password("doe") user.save() setattr(app_settings, "QRCODE_TYPE", "file") self.client.post( reverse("account_login"), { "login": "john", "password": "doe", }, ) self.assertRaises( ImproperlyConfigured, self.client.get, reverse("two-factor-setup"), )
30.240038
88
0.563737
3,299
31,873
5.310094
0.112155
0.036534
0.043841
0.046752
0.74746
0.713837
0.702592
0.665144
0.655611
0.64545
0
0.009907
0.315973
31,873
1,053
89
30.268756
0.793597
0.187808
0
0.637621
0
0
0.138157
0.04916
0
0
0
0
0.071923
1
0.051176
false
0.077455
0.026279
0
0.096819
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
1
0
0
0
0
0
4
c509c36bb393db94b40f876b4cba84577d063ccc
136
py
Python
tests/test_models/__init__.py
mecomontes/AirBnB-clone-one
a26f0ff0e3c259895d0c03f24e351ffe3c8004b0
[ "CNRI-Python", "OML" ]
1
2021-07-12T00:14:03.000Z
2021-07-12T00:14:03.000Z
tests/test_models/test_engine/__init__.py
mecomontes/AirBnB-clone-one
a26f0ff0e3c259895d0c03f24e351ffe3c8004b0
[ "CNRI-Python", "OML" ]
null
null
null
tests/test_models/test_engine/__init__.py
mecomontes/AirBnB-clone-one
a26f0ff0e3c259895d0c03f24e351ffe3c8004b0
[ "CNRI-Python", "OML" ]
null
null
null
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ Created on Tue Jun 30 13:28:17 2020 @author: Robinson Montes Carlos Murcia """
15.111111
35
0.602941
20
136
4.1
1
0
0
0
0
0
0
0
0
0
0
0.132075
0.220588
136
8
36
17
0.641509
0.911765
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
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
4
c526df44a4c630ec444369dbeac01cab6351482b
332
py
Python
the_complete_python_&_postgreSQL_developer_course/a_lottery_app/list_comprehension.py
supermonkeyparadise/python
ce8799d643dd7af2b1cb5bc9179bcd83be9769d6
[ "MIT" ]
null
null
null
the_complete_python_&_postgreSQL_developer_course/a_lottery_app/list_comprehension.py
supermonkeyparadise/python
ce8799d643dd7af2b1cb5bc9179bcd83be9769d6
[ "MIT" ]
null
null
null
the_complete_python_&_postgreSQL_developer_course/a_lottery_app/list_comprehension.py
supermonkeyparadise/python
ce8799d643dd7af2b1cb5bc9179bcd83be9769d6
[ "MIT" ]
null
null
null
user_input = '5,4,25,18,22,9' user_numbers = user_input.split(',') user_numbers_as_int = [] for number in user_numbers: user_numbers_as_int.append(int(number)) print(user_numbers_as_int) print([number for number in user_numbers]) print([number*2 for number in user_numbers]) print([int(number) for number in user_numbers])
22.133333
47
0.759036
57
332
4.140351
0.315789
0.372881
0.186441
0.254237
0.466102
0.372881
0
0
0
0
0
0.03413
0.11747
332
14
48
23.714286
0.771331
0
0
0
0
0
0.045181
0
0
0
0
0
0
1
0
false
0
0
0
0
0.444444
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
1
0
4
c535f06966cf53bb20c3c0bc0cf8f4cde4341471
296
py
Python
searchbot/help.py
cleac/tgsearchbot
c1662708aa82b100689801703e6868f66af18cd9
[ "Apache-2.0" ]
null
null
null
searchbot/help.py
cleac/tgsearchbot
c1662708aa82b100689801703e6868f66af18cd9
[ "Apache-2.0" ]
1
2021-06-01T21:55:19.000Z
2021-06-01T21:55:19.000Z
searchbot/help.py
cleac/tgsearchbot
c1662708aa82b100689801703e6868f66af18cd9
[ "Apache-2.0" ]
null
null
null
def gen_help(bot_name): return''' Hello! I am a telegram bot that generates duckduckgo links from tg directly. I am an inline bot, you can access it via @{bot_name}. If you have any questions feel free to leave issue at http://github.com/cleac/tgsearchbot '''.format(bot_name=bot_name)
29.6
89
0.743243
52
296
4.134615
0.788462
0.130233
0
0
0
0
0
0
0
0
0
0
0.168919
296
9
90
32.888889
0.873984
0
0
0
1
0
0.773649
0
0
0
0
0
0
1
0.142857
false
0
0
0.142857
0.142857
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
1
0
null
0
0
0
0
0
0
0
0
0
1
0
0
0
4
c53776ed04578025361e6e05059401600c8c6c39
90
py
Python
src/rent_hotel/apps.py
pfskiev/lisbon
c756d0cd2f8fd2405c7123dab029748da75b6e5b
[ "MIT" ]
null
null
null
src/rent_hotel/apps.py
pfskiev/lisbon
c756d0cd2f8fd2405c7123dab029748da75b6e5b
[ "MIT" ]
1
2017-11-07T09:09:28.000Z
2017-11-07T09:09:28.000Z
src/rent_hotel/apps.py
pfskiev/lisbon
c756d0cd2f8fd2405c7123dab029748da75b6e5b
[ "MIT" ]
null
null
null
from django.apps import AppConfig class RentCarConfig(AppConfig): name = 'rent_car'
15
33
0.755556
11
90
6.090909
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.166667
90
5
34
18
0.893333
0
0
0
0
0
0.088889
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
1
0
0
4
c54d1609de8628c65fd05105412902e3a2652715
98
py
Python
students/k3342/practical_works/Reybandt Alexandr/docker/backend/flight_board/apps.py
Reybandt/ITMO_ICT_WebProgramming_2020
2cb30e9ca7e013d10f533f2ac32f1602f321b6a9
[ "MIT" ]
null
null
null
students/k3342/practical_works/Reybandt Alexandr/docker/backend/flight_board/apps.py
Reybandt/ITMO_ICT_WebProgramming_2020
2cb30e9ca7e013d10f533f2ac32f1602f321b6a9
[ "MIT" ]
null
null
null
students/k3342/practical_works/Reybandt Alexandr/docker/backend/flight_board/apps.py
Reybandt/ITMO_ICT_WebProgramming_2020
2cb30e9ca7e013d10f533f2ac32f1602f321b6a9
[ "MIT" ]
null
null
null
from django.apps import AppConfig class FlightBoardConfig(AppConfig): name = 'flight_board'
16.333333
35
0.77551
11
98
6.818182
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.153061
98
5
36
19.6
0.903614
0
0
0
0
0
0.122449
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
1
0
0
4
3d8cda565c770f1cf10134e1a4e1e26ceb92a0a9
62
py
Python
setup.py
mbroz/feel-the-streets
6e21a496f1530b0500ca66e11712f3f31cd857ae
[ "MIT" ]
5
2018-03-19T19:04:53.000Z
2021-02-19T16:44:04.000Z
setup.py
mbroz/feel-the-streets
6e21a496f1530b0500ca66e11712f3f31cd857ae
[ "MIT" ]
6
2020-04-18T16:14:22.000Z
2021-08-14T09:23:16.000Z
setup.py
mbroz/feel-the-streets
6e21a496f1530b0500ca66e11712f3f31cd857ae
[ "MIT" ]
1
2021-01-10T18:47:38.000Z
2021-01-10T18:47:38.000Z
from setuptools import setup setup(name="Feel the streets")
20.666667
30
0.774194
9
62
5.333333
0.888889
0
0
0
0
0
0
0
0
0
0
0
0.145161
62
3
30
20.666667
0.90566
0
0
0
0
0
0.262295
0
0
0
0
0
0
1
0
true
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
1
0
1
0
0
0
0
4
3dadda25876d9dc0214f1a1df88ea87474feb3f4
582
py
Python
week6/test_add_function.py
johnehunt/computationalthinking
0f3694b7977be5e3015b5a1ad64a50d0d8827842
[ "Apache-2.0" ]
1
2021-05-16T10:24:47.000Z
2021-05-16T10:24:47.000Z
week6/test_add_function.py
johnehunt/computationalthinking
0f3694b7977be5e3015b5a1ad64a50d0d8827842
[ "Apache-2.0" ]
null
null
null
week6/test_add_function.py
johnehunt/computationalthinking
0f3694b7977be5e3015b5a1ad64a50d0d8827842
[ "Apache-2.0" ]
1
2019-09-21T08:24:46.000Z
2019-09-21T08:24:46.000Z
from add_function import add def test_add_zeros(): result = add(0, 0) assert result == 0 def test_add_one_and_zero(): result = add(1, 0) assert result == 1 def test_add_zero_and_one(): result = add(0, 1) assert result == 1 def test_add_one_and_one(): result = add(1, 1) assert result == 2 def test_add_zero_and_minus_one(): result = add(0, -1) assert result == -1 def test_add_minus_one_and_zero(): result = add(-1, 0) assert result == -1 def test_add_minus_one_and_minus_one(): result = add(-1, -1) assert result == -2
20.068966
39
0.646048
98
582
3.520408
0.163265
0.142029
0.202899
0.185507
0.817391
0.672464
0.672464
0.672464
0.515942
0.469565
0
0.047085
0.233677
582
29
40
20.068966
0.726457
0
0
0.181818
0
0
0
0
0
0
0
0
0.318182
1
0.318182
false
0
0.045455
0
0.363636
0
0
0
0
null
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
4
3db053ec44e68e35f925889d895bd0fcd7f296ef
145
py
Python
Module04/constants.py
geiyer/cis189-python
2b85ff66277b337aab9f6a7a6fa1c86dccf0178c
[ "MIT" ]
2
2021-02-24T00:32:36.000Z
2021-04-21T00:09:36.000Z
Module04/constants.py
geiyer/cis189-python
2b85ff66277b337aab9f6a7a6fa1c86dccf0178c
[ "MIT" ]
null
null
null
Module04/constants.py
geiyer/cis189-python
2b85ff66277b337aab9f6a7a6fa1c86dccf0178c
[ "MIT" ]
2
2021-03-30T23:37:49.000Z
2021-04-21T00:08:32.000Z
PI = 3.14 SALES_TAX = 6 if __name__ == '__main__': print('Constant file directly executed') else: print('Constant file is imported')
20.714286
44
0.668966
20
145
4.4
0.85
0.295455
0.386364
0
0
0
0
0
0
0
0
0.035088
0.213793
145
7
45
20.714286
0.736842
0
0
0
0
0
0.438356
0
0
0
0
0
0
1
0
false
0
0.166667
0
0.166667
0.333333
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
3db5ebdb4b4233e4c22f9b0062f8d11772aa207b
108
py
Python
tests/input_scripts/rewrite.py
shiba6v/shape_commentator
e57c4d7e0781fa02fdc49dbc5c88236df5948cf1
[ "MIT" ]
65
2018-12-06T15:34:50.000Z
2021-09-10T12:38:43.000Z
tests/input_scripts/rewrite.py
shiba6v/shape_commentator
e57c4d7e0781fa02fdc49dbc5c88236df5948cf1
[ "MIT" ]
5
2018-12-14T06:32:54.000Z
2019-08-04T09:36:45.000Z
tests/input_scripts/rewrite.py
shiba6v/shape_commentator
e57c4d7e0781fa02fdc49dbc5c88236df5948cf1
[ "MIT" ]
1
2019-01-02T00:05:38.000Z
2019-01-02T00:05:38.000Z
import numpy as np a = np.array([1,2,3,4,5,6]) #_ rewrite it! b = np.array([0,1,2,3,4,5]) #_ rewrite it!
21.6
43
0.583333
26
108
2.346154
0.615385
0.229508
0.098361
0.131148
0.163934
0
0
0
0
0
0
0.134831
0.175926
108
4
44
27
0.550562
0.240741
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
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
4
3deb2d3a47932e0ae07b0ec913d5cebef382f1c2
146
py
Python
clouddb/__init__.py
adregner/python-clouddb
6c77261a0e9cda221980c9240c7fffc93a78f7f7
[ "X11" ]
1
2018-05-21T23:09:36.000Z
2018-05-21T23:09:36.000Z
clouddb/__init__.py
adregner/python-clouddb
6c77261a0e9cda221980c9240c7fffc93a78f7f7
[ "X11" ]
null
null
null
clouddb/__init__.py
adregner/python-clouddb
6c77261a0e9cda221980c9240c7fffc93a78f7f7
[ "X11" ]
null
null
null
# -*- encoding: utf-8 -*- __author__ = "Andrew Regner <andrew@aregner.com>" from clouddb.connection import Connection from clouddb.models import *
36.5
49
0.753425
18
146
5.888889
0.722222
0.207547
0
0
0
0
0
0
0
0
0
0.007752
0.116438
146
4
50
36.5
0.813953
0.157534
0
0
0
0
0.278689
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
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
1
0
0
0
0
4
3ded945f5532010201dc1871041d432a0c4521c9
124
py
Python
test/wpu.py
JittoThomas/IOT
994fa25087d14e33c2d82b9c9d526f65823b6fa8
[ "MIT" ]
null
null
null
test/wpu.py
JittoThomas/IOT
994fa25087d14e33c2d82b9c9d526f65823b6fa8
[ "MIT" ]
null
null
null
test/wpu.py
JittoThomas/IOT
994fa25087d14e33c2d82b9c9d526f65823b6fa8
[ "MIT" ]
null
null
null
import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) # set up BCM GPIO numbering GPIO.setup(4, GPIO.IN, pull_up_down=GPIO.PUD_UP)
31
50
0.774194
25
124
3.72
0.6
0
0
0
0
0
0
0
0
0
0
0.009091
0.112903
124
3
51
41.333333
0.836364
0.201613
0
0
0
0
0
0
0
0
0
0
0
1
0
true
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
1
0
1
0
0
0
0
4
9a76b95d4521d5a24470ae02eee985af840584d3
258
py
Python
dup/tasks.py
almazkun/dup
f188d771c02e5b4da96131c09c74ad981280e7a5
[ "MIT" ]
null
null
null
dup/tasks.py
almazkun/dup
f188d771c02e5b4da96131c09c74ad981280e7a5
[ "MIT" ]
1
2021-12-22T02:45:00.000Z
2021-12-22T02:45:00.000Z
dup/tasks.py
almazkun/dup
f188d771c02e5b4da96131c09c74ad981280e7a5
[ "MIT" ]
null
null
null
from dup.models import Website def check_all_websites(): for website in Website.objects.all(): check_website(website.pk) def check_website(website_pk: int) -> None: website = Website.objects.get(pk=website_pk) website.update_status()
21.5
48
0.724806
36
258
5
0.5
0.233333
0.211111
0.233333
0
0
0
0
0
0
0
0
0.170543
258
11
49
23.454545
0.841122
0
0
0
0
0
0
0
0
0
0
0
0
1
0.285714
false
0
0.142857
0
0.428571
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
1
0
0
0
0
0
0
0
4
9a980aa5c690a678851d01f1a5c48efe995b53e3
15
py
Python
examples/mnist_simple/mnist.py
raviqqe/qnd.tf
fab2bd93b1b2b2a15fd6eac8d30ede382522c368
[ "Unlicense" ]
69
2016-12-23T16:23:23.000Z
2019-06-08T16:38:06.000Z
examples/mnist_simple/mnist.py
raviqqe/qnd.tf
fab2bd93b1b2b2a15fd6eac8d30ede382522c368
[ "Unlicense" ]
7
2016-12-26T03:00:21.000Z
2017-05-20T10:25:46.000Z
examples/mnist_simple/mnist.py
raviqqe/qnd.tf
fab2bd93b1b2b2a15fd6eac8d30ede382522c368
[ "Unlicense" ]
7
2016-12-25T12:56:14.000Z
2019-07-16T00:29:50.000Z
../lib/mnist.py
15
15
0.666667
3
15
3.333333
1
0
0
0
0
0
0
0
0
0
0
0
0
15
1
15
15
0.666667
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
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
1
0
0
0
0
0
0
0
0
4
9a9c91eca9eec104ea666b6a74af9153b91f6668
513
py
Python
noxfile.py
gitonthescene/csv-reconcile
243f6e6286553489b924ed579af82a3b0a0e51fd
[ "MIT" ]
27
2021-03-15T09:15:57.000Z
2022-03-30T20:11:01.000Z
noxfile.py
gitonthescene/csv-reconcile
243f6e6286553489b924ed579af82a3b0a0e51fd
[ "MIT" ]
40
2021-04-13T14:00:32.000Z
2022-03-25T14:08:17.000Z
noxfile.py
gitonthescene/csv-reconcile
243f6e6286553489b924ed579af82a3b0a0e51fd
[ "MIT" ]
5
2021-02-14T23:43:16.000Z
2022-01-02T09:28:17.000Z
from nox_poetry import session, SDIST args = lambda s: s.split() @session(python=['3.7', '3.8', '3.9']) def test_main(session): session.poetry.installroot(distribution_format=SDIST) session.install('pytest') session.run(*args('pytest -v tests/main')) @session(python=['3.7', '3.8', '3.9']) def test_geo(session): session.poetry.installroot(distribution_format=SDIST) session.install('csv-reconcile-geo') session.install('pytest') session.run(*args('pytest -v tests/plugins/geo'))
27
57
0.692008
73
513
4.794521
0.410959
0.12
0.08
0.085714
0.76
0.76
0.76
0.76
0.76
0.148571
0
0.026726
0.124756
513
18
58
28.5
0.752784
0
0
0.461538
0
0
0.183236
0
0
0
0
0
0
1
0.153846
false
0
0.076923
0
0.230769
0
0
0
0
null
0
0
0
0
1
1
1
1
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
4
9abcd40ef4dfadf4ae4c13a627c2997c09f35535
943
py
Python
addresses/models.py
DKMDebugin/ecommerce
427d18f19cabd128fe21c716d965e85b8e91a169
[ "MIT" ]
null
null
null
addresses/models.py
DKMDebugin/ecommerce
427d18f19cabd128fe21c716d965e85b8e91a169
[ "MIT" ]
null
null
null
addresses/models.py
DKMDebugin/ecommerce
427d18f19cabd128fe21c716d965e85b8e91a169
[ "MIT" ]
null
null
null
from django.db import models from billing.models import BillingProfile ADDRESS_TYPES = ( ('billing', 'Billing'), ('shipping', 'Shipping'), ) class Addresses(models.Model): billing_profile = models.ForeignKey(BillingProfile, on_delete=models.DO_NOTHING) address_type = models.CharField(max_length=120, choices=ADDRESS_TYPES) address_line_1 = models.CharField(max_length=120) address_line_2 = models.CharField(max_length=120, null=True, blank=True) city = models.CharField(max_length=120) country = models.CharField(max_length=120, default='Nigeria') state = models.CharField(max_length=120) postal_code = models.CharField(max_length=120) def __str__(self): return str(self.billing_profile) def get_address(self): return f"{self.address_line_1}\n{self.address_line_2 or ''}\n{self.city}\n{self.state}, {self.postal_code}\n{self.country}"
37.72
131
0.705196
123
943
5.170732
0.373984
0.165094
0.198113
0.264151
0.29717
0
0
0
0
0
0
0.032134
0.174973
943
24
132
39.291667
0.785347
0
0
0
0
0.052632
0.159067
0.114528
0
0
0
0
0
1
0.105263
false
0
0.105263
0.105263
0.789474
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
4
9acc217f06f55f9deffca7307de99eb2dc005e6d
975
py
Python
tests/utils/test_common.py
WhiteOnBlackCode/proxion
6c6fda6f3017ad28f917a0d6d18b0b18aabb248b
[ "MIT" ]
4
2018-09-08T18:41:09.000Z
2019-07-18T03:20:53.000Z
tests/utils/test_common.py
codeswhite/proxion
6c6fda6f3017ad28f917a0d6d18b0b18aabb248b
[ "MIT" ]
9
2021-06-26T07:44:08.000Z
2021-07-10T05:32:22.000Z
tests/utils/test_common.py
WhiteOnBlackCode/proxion
6c6fda6f3017ad28f917a0d6d18b0b18aabb248b
[ "MIT" ]
null
null
null
from proxion.util.common import * def test_is_proxy_format(): assert is_proxy_format('0.0.0.0:0') == True assert is_proxy_format('255.255.255.255:65535') == True assert is_proxy_format(None) == False assert is_proxy_format('') == False assert is_proxy_format('256.255.255.255:65535') == False assert is_proxy_format('255.255.255.255:65536') == False assert is_proxy_format('1.1.1.1:-20') == False assert is_proxy_format('-1.1.1.1:20') == False assert is_proxy_format('a1.1.1.1:20') == False assert is_proxy_format('1.1.1.1:20a') == False assert is_proxy_format('1.1.1.1:-20') == False def test_is_ip_addr(): assert is_ip_address('0.0.0.0') == True assert is_ip_address('255.255.255.255') == True assert is_ip_address(None) == False assert is_ip_address('') == False assert is_ip_address('256.255.255.255') == False assert is_ip_address('-1.1.1.1') == False assert is_ip_address('a1.1.1.1') == False
37.5
60
0.667692
172
975
3.540698
0.151163
0.062397
0.256158
0.343186
0.70936
0.390805
0.390805
0.351396
0.249589
0.249589
0
0.148962
0.16
975
25
61
39
0.594628
0
0
0.095238
0
0
0.184615
0.064615
0
0
0
0
0.857143
1
0.095238
true
0
0.047619
0
0.142857
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
1
0
0
0
0
0
0
4
b12df6e3d721fbe740072e897712b394530d30fd
1,625
py
Python
scripts/compute_possible_instructions.py
m-smith/babyai
deb79a8171eaf3c7e1e131a49e92caaf89eecd8d
[ "BSD-3-Clause" ]
411
2019-02-13T13:57:10.000Z
2022-03-15T22:47:27.000Z
scripts/compute_possible_instructions.py
m-smith/babyai
deb79a8171eaf3c7e1e131a49e92caaf89eecd8d
[ "BSD-3-Clause" ]
47
2019-02-19T17:23:35.000Z
2021-05-05T15:16:03.000Z
scripts/compute_possible_instructions.py
m-smith/babyai
deb79a8171eaf3c7e1e131a49e92caaf89eecd8d
[ "BSD-3-Clause" ]
100
2019-02-13T23:35:25.000Z
2022-02-10T17:58:25.000Z
#!/usr/bin/env python3 """ Compute the number of possible instructions in the BabyAI grammar. """ from gym_minigrid.minigrid import COLOR_NAMES def count_Sent(): return ( count_Sent1() + # Sent1, then Sent1 count_Sent1() * count_Sent1() + # Sent1 after you Sent1 count_Sent1() * count_Sent1() ) def count_Sent1(): return ( count_Clause() + # Clause and Clause count_Clause() * count_Clause() ) def count_Clause(): return ( # go to count_Descr() + # pick up count_DescrNotDoor() + # open count_DescrDoor() + # put next count_DescrNotDoor() * count_Descr() ) def count_DescrDoor(): # (the|a) Color door Location return 2 * count_Color() * count_LocSpec() def count_DescrBall(): return count_DescrDoor() def count_DescrBox(): return count_DescrDoor() def count_DescrKey(): return count_DescrDoor() def count_Descr(): return count_DescrDoor() + count_DescrBall() + count_DescrBox() + count_DescrKey() def count_DescrNotDoor(): return count_DescrBall() + count_DescrBox() + count_DescrKey() def count_Color(): # Empty string or color return len([None] + COLOR_NAMES) def count_LocSpec(): # Empty string or location return len([None, 'left', 'right', 'front', 'behind']) print('DescrKey: ', count_DescrKey()) print('Descr: ', count_Descr()) print('DescrNotDoor: ', count_DescrNotDoor()) print('Clause: ', count_Clause()) print('Sent1: ', count_Sent1()) print('Sent: ', count_Sent()) print('Sent: {:.3g}'.format(count_Sent()))
24.621212
86
0.638154
186
1,625
5.327957
0.317204
0.088799
0.075681
0.069627
0.232089
0.096872
0.096872
0.096872
0
0
0
0.011971
0.228923
1,625
65
87
25
0.778931
0.153231
0
0.142857
0
0
0.061856
0
0
0
0
0
0
1
0.261905
true
0
0.02381
0.261905
0.547619
0.166667
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
0
1
1
0
0
4
b161a9d334216f52a73ee1e1dac91a2c32756c73
105
py
Python
exercises/en/exc_cars_data.py
UBC-MDS/exploratory-data-viz
83b704ce10d1ff5e10bfd4cdfa872ac52993fd54
[ "CC-BY-4.0" ]
null
null
null
exercises/en/exc_cars_data.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/solution_cars_data.py
flor14/ds-toolbox
5ff3730b114a96a3ea4491af74d0a0ba33385054
[ "CC-BY-4.0" ]
4
2021-01-13T09:30:57.000Z
2021-08-03T20:49:31.000Z
import altair as alt from vega_datasets import data cars = data.cars() print(cars.columns) cars.head()
13.125
30
0.761905
17
105
4.647059
0.705882
0.202532
0
0
0
0
0
0
0
0
0
0
0.142857
105
8
31
13.125
0.877778
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.4
0
0.4
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
1
0
0
0
0
4
b17c1673c7544fcbe73ce79036a2cc59022ab5ea
181
py
Python
rgbd_seg/models/heads/builder.py
tomchol/ShapeConv
41ead20854daed43b59ef978665fa53f113cbb65
[ "Apache-2.0" ]
57
2021-08-03T08:03:56.000Z
2022-03-25T12:17:44.000Z
rgbd_seg/models/heads/builder.py
tomchol/ShapeConv
41ead20854daed43b59ef978665fa53f113cbb65
[ "Apache-2.0" ]
6
2021-08-30T10:06:46.000Z
2022-03-08T12:47:20.000Z
rgbd_seg/models/heads/builder.py
tomchol/ShapeConv
41ead20854daed43b59ef978665fa53f113cbb65
[ "Apache-2.0" ]
8
2021-08-13T08:32:54.000Z
2022-03-25T11:12:13.000Z
from rgbd_seg.utils import build_from_cfg from .registry import HEADS def build_head(cfg, default_args=None): head = build_from_cfg(cfg, HEADS, default_args) return head
20.111111
51
0.773481
29
181
4.551724
0.517241
0.136364
0.181818
0
0
0
0
0
0
0
0
0
0.160221
181
8
52
22.625
0.868421
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0.4
0
0.8
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
b1aa8530a80443492a6f780c3d2f3bfe1068587c
144
py
Python
src/jobResub_lxplus.py
GilesStrong/Delphes_Event_Selection_YR-2018
64347a47f79bcb9931a6d82c48b6ba33d1f0aaf7
[ "MIT" ]
null
null
null
src/jobResub_lxplus.py
GilesStrong/Delphes_Event_Selection_YR-2018
64347a47f79bcb9931a6d82c48b6ba33d1f0aaf7
[ "MIT" ]
null
null
null
src/jobResub_lxplus.py
GilesStrong/Delphes_Event_Selection_YR-2018
64347a47f79bcb9931a6d82c48b6ba33d1f0aaf7
[ "MIT" ]
null
null
null
import os, glob failures = [x[:x.rfind("/")] for x in glob.glob("*/STDOUT") if "Data saved" not in open(x).read()] print len(failures), failures
48
98
0.666667
25
144
3.84
0.68
0
0
0
0
0
0
0
0
0
0
0
0.125
144
3
99
48
0.761905
0
0
0
0
0
0.131034
0
0
0
0
0
0
0
null
null
0
0.333333
null
null
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
1
0
0
0
1
0
0
0
0
4
494c68fffdcf6d4d85df90863b14ec106aaf3dd3
35,505
py
Python
fledge/der_models.py
sonercandas/fledge
ac107df1236d898ea31f62a60a568cf00a9bda08
[ "MIT" ]
2
2020-05-25T03:06:55.000Z
2020-09-30T11:14:27.000Z
fledge/der_models.py
sonercandas/fledge
ac107df1236d898ea31f62a60a568cf00a9bda08
[ "MIT" ]
null
null
null
fledge/der_models.py
sonercandas/fledge
ac107df1236d898ea31f62a60a568cf00a9bda08
[ "MIT" ]
null
null
null
"""Distributed energy resource (DER) models.""" from multimethod import multimethod import numpy as np import pandas as pd import pyomo.core import pyomo.environ as pyo import typing import fledge.config import fledge.database_interface import fledge.electric_grid_models import fledge.power_flow_solvers import fledge.thermal_grid_models import fledge.utils logger = fledge.config.get_logger(__name__) class DERModel(object): """DER model object.""" der_name: str timesteps: pd.Index active_power_nominal_timeseries: pd.Series reactive_power_nominal_timeseries: pd.Series class FixedDERModel(DERModel): """Fixed DER model object.""" def define_optimization_variables( self, optimization_problem: pyomo.core.base.PyomoModel.ConcreteModel, ): pass def define_optimization_constraints( self, optimization_problem: pyomo.core.base.PyomoModel.ConcreteModel ): pass def define_optimization_connection_grid( self, optimization_problem: pyomo.core.base.PyomoModel.ConcreteModel, power_flow_solution: fledge.power_flow_solvers.PowerFlowSolution, electric_grid_model: fledge.electric_grid_models.ElectricGridModel ): # Obtain DER index. der_index = int(fledge.utils.get_index(electric_grid_model.ders, der_name=self.der_name)) der = electric_grid_model.ders[der_index] # Define connection constraints. if optimization_problem.find_component('der_connection_constraints') is None: optimization_problem.der_connection_constraints = pyo.ConstraintList() for timestep in self.timesteps: optimization_problem.der_connection_constraints.add( optimization_problem.der_active_power_vector_change[timestep, der] == self.active_power_nominal_timeseries.at[timestep] - np.real( power_flow_solution.der_power_vector[der_index] ) ) optimization_problem.der_connection_constraints.add( optimization_problem.der_reactive_power_vector_change[timestep, der] == self.reactive_power_nominal_timeseries.at[timestep] - np.imag( power_flow_solution.der_power_vector[der_index] ) ) def get_optimization_results( self, optimization_problem: pyomo.core.base.PyomoModel.ConcreteModel ): return None class FixedLoadModel(FixedDERModel): """Fixed load model object.""" def __init__( self, der_data: fledge.database_interface.DERData, der_name: str ): """Construct fixed load model object by `der_data` and `der_name`.""" # Store DER name. self.der_name = der_name # Get fixed load data by `der_name`. fixed_load = der_data.fixed_loads.loc[self.der_name, :] # Store timesteps index. self.timesteps = der_data.fixed_load_timeseries_dict[fixed_load['timeseries_name']].index # Construct active and reactive power timeseries. self.active_power_nominal_timeseries = ( der_data.fixed_load_timeseries_dict[ fixed_load['timeseries_name'] ]['apparent_power_per_unit'].rename('active_power') * fixed_load['scaling_factor'] * fixed_load['active_power'] ) self.reactive_power_nominal_timeseries = ( der_data.fixed_load_timeseries_dict[ fixed_load['timeseries_name'] ]['apparent_power_per_unit'].rename('reactive_power') * fixed_load['scaling_factor'] * fixed_load['reactive_power'] ) class EVChargerModel(FixedDERModel): """EV charger model object.""" def __init__( self, der_data: fledge.database_interface.DERData, der_name: str ): """Construct EV charger model object by `der_data` and `der_name`.""" # Store DER name. self.der_name = der_name # Get fixed load data by `der_name`. ev_charger = der_data.ev_chargers.loc[self.der_name, :] # Store timesteps index. self.timesteps = der_data.ev_charger_timeseries_dict[ev_charger['timeseries_name']].index # Construct active and reactive power timeseries. self.active_power_nominal_timeseries = ( der_data.ev_charger_timeseries_dict[ ev_charger['timeseries_name'] ]['apparent_power_per_unit'].rename('active_power') * ev_charger['scaling_factor'] * ev_charger['active_power'] ) self.reactive_power_nominal_timeseries = ( der_data.ev_charger_timeseries_dict[ ev_charger['timeseries_name'] ]['apparent_power_per_unit'].rename('reactive_power') * ev_charger['scaling_factor'] * ev_charger['reactive_power'] ) class FlexibleDERModel(DERModel): """Flexible DER model, e.g., flexible load, object.""" state_names: pd.Index control_names: pd.Index disturbance_names: pd.Index output_names: pd.Index state_vector_initial: pd.Series state_matrix: pd.DataFrame control_matrix: pd.DataFrame disturbance_matrix: pd.DataFrame state_output_matrix: pd.DataFrame control_output_matrix: pd.DataFrame disturbance_output_matrix: pd.DataFrame disturbance_timeseries: pd.DataFrame output_maximum_timeseries: pd.DataFrame output_minimum_timeseries: pd.DataFrame def define_optimization_variables( self, optimization_problem: pyomo.core.base.PyomoModel.ConcreteModel, ): # Define variables. optimization_problem.state_vector = pyo.Var(self.timesteps, [self.der_name], self.state_names) optimization_problem.control_vector = pyo.Var(self.timesteps, [self.der_name], self.control_names) optimization_problem.output_vector = pyo.Var(self.timesteps, [self.der_name], self.output_names) def define_optimization_constraints( self, optimization_problem: pyomo.core.base.PyomoModel.ConcreteModel ): # Define shorthand for indexing 't+1'. # TODO: Is inferring timestep_interval from timesteps guaranteed to work? timestep_interval = self.timesteps[1] - self.timesteps[0] # Define constraints. if optimization_problem.find_component('flexible_der_model_constraints') is None: optimization_problem.flexible_der_model_constraints = pyo.ConstraintList() # Initial state. for state_name in self.state_names: optimization_problem.flexible_der_model_constraints.add( optimization_problem.state_vector[self.timesteps[0], self.der_name, state_name] == self.state_vector_initial.at[state_name] ) for timestep in self.timesteps[:-1]: # State equation. for state_name in self.state_names: optimization_problem.flexible_der_model_constraints.add( optimization_problem.state_vector[timestep + timestep_interval, self.der_name, state_name] == sum( self.state_matrix.at[state_name, state_name_other] * optimization_problem.state_vector[timestep, self.der_name, state_name_other] for state_name_other in self.state_names ) + sum( self.control_matrix.at[state_name, control_name] * optimization_problem.control_vector[timestep, self.der_name, control_name] for control_name in self.control_names ) + sum( self.disturbance_matrix.at[state_name, disturbance_name] * self.disturbance_timeseries.at[timestep, disturbance_name] for disturbance_name in self.disturbance_names ) ) for timestep in self.timesteps: # Output equation. for output_name in self.output_names: optimization_problem.flexible_der_model_constraints.add( optimization_problem.output_vector[timestep, self.der_name, output_name] == sum( self.state_output_matrix.at[output_name, state_name] * optimization_problem.state_vector[timestep, self.der_name, state_name] for state_name in self.state_names ) + sum( self.control_output_matrix.at[output_name, control_name] * optimization_problem.control_vector[timestep, self.der_name, control_name] for control_name in self.control_names ) + sum( self.disturbance_output_matrix.at[output_name, disturbance_name] * self.disturbance_timeseries.at[timestep, disturbance_name] for disturbance_name in self.disturbance_names ) ) # Output limits. for output_name in self.output_names: optimization_problem.flexible_der_model_constraints.add( optimization_problem.output_vector[timestep, self.der_name, output_name] >= self.output_minimum_timeseries.at[timestep, output_name] ) optimization_problem.flexible_der_model_constraints.add( optimization_problem.output_vector[timestep, self.der_name, output_name] <= self.output_maximum_timeseries.at[timestep, output_name] ) @multimethod def define_optimization_connection_grid( self, optimization_problem: pyomo.core.base.PyomoModel.ConcreteModel, power_flow_solution: fledge.power_flow_solvers.PowerFlowSolution, electric_grid_model: fledge.electric_grid_models.ElectricGridModel, thermal_power_flow_solution: fledge.thermal_grid_models.ThermalPowerFlowSolution, thermal_grid_model: fledge.thermal_grid_models.ThermalGridModel, ): # Connect electric grid. self.define_optimization_connection_grid( optimization_problem, power_flow_solution, electric_grid_model, disconnect_thermal_grid=False ) # Connect thermal grid. self.define_optimization_connection_grid( optimization_problem, thermal_power_flow_solution, thermal_grid_model, disconnect_electric_grid=False ) @multimethod def define_optimization_connection_grid( self, optimization_problem: pyomo.core.base.PyomoModel.ConcreteModel, power_flow_solution: fledge.power_flow_solvers.PowerFlowSolution, electric_grid_model: fledge.electric_grid_models.ElectricGridModel, disconnect_thermal_grid=True ): # Obtain DER index. der_index = int(fledge.utils.get_index(electric_grid_model.ders, der_name=self.der_name)) der = electric_grid_model.ders[der_index] # Define connection constraints. if optimization_problem.find_component('der_connection_constraints') is None: optimization_problem.der_connection_constraints = pyo.ConstraintList() for timestep in self.timesteps: optimization_problem.der_connection_constraints.add( optimization_problem.der_active_power_vector_change[timestep, der] == optimization_problem.output_vector[timestep, self.der_name, 'active_power'] - np.real( power_flow_solution.der_power_vector[der_index] ) ) optimization_problem.der_connection_constraints.add( optimization_problem.der_reactive_power_vector_change[timestep, der] == optimization_problem.output_vector[timestep, self.der_name, 'reactive_power'] - np.imag( power_flow_solution.der_power_vector[der_index] ) ) @multimethod def define_optimization_connection_grid( self, optimization_problem: pyomo.core.base.PyomoModel.ConcreteModel, thermal_power_flow_solution: fledge.thermal_grid_models.ThermalPowerFlowSolution, thermal_grid_model: fledge.thermal_grid_models.ThermalGridModel, disconnect_electric_grid=True ): pass def define_optimization_objective( self, optimization_problem: pyomo.core.base.PyomoModel.ConcreteModel, price_timeseries: pd.DataFrame ): # Define objective. if optimization_problem.find_component('objective') is None: optimization_problem.objective = pyo.Objective(expr=0.0, sense=pyo.minimize) optimization_problem.objective.expr += ( sum( -1.0 * price_timeseries.at[timestep, 'price_value'] * optimization_problem.output_vector[timestep, self.der_name, 'active_power'] for timestep in self.timesteps ) ) def get_optimization_results( self, optimization_problem: pyomo.core.base.PyomoModel.ConcreteModel ): # Instantiate results variables. state_vector = pd.DataFrame(0.0, index=self.timesteps, columns=self.state_names) control_vector = pd.DataFrame(0.0, index=self.timesteps, columns=self.control_names) output_vector = pd.DataFrame(0.0, index=self.timesteps, columns=self.output_names) # Obtain results. for timestep in self.timesteps: for state_name in self.state_names: state_vector.at[timestep, state_name] = ( optimization_problem.state_vector[timestep, self.der_name, state_name].value ) for control_name in self.control_names: control_vector.at[timestep, control_name] = ( optimization_problem.control_vector[timestep, self.der_name, control_name].value ) for output_name in self.output_names: output_vector.at[timestep, output_name] = ( optimization_problem.output_vector[timestep, self.der_name, output_name].value ) return ( state_vector, control_vector, output_vector ) class FlexibleLoadModel(FlexibleDERModel): """Flexible load model object.""" def __init__( self, der_data: fledge.database_interface.DERData, der_name: str ): """Construct flexible load model object by `der_data` and `der_name`.""" # Store DER name. self.der_name = der_name # Get flexible load data by `der_name`. flexible_load = der_data.flexible_loads.loc[der_name, :] # Store timesteps index. self.timesteps = der_data.flexible_load_timeseries_dict[flexible_load['timeseries_name']].index # Construct active and reactive power timeseries. self.active_power_nominal_timeseries = ( der_data.flexible_load_timeseries_dict[ flexible_load['timeseries_name'] ]['apparent_power_per_unit'].rename('active_power') * flexible_load['scaling_factor'] * flexible_load['active_power'] ) self.reactive_power_nominal_timeseries = ( der_data.flexible_load_timeseries_dict[ flexible_load['timeseries_name'] ]['apparent_power_per_unit'].rename('reactive_power') * flexible_load['scaling_factor'] * flexible_load['reactive_power'] ) # Calculate nominal accumulated energy timeseries. # TODO: Consider reactive power in accumulated energy. accumulated_energy_nominal_timeseries = ( self.active_power_nominal_timeseries.cumsum().rename('accumulated_energy') ) # Instantiate indexes. self.state_names = pd.Index(['accumulated_energy']) self.control_names = pd.Index(['active_power', 'reactive_power']) self.disturbance_names = pd.Index([]) self.output_names = pd.Index(['accumulated_energy', 'active_power', 'reactive_power', 'power_factor_constant']) # Instantiate initial state. self.state_vector_initial = ( pd.Series(0.0, index=self.state_names) ) # Instantiate state space matrices. # TODO: Consolidate indexing approach with electric grid model. self.state_matrix = ( pd.DataFrame(0.0, index=self.state_names, columns=self.state_names) ) self.state_matrix.at['accumulated_energy', 'accumulated_energy'] = 1.0 self.control_matrix = ( pd.DataFrame(0.0, index=self.state_names, columns=self.control_names) ) self.control_matrix.at['accumulated_energy', 'active_power'] = 1.0 self.disturbance_matrix = ( pd.DataFrame(0.0, index=self.state_names, columns=self.disturbance_names) ) self.state_output_matrix = ( pd.DataFrame(0.0, index=self.output_names, columns=self.state_names) ) self.state_output_matrix.at['accumulated_energy', 'accumulated_energy'] = 1.0 self.control_output_matrix = ( pd.DataFrame(0.0, index=self.output_names, columns=self.control_names) ) self.control_output_matrix.at['active_power', 'active_power'] = 1.0 self.control_output_matrix.at['reactive_power', 'reactive_power'] = 1.0 self.control_output_matrix.at['power_factor_constant', 'active_power'] = -1.0 / flexible_load['active_power'] self.control_output_matrix.at['power_factor_constant', 'reactive_power'] = 1.0 / flexible_load['reactive_power'] self.disturbance_output_matrix = ( pd.DataFrame(0.0, index=self.output_names, columns=self.disturbance_names) ) # Instantiate disturbance timeseries. self.disturbance_timeseries = ( pd.DataFrame(0.0, index=self.active_power_nominal_timeseries.index, columns=self.disturbance_names) ) # Construct output constraint timeseries # TODO: Fix offset of accumulated energy constraints. self.output_maximum_timeseries = ( pd.concat([ ( accumulated_energy_nominal_timeseries - accumulated_energy_nominal_timeseries[int(flexible_load['time_period_power_shift_maximum'])] ), ( (1.0 - flexible_load['power_decrease_percentage_maximum']) * self.active_power_nominal_timeseries ), ( (1.0 - flexible_load['power_decrease_percentage_maximum']) * self.reactive_power_nominal_timeseries ), pd.Series(0.0, index=self.active_power_nominal_timeseries.index, name='power_factor_constant') ], axis='columns') ) self.output_minimum_timeseries = ( pd.concat([ ( accumulated_energy_nominal_timeseries + accumulated_energy_nominal_timeseries[int(flexible_load['time_period_power_shift_maximum'])] ), ( (1.0 + flexible_load['power_increase_percentage_maximum']) * self.active_power_nominal_timeseries ), ( (1.0 + flexible_load['power_increase_percentage_maximum']) * self.reactive_power_nominal_timeseries ), pd.Series(0.0, index=self.active_power_nominal_timeseries.index, name='power_factor_constant') ], axis='columns') ) class FlexibleBuildingModel(FlexibleDERModel): """Flexible load model object.""" power_factor_nominal: np.float def __init__( self, der_data: fledge.database_interface.DERData, der_name: str ): """Construct flexible building model object by `der_data` and `der_name`.""" # Store DER name. self.der_name = der_name # Obtain shorthands for flexible building data and model by `der_name`. flexible_building = der_data.flexible_buildings.loc[der_name, :] flexible_building_model = der_data.flexible_building_model_dict[flexible_building['model_name']] # Store timesteps. self.timesteps = flexible_building_model.set_timesteps # Obtain nominal power factor. self.power_factor_nominal = ( np.cos(np.arctan( flexible_building['reactive_power'] / flexible_building['active_power'] )) ) # Construct nominal active and reactive power timeseries. self.active_power_nominal_timeseries = ( pd.Series( 1.0, index=self.timesteps ) * flexible_building['active_power'] ) self.reactive_power_nominal_timeseries = ( pd.Series( 1.0, index=self.timesteps ) * flexible_building['reactive_power'] ) # Obtain indexes. self.state_names = flexible_building_model.set_states self.control_names = flexible_building_model.set_controls self.disturbance_names = flexible_building_model.set_disturbances self.output_names = flexible_building_model.set_outputs # Obtain initial state. self.state_vector_initial = flexible_building_model.set_state_initial # Obtain state space matrices. self.state_matrix = flexible_building_model.state_matrix self.control_matrix = flexible_building_model.control_matrix self.disturbance_matrix = flexible_building_model.disturbance_matrix self.state_output_matrix = flexible_building_model.state_output_matrix self.control_output_matrix = flexible_building_model.control_output_matrix self.disturbance_output_matrix = flexible_building_model.disturbance_output_matrix # Instantiate disturbance timeseries. self.disturbance_timeseries = flexible_building_model.disturbance_timeseries # Obtain output constraint timeseries self.output_maximum_timeseries = flexible_building_model.output_constraint_timeseries_maximum self.output_minimum_timeseries = flexible_building_model.output_constraint_timeseries_minimum @multimethod def define_optimization_connection_grid( self, optimization_problem: pyomo.core.base.PyomoModel.ConcreteModel, power_flow_solution: fledge.power_flow_solvers.PowerFlowSolution, electric_grid_model: fledge.electric_grid_models.ElectricGridModel, thermal_power_flow_solution: fledge.thermal_grid_models.ThermalPowerFlowSolution, thermal_grid_model: fledge.thermal_grid_models.ThermalGridModel, ): # Connect electric grid. self.define_optimization_connection_grid( optimization_problem, power_flow_solution, electric_grid_model, disconnect_thermal_grid=False ) # Connect thermal grid. self.define_optimization_connection_grid( optimization_problem, thermal_power_flow_solution, thermal_grid_model, disconnect_electric_grid=False ) @multimethod def define_optimization_connection_grid( self, optimization_problem: pyomo.core.base.PyomoModel.ConcreteModel, power_flow_solution: fledge.power_flow_solvers.PowerFlowSolution, electric_grid_model: fledge.electric_grid_models.ElectricGridModel, disconnect_thermal_grid=True ): # Obtain DER index. der_index = int(fledge.utils.get_index(electric_grid_model.ders, der_name=self.der_name)) der = electric_grid_model.ders[der_index] # Define connection constraints. if optimization_problem.find_component('der_connection_constraints') is None: optimization_problem.der_connection_constraints = pyo.ConstraintList() for timestep in self.timesteps: optimization_problem.der_connection_constraints.add( optimization_problem.der_active_power_vector_change[timestep, der] == -1.0 * optimization_problem.output_vector[timestep, self.der_name, 'grid_electric_power'] - np.real( power_flow_solution.der_power_vector[der_index] ) ) optimization_problem.der_connection_constraints.add( optimization_problem.der_reactive_power_vector_change[timestep, der] == -1.0 * ( optimization_problem.output_vector[timestep, self.der_name, 'grid_electric_power'] * np.tan(np.arccos(self.power_factor_nominal)) ) - np.imag( power_flow_solution.der_power_vector[der_index] ) ) # Disable thermal grid connection. if disconnect_thermal_grid: optimization_problem.der_connection_constraints.add( 0.0 == optimization_problem.output_vector[timestep, self.der_name, 'grid_thermal_power_cooling'] ) @multimethod def define_optimization_connection_grid( self, optimization_problem: pyomo.core.base.PyomoModel.ConcreteModel, thermal_power_flow_solution: fledge.thermal_grid_models.ThermalPowerFlowSolution, thermal_grid_model: fledge.thermal_grid_models.ThermalGridModel, disconnect_electric_grid=True ): # Obtain DER index. der_index = int(fledge.utils.get_index(thermal_grid_model.ders, der_name=self.der_name)) der = thermal_grid_model.ders[der_index] # Define connection constraints. if optimization_problem.find_component('der_connection_constraints') is None: optimization_problem.der_connection_constraints = pyo.ConstraintList() for timestep in self.timesteps: optimization_problem.der_connection_constraints.add( optimization_problem.der_thermal_power_vector[timestep, der] == -1.0 * optimization_problem.output_vector[timestep, self.der_name, 'grid_thermal_power_cooling'] ) # Disable electric grid connection. if disconnect_electric_grid: optimization_problem.der_connection_constraints.add( 0.0 == optimization_problem.output_vector[timestep, self.der_name, 'grid_electric_power'] ) def define_optimization_objective( self, optimization_problem: pyomo.core.base.PyomoModel.ConcreteModel, price_timeseries: pd.DataFrame ): # Define objective. if optimization_problem.find_component('objective') is None: optimization_problem.objective = pyo.Objective(expr=0.0, sense=pyo.minimize) optimization_problem.objective.expr += ( sum( price_timeseries.at[timestep, 'price_value'] * optimization_problem.output_vector[timestep, self.der_name, 'grid_electric_power'] for timestep in self.timesteps ) ) class DERModelSet(object): """DER model set object.""" timesteps: pd.Index der_names: pd.Index fixed_der_names: pd.Index flexible_der_names: pd.Index der_models: typing.Dict[str, DERModel] fixed_der_models: typing.Dict[str, FixedDERModel] flexible_der_models: typing.Dict[str, FlexibleDERModel] def __init__( self, scenario_name: str ): # Obtain data. scenario_data = fledge.database_interface.ScenarioData(scenario_name) der_data = fledge.database_interface.DERData(scenario_name) # Obtain timesteps. self.timesteps = scenario_data.timesteps # Obtain DER names. self.der_names = ( pd.Index(pd.concat([ der_data.fixed_loads['der_name'], der_data.ev_chargers['der_name'], der_data.flexible_loads['der_name'], der_data.flexible_buildings['der_name'] ])) ) self.fixed_der_names = ( pd.Index(pd.concat([ der_data.fixed_loads['der_name'], der_data.ev_chargers['der_name'], ])) ) self.flexible_der_names = ( pd.Index(pd.concat([ der_data.flexible_loads['der_name'], der_data.flexible_buildings['der_name'] ])) ) # Obtain models. self.der_models = dict.fromkeys(self.der_names) self.fixed_der_models = dict.fromkeys(self.fixed_der_names) self.flexible_der_models = dict.fromkeys(self.flexible_der_names) for der_name in self.der_names: if der_name in der_data.fixed_loads['der_name']: self.der_models[der_name] = self.fixed_der_models[der_name] = ( fledge.der_models.FixedLoadModel( der_data, der_name ) ) elif der_name in der_data.ev_chargers['der_name']: self.der_models[der_name] = self.fixed_der_models[der_name] = ( fledge.der_models.EVChargerModel( der_data, der_name ) ) elif der_name in der_data.flexible_loads['der_name']: self.der_models[der_name] = self.flexible_der_models[der_name] = ( fledge.der_models.FlexibleLoadModel( der_data, der_name ) ) elif der_name in der_data.flexible_buildings['der_name']: self.der_models[der_name] = self.flexible_der_models[der_name] = ( fledge.der_models.FlexibleBuildingModel( der_data, der_name ) ) else: logger.error(f"Cannot determine type of DER: {der_name}") raise ValueError def define_optimization_variables( self, optimization_problem: pyomo.core.base.PyomoModel.ConcreteModel ): # Define flexible DER variables. der_state_names = [ (der_name, state_name) for der_name in self.flexible_der_names for state_name in self.flexible_der_models[der_name].state_names ] der_control_names = [ (der_name, control_name) for der_name in self.flexible_der_names for control_name in self.flexible_der_models[der_name].control_names ] der_output_names = [ (der_name, output_name) for der_name in self.flexible_der_names for output_name in self.flexible_der_models[der_name].output_names ] optimization_problem.state_vector = pyo.Var(self.timesteps, der_state_names) optimization_problem.control_vector = pyo.Var(self.timesteps, der_control_names) optimization_problem.output_vector = pyo.Var(self.timesteps, der_output_names) def define_optimization_constraints( self, optimization_problem: pyomo.core.base.PyomoModel.ConcreteModel ): # Define DER constraints, only for flexible DERs. for der_name in self.flexible_der_names: self.flexible_der_models[der_name].define_optimization_constraints( optimization_problem ) @multimethod def define_optimization_connection_grid( self, optimization_problem: pyomo.core.base.PyomoModel.ConcreteModel, power_flow_solution: fledge.power_flow_solvers.PowerFlowSolution, electric_grid_model: fledge.electric_grid_models.ElectricGridModel, thermal_power_flow_solution: fledge.thermal_grid_models.ThermalPowerFlowSolution, thermal_grid_model: fledge.thermal_grid_models.ThermalGridModel, ): # Define constraints for the connection with the DER power vector of the grid. for der_name in self.der_names: self.der_models[der_name].define_optimization_connection_grid( optimization_problem, power_flow_solution, electric_grid_model, thermal_power_flow_solution, thermal_grid_model ) @multimethod def define_optimization_connection_grid( self, optimization_problem: pyomo.core.base.PyomoModel.ConcreteModel, power_flow_solution: fledge.power_flow_solvers.PowerFlowSolution, electric_grid_model: fledge.electric_grid_models.ElectricGridModel, **kwargs ): # Define constraints for the connection with the DER power vector of the grid. for der_name in self.der_names: self.der_models[der_name].define_optimization_connection_grid( optimization_problem, power_flow_solution, electric_grid_model, **kwargs ) @multimethod def define_optimization_connection_grid( self, optimization_problem: pyomo.core.base.PyomoModel.ConcreteModel, thermal_power_flow_solution: fledge.thermal_grid_models.ThermalPowerFlowSolution, thermal_grid_model: fledge.thermal_grid_models.ThermalGridModel, **kwargs ): # Define constraints for the connection with the DER power vector of the grid. for der_name in self.der_names: self.der_models[der_name].define_optimization_connection_grid( optimization_problem, thermal_power_flow_solution, thermal_grid_model, **kwargs ) def define_optimization_objective( self, optimization_problem: pyomo.core.base.PyomoModel.ConcreteModel, price_timeseries: pd.DataFrame ): # Define objective, only for flexible DERs. for der_name in self.flexible_der_names: self.flexible_der_models[der_name].define_optimization_objective( optimization_problem, price_timeseries )
40.164027
120
0.632615
3,630
35,505
5.825069
0.055923
0.036415
0.017687
0.027808
0.816363
0.752991
0.720832
0.68943
0.67406
0.661007
0
0.002919
0.295733
35,505
883
121
40.209513
0.842711
0.074863
0
0.569767
0
0
0.05123
0.019043
0
0
0
0.001133
0
1
0.037791
false
0.00436
0.017442
0.001453
0.107558
0
0
0
0
null
0
0
0
1
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
4
4962a32c536cbb23c48681cc48636d4fe4007362
85
py
Python
app/backend/mails/apps.py
NicholasCF/meridien
dd00caf341d4c9979b89dc8441224ff2b97eac7f
[ "MIT" ]
1
2020-11-17T18:50:44.000Z
2020-11-17T18:50:44.000Z
app/backend/mails/apps.py
NicholasCF/meridien
dd00caf341d4c9979b89dc8441224ff2b97eac7f
[ "MIT" ]
41
2020-05-24T06:47:53.000Z
2022-02-27T11:10:41.000Z
app/backend/mails/apps.py
NicholasCF/meridien
dd00caf341d4c9979b89dc8441224ff2b97eac7f
[ "MIT" ]
2
2020-11-26T12:19:30.000Z
2020-12-19T01:14:02.000Z
from django.apps import AppConfig class MailsConfig(AppConfig): name = 'mails'
14.166667
33
0.741176
10
85
6.3
0.9
0
0
0
0
0
0
0
0
0
0
0
0.176471
85
5
34
17
0.9
0
0
0
0
0
0.058824
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
1
0
0
4
4982a7df803e292530d76a29271c871349c9de59
129
py
Python
beers/urls.py
rmedeiros/open-webinars-django
98fa5baedb0195a76075f279e95a6702557dad94
[ "Apache-2.0" ]
null
null
null
beers/urls.py
rmedeiros/open-webinars-django
98fa5baedb0195a76075f279e95a6702557dad94
[ "Apache-2.0" ]
null
null
null
beers/urls.py
rmedeiros/open-webinars-django
98fa5baedb0195a76075f279e95a6702557dad94
[ "Apache-2.0" ]
null
null
null
from django.urls import path from beers.views import first_view urlpatterns = [ path('', first_view, name='first_view'), ]
16.125
44
0.72093
18
129
5
0.611111
0.3
0
0
0
0
0
0
0
0
0
0
0.162791
129
7
45
18.428571
0.833333
0
0
0
0
0
0.077519
0
0
0
0
0
0
1
0
false
0
0.4
0
0.4
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
1
0
0
0
0
4
499330e97295eea549e47c184964e57f97c0bc72
249
py
Python
Python/calculoMedia.py
schiblich/Practice
bb3572328196bf47b07ec03bc3e78b87ecaf783c
[ "MIT" ]
null
null
null
Python/calculoMedia.py
schiblich/Practice
bb3572328196bf47b07ec03bc3e78b87ecaf783c
[ "MIT" ]
null
null
null
Python/calculoMedia.py
schiblich/Practice
bb3572328196bf47b07ec03bc3e78b87ecaf783c
[ "MIT" ]
1
2022-01-31T21:27:23.000Z
2022-01-31T21:27:23.000Z
import math a = float(input("Digite um numero")) b = float(input("Digite um numero")) c = float(input("Digite um numero")) d = float(input("Digite um numero")) e = float(input("Digite um numero")) calc = (a + b + c + d + e)/ 5 print(math.ceil(calc))
31.125
36
0.650602
43
249
3.767442
0.372093
0.308642
0.493827
0.555556
0.740741
0
0
0
0
0
0
0.004762
0.156627
249
8
37
31.125
0.766667
0
0
0
0
0
0.32
0
0
0
0
0
0
1
0
false
0
0.125
0
0.125
0.125
0
0
0
null
1
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
4
499a48ae026e14b95580d3dd9a459acb83926f1e
50
py
Python
MathYouDidntNeed/__init__.py
SamAsh11414/MathYouDidntNeed
570fc79ddec18b92563186015b01b5dd03e68237
[ "MIT" ]
1
2021-12-09T06:04:16.000Z
2021-12-09T06:04:16.000Z
MathYouDidntNeed/__init__.py
SamAsh11414/MathYouDidntNeed
570fc79ddec18b92563186015b01b5dd03e68237
[ "MIT" ]
2
2021-10-05T12:24:49.000Z
2022-02-09T22:15:45.000Z
MathYouDidntNeed/__init__.py
SamAsh11414/MathYouDidntNeed
570fc79ddec18b92563186015b01b5dd03e68237
[ "MIT" ]
null
null
null
from MathYouDidntNeed.RadianDegrees import Convert
50
50
0.92
5
50
9.2
1
0
0
0
0
0
0
0
0
0
0
0
0.06
50
1
50
50
0.978723
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
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
1
0
1
0
0
0
0
4
b8c691e8fd2f895111e54be205b5d0729e7550b2
349
py
Python
polls/serializers.py
awsbreathpanda/drfsite
2ff4bd2b21e6c35fcdae8cf0848a3be7e33fb964
[ "MIT" ]
null
null
null
polls/serializers.py
awsbreathpanda/drfsite
2ff4bd2b21e6c35fcdae8cf0848a3be7e33fb964
[ "MIT" ]
null
null
null
polls/serializers.py
awsbreathpanda/drfsite
2ff4bd2b21e6c35fcdae8cf0848a3be7e33fb964
[ "MIT" ]
null
null
null
from rest_framework import serializers from polls.models import Question, Choice class QuestionSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Question fields = '__all__' class ChoiceSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Choice fields = '__all__'
23.266667
65
0.733524
31
349
7.967742
0.548387
0.299595
0.340081
0.37247
0.412955
0
0
0
0
0
0
0
0.209169
349
14
66
24.928571
0.894928
0
0
0.4
0
0
0.040115
0
0
0
0
0
0
1
0
false
0
0.2
0
0.6
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
1
0
0
4
b8c955d4e8c0d21ef350932011913822da55c3d7
272
py
Python
src/platform/weblogic/deployers/webs_deploy.py
0x27/clusterd
0f04a4955c61aa523274e9ae35d750f4339b1e59
[ "MIT" ]
539
2015-01-08T23:59:32.000Z
2022-03-29T17:53:02.000Z
src/platform/weblogic/deployers/webs_deploy.py
M31MOTH/clusterd
d190b2cbaa93820e928a7ce5471c661d4559fb7c
[ "MIT" ]
21
2015-01-17T21:51:21.000Z
2019-09-20T09:23:18.000Z
src/platform/weblogic/deployers/webs_deploy.py
M31MOTH/clusterd
d190b2cbaa93820e928a7ce5471c661d4559fb7c
[ "MIT" ]
192
2015-01-26T20:44:14.000Z
2021-12-22T01:39:50.000Z
from src.platform.weblogic.interfaces import WINTERFACES import src.platform.weblogic.deployers.web_deploy as web_deploy versions = ["10", "11", "12"] title = WINTERFACES.WLS def deploy(fingerengine, fingerprint): return web_deploy.deploy(fingerengine, fingerprint)
30.222222
63
0.794118
34
272
6.264706
0.617647
0.126761
0.178404
0
0
0
0
0
0
0
0
0.02459
0.102941
272
8
64
34
0.848361
0
0
0
0
0
0.022059
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0.166667
0.666667
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
0
0
1
1
1
0
0
4
b8d5a602597757e827120a1e5c617adddb12763f
237
py
Python
hoodzapp/admin.py
philipkariuki/neighbourhood
c4c15d3aee5ebc95d0190bc759948c384f5c132c
[ "MIT" ]
null
null
null
hoodzapp/admin.py
philipkariuki/neighbourhood
c4c15d3aee5ebc95d0190bc759948c384f5c132c
[ "MIT" ]
4
2020-06-05T22:15:06.000Z
2021-09-08T01:12:46.000Z
hoodzapp/admin.py
philipkariuki/neighbourhood
c4c15d3aee5ebc95d0190bc759948c384f5c132c
[ "MIT" ]
null
null
null
from django.contrib import admin from .models import Post, Thahood, UserProfile, Business # Register your models here. admin.site.register(Post) admin.site.register(UserProfile) admin.site.register(Thahood) admin.site.register(Business)
29.625
56
0.818565
32
237
6.0625
0.4375
0.185567
0.350515
0
0
0
0
0
0
0
0
0
0.084388
237
8
57
29.625
0.894009
0.109705
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0
0
0
0
null
0
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
1
0
1
0
0
0
0
4
b8e874401328e8b11be5cd342fa2c33e6eae5da8
110
py
Python
python/testData/psi/IfStatement.py
jnthn/intellij-community
8fa7c8a3ace62400c838e0d5926a7be106aa8557
[ "Apache-2.0" ]
2
2019-04-28T07:48:50.000Z
2020-12-11T14:18:08.000Z
python/testData/psi/IfStatement.py
jnthn/intellij-community
8fa7c8a3ace62400c838e0d5926a7be106aa8557
[ "Apache-2.0" ]
173
2018-07-05T13:59:39.000Z
2018-08-09T01:12:03.000Z
python/testData/psi/IfStatement.py
jnthn/intellij-community
8fa7c8a3ace62400c838e0d5926a7be106aa8557
[ "Apache-2.0" ]
2
2020-03-15T08:57:37.000Z
2020-04-07T04:48:14.000Z
if 0: pass if 1: pass else: pass if 2: pass elif 3: pass if 4: pass elif 5: pass else: 1
5.238095
7
0.536364
22
110
2.681818
0.454545
0.305085
0
0
0
0
0
0
0
0
0
0.104478
0.390909
110
20
8
5.5
0.776119
0
0
0.5625
0
0
0
0
0
0
0
0
0
1
0
true
0.4375
0
0
0
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
4
771812a25e0fd30eaa5af7c8a99d9cd85e094e79
159
py
Python
Meus_dessafios/Exercicios2021/ex007.py
DiegoSilvaHoffmann/Curso-de-Python
62824bbd3ed42b256fda77acd49536ec7cf23b29
[ "MIT" ]
null
null
null
Meus_dessafios/Exercicios2021/ex007.py
DiegoSilvaHoffmann/Curso-de-Python
62824bbd3ed42b256fda77acd49536ec7cf23b29
[ "MIT" ]
null
null
null
Meus_dessafios/Exercicios2021/ex007.py
DiegoSilvaHoffmann/Curso-de-Python
62824bbd3ed42b256fda77acd49536ec7cf23b29
[ "MIT" ]
null
null
null
n1 = float(input('Informe a primeira nota do Aluno: ')) n2 = float(input('informe a segunda nota: ')) m = (n1 + n2) / 2 print('Sua media foi de {}'.format(m))
31.8
55
0.63522
27
159
3.740741
0.703704
0.19802
0.336634
0.356436
0
0
0
0
0
0
0
0.038168
0.176101
159
4
56
39.75
0.732824
0
0
0
0
0
0.484277
0
0
0
0
0
0
1
0
false
0
0
0
0
0.25
1
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
4