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
aa4ef2d9ea34cac394dfd068462eacae94338cce
8,849
py
Python
devilry/devilry_examiner/views/assignment/bulkoperations/bulk_feedback.py
devilry/devilry-django
9ae28e462dfa4cfee966ebacbca04ade9627e715
[ "BSD-3-Clause" ]
29
2015-01-18T22:56:23.000Z
2020-11-10T21:28:27.000Z
devilry/devilry_examiner/views/assignment/bulkoperations/bulk_feedback.py
devilry/devilry-django
9ae28e462dfa4cfee966ebacbca04ade9627e715
[ "BSD-3-Clause" ]
786
2015-01-06T16:10:18.000Z
2022-03-16T11:10:50.000Z
devilry/devilry_examiner/views/assignment/bulkoperations/bulk_feedback.py
devilry/devilry-django
9ae28e462dfa4cfee966ebacbca04ade9627e715
[ "BSD-3-Clause" ]
15
2015-04-06T06:18:43.000Z
2021-02-24T12:28:30.000Z
from django import forms from django.contrib import messages from django.db import models from django.db import transaction from django.http import HttpResponseRedirect, Http404 from django.utils import timezone from django.utils.translation import gettext_lazy, pgettext_lazy from django.views.generic import View import django_rq from devilry.apps.core import models as core_models from devilry.devilry_comment import models as comment_models from devilry.devilry_cradmin import devilry_listbuilder from devilry.devilry_examiner.views.assignment.bulkoperations import bulk_operations_grouplist from devilry.devilry_group import models as group_models from devilry.devilry_email.feedback_email import feedback_email class AssignPointsForm(bulk_operations_grouplist.SelectedAssignmentGroupForm): """ Subclassed the select form and adds a ``IntegerField`` for points. """ #: Set the amount of points. points = forms.IntegerField( min_value=0, help_text='Add a score that will be given to all selected assignment groups.', required=True, label=pgettext_lazy('Points')) def get_grading_points(self): return self.cleaned_data['points'] class PointsTargetRenderer(bulk_operations_grouplist.AssignmentGroupTargetRenderer): def get_field_layout(self): layout = super(PointsTargetRenderer, self).get_field_layout() layout.append('points') return layout class AssignPassedFailedForm(bulk_operations_grouplist.SelectedAssignmentGroupForm): """ Subclassed the select form and adds a ``Boolean`` field to provide a passed/failed grade. """ #: Set delivery as passed or failed. passed = forms.BooleanField( label=pgettext_lazy('grading', 'Passed?'), help_text=pgettext_lazy('grading', 'Check to provide a passing grade.'), initial=True, required=False) def get_grading_points(self): if self.cleaned_data['passed']: return self.assignment.max_points else: return 0 class PassedFailedTargetRenderer(bulk_operations_grouplist.AssignmentGroupTargetRenderer): def get_field_layout(self): layout = super(PassedFailedTargetRenderer, self).get_field_layout() layout.append('passed') return layout class AbstractBulkFeedbackListView(bulk_operations_grouplist.AbstractAssignmentGroupMultiSelectListFilterView): """ Base class that handles all the logic of bulk creating feedbacks. Extend this class with a subclass that uses a form suited for the :attr:``~.devilry.apps.core.models.Assignment.grading_system_plugin_id``. Example: Bulk feedback class points based Assignment:: class BulkFeedbackPassedFailedView(AbstractBulkFeedbackListView): def get_filterlist_url(self, filters_string): return self.request.cradmin_app.reverse_appurl( 'bulk-feedback-passedfailed-filter', kwargs={'filters_string': filters_string}) def get_target_renderer_class(self): return PassedFailedTargetRenderer def get_form_class(self): return AssignPassedFailedForm """ value_renderer_class = devilry_listbuilder.assignmentgroup.ExaminerMultiselectItemValue template_name = 'devilry_examiner/assignment/bulk_create_feedback.django.html' def get_pagetitle(self): return gettext_lazy('Bulk create feedback') def get_filterlist_url(self, filters_string): raise NotImplementedError() def get_unfiltered_queryset_for_role(self, role): queryset = super(AbstractBulkFeedbackListView, self).get_unfiltered_queryset_for_role(role) return queryset\ .filter_examiner_has_access(user=self.request.user) \ .exclude(cached_data__last_published_feedbackset=models.F('cached_data__last_feedbackset')) def __create_grading_groupcomment(self, feedback_set_id, published_time, text): """ Create an entry of :class:`~.devilry.devilry_group.models.GroupComment` as part of grading for the :class:`~.devilry.devilry_group.models.FeedbackSet` that received feedback. Args: feedback_set_id: comment for this feedback. published_time: Time the comment was published. text: Text provided by examiner. """ group_models.GroupComment.objects.create( feedback_set_id=feedback_set_id, part_of_grading=True, visibility=group_models.GroupComment.VISIBILITY_VISIBLE_TO_EVERYONE, user=self.request.user, user_role=comment_models.Comment.USER_ROLE_EXAMINER, text=text, comment_type=comment_models.Comment.COMMENT_TYPE_GROUPCOMMENT, published_datetime=published_time ) def form_valid(self, form): """ Creates entries of :class:`~.devilry.devilry_group.models.GroupComment`s for all the :class:`~.devilry.devilry_group.models.FeedbackSet`s that is given a bulk feedback. Note: Using ``transaction.atomic()`` for single transaction when creating ``GroupComment``s and updating the ``FeedbackSet``s. If anything goes wrong, the transaction is rolled back and nothing is saved to the database. Args: form: cleaned form. """ feedback_set_ids = self.get_feedbackset_ids_from_posted_ids(form=form) points = form.get_grading_points() text = form.cleaned_data['feedback_comment_text'] # Cache anonymous display names before transaction. Needed for django messages. displaynames = self.get_group_displaynames(form=form) now_without_microseconds = timezone.now().replace(microsecond=0) with transaction.atomic(): for feedback_set_id in feedback_set_ids: self.__create_grading_groupcomment( feedback_set_id=feedback_set_id, published_time=now_without_microseconds, text=text) group_models.FeedbackSet.objects\ .filter(id__in=feedback_set_ids)\ .update( grading_published_by=self.request.user, grading_published_datetime=now_without_microseconds + timezone.timedelta(microseconds=1), grading_points=points) feedback_email.bulk_send_feedback_created_email( assignment_id=self.assignment.id, feedbackset_id_list=feedback_set_ids, domain_url_start=self.request.build_absolute_uri('/')) self.add_success_message(displaynames) return super(AbstractBulkFeedbackListView, self).form_valid(form=form) def add_success_message(self, anonymous_display_names): message = gettext_lazy('Bulk added feedback for %(group_names)s') % { 'group_names': ', '.join(anonymous_display_names)} messages.success(self.request, message=message) class BulkFeedbackPointsView(AbstractBulkFeedbackListView): """ Handles bulkfeedback for assignment with points-based grading system. """ def get_filterlist_url(self, filters_string): return self.request.cradmin_app.reverse_appurl( 'bulk-feedback-points-filter', kwargs={'filters_string': filters_string}) def get_target_renderer_class(self): return PointsTargetRenderer def get_form_class(self): return AssignPointsForm class BulkFeedbackPassedFailedView(AbstractBulkFeedbackListView): """ Handles bulkfeedback for assignment with passed/failed grading system. """ def get_filterlist_url(self, filters_string): return self.request.cradmin_app.reverse_appurl( 'bulk-feedback-passedfailed-filter', kwargs={'filters_string': filters_string}) def get_target_renderer_class(self): return PassedFailedTargetRenderer def get_form_class(self): return AssignPassedFailedForm class BulkFeedbackRedirectView(View): """ Redirects to the appropriate view based on the assignments grading system type. """ def dispatch(self, request, *args, **kwargs): grading_plugin_id = self.request.cradmin_role.grading_system_plugin_id if grading_plugin_id == core_models.Assignment.GRADING_SYSTEM_PLUGIN_ID_POINTS: return HttpResponseRedirect(request.cradmin_app.reverse_appurl('bulk-feedback-points')) grading_plugin_id = self.request.cradmin_role.grading_system_plugin_id if grading_plugin_id == core_models.Assignment.GRADING_SYSTEM_PLUGIN_ID_PASSEDFAILED: return HttpResponseRedirect(request.cradmin_app.reverse_appurl('bulk-feedback-passedfailed')) return Http404()
40.591743
111
0.711154
974
8,849
6.201232
0.235113
0.015894
0.015066
0.017384
0.34702
0.317715
0.273841
0.231954
0.22798
0.205464
0
0.001441
0.215731
8,849
217
112
40.778802
0.868876
0.228274
0
0.158333
0
0
0.071254
0.029969
0
0
0
0
0
1
0.141667
false
0.116667
0.125
0.066667
0.508333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
2
aa819751141039d158103e1e22f76244cbd9c7bf
874
py
Python
configs/_base_/models/x3d.py
ptoupas/mmaction2
1e1911295b63cffeba4c6f4809cb74d291c4505b
[ "Apache-2.0" ]
null
null
null
configs/_base_/models/x3d.py
ptoupas/mmaction2
1e1911295b63cffeba4c6f4809cb74d291c4505b
[ "Apache-2.0" ]
null
null
null
configs/_base_/models/x3d.py
ptoupas/mmaction2
1e1911295b63cffeba4c6f4809cb74d291c4505b
[ "Apache-2.0" ]
null
null
null
# model settings model = dict( type='Recognizer3D', backbone=dict(type='X3D', frozen_stages = -1, gamma_w=1, gamma_b=2.25, gamma_d=2.2), cls_head=dict( type='X3DHead', in_channels=432, num_classes=400, multi_class=False, spatial_type='avg', dropout_ratio=0.7, fc1_bias=False), # model training and testing settings train_cfg=None, test_cfg=dict(average_clips='prob')) # model = dict( # type='Recognizer3D', # backbone=dict(type='X3D', frozen_stages = 0, gamma_w=2, gamma_b=2.25, gamma_d=5), # cls_head=dict( # type='X3DHead', # in_channels=864, # num_classes=7, # spatial_type='avg', # dropout_ratio=0.6, # fc1_bias=False), # # model training and testing settings # train_cfg=None, # test_cfg=dict(average_clips='prob'))
29.133333
88
0.606407
118
874
4.262712
0.415254
0.095427
0.05169
0.099404
0.842942
0.842942
0.675944
0.548708
0.548708
0.548708
0
0.053681
0.254005
874
29
89
30.137931
0.717791
0.512586
0
0
0
0
0.070905
0
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
aa97298a7164be0094cd007d6b0ccc9b510f720f
329
py
Python
test.py
sxhfut/Kashgari
efc9510ed53f5bb78183e66d96d57a55cc290a91
[ "MIT" ]
1
2019-01-26T15:18:07.000Z
2019-01-26T15:18:07.000Z
test.py
sxhfut/Kashgari
efc9510ed53f5bb78183e66d96d57a55cc290a91
[ "MIT" ]
null
null
null
test.py
sxhfut/Kashgari
efc9510ed53f5bb78183e66d96d57a55cc290a91
[ "MIT" ]
null
null
null
# encoding: utf-8 """ @author: BrikerMan @contact: eliyar917@gmail.com @blog: https://eliyar.biz @version: 1.0 @license: Apache Licence @file: test.py.py @time: 2019-01-25 14:43 """ import unittest from tests import * from kashgari.utils.logger import init_logger init_logger() if __name__ == '__main__': unittest.main()
15.666667
45
0.717325
48
329
4.708333
0.8125
0.088496
0
0
0
0
0
0
0
0
0
0.06338
0.136778
329
20
46
16.45
0.732394
0.525836
0
0
0
0
0.054422
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
2
aa9a7b51d2199fe8ca1968592f12f16f55f4da67
536
py
Python
crossasr/text.py
mhilmiasyrofi/CrossASRv2
202b9a7caadf5f8d6f115f776526960af35a73a3
[ "MIT" ]
3
2021-05-12T02:48:06.000Z
2021-12-21T14:45:56.000Z
crossasr/text.py
mhilmiasyrofi/CrossASRv2
202b9a7caadf5f8d6f115f776526960af35a73a3
[ "MIT" ]
null
null
null
crossasr/text.py
mhilmiasyrofi/CrossASRv2
202b9a7caadf5f8d6f115f776526960af35a73a3
[ "MIT" ]
1
2021-06-14T11:15:35.000Z
2021-06-14T11:15:35.000Z
import functools @functools.total_ordering class Text: def __init__(self, id: int, text: str): self.id = id self.text = text def __eq__(self, other): return self.id == other.id and self.text == other.text def __lt__(self, other): return (self.id, self.text) < (other.id, other.text) def getId(self): return self.id def setId(self, id: int): self.id = id def getText(self): return self.text def setText(self, text: str): self.text = text
20.615385
62
0.587687
75
536
4.026667
0.28
0.139073
0.119205
0.125828
0.139073
0
0
0
0
0
0
0
0.294776
536
25
63
21.44
0.798942
0
0
0.222222
0
0
0
0
0
0
0
0
0
1
0.388889
false
0
0.055556
0.222222
0.722222
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
2
aa9c683934f9013e24a201545cdec92668339683
912
py
Python
ansibler/exceptions/ansibler.py
ProfessorManhattan/ansibler
ca3cbd8af974b59a70e6c46b4ee7f97f68158031
[ "MIT" ]
null
null
null
ansibler/exceptions/ansibler.py
ProfessorManhattan/ansibler
ca3cbd8af974b59a70e6c46b4ee7f97f68158031
[ "MIT" ]
null
null
null
ansibler/exceptions/ansibler.py
ProfessorManhattan/ansibler
ca3cbd8af974b59a70e6c46b4ee7f97f68158031
[ "MIT" ]
null
null
null
class BaseAnsiblerException(Exception): message = "Error" def __init__(self, *args, **kwargs) -> None: super().__init__(*args) self.__class__.message = kwargs.get("message", self.message) def __str__(self) -> str: return self.__class__.message class CommandNotFound(BaseAnsiblerException): message = "Command not found" class RolesParseError(BaseAnsiblerException): message = "Could not parse default roles" class MetaYMLError(BaseAnsiblerException): message = "Invalid meta/main.yml" class RoleMetadataError(BaseAnsiblerException): message = "Role metadata error" class MoleculeTestsNotFound(BaseAnsiblerException): message = "Molecule tests not foound" class MoleculeTestParseError(BaseAnsiblerException): message = "Could not parse molecule test file" class NoPackageJsonError(BaseAnsiblerException): message = "No package.json"
24
68
0.737939
86
912
7.593023
0.5
0.300153
0.049005
0.11026
0.125574
0
0
0
0
0
0
0
0.169956
912
37
69
24.648649
0.862616
0
0
0
0
0
0.188596
0
0
0
0
0
0
1
0.095238
false
0
0
0.047619
0.904762
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
0
0
0
0
0
1
0
0
2
aaaa178c8c04cddbd491ee6f45b2a2ede27a0ba8
1,131
py
Python
src/commons/helpers.py
thierrydecker/nfpy
bda460feb07719e66dc25c763172fc380559e022
[ "Apache-2.0" ]
null
null
null
src/commons/helpers.py
thierrydecker/nfpy
bda460feb07719e66dc25c763172fc380559e022
[ "Apache-2.0" ]
null
null
null
src/commons/helpers.py
thierrydecker/nfpy
bda460feb07719e66dc25c763172fc380559e022
[ "Apache-2.0" ]
null
null
null
"""helpers module """ import json import pcap import yaml def get_adapters_names(): """Finds all adapters on the system :return: A list of the network adapters available on the system """ return pcap.findalldevs() def config_loader_yaml(config_name): """Loads a .yml configuration file :param config_name: The path name of the yml configuration file :return: A dictionary of the configuration """ with open(config_name, 'r') as f: config_yml = f.read() return yaml.load(config_yml) def log_message(queue, level, module_name, class_name, function_name, message): """Sends a message to a log worker process :param queue: A queue to send the message to :param level: A string identifying the level of the message (Either DEBUG, INFO, WARNING, ERROR, CRITICAL :param module: A string identifying the source module of the message :param function: A string identifying the source function module of the message :param message: A string representing the message :return: """ queue.put((level, module_name, class_name, function_name, message))
28.275
109
0.713528
162
1,131
4.882716
0.376543
0.037927
0.068268
0.079646
0.235145
0.108723
0.108723
0.108723
0
0
0
0
0.209549
1,131
39
110
29
0.884787
0.576481
0
0
0
0
0.002463
0
0
0
0
0
0
1
0.272727
false
0
0.272727
0
0.727273
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
aaad78389190fcfac231fdc6ed3013707ef9bc63
488
py
Python
Daily-Coding-Problem/Problem4/Problem4.py
grisreyesrios/Solutions--Daily-Coding-Problems
beb977e6666800b2158e43a649ed197ad2f79d0a
[ "MIT" ]
1
2019-02-14T00:35:26.000Z
2019-02-14T00:35:26.000Z
Daily-Coding-Problem/Problem4/Problem4.py
grisreyesrios/Solutions--Daily-Coding-Problems
beb977e6666800b2158e43a649ed197ad2f79d0a
[ "MIT" ]
null
null
null
Daily-Coding-Problem/Problem4/Problem4.py
grisreyesrios/Solutions--Daily-Coding-Problems
beb977e6666800b2158e43a649ed197ad2f79d0a
[ "MIT" ]
1
2021-10-18T00:51:51.000Z
2021-10-18T00:51:51.000Z
# Python programming that returns the weight of the maximum weight path in a triangle def triangle_max_weight(arrs, level=0, index=0): if level == len(arrs) - 1: return arrs[level][index] else: return arrs[level][index] + max( triangle_max_weight(arrs, level + 1, index), triangle_max_weight(arrs, level + 1, index + 1) ) if __name__ == "__main__": # Driver function arrs1 =[[1], [2, 3], [1, 5, 1]] print(triangle_max_weight(arrs1))
34.857143
104
0.637295
70
488
4.214286
0.457143
0.152542
0.230508
0.213559
0.305085
0.216949
0.216949
0
0
0
0
0.037534
0.235656
488
13
105
37.538462
0.753351
0.202869
0
0
0
0
0.020725
0
0
0
0
0
0
1
0.1
false
0
0
0
0.3
0.1
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
aabcc6bd93dd565fe8912f5540d060fac3483c64
2,246
py
Python
odoo_actions/odoo_client/common.py
catalyst-cloud/adjutant-odoo
6d1e473710e1757b92b4344d65d5bd106677fe36
[ "Apache-2.0" ]
1
2020-05-01T18:28:39.000Z
2020-05-01T18:28:39.000Z
odoo_actions/odoo_client/common.py
catalyst-cloud/adjutant-odoo
6d1e473710e1757b92b4344d65d5bd106677fe36
[ "Apache-2.0" ]
null
null
null
odoo_actions/odoo_client/common.py
catalyst-cloud/adjutant-odoo
6d1e473710e1757b92b4344d65d5bd106677fe36
[ "Apache-2.0" ]
2
2018-09-20T05:01:34.000Z
2020-10-17T04:31:47.000Z
from collections import Iterable class BaseManager(object): # you must initialise self.resource_env in __init__ fields = None class Meta: abstract = True def _is_iterable(self, ids): if isinstance(ids, str) or not isinstance(ids, Iterable): ids = [ids, ] return ids def get(self, ids, read=False): """Get one or more Resources by id. 'ids' can be 1 id, or a list of ids. <resource>.get(<id>) returns: [<object_of_id>] <resource>.get([<id>]) returns: [<object_of_id>] <resource>.get([<id_1>, <id_2>]) returns: [<object_of_id_1>, <object_of_id_2>] Always returns a list even when 1 id is given. This is done for consistency. """ if read: return self.resource_env.read( self._is_iterable(ids), fields=self.fields) return self.resource_env.browse(self._is_iterable(ids)) def list(self, filters, get=True, read=False): """Get a list of Resources. 'filters' is a list of search options.` [('field', '=', value), ] """ ids = self.resource_env.search(filters) if get: return self.get(ids, read) else: return ids def create(self, **fields): """Create a Resource. 'fields' is the dict of kwargs to pass to create. Allows slighly nicer syntax than having to pass in a dict. """ return self.resource_env.create(fields) def load(self, fields, rows): """Loads in a Resource. 'fields' is a list of fields to import. - list(str) 'rows' is the item data. - list(list(str)) """ return self.resource_env.load(fields=fields, data=rows) def delete(self, ids): """Delete 1 or more Resources by id. 'ids' can be 1 id, or a list of ids. <resource>.delete(<id>) deletes: <object_of_id> <resource>.delete([<id>]) deletes: <object_of_id> <resource>.delete([<id_1>, <id_2>]) deletes: <object_of_id_1> and <object_of_id_2> returns True if deleted or not present. """ return self.resource_env.unlink(self._is_iterable(ids))
29.168831
66
0.580142
304
2,246
4.144737
0.273026
0.050794
0.063492
0.083333
0.189683
0.189683
0.189683
0.189683
0.189683
0.189683
0
0.007658
0.302315
2,246
76
67
29.552632
0.796426
0.454141
0
0.076923
0
0
0
0
0
0
0
0
0
1
0.230769
false
0
0.038462
0
0.692308
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
aac63a5d8e54599f688823a384ac72b4a3f7a76c
233
py
Python
app/helpers/header_helpers.py
petechd/eq-questionnaire-runner
1c5b182a7f8bc878cfdd767ae080410fa679abd6
[ "MIT" ]
3
2020-09-28T13:21:21.000Z
2021-05-05T14:14:51.000Z
app/helpers/header_helpers.py
petechd/eq-questionnaire-runner
1c5b182a7f8bc878cfdd767ae080410fa679abd6
[ "MIT" ]
402
2019-11-06T17:23:03.000Z
2022-03-31T16:03:35.000Z
app/helpers/header_helpers.py
petechd/eq-questionnaire-runner
1c5b182a7f8bc878cfdd767ae080410fa679abd6
[ "MIT" ]
10
2020-03-03T14:23:27.000Z
2022-01-31T12:21:21.000Z
def get_span_and_trace(headers): try: trace, span = headers.get("X-Cloud-Trace-Context").split("/") except (ValueError, AttributeError): return None, None span = span.split(";")[0] return span, trace
25.888889
69
0.626609
29
233
4.931034
0.586207
0
0
0
0
0
0
0
0
0
0
0.005525
0.223176
233
8
70
29.125
0.78453
0
0
0
0
0
0.098712
0.090129
0
0
0
0
0
1
0.142857
false
0
0
0
0.428571
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
aad4319f7007dc6fffcb823fea0b0e260ea324c5
3,298
py
Python
src/oci/object_storage/models/commit_multipart_upload_part_details.py
LaudateCorpus1/oci-python-sdk
b0d3ce629d5113df4d8b83b7a6502b2c5bfa3015
[ "Apache-2.0", "BSD-3-Clause" ]
null
null
null
src/oci/object_storage/models/commit_multipart_upload_part_details.py
LaudateCorpus1/oci-python-sdk
b0d3ce629d5113df4d8b83b7a6502b2c5bfa3015
[ "Apache-2.0", "BSD-3-Clause" ]
null
null
null
src/oci/object_storage/models/commit_multipart_upload_part_details.py
LaudateCorpus1/oci-python-sdk
b0d3ce629d5113df4d8b83b7a6502b2c5bfa3015
[ "Apache-2.0", "BSD-3-Clause" ]
null
null
null
# coding: utf-8 # Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 from oci.decorators import init_model_state_from_kwargs @init_model_state_from_kwargs class CommitMultipartUploadPartDetails(object): """ To use any of the API operations, you must be authorized in an IAM policy. If you are not authorized, talk to an administrator. If you are an administrator who needs to write policies to give users access, see `Getting Started with Policies`__. __ https://docs.cloud.oracle.com/Content/Identity/Concepts/policygetstarted.htm """ def __init__(self, **kwargs): """ Initializes a new CommitMultipartUploadPartDetails object with values from keyword arguments. The following keyword arguments are supported (corresponding to the getters/setters of this class): :param part_num: The value to assign to the part_num property of this CommitMultipartUploadPartDetails. :type part_num: int :param etag: The value to assign to the etag property of this CommitMultipartUploadPartDetails. :type etag: str """ self.swagger_types = { 'part_num': 'int', 'etag': 'str' } self.attribute_map = { 'part_num': 'partNum', 'etag': 'etag' } self._part_num = None self._etag = None @property def part_num(self): """ **[Required]** Gets the part_num of this CommitMultipartUploadPartDetails. The part number for this part. :return: The part_num of this CommitMultipartUploadPartDetails. :rtype: int """ return self._part_num @part_num.setter def part_num(self, part_num): """ Sets the part_num of this CommitMultipartUploadPartDetails. The part number for this part. :param part_num: The part_num of this CommitMultipartUploadPartDetails. :type: int """ self._part_num = part_num @property def etag(self): """ **[Required]** Gets the etag of this CommitMultipartUploadPartDetails. The entity tag (ETag) returned when this part was uploaded. :return: The etag of this CommitMultipartUploadPartDetails. :rtype: str """ return self._etag @etag.setter def etag(self, etag): """ Sets the etag of this CommitMultipartUploadPartDetails. The entity tag (ETag) returned when this part was uploaded. :param etag: The etag of this CommitMultipartUploadPartDetails. :type: str """ self._etag = etag def __repr__(self): return formatted_flat_dict(self) def __eq__(self, other): if other is None: return False return self.__dict__ == other.__dict__ def __ne__(self, other): return not self == other
31.113208
245
0.654942
400
3,298
5.22
0.3675
0.060345
0.181992
0.08046
0.354406
0.22318
0.157088
0.157088
0.157088
0.157088
0
0.007484
0.27077
3,298
105
246
31.409524
0.860707
0.567314
0
0.057143
0
0
0.036348
0
0
0
0
0
0
1
0.228571
false
0
0.057143
0.057143
0.485714
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
aadcc926ae2bae8f3f547c0e153e1ffc86f3b16e
65
py
Python
tackle/__init__.py
robcxyz/tackle-box
a7a1403d4f7549cdacb32e5b11c1f9043bdd5762
[ "BSD-3-Clause" ]
5
2021-01-05T04:21:37.000Z
2022-01-01T22:12:32.000Z
tackle/__init__.py
robcxyz/tackle-box
a7a1403d4f7549cdacb32e5b11c1f9043bdd5762
[ "BSD-3-Clause" ]
51
2021-01-03T00:41:59.000Z
2022-03-27T00:13:51.000Z
tackle/__init__.py
robcxyz/tackle-box
a7a1403d4f7549cdacb32e5b11c1f9043bdd5762
[ "BSD-3-Clause" ]
1
2022-01-03T11:46:02.000Z
2022-01-03T11:46:02.000Z
"""Main package for tackle box.""" __version__ = "0.1.0-alpha.4"
21.666667
34
0.661538
11
65
3.545455
0.909091
0
0
0
0
0
0
0
0
0
0
0.070175
0.123077
65
2
35
32.5
0.614035
0.430769
0
0
0
0
0.419355
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
aae0ef6f919b713b8a03794a527288d50661e12d
880
py
Python
ticket/triggers/trg_ticket_prioridade.py
rafaelnoronha/tickets
5497b8de4efed02e5d2cad78fe8e8811ad1e03c1
[ "MIT" ]
null
null
null
ticket/triggers/trg_ticket_prioridade.py
rafaelnoronha/tickets
5497b8de4efed02e5d2cad78fe8e8811ad1e03c1
[ "MIT" ]
null
null
null
ticket/triggers/trg_ticket_prioridade.py
rafaelnoronha/tickets
5497b8de4efed02e5d2cad78fe8e8811ad1e03c1
[ "MIT" ]
null
null
null
def trigger(): return """ CREATE OR REPLACE FUNCTION trg_ticket_prioridade() RETURNS TRIGGER AS $$ DECLARE prioridade_grupo smallint; prioridade_subgrupo smallint; BEGIN prioridade_grupo = COALESCE((SELECT prioridade FROM grupo WHERE id = NEW.grupo_id), 0); prioridade_subgrupo = COALESCE((SELECT prioridade FROM subgrupo WHERE id = NEW.subgrupo_id), 0); NEW.prioridade = prioridade_grupo + prioridade_subgrupo; RETURN NEW; END $$ LANGUAGE plpgsql; DROP TRIGGER IF EXISTS trg_ticket_prioridade ON ticket; CREATE TRIGGER trg_ticket_prioridade BEFORE INSERT OR UPDATE ON ticket FOR EACH ROW EXECUTE PROCEDURE trg_ticket_prioridade(); """
36.666667
112
0.586364
86
880
5.813953
0.453488
0.072
0.152
0.112
0
0
0
0
0
0
0
0.003565
0.3625
880
23
113
38.26087
0.887701
0
0
0
0
0
0.9625
0.101136
0
0
0
0
0
1
0.052632
true
0
0
0.052632
0.105263
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
aae44756cbe9fb17074f9c08844383373bfa435e
247
py
Python
kattis/Shopping List.py
jaredliw/python-question-bank
9c8c246623d8d171f875700b57772df0afcbdcdf
[ "MIT" ]
1
2021-04-08T07:49:15.000Z
2021-04-08T07:49:15.000Z
kattis/Shopping List.py
jaredliw/leetcode-solutions
9c8c246623d8d171f875700b57772df0afcbdcdf
[ "MIT" ]
null
null
null
kattis/Shopping List.py
jaredliw/leetcode-solutions
9c8c246623d8d171f875700b57772df0afcbdcdf
[ "MIT" ]
1
2022-01-23T02:12:24.000Z
2022-01-23T02:12:24.000Z
# CPU: 0.18 s n_rows, _ = map(int, input().split()) common_items = set(input().split()) for _ in range(n_rows - 1): common_items = common_items.intersection(set(input().split())) print(len(common_items)) print(*sorted(common_items), sep="\n")
30.875
66
0.684211
39
247
4.102564
0.564103
0.34375
0.1625
0
0
0
0
0
0
0
0
0.018265
0.11336
247
7
67
35.285714
0.712329
0.044534
0
0
0
0
0.008547
0
0
0
0
0
0
1
0
false
0
0
0
0
0.333333
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2a9e6aba26f30258549a13ef7697fd4a41b47aac
563
py
Python
search_engine/worker.py
Dhruvacube/search-engine
13ba35d99e1dcb7591975e352d70329d41f868e6
[ "Apache-2.0" ]
null
null
null
search_engine/worker.py
Dhruvacube/search-engine
13ba35d99e1dcb7591975e352d70329d41f868e6
[ "Apache-2.0" ]
null
null
null
search_engine/worker.py
Dhruvacube/search-engine
13ba35d99e1dcb7591975e352d70329d41f868e6
[ "Apache-2.0" ]
null
null
null
import importlib from uvicorn.workers import UvicornWorker class DynamicUvicornWorker(UvicornWorker): """ This class is called `DynamicUvicornWorker` because it assigns values according to the module available Union['asyncio', 'uvloop'] It also set `lifespan` to `off` :) """ spam_spec = importlib.util.find_spec("uvloop") found = spam_spec is not None if found: CONFIG_KWARGS = {"loop": "uvloop", "http": "auto", "lifespan": "off"} else: CONFIG_KWARGS = {"loop": "auto", "http": "auto", "lifespan": "off"}
29.631579
77
0.65897
65
563
5.630769
0.630769
0.043716
0.087432
0.103825
0
0
0
0
0
0
0
0
0.207815
563
18
78
31.277778
0.820628
0.293073
0
0
0
0
0.165775
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
2aa980f2e7bb9369dafe24972122e61fe79c1759
766
py
Python
class and objects/Mro.py
ZephyrAveryl777/Python-Programs
26de85c31af28382d406d27d54186b966a7b1bfc
[ "MIT" ]
6
2020-08-13T11:49:29.000Z
2021-03-07T05:46:17.000Z
class and objects/Mro.py
ZephyrAveryl777/Python-Programs
26de85c31af28382d406d27d54186b966a7b1bfc
[ "MIT" ]
null
null
null
class and objects/Mro.py
ZephyrAveryl777/Python-Programs
26de85c31af28382d406d27d54186b966a7b1bfc
[ "MIT" ]
1
2021-04-24T06:12:48.000Z
2021-04-24T06:12:48.000Z
''' mro stands for Method Resolution Order. It returns a list of types the class is derived from, in the order they are searched for methods''' print(__doc__) print('\n'+'-'*35+ 'Method Resolution Order'+'-'*35) class A(object): def dothis(self): print('From A class') class B1(A): def dothis(self): print('From B1 class') pass class B2(object): def dothis(self): print('From B2 class') pass class B3(A): def dothis(self): print('From B3 class') # Diamond inheritance class D1(B1, B3): pass class D2(B1, B2): pass d1_instance = D1() d1_instance.dothis() print(D1.__mro__) d2_instance = D2() d2_instance.dothis() print(D2.__mro__)
17.022222
53
0.591384
106
766
4.122642
0.367925
0.08238
0.118993
0.16476
0.23341
0.23341
0
0
0
0
0
0.043796
0.284595
766
45
54
17.022222
0.75365
0.208877
0
0.307692
0
0
0.140288
0
0
0
0
0
0
1
0.153846
false
0.153846
0
0
0.384615
0.307692
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
2aac09b051b13c891b16499f4e8579b8384792aa
1,507
py
Python
src/petmail/test/test_eventsource.py
warner/petmail
2c43f6177e301275e235cc2a155aafba3e66b4c4
[ "MIT" ]
25
2015-04-14T15:55:46.000Z
2021-01-23T16:00:55.000Z
src/petmail/test/test_eventsource.py
warner/petmail
2c43f6177e301275e235cc2a155aafba3e66b4c4
[ "MIT" ]
null
null
null
src/petmail/test/test_eventsource.py
warner/petmail
2c43f6177e301275e235cc2a155aafba3e66b4c4
[ "MIT" ]
1
2018-05-17T08:41:47.000Z
2018-05-17T08:41:47.000Z
from twisted.trial import unittest from ..eventsource import EventSourceParser class FakeTransport: disconnecting = False def parse_events(s): fields = [] p = EventSourceParser(lambda name, data: fields.append((name,data))) p.makeConnection(FakeTransport()) p.dataReceived(s) return fields class EventSource(unittest.TestCase): def test_parse(self): fields = [] p = EventSourceParser(lambda name, data: fields.append((name,data))) p.makeConnection(FakeTransport()) self.failUnlessEqual(fields, []) p.dataReceived(": comment") self.failUnlessEqual(fields, []) p.dataReceived("\n") self.failUnlessEqual(fields, []) p.dataReceived("\n") self.failUnlessEqual(fields, [("", "comment")]) p.dataReceived("data: one line\n\n") self.failUnlessEqual(fields, [("", "comment"), ("data", "one line")]) p.dataReceived("data: two\n") self.failUnlessEqual(fields, [("", "comment"), ("data", "one line")]) p.dataReceived("lines\n") self.failUnlessEqual(fields, [("", "comment"), ("data", "one line")]) p.dataReceived("\n") self.failUnlessEqual(fields, [("", "comment"), ("data", "one line"), ("data", "two\nlines"), ])
35.880952
76
0.52223
128
1,507
6.132813
0.273438
0.132484
0.254777
0.198726
0.681529
0.633121
0.633121
0.624204
0.568153
0.436943
0
0
0.327804
1,507
41
77
36.756098
0.774926
0
0
0.527778
0
0
0.098208
0
0
0
0
0
0
1
0.055556
false
0
0.055556
0
0.222222
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2aad36ed8d9e01be2c017eacc17af6c7e6d3a8a0
126
py
Python
01_Language/01_Functions/python/fread.py
cliff363825/TwentyFour
09df59bd5d275e66463e343647f46027397d1233
[ "MIT" ]
3
2020-06-28T07:42:51.000Z
2021-01-15T10:32:11.000Z
01_Language/01_Functions/python/fread.py
cliff363825/TwentyFour
09df59bd5d275e66463e343647f46027397d1233
[ "MIT" ]
9
2021-03-10T22:45:40.000Z
2022-02-27T06:53:20.000Z
01_Language/01_Functions/python/fread.py
cliff363825/TwentyFour
09df59bd5d275e66463e343647f46027397d1233
[ "MIT" ]
1
2021-01-15T10:51:24.000Z
2021-01-15T10:51:24.000Z
# coding: utf-8 import os size = os.path.getsize("test.txt") with open("test.txt", mode="r") as f: print(f.read(size))
14
37
0.626984
23
126
3.434783
0.782609
0.177215
0
0
0
0
0
0
0
0
0
0.009524
0.166667
126
8
38
15.75
0.742857
0.103175
0
0
0
0
0.153153
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2ab21d6af7562df91669716faae1d4fb2aeb12d2
499
py
Python
interactive_widgets/backend/contexts/docker_context.py
h3ndrk/interactive-widgets-backend
926dea44f00aca8b51893dab533c566728d5e65d
[ "MIT" ]
null
null
null
interactive_widgets/backend/contexts/docker_context.py
h3ndrk/interactive-widgets-backend
926dea44f00aca8b51893dab533c566728d5e65d
[ "MIT" ]
null
null
null
interactive_widgets/backend/contexts/docker_context.py
h3ndrk/interactive-widgets-backend
926dea44f00aca8b51893dab533c566728d5e65d
[ "MIT" ]
null
null
null
import aiodocker import interactive_widgets.backend.contexts.context class DockerContext(interactive_widgets.backend.contexts.context.Context): async def __aenter__(self): self.docker = aiodocker.Docker( url=self.configuration.get('url', None), ) await self.docker.__aenter__() self.logger.debug(await self.docker.version()) return self async def __aexit__(self, *args, **kwargs): await self.docker.__aexit__(*args, **kwargs)
27.722222
74
0.685371
55
499
5.890909
0.472727
0.123457
0.138889
0.203704
0.246914
0
0
0
0
0
0
0
0.204409
499
17
75
29.352941
0.816121
0
0
0
0
0
0.006012
0
0
0
0
0
0
1
0
true
0
0.166667
0
0.333333
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
2ab6f2fd95e89231a622465bab0cf4bb48fade28
418
py
Python
vtr_flow/scripts/benchtracker/flask_cors/__init__.py
HackerFoo/vtr-verilog-to-routing
9bf3c1004e8a7c9f3756167905fd2e71218158d0
[ "MIT" ]
1
2020-05-07T17:38:58.000Z
2020-05-07T17:38:58.000Z
vtr_flow/scripts/benchtracker/flask_cors/__init__.py
HackerFoo/vtr-verilog-to-routing
9bf3c1004e8a7c9f3756167905fd2e71218158d0
[ "MIT" ]
12
2015-06-26T19:47:14.000Z
2015-07-06T17:29:29.000Z
vtr_flow/scripts/benchtracker/flask_cors/__init__.py
HackerFoo/vtr-verilog-to-routing
9bf3c1004e8a7c9f3756167905fd2e71218158d0
[ "MIT" ]
1
2020-08-15T03:04:34.000Z
2020-08-15T03:04:34.000Z
# -*- coding: utf-8 -*- """ flask_cors ~~~~ Flask-CORS is a simple extension to Flask allowing you to support cross origin resource sharing (CORS) using a simple decorator. :copyright: (c) 2014 by Cory Dolphin. :license: MIT, see LICENSE for more details. """ from .decorator import cross_origin from .extension import CORS from .version import __version__ __all__ = ['CORS', 'cross_origin']
26.125
75
0.696172
56
418
5
0.625
0.117857
0
0
0
0
0
0
0
0
0
0.01497
0.200957
418
15
76
27.866667
0.823353
0.600478
0
0
0
0
0.118519
0
0
0
0
0
0
1
0
false
0
0.75
0
0.75
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
2ad7054044b890689ad7e39e0a17d04847e28d9a
347
py
Python
grpc_django/models.py
soheltarir/grpc-django
890038de2d7b7c36e4fd37ef1727d3568b3f68f5
[ "MIT" ]
12
2018-08-03T08:02:32.000Z
2020-05-06T03:49:43.000Z
grpc_django/models.py
localhost-sys/grpc-django
890038de2d7b7c36e4fd37ef1727d3568b3f68f5
[ "MIT" ]
7
2018-07-18T07:18:44.000Z
2022-02-10T10:28:42.000Z
grpc_django/models.py
localhost-sys/grpc-django
890038de2d7b7c36e4fd37ef1727d3568b3f68f5
[ "MIT" ]
5
2019-10-13T08:22:04.000Z
2021-06-11T02:25:04.000Z
from django.contrib.auth.models import AbstractUser # Create your models here. class ContextUser(AbstractUser): """ Just an abstract model class to represent Auth user coming as context in GRPC requests """ class Meta: abstract = True def __str__(self): return " ".format([self.first_name, self.last_name])
23.133333
90
0.688761
44
347
5.295455
0.795455
0
0
0
0
0
0
0
0
0
0
0
0.227666
347
14
91
24.785714
0.869403
0.322767
0
0
0
0
0.004566
0
0
0
0
0
0
1
0.166667
false
0
0.166667
0.166667
0.833333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
2
2addab6e6db1d5d6df636a69706b6de36199b161
2,350
py
Python
dataset_tools/dataset_case/base_case.py
jprashant21/ElNeuKGQA
ebafa0a3d3e779e487a665fabc4f9ed50f21f134
[ "MIT" ]
null
null
null
dataset_tools/dataset_case/base_case.py
jprashant21/ElNeuKGQA
ebafa0a3d3e779e487a665fabc4f9ed50f21f134
[ "MIT" ]
null
null
null
dataset_tools/dataset_case/base_case.py
jprashant21/ElNeuKGQA
ebafa0a3d3e779e487a665fabc4f9ed50f21f134
[ "MIT" ]
null
null
null
from typing import Optional class BaseCaseMethodNotImplemented(Exception): """ Exception when a BaseCase method has not been implemented. """ pass class BaseCase: """ Base class for representing a dataset case with a mandatory question text and an optional question id and sparql query answer. """ @property def question_id(self) -> Optional[int]: """ Get the question id, if exists. :return: question integer identifier or None if there is no identifier. """ return None @property def question_text(self) -> str: """ Get the question text. :exception: BaseCaseMethodNotImplemented if method has not been implemented. :return: question string. """ raise BaseCaseMethodNotImplemented @property def sparql_query(self) -> Optional[str]: """ Get the SPARQL query answer. :return: SPARQL query string or None if there is no SPARQL query answer. """ return None class QuestionCase(BaseCase): """ Question case class for representing a dataset question case with a mandatory question text and an optional question id. No SPARQL query answer required. """ def __init__(self, question_text: str, question_id: Optional[int] = None): """ Question case constructor. :param question_text: question case string. :param question_id: question case identifier. """ self.__id = question_id self.__text = question_text @property def question_id(self) -> Optional[int]: """ Get the question id, if exists. :return: question integer identifier or None if there is no identifier. """ return self.__id @property def question_text(self) -> str: """ Get the question text. :return: question string. """ return self.__text class Question(QuestionCase): """ Question class for representing a question case that only requires a question text. No question id nor SPARQL query answer required. """ def __init__(self, question_text: str): """ Question constructor. :param question_text: question case string. """ super().__init__(question_text)
25.543478
91
0.628085
262
2,350
5.503817
0.229008
0.108183
0.058946
0.043689
0.54577
0.469487
0.457698
0.393897
0.393897
0.393897
0
0
0.295319
2,350
91
92
25.824176
0.870773
0.488085
0
0.423077
0
0
0
0
0
0
0
0
0
1
0.269231
false
0.038462
0.038462
0
0.615385
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
2ae1ab750c7d91fe0b34736e84b79b4270ed4fbb
355
py
Python
1_mundo_exercicios/ex012.py
GuilhermeLima182/CursoDePython
7e72b117142794c38cbb14284d0fa6e1dbee5bf6
[ "MIT" ]
null
null
null
1_mundo_exercicios/ex012.py
GuilhermeLima182/CursoDePython
7e72b117142794c38cbb14284d0fa6e1dbee5bf6
[ "MIT" ]
null
null
null
1_mundo_exercicios/ex012.py
GuilhermeLima182/CursoDePython
7e72b117142794c38cbb14284d0fa6e1dbee5bf6
[ "MIT" ]
null
null
null
#Faça um programa que pergunte ao usuario o valor do produto, #e mostre o valor final com 5% de desconto. valorProduto = float(input('Qual o valor do produto? R$ ')) desconto = (valorProduto * 5) / 100 vFinal = valorProduto - desconto print('O valor do produto é R${}'.format(valorProduto)) print('O novo valor com o desconto é de R${}'.format(vFinal))
39.444444
62
0.721127
57
355
4.491228
0.508772
0.09375
0.09375
0.175781
0
0
0
0
0
0
0
0.016835
0.16338
355
8
63
44.375
0.845118
0.287324
0
0
0
0
0.36255
0
0
0
0
0
0
1
0
false
0
0
0
0
0.4
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2aece40023ab19be0d9af7b42aedee10e53c55c8
1,375
py
Python
spec/person.py
ace6807/spec-data-validation-pattern
57c7a757035f16ffa999244175814db0ec3964d9
[ "MIT" ]
1
2021-07-27T00:55:08.000Z
2021-07-27T00:55:08.000Z
spec/person.py
ace6807/spec-data-validation-pattern
57c7a757035f16ffa999244175814db0ec3964d9
[ "MIT" ]
null
null
null
spec/person.py
ace6807/spec-data-validation-pattern
57c7a757035f16ffa999244175814db0ec3964d9
[ "MIT" ]
null
null
null
from dataclasses import dataclass from . import Spec from dto.person import PersonDTO @dataclass class HasNameSpec(Spec): def passes(self, candidate: PersonDTO) -> bool: return candidate.name is not None and candidate.name != "" @dataclass class HasAgeSpec(Spec): def passes(self, candidate: PersonDTO) -> bool: return candidate.age is not None @dataclass class AgeIsLessThan(Spec): age: int def passes(self, candidate: PersonDTO) -> bool: return candidate.age < self.age @dataclass class AgeIsGreaterThan(Spec): age: int def passes(self, candidate: PersonDTO) -> bool: return candidate.age > self.age @dataclass class IsFromCountry(Spec): country: str def passes(self, candidate: PersonDTO) -> bool: return candidate.address.country == self.country @dataclass class ContestEligibilitySpec(Spec): has_name_spec = HasNameSpec() has_age_spec = HasAgeSpec() age_less_than_spec = AgeIsLessThan(55) age_greater_than_spec = AgeIsGreaterThan(18) is_domestic = IsFromCountry("US") def passes(self, candidate: PersonDTO) -> bool: tests = ( self.has_age_spec & self.has_name_spec & self.age_less_than_spec & self.age_greater_than_spec & -self.is_domestic ) return tests.passes(candidate)
22.916667
66
0.674909
159
1,375
5.698113
0.251572
0.092715
0.086093
0.145695
0.401766
0.401766
0.363135
0.363135
0.307947
0.18543
0
0.00381
0.236364
1,375
59
67
23.305085
0.859048
0
0
0.333333
0
0
0.001455
0
0
0
0
0
0
1
0.142857
false
0.166667
0.071429
0.119048
0.690476
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
1
0
0
0
2
2af11eb0b42cbfb5a1efbef4325e698fa799a2e8
5,631
py
Python
roadmap_planner_tools/scripts/pi_manager_example.py
JKBehrens/STAAMS-Solver
b6837da69cda574d081ab3dc0b307e3ce40ad6f2
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
16
2018-12-11T13:02:58.000Z
2022-02-28T09:05:20.000Z
roadmap_planner_tools/scripts/pi_manager_example.py
stepakar/STAAMS-Solver
b6837da69cda574d081ab3dc0b307e3ce40ad6f2
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
2
2019-11-04T13:16:49.000Z
2022-02-28T09:17:30.000Z
roadmap_planner_tools/scripts/pi_manager_example.py
stepakar/STAAMS-Solver
b6837da69cda574d081ab3dc0b307e3ce40ad6f2
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
4
2019-02-12T12:41:25.000Z
2022-02-09T12:55:56.000Z
#!/usr/bin/env python """ Copyright (c) 2018 Robert Bosch GmbH All rights reserved. This source code is licensed under the BSD-3-Clause license found in the LICENSE file in the root directory of this source tree. @author: Jan Behrens """ from geometry_msgs.msg import TransformStamped from roadmap_planner_tools.planner_input_manager import PlannerInputManager from roadmap_planning_common_msgs.msg import OrderedVisitingConstraint, StringList, ConstraintType from roadmap_planning_common_msgs.srv import AddObjectRequest from rospy_message_converter import json_message_converter def get_pose_dict(): # type: () -> dict[str, PoseStamped] PosesDict = {} s = '{"object_type": "gluepoint", "object_name": "loc_8", "pose": {"header": {"stamp": {"secs": 1527494081, "nsecs": 245750904}, "frame_id": "board", "seq": 0}, "pose": {"position": {"y": 0.0673123623248813, "x": -0.11819957737525943, "z": -0.000529293203694906}, "orientation": {"y": -0.09199954920780186, "x": -0.02204239273911617, "z": -0.9826223619036331, "w": -0.15969818331722338}}}}' + '\n' s += '{"object_type": "gluepoint", "object_name": "loc_6", "pose": {"header": {"stamp": {"secs": 1527494075, "nsecs": 379102230}, "frame_id": "board", "seq": 0}, "pose": {"position": {"y": 0.11369306929267338, "x": -0.1261289291850433, "z": 0.0007951176021754491}, "orientation": {"y": 0.07187094200286825, "x": -0.061023926496261725, "z": 0.9873831660085665, "w": 0.12722079850990872}}}}' + '\n' s += '{"object_type": "gluepoint", "object_name": "loc_7", "pose": {"header": {"stamp": {"secs": 1527494078, "nsecs": 595736504}, "frame_id": "board", "seq": 0}, "pose": {"position": {"y": 0.1149274695384531, "x": 0.06208364635543662, "z": -0.005476238253788906}, "orientation": {"y": 0.1316436407714954, "x": 0.019739166149056388, "z": 0.9750055991865761, "w": 0.17788872566576838}}}}' + '\n' s += '{"object_type": "gluepoint", "object_name": "loc_4", "pose": {"header": {"stamp": {"secs": 1527494065, "nsecs": 979056120}, "frame_id": "board", "seq": 0}, "pose": {"position": {"y": 0.06856865760540547, "x": 0.4478018813158141, "z": -0.000679487573898074}, "orientation": {"y": -0.050516132689598016, "x": 0.014163494691613031, "z": -0.878984408924756, "w": -0.47395561461323}}}}' + '\n' s += '{"object_type": "gluepoint", "object_name": "loc_5", "pose": {"header": {"stamp": {"secs": 1527494071, "nsecs": 795750141}, "frame_id": "board", "seq": 0}, "pose": {"position": {"y": 0.06760627153697468, "x": 0.06349269911330815, "z": -0.0007470379806025116}, "orientation": {"y": -0.010168248374561623, "x": 0.04411559477008324, "z": -0.9325496611657705, "w": -0.3581920580954878}}}}' + '\n' s += '{"object_type": "gluepoint", "object_name": "loc_2", "pose": {"header": {"stamp": {"secs": 1527494059, "nsecs": 112413883}, "frame_id": "board", "seq": 0}, "pose": {"position": {"y": 0.06838950251450462, "x": 0.6409328063798745, "z": 0.00015782094835932174}, "orientation": {"y": 0.05237392498219545, "x": 0.02846261965189043, "z": 0.8403338301717435, "w": 0.53878187157086}}}}' + '\n' s += '{"object_type": "gluepoint", "object_name": "loc_3", "pose": {"header": {"stamp": {"secs": 1527494063, "nsecs": 79089880}, "frame_id": "board", "seq": 0}, "pose": {"position": {"y": 0.11665509017783073, "x": 0.6388356663857032, "z": 0.001613388200793883}, "orientation": {"y": -0.10153267056716704, "x": -0.0370089029955912, "z": -0.9240133314356973, "w": -0.3667708020489993}}}}' + '\n' s += '{"object_type": "gluepoint", "object_name": "loc_1", "pose": {"header": {"stamp": {"secs": 1527494055, "nsecs": 529085398}, "frame_id": "board", "seq": 0}, "pose": {"position": {"y": 0.11632455207600452, "x": 0.4453907194544092, "z": 0.0016855318552673815}, "orientation": {"y": -0.11786933993294174, "x": -0.08813291134398896, "z": -0.9653377546033448, "w": -0.21555145135020032}}}}' + '\n' json_strs = s.readlines() for json in json_strs: if json == "\n": continue req = json_message_converter.convert_json_to_ros_message('roadmap_planning_common_msgs/AddObjectRequest', json) # type: AddObjectRequest PosesDict[req.object_name] = req.pose return PosesDict if __name__ == "__main__": pi_manager = PlannerInputManager() trans = TransformStamped() trans.child_frame_id = 'board' trans.header.frame_id = 'world' board_quat = [-0.6646584989424609, 0.7469166744613165, 0.009387090228191897, -0.016013860629187193] board_trans = [0.6, 0.3, 0.02] trans.transform.translation.x = board_trans[0] trans.transform.translation.y = board_trans[1] trans.transform.translation.z = board_trans[2] trans.transform.rotation.x = board_quat[0] trans.transform.rotation.y = board_quat[1] trans.transform.rotation.z = board_quat[2] trans.transform.rotation.w = board_quat[3] pi_manager.add_frame(transform=trans) PosesDict = get_pose_dict() pi_manager.add_loc(PosesDict.values(), PosesDict.keys(), len(PosesDict) * ["gluepoint"]) myOVC = OrderedVisitingConstraint() myOVC.name = 'ovc_1' loc_names_1 = StringList() loc_names_1.values.append('loc_1') myOVC.location_names.append(loc_names_1) pi_manager.add_ovc([myOVC]) myOVC_2 = OrderedVisitingConstraint() myOVC_2.name = 'ovc_2' loc_names_1 = StringList() loc_names_1.values.append('loc_2') myOVC_2.location_names.append(loc_names_1) pi_manager.add_ovc([myOVC]) # ct = Constraints[0] pi_manager.add_ovc_ct(constraint_type=ConstraintType.StartsAfterEnd, first_ovcs=['ovc_1'], second_ovcs=['ovc_2']) pi_manager.write_planner_input_file('test')
69.518519
402
0.679098
682
5,631
5.423754
0.303519
0.008651
0.029197
0.043255
0.203028
0.187348
0.187348
0.178427
0.114085
0.049202
0
0.25847
0.124667
5,631
81
403
69.518519
0.491986
0.054697
0
0.075472
0
0.150943
0.597026
0.117636
0.150943
0
0
0
0
1
0.018868
false
0
0.09434
0
0.132075
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2af67edc0d8f4da4a1404fc6cd17e17df40ffa60
374
py
Python
src/cn_query/juhe/exceptions.py
winkidney/juhe-sdk
dc92d7421f54b5858c90b32f75297a76e3ecbac5
[ "MIT" ]
null
null
null
src/cn_query/juhe/exceptions.py
winkidney/juhe-sdk
dc92d7421f54b5858c90b32f75297a76e3ecbac5
[ "MIT" ]
null
null
null
src/cn_query/juhe/exceptions.py
winkidney/juhe-sdk
dc92d7421f54b5858c90b32f75297a76e3ecbac5
[ "MIT" ]
null
null
null
from functools import wraps DEFAULT_CODE = -1 class APIError(ValueError): pass def normalize_network_error(func): from requests import exceptions as exc @wraps(func) def decorated(*args, **kwargs): try: return func(*args, **kwargs) except exc.RequestException as e: raise APIError(str(e)) return decorated
17
42
0.644385
44
374
5.409091
0.681818
0.084034
0
0
0
0
0
0
0
0
0
0.003676
0.272727
374
21
43
17.809524
0.871324
0
0
0
0
0
0
0
0
0
0
0
0
1
0.153846
false
0.076923
0.153846
0
0.538462
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
2
6310d4042eb7ef64a2b5785735563119f99531f8
719
py
Python
Test_Beat_Detector.py
filipmazurek/Heart-Rate-Monitor
eef5bed63357442dde3746e0443671a947f0ec3d
[ "MIT" ]
null
null
null
Test_Beat_Detector.py
filipmazurek/Heart-Rate-Monitor
eef5bed63357442dde3746e0443671a947f0ec3d
[ "MIT" ]
null
null
null
Test_Beat_Detector.py
filipmazurek/Heart-Rate-Monitor
eef5bed63357442dde3746e0443671a947f0ec3d
[ "MIT" ]
null
null
null
from Beat_Detector import BeatDetector from SignalChoice import * update_time_seconds = 20 update_time_easy = 2 # means enough data for 2 seconds. array_easy = [0, 2, 5, 10, 5, 2, 0, 2, 5, 10, 5] def test_get_num_beats(): beat_detector = BeatDetector(update_time_seconds, SignalChoice.both) assert 2 == beat_detector.get_num_beats(array_easy) def test_single_array_hr(): beat_detector = BeatDetector(update_time_easy, SignalChoice.both) assert 60 == beat_detector.single_array_hr(array_easy) # 2 beats in 2 seconds means 60 bpm def test_find_inst_hr(): beat_detector = BeatDetector(update_time_easy, SignalChoice.both) assert 60 == beat_detector.find_instant_hr(array_easy, array_easy)
32.681818
95
0.769124
111
719
4.648649
0.315315
0.162791
0.081395
0.174419
0.383721
0.294574
0.294574
0.294574
0.294574
0.294574
0
0.042484
0.148818
719
21
96
34.238095
0.800654
0.091794
0
0.142857
0
0
0
0
0
0
0
0
0.214286
1
0.214286
false
0
0.142857
0
0.357143
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
6315ca182a138a7397f2bdcc32da39042e1ae1a2
3,356
py
Python
gestor_usuarios/apps/app_gestor_usuarios/forms.py
Enrialonso/LP-Manage-Contacts
fdee309442b44efee5f7aa67612738b1655197c9
[ "Unlicense" ]
null
null
null
gestor_usuarios/apps/app_gestor_usuarios/forms.py
Enrialonso/LP-Manage-Contacts
fdee309442b44efee5f7aa67612738b1655197c9
[ "Unlicense" ]
null
null
null
gestor_usuarios/apps/app_gestor_usuarios/forms.py
Enrialonso/LP-Manage-Contacts
fdee309442b44efee5f7aa67612738b1655197c9
[ "Unlicense" ]
null
null
null
from django import forms from apps.app_gestor_usuarios.models import db_usuarios, db_manage_contacts class signupForm(forms.ModelForm): class Meta: model = db_usuarios fields = [ 'name', 'last', 'email', 'password', ] labels = { 'name':'Name', 'last':'Last', 'email':'Email', 'password':'Password', } widgets = { 'name': forms.TextInput(attrs={'class':'form-control'}), 'last': forms.TextInput(attrs={'class':'form-control'}), 'email': forms.EmailInput(attrs={'class':'form-control'}), 'password': forms.PasswordInput(attrs={'class':'form-control'}), } class loginForm(forms.ModelForm): class Meta: model = db_usuarios fields = [ 'email', 'password', ] labels = { 'email':'Email', 'password':'Password', } widgets = { 'email': forms.EmailInput(attrs={'class':'form-control'}), 'password': forms.PasswordInput(attrs={'class':'form-control'}), } class addForm(forms.ModelForm): class Meta: model = db_manage_contacts fields = [ 'id', 'associated_user', 'name', 'last', 'email', 'phone_local', 'phone_mov', 'street', 'street_number', 'population', 'state', 'postalcode', 'country', 'url_web', ] labels = { 'id':'id', 'associated_user':'Associated User', 'name':'Name', 'last':'Last', 'email':'Email', 'phone_local':'Local Phone', 'phone_mov':'Cel. Phone', 'street':'Street', 'street_number':'Street Number', 'population':'Population', 'state':'Comunity', 'postalcode':'Postal code', 'country':'Country', 'url_web':'Web or Blog', } widgets = { 'id':forms.TextInput(attrs={'class':'form-control'}), 'associated_user':forms.EmailInput(attrs={'class':'form-control','readonly':'True'}), 'name': forms.TextInput(attrs={'class':'form-control'}), 'last': forms.TextInput(attrs={'class':'form-control'}), 'email': forms.EmailInput(attrs={'class':'form-control'}), 'phone_local': forms.TextInput(attrs={'class':'form-control'}), 'phone_mov': forms.TextInput(attrs={'class': 'form-control'}), 'street': forms.TextInput(attrs={'class': 'form-control', 'id':'route'}), 'street_number': forms.TextInput(attrs={'class': 'form-control', 'id': 'street_number'}), 'population': forms.TextInput(attrs={'class': 'form-control', 'id':'locality'}), 'state': forms.TextInput(attrs={'class': 'form-control', 'id': 'administrative_area_level_1'}), 'postalcode': forms.TextInput(attrs={'class': 'form-control', 'id':'postal_code'}), 'country': forms.TextInput(attrs={'class': 'form-control', 'id':'country'}), 'url_web': forms.URLInput(attrs={'class': 'form-control'}), }
32.901961
107
0.502384
294
3,356
5.636054
0.207483
0.1207
0.16898
0.25347
0.592637
0.552806
0.418226
0.284249
0.231141
0.231141
0
0.000439
0.321514
3,356
102
108
32.901961
0.727273
0
0
0.460674
0
0
0.30146
0.008043
0
0
0
0
0
1
0
false
0.067416
0.022472
0
0.089888
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
6324fc38f5d2e0297dfed36c24f30bc5c9a5e87b
3,786
py
Python
sails/commands.py
metrasynth/solar-sails
3a10774dad29d85834d3acb38171741b3a11ef91
[ "MIT" ]
6
2016-11-22T14:32:55.000Z
2021-08-15T01:35:33.000Z
sails/commands.py
metrasynth/s4ils
efc061993d15ebe662b72ab8b3127f7f7ce2f66b
[ "MIT" ]
2
2022-03-18T16:47:43.000Z
2022-03-18T16:47:44.000Z
sails/commands.py
metrasynth/s4ils
efc061993d15ebe662b72ab8b3127f7f7ce2f66b
[ "MIT" ]
2
2019-07-09T23:44:08.000Z
2021-08-15T01:35:37.000Z
import rv.api class Command(object): args = () processed = False def __init__(self, *args, **kw): self._apply_args(*args, **kw) def __repr__(self): attrs = ' '.join( '{}={!r}'.format( arg, getattr(self, arg), ) for arg in self.args if hasattr(self, arg) ) return '<{}{}>'.format( self.__class__.__name__, ' ' + attrs if attrs else '', ) def _apply_args(self, *args, **kw): for key, value in zip(self.args, args): setattr(self, key, value) for key, value in kw.items(): if key in self.args: setattr(self, key, value) def copy(self, *args, **kw): c2 = self.__class__() for key in self.args: try: value = getattr(self, key) except AttributeError: pass else: setattr(c2, key, value) c2._apply_args(*args, **kw) return c2 class ConnectModules(Command): args = 'engine', 'src', 'dest' class Engine(Command): class Track(object): def __init__(self, engine, index): self.engine = engine self.index = index def __repr__(self): return '<Track {}>'.format(self.index) def __ror__(self, other): if isinstance(other, NoteOn): note = other.copy(engine=self.engine, track=self) return note def off(self): return NoteOff(self.engine, self) class Output(object): index = 0 def __init__(self, engine): self.engine = engine def __repr__(self): return '<Output>' def __lshift__(self, other): return ConnectModules(self.engine, other.module, self) def __rshift__(self, other): return ConnectModules(self.engine, self, other.module) def __init__(self, *args, **kw): super(Engine, self).__init__(*args, **kw) self.output = self.Output(self) def new_module(self, obj, *args, **kw): if isinstance(obj, type) and issubclass(obj, rv.m.Module): obj = obj(*args, **kw) if isinstance(obj, rv.m.Module): return Module(self, obj) else: raise ValueError() def track(self, index): return self.Track(self, index) class Generator(Command): args = 'fn', 'fn_args', 'fn_kw' generator = None def advance(self, cursor): if self.generator is not None: try: self.generator.send(cursor) except StopIteration: self.stop() | cursor @property def started(self): return self.generator is not None def start(self): if not self.started: self.generator = self.fn(*self.fn_args, **self.fn_kw) self.generator.send(None) def stop(self): return GeneratorStop(self) @classmethod def factory(cls, fn): def factory_fn(*args, **kw): return cls(fn, args, kw) return factory_fn class GeneratorStop(Command): args = 'parent', class Module(Command): args = 'engine', 'module' def __lshift__(self, other): return ConnectModules(self, other.module, self.module) def __rshift__(self, other): return ConnectModules(self, self.module, other.module) def on(self, note, vel=None): return NoteOn(note, vel, self.engine, self.module) class NoteOff(Command): args = 'engine', 'track' class NoteOn(Command): args = 'note', 'vel', 'engine', 'module', 'track' def off(self): return NoteOff(self.engine, self.track)
23.811321
66
0.542789
427
3,786
4.632319
0.201405
0.033367
0.035389
0.058645
0.215369
0.152679
0.122346
0.037412
0
0
0
0.001988
0.335711
3,786
158
67
23.962025
0.784493
0
0
0.169643
0
0
0.029847
0
0
0
0
0
0
1
0.223214
false
0.008929
0.008929
0.116071
0.5625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
2
6326a7cc80d3d1603f92a048b09d9d4066064738
448
py
Python
.config/vim/python3/tex.py
psvenk/dotfiles
2c07e97b5087a224e5df3060405f8bbfac28866e
[ "0BSD" ]
null
null
null
.config/vim/python3/tex.py
psvenk/dotfiles
2c07e97b5087a224e5df3060405f8bbfac28866e
[ "0BSD" ]
null
null
null
.config/vim/python3/tex.py
psvenk/dotfiles
2c07e97b5087a224e5df3060405f8bbfac28866e
[ "0BSD" ]
null
null
null
import vim from datetime import datetime from os import path from subprocess import run, DEVNULL def include_screenshot(): directory = path.dirname(vim.current.buffer.name) timestamp = datetime.now().strftime("%Y-%m-%d-%H-%M-%S") filename = f"screenshot-{timestamp}.png" with open(path.join(directory, filename), mode="wb") as outfile: run(["maim", "-s"], stdin=DEVNULL, stdout=outfile, stderr=DEVNULL) return filename
34.461538
74
0.703125
61
448
5.147541
0.655738
0
0
0
0
0
0
0
0
0
0
0
0.151786
448
12
75
37.333333
0.826316
0
0
0
0
0
0.113839
0.058036
0
0
0
0
0
1
0.090909
false
0
0.363636
0
0.545455
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
63319d40cb5498bfc7c0d34898459019f0749096
1,031
py
Python
lre/nlp/__init__.py
ovixiao/lre
e60de7b4457efd5a85165e89a4477c14f52c471b
[ "Apache-2.0" ]
null
null
null
lre/nlp/__init__.py
ovixiao/lre
e60de7b4457efd5a85165e89a4477c14f52c471b
[ "Apache-2.0" ]
null
null
null
lre/nlp/__init__.py
ovixiao/lre
e60de7b4457efd5a85165e89a4477c14f52c471b
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- """ 处理各种语言的库,主要是实现分段落、句子、词的功能 """ from __future__ import unicode_literals from .nlp_zh import NlpZh class Nlp(object): def __init__(self, config): self.config = config if self.config.language == 'zh': self.nlp = NlpZh(config) else: raise ValueError('invalid_language', config.language) def text2para(self, text): """ 从文本切分成为段落, 会依据 config 的 language 来切分 :param text: 输入的文本整体,段落以 \n 作为分割 :return: 返回段落的列表 """ return self.nlp.text2para(text[:self.config.max_text_len]) def para2sent(self, paragraph): """ 从段落切分句子,会依据 config 的 language 来切分 :param paragraph: 输入的段落文本,段落以 \n 作为分割,仅支持一个 \n :return: 返回句子的列表 """ return self.nlp.para2sent(paragraph) def sent2word(self, sentence): """ 从句子切分成词,会依据 config 的 language 来切分 :param sentence: 输入的句子文本 :return: 返回词的列表 """ return self.nlp.sent2word(sentence)
24.547619
66
0.591659
116
1,031
5.146552
0.456897
0.067002
0.050251
0.090452
0.130653
0.130653
0
0
0
0
0
0.009669
0.297769
1,031
41
67
25.146341
0.814917
0.343356
0
0
0
0
0.0301
0
0
0
0
0
0
1
0.266667
false
0
0.133333
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
2d4e716ec32e46db3c8f8b92ca201b3088f776bf
1,911
py
Python
pages/cart_page.py
kukushdi3981/sel-1_test-project
81066e1501a62f642b5b76745801170ca62ad237
[ "Apache-2.0" ]
null
null
null
pages/cart_page.py
kukushdi3981/sel-1_test-project
81066e1501a62f642b5b76745801170ca62ad237
[ "Apache-2.0" ]
null
null
null
pages/cart_page.py
kukushdi3981/sel-1_test-project
81066e1501a62f642b5b76745801170ca62ad237
[ "Apache-2.0" ]
null
null
null
from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By class CartPage: def __init__(self, driver): self.driver = driver self.wait = WebDriverWait(driver, 10) def del_from_cart_button(self): return self.driver.find_elements_by_css_selector("li.item button[name='remove_cart_item']") @property def smal_prod_icons(self): return self.driver.find_elements_by_css_selector("li.shortcut a") @property def product_image(self): return self.driver.find_elements_by_css_selector("li.item a[class='image-wrapper shadow']") @property def back_main_page_link(self): return self.driver.find_element_by_css_selector("div#checkout-cart-wrapper a") def get_count_product_in_cart(self): self.wait.until(EC.presence_of_element_located((By.ID, "checkout-summary-wrapper"))) # определяем количество товаров для удаления из корзины (кол-во строк в таблице) return self.driver.find_elements_by_css_selector("div#checkout-summary-wrapper td.item") def delete_all_prod_from_cart(self, prod_count): for i in range(prod_count): # определяем элемент исчезновение которого будем ожидать после очередного удаления товара из корзины if i != prod_count-1: shortcuts = self.smal_prod_icons shortcuts[0].click() else: shortcuts = self.product_image products_del = self.del_from_cart_button() products_del[0].click() # ожидаем исчезновение нужного элемента для продолжения действий self.wait.until(EC.staleness_of(shortcuts[0])) def wait_for_empty_cart(self): self.wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, "div#checkout-cart-wrapper a")))
39
112
0.70539
254
1,911
5.047244
0.385827
0.054602
0.060842
0.078003
0.306552
0.279251
0.279251
0.279251
0.192668
0.192668
0
0.003958
0.206698
1,911
48
113
39.8125
0.841689
0.125589
0
0.090909
0
0
0.122975
0.092981
0
0
0
0
0
1
0.242424
false
0
0.090909
0.121212
0.515152
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
2
2d5dc4553abbc55c9321bc9cfe1937d4082c6990
272
py
Python
Modulo1/exercicio009_2.py
natterra/python3
e462192f03e81e2a614b1f2a441ffa702e4988e0
[ "MIT" ]
null
null
null
Modulo1/exercicio009_2.py
natterra/python3
e462192f03e81e2a614b1f2a441ffa702e4988e0
[ "MIT" ]
null
null
null
Modulo1/exercicio009_2.py
natterra/python3
e462192f03e81e2a614b1f2a441ffa702e4988e0
[ "MIT" ]
null
null
null
#Exercício Python 9: Faça um programa que leia um número Inteiro qualquer e mostre na tela a sua tabuada. n = int(input("Digite um número: ")) i = 0 print("--------------") while i < 10: i += 1 print("{:2} x {:2} = {:2}".format(n, i, n*i)) print("--------------")
30.222222
105
0.544118
44
272
3.363636
0.704545
0.108108
0
0
0
0
0
0
0
0
0
0.036364
0.191176
272
9
106
30.222222
0.636364
0.382353
0
0.285714
0
0
0.380952
0
0
0
0
0
0
1
0
false
0
0
0
0
0.428571
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
2
2d5eb9a5f86eac06485fcefb4b677be4db7c878c
4,988
py
Python
tests/test_metrics.py
Patte1808/moda
312c9594754ae0f6d17cbfafaa2c4c790c58efe5
[ "MIT" ]
27
2019-03-15T21:21:17.000Z
2022-01-03T14:37:02.000Z
tests/test_metrics.py
Patte1808/moda
312c9594754ae0f6d17cbfafaa2c4c790c58efe5
[ "MIT" ]
4
2019-09-30T13:29:20.000Z
2021-03-20T20:05:36.000Z
tests/test_metrics.py
Patte1808/moda
312c9594754ae0f6d17cbfafaa2c4c790c58efe5
[ "MIT" ]
11
2019-03-15T21:21:19.000Z
2021-08-09T22:10:15.000Z
"""Test evaluation functionality.""" from moda.evaluators import f_beta from moda.evaluators.metrics import calculate_metrics_with_shift, _join_metrics def test_f_beta1(): precision = 0.6 recall = 1.0 beta = 1 f = f_beta(precision, recall, beta) assert (f > 0.74) and (f < 0.76) def test_f_beta3(): precision = 0.6 recall = 1.0 beta = 3 f = f_beta(precision, recall, beta) assert (f > 0.937) and (f < 0.938) def test_calculate_metrics_with_shift_all_zero(): actual = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] predicted = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] metrics = calculate_metrics_with_shift(predicted, actual, window_size=1) assert metrics['TP'] == 0 assert metrics['FP'] == 0 assert metrics['FN'] == 0 def test_calculate_metrics_with_shift_actual_zero(): actual = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] predicted = [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0] metrics = calculate_metrics_with_shift(predicted, actual, window_size=1) assert metrics['TP'] == 0 assert metrics['FP'] == 2 assert metrics['FN'] == 0 predicted = [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1] metrics = calculate_metrics_with_shift(predicted, actual, window_size=1) assert metrics['TP'] == 0 assert metrics['FP'] == 4 assert metrics['FN'] == 0 def test_calculate_metrics_with_shift_predicted_zero(): actual = [0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0] predicted = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] metrics = calculate_metrics_with_shift(predicted, actual, window_size=1) assert metrics['TP'] == 0 assert metrics['FP'] == 0 assert metrics['FN'] == 2 actual = [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1] metrics = calculate_metrics_with_shift(predicted, actual, window_size=1) assert metrics['TP'] == 0 assert metrics['FP'] == 0 assert metrics['FN'] == 4 def test_calculate_metrics_with_shift_perfect(): actual = [0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0] predicted = [0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0] metrics = calculate_metrics_with_shift(predicted, actual, window_size=1) assert metrics['TP'] == 2 assert metrics['FP'] == 0 assert metrics['FN'] == 0 actual = [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1] predicted = [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1] metrics = calculate_metrics_with_shift(predicted, actual, window_size=1) assert metrics['TP'] == 4 assert metrics['FP'] == 0 assert metrics['FN'] == 0 def test_calculate_metrics_with_shift_mixed(): actual = [0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0] predicted = [0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0] metrics = calculate_metrics_with_shift(predicted, actual, window_size=1) assert metrics['TP'] == 1 assert metrics['FP'] == 1 assert metrics['FN'] == 1 def test_calculate_metrics_with_shift_in_window(): actual = [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0] predicted = [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0] metrics = calculate_metrics_with_shift(predicted, actual, window_size=1) assert metrics['TP'] == 1 assert metrics['FP'] == 0 assert metrics['FN'] == 0 def test_calculate_metrics_with_shift_in_large_window(): actual = [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0] predicted = [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0] metrics = calculate_metrics_with_shift(predicted, actual, window_size=4) assert metrics['TP'] == 1 assert metrics['FP'] == 0 assert metrics['FN'] == 0 def test_join_metrics(): metrics1 = {'cat1': {'TP': 12, 'FP': 7, 'FN': 35, 'num_samples': 1, 'num_values': 2}, 'cat2': {'TP': 0, 'FP': 0, 'FN': 0, 'num_samples': 1, 'num_values': 2}, 'cat4': {'TP': 9, 'FP': 9, 'FN': 9, 'num_samples': 1, 'num_values': 2}} metrics2 = {'cat1': {'TP': 10, 'FP': 10, 'FN': 10, 'num_samples': 1, 'num_values': 2}, 'cat2': {'TP': 2, 'FP': 2, 'FN': 2, 'num_samples': 1, 'num_values': 2}, 'cat3': {'TP': 1, 'FP': 1, 'FN': 1, 'num_samples': 1, 'num_values': 2}} metrics = _join_metrics(metrics1, metrics2) assert metrics['cat1']['TP'] == 22 assert metrics['cat1']['FP'] == 17 assert metrics['cat1']['FN'] == 45 assert metrics['cat1']['num_samples'] == 2 assert metrics['cat1']['num_values'] == 4 assert metrics['cat2']['TP'] == 2 assert metrics['cat2']['FP'] == 2 assert metrics['cat2']['FN'] == 2 assert metrics['cat3']['TP'] == 1 assert metrics['cat3']['FP'] == 1 assert metrics['cat3']['FN'] == 1 assert metrics['cat4']['TP'] == 9 assert metrics['cat4']['FP'] == 9 assert metrics['cat4']['FN'] == 9 if __name__ == '__main__': test_f_beta1() test_f_beta3() test_calculate_metrics_with_shift_all_zero() test_calculate_metrics_with_shift_actual_zero() test_calculate_metrics_with_shift_predicted_zero() test_calculate_metrics_with_shift_perfect() test_calculate_metrics_with_shift_mixed() test_calculate_metrics_with_shift_in_window() test_calculate_metrics_with_shift_in_large_window() test_join_metrics()
34.4
90
0.604451
784
4,988
3.633929
0.081633
0.087048
0.087399
0.078624
0.759214
0.759214
0.688663
0.588277
0.540892
0.517375
0
0.08794
0.220329
4,988
144
91
34.638889
0.644639
0.006014
0
0.446429
0
0
0.071688
0
0
0
0
0
0.410714
1
0.089286
false
0
0.017857
0
0.107143
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
2
2d662757e1d86c36d9d911b8a2139bac3250db00
221
py
Python
Other/pdf2imageTest.py
Wanganator414/python
afa7a931bd9da8a5235a6cd889bfc417950165fe
[ "MIT" ]
1
2019-08-17T03:31:19.000Z
2019-08-17T03:31:19.000Z
Other/pdf2imageTest.py
Wanganator414/python
afa7a931bd9da8a5235a6cd889bfc417950165fe
[ "MIT" ]
null
null
null
Other/pdf2imageTest.py
Wanganator414/python
afa7a931bd9da8a5235a6cd889bfc417950165fe
[ "MIT" ]
null
null
null
from pdf2image import convert_from_path, convert_from_bytes from pdf2image.exceptions import ( PDFInfoNotInstalledError, PDFPageCountError, PDFSyntaxError ) images = convert_from_path('.\git_cheat_sheet.pdf')
27.625
59
0.809955
24
221
7.125
0.625
0.192982
0.175439
0
0
0
0
0
0
0
0
0.010363
0.126697
221
7
60
31.571429
0.875648
0
0
0
0
0
0.095023
0.095023
0
0
0
0
0
1
0
false
0
0.285714
0
0.285714
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2d6d0fc2ece7d6b6190b0adbadaceaefdccb6df6
472
py
Python
templatetags/spreedly_tags.py
shelfworthy/django-spreedly
95e4572fec67501835d08c3e54e9437345733784
[ "MIT" ]
2
2015-09-28T10:08:13.000Z
2015-11-08T12:46:43.000Z
templatetags/spreedly_tags.py
shelfworthy/django-spreedly
95e4572fec67501835d08c3e54e9437345733784
[ "MIT" ]
null
null
null
templatetags/spreedly_tags.py
shelfworthy/django-spreedly
95e4572fec67501835d08c3e54e9437345733784
[ "MIT" ]
null
null
null
from django.conf import settings from django import template from spreedly.functions import subscription_url register = template.Library() @register.simple_tag def existing_plan_url(user): return 'https://spreedly.com/%(site_name)s/subscriber_accounts/%(user_token)s' % { 'site_name': settings.SPREEDLY_SITE_NAME, 'user_token': user.subscription.token } @register.simple_tag def new_plan_url(plan, user): return subscription_url(plan, user)
27.764706
86
0.760593
63
472
5.460317
0.444444
0.069767
0.098837
0.116279
0
0
0
0
0
0
0
0
0.137712
472
17
87
27.764706
0.845209
0
0
0.153846
0
0
0.186047
0
0
0
0
0
0
1
0.153846
false
0
0.230769
0.153846
0.538462
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
2
2d7ff8efa71157528cf59e7762c185eb4caf5b50
147
py
Python
Chapter08/chapter8_sflowtool_1.py
stavsta/Mastering-Python-Networking-Second-Edition
9999d2e415a1eb9c653ac3507500da7ddac2b556
[ "MIT" ]
107
2017-03-31T09:39:47.000Z
2022-01-10T17:43:12.000Z
Chapter08/chapter8_sflowtool_1.py
muzhang90/Mastering-Python-Networking-Third-Edition
f8086fc9a28e441cf8c31099d16839c2e868c7fc
[ "MIT" ]
3
2020-03-29T14:14:43.000Z
2020-10-29T18:21:09.000Z
Chapter08/chapter8_sflowtool_1.py
muzhang90/Mastering-Python-Networking-Third-Edition
f8086fc9a28e441cf8c31099d16839c2e868c7fc
[ "MIT" ]
98
2017-02-25T17:55:43.000Z
2022-02-20T19:06:06.000Z
#!/usr/bin/env python3 import sys, re for line in iter(sys.stdin.readline, ''): if re.search('agent ', line): print(line.strip())
14.7
41
0.605442
22
147
4.045455
0.818182
0
0
0
0
0
0
0
0
0
0
0.008696
0.217687
147
9
42
16.333333
0.765217
0.142857
0
0
0
0
0.04878
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2d849f6ef02f2ba2420e4777e5f788eedd4a8971
357
py
Python
src/emr/scripts/util.py
anorth848/aws-data-analytics
7721f1214f163a9a76f8e797edd3a1e300a5e2ab
[ "MIT" ]
1
2022-02-18T22:28:36.000Z
2022-02-18T22:28:36.000Z
src/emr/scripts/util.py
anorth848/aws-data-analytics
7721f1214f163a9a76f8e797edd3a1e300a5e2ab
[ "MIT" ]
null
null
null
src/emr/scripts/util.py
anorth848/aws-data-analytics
7721f1214f163a9a76f8e797edd3a1e300a5e2ab
[ "MIT" ]
null
null
null
import boto3 import logging import json def get_secret(secret): client = boto3.client('secretsmanager') logging.info(f'Retrieving secret {secret}') response = client.get_secret_value(SecretId=secret) logging.debug(f'Retrieved Secret ARN {response["ARN"]} VersionId {response["VersionId"]}') return json.loads(response['SecretString'])
29.75
94
0.742297
43
357
6.093023
0.511628
0.068702
0
0
0
0
0
0
0
0
0
0.006452
0.131653
357
11
95
32.454545
0.83871
0
0
0
0
0
0.347339
0.064426
0
0
0
0
0
1
0.111111
false
0
0.333333
0
0.555556
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
2da34ae804d338824cab481265b913a1023b155d
2,509
py
Python
pkgs/nbconvert-4.1.0-py27_0/lib/python2.7/site-packages/nbconvert/filters/markdown.py
wangyum/anaconda
6e5a0dbead3327661d73a61e85414cf92aa52be6
[ "Apache-2.0", "BSD-3-Clause" ]
652
2015-07-26T00:00:17.000Z
2022-02-24T18:30:04.000Z
pkgs/nbconvert-4.1.0-py27_0/lib/python2.7/site-packages/nbconvert/filters/markdown.py
wangyum/anaconda
6e5a0dbead3327661d73a61e85414cf92aa52be6
[ "Apache-2.0", "BSD-3-Clause" ]
8
2015-09-07T03:38:19.000Z
2021-05-23T03:18:51.000Z
pkgs/nbconvert-4.1.0-py27_0/lib/python2.7/site-packages/nbconvert/filters/markdown.py
wangyum/anaconda
6e5a0dbead3327661d73a61e85414cf92aa52be6
[ "Apache-2.0", "BSD-3-Clause" ]
40
2015-07-24T19:45:08.000Z
2021-11-01T14:54:56.000Z
"""Markdown filters This file contains a collection of utility filters for dealing with markdown within Jinja templates. """ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import print_function import os import subprocess from io import TextIOWrapper, BytesIO try: from .markdown_mistune import markdown2html_mistune except ImportError as e: # store in variable for Python 3 _mistune_import_error = e def markdown2html_mistune(source): """mistune is unavailable, raise ImportError""" raise ImportError("markdown2html requires mistune: %s" % _mistune_import_error) from nbconvert.utils.pandoc import pandoc from nbconvert.utils.exceptions import ConversionException from nbconvert.utils.version import check_version from ipython_genutils.py3compat import cast_bytes __all__ = [ 'markdown2html', 'markdown2html_pandoc', 'markdown2html_mistune', 'markdown2latex', 'markdown2rst', ] def markdown2latex(source, markup='markdown', extra_args=None): """Convert a markdown string to LaTeX via pandoc. This function will raise an error if pandoc is not installed. Any error messages generated by pandoc are printed to stderr. Parameters ---------- source : string Input string, assumed to be valid markdown. markup : string Markup used by pandoc's reader default : pandoc extended markdown (see http://johnmacfarlane.net/pandoc/README.html#pandocs-markdown) Returns ------- out : string Output as returned by pandoc. """ return pandoc(source, markup, 'latex', extra_args=extra_args) def markdown2html_pandoc(source, extra_args=None): """Convert a markdown string to HTML via pandoc""" extra_args = extra_args or ['--mathjax'] return pandoc(source, 'markdown', 'html', extra_args=extra_args) # The mistune renderer is the default, because it's simple to depend on it markdown2html = markdown2html_mistune def markdown2rst(source, extra_args=None): """Convert a markdown string to ReST via pandoc. This function will raise an error if pandoc is not installed. Any error messages generated by pandoc are printed to stderr. Parameters ---------- source : string Input string, assumed to be valid markdown. Returns ------- out : string Output as returned by pandoc. """ return pandoc(source, 'markdown', 'rst', extra_args=extra_args)
28.511364
87
0.721403
312
2,509
5.685897
0.394231
0.055806
0.031567
0.040586
0.327508
0.327508
0.327508
0.327508
0.306652
0.258174
0
0.007459
0.198485
2,509
87
88
28.83908
0.874689
0.478677
0
0
0
0
0.135666
0.017918
0
0
0
0
0
1
0.137931
false
0
0.413793
0
0.655172
0.034483
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
2db7c1f7bd22a70de17e35de2236e6155f5a96dc
534
py
Python
AEC.py
apayeur/GIF-Ca
7ba9e715d79aa3a733f417f7dfce81842041e7ec
[ "MIT" ]
1
2020-06-05T15:34:34.000Z
2020-06-05T15:34:34.000Z
src/AEC.py
apayeur/GIF-K
36228dfe5ffc2cded3f3224e289bd60e6bc7b93c
[ "MIT" ]
null
null
null
src/AEC.py
apayeur/GIF-K
36228dfe5ffc2cded3f3224e289bd60e6bc7b93c
[ "MIT" ]
null
null
null
import abc from Experiment import * class AEC : """ Abstract class defining an interface for performing active electrode compensation. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def performAEC(self, experiment): """ This method should preprocess all the traces in the experiment and compute V given V_rec. """ @abc.abstractmethod def plot(self): """ Plot the filter of AEC. """
18.413793
97
0.554307
52
534
5.596154
0.711538
0.116838
0.137457
0
0
0
0
0
0
0
0
0
0.378277
534
28
98
19.071429
0.876506
0.367041
0
0.25
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.75
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
2ddca5cc12de3a408cda0ff45249cbd6d8e54333
7,452
py
Python
pysnmp-with-texts/TIMETRA-SAS-IEEE8021-PAE-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
8
2019-05-09T17:04:00.000Z
2021-06-09T06:50:51.000Z
pysnmp-with-texts/TIMETRA-SAS-IEEE8021-PAE-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
4
2019-05-31T16:42:59.000Z
2020-01-31T21:57:17.000Z
pysnmp-with-texts/TIMETRA-SAS-IEEE8021-PAE-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
10
2019-04-30T05:51:36.000Z
2022-02-16T03:33:41.000Z
# # PySNMP MIB module TIMETRA-SAS-IEEE8021-PAE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TIMETRA-SAS-IEEE8021-PAE-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:21:45 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, SingleValueConstraint, ValueSizeConstraint, ValueRangeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "SingleValueConstraint", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsIntersection") dot1xAuthConfigEntry, = mibBuilder.importSymbols("IEEE8021-PAE-MIB", "dot1xAuthConfigEntry") ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup") Counter32, NotificationType, Gauge32, MibIdentifier, ModuleIdentity, Bits, TimeTicks, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, iso, Integer32, Counter64, IpAddress, Unsigned32 = mibBuilder.importSymbols("SNMPv2-SMI", "Counter32", "NotificationType", "Gauge32", "MibIdentifier", "ModuleIdentity", "Bits", "TimeTicks", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "iso", "Integer32", "Counter64", "IpAddress", "Unsigned32") DisplayString, TruthValue, TextualConvention, RowStatus = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TruthValue", "TextualConvention", "RowStatus") timetraSASNotifyPrefix, timetraSASConfs, timetraSASModules, timetraSASObjs = mibBuilder.importSymbols("TIMETRA-SAS-GLOBAL-MIB", "timetraSASNotifyPrefix", "timetraSASConfs", "timetraSASModules", "timetraSASObjs") TNamedItem, TPolicyStatementNameOrEmpty, ServiceAdminStatus = mibBuilder.importSymbols("TIMETRA-TC-MIB", "TNamedItem", "TPolicyStatementNameOrEmpty", "ServiceAdminStatus") timeraSASIEEE8021PaeMIBModule = ModuleIdentity((1, 3, 6, 1, 4, 1, 6527, 6, 2, 1, 1, 17)) timeraSASIEEE8021PaeMIBModule.setRevisions(('1912-07-01 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: timeraSASIEEE8021PaeMIBModule.setRevisionsDescriptions(('Rev 1.0 03 Aug 2012 00:00 1.0 release of the ALCATEL-SAS-IEEE8021-PAE-MIB.',)) if mibBuilder.loadTexts: timeraSASIEEE8021PaeMIBModule.setLastUpdated('1207010000Z') if mibBuilder.loadTexts: timeraSASIEEE8021PaeMIBModule.setOrganization('Alcatel-Lucent') if mibBuilder.loadTexts: timeraSASIEEE8021PaeMIBModule.setContactInfo('Alcatel-Lucent SROS Support Web: http://support.alcatel-lucent.com ') if mibBuilder.loadTexts: timeraSASIEEE8021PaeMIBModule.setDescription("This document is the SNMP MIB module to manage and provision the 7x50 extensions to the IEEE8021-PAE-MIB (Port Access Entity nodule for managing IEEE 802.X) feature for the Alcatel 7210 device. Copyright 2004-2012 Alcatel-Lucent. All rights reserved. Reproduction of this document is authorized on the condition that the foregoing copyright notice is included. This SNMP MIB module (Specification) embodies Alcatel-Lucent's proprietary intellectual property. Alcatel-Lucent retains all title and ownership in the Specification, including any revisions. Alcatel-Lucent grants all interested parties a non-exclusive license to use and distribute an unmodified copy of this Specification in connection with management of Alcatel-Lucent products, and without fee, provided this copyright notice and license appear on all copies. This Specification is supplied 'as is', and Alcatel-Lucent makes no warranty, either express or implied, as to the use, operation, condition, or performance of the Specification.") tmnxSASDot1xObjs = MibIdentifier((1, 3, 6, 1, 4, 1, 6527, 6, 2, 2, 2, 16)) tmnxSASDot1xAuthenticatorObjs = MibIdentifier((1, 3, 6, 1, 4, 1, 6527, 6, 2, 2, 2, 16, 1)) tmnxSASDot1xConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 6527, 6, 2, 2, 1, 12)) tmnxDot1xSASCompliancs = MibIdentifier((1, 3, 6, 1, 4, 1, 6527, 6, 2, 2, 1, 12, 1)) tmnxDot1xSASGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 6527, 6, 2, 2, 1, 12, 2)) dot1xAuthConfigExtnTable = MibTable((1, 3, 6, 1, 4, 1, 6527, 6, 2, 2, 2, 16, 1, 1), ) if mibBuilder.loadTexts: dot1xAuthConfigExtnTable.setStatus('current') if mibBuilder.loadTexts: dot1xAuthConfigExtnTable.setDescription('The table dot1xAuthConfigExtnTable allows configuration of RADIUS authentication parameters for the 802.1X PAE feature on port level.') dot1xAuthConfigExtnEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6527, 6, 2, 2, 2, 16, 1, 1, 1), ) dot1xAuthConfigEntry.registerAugmentions(("TIMETRA-SAS-IEEE8021-PAE-MIB", "dot1xAuthConfigExtnEntry")) dot1xAuthConfigExtnEntry.setIndexNames(*dot1xAuthConfigEntry.getIndexNames()) if mibBuilder.loadTexts: dot1xAuthConfigExtnEntry.setStatus('current') if mibBuilder.loadTexts: dot1xAuthConfigExtnEntry.setDescription('dot1xAuthConfigExtnEntry is an entry (conceptual row) in the dot1xAuthConfigExtnTable. Each entry represents the configuration for Radius Authentication on a port. Entries have a presumed StorageType of nonVolatile.') dot1xPortEtherTunnel = MibTableColumn((1, 3, 6, 1, 4, 1, 6527, 6, 2, 2, 2, 16, 1, 1, 1, 150), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: dot1xPortEtherTunnel.setStatus('current') if mibBuilder.loadTexts: dot1xPortEtherTunnel.setDescription('The value of tmnxPortEtherDot1xTunnel specifies whether the DOT1X packet tunneling for the ethernet port is enabled or disabled. When tunneling is enabled, the port will not process any DOT1X packets but will tunnel them through instead.') dot1xAuthConfigExtnGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 6527, 6, 2, 2, 1, 12, 2, 1)).setObjects(("TIMETRA-SAS-IEEE8021-PAE-MIB", "dot1xPortEtherTunnel")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): dot1xAuthConfigExtnGroup = dot1xAuthConfigExtnGroup.setStatus('current') if mibBuilder.loadTexts: dot1xAuthConfigExtnGroup.setDescription('The group of objects supporting management of Radius authentication for the IEEE801.1X PAE feature on Alcatel 7210 SR series systems.') dot1xAuthConfigExtnCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 6527, 6, 2, 2, 1, 12, 1, 1)).setObjects(("TIMETRA-SAS-IEEE8021-PAE-MIB", "dot1xAuthConfigExtnGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): dot1xAuthConfigExtnCompliance = dot1xAuthConfigExtnCompliance.setStatus('current') if mibBuilder.loadTexts: dot1xAuthConfigExtnCompliance.setDescription('The compliance statement for management of Radius authentication for the IEEE801.1X PAE feature on Alcatel 7210 SR series systems.') mibBuilder.exportSymbols("TIMETRA-SAS-IEEE8021-PAE-MIB", dot1xAuthConfigExtnGroup=dot1xAuthConfigExtnGroup, dot1xAuthConfigExtnEntry=dot1xAuthConfigExtnEntry, tmnxSASDot1xObjs=tmnxSASDot1xObjs, timeraSASIEEE8021PaeMIBModule=timeraSASIEEE8021PaeMIBModule, tmnxDot1xSASGroups=tmnxDot1xSASGroups, PYSNMP_MODULE_ID=timeraSASIEEE8021PaeMIBModule, dot1xAuthConfigExtnCompliance=dot1xAuthConfigExtnCompliance, tmnxDot1xSASCompliancs=tmnxDot1xSASCompliancs, dot1xPortEtherTunnel=dot1xPortEtherTunnel, tmnxSASDot1xConformance=tmnxSASDot1xConformance, dot1xAuthConfigExtnTable=dot1xAuthConfigExtnTable, tmnxSASDot1xAuthenticatorObjs=tmnxSASDot1xAuthenticatorObjs)
143.307692
1,076
0.800322
841
7,452
7.08918
0.335315
0.005032
0.04579
0.00738
0.243039
0.166723
0.154646
0.142905
0.142905
0.140892
0
0.071915
0.093129
7,452
51
1,077
146.117647
0.810299
0.046967
0
0.071429
0
0.142857
0.415621
0.056535
0
0
0
0
0
1
0
false
0
0.214286
0
0.214286
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2df782b87d6da8a3b61ad938472a58ca41cb66f2
396
py
Python
stubs/esp32_1_10_0/upip_utarfile.py
jmannau/micropython-stubber
8930e8a0038192fd259b31a193d1da3b2501256a
[ "MIT" ]
null
null
null
stubs/esp32_1_10_0/upip_utarfile.py
jmannau/micropython-stubber
8930e8a0038192fd259b31a193d1da3b2501256a
[ "MIT" ]
null
null
null
stubs/esp32_1_10_0/upip_utarfile.py
jmannau/micropython-stubber
8930e8a0038192fd259b31a193d1da3b2501256a
[ "MIT" ]
null
null
null
"Module 'upip_utarfile' on firmware 'v1.10-247-g0fb15fc3f on 2019-03-29'" DIRTYPE = 'dir' class FileSection(): ... def read(): pass def readinto(): pass def skip(): pass REGTYPE = 'file' TAR_HEADER = None class TarFile(): ... def extractfile(): pass def next(): pass class TarInfo(): ... def roundup(): pass uctypes = None
13.2
73
0.560606
46
396
4.782609
0.695652
0.095455
0
0
0
0
0
0
0
0
0
0.064982
0.300505
396
29
74
13.655172
0.729242
0
0
0.3
0
0.05
0.19697
0.05303
0
0
0
0
0
0
null
null
0.3
0
null
null
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
1
0
0
0
0
0
2
2dfab9e21824f933194ff41412afd5eaebd5cb04
438
py
Python
reader.py
Asylumrunner/FeedingFrenzy
7f0d96f8361cb2c37cd41d06345e6ec0aa721472
[ "MIT" ]
1
2020-12-08T13:09:38.000Z
2020-12-08T13:09:38.000Z
reader.py
weisisheng/FeedingFrenzy
7f0d96f8361cb2c37cd41d06345e6ec0aa721472
[ "MIT" ]
null
null
null
reader.py
weisisheng/FeedingFrenzy
7f0d96f8361cb2c37cd41d06345e6ec0aa721472
[ "MIT" ]
1
2020-12-08T13:09:39.000Z
2020-12-08T13:09:39.000Z
import feedparser def read_rss_feed(feed_url): feed = feedparser.parse(feed_url) return [trim_entry(entry) for entry in feed.entries] def trim_entry(entry): return { 'date': "{}/{}/{}".format(entry.published_parsed.tm_year, entry.published_parsed.tm_mon, entry.published_parsed.tm_mday), 'title': entry.title, 'link': entry.link, 'author': entry.author, 'summary': entry.summary }
31.285714
129
0.6621
56
438
4.964286
0.464286
0.151079
0.215827
0.23741
0
0
0
0
0
0
0
0
0.19863
438
14
130
31.285714
0.792023
0
0
0
0
0
0.077449
0
0
0
0
0
0
1
0.166667
false
0
0.083333
0.083333
0.416667
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
93034a9a6233faadc660e34f44294b994aedc83c
124
py
Python
Eolymp_DSAWeek1_Solns/Digits.py
sulphatet/MiniProjectsndCodingProbs
a8f6c9c3993854cad9444800f9d1b1720a239b39
[ "MIT" ]
1
2022-02-24T08:29:00.000Z
2022-02-24T08:29:00.000Z
Eolymp_DSAWeek1_Solns/Digits.py
sulphatet/MiniProjectsndCodingProbs
a8f6c9c3993854cad9444800f9d1b1720a239b39
[ "MIT" ]
null
null
null
Eolymp_DSAWeek1_Solns/Digits.py
sulphatet/MiniProjectsndCodingProbs
a8f6c9c3993854cad9444800f9d1b1720a239b39
[ "MIT" ]
null
null
null
num = int(input()) x = 0 if num == 0: print(1) exit() while num != 0: x +=1 num = num//10 print(x)
12.4
19
0.435484
21
124
2.571429
0.52381
0.148148
0
0
0
0
0
0
0
0
0
0.090909
0.379032
124
9
20
13.777778
0.61039
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.222222
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
93074d51c0af568361ff79fea1825596f6e8553e
252
py
Python
edbdeploy/spec/__init__.py
mw2q/postgres-deployment
7b07375588da6ede25062c5518922275ed35844b
[ "BSD-3-Clause" ]
null
null
null
edbdeploy/spec/__init__.py
mw2q/postgres-deployment
7b07375588da6ede25062c5518922275ed35844b
[ "BSD-3-Clause" ]
1
2021-07-01T18:02:00.000Z
2021-07-01T18:02:00.000Z
edbdeploy/spec/__init__.py
jt-edb/postgres-deployment
871cf517379152f096f44d682dd03d93971715a2
[ "BSD-3-Clause" ]
null
null
null
class SpecValidator: def __init__(self, type=None, default=None, choices=[], min=None, max=None): self.type = type self.default = default self.choices = choices self.min = min self.max = max
28
69
0.559524
29
252
4.724138
0.37931
0.116788
0
0
0
0
0
0
0
0
0
0
0.337302
252
8
70
31.5
0.820359
0
0
0
0
0
0
0
0
0
0
0
0
1
0.125
false
0
0
0
0.25
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
931b8e121065b6e7d0568d8a4e43d037da1b3b77
4,295
py
Python
dynatrace/environment_v2/networkzones.py
hashmibilaldt/api-client-python
910008a4c6800a547535acba79b7a49e540b5d16
[ "Apache-2.0" ]
null
null
null
dynatrace/environment_v2/networkzones.py
hashmibilaldt/api-client-python
910008a4c6800a547535acba79b7a49e540b5d16
[ "Apache-2.0" ]
null
null
null
dynatrace/environment_v2/networkzones.py
hashmibilaldt/api-client-python
910008a4c6800a547535acba79b7a49e540b5d16
[ "Apache-2.0" ]
null
null
null
""" Copyright 2021 Dynatrace LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ from datetime import datetime from dynatrace.dynatrace_object import DynatraceObject from typing import List, Optional, Union, Dict, Any from dynatrace.environment_v2.schemas import EntityType, ManagementZone from dynatrace.http_client import HttpClient from dynatrace.pagination import PaginatedList class NetworkZoneService: ENDPOINT = "/api/v2/networkZones" ENDPOINT_GLOBALSETTINGS = "/api/v2/networkZoneSettings" def __init__(self, http_client: HttpClient): self.__http_client = http_client def list(self) -> PaginatedList["NetworkZone"]: """ Lists all network zones. No params :return: a list of Network Zones with details """ return PaginatedList(NetworkZone, self.__http_client, target_url=self.ENDPOINT, list_item="networkZones") def get(self, networkzone_id: str): """ Gets parameters of specified network zone :param networkzone_id: the ID of the network zone :return: a Network Zone + details """ response = self.__http_client.make_request(f"{self.ENDPOINT}/{networkzone_id}").json() return NetworkZone(raw_element=response) def update(self, networkzone_id: str, alternate_zones: Optional[List[str]] = None, description: Optional[str] = None): """ Updates an existing network zone or creates a new one :param networkzone_id: the ID of the network zone, if none exists, will create :param alternate_zones: optional list of text body of alternative network zones :param description: optional text body for short description of network zone :return: HTTP response """ params = {"alternativeZones": alternate_zones, "description": description} return self.__http_client.make_request(path=f"{self.ENDPOINT}/{networkzone_id}", params=params, method="PUT") def delete(self, networkzone_id: str): """ Deletes the specified network zone :param networkzone_id: the ID of the network zone :return: HTTP response """ return self.__http_client.make_request(path=f"{self.ENDPOINT}/{networkzone_id}", method="DELETE") def getGlobalConfig(self): """ Gets the global configuration of network zones. No params :return: Network Zone Global Settings object """ response = self.__http_client.make_request(path=self.ENDPOINT_GLOBALSETTINGS).json() return NetworkZoneSettings(raw_element=response) def updateGlobalConfig(self, configuration: bool): """ Updates the global configuration of network zones. :param configuration: boolean setting to enable/disable NZs :return: HTTP response """ params = {"networkZonesEnabled": configuration} return self.__http_client.make_request(path=self.ENDPOINT_GLOBALSETTINGS, method="PUT", params=params) class NetworkZone(DynatraceObject): def _create_from_raw_data(self, raw_element: Dict[str, Any]): self.id: str = raw_element.get("id") self.description: str = raw_element.get("description") self.alternative_zones: List[str] = raw_element.get("alternativeZones") self.num_oneagents_using: int = raw_element.get("numOfOneAgentsUsing") self.num_oneagents_configured: int = raw_element.get("numOfConfiguredOneAgents") self.num_oneagents_from_other_zones: int = raw_element.get("numOfOneAgentsFromOtherZones") self.num_configured_activegates: int = raw_element.get("numOfConfiguredActiveGates") class NetworkZoneSettings(DynatraceObject): def _create_from_raw_data(self, raw_element: Dict[str, bool]): self.network_zones_enabled: bool = raw_element.get("networkZonesEnabled")
40.518868
122
0.723632
521
4,295
5.802303
0.320537
0.039696
0.037049
0.029772
0.244459
0.209064
0.171684
0.169699
0.169699
0.12041
0
0.003166
0.191153
4,295
106
123
40.518868
0.867012
0.331548
0
0
0
0
0.137996
0.075168
0
0
0
0
0
1
0.230769
false
0
0.153846
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
9320c7176b7d0f5a4f94419ff900dc0287dd18c3
8,544
py
Python
tests/l_layer/backward.py
felix990302/nnlib
618c9f860ff2298ed2e0bbcb249ae74eeb8a408b
[ "Apache-2.0" ]
1
2019-03-27T17:02:50.000Z
2019-03-27T17:02:50.000Z
tests/l_layer/backward.py
felix990302/nnlib
618c9f860ff2298ed2e0bbcb249ae74eeb8a408b
[ "Apache-2.0" ]
null
null
null
tests/l_layer/backward.py
felix990302/nnlib
618c9f860ff2298ed2e0bbcb249ae74eeb8a408b
[ "Apache-2.0" ]
null
null
null
import numpy as np from numpy.random import RandomState from numpy.testing import assert_allclose from nnlib.l_layer.backward import linear_backward, linear_backward_activation, model_backward from nnlib.utils.derivative import sigmoid_backward, relu_backward from nnlib.utils.activation import sigmoid, relu def test_linear_backward(): rand = RandomState(1) dZ = rand.randn(1, 2) A = rand.randn(3, 2) W = rand.randn(1, 3) dA_prev, dW, db = linear_backward(dZ, (A, 1, W), alpha=0, keep_prob=1) assert_allclose(dA_prev, [ [0.51822968, -0.19517421], [-0.40506361, 0.15255393], [2.37496825, -0.89445391]]) assert_allclose(dW, [[-0.10076895, 1.40685096, 1.64992505]]) assert_allclose(db, [[0.50629448]]) def test_linear_backward_activation_sigmoid(): rand = RandomState(2) dA = rand.randn(1, 2) A = rand.randn(3, 2) W = rand.randn(1, 3) _ = rand.randn(1, 1) # noqa: F841 Z = rand.randn(1, 2) dA_prev, dW, db = linear_backward_activation(dA, ((A, 1, W), (Z, sigmoid(Z))), sigmoid_backward, alpha=0, keep_prob=1) assert_allclose(dA_prev, np.array([ [0.11017994, 0.01105339], [0.09466817, 0.00949723], [-0.05743092, -0.00576154]]), rtol=1e-05) assert_allclose(dW, np.array([[0.10266786, 0.09778551, -0.01968084]]), rtol=1e-05) assert_allclose(db, np.array([[-0.05729622]]), rtol=1e-05) def test_linear_backward_activation_relu(): rand = RandomState(2) dA = rand.randn(1, 2) A = rand.randn(3, 2) W = rand.randn(1, 3) _ = rand.randn(1, 1) # noqa: F841 Z = rand.randn(1, 2) dA_prev, dW, db = linear_backward_activation(dA, ((A, 1, W), (Z, relu(Z))), relu_backward, alpha=0, keep_prob=1) assert_allclose(dA_prev, np.array([ [0.44090989, 0.], [0.37883606, 0.], [-0.2298228, 0.]]), rtol=1e-05) assert_allclose(dW, np.array([[0.44513824, 0.37371418, -0.10478989]]), rtol=1e-05) assert_allclose(db, np.array([[-0.20837892]]), rtol=1e-05) def test_model_backward(): rand = RandomState(3) AL = rand.randn(1, 2) Y = np.array([[1, 0]]) X = rand.randn(4, 2) W1 = rand.randn(3, 4) b1 = rand.randn(3, 1) Z1 = rand.randn(3, 2) A1 = rand.randn(3, 2) W2 = rand.randn(1, 3) b2 = rand.randn(1, 1) Z2 = rand.randn(1, 2) parameters = dict( W={1: W1, 2: W2}, b={1: b1, 2: b2} ) caches = dict( Z={1: Z1, 2: Z2}, A={0: X, 1: A1, 2: sigmoid(Z2)}, D={0: 1, 1: 1} ) grads = model_backward(AL, Y, parameters, caches, alpha=0, keep_prob=1) assert_allclose( grads["dW"][1], np.array([ [0.41010002, 0.07807203, 0.13798444, 0.10502167], [0., 0., 0., 0.], [0.05283652, 0.01005865, 0.01777766, 0.0135308]]), rtol=1e-05 ) assert_allclose( grads["db"][1], np.array([ [-0.22007063], [0.], [-0.02835349]]) ) assert_allclose( grads["dA"][1], np.array([ [0.12913162, -0.44014127], [-0.14175655, 0.48317296], [0.01663708, -0.05670698]]), rtol=1e-05 ) def test_model_backward_l2_regularization(): random_state = RandomState(1) X = random_state.randn(3, 5) Y = np.array([[1, 1, 0, 1, 0]]) cache = ( np.array([[-1.52855314, 3.32524635, 2.13994541, 2.60700654, -0.75942115], [-1.98043538, 4.1600994, 0.79051021, 1.46493512, -0.45506242]]), np.array([[0., 3.32524635, 2.13994541, 2.60700654, 0.], [0., 4.1600994, 0.79051021, 1.46493512, 0.]]), np.array([[-1.09989127, -0.17242821, -0.87785842], [0.04221375, 0.58281521, -1.10061918]]), np.array([[1.14472371], [0.90159072]]), np.array([[0.53035547, 5.94892323, 2.31780174, 3.16005701, 0.53035547], [-0.69166075, -3.47645987, -2.25194702, -2.65416996, -0.69166075], [-0.39675353, -4.62285846, -2.61101729, -3.22874921, -0.39675353]]), np.array([[0.53035547, 5.94892323, 2.31780174, 3.16005701, 0.53035547], [0., 0., 0., 0., 0.], [0., 0., 0., 0., 0.]]), np.array([[0.50249434, 0.90085595], [-0.68372786, -0.12289023], [-0.93576943, -0.26788808]]), np.array([[0.53035547], [-0.69166075], [-0.39675353]]), np.array( [[-0.3771104, -4.10060224, -1.60539468, -2.18416951, -0.3771104]]), np.array( [[0.40682402, 0.01629284, 0.16722898, 0.10118111, 0.40682402]]), np.array([[-0.6871727, -0.84520564, -0.67124613]]), np.array([[-0.0126646]]) ) Z1, A1, W1, b1, Z2, A2, W2, b2, Z3, _, W3, b3 = cache parameters = dict( W={1: W1, 2: W2, 3: W3}, b={1: b1, 2: b2, 3: b3} ) caches = dict( Z={1: Z1, 2: Z2, 3: Z3}, A={0: X, 1: A1, 2: A2, 3: sigmoid(Z3)}, D={0: 1, 1: 1, 2: 1} ) AL = caches["A"][3] grads = model_backward(AL, Y, parameters, caches, alpha=0.7, keep_prob=1) dW1 = np.array([[-0.25604646, 0.12298827, - 0.28297129], [-0.17706303, 0.34536094, - 0.4410571]]) dW2 = np.array([[0.79276486, 0.85133918], [-0.0957219, - 0.01720463], [-0.13100772, - 0.03750433]]) dW3 = np.array([[-1.77691347, - 0.11832879, - 0.09397446]]) assert_allclose(grads['dW'][1], dW1) assert_allclose(grads['dW'][2], dW2, rtol=1e-05) assert_allclose(grads['dW'][3], dW3) def test_model_backward_dropout(): random_state = RandomState(1) X = random_state.randn(3, 5) Y = np.array([[1, 1, 0, 1, 0]]) cache = ( np.array([[-1.52855314, 3.32524635, 2.13994541, 2.60700654, -0.75942115], [-1.98043538, 4.1600994, 0.79051021, 1.46493512, -0.45506242]]), np.array([[True, False, True, True, True], [True, True, True, True, False]], dtype=bool), np.array([[0., 0., 4.27989081, 5.21401307, 0.], [0., 8.32019881, 1.58102041, 2.92987024, 0.]]), np.array([[-1.09989127, -0.17242821, -0.87785842], [0.04221375, 0.58281521, -1.10061918]]), np.array([[1.14472371], [0.90159072]]), np.array([[0.53035547, 8.02565606, 4.10524802, 5.78975856, 0.53035547], [-0.69166075, -1.71413186, -3.81223329, -4.61667916, -0.69166075], [-0.39675353, -2.62563561, -4.82528105, -6.0607449, -0.39675353]]), np.array([[True, False, True, False, True], [False, True, False, True, True], [False, False, True, False, False]], dtype=bool), np.array([[1.06071093, 0., 8.21049603, 0., 1.06071093], [0., 0., 0., 0., 0.], [0., 0., 0., 0., 0.]]), np.array([[0.50249434, 0.90085595], [-0.68372786, -0.12289023], [-0.93576943, -0.26788808]]), np.array([[0.53035547], [-0.69166075], [-0.39675353]]), np.array([[-0.7415562, -0.0126646, -5.65469333, -0.0126646, -0.7415562]]), np.array([[0.32266394, 0.49683389, 0.00348883, 0.49683389, 0.32266394]]), np.array([[-0.6871727, -0.84520564, -0.67124613]]), np.array([[-0.0126646]]) ) Z1, D1, A1, W1, b1, Z2, D2, A2, W2, b2, Z3, A3, W3, b3 = cache parameters = dict( W={1: W1, 2: W2, 3: W3}, b={1: b1, 2: b2, 3: b3} ) caches = dict( Z={1: Z1, 2: Z2, 3: Z3}, A={0: X, 1: A1, 2: A2, 3: sigmoid(Z3)}, D={0: 1, 1: D1, 2: D2} ) grads = model_backward(A3, Y, parameters, caches, alpha=0, keep_prob=0.8) dA1 = np.array([[0.36544439, 0., -0.00188233, 0., -0.17408748], [0.65515713, 0., -0.00337459, 0., -0.]]) dA2 = np.array([[0.58180856, 0., -0.00299679, 0., -0.27715731], [0., 0.53159854, -0., 0.53159854, -0.34089673], [0., 0., -0.00292733, 0., -0., ]]) assert_allclose(grads['dA'][1], dA1, rtol=1e-05) assert_allclose(grads['dA'][2], dA2, rtol=1e-05)
37.147826
122
0.508544
1,160
8,544
3.682759
0.194828
0.070459
0.05618
0.014981
0.553371
0.499766
0.466994
0.410346
0.410346
0.35206
0
0.351985
0.301381
8,544
229
123
37.310044
0.363713
0.002458
0
0.422111
0
0
0.001995
0
0
0
0
0
0.090452
1
0.030151
false
0
0.030151
0
0.060302
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
932e5914cfad78eadac43b5ef29f6ed1ab78376e
874
py
Python
config/conf.d/04-spawner-common.py
possiblyMikeB/davidson-jupyter
8980c1249756d421b70950b9895b75e16d7e68c0
[ "BSD-3-Clause" ]
null
null
null
config/conf.d/04-spawner-common.py
possiblyMikeB/davidson-jupyter
8980c1249756d421b70950b9895b75e16d7e68c0
[ "BSD-3-Clause" ]
null
null
null
config/conf.d/04-spawner-common.py
possiblyMikeB/davidson-jupyter
8980c1249756d421b70950b9895b75e16d7e68c0
[ "BSD-3-Clause" ]
null
null
null
import json, os ## base spawner config try: c.Spawner.cmd = \ json.loads(os.environ['SPAWNER_CMD']) except KeyError: c.Spawner.cmd = [ 'jupyterhub-singleuser', # OAuth wrapped jupyter instance server '--KernelManager.transport=ipc', # -- all kernel comms over UNIX sockets '--MappingKernelManager.cull_idle_timeout=0' # -- no kernel culling ] c.Spawner.http_timeout = int(os.environ.get('SPAWNER_HTTP_TIMEOUT', '20')) # grace period for spawner connect back c.Spawner.default_url = os.environ.get('SPAWNER_DEFAULT_URL', '/lab') # default route to visit once spawned # set jupyter instacne base directory (relative to $HOME) if hub_id.lower() in {'jupyter', 'public', 'pub'}: c.Spawner.notebook_dir = '' else: # restrict to context specific notebook path c.Spawner.notebook_dir = f'Workspace/{hub_id}' pass
33.615385
114
0.693364
116
874
5.112069
0.646552
0.080944
0.037099
0.064081
0
0
0
0
0
0
0
0.004202
0.183066
874
25
115
34.96
0.826331
0.330664
0
0
0
0
0.317073
0.160279
0
0
0
0
0
1
0
true
0.058824
0.058824
0
0.058824
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
2
93388ca96a9f3273e22a1cd4ed97d8092f0d63f7
739
py
Python
a10/build/lib/a10/asvr/types.py
THS-on/AttestationEngine
6746d602215df43056b04515bd9b831f0bb0ddbb
[ "BSD-3-Clause-Clear" ]
null
null
null
a10/build/lib/a10/asvr/types.py
THS-on/AttestationEngine
6746d602215df43056b04515bd9b831f0bb0ddbb
[ "BSD-3-Clause-Clear" ]
4
2021-11-08T19:47:56.000Z
2021-11-25T10:30:50.000Z
a10/build/lib/a10/asvr/types.py
THS-on/AttestationEngine
6746d602215df43056b04515bd9b831f0bb0ddbb
[ "BSD-3-Clause-Clear" ]
null
null
null
# Copyright 2021 Nokia # Licensed under the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause import a10.structures.constants import a10.structures.identity import a10.structures.returncode import a10.asvr.db.core import a10.asvr.db.announce import a10.asvr.elements def getTypes(): """Gets a list of all currently used types :return: set of types :rtype: Set """ ts = [] es = a10.asvr.elements.getElementsFull() for e in es: print("type=", e["type"],type(e["type"])) # ugly - we keep everything as a flat list for t in e["type"]: ts.append(t) print("ts =", ts) # otherwise the set(List) breaks # warned you! return set(ts)
21.114286
50
0.630582
104
739
4.480769
0.538462
0.11588
0.122318
0.064378
0
0
0
0
0
0
0
0.036166
0.251691
739
34
51
21.735294
0.80651
0.351827
0
0
0
0
0.048458
0
0
0
0
0
0
1
0.066667
false
0
0.4
0
0.533333
0.133333
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
934773febc7f5decd256c9aba66a91ef1956f628
761
py
Python
setup.py
shubhamjain/quick-grayscale
470f726ec93224ffff57a3d7ba58fcf849fb4617
[ "MIT" ]
14
2018-11-26T01:32:21.000Z
2021-11-09T11:04:34.000Z
setup.py
shubhamjain/quick-grayscale
470f726ec93224ffff57a3d7ba58fcf849fb4617
[ "MIT" ]
1
2019-03-28T21:38:56.000Z
2019-03-30T21:34:05.000Z
setup.py
shubhamjain/quick-grayscale
470f726ec93224ffff57a3d7ba58fcf849fb4617
[ "MIT" ]
1
2018-12-05T01:10:55.000Z
2018-12-05T01:10:55.000Z
""" This is a setup.py script generated by py2applet Usage: python setup.py py2app """ from setuptools import setup APP = ["quick-gray.py"] APP_NAME = "QuickGrayscale" DATA_FILES = ["status-bar-logo.png", "status-bar-logo--dark.png"] OPTIONS = { "iconfile":"./assets/gq.icns", "plist": { "CFBundleName": "QuickGrayscale", "CFBundleDisplayName": "Quick Grayscale", "CFBundleIdentifier": "com.shubham.quickgrayscale", "CFBundleVersion": "0.1.2, "CFBundleShortVersionString": "0.1.2", "LSUIElement": True # Launch on startup }, "packages": ["rumps"] } setup( name="Quick Grayscale", app=APP, data_files=DATA_FILES, options={"py2app": OPTIONS}, setup_requires=["py2app"] )
23.060606
65
0.634691
82
761
5.829268
0.634146
0.056485
0.054393
0
0
0
0
0
0
0
0
0.016529
0.204993
761
33
66
23.060606
0.773554
0.022339
0
0
1
0
0.461656
0.118098
0
0
0
0
0
0
null
null
0
0.043478
null
null
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
9352862472804182f6ff78dfa5acae79e4f0c5ce
476
py
Python
gist_set.py
devnoname120/gist-alfred
5e918566254b6891241be3ad6e2f6c77959052ff
[ "MIT" ]
113
2015-06-24T19:36:22.000Z
2022-03-05T05:15:49.000Z
gist_set.py
devnoname120/gist-alfred
5e918566254b6891241be3ad6e2f6c77959052ff
[ "MIT" ]
18
2016-05-03T08:21:54.000Z
2022-03-26T18:24:21.000Z
gist_set.py
devnoname120/gist-alfred
5e918566254b6891241be3ad6e2f6c77959052ff
[ "MIT" ]
13
2015-07-02T03:16:04.000Z
2022-03-15T10:42:38.000Z
#!/usr/bin/python # encoding: utf-8 from collections import Counter from gist import create_workflow from pprint import pprint as pp import sys import workflow from workflow import Workflow, web from workflow.background import run_in_background, is_running def main(wf): arg = wf.args[0] wf.add_item(u"Set token", arg=arg, valid=True, icon="icons/token.png") wf.send_feedback() if __name__ == '__main__': wf = create_workflow() sys.exit(wf.run(main))
21.636364
74
0.735294
74
476
4.527027
0.594595
0.083582
0
0
0
0
0
0
0
0
0
0.005
0.159664
476
21
75
22.666667
0.8325
0.067227
0
0
0
0
0.072398
0
0
0
0
0
0
1
0.071429
false
0
0.5
0
0.571429
0.071429
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
936f55fdfaa40d9286b2780e20a668166b6fc40f
273
py
Python
backfill/save_to_gcs.py
grollins/quandl-gcp-pipeline
1b6c247fb3ad1ee33bd3cf363d119c124b8e26b2
[ "MIT" ]
null
null
null
backfill/save_to_gcs.py
grollins/quandl-gcp-pipeline
1b6c247fb3ad1ee33bd3cf363d119c124b8e26b2
[ "MIT" ]
null
null
null
backfill/save_to_gcs.py
grollins/quandl-gcp-pipeline
1b6c247fb3ad1ee33bd3cf363d119c124b8e26b2
[ "MIT" ]
null
null
null
from google.cloud import storage GCS_CLIENT = storage.Client() GCS_BUCKET = GCS_CLIENT.get_bucket('senpai-io.appspot.com') path = 'quandl-stage/backfill_data_jan2015_mar2018.csv' blob = GCS_BUCKET.blob(path) blob.upload_from_filename(filename='data_jan2015_mar2018.csv')
30.333333
62
0.81685
41
273
5.146341
0.585366
0.085308
0.170616
0.199052
0
0
0
0
0
0
0
0.062992
0.069597
273
8
63
34.125
0.767717
0
0
0
0
0
0.333333
0.333333
0
0
0
0
0
1
0
false
0
0.166667
0
0.166667
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
9373256a577124b3122a3c2bb32ac8963415c16e
5,229
py
Python
rest_api/views/doc_users.py
AktanKasymaliev/django_MyDentKg_backend
ede10d33028d36035b22e1e1dec916d773fecff6
[ "MIT" ]
null
null
null
rest_api/views/doc_users.py
AktanKasymaliev/django_MyDentKg_backend
ede10d33028d36035b22e1e1dec916d773fecff6
[ "MIT" ]
null
null
null
rest_api/views/doc_users.py
AktanKasymaliev/django_MyDentKg_backend
ede10d33028d36035b22e1e1dec916d773fecff6
[ "MIT" ]
null
null
null
from rest_framework import generics from rest_framework import response from rest_framework.permissions import AllowAny, IsAuthenticated from rest_framework.views import APIView from rest_api.serializers.doc_serializers import (DoctorRegisterSerializer, DoctorUsersSerializer, DoctorLoginSerializer, DoctorChangePasswordSerializer) from rest_framework.response import Response from rest_api.send_mail import password_reset_token_created, send_confirmation_email from rest_framework import status from doctorsUser.models import DoctorUser from drf_yasg.utils import swagger_auto_schema from rest_framework_simplejwt.views import TokenObtainPairView from rest_framework_simplejwt.backends import TokenBackend from rest_api.permissions import IsOwnerOrReadOnly import jwt from config.settings import SECRET_KEY class DoctorUsersView(generics.ListAPIView): queryset = DoctorUser.objects.all() serializer_class = DoctorUsersSerializer @swagger_auto_schema(operation_description='List doctor users (can add params(?search) for search)', tags=['Doctor User'], security=[]) def get(self, request): return self.list(request) def get_queryset(self): search = self.request.query_params.get("search") query = super().get_queryset() if search: query = query.filter(fullname__icontains=search) return query else: return query class Doctor(generics.RetrieveAPIView): serializer_class = DoctorUsersSerializer queryset = DoctorUser.objects.all() class DoctorUserRegisterView(generics.CreateAPIView): serializer_class = DoctorRegisterSerializer @swagger_auto_schema(operation_description='Registration doctor users', tags=['Doctor User'], security=[]) def post(self, request): serializer = DoctorRegisterSerializer(data=request.data) if serializer.is_valid(raise_exception=True): user = serializer.save() if user: send_confirmation_email(request, user) return Response(serializer.data, status=status.HTTP_201_CREATED) class DoctorLoginView(TokenObtainPairView): serializer_class = DoctorLoginSerializer permission_classes = [AllowAny,] @swagger_auto_schema(operation_description='Login doctor users', tags=['Doctor User'], security=[]) def post(self, request, *args, **kwargs): return super().post(request, *args, **kwargs) class DoctorChangePasswordView(generics.UpdateAPIView): serializer_class = DoctorChangePasswordSerializer model = DoctorUser permission_classes = (IsOwnerOrReadOnly,) def update(self, request, *args, **kwargs): user = self.request.user serializer: DoctorChangePasswordSerializer = self.get_serializer(data=request.data) if serializer.is_valid(): if not user.check_password(serializer.data.get("old_password")): return Response({"old_password": "Wrong password"}, status=status.HTTP_400_BAD_REQUEST) user.set_password(serializer.data.get("new_password")) user.save() return Response({ 'status': 'success', 'code': status.HTTP_200_OK, 'message': 'Password updated successfully', 'data': [] }) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) class DoctorForgotPasswordView(APIView): permission_classes = [IsOwnerOrReadOnly, ] @swagger_auto_schema(operation_description='Reset password doctor users', tags=['Doctor User'], security=[]) def get(self, request, *args, **kwargs): password_reset_token_created(request) return response.Response("Email was sended", status=status.HTTP_200_OK) class DoctorInfo(generics.ListAPIView): serializer_class = DoctorUsersSerializer model = DoctorUser permission_classes = [IsAuthenticated] def get(self, request, *args, **kwargs): token = request.META.get('HTTP_AUTHORIZATION', " ").split(' ')[1] user_id = jwt.decode(token, SECRET_KEY, algorithms=["HS256"])["user_id"] request.user = DoctorUser.objects.get(pk=user_id) try: data = { "id": str(request.user.id), "fullname": str(request.user.fullname), "username": str(request.user.username), "email": str(request.user.email), "phone_number": str(request.user.phone_number), "license_image": str(request.user.license_image), "avatar": str(request.user.avatar), "profession": str(request.user.profession), "experience": str(request.user.experience), "price": str(request.user.price), "company": str(request.user.company), "address": str(request.user.address), "is_active": str(request.user.is_active), } return response.Response(data, status=200) except Exception: return response.Response("Login does not succeded", status=401)
43.214876
126
0.673934
528
5,229
6.507576
0.282197
0.054424
0.052969
0.030268
0.1461
0.103027
0.075378
0.052387
0.029686
0.029686
0
0.00621
0.230063
5,229
121
127
43.214876
0.847243
0
0
0.142857
0
0
0.086807
0
0
0
0
0
0
1
0.066667
false
0.114286
0.142857
0.019048
0.514286
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
2
fa79e9f429253026bc9c0f924d862a6178140da0
1,156
py
Python
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/common/djangoapps/util/monitoring.py
osoco/better-ways-of-thinking-about-software
83e70d23c873509e22362a09a10d3510e10f6992
[ "MIT" ]
3
2021-12-15T04:58:18.000Z
2022-02-06T12:15:37.000Z
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/common/djangoapps/util/monitoring.py
osoco/better-ways-of-thinking-about-software
83e70d23c873509e22362a09a10d3510e10f6992
[ "MIT" ]
null
null
null
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/common/djangoapps/util/monitoring.py
osoco/better-ways-of-thinking-about-software
83e70d23c873509e22362a09a10d3510e10f6992
[ "MIT" ]
1
2019-01-02T14:38:50.000Z
2019-01-02T14:38:50.000Z
"""Helper methods for monitoring of events.""" from edx_django_utils.monitoring import set_custom_attribute, set_custom_attributes_for_course_key def monitor_import_failure(course_key, import_step, message=None, exception=None): """ Helper method to add custom parameters to for import failures. Arguments: course_key: CourseKey object import_step (str): current step in course import message (str): any particular message to add exception: Exception object """ set_custom_attribute('course_import_failure', import_step) set_custom_attributes_for_course_key(course_key) if message: set_custom_attribute('course_import_failure_message', message) if exception is not None: exception_module = getattr(exception, '__module__', '') separator = '.' if exception_module else '' module_and_class = f'{exception_module}{separator}{exception.__class__.__name__}' exc_message = str(exception) set_custom_attribute('course_import_failure_error_class', module_and_class) set_custom_attribute('course_import_failure_error_message', exc_message)
41.285714
98
0.745675
142
1,156
5.619718
0.352113
0.078947
0.112782
0.120301
0.275689
0.275689
0.105263
0
0
0
0
0
0.179931
1,156
27
99
42.814815
0.841772
0.24308
0
0
0
0
0.22542
0.21223
0
0
0
0
0
1
0.076923
false
0
0.461538
0
0.538462
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
fa7c044effd2fd98d0d77b1344bdf8fa952165a5
482
py
Python
day-02/python/part2.py
kayew/aoc-2020
55ea804c983aef4d3a7e159403247ec23a47aa10
[ "MIT" ]
null
null
null
day-02/python/part2.py
kayew/aoc-2020
55ea804c983aef4d3a7e159403247ec23a47aa10
[ "MIT" ]
null
null
null
day-02/python/part2.py
kayew/aoc-2020
55ea804c983aef4d3a7e159403247ec23a47aa10
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 import sys file = open(sys.argv[1], "r") total = 0 for line in file: letterMatch = 0 param = line.split() passIndex = [int(x) for x in param[0].split('-')] targetLetter = param[1][0] password = param[2] if password[passIndex[0]-1] == targetLetter: letterMatch += 1 if password[passIndex[1]-1] == targetLetter: letterMatch += 1 if letterMatch == 1: total += 1 file.close() print(f"total: {total}")
19.28
53
0.591286
66
482
4.318182
0.439394
0.126316
0.133333
0.175439
0.189474
0
0
0
0
0
0
0.044199
0.248963
482
24
54
20.083333
0.743094
0.043568
0
0.117647
0
0
0.034783
0
0
0
0
0
0
1
0
false
0.235294
0.058824
0
0.058824
0.058824
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
fa98db342baff8386700db039d9f97d991e6637e
2,648
py
Python
tests/conftest.py
Peter-Metz/taxdata
ee4d401979f48bbbe392bbfba1b571233fec3495
[ "CC0-1.0" ]
null
null
null
tests/conftest.py
Peter-Metz/taxdata
ee4d401979f48bbbe392bbfba1b571233fec3495
[ "CC0-1.0" ]
null
null
null
tests/conftest.py
Peter-Metz/taxdata
ee4d401979f48bbbe392bbfba1b571233fec3495
[ "CC0-1.0" ]
null
null
null
import os import json import pytest import pandas as pd # TODO: revise the following constants when using new or revised CPS/PUF data CPS_START_YEAR = 2014 PUF_START_YEAR = 2011 PUF_COUNT = 248591 LAST_YEAR = 2027 @pytest.fixture(scope='session') def test_path(): return os.path.abspath(os.path.dirname(__file__)) @pytest.fixture(scope='session') def growfactors(test_path): gf_path = os.path.join(test_path, '../puf_stage1/growfactors.csv') return pd.read_csv(gf_path, index_col='YEAR') @pytest.fixture(scope='session') def metadata(test_path): md_path = os.path.join(test_path, 'records_metadata.json') with open(md_path, 'r') as mdf: return json.load(mdf) @pytest.fixture(scope='session') def cps(test_path): cps_path = os.path.join(test_path, '../cps_data/cps.csv.gz') return pd.read_csv(cps_path) @pytest.fixture(scope='session') def cps_count(test_path): cps_path = os.path.join(test_path, '../cps_data/cps.csv.gz') cps_df = pd.read_csv(cps_path) return cps_df.shape[0] @pytest.fixture(scope='session') def cps_start_year(): return CPS_START_YEAR @pytest.fixture(scope='session') def puf_path(test_path): return os.path.join(test_path, '../puf_data/puf.csv') @pytest.fixture(scope='session') def puf(puf_path): if os.path.isfile(puf_path): return pd.read_csv(puf_path) else: return None @pytest.fixture(scope='session') def puf_count(puf_path): if os.path.isfile(puf_path): puf_df = pd.read_csv(puf_path) count = puf_df.shape[0] if count != PUF_COUNT: msg = 'puf.shape[0] = {} not equal to PUF_COUNT = {}' raise ValueError(msg.format(count, PUF_COUNT)) else: count = PUF_COUNT return count @pytest.fixture(scope='session') def puf_start_year(): return PUF_START_YEAR @pytest.fixture(scope='session') def last_year(): return LAST_YEAR @pytest.fixture(scope='session') def cps_weights(test_path): cpsw_path = os.path.join(test_path, '../cps_stage2/cps_weights.csv.gz') return pd.read_csv(cpsw_path) @pytest.fixture(scope='session') def puf_weights(test_path): pufw_path = os.path.join(test_path, '../puf_stage2/puf_weights.csv.gz') return pd.read_csv(pufw_path) @pytest.fixture(scope='session') def cps_ratios(test_path): # cpsr_path = os.path.join(test_path, '../cps_stage3/cps_ratios.csv') # return pd.read_csv(cpsr_path, index_col=0) return None @pytest.fixture(scope='session') def puf_ratios(test_path): pufr_path = os.path.join(test_path, '../puf_stage3/puf_ratios.csv') return pd.read_csv(pufr_path, index_col=0)
24.293578
77
0.702795
415
2,648
4.240964
0.185542
0.086364
0.153409
0.213068
0.597159
0.506818
0.316477
0.132955
0.054545
0.054545
0
0.01255
0.157477
2,648
108
78
24.518519
0.776333
0.070242
0
0.315068
0
0
0.146461
0.075671
0
0
0
0.009259
0
1
0.205479
false
0
0.054795
0.082192
0.479452
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
fa9a48ce8dbd9143921b6d9a6aaa68457aed7d58
3,353
py
Python
sixx/plugins/utils/converters.py
TildeBeta/6X
1814eb8f394b7c25b49decdd7d7249567c85f30f
[ "MIT" ]
2
2018-03-06T20:39:49.000Z
2018-03-17T04:28:57.000Z
sixx/plugins/utils/converters.py
TildeBeta/TwitterImages
1814eb8f394b7c25b49decdd7d7249567c85f30f
[ "MIT" ]
2
2018-03-06T20:39:46.000Z
2018-03-15T17:03:03.000Z
sixx/plugins/utils/converters.py
TildeBeta/TwitterImages
1814eb8f394b7c25b49decdd7d7249567c85f30f
[ "MIT" ]
1
2018-04-25T22:24:40.000Z
2018-04-25T22:24:40.000Z
from math import sqrt import re from curious.commands import Context from curious.commands.exc import ConversionFailedError from typing import Tuple colour_pattern = re.compile(r'(#|0x)?([A-Za-z0-9]{1,6})') RGB = Tuple[int, int, int] class Colour: """ A class that represents a colour. """ def __init__(self, value: int): self.value = value def _get_part(self, part) -> int: string = f'{self.value:06x}' piece = slice(part * 2, part * 2 + 2) return int(string[piece], base=16) @property def red(self) -> int: return self._get_part(0) r = red @property def green(self) -> int: return self._get_part(1) g = green @property def blue(self) -> int: return self._get_part(2) b = blue @property def rgb(self) -> RGB: return self.r, self.g, self.b def distance(self, other: 'Colour'): # Taken from some wikipedia article I'm too lazy to dig it up r1, g1, b1 = self.rgb r2, g2, b2 = other.rgb return sqrt((r2 - r1) ** 2 + (g2 - g1) ** 2 + (b2 - b1) ** 2) def luminance(self) -> float: """ Calculate the luminance of the colour. Based on information from https://www.w3.org/TR/WCAG20-TECHS/G18.html """ def convert(value): value /= 255 if value <= 0.03928: return value / 12.92 else: return ((value + 0.055) / 1.055) ** 2.4 r, g, b = map(convert, self.rgb) return r * 0.2126 + g * 0.7152 + b * 0.0722 def contrast(self, other: 'Colour'): """ Calculate the contrast between two colours. Based on information from https://www.w3.org/TR/WCAG20-TECHS/G18.html """ # TODO make x.contrast(y) the same as y.contrast(x) instead of x/y y/x return (self.luminance() + 0.05) / (other.luminance() + 0.05) def __repr__(self): return '{0.__class__.__name__}({0.value})'.format(self) def __str__(self): return f'#{self.value:06x}' def __eq__(self, other): return self.value == other.value def __hash__(self): return hash(self.value) def convert_hex_colour(annotation, ctx: Context, arg: str) -> Colour: """ Converts a string representation of a hex colour into an instance of Colour. """ arg = colour_pattern.sub(r'\2', arg) try: value = int(arg, base=16) except ValueError: raise ConversionFailedError(ctx, arg, annotation, 'Invalid value.') else: return annotation(value) class RGBPart: """ Represents a hex value that is in the unsigned char range. """ pass def valid_unsigned_char(annotation, ctx: Context, arg: str): """ Checks if given input is a number in the domain [0, 255]. 255 = 0xFF, which is the largest value for any component of an RGB(A) number. """ try: value = int(arg) except ValueError: raise ConversionFailedError(ctx, arg, annotation, 'Invalid number.') else: if not 0 <= value <= 255: raise ConversionFailedError(ctx, arg, annotation, 'Value must be within range (0 - 255)') return value Context.add_converter(Colour, convert_hex_colour) Context.add_converter(RGBPart, valid_unsigned_char)
25.022388
101
0.593498
458
3,353
4.240175
0.344978
0.027806
0.020082
0.026262
0.209063
0.160659
0.123584
0.123584
0.056643
0.056643
0
0.044676
0.285714
3,353
133
102
25.210526
0.76618
0.197137
0
0.150685
0
0
0.066303
0.022621
0
0
0
0.007519
0
1
0.219178
false
0.013699
0.068493
0.109589
0.575342
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
2
fa9b854e0bf31a77452586413b7c4fd1b1f19d69
85
py
Python
tests/plugins/tool/docformatter_tool_plugin/valid_package/wrong.py
kogut/statick
6cbe43b5ac78275a12af3ac5aa325833368d0767
[ "CC0-1.0" ]
54
2018-08-27T19:12:41.000Z
2022-03-31T04:16:40.000Z
tests/plugins/tool/docformatter_tool_plugin/valid_package/wrong.py
gregtkogut/statick
11a8f950d50b52903a25f4f00c7cd52a90eff56c
[ "CC0-1.0" ]
288
2018-08-28T13:17:44.000Z
2022-03-21T20:05:19.000Z
tests/plugins/tool/docformatter_tool_plugin/valid_package/wrong.py
gregtkogut/statick
11a8f950d50b52903a25f4f00c7cd52a90eff56c
[ "CC0-1.0" ]
12
2018-08-28T13:18:39.000Z
2022-03-21T19:27:16.000Z
''' Docstring with single quotes instead of double quotes. ''' my_str = "not an int"
17
54
0.705882
13
85
4.538462
0.923077
0
0
0
0
0
0
0
0
0
0
0
0.176471
85
4
55
21.25
0.842857
0.635294
0
0
0
0
0.434783
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
fa9fe5acc3c1efc2638d84976321625ca2613512
3,299
py
Python
src/scs_core/data/histogram.py
seoss/scs_core
0d4323c5697a39eb44a887f179ba5dca3716c1d2
[ "MIT" ]
null
null
null
src/scs_core/data/histogram.py
seoss/scs_core
0d4323c5697a39eb44a887f179ba5dca3716c1d2
[ "MIT" ]
null
null
null
src/scs_core/data/histogram.py
seoss/scs_core
0d4323c5697a39eb44a887f179ba5dca3716c1d2
[ "MIT" ]
null
null
null
""" Created on 9 Aug 2016 @author: Bruno Beloff (bruno.beloff@southcoastscience.com) """ import _csv import sys # -------------------------------------------------------------------------------------------------------------------- class Histogram(object): """ classdocs """ __HEADER_BIN = ".bin" __HEADER_COUNT = ".count" # ---------------------------------------------------------------------------------------------------------------- def __init__(self, minimum, maximum, bin_count, path): """ Constructor """ self.__minimum = minimum self.__maximum = maximum self.__bin_count = bin_count self.__path = path self.__counts = [0] * bin_count self.__max_count = int(0) self.__delta = (maximum - minimum) / bin_count def __len__(self): return self.__bin_count # ---------------------------------------------------------------------------------------------------------------- def append(self, datum): # reject out-of-range if datum < self.__minimum or datum > self.__maximum: raise ValueError("datum out of range:%f" % datum) # compute index... offset = datum - self.__minimum index = int(offset // self.__delta) # update counts... self.__counts[index] += 1 if self.__counts[index] > self.__max_count: self.__max_count = int(self.__counts[index]) return index, self.__counts[index] def to_csv(self, filename=None): file = sys.stdout if filename is None else open(filename, "w") writer = _csv.writer(file) writer.writerow((self.__path + Histogram.__HEADER_BIN, self.__path + Histogram.__HEADER_COUNT)) for i in range(self.bin_count): writer.writerow((format(self.__bin(i), '.6f'), self.__counts[i])) if filename is not None: file.close() # ---------------------------------------------------------------------------------------------------------------- @property def bins(self): return [self.__bin(i) for i in range(self.__bin_count)] @property def minimum(self): return self.__minimum @property def maximum(self): return self.__maximum @property def bin_count(self): return self.__bin_count @property def path(self): return self.__path @property def delta(self): return self.__delta @property def max_count(self): return self.__max_count @property def counts(self): return self.__counts # ---------------------------------------------------------------------------------------------------------------- def __bin(self, index): return self.__minimum + (index * self.__delta) # ---------------------------------------------------------------------------------------------------------------- def __str__(self, *args, **kwargs): return "Histogram:{minimum:%0.6f, maximum:%0.6f, bin_count:%d, delta:%0.6f, max_count:%d, counts:%s, " \ "path:%s}" % \ (self.minimum, self.maximum, self.bin_count, self.delta, self.max_count, self.counts, self.path)
24.992424
118
0.461352
309
3,299
4.556634
0.242718
0.068182
0.089489
0.036222
0.107955
0.03267
0.03267
0
0
0
0
0.006002
0.242498
3,299
131
119
25.183206
0.557423
0.254623
0
0.15873
0
0.015873
0.056549
0.010395
0
0
0
0
0
1
0.222222
false
0
0.031746
0.174603
0.492063
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
2
faaad1e0a17c9ccfde15b59721ef3b9545cff063
871
py
Python
tests/test_vera.py
j-faria/vera
96cbdb61c98c3527416611155b29a03a2bc66b15
[ "MIT" ]
null
null
null
tests/test_vera.py
j-faria/vera
96cbdb61c98c3527416611155b29a03a2bc66b15
[ "MIT" ]
null
null
null
tests/test_vera.py
j-faria/vera
96cbdb61c98c3527416611155b29a03a2bc66b15
[ "MIT" ]
null
null
null
# import pytest def test_imports(): import vera from vera import RV def test_dace(): from vera.query_dace import get_observations _ = get_observations('HD10180', verbose=False) def test_read_rdb(): from vera import RV from os.path import dirname, join here = dirname(__file__) s = RV(join(here, 'data_file.rdb'), star='dummy', sigmaclip=False) print(s) def test_DACE(): from vera import DACE s = DACE.HD10180 print(s) def test_KOBE(capsys): from vera import KOBE # not in target list _ = KOBE.HD100 cap = capsys.readouterr() assert cap.out == 'Cannot find "HD100" in KOBE target list.\n' # no access to data s = KOBE.KOBE_001 assert s is None def test_plot(): import matplotlib.pyplot as plt from vera import DACE s = DACE.HD10180 s.plot() plt.close('all')
18.531915
70
0.652124
128
871
4.296875
0.4375
0.076364
0.127273
0.058182
0.163636
0.109091
0.109091
0
0
0
0
0.036866
0.252583
871
46
71
18.934783
0.807988
0.057405
0
0.275862
0
0
0.085679
0
0
0
0
0
0.068966
1
0.206897
false
0
0.344828
0
0.551724
0.068966
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
0
0
0
0
2
fabe4605f255d398162a6669d4a99f004a58a723
6,380
py
Python
qchem/tests/test_two_particle.py
theRoughCode/pennylane
317f82ef00c752beeef7d2412b88119a753467b4
[ "Apache-2.0" ]
1
2020-10-15T01:09:27.000Z
2020-10-15T01:09:27.000Z
qchem/tests/test_two_particle.py
theRoughCode/pennylane
317f82ef00c752beeef7d2412b88119a753467b4
[ "Apache-2.0" ]
1
2020-10-04T22:45:45.000Z
2020-10-04T22:45:45.000Z
qchem/tests/test_two_particle.py
theRoughCode/pennylane
317f82ef00c752beeef7d2412b88119a753467b4
[ "Apache-2.0" ]
null
null
null
import os import numpy as np import pytest from pennylane import qchem from openfermion.hamiltonians import MolecularData ref_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "test_ref_files") table_1 = np.array( [ [0.0, 0.0, 0.0, 0.0, 0.68238953], [0.0, 1.0, 1.0, 0.0, 0.68238953], [1.0, 0.0, 0.0, 1.0, 0.68238953], [1.0, 1.0, 1.0, 1.0, 0.68238953], [0.0, 0.0, 2.0, 2.0, 0.17900058], [0.0, 1.0, 3.0, 2.0, 0.17900058], [1.0, 0.0, 2.0, 3.0, 0.17900058], [1.0, 1.0, 3.0, 3.0, 0.17900058], [0.0, 2.0, 0.0, 2.0, 0.17900058], [0.0, 3.0, 1.0, 2.0, 0.17900058], [1.0, 2.0, 0.0, 3.0, 0.17900058], [1.0, 3.0, 1.0, 3.0, 0.17900058], [0.0, 2.0, 2.0, 0.0, 0.67073278], [0.0, 3.0, 3.0, 0.0, 0.67073278], [1.0, 2.0, 2.0, 1.0, 0.67073278], [1.0, 3.0, 3.0, 1.0, 0.67073278], [2.0, 0.0, 0.0, 2.0, 0.67073278], [2.0, 1.0, 1.0, 2.0, 0.67073278], [3.0, 0.0, 0.0, 3.0, 0.67073278], [3.0, 1.0, 1.0, 3.0, 0.67073278], [2.0, 0.0, 2.0, 0.0, 0.17900058], [2.0, 1.0, 3.0, 0.0, 0.17900058], [3.0, 0.0, 2.0, 1.0, 0.17900058], [3.0, 1.0, 3.0, 1.0, 0.17900058], [2.0, 2.0, 0.0, 0.0, 0.17900058], [2.0, 3.0, 1.0, 0.0, 0.17900058], [3.0, 2.0, 0.0, 1.0, 0.17900058], [3.0, 3.0, 1.0, 1.0, 0.17900058], [2.0, 2.0, 2.0, 2.0, 0.70510563], [2.0, 3.0, 3.0, 2.0, 0.70510563], [3.0, 2.0, 2.0, 3.0, 0.70510563], [3.0, 3.0, 3.0, 3.0, 0.70510563], ] ) table_2 = np.array( [ [0.0, 0.0, 0.0, 0.0, 0.70510563], [0.0, 1.0, 1.0, 0.0, 0.70510563], [1.0, 0.0, 0.0, 1.0, 0.70510563], [1.0, 1.0, 1.0, 1.0, 0.70510563], ] ) table_3 = np.array( [ [0.0, 0.0, 0.0, 0.0, 0.48731097], [0.0, 1.0, 1.0, 0.0, 0.48731097], [1.0, 0.0, 0.0, 1.0, 0.48731097], [1.0, 1.0, 1.0, 1.0, 0.48731097], [0.0, 0.0, 0.0, 2.0, -0.04857958], [0.0, 1.0, 1.0, 2.0, -0.04857958], [1.0, 0.0, 0.0, 3.0, -0.04857958], [1.0, 1.0, 1.0, 3.0, -0.04857958], [0.0, 0.0, 2.0, 0.0, -0.04857958], [0.0, 1.0, 3.0, 0.0, -0.04857958], [1.0, 0.0, 2.0, 1.0, -0.04857958], [1.0, 1.0, 3.0, 1.0, -0.04857958], [0.0, 0.0, 2.0, 2.0, 0.01306398], [0.0, 1.0, 3.0, 2.0, 0.01306398], [1.0, 0.0, 2.0, 3.0, 0.01306398], [1.0, 1.0, 3.0, 3.0, 0.01306398], [0.0, 2.0, 0.0, 0.0, -0.04857958], [0.0, 3.0, 1.0, 0.0, -0.04857958], [1.0, 2.0, 0.0, 1.0, -0.04857958], [1.0, 3.0, 1.0, 1.0, -0.04857958], [0.0, 2.0, 0.0, 2.0, 0.01306398], [0.0, 3.0, 1.0, 2.0, 0.01306398], [1.0, 2.0, 0.0, 3.0, 0.01306398], [1.0, 3.0, 1.0, 3.0, 0.01306398], [0.0, 2.0, 2.0, 0.0, 0.22361004], [0.0, 3.0, 3.0, 0.0, 0.22361004], [1.0, 2.0, 2.0, 1.0, 0.22361004], [1.0, 3.0, 3.0, 1.0, 0.22361004], [0.0, 2.0, 2.0, 2.0, 0.00748417], [0.0, 3.0, 3.0, 2.0, 0.00748417], [1.0, 2.0, 2.0, 3.0, 0.00748417], [1.0, 3.0, 3.0, 3.0, 0.00748417], [2.0, 0.0, 0.0, 0.0, -0.04857958], [2.0, 1.0, 1.0, 0.0, -0.04857958], [3.0, 0.0, 0.0, 1.0, -0.04857958], [3.0, 1.0, 1.0, 1.0, -0.04857958], [2.0, 0.0, 0.0, 2.0, 0.22361004], [2.0, 1.0, 1.0, 2.0, 0.22361004], [3.0, 0.0, 0.0, 3.0, 0.22361004], [3.0, 1.0, 1.0, 3.0, 0.22361004], [2.0, 0.0, 2.0, 0.0, 0.01306398], [2.0, 1.0, 3.0, 0.0, 0.01306398], [3.0, 0.0, 2.0, 1.0, 0.01306398], [3.0, 1.0, 3.0, 1.0, 0.01306398], [2.0, 0.0, 2.0, 2.0, 0.00748417], [2.0, 1.0, 3.0, 2.0, 0.00748417], [3.0, 0.0, 2.0, 3.0, 0.00748417], [3.0, 1.0, 3.0, 3.0, 0.00748417], [2.0, 2.0, 0.0, 0.0, 0.01306398], [2.0, 3.0, 1.0, 0.0, 0.01306398], [3.0, 2.0, 0.0, 1.0, 0.01306398], [3.0, 3.0, 1.0, 1.0, 0.01306398], [2.0, 2.0, 0.0, 2.0, 0.00748417], [2.0, 3.0, 1.0, 2.0, 0.00748417], [3.0, 2.0, 0.0, 3.0, 0.00748417], [3.0, 3.0, 1.0, 3.0, 0.00748417], [2.0, 2.0, 2.0, 0.0, 0.00748417], [2.0, 3.0, 3.0, 0.0, 0.00748417], [3.0, 2.0, 2.0, 1.0, 0.00748417], [3.0, 3.0, 3.0, 1.0, 0.00748417], [2.0, 2.0, 2.0, 2.0, 0.33788228], [2.0, 3.0, 3.0, 2.0, 0.33788228], [3.0, 2.0, 2.0, 3.0, 0.33788228], [3.0, 3.0, 3.0, 3.0, 0.33788228], ] ) @pytest.mark.parametrize( ("name", "core", "active", "table_exp", "v_core_exp"), [ ("h2_pyscf", None, None, table_1, 0), ("h2_pyscf", [0], None, table_2, 0.6823895331520422), ("h2_pyscf", None, [0, 1], table_1, 0), ("h2_pyscf", [0], [1], table_2, 0.6823895331520422), ("lih", [0], [1, 2], table_3, 1.6585666870874103), ], ) def test_table_two_particle(name, core, active, table_exp, v_core_exp, tol): r"""Test the table of two-particle matrix elements and the contribution of core orbitals as implemented in the `two_particle` function of the `obs` module""" hf_data = MolecularData(filename=os.path.join(ref_dir, name)) table, v_core = qchem.two_particle(hf_data.two_body_integrals, core=core, active=active) assert np.allclose(table, table_exp, **tol) assert np.allclose(v_core, v_core_exp, **tol) v_me_1D = np.array([1, 2, 3, 4]) v_me_4D = np.full((2, 2, 2, 2), 0.5) @pytest.mark.parametrize( ("v_me", "core", "active", "msg_match"), [ (v_me_1D, [0], None, "'matrix_elements' must be a 4D array"), (v_me_4D, [-1, 0, 1, 2], None, "Indices of core orbitals must be between 0 and"), (v_me_4D, [0, 1, 2, 3], None, "Indices of core orbitals must be between 0 and"), (v_me_4D, None, [-1, 0], "Indices of active orbitals must be between 0 and"), (v_me_4D, None, [2, 6], "Indices of active orbitals must be between 0 and"), ], ) def test_exceptions_two_particle(v_me, core, active, msg_match): """Test that the function `'two_particle'` throws an exception if the dimension of the matrix elements array is not a 4D array or if the indices of core and/or active orbitals are out of range.""" with pytest.raises(ValueError, match=msg_match): qchem.two_particle(v_me, core=core, active=active)
37.529412
92
0.487461
1,343
6,380
2.266567
0.077439
0.185283
0.130092
0.098555
0.679698
0.580815
0.554534
0.406045
0.31406
0.059133
0
0.390291
0.273511
6,380
169
93
37.751479
0.266451
0.053448
0
0.026846
0
0
0.054688
0
0
0
0
0
0.013423
1
0.013423
false
0
0.033557
0
0.04698
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
fade8de862f192db4db57a6e8e338b8eea806aa8
1,628
py
Python
tests/prosperpy/overlays/test_bollinger_bands.py
CaptainBriot/prosperpy
831abb9c9e3b730c81895647e33a59854c4e4648
[ "MIT" ]
2
2018-01-28T06:11:37.000Z
2018-02-04T16:01:30.000Z
tests/prosperpy/overlays/test_bollinger_bands.py
CaptainBriot/prosperpy
831abb9c9e3b730c81895647e33a59854c4e4648
[ "MIT" ]
1
2018-03-20T12:10:40.000Z
2018-03-21T00:08:04.000Z
tests/prosperpy/overlays/test_bollinger_bands.py
CaptainBriot/prosperpy
831abb9c9e3b730c81895647e33a59854c4e4648
[ "MIT" ]
2
2019-04-06T14:33:26.000Z
2020-06-25T23:34:32.000Z
import unittest import decimal import prosperpy def get_prices(): prices = ['90.704', '92.900', '92.978', '91.802', '92.665', '92.684', '92.302', '92.773', '92.537', '92.949', '93.204', '91.067', '89.832', '89.744', '90.399', '90.739', '88.018', '88.087', '88.844', '90.778', '90.542', '91.389', '90.650'] return [decimal.Decimal(price) for price in prices] class TestSimpleMovingAverage(unittest.TestCase): def test_simple_moving_average(self): prices = get_prices() data = [('91.2422', '94.53214587189516', '87.95225412810484', '6.57989174379032'), ('91.16665', '94.36908071900080', '87.96421928099920', '6.40486143800160'), ('91.05025', '94.14840337741694', '87.95209662258306', '6.19630675483388')] data = [(decimal.Decimal(item[0]), decimal.Decimal(item[1]), decimal.Decimal(item[2])) for item in data] bollinger_bands = prosperpy.overlays.BollingerBands(prices[:20]) self.assertEqual(bollinger_bands.moving_average.value, decimal.Decimal('91.2503')) self.assertEqual(bollinger_bands.upper, decimal.Decimal('94.53410225348604')) self.assertEqual(bollinger_bands.lower, decimal.Decimal('87.96649774651396')) self.assertEqual(bollinger_bands.bandwidth, decimal.Decimal('6.56760450697208')) for price, value in zip(prices[20:], data): bollinger_bands.add(price) self.assertEqual(bollinger_bands.moving_average.value, value[0]) self.assertEqual(bollinger_bands.upper, value[1]) self.assertEqual(bollinger_bands.lower, value[2])
49.333333
113
0.651106
199
1,628
5.246231
0.422111
0.12069
0.16092
0.194444
0.220307
0.090038
0.090038
0
0
0
0
0.253743
0.179361
1,628
32
114
50.875
0.527695
0
0
0
0
0
0.226044
0
0
0
0
0
0.28
1
0.08
false
0
0.12
0
0.28
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
faedb7593b3fda8461621c6c98b5de97e2ad88e0
1,064
py
Python
test/integration/test_natural_language_understanding_v1.py
jsstylos/waston-developer-cloud-python-sdk
97de097b8c86622ab2f30f5386bb74321d28addf
[ "Apache-2.0" ]
1,579
2015-10-08T14:02:17.000Z
2022-02-28T10:49:21.000Z
test/integration/test_natural_language_understanding_v1.py
jsstylos/waston-developer-cloud-python-sdk
97de097b8c86622ab2f30f5386bb74321d28addf
[ "Apache-2.0" ]
749
2015-10-08T20:00:24.000Z
2022-03-21T21:33:17.000Z
test/integration/test_natural_language_understanding_v1.py
jsstylos/waston-developer-cloud-python-sdk
97de097b8c86622ab2f30f5386bb74321d28addf
[ "Apache-2.0" ]
1,006
2015-10-24T06:30:58.000Z
2022-03-23T07:10:04.000Z
# coding: utf-8 from unittest import TestCase import os import ibm_watson import pytest import json import time from ibm_watson.natural_language_understanding_v1 import Features, EntitiesOptions, KeywordsOptions @pytest.mark.skipif(os.getenv('NATURAL_LANGUAGE_UNDERSTANDING_APIKEY') is None, reason='requires NATURAL_LANGUAGE_UNDERSTANDING_APIKEY') class TestNaturalLanguageUnderstandingV1(TestCase): def setUp(self): self.natural_language_understanding = ibm_watson.NaturalLanguageUnderstandingV1(version='2018-03-16') self.natural_language_understanding.set_default_headers({ 'X-Watson-Learning-Opt-Out': '1', 'X-Watson-Test': '1' }) def test_analyze(self): response = self.natural_language_understanding.analyze( text='Bruce Banner is the Hulk and Bruce Wayne is BATMAN! ' 'Superman fears not Banner, but Wayne.', features=Features(entities=EntitiesOptions(), keywords=KeywordsOptions())).get_result() assert response is not None
39.407407
109
0.727444
120
1,064
6.266667
0.55
0.119681
0.223404
0.12766
0
0
0
0
0
0
0
0.016222
0.18891
1,064
26
110
40.923077
0.855156
0.012218
0
0
0
0
0.21163
0.094376
0
0
0
0
0.045455
1
0.090909
false
0
0.318182
0
0.454545
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
fafb8734f2572ef0c2b5074b37edc6e0b8a53374
1,070
py
Python
test_credentialData.py
mireille1999/Credential-Locker
fc7e8c9035a3d89c889ab7db603eec4ec3d62522
[ "Unlicense" ]
null
null
null
test_credentialData.py
mireille1999/Credential-Locker
fc7e8c9035a3d89c889ab7db603eec4ec3d62522
[ "Unlicense" ]
null
null
null
test_credentialData.py
mireille1999/Credential-Locker
fc7e8c9035a3d89c889ab7db603eec4ec3d62522
[ "Unlicense" ]
null
null
null
import unittest from credentialData import CredentialData class TestCredentials(unittest.TestCase): def setUp(self): """ setUp method """ self.new_credential = CredentialData("Instagram", "mimi", "mireille") def test_init(self): """ testing initialization """ self.assertEqual(self.new_credential.platform, "Instagram") self.assertEqual(self.new_credential.username, "mimi") self.assertEqual(self.new_credential.password, "mireille") def tearDown(self): CredentialData.credentials = [] def test_save_credential(self): """ test if credential is saved in the credentials list """ self.new_credential.save_credential() self.assertEqual(len(CredentialData.credentials), 1) def test_display_credentials(self): """ test display credentials method """ self.assertEqual(CredentialData.display_credentials(),CredentialData.credentials) if __name__ == '__main__': unittest.main()
26.75
89
0.648598
100
1,070
6.74
0.38
0.051929
0.126113
0.097923
0.142433
0
0
0
0
0
0
0.001244
0.248598
1,070
39
90
27.435897
0.837065
0.111215
0
0
0
0
0.058275
0
0
0
0
0
0.277778
1
0.277778
false
0.055556
0.111111
0
0.444444
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
2
4f0149cb740276e036ceef0f9256600992cdaaba
338
py
Python
timetest.py
schaibo/gpio-
67843aa3869662ad87e9c23914bc0c1ff9f4e2bb
[ "Apache-2.0" ]
null
null
null
timetest.py
schaibo/gpio-
67843aa3869662ad87e9c23914bc0c1ff9f4e2bb
[ "Apache-2.0" ]
null
null
null
timetest.py
schaibo/gpio-
67843aa3869662ad87e9c23914bc0c1ff9f4e2bb
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- """ Created on Sun Jan 26 16:01:59 2014 @author: pi """ import time def delay(i): k=0 for j in range(i): k+=1 n=5000 j=0 a=time.time() i=1 c=time.time() d=c-a print d a=time.time() for i in range(n): j+=1 c=time.time() d=c-a print d a=time.time() delay(n) c=time.time() d=c-a print d
9.941176
35
0.56213
76
338
2.5
0.421053
0.252632
0.142105
0.157895
0.389474
0.389474
0.389474
0.389474
0.294737
0.294737
0
0.085271
0.236686
338
33
36
10.242424
0.651163
0.06213
0
0.521739
0
0
0
0
0
0
0
0
0
0
null
null
0
0.043478
null
null
0.130435
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
1
0
0
0
0
0
0
0
0
2
4f0516d6a42f51c998184fee233eec9bb65f272a
427
py
Python
codewars/7kyu/mohamedashrafamin/Ultimate_Array_Reverser/test_bench.py
mohamedashrafamin/Training_one
11748fdde85cdc9083e2b0bde7519b51a7acfa62
[ "MIT" ]
null
null
null
codewars/7kyu/mohamedashrafamin/Ultimate_Array_Reverser/test_bench.py
mohamedashrafamin/Training_one
11748fdde85cdc9083e2b0bde7519b51a7acfa62
[ "MIT" ]
2
2019-01-22T10:53:42.000Z
2019-01-31T08:02:48.000Z
codewars/7kyu/mohamedashrafamin/Ultimate_Array_Reverser/test_bench.py
mohamedashrafamin/Training_one
11748fdde85cdc9083e2b0bde7519b51a7acfa62
[ "MIT" ]
13
2019-01-22T10:37:42.000Z
2019-01-25T13:30:43.000Z
from main import reverse, reverse1 def test1(benchmark): assert benchmark(reverse, ["I", "like", "big", "butts", "and", "I", "cannot", "lie!"]) == \ ["!", "eilt", "onn", "acIdn", "ast", "t", "ubgibe", "kilI"] def test(benchmark): assert benchmark(reverse1, ["I", "like", "big", "butts", "and", "I", "cannot", "lie!"]) == \ ["!", "eilt", "onn", "acIdn", "ast", "t", "ubgibe", "kilI"] # py.test
32.846154
96
0.508197
49
427
4.428571
0.510204
0.138249
0.221198
0.119816
0.479263
0.479263
0.479263
0.479263
0.479263
0.479263
0
0.008772
0.199063
427
13
97
32.846154
0.625731
0.016393
0
0.285714
0
0
0.257757
0
0
0
0
0
0.285714
1
0.285714
false
0
0.142857
0
0.428571
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
4f06852d79a4234cb404a8d1df2fcff4ed2b0dcb
2,356
py
Python
rodario/registry.py
haliphax/rodario
c31f9a99f80a19cd911edb61e86f4050003dbd90
[ "MIT" ]
4
2015-08-18T16:54:38.000Z
2021-02-21T13:07:08.000Z
rodario/registry.py
haliphax/rodario
c31f9a99f80a19cd911edb61e86f4050003dbd90
[ "MIT" ]
14
2015-08-29T06:04:52.000Z
2017-04-12T17:58:09.000Z
rodario/registry.py
haliphax/rodario
c31f9a99f80a19cd911edb61e86f4050003dbd90
[ "MIT" ]
2
2016-10-14T21:27:54.000Z
2017-05-07T12:59:08.000Z
""" Actor registry for rodario framework """ # local from rodario import get_redis_connection from rodario.exceptions import RegistrationException # pylint: disable=C1001 class _RegistrySingleton(object): """ Singleton for actor registry """ def __init__(self, prefix=None): """ Initialize the registry. :param str prefix: Optional prefix for redis key names """ self._redis = get_redis_connection() self._list = '{prefix}actors'.format(prefix=prefix) @property def actors(self): """ Retrieve a list of registered actors. :rtype: :class:`set` """ return self._redis.smembers(self._list) def register(self, uuid): """ Register a new actor. :param str uuid: The UUID of the actor to register """ if self._redis.sadd(self._list, uuid) == 0: raise RegistrationException('Failed adding member to set') def unregister(self, uuid): """ Unregister an existing actor. :param str uuid: The UUID of the actor to unregister """ self._redis.srem(self._list, uuid) def exists(self, uuid): """ Test whether an actor exists in the registry. :param str uuid: UUID of the actor to check for :rtype: :class:`bool` """ return self._redis.sismember(self._list, uuid) == 1 # pylint: disable=R0201 def get_proxy(self, uuid): """ Return an ActorProxy for the given UUID. :param str uuid: The UUID to return a proxy object for :rtype: :class:`rodario.actors.ActorProxy` """ # avoid cyclic import proxy_module = __import__('rodario.actors', fromlist=('ActorProxy',)) return proxy_module.ActorProxy(uuid=uuid) # pylint: disable=R0903 class Registry(object): """ Actor registry class (singleton wrapper) """ _instance = None def __new__(cls, prefix=None): """ Retrieve the singleton instance for Registry. :param str prefix: Optional prefix for redis key names :rtype: :class:`rodario.registry._RegistrySingleton` """ if not cls._instance: cls._instance = _RegistrySingleton(prefix=prefix) return cls._instance
24.28866
70
0.604414
262
2,356
5.29771
0.305344
0.034582
0.034582
0.032421
0.152017
0.126801
0.126801
0.126801
0.126801
0.126801
0
0.008469
0.298387
2,356
96
71
24.541667
0.831216
0.387521
0
0
0
0
0.055131
0
0
0
0
0
0
1
0.269231
false
0
0.115385
0
0.653846
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
877c7d49d1b9f81b157093af1820422a112322bb
4,069
py
Python
main.py
artin222/Password-generator
7649377b578267b899737b4f7d312bc2b489cc0e
[ "MIT" ]
1
2021-11-20T13:47:27.000Z
2021-11-20T13:47:27.000Z
main.py
artin222/Password-generator
7649377b578267b899737b4f7d312bc2b489cc0e
[ "MIT" ]
null
null
null
main.py
artin222/Password-generator
7649377b578267b899737b4f7d312bc2b489cc0e
[ "MIT" ]
null
null
null
from csv import reader , writer from random import randrange #These are lists of characters that program can use to generate password smlLetters = ["a" , "b" , "c" , "d" , "e" , "f" , "g" , "h" , "i" , "j" , "k" , "l" , "m" , "n" , "o" , "p" , "q" , "r" , "s" , "t" , "u" , "v" , "w" , "x" , "y" , "z"] capLetters = ["A" , "B" , "C" , "D" , "E" , "F" , "G" , "H" , "I" , "J" , "K" , "L" , "M" , "N" , "O" , "P" , "Q" , "R" , "S" , "T" , "U" , "V" , "W" , "X" , "Y" , "Z"] numbers = ["1" , "2" , "3" , "4" , "5" , "6" , "7" , "8" , "9" , "0"] symbols = ["!" , "@" , "#" , "$" , "%"] #genpass function generate password. def genpass(useNumbers , useSymbols , useCapLetters , useSmlLetters , numbers , symbols , capLetters , lenOfPassword , nameOfPassword): #This is password. every time program choose character for password program add character to password string. password = "" #This is list of characters that program can use liOfChars = [] if useNumbers == True: liOfChars.append(numbers) if useSymbols == True: liOfChars.append(symbols) if useCapLetters == True: liOfChars.append(capLetters) if useSmlLetters == True: liOfChars.append(smlLetters) for char in range(lenOfPassword): #choose characters choosingList = liOfChars[(randrange(0 , (liOfChars.index(liOfChars[-1]) + 1)))] choosingChar = choosingList[(randrange(0 , (choosingList.index(choosingList[-1]) + 1)))] password += choosingChar #write password in file.txt with open("./file.csv" , "a") as csvFile: csvReader = reader(csvFile) csvWriter = writer(csvFile) password = [nameOfPassword , password] csvWriter.writerow(password) def boolInput(prompt): inputVal = input(prompt).capitalize().strip() while inputVal != "True" and inputVal != "False": print("Input is not True of False. please write with True of False") inputVal = input(prompt).capitalize().strip() if inputVal == "True": inputVal = True elif inputVal == "False": inputVal = False return inputVal numOfPasswords = input("Please enter how many password you want: ") while not numOfPasswords.isdigit() and not numOfPasswords > 0: print("\n" + "Entered value is not natural number. please enter natural number") numOfPasswords = input("Please enter how many password you want: ") numOfPasswords = int(numOfPasswords) for run in range(numOfPasswords): useNumbers = boolInput("\n" + "Do you want to use numbers? True of False: ") useSymbols = boolInput("Do you want to use symbols? True of False: ") useCapLetters = boolInput("Do you want to use capital letters? True of False: ") useSmlLetters = boolInput("Do you want to use small letters? True of False: ") while useNumbers == False and useSymbols == False and useCapLetters == False and useSmlLetters == False: print("\n" + "\n" + "All of options of password was False. please make one of them True. \n") useNumbers = boolInput("Do you want to use numbers? True of False: ") useSymbols = boolInput("Do you want to use symbols? True of False: ") useCapLetters = boolInput("Do you want to use capital letters? True of False: ") useSmlLetters = boolInput("Do you want to use small letters? True of False: ") nameOfPassword = input("\n" + "What is name of this password? ") while nameOfPassword == "": nameOfPassword = input("You must choose name for password. please enter something: ") lenOfPassword = int(input("\n" + "How much is length of password?(maximum is 4096) ")) while lenOfPassword > 4096 or lenOfPassword < 1: print("\n" + "You entered number that was bigger than 4096 or lower than 1. please enter smaller or bigger number.(maximum is 4096)") lenOfPassword = int(input("How much is length of password?(maximum is 4096) ")) genpass(useNumbers , useSymbols , useCapLetters , useSmlLetters , numbers , symbols , capLetters , lenOfPassword , nameOfPassword)
42.831579
141
0.632834
502
4,069
5.129482
0.294821
0.023301
0.042718
0.034175
0.380971
0.354563
0.328544
0.328544
0.328544
0.258641
0
0.012428
0.228803
4,069
94
142
43.287234
0.808158
0.074711
0
0.15625
1
0.015625
0.282522
0
0
0
0
0
0
1
0.03125
false
0.296875
0.03125
0
0.078125
0.0625
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
8786ee9f99a430b3faffc52d450268f38a85e338
368
py
Python
pythonforandroid/recipes/android/__init__.py
inclement/p4a-experiment
4e120e08cc3c33af89948307628c8b28fdf76b87
[ "MIT" ]
1
2015-06-09T21:12:09.000Z
2015-06-09T21:12:09.000Z
pythonforandroid/recipes/android/__init__.py
inclement/p4a-experiment
4e120e08cc3c33af89948307628c8b28fdf76b87
[ "MIT" ]
null
null
null
pythonforandroid/recipes/android/__init__.py
inclement/p4a-experiment
4e120e08cc3c33af89948307628c8b28fdf76b87
[ "MIT" ]
null
null
null
from pythonforandroid.toolchain import CythonRecipe, shprint, ensure_dir, current_directory, ArchAndroid, IncludedFilesBehaviour import sh from os.path import exists, join class AndroidRecipe(IncludedFilesBehaviour, CythonRecipe): # name = 'android' version = None url = None depends = ['pygame'] src_filename = 'src' recipe = AndroidRecipe()
23
128
0.75
37
368
7.378378
0.783784
0
0
0
0
0
0
0
0
0
0
0
0.171196
368
15
129
24.533333
0.895082
0.043478
0
0
0
0
0.025788
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.888889
0.111111
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
8793f9ea482d0f9374dda4215d86b8945f6bf480
1,709
py
Python
api/tiposrefeicao.py
Guergeiro/bd2-group2
34520e40ef915dc7bb89486ac2322f8994ac9862
[ "MIT" ]
null
null
null
api/tiposrefeicao.py
Guergeiro/bd2-group2
34520e40ef915dc7bb89486ac2322f8994ac9862
[ "MIT" ]
12
2019-11-17T21:22:49.000Z
2020-01-19T18:10:00.000Z
api/tiposrefeicao.py
Guergeiro/bd2-group2
34520e40ef915dc7bb89486ac2322f8994ac9862
[ "MIT" ]
2
2019-11-15T16:47:21.000Z
2019-11-17T13:59:40.000Z
from flask import Blueprint, request import json import databaseutils as utils tiposrefeicao = Blueprint("tiposrefeicao", __name__) tiposrefeicaoColumns = ["cod_tiporefeicao", "designacao"] @tiposrefeicao.route("/api/tiposrefeicao", methods=["GET"]) @tiposrefeicao.route("/api/tiposrefeicao/", methods=["GET"]) def get_tiposrefeicao(): return utils.getAll(tiposrefeicaoColumns, f"SELECT * FROM selecttiposrefeicao();") @tiposrefeicao.route("/api/tiposrefeicao/<cod_TipoRefeicao>", methods=["GET"]) @tiposrefeicao.route("/api/tiposrefeicao/<cod_TipoRefeicao>/", methods=["GET"]) def get_tiporefeicao(cod_TipoRefeicao): return utils.getOne( tiposrefeicaoColumns, f"SELECT * FROM selecttiporefeicao('{cod_TipoRefeicao}');") @tiposrefeicao.route("/api/tiposrefeicao", methods=["POST"]) @tiposrefeicao.route("/api/tiposrefeicao/", methods=["POST"]) def post_tiporefeicao(): return utils.postOne( tiposrefeicaoColumns, f"SELECT * FROM inserttiposrefeicao('{json.dumps(request.json)}');") @tiposrefeicao.route("/api/tiposrefeicao/<cod_TipoRefeicao>", methods=["PUT"]) @tiposrefeicao.route("/api/tiposrefeicao/<cod_TipoRefeicao>/", methods=["PUT"]) def put_tiporefeicao(cod_TipoRefeicao): return utils.putOne( f"CALL updatetiposrefeicao('{cod_TipoRefeicao}', '{json.dumps(request.json)}');" ) @tiposrefeicao.route("/api/tiposrefeicao/<cod_TipoRefeicao>", methods=["DELETE"]) @tiposrefeicao.route("/api/tiposrefeicao/<cod_TipoRefeicao>/", methods=["DELETE"]) def delete_tiporefeicao(cod_TipoRefeicao): return utils.deleteOne(f"CALL deletetiposrefeicao('{cod_TipoRefeicao}');")
37.152174
88
0.715038
162
1,709
7.407407
0.234568
0.1625
0.175
0.283333
0.576667
0.481667
0.333333
0.333333
0.126667
0.126667
0
0
0.128145
1,709
46
89
37.152174
0.805369
0
0
0.117647
0
0
0.383041
0.263743
0
0
0
0
0
1
0.147059
false
0
0.088235
0.147059
0.382353
0.058824
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
0
0
0
2
87a0c198aaf64fb0040e08381e0e0853c27aa4ce
1,483
py
Python
settings.py
vboginskey/cribfinder
fe89717b5ed503a42100069cad966f82b495d7b5
[ "MIT" ]
null
null
null
settings.py
vboginskey/cribfinder
fe89717b5ed503a42100069cad966f82b495d7b5
[ "MIT" ]
null
null
null
settings.py
vboginskey/cribfinder
fe89717b5ed503a42100069cad966f82b495d7b5
[ "MIT" ]
null
null
null
import os CRAIGSLIST_SITE = 'newjersey' CRAIGSLIST_CATEGORY = 'apa' MIN_FT2 = 900 MIN_PRICE = 1500 MAX_PRICE = 3000 MAX_TRANSIT_DISTANCE = 0.75 BOXES = { "Hoboken": [40.734966101, -74.0439891815, 40.7529789172, -74.0192699432], "The Heights": [40.7332100782, -74.0573787689, 40.7615609255, -74.0378093719], "Downtown": [40.7111582926, -74.05626297, 40.7357465407, -74.0299129486], "Journal Square": [40.7131100727, -74.0830850601, 40.7402664072, -74.0509414673] } NEIGHBORHOODS = ["hoboken", "journal square", "heights", "newport", "grove", "downtown", "paulus hook", "powerhouse", "exchange place", "waterfront", "jersey city"] STATIONS = { "9th St light rail": [40.748874, -74.038552], "2nd St light rail": [40.741594, -74.042730], "Newport light rail": [40.726828, -74.036256], "Harsimus Cove light rail": [40.722663, -74.037288], "Harborside light rail": [40.719514, -74.034019], "Exchange Pl light rail": [40.715993, -74.034118], "Essex St light rail": [40.712847, -74.036114], "Marin Blvd light rail": [40.714425, -74.043264], "Jersey Ave light rail": [40.715001, -74.048428], "Exchange Pl PATH": [40.716738, -74.032397], "Grove St PATH": [40.719609, -74.042642], "Newport PATH": [40.726998, -74.033818], "Journal Square PATH": [40.733014, -74.062882], "Hoboken PATH": [40.734937, -74.027545] } SLACK_TOKEN = os.getenv('SLACK_TOKEN', '') SLACK_CHANNEL = '#cribs'
34.488372
84
0.645314
190
1,483
4.984211
0.536842
0.085533
0.104541
0.041183
0
0
0
0
0
0
0
0.352459
0.177343
1,483
42
85
35.309524
0.42377
0
0
0
0
0
0.286581
0
0
0
0
0
0
1
0
false
0
0.029412
0
0.029412
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
87a2ad1b1b371bea7b87cb1eb38aeedd4b3b8d00
210
py
Python
q5.py
fairoz-ahmed/Python_Practice
e498f81fca02f0773f1c6e9f93e5f1cf1f94eb89
[ "MIT" ]
null
null
null
q5.py
fairoz-ahmed/Python_Practice
e498f81fca02f0773f1c6e9f93e5f1cf1f94eb89
[ "MIT" ]
null
null
null
q5.py
fairoz-ahmed/Python_Practice
e498f81fca02f0773f1c6e9f93e5f1cf1f94eb89
[ "MIT" ]
null
null
null
class Input_data(): def __init__(self): self.s='' def getString(self): self.s = input() def printString(self): print(self.s.upper()) strobj=Input_data() strobj.getString() strobj.printString()
21
24
0.67619
28
210
4.857143
0.428571
0.110294
0.132353
0
0
0
0
0
0
0
0
0
0.157143
210
10
25
21
0.768362
0
0
0
0
0
0
0
0
0
0
0
0
1
0.3
false
0
0
0
0.4
0.3
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
0
0
0
0
0
0
0
2
87ae65900773758ea1e8c983d49e6f56cd93b9ec
795
py
Python
clone/views.py
kurian-thomas/neuralcloning
1458aeeaef6be32a11079a66d09fb94feeeba8c1
[ "MIT" ]
9
2018-11-15T16:50:59.000Z
2021-10-05T09:58:36.000Z
clone/views.py
kurian-thomas/neuralcloning
1458aeeaef6be32a11079a66d09fb94feeeba8c1
[ "MIT" ]
null
null
null
clone/views.py
kurian-thomas/neuralcloning
1458aeeaef6be32a11079a66d09fb94feeeba8c1
[ "MIT" ]
6
2018-11-26T05:38:34.000Z
2021-03-30T16:30:21.000Z
from django.shortcuts import render, HttpResponse from django.views.decorators.csrf import csrf_exempt import os import base64 # from .celery_test import test # from clone_script import clone def index(request): return render(request, 'clone/index.html') def results(request): return render(request, 'clone/results.html') def login(request): return render(request, 'clone/login.html') @csrf_exempt def upload(request): if request.method == 'POST': data = request.POST["base64_img"] format, imgstr = data.split(';base64,') ext = '.'+format.split('/')[-1] # print(ext) directory = "STEPS/0" filename = directory + ".jpg" with open(filename, "wb") as fh: fh.write(base64.b64decode(imgstr)) # clone.delay() return HttpResponse("success") return HttpResponse("fail")
25.645161
52
0.719497
105
795
5.4
0.47619
0.068783
0.100529
0.137566
0.164021
0
0
0
0
0
0
0.017518
0.138365
795
31
53
25.645161
0.810219
0.106918
0
0
0
0
0.13881
0
0
0
0
0
0
1
0.181818
false
0
0.181818
0.136364
0.590909
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
2
87b8e5d4a4c403c1e33d8ea9c1529f056cb42aa0
646
py
Python
mapnik_style_generator/utils/PandasMerge.py
sjsafranek/GeoTileServer
4f39ce3b6dc5bd374d4a683fd7a425e950b218f0
[ "MIT" ]
1
2017-09-29T21:30:33.000Z
2017-09-29T21:30:33.000Z
mapnik_style_generator/utils/PandasMerge.py
sjsafranek/go-tileserver
5453186b5c00281588aeba82311bea8ddf8d8ae2
[ "BSD-3-Clause" ]
null
null
null
mapnik_style_generator/utils/PandasMerge.py
sjsafranek/go-tileserver
5453186b5c00281588aeba82311bea8ddf8d8ae2
[ "BSD-3-Clause" ]
null
null
null
#table join #stefan safranek import csv, os, sys, time import pandas as pd start_time = time.time() #start time #File 1 IMPORT_FILE = "Burns_wO_LnLID.csv" SAVE_FILE = IMPORT_FILE.replace('.csv','') + " MATCHED.csv" df1 = pd.read_csv("Burns HD 58.csv", index_col=None, usecols=[0,1,2,4], parse_dates=True) df2 = pd.read_csv(IMPORT_FILE, index_col=None, usecols=[0,1,2], parse_dates=True) df = pd.merge(df1,df2) df.to_csv(SAVE_FILE,on='Voters_StateVoterID',how='right') #df.to_csv(SAVE_FILE,on='Full_Name',how='right') end_time = time.time() run_time = end_time - start_time print run_time #time.sleep(15)
22.275862
90
0.690402
111
646
3.801802
0.459459
0.094787
0.078199
0.090047
0.184834
0.184834
0.104265
0
0
0
0
0.029358
0.156347
646
28
91
23.071429
0.744954
0.157895
0
0
0
0
0.143984
0
0
0
0
0
0
0
null
null
0
0.416667
null
null
0.083333
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
2
87cc1d411068ff6128e0109b9dbc111a69527c35
3,218
py
Python
client/netmgr.py
kendase3/every
83b543c54a2dd071f0a34f128c5baa20a7e58def
[ "BSD-2-Clause" ]
1
2017-06-12T18:36:20.000Z
2017-06-12T18:36:20.000Z
client/netmgr.py
kendase3/every
83b543c54a2dd071f0a34f128c5baa20a7e58def
[ "BSD-2-Clause" ]
null
null
null
client/netmgr.py
kendase3/every
83b543c54a2dd071f0a34f128c5baa20a7e58def
[ "BSD-2-Clause" ]
null
null
null
from twisted.internet import defer, reactor from twisted.protocols import basic from twisted.internet.protocol import Protocol, ReconnectingClientFactory from time import sleep # local import screen import stevent class NetMgr: """ new abstraction: 1) this module receives the latest screen from the server. 2) this module sends all user input in the form of an event list to the server. """ HOST = "localhost" PORT = 50025 LINE_ENDING = "\r\n" #TODO: should eventually prompt for host and port # and remember a list of previously used hosts and ports # (or at least the last one) def __init__(self, host=None): if host == None: host = NetMgr.HOST reactor.connectTCP(host, NetMgr.PORT, IngressClientFactory(self)) reactor.startRunning(False) self.screen = None self.client = None self.quit = False self.failed = False def iterate(self): reactor.iterate() def sendEvents(self, outgoing): if self.client == None: print "No client! =0 " return #TODO: what if an event happens to match '\r\n'? it could happen. for event in outgoing: outBytes = stevent.byte(event) self.client.sendMessage(str(outBytes)) def receiveScreen(self, screenBytes): """ the server has sent us an updated screen object """ self.screen = screen.unbyte(screenBytes) def popScreen(self): """ gets the screen and clears the screen object so we know when we get a new one """ ret = self.screen self.screen = None return ret def hasScreen(self): """ returns whether or not there is a screen update """ if self.screen == None: return False else: return True def cleanup(self): if self.client != None: self.client.transport.loseConnection() #FIXME: should use deferreds and wait exact amount sleep(1) reactor.stop() # allow the stop to actually be processed reactor.iterate() class IngressClient(basic.LineReceiver): def __init__(self, netMgr): self.netMgr = netMgr def lineReceived(self, line): # we assume it is a screen update # and pass it up to netMgr #print "USING LINE MODE!" self.netMgr.receiveScreen(line) def sendMessage(self, line): # send out the message #print "sending|%s|" % (line + NetMgr.LINE_ENDING) #print "\nlen=%d" % len(line + NetMgr.LINE_ENDING) self.transport.write(line + NetMgr.LINE_ENDING) class IngressClientFactory(ReconnectingClientFactory): def __init__(self, netMgr): self.netMgr = netMgr def startedConnecting(self, connector): print 'Started to connect.' def buildProtocol(self, addr): print 'Connected.' print 'Resetting connection delay.' self.resetDelay() ic = IngressClient(self.netMgr) # the latest client is always the correct one self.netMgr.client = ic return ic def clientConnectionLost(self, connector, reason): print 'Lost connection!\n' #print 'Reason: %s' % reason ReconnectingClientFactory.clientConnectionFailed( self, connector, reason) self.netMgr.quit = True def clientConnectionFailed(self, connector, reason): self.netMgr.failed = True print 'Failed to connect to server. Are you sure one is running at %s on port %d?' % (NetMgr.HOST, NetMgr.PORT) self.netMgr.quit = True
25.951613
114
0.711933
436
3,218
5.21789
0.394495
0.043956
0.014505
0.026374
0.076484
0.076484
0.031648
0.031648
0
0
0
0.003467
0.193288
3,218
123
115
26.162602
0.872881
0.175264
0
0.136986
0
0
0.078807
0
0
0
0
0.01626
0
0
null
null
0
0.082192
null
null
0.082192
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
1
0
0
0
0
0
0
0
0
2
87d6924e02630e60ee58f3ea397ba2d39e4eb305
442
py
Python
set_input.py
oinu32/discordpy-startup
9ef948d1811beba71aa44051b23b5a59adac0500
[ "MIT" ]
1
2020-01-09T16:29:25.000Z
2020-01-09T16:29:25.000Z
set_input.py
oinu32/discordpy-startup
9ef948d1811beba71aa44051b23b5a59adac0500
[ "MIT" ]
null
null
null
set_input.py
oinu32/discordpy-startup
9ef948d1811beba71aa44051b23b5a59adac0500
[ "MIT" ]
null
null
null
#AGNET # 該当のチャンネルのID ID_CHANNEL_README = 771383900814573598 #たすきる ID_ROLE_TSKL = 671354476044615680 #たすきる用ちゃんねるID(とつかんり) ID_TSKILL = 624668843444273164 #とつ予定(とつかんり) ID_totu = 739498595329376487 #とつ予定じゃり ID_totu2 = 750321508219355227 #さーばーID ID_SRV = 539773033724772362 #agnet ID_agnet = 549971775828656168 ID_alist = 750236871967244379 #RKME #たすきる用ちゃんねるID ID_Channel_RKME = 795869377882226708 #さーばーID ID_SRV_RKME = 795355793524129823
15.785714
38
0.830317
47
442
7.510638
0.617021
0.050992
0.062323
0
0
0
0
0
0
0
0
0.461735
0.113122
442
27
39
16.37037
0.438776
0.210407
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
87fbec4be50353beb91a6993ffce8b10edc30d98
679
py
Python
cctbx_website/run_tests.py
dwpaley/cctbx_project
476428363d260126319e82aa24d1e79b6474d877
[ "BSD-3-Clause-LBNL" ]
null
null
null
cctbx_website/run_tests.py
dwpaley/cctbx_project
476428363d260126319e82aa24d1e79b6474d877
[ "BSD-3-Clause-LBNL" ]
null
null
null
cctbx_website/run_tests.py
dwpaley/cctbx_project
476428363d260126319e82aa24d1e79b6474d877
[ "BSD-3-Clause-LBNL" ]
null
null
null
from __future__ import absolute_import, division, print_function from libtbx import test_utils import libtbx.load_env #tst_list = [ # "$D/regression/tst_py_from_html.py" # ] tst_list = [ "$D/regression/tst_1_template.py", "$D/regression/tst_2_doc_high_level_objects.py", "$D/regression/tst_3_doc_model_manager.py", "$D/regression/tst_4_doc_data_manager.py", "$D/regression/tst_5_doc_map_manager.py", "$D/regression/tst_6_doc_model_map_manager.py", ] def run(): build_dir = libtbx.env.under_build("cctbx_website") dist_dir = libtbx.env.dist_path("cctbx_website") test_utils.run_tests(build_dir, dist_dir, tst_list) if (__name__ == "__main__"): run()
25.148148
64
0.755523
108
679
4.231481
0.425926
0.16849
0.214442
0.175055
0.242888
0
0
0
0
0
0
0.009934
0.110457
679
26
65
26.115385
0.746689
0.076583
0
0
0
0
0.434295
0.379808
0
0
0
0
0
1
0.058824
false
0
0.176471
0
0.235294
0.058824
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
e20dfc2a207d87cb746506a4b2801706084ee98d
966
py
Python
env/Lib/site-packages/promise/compat.py
nerdyator/graphene-django-cookbook
e19aec7a6e910898558b16e910c7392b0b219390
[ "MIT" ]
2
2019-01-07T07:11:05.000Z
2019-11-10T18:08:40.000Z
env/Lib/site-packages/promise/compat.py
nerdyator/graphene-django-cookbook
e19aec7a6e910898558b16e910c7392b0b219390
[ "MIT" ]
null
null
null
env/Lib/site-packages/promise/compat.py
nerdyator/graphene-django-cookbook
e19aec7a6e910898558b16e910c7392b0b219390
[ "MIT" ]
2
2017-10-18T14:12:35.000Z
2020-03-24T06:01:23.000Z
try: from asyncio import Future, iscoroutine, ensure_future # type: ignore except ImportError: class Future: # type: ignore def __init__(self): raise Exception("You need asyncio for using Futures") def set_result(self): raise Exception("You need asyncio for using Futures") def set_exception(self): raise Exception("You need asyncio for using Futures") def ensure_future(): # type: ignore raise Exception("ensure_future needs asyncio for executing") def iscoroutine(obj): # type: ignore return False try: from Queue import Queue # type: ignore # flake8: noqa except ImportError: from queue import Queue # type: ignore # flake8: noqa try: from .iterate_promise import iterate_promise except (SyntaxError, ImportError): def iterate_promise(promise): raise Exception( 'You need "yield from" syntax for iterate in a Promise.')
28.411765
74
0.668737
116
966
5.465517
0.336207
0.094637
0.107256
0.132492
0.37224
0.37224
0.37224
0.37224
0.246057
0.246057
0
0.002793
0.258799
966
33
75
29.272727
0.882682
0.108696
0
0.333333
0
0
0.231221
0
0
0
0
0
0
1
0.25
false
0
0.291667
0.041667
0.625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
e2151dbd8d042f1a314638218c6335ca02b0727a
513
py
Python
tests/unit/test_models.py
Joel-Milligan/physics-tutor-assignment
9db0b871c947bb19886026c06bcd04cefd852d98
[ "MIT" ]
null
null
null
tests/unit/test_models.py
Joel-Milligan/physics-tutor-assignment
9db0b871c947bb19886026c06bcd04cefd852d98
[ "MIT" ]
null
null
null
tests/unit/test_models.py
Joel-Milligan/physics-tutor-assignment
9db0b871c947bb19886026c06bcd04cefd852d98
[ "MIT" ]
null
null
null
from datetime import datetime from app.models import Assessment, User def test_new_user(): new_user = User('usernam1', 'password', datetime(2020, 1, 1), True) assert new_user.username == 'usernam1' assert new_user.password != 'password' assert new_user.signup_date == datetime(2020, 1, 1) assert new_user.is_admin == True def test_new_assessment(): new_assessment = Assessment('question', '56') assert new_assessment.question == 'question' assert new_assessment.answer == '56'
30.176471
71
0.71345
68
513
5.176471
0.352941
0.119318
0.147727
0.079545
0
0
0
0
0
0
0
0.042254
0.169591
513
16
72
32.0625
0.784038
0
0
0
0
0
0.101365
0
0
0
0
0
0.5
1
0.166667
false
0.166667
0.166667
0
0.333333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
1
0
0
0
0
0
2
357a7c212d64ef469b6cfe0399c8c3f62da9f7bf
7,160
py
Python
app/models.py
nickspeal/net-zero-python-backend
a31139fe8d365abed4f48407a2f407a9b5ac7357
[ "MIT" ]
null
null
null
app/models.py
nickspeal/net-zero-python-backend
a31139fe8d365abed4f48407a2f407a9b5ac7357
[ "MIT" ]
null
null
null
app/models.py
nickspeal/net-zero-python-backend
a31139fe8d365abed4f48407a2f407a9b5ac7357
[ "MIT" ]
null
null
null
from app import db # Junction Tables for many-to-many relationships campaign_users = db.Table('campaign_users', db.Column('campaign', db.Integer, db.ForeignKey('campaigns.id'), primary_key=True), db.Column('user', db.Integer, db.ForeignKey('users.username'), primary_key=True), ) campaign_vehicles = db.Table('campaign_vehicles', db.Column('campaign', db.Integer, db.ForeignKey('campaigns.id'), primary_key=True), db.Column('vehicle', db.Integer, db.ForeignKey('vehicles.id'), primary_key=True), ) class Campaign(db.Model): ''' A Campaign is a context in which to tally a carbon footprint total. For example, a personal total, or an activity shared across multiple people ''' __tablename__ = 'campaigns' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String, unique=True) offsets_available = db.Column(db.Float, nullable=False, default=0.0) users = db.relationship('User', secondary=campaign_users, lazy='subquery', backref=db.backref('campaigns', lazy=True)) vehicles = db.relationship('Vehicle', secondary=campaign_vehicles, lazy='subquery', backref=db.backref('campaigns', lazy=True)) # Other resources # consumptions = TODO m2m relationship to consumptions # offsets = db.relationship('Offset', backref='campaign', lazy=True) def __repr__(self): return '<Campaign {}>'.format(self.name) class User(db.Model): ''' A person with an account ''' __tablename__ = 'users' username = db.Column(db.String, primary_key=True) # campaigns attribute is backreferenced def __repr__(self): return '<User {}>'.format(self.username) class Vehicle(db.Model): ''' A Vehicle is a type of Resource Resources have an increasing counter (i.e. odometer, gas meter) that can be snapshotted over time to measure usage Usage can be converted into CO2 emitted according with some linear factors ''' __tablename__ = 'vehicles' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String, nullable=False) units = db.Column(db.String, nullable=False, default='km') # Should be km for all vehicles for now. This column exists for extensibility to other resources. notes = db.Column(db.String, nullable=True) fuel_l_per_100km = db.Column(db.Float, nullable=False, default=10.6) # Default average car 22 mpg carbon_to_manufacture = db.Column(db.Float, nullable=False, default=10000) # Default wild estimate based on quick search expected_life_km = db.Column(db.Float, nullable=False, default=321868) # Default based on guess of 200k miles def get_carbon_per_unit(self): ''' Calculate the CO2 emission per mile of driving as the sum of contributions of burning gas and deprecating a vehicle that emitted lots of carbon during manufacure Units of kg CO2 per km ''' GAL_PER_L = 0.2641729 CARBON_PER_LITRE = 8.9 * GAL_PER_L # 8.9 kg CO2 per gallon of gas: https://www.epa.gov/greenvehicles/greenhouse-gas-emissions-typical-passenger-vehicle-0 gas_contribution = ( self.fuel_l_per_100km / 100.0 ) * CARBON_PER_LITRE deprecation_contribution = self.carbon_to_manufacture / self.expected_life_km return gas_contribution + deprecation_contribution def __repr__(self): return '<Vehicle {}>'.format(self.id) class ResourceMeasurement(db.Model): ''' This table stores the timeseries of all measurements for all resources (i.e. car odometer readings over time) ''' __tablename__ = 'resource_measurements' id = db.Column(db.Integer, primary_key=True) date = db.Column(db.DateTime, nullable=False) value = db.Column(db.Float, nullable=False) resource = db.Column(db.Integer, db.ForeignKey('vehicles.id'), nullable=False) ## TODO FUTURE - Add additional models # The following models are stubbed out, but likely don't work yet # They're needed to complete a larger carbon footprint picture for a Campaign # Add new consumptions to track each contribution to your carbon footprint (as discrete events) # They can be of different types, (in an enum table) mostly just for future potential categorization features and stats across users # Add Offsets each time you buy an offset and apply it to a campaign # class Consumption(db.Model): # ''' A Consumption is a thing that has a carbon footprint. I.e. a flight, or a cheeseburger, or a bonfire ''' # __tablename__ = 'consumptions' # id = db.Column(db.Integer, primary_key=True) # name = db.Column(db.String, nullable=False) # date = db.Column(db.DateTime, nullable=False) # category = # TODO foreign key # quantity = db.Column(db.Float, nullable=False) # units = db.Column(db.String, nullable=False) # carbon_per_unit = db.Column(db.Float, nullable=False) # # Footprint off the consumption can be derived from the product of quantity and carbon_per_unity # def __repr__(self): # return '<Consumption {}, {}>'.format(self.name, self.id) # class ConsumptionCategories(db.Model): # ''' Enumeration of categories that Consumptions can fall into. One category to many Consumptions.''' # id = db.Column(db.Integer, primary_key=True) # name = db.Column(db.String, nullable=False) # def __repr__(self): # return '<Consumption Category {}, {}>'.format(self.name, self.id) # class Offset(db.Model): # __tablename__ = 'offsets' # id = db.Column(db.Integer, primary_key=True) # name = db.Column(db.String, nullable=False) # date = db.Column(db.DateTime, nullable=False) # price_usd = db.Column(db.Float, nullable=True) # carbon_offset_quantity = db.Column(db.Float, nullable=False) # reference = db.Column(db.String) # # Foreign key to Campaigns. Many offsets to one campaign. # campaign = db.Column(db.Integer, db.ForeignKey('campaigns.id'), nullable=False) # def __repr__(self): # return '<Offset #{}: {} ({}) kg CO2>'.format(self.id, self.name, self.carbon_offset_quantity) # ====================================================== # TODO FUTURE # Potentially I might want to abstract the Vehicle Resource into a Resource base class that Vehicles and Utilities can extend # # Abstract Class # class Resource(db.Model): # id = db.Column(db.Integer, primary_key=True) # carbon_per_unit = db.Column(db.Float, nullable=False) # units = db.Column(db.String, nullable=False) # notes = db.Column(db.String, nullable=True) # def __repr__(self): # return '<Resource {}>'.format(self.id) # class Vehicle(Resource): # __tablename__ = 'vehicles' # fuel_l_per_100km = db.Column(db.Float, nullable=False) # carbon_to_manufacture = db.Column(db.Float, nullable=False) # expected_life_km = db.Column(db.Float, nullable=False) # units = 'miles' # Somehow set this. # def __repr__(self): # return '<Vehicle {}>'.format(self.id) # class Utility(Resource): # __tablename__ = 'electric' # username = db.Column(db.String, primary_key=True) # def __repr__(self): # return '<User {}>'.format(self.id)
41.149425
161
0.691899
966
7,160
4.987578
0.259834
0.069738
0.078871
0.043171
0.402657
0.381901
0.333126
0.277501
0.229348
0.157119
0
0.009089
0.185615
7,160
174
162
41.149425
0.817184
0.615363
0
0.173913
0
0
0.093798
0.00814
0
0
0
0.011494
0
1
0.086957
false
0
0.021739
0.065217
0.73913
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
1
0
0
2
35939e520372bd241032dd0ca8f839c03e847bef
1,792
py
Python
demo/buf.py
uldisa/tuxedo-python
59bd44ee9be1807b63599b48b3af9b4dc4ac4277
[ "MIT" ]
4
2019-11-05T17:44:29.000Z
2022-03-21T08:51:14.000Z
demo/buf.py
uldisa/tuxedo-python
59bd44ee9be1807b63599b48b3af9b4dc4ac4277
[ "MIT" ]
3
2020-12-15T19:39:38.000Z
2021-11-22T20:54:13.000Z
demo/buf.py
uldisa/tuxedo-python
59bd44ee9be1807b63599b48b3af9b4dc4ac4277
[ "MIT" ]
4
2020-12-13T17:02:21.000Z
2021-12-15T22:46:00.000Z
#!/usr/bin/env python3 import tuxedo as t if __name__ == '__main__': buf = {'TA_CLASS': ['T_SVCGRP'], 'TA_OPERATION': ['GET']} assert t.tpimport(t.tpexport(buf)) == buf assert t.tpimport(t.tpexport(buf, t.TPEX_STRING), t.TPEX_STRING) == buf assert t.Fname32(t.Fldid32('TA_OPERATION')) == 'TA_OPERATION' assert t.Fldtype32(t.Fmkfldid32(t.FLD_STRING, 10)) == t.FLD_STRING assert t.Fldno32(t.Fmkfldid32(t.FLD_STRING, 10)) == 10 binstr = b'\xc1 hello' binstr2 = t.tpimport(t.tpexport({'TA_OPERATION': binstr}))['TA_OPERATION'][0] assert binstr2.encode(errors='surrogateescape') == binstr t.tpexport({'TA_OPERATION': binstr2}) binstr3 = t.tpimport(t.tpexport({'TA_OPERATION': binstr2}))['TA_OPERATION'][0] assert binstr3.encode(errors='surrogateescape') == binstr utf8 = b'gl\xc4\x81\xc5\xbe\xc5\xa1\xc4\xb7\xc5\xab\xc5\x86r\xc5\xab\xc4\xb7\xc4\xabtis' s = t.tpimport(t.tpexport({'TA_OPERATION': utf8}))['TA_OPERATION'][0] assert s.encode('utf8') == utf8 uni = 'gl\u0101\u017e\u0161\u0137\u016b\u0146r\u016b\u0137\u012btis' s = t.tpimport(t.tpexport({'TA_OPERATION': uni}))['TA_OPERATION'][0] assert s == uni assert t.Fboolev32({'TA_OPERATION': '123456789'}, "TA_OPERATION=='123456789'") assert not t.Fboolev32({'TA_OPERATION': '123456789'}, "TA_OPERATION=='1234567890'") assert t.Fboolev32({'TA_OPERATION': '123456789'}, "TA_OPERATION%%'.234.*'") assert not t.Fboolev32({'TA_OPERATION': '123456789'}, "TA_OPERATION%%'.123.*'") assert t.Fboolev32({'TA_OPERATION': '123456789'}, "TA_OPERATION!%'.123.*'") import sys t.Ffprint32({'TA_OPERATION': '123456789'}, sys.stdout) t.Ffprint32({t.Fmkfldid32(t.FLD_STRING, 10): 'Dynamic field'}, sys.stdout) print(t.Fextread32(sys.stdin))
41.674419
92
0.671875
248
1,792
4.697581
0.294355
0.217167
0.120172
0.092704
0.480687
0.418884
0.263519
0.212017
0.085837
0
0
0.118404
0.132813
1,792
42
93
42.666667
0.631274
0.011719
0
0
0
0.034483
0.344068
0.144068
0
0
0
0
0.482759
1
0
false
0
0.275862
0
0.275862
0.103448
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
1
0
0
0
0
0
0
0
0
0
2
359667e8aabcd97e7d2ce1d0e41dfa0d7e888640
302
py
Python
archive/2017/week12/tasks/more_list_tasks/tail.py
YAtOff/python0
b5af5004131d64dd52d42746eddb72b6c43a13c7
[ "Apache-2.0" ]
6
2017-11-08T14:04:39.000Z
2019-03-24T22:11:04.000Z
archive/2016/week13/tasks/tail.py
YAtOff/python0
b5af5004131d64dd52d42746eddb72b6c43a13c7
[ "Apache-2.0" ]
null
null
null
archive/2016/week13/tasks/tail.py
YAtOff/python0
b5af5004131d64dd52d42746eddb72b6c43a13c7
[ "Apache-2.0" ]
7
2015-10-27T09:04:58.000Z
2019-03-03T14:18:26.000Z
def tail(xs): """ Напишете функция в Python, която взима списък и връща нов списък, който се състои от всички елементи **без първия** от първоначалния списъка. **Не се грижете, ако списъка е празен** >>> tail([1, 2, 3]) [2, 3] >>> tail(["Python"]) [] """ pass
21.571429
79
0.572848
41
302
4.219512
0.780488
0.023121
0
0
0
0
0
0
0
0
0
0.023041
0.281457
302
13
80
23.230769
0.774194
0.774834
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0.5
0
0
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
2
359a0ef6c0200615c6b4cd4163ac0cfe31bb7efc
970
py
Python
squealy/urls.py
vaibhav-singh/squealy
abfe8fc5e7406987d84fb065bb70152d43f61250
[ "MIT" ]
null
null
null
squealy/urls.py
vaibhav-singh/squealy
abfe8fc5e7406987d84fb065bb70152d43f61250
[ "MIT" ]
null
null
null
squealy/urls.py
vaibhav-singh/squealy
abfe8fc5e7406987d84fb065bb70152d43f61250
[ "MIT" ]
null
null
null
from __future__ import absolute_import from django.conf.urls import url from django.contrib.auth.decorators import login_required from . import views urlpatterns = [ url(r'^swagger.json/$',views.swagger_json_api), url(r'^swagger/$', login_required(views.swagger)), url(r'charts/$', login_required(views.ChartsLoaderView.as_view())), url(r'user/$', login_required(views.UserInformation.as_view())), url(r'filters/$', login_required(views.FilterLoaderView.as_view())), url(r'squealy/(?P<chart_url>[-\w]+)', login_required(views.ChartView.as_view())), url(r'filter-api/(?P<filter_url>[-\w]+)', login_required(views.FilterView.as_view())), url(r'databases/$', login_required(views.DatabaseView.as_view())), url(r'^$', login_required(views.squealy_interface)), url(r'^(?P<chart_name>[\w@%.\Wd]+)/$', login_required(views.squealy_interface)), url(r'^(?P<chart_name>[\w@%.\Wd]+)/(?P<mode>\w+)$', login_required(views.squealy_interface)), ]
44.090909
96
0.710309
135
970
4.874074
0.296296
0.217325
0.273556
0.091185
0.273556
0.155015
0.155015
0.155015
0.155015
0.155015
0
0
0.080412
970
21
97
46.190476
0.737668
0
0
0
0
0
0.202062
0.139175
0
0
0
0
0
1
0
false
0
0.235294
0
0.235294
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
359d7f659114e08efb5857c6c56f60369996d99c
142
py
Python
my_site/objects.py
mequetrefe-do-subtroco/web_constel_cont_ext
c720c66e6d394e9aad0ed7039e1ff44e4a1c61c1
[ "MIT" ]
1
2020-06-18T09:03:53.000Z
2020-06-18T09:03:53.000Z
my_site/objects.py
mequetrefe-do-subtroco/web_constel_cont_ext
c720c66e6d394e9aad0ed7039e1ff44e4a1c61c1
[ "MIT" ]
33
2020-06-16T18:59:33.000Z
2021-08-12T21:33:17.000Z
constel/objects.py
gabrielhjs/web_constel
57b5626fb17b4fefc740cbe1ac95fd4ab90147bc
[ "MIT" ]
null
null
null
class Button(object): def __init__(self, url, label, get=''): self.url = url self.label = label self.get = get
15.777778
43
0.542254
18
142
4.055556
0.5
0.191781
0
0
0
0
0
0
0
0
0
0
0.330986
142
8
44
17.75
0.768421
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0
0
0.4
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
35aec8279955fef5781af2402034c048af969760
618
py
Python
ztools/Fs/__init__.py
ItsCinnabar/Mass_Custom_XCIs
94551f43eeed3a6ab7a761fd41ff5500435910dc
[ "MIT" ]
6
2019-05-08T18:52:48.000Z
2019-10-01T06:58:20.000Z
ztools/Fs/__init__.py
ItsCinnabar/Mass_Custom_XCIs
94551f43eeed3a6ab7a761fd41ff5500435910dc
[ "MIT" ]
null
null
null
ztools/Fs/__init__.py
ItsCinnabar/Mass_Custom_XCIs
94551f43eeed3a6ab7a761fd41ff5500435910dc
[ "MIT" ]
1
2020-01-01T07:44:06.000Z
2020-01-01T07:44:06.000Z
from Fs.Xci import Xci from Fs.pXci import uXci from Fs.pXci import nXci from Fs.Nca import Nca from Fs.Nsp import Nsp from Fs.Rom import Rom from Fs.Nacp import Nacp from Fs.Pfs0 import Pfs0 from Fs.Hfs0 import Hfs0 from Fs.Ticket import Ticket from Fs.File import File def factory(name): if name.endswith('.xci'): f = Xci() elif name.endswith('.nsp'): f = Nsp() elif name.endswith('.nsx'): f = Nsp() elif name.endswith('.nca'): f = Nca() elif name.endswith('.nacp'): f = Nacp() elif name.endswith('.tik'): f = Ticket() elif name.endswith('.hfs0'): f = Hfs0() else: f = File() return f
20.6
29
0.666667
105
618
3.92381
0.247619
0.160194
0.23301
0.07767
0.097087
0
0
0
0
0
0
0.012
0.190939
618
30
30
20.6
0.812
0
0
0.068966
0
0
0.048465
0
0
0
0
0
0
1
0.034483
false
0
0.37931
0
0.448276
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
35d3caf546997ac4a3e9ab5b7bbe7a7b734d8898
72,977
py
Python
juju/client/_client8.py
wallyworld/python-libjuju
1de9ad1cea120a691041c243877a6316ba648900
[ "Apache-2.0" ]
null
null
null
juju/client/_client8.py
wallyworld/python-libjuju
1de9ad1cea120a691041c243877a6316ba648900
[ "Apache-2.0" ]
1
2019-02-11T10:00:15.000Z
2019-02-11T10:06:20.000Z
juju/client/_client8.py
CanonicalBootStack/python-libjuju
43fb846042f4cd7d31ae11b1542862477bd76d36
[ "Apache-2.0" ]
null
null
null
# DO NOT CHANGE THIS FILE! This file is auto-generated by facade.py. # Changes will be overwritten/lost when the file is regenerated. from juju.client.facade import Type, ReturnMapping from juju.client._definitions import * class ApplicationFacade(Type): name = 'Application' version = 8 schema = {'definitions': {'AddApplicationUnits': {'additionalProperties': False, 'properties': {'application': {'type': 'string'}, 'attach-storage': {'items': {'type': 'string'}, 'type': 'array'}, 'num-units': {'type': 'integer'}, 'placement': {'items': {'$ref': '#/definitions/Placement'}, 'type': 'array'}, 'policy': {'type': 'string'}}, 'required': ['application', 'num-units', 'placement'], 'type': 'object'}, 'AddApplicationUnitsResults': {'additionalProperties': False, 'properties': {'units': {'items': {'type': 'string'}, 'type': 'array'}}, 'required': ['units'], 'type': 'object'}, 'AddRelation': {'additionalProperties': False, 'properties': {'endpoints': {'items': {'type': 'string'}, 'type': 'array'}, 'via-cidrs': {'items': {'type': 'string'}, 'type': 'array'}}, 'required': ['endpoints'], 'type': 'object'}, 'AddRelationResults': {'additionalProperties': False, 'properties': {'endpoints': {'patternProperties': {'.*': {'$ref': '#/definitions/CharmRelation'}}, 'type': 'object'}}, 'required': ['endpoints'], 'type': 'object'}, 'ApplicationCharmRelations': {'additionalProperties': False, 'properties': {'application': {'type': 'string'}}, 'required': ['application'], 'type': 'object'}, 'ApplicationCharmRelationsResults': {'additionalProperties': False, 'properties': {'charm-relations': {'items': {'type': 'string'}, 'type': 'array'}}, 'required': ['charm-relations'], 'type': 'object'}, 'ApplicationConfigSet': {'additionalProperties': False, 'properties': {'application': {'type': 'string'}, 'config': {'patternProperties': {'.*': {'type': 'string'}}, 'type': 'object'}}, 'required': ['application', 'config'], 'type': 'object'}, 'ApplicationConfigSetArgs': {'additionalProperties': False, 'properties': {'Args': {'items': {'$ref': '#/definitions/ApplicationConfigSet'}, 'type': 'array'}}, 'required': ['Args'], 'type': 'object'}, 'ApplicationConfigUnsetArgs': {'additionalProperties': False, 'properties': {'Args': {'items': {'$ref': '#/definitions/ApplicationUnset'}, 'type': 'array'}}, 'required': ['Args'], 'type': 'object'}, 'ApplicationConstraint': {'additionalProperties': False, 'properties': {'constraints': {'$ref': '#/definitions/Value'}, 'error': {'$ref': '#/definitions/Error'}}, 'required': ['constraints'], 'type': 'object'}, 'ApplicationDeploy': {'additionalProperties': False, 'properties': {'application': {'type': 'string'}, 'attach-storage': {'items': {'type': 'string'}, 'type': 'array'}, 'channel': {'type': 'string'}, 'charm-url': {'type': 'string'}, 'config': {'patternProperties': {'.*': {'type': 'string'}}, 'type': 'object'}, 'config-yaml': {'type': 'string'}, 'constraints': {'$ref': '#/definitions/Value'}, 'devices': {'patternProperties': {'.*': {'$ref': '#/definitions/Constraints'}}, 'type': 'object'}, 'endpoint-bindings': {'patternProperties': {'.*': {'type': 'string'}}, 'type': 'object'}, 'num-units': {'type': 'integer'}, 'placement': {'items': {'$ref': '#/definitions/Placement'}, 'type': 'array'}, 'policy': {'type': 'string'}, 'resources': {'patternProperties': {'.*': {'type': 'string'}}, 'type': 'object'}, 'series': {'type': 'string'}, 'storage': {'patternProperties': {'.*': {'$ref': '#/definitions/Constraints'}}, 'type': 'object'}}, 'required': ['application', 'series', 'charm-url', 'channel', 'num-units', 'config-yaml', 'constraints'], 'type': 'object'}, 'ApplicationDestroy': {'additionalProperties': False, 'properties': {'application': {'type': 'string'}}, 'required': ['application'], 'type': 'object'}, 'ApplicationExpose': {'additionalProperties': False, 'properties': {'application': {'type': 'string'}}, 'required': ['application'], 'type': 'object'}, 'ApplicationGet': {'additionalProperties': False, 'properties': {'application': {'type': 'string'}}, 'required': ['application'], 'type': 'object'}, 'ApplicationGetConfigResults': {'additionalProperties': False, 'properties': {'Results': {'items': {'$ref': '#/definitions/ConfigResult'}, 'type': 'array'}}, 'required': ['Results'], 'type': 'object'}, 'ApplicationGetConstraintsResults': {'additionalProperties': False, 'properties': {'results': {'items': {'$ref': '#/definitions/ApplicationConstraint'}, 'type': 'array'}}, 'required': ['results'], 'type': 'object'}, 'ApplicationGetResults': {'additionalProperties': False, 'properties': {'application': {'type': 'string'}, 'application-config': {'patternProperties': {'.*': {'additionalProperties': True, 'type': 'object'}}, 'type': 'object'}, 'charm': {'type': 'string'}, 'config': {'patternProperties': {'.*': {'additionalProperties': True, 'type': 'object'}}, 'type': 'object'}, 'constraints': {'$ref': '#/definitions/Value'}, 'series': {'type': 'string'}}, 'required': ['application', 'charm', 'config', 'constraints', 'series'], 'type': 'object'}, 'ApplicationMetricCredential': {'additionalProperties': False, 'properties': {'application': {'type': 'string'}, 'metrics-credentials': {'items': {'type': 'integer'}, 'type': 'array'}}, 'required': ['application', 'metrics-credentials'], 'type': 'object'}, 'ApplicationMetricCredentials': {'additionalProperties': False, 'properties': {'creds': {'items': {'$ref': '#/definitions/ApplicationMetricCredential'}, 'type': 'array'}}, 'required': ['creds'], 'type': 'object'}, 'ApplicationOfferDetails': {'additionalProperties': False, 'properties': {'application-description': {'type': 'string'}, 'bindings': {'patternProperties': {'.*': {'type': 'string'}}, 'type': 'object'}, 'endpoints': {'items': {'$ref': '#/definitions/RemoteEndpoint'}, 'type': 'array'}, 'offer-name': {'type': 'string'}, 'offer-url': {'type': 'string'}, 'offer-uuid': {'type': 'string'}, 'source-model-tag': {'type': 'string'}, 'spaces': {'items': {'$ref': '#/definitions/RemoteSpace'}, 'type': 'array'}, 'users': {'items': {'$ref': '#/definitions/OfferUserDetails'}, 'type': 'array'}}, 'required': ['source-model-tag', 'offer-uuid', 'offer-url', 'offer-name', 'application-description'], 'type': 'object'}, 'ApplicationSet': {'additionalProperties': False, 'properties': {'application': {'type': 'string'}, 'options': {'patternProperties': {'.*': {'type': 'string'}}, 'type': 'object'}}, 'required': ['application', 'options'], 'type': 'object'}, 'ApplicationSetCharm': {'additionalProperties': False, 'properties': {'application': {'type': 'string'}, 'channel': {'type': 'string'}, 'charm-url': {'type': 'string'}, 'config-settings': {'patternProperties': {'.*': {'type': 'string'}}, 'type': 'object'}, 'config-settings-yaml': {'type': 'string'}, 'force': {'type': 'boolean'}, 'force-series': {'type': 'boolean'}, 'force-units': {'type': 'boolean'}, 'resource-ids': {'patternProperties': {'.*': {'type': 'string'}}, 'type': 'object'}, 'storage-constraints': {'patternProperties': {'.*': {'$ref': '#/definitions/StorageConstraints'}}, 'type': 'object'}}, 'required': ['application', 'charm-url', 'channel', 'force', 'force-units', 'force-series'], 'type': 'object'}, 'ApplicationSetCharmProfile': {'additionalProperties': False, 'properties': {'application': {'type': 'string'}, 'charm-url': {'type': 'string'}}, 'required': ['application', 'charm-url'], 'type': 'object'}, 'ApplicationUnexpose': {'additionalProperties': False, 'properties': {'application': {'type': 'string'}}, 'required': ['application'], 'type': 'object'}, 'ApplicationUnset': {'additionalProperties': False, 'properties': {'application': {'type': 'string'}, 'options': {'items': {'type': 'string'}, 'type': 'array'}}, 'required': ['application', 'options'], 'type': 'object'}, 'ApplicationUpdate': {'additionalProperties': False, 'properties': {'application': {'type': 'string'}, 'charm-url': {'type': 'string'}, 'constraints': {'$ref': '#/definitions/Value'}, 'force': {'type': 'boolean'}, 'force-charm-url': {'type': 'boolean'}, 'force-series': {'type': 'boolean'}, 'min-units': {'type': 'integer'}, 'settings': {'patternProperties': {'.*': {'type': 'string'}}, 'type': 'object'}, 'settings-yaml': {'type': 'string'}}, 'required': ['application', 'charm-url', 'force-charm-url', 'force-series', 'force', 'settings-yaml'], 'type': 'object'}, 'ApplicationsDeploy': {'additionalProperties': False, 'properties': {'applications': {'items': {'$ref': '#/definitions/ApplicationDeploy'}, 'type': 'array'}}, 'required': ['applications'], 'type': 'object'}, 'CharmRelation': {'additionalProperties': False, 'properties': {'interface': {'type': 'string'}, 'limit': {'type': 'integer'}, 'name': {'type': 'string'}, 'optional': {'type': 'boolean'}, 'role': {'type': 'string'}, 'scope': {'type': 'string'}}, 'required': ['name', 'role', 'interface', 'optional', 'limit', 'scope'], 'type': 'object'}, 'ConfigResult': {'additionalProperties': False, 'properties': {'config': {'patternProperties': {'.*': {'additionalProperties': True, 'type': 'object'}}, 'type': 'object'}, 'error': {'$ref': '#/definitions/Error'}}, 'required': ['config'], 'type': 'object'}, 'Constraints': {'additionalProperties': False, 'properties': {'Count': {'type': 'integer'}, 'Pool': {'type': 'string'}, 'Size': {'type': 'integer'}}, 'required': ['Pool', 'Size', 'Count'], 'type': 'object'}, 'ConsumeApplicationArg': {'additionalProperties': False, 'properties': {'ApplicationOfferDetails': {'$ref': '#/definitions/ApplicationOfferDetails'}, 'application-alias': {'type': 'string'}, 'external-controller': {'$ref': '#/definitions/ExternalControllerInfo'}, 'macaroon': {'$ref': '#/definitions/Macaroon'}}, 'required': ['ApplicationOfferDetails'], 'type': 'object'}, 'ConsumeApplicationArgs': {'additionalProperties': False, 'properties': {'args': {'items': {'$ref': '#/definitions/ConsumeApplicationArg'}, 'type': 'array'}}, 'type': 'object'}, 'DestroyApplicationInfo': {'additionalProperties': False, 'properties': {'destroyed-storage': {'items': {'$ref': '#/definitions/Entity'}, 'type': 'array'}, 'destroyed-units': {'items': {'$ref': '#/definitions/Entity'}, 'type': 'array'}, 'detached-storage': {'items': {'$ref': '#/definitions/Entity'}, 'type': 'array'}}, 'type': 'object'}, 'DestroyApplicationParams': {'additionalProperties': False, 'properties': {'application-tag': {'type': 'string'}, 'destroy-storage': {'type': 'boolean'}}, 'required': ['application-tag'], 'type': 'object'}, 'DestroyApplicationResult': {'additionalProperties': False, 'properties': {'error': {'$ref': '#/definitions/Error'}, 'info': {'$ref': '#/definitions/DestroyApplicationInfo'}}, 'type': 'object'}, 'DestroyApplicationResults': {'additionalProperties': False, 'properties': {'results': {'items': {'$ref': '#/definitions/DestroyApplicationResult'}, 'type': 'array'}}, 'type': 'object'}, 'DestroyApplicationUnits': {'additionalProperties': False, 'properties': {'unit-names': {'items': {'type': 'string'}, 'type': 'array'}}, 'required': ['unit-names'], 'type': 'object'}, 'DestroyApplicationsParams': {'additionalProperties': False, 'properties': {'applications': {'items': {'$ref': '#/definitions/DestroyApplicationParams'}, 'type': 'array'}}, 'required': ['applications'], 'type': 'object'}, 'DestroyConsumedApplicationParams': {'additionalProperties': False, 'properties': {'application-tag': {'type': 'string'}}, 'required': ['application-tag'], 'type': 'object'}, 'DestroyConsumedApplicationsParams': {'additionalProperties': False, 'properties': {'applications': {'items': {'$ref': '#/definitions/DestroyConsumedApplicationParams'}, 'type': 'array'}}, 'required': ['applications'], 'type': 'object'}, 'DestroyRelation': {'additionalProperties': False, 'properties': {'endpoints': {'items': {'type': 'string'}, 'type': 'array'}, 'relation-id': {'type': 'integer'}}, 'required': ['relation-id'], 'type': 'object'}, 'DestroyUnitInfo': {'additionalProperties': False, 'properties': {'destroyed-storage': {'items': {'$ref': '#/definitions/Entity'}, 'type': 'array'}, 'detached-storage': {'items': {'$ref': '#/definitions/Entity'}, 'type': 'array'}}, 'type': 'object'}, 'DestroyUnitParams': {'additionalProperties': False, 'properties': {'destroy-storage': {'type': 'boolean'}, 'unit-tag': {'type': 'string'}}, 'required': ['unit-tag'], 'type': 'object'}, 'DestroyUnitResult': {'additionalProperties': False, 'properties': {'error': {'$ref': '#/definitions/Error'}, 'info': {'$ref': '#/definitions/DestroyUnitInfo'}}, 'type': 'object'}, 'DestroyUnitResults': {'additionalProperties': False, 'properties': {'results': {'items': {'$ref': '#/definitions/DestroyUnitResult'}, 'type': 'array'}}, 'type': 'object'}, 'DestroyUnitsParams': {'additionalProperties': False, 'properties': {'units': {'items': {'$ref': '#/definitions/DestroyUnitParams'}, 'type': 'array'}}, 'required': ['units'], 'type': 'object'}, 'Entities': {'additionalProperties': False, 'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'}, 'type': 'array'}}, 'required': ['entities'], 'type': 'object'}, 'Entity': {'additionalProperties': False, 'properties': {'tag': {'type': 'string'}}, 'required': ['tag'], 'type': 'object'}, 'Error': {'additionalProperties': False, 'properties': {'code': {'type': 'string'}, 'info': {'$ref': '#/definitions/ErrorInfo'}, 'message': {'type': 'string'}}, 'required': ['message', 'code'], 'type': 'object'}, 'ErrorInfo': {'additionalProperties': False, 'properties': {'macaroon': {'$ref': '#/definitions/Macaroon'}, 'macaroon-path': {'type': 'string'}}, 'type': 'object'}, 'ErrorResult': {'additionalProperties': False, 'properties': {'error': {'$ref': '#/definitions/Error'}}, 'type': 'object'}, 'ErrorResults': {'additionalProperties': False, 'properties': {'results': {'items': {'$ref': '#/definitions/ErrorResult'}, 'type': 'array'}}, 'required': ['results'], 'type': 'object'}, 'ExternalControllerInfo': {'additionalProperties': False, 'properties': {'addrs': {'items': {'type': 'string'}, 'type': 'array'}, 'ca-cert': {'type': 'string'}, 'controller-alias': {'type': 'string'}, 'controller-tag': {'type': 'string'}}, 'required': ['controller-tag', 'controller-alias', 'addrs', 'ca-cert'], 'type': 'object'}, 'LXDProfileUpgradeMessages': {'additionalProperties': False, 'properties': {'application': {'$ref': '#/definitions/Entity'}, 'watcher-id': {'type': 'string'}}, 'required': ['application', 'watcher-id'], 'type': 'object'}, 'LXDProfileUpgradeMessagesResult': {'additionalProperties': False, 'properties': {'error': {'$ref': '#/definitions/Error'}, 'message': {'type': 'string'}, 'unit-name': {'type': 'string'}}, 'required': ['unit-name', 'message'], 'type': 'object'}, 'LXDProfileUpgradeMessagesResults': {'additionalProperties': False, 'properties': {'args': {'items': {'$ref': '#/definitions/LXDProfileUpgradeMessagesResult'}, 'type': 'array'}}, 'required': ['args'], 'type': 'object'}, 'Macaroon': {'additionalProperties': False, 'type': 'object'}, 'NotifyWatchResult': {'additionalProperties': False, 'properties': {'NotifyWatcherId': {'type': 'string'}, 'error': {'$ref': '#/definitions/Error'}}, 'required': ['NotifyWatcherId'], 'type': 'object'}, 'OfferUserDetails': {'additionalProperties': False, 'properties': {'access': {'type': 'string'}, 'display-name': {'type': 'string'}, 'user': {'type': 'string'}}, 'required': ['user', 'display-name', 'access'], 'type': 'object'}, 'Placement': {'additionalProperties': False, 'properties': {'directive': {'type': 'string'}, 'scope': {'type': 'string'}}, 'required': ['scope', 'directive'], 'type': 'object'}, 'RelationSuspendedArg': {'additionalProperties': False, 'properties': {'message': {'type': 'string'}, 'relation-id': {'type': 'integer'}, 'suspended': {'type': 'boolean'}}, 'required': ['relation-id', 'message', 'suspended'], 'type': 'object'}, 'RelationSuspendedArgs': {'additionalProperties': False, 'properties': {'args': {'items': {'$ref': '#/definitions/RelationSuspendedArg'}, 'type': 'array'}}, 'required': ['args'], 'type': 'object'}, 'RemoteEndpoint': {'additionalProperties': False, 'properties': {'interface': {'type': 'string'}, 'limit': {'type': 'integer'}, 'name': {'type': 'string'}, 'role': {'type': 'string'}}, 'required': ['name', 'role', 'interface', 'limit'], 'type': 'object'}, 'RemoteSpace': {'additionalProperties': False, 'properties': {'cloud-type': {'type': 'string'}, 'name': {'type': 'string'}, 'provider-attributes': {'patternProperties': {'.*': {'additionalProperties': True, 'type': 'object'}}, 'type': 'object'}, 'provider-id': {'type': 'string'}, 'subnets': {'items': {'$ref': '#/definitions/Subnet'}, 'type': 'array'}}, 'required': ['cloud-type', 'name', 'provider-id', 'provider-attributes', 'subnets'], 'type': 'object'}, 'ScaleApplicationInfo': {'additionalProperties': False, 'properties': {'num-units': {'type': 'integer'}}, 'required': ['num-units'], 'type': 'object'}, 'ScaleApplicationParams': {'additionalProperties': False, 'properties': {'application-tag': {'type': 'string'}, 'scale': {'type': 'integer'}, 'scale-change': {'type': 'integer'}}, 'required': ['application-tag', 'scale'], 'type': 'object'}, 'ScaleApplicationResult': {'additionalProperties': False, 'properties': {'error': {'$ref': '#/definitions/Error'}, 'info': {'$ref': '#/definitions/ScaleApplicationInfo'}}, 'type': 'object'}, 'ScaleApplicationResults': {'additionalProperties': False, 'properties': {'results': {'items': {'$ref': '#/definitions/ScaleApplicationResult'}, 'type': 'array'}}, 'type': 'object'}, 'ScaleApplicationsParams': {'additionalProperties': False, 'properties': {'applications': {'items': {'$ref': '#/definitions/ScaleApplicationParams'}, 'type': 'array'}}, 'required': ['applications'], 'type': 'object'}, 'SetConstraints': {'additionalProperties': False, 'properties': {'application': {'type': 'string'}, 'constraints': {'$ref': '#/definitions/Value'}}, 'required': ['application', 'constraints'], 'type': 'object'}, 'StorageConstraints': {'additionalProperties': False, 'properties': {'count': {'type': 'integer'}, 'pool': {'type': 'string'}, 'size': {'type': 'integer'}}, 'type': 'object'}, 'StringResult': {'additionalProperties': False, 'properties': {'error': {'$ref': '#/definitions/Error'}, 'result': {'type': 'string'}}, 'required': ['result'], 'type': 'object'}, 'Subnet': {'additionalProperties': False, 'properties': {'cidr': {'type': 'string'}, 'life': {'type': 'string'}, 'provider-id': {'type': 'string'}, 'provider-network-id': {'type': 'string'}, 'provider-space-id': {'type': 'string'}, 'space-tag': {'type': 'string'}, 'status': {'type': 'string'}, 'vlan-tag': {'type': 'integer'}, 'zones': {'items': {'type': 'string'}, 'type': 'array'}}, 'required': ['cidr', 'vlan-tag', 'life', 'space-tag', 'zones'], 'type': 'object'}, 'UnitsResolved': {'additionalProperties': False, 'properties': {'all': {'type': 'boolean'}, 'retry': {'type': 'boolean'}, 'tags': {'$ref': '#/definitions/Entities'}}, 'type': 'object'}, 'UpdateSeriesArg': {'additionalProperties': False, 'properties': {'force': {'type': 'boolean'}, 'series': {'type': 'string'}, 'tag': {'$ref': '#/definitions/Entity'}}, 'required': ['tag', 'force', 'series'], 'type': 'object'}, 'UpdateSeriesArgs': {'additionalProperties': False, 'properties': {'args': {'items': {'$ref': '#/definitions/UpdateSeriesArg'}, 'type': 'array'}}, 'required': ['args'], 'type': 'object'}, 'Value': {'additionalProperties': False, 'properties': {'arch': {'type': 'string'}, 'container': {'type': 'string'}, 'cores': {'type': 'integer'}, 'cpu-power': {'type': 'integer'}, 'instance-type': {'type': 'string'}, 'mem': {'type': 'integer'}, 'root-disk': {'type': 'integer'}, 'spaces': {'items': {'type': 'string'}, 'type': 'array'}, 'tags': {'items': {'type': 'string'}, 'type': 'array'}, 'virt-type': {'type': 'string'}, 'zones': {'items': {'type': 'string'}, 'type': 'array'}}, 'type': 'object'}}, 'properties': {'AddRelation': {'properties': {'Params': {'$ref': '#/definitions/AddRelation'}, 'Result': {'$ref': '#/definitions/AddRelationResults'}}, 'type': 'object'}, 'AddUnits': {'properties': {'Params': {'$ref': '#/definitions/AddApplicationUnits'}, 'Result': {'$ref': '#/definitions/AddApplicationUnitsResults'}}, 'type': 'object'}, 'CharmConfig': {'properties': {'Params': {'$ref': '#/definitions/Entities'}, 'Result': {'$ref': '#/definitions/ApplicationGetConfigResults'}}, 'type': 'object'}, 'CharmRelations': {'properties': {'Params': {'$ref': '#/definitions/ApplicationCharmRelations'}, 'Result': {'$ref': '#/definitions/ApplicationCharmRelationsResults'}}, 'type': 'object'}, 'Consume': {'properties': {'Params': {'$ref': '#/definitions/ConsumeApplicationArgs'}, 'Result': {'$ref': '#/definitions/ErrorResults'}}, 'type': 'object'}, 'Deploy': {'properties': {'Params': {'$ref': '#/definitions/ApplicationsDeploy'}, 'Result': {'$ref': '#/definitions/ErrorResults'}}, 'type': 'object'}, 'Destroy': {'properties': {'Params': {'$ref': '#/definitions/ApplicationDestroy'}}, 'type': 'object'}, 'DestroyApplication': {'properties': {'Params': {'$ref': '#/definitions/DestroyApplicationsParams'}, 'Result': {'$ref': '#/definitions/DestroyApplicationResults'}}, 'type': 'object'}, 'DestroyConsumedApplications': {'properties': {'Params': {'$ref': '#/definitions/DestroyConsumedApplicationsParams'}, 'Result': {'$ref': '#/definitions/ErrorResults'}}, 'type': 'object'}, 'DestroyRelation': {'properties': {'Params': {'$ref': '#/definitions/DestroyRelation'}}, 'type': 'object'}, 'DestroyUnit': {'properties': {'Params': {'$ref': '#/definitions/DestroyUnitsParams'}, 'Result': {'$ref': '#/definitions/DestroyUnitResults'}}, 'type': 'object'}, 'DestroyUnits': {'properties': {'Params': {'$ref': '#/definitions/DestroyApplicationUnits'}}, 'type': 'object'}, 'Expose': {'properties': {'Params': {'$ref': '#/definitions/ApplicationExpose'}}, 'type': 'object'}, 'Get': {'properties': {'Params': {'$ref': '#/definitions/ApplicationGet'}, 'Result': {'$ref': '#/definitions/ApplicationGetResults'}}, 'type': 'object'}, 'GetCharmURL': {'properties': {'Params': {'$ref': '#/definitions/ApplicationGet'}, 'Result': {'$ref': '#/definitions/StringResult'}}, 'type': 'object'}, 'GetConfig': {'properties': {'Params': {'$ref': '#/definitions/Entities'}, 'Result': {'$ref': '#/definitions/ApplicationGetConfigResults'}}, 'type': 'object'}, 'GetConstraints': {'properties': {'Params': {'$ref': '#/definitions/Entities'}, 'Result': {'$ref': '#/definitions/ApplicationGetConstraintsResults'}}, 'type': 'object'}, 'GetLXDProfileUpgradeMessages': {'properties': {'Params': {'$ref': '#/definitions/LXDProfileUpgradeMessages'}, 'Result': {'$ref': '#/definitions/LXDProfileUpgradeMessagesResults'}}, 'type': 'object'}, 'ResolveUnitErrors': {'properties': {'Params': {'$ref': '#/definitions/UnitsResolved'}, 'Result': {'$ref': '#/definitions/ErrorResults'}}, 'type': 'object'}, 'ScaleApplications': {'properties': {'Params': {'$ref': '#/definitions/ScaleApplicationsParams'}, 'Result': {'$ref': '#/definitions/ScaleApplicationResults'}}, 'type': 'object'}, 'Set': {'properties': {'Params': {'$ref': '#/definitions/ApplicationSet'}}, 'type': 'object'}, 'SetApplicationsConfig': {'properties': {'Params': {'$ref': '#/definitions/ApplicationConfigSetArgs'}, 'Result': {'$ref': '#/definitions/ErrorResults'}}, 'type': 'object'}, 'SetCharm': {'properties': {'Params': {'$ref': '#/definitions/ApplicationSetCharm'}}, 'type': 'object'}, 'SetCharmProfile': {'properties': {'Params': {'$ref': '#/definitions/ApplicationSetCharmProfile'}}, 'type': 'object'}, 'SetConstraints': {'properties': {'Params': {'$ref': '#/definitions/SetConstraints'}}, 'type': 'object'}, 'SetMetricCredentials': {'properties': {'Params': {'$ref': '#/definitions/ApplicationMetricCredentials'}, 'Result': {'$ref': '#/definitions/ErrorResults'}}, 'type': 'object'}, 'SetRelationsSuspended': {'properties': {'Params': {'$ref': '#/definitions/RelationSuspendedArgs'}, 'Result': {'$ref': '#/definitions/ErrorResults'}}, 'type': 'object'}, 'Unexpose': {'properties': {'Params': {'$ref': '#/definitions/ApplicationUnexpose'}}, 'type': 'object'}, 'Unset': {'properties': {'Params': {'$ref': '#/definitions/ApplicationUnset'}}, 'type': 'object'}, 'UnsetApplicationsConfig': {'properties': {'Params': {'$ref': '#/definitions/ApplicationConfigUnsetArgs'}, 'Result': {'$ref': '#/definitions/ErrorResults'}}, 'type': 'object'}, 'Update': {'properties': {'Params': {'$ref': '#/definitions/ApplicationUpdate'}}, 'type': 'object'}, 'UpdateApplicationSeries': {'properties': {'Params': {'$ref': '#/definitions/UpdateSeriesArgs'}, 'Result': {'$ref': '#/definitions/ErrorResults'}}, 'type': 'object'}, 'WatchLXDProfileUpgradeNotifications': {'properties': {'Params': {'$ref': '#/definitions/Entity'}, 'Result': {'$ref': '#/definitions/NotifyWatchResult'}}, 'type': 'object'}}, 'type': 'object'} @ReturnMapping(AddRelationResults) async def AddRelation(self, endpoints): ''' endpoints : typing.Sequence[str] Returns -> typing.Mapping[str, ~CharmRelation] ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='AddRelation', version=8, params=_params) _params['endpoints'] = endpoints reply = await self.rpc(msg) return reply @ReturnMapping(AddApplicationUnitsResults) async def AddUnits(self, application, num_units, placement): ''' application : str num_units : int placement : typing.Sequence[~Placement] Returns -> typing.Sequence[str] ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='AddUnits', version=8, params=_params) _params['application'] = application _params['num-units'] = num_units _params['placement'] = placement reply = await self.rpc(msg) return reply @ReturnMapping(ApplicationGetConfigResults) async def CharmConfig(self, entities): ''' entities : typing.Sequence[~Entity] Returns -> typing.Sequence[~ConfigResult] ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='CharmConfig', version=8, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply @ReturnMapping(ApplicationCharmRelationsResults) async def CharmRelations(self, application): ''' application : str Returns -> typing.Sequence[str] ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='CharmRelations', version=8, params=_params) _params['application'] = application reply = await self.rpc(msg) return reply @ReturnMapping(ErrorResults) async def Consume(self, args): ''' args : typing.Sequence[~ConsumeApplicationArg] Returns -> typing.Sequence[~ErrorResult] ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='Consume', version=8, params=_params) _params['args'] = args reply = await self.rpc(msg) return reply @ReturnMapping(ErrorResults) async def Deploy(self, applications): ''' applications : typing.Sequence[~ApplicationDeploy] Returns -> typing.Sequence[~ErrorResult] ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='Deploy', version=8, params=_params) _params['applications'] = applications reply = await self.rpc(msg) return reply @ReturnMapping(None) async def Destroy(self, application): ''' application : str Returns -> None ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='Destroy', version=8, params=_params) _params['application'] = application reply = await self.rpc(msg) return reply @ReturnMapping(DestroyApplicationResults) async def DestroyApplication(self, applications): ''' applications : typing.Sequence[~DestroyApplicationParams] Returns -> typing.Sequence[~DestroyApplicationResult] ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='DestroyApplication', version=8, params=_params) _params['applications'] = applications reply = await self.rpc(msg) return reply @ReturnMapping(ErrorResults) async def DestroyConsumedApplications(self, applications): ''' applications : typing.Sequence[~DestroyConsumedApplicationParams] Returns -> typing.Sequence[~ErrorResult] ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='DestroyConsumedApplications', version=8, params=_params) _params['applications'] = applications reply = await self.rpc(msg) return reply @ReturnMapping(None) async def DestroyRelation(self, endpoints): ''' endpoints : typing.Sequence[str] Returns -> None ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='DestroyRelation', version=8, params=_params) _params['endpoints'] = endpoints reply = await self.rpc(msg) return reply @ReturnMapping(DestroyUnitResults) async def DestroyUnit(self, units): ''' units : typing.Sequence[~DestroyUnitParams] Returns -> typing.Sequence[~DestroyUnitResult] ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='DestroyUnit', version=8, params=_params) _params['units'] = units reply = await self.rpc(msg) return reply @ReturnMapping(None) async def DestroyUnits(self, unit_names): ''' unit_names : typing.Sequence[str] Returns -> None ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='DestroyUnits', version=8, params=_params) _params['unit-names'] = unit_names reply = await self.rpc(msg) return reply @ReturnMapping(None) async def Expose(self, application): ''' application : str Returns -> None ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='Expose', version=8, params=_params) _params['application'] = application reply = await self.rpc(msg) return reply @ReturnMapping(ApplicationGetResults) async def Get(self, application): ''' application : str Returns -> typing.Union[str, typing.Mapping[str, typing.Any], _ForwardRef('Value')] ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='Get', version=8, params=_params) _params['application'] = application reply = await self.rpc(msg) return reply @ReturnMapping(StringResult) async def GetCharmURL(self, application): ''' application : str Returns -> typing.Union[_ForwardRef('Error'), str] ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='GetCharmURL', version=8, params=_params) _params['application'] = application reply = await self.rpc(msg) return reply @ReturnMapping(ApplicationGetConfigResults) async def GetConfig(self, entities): ''' entities : typing.Sequence[~Entity] Returns -> typing.Sequence[~ConfigResult] ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='GetConfig', version=8, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply @ReturnMapping(ApplicationGetConstraintsResults) async def GetConstraints(self, entities): ''' entities : typing.Sequence[~Entity] Returns -> typing.Sequence[~ApplicationConstraint] ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='GetConstraints', version=8, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply @ReturnMapping(LXDProfileUpgradeMessagesResults) async def GetLXDProfileUpgradeMessages(self, application, watcher_id): ''' application : Entity watcher_id : str Returns -> typing.Sequence[~LXDProfileUpgradeMessagesResult] ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='GetLXDProfileUpgradeMessages', version=8, params=_params) _params['application'] = application _params['watcher-id'] = watcher_id reply = await self.rpc(msg) return reply @ReturnMapping(ErrorResults) async def ResolveUnitErrors(self, all_, retry, tags): ''' all_ : bool retry : bool tags : Entities Returns -> typing.Sequence[~ErrorResult] ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='ResolveUnitErrors', version=8, params=_params) _params['all'] = all_ _params['retry'] = retry _params['tags'] = tags reply = await self.rpc(msg) return reply @ReturnMapping(ScaleApplicationResults) async def ScaleApplications(self, applications): ''' applications : typing.Sequence[~ScaleApplicationParams] Returns -> typing.Sequence[~ScaleApplicationResult] ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='ScaleApplications', version=8, params=_params) _params['applications'] = applications reply = await self.rpc(msg) return reply @ReturnMapping(None) async def Set(self, application, options): ''' application : str options : typing.Mapping[str, str] Returns -> None ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='Set', version=8, params=_params) _params['application'] = application _params['options'] = options reply = await self.rpc(msg) return reply @ReturnMapping(ErrorResults) async def SetApplicationsConfig(self, args): ''' args : typing.Sequence[~ApplicationConfigSet] Returns -> typing.Sequence[~ErrorResult] ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='SetApplicationsConfig', version=8, params=_params) _params['Args'] = args reply = await self.rpc(msg) return reply @ReturnMapping(None) async def SetCharm(self, application, channel, charm_url, config_settings, config_settings_yaml, force_series, force_units, resource_ids, storage_constraints): ''' application : str channel : str charm_url : str config_settings : typing.Mapping[str, str] config_settings_yaml : str force_series : bool force_units : bool resource_ids : typing.Mapping[str, str] storage_constraints : typing.Mapping[str, ~StorageConstraints] Returns -> None ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='SetCharm', version=8, params=_params) _params['application'] = application _params['channel'] = channel _params['charm-url'] = charm_url _params['config-settings'] = config_settings _params['config-settings-yaml'] = config_settings_yaml _params['force-series'] = force_series _params['force-units'] = force_units _params['resource-ids'] = resource_ids _params['storage-constraints'] = storage_constraints reply = await self.rpc(msg) return reply @ReturnMapping(None) async def SetCharmProfile(self, application, charm_url): ''' application : str charm_url : str Returns -> None ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='SetCharmProfile', version=8, params=_params) _params['application'] = application _params['charm-url'] = charm_url reply = await self.rpc(msg) return reply @ReturnMapping(None) async def SetConstraints(self, application, constraints): ''' application : str constraints : Value Returns -> None ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='SetConstraints', version=8, params=_params) _params['application'] = application _params['constraints'] = constraints reply = await self.rpc(msg) return reply @ReturnMapping(ErrorResults) async def SetMetricCredentials(self, creds): ''' creds : typing.Sequence[~ApplicationMetricCredential] Returns -> typing.Sequence[~ErrorResult] ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='SetMetricCredentials', version=8, params=_params) _params['creds'] = creds reply = await self.rpc(msg) return reply @ReturnMapping(ErrorResults) async def SetRelationsSuspended(self, args): ''' args : typing.Sequence[~RelationSuspendedArg] Returns -> typing.Sequence[~ErrorResult] ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='SetRelationsSuspended', version=8, params=_params) _params['args'] = args reply = await self.rpc(msg) return reply @ReturnMapping(None) async def Unexpose(self, application): ''' application : str Returns -> None ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='Unexpose', version=8, params=_params) _params['application'] = application reply = await self.rpc(msg) return reply @ReturnMapping(None) async def Unset(self, application, options): ''' application : str options : typing.Sequence[str] Returns -> None ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='Unset', version=8, params=_params) _params['application'] = application _params['options'] = options reply = await self.rpc(msg) return reply @ReturnMapping(ErrorResults) async def UnsetApplicationsConfig(self, args): ''' args : typing.Sequence[~ApplicationUnset] Returns -> typing.Sequence[~ErrorResult] ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='UnsetApplicationsConfig', version=8, params=_params) _params['Args'] = args reply = await self.rpc(msg) return reply @ReturnMapping(None) async def Update(self, application, charm_url, constraints, force_charm_url, force_series, min_units, settings, settings_yaml): ''' application : str charm_url : str constraints : Value force_charm_url : bool force_series : bool min_units : int settings : typing.Mapping[str, str] settings_yaml : str Returns -> None ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='Update', version=8, params=_params) _params['application'] = application _params['charm-url'] = charm_url _params['constraints'] = constraints _params['force-charm-url'] = force_charm_url _params['force-series'] = force_series _params['min-units'] = min_units _params['settings'] = settings _params['settings-yaml'] = settings_yaml reply = await self.rpc(msg) return reply @ReturnMapping(ErrorResults) async def UpdateApplicationSeries(self, args): ''' args : typing.Sequence[~UpdateSeriesArg] Returns -> typing.Sequence[~ErrorResult] ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='UpdateApplicationSeries', version=8, params=_params) _params['args'] = args reply = await self.rpc(msg) return reply @ReturnMapping(NotifyWatchResult) async def WatchLXDProfileUpgradeNotifications(self, tag): ''' tag : str Returns -> typing.Union[str, _ForwardRef('Error')] ''' # map input types to rpc msg _params = dict() msg = dict(type='Application', request='WatchLXDProfileUpgradeNotifications', version=8, params=_params) _params['tag'] = tag reply = await self.rpc(msg) return reply
57.057858
163
0.357113
3,627
72,977
7.134546
0.07582
0.051011
0.102794
0.038258
0.532287
0.489972
0.407157
0.334544
0.302894
0.294431
0
0.000976
0.522397
72,977
1,278
164
57.102504
0.741464
0.013977
0
0.566057
1
0
0.253978
0.061123
0
0
0
0
0
1
0
false
0
0.002033
0
0.039634
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
ea06238c6c6f8de7ed088df9c80dadbb3372a8f9
1,277
py
Python
GUI/Generic/GTasks.py
gcewing/PyGUI
58c6c38ccb8e66acdf98dea6b24bef1d9a03147c
[ "MIT" ]
9
2019-07-15T19:03:27.000Z
2021-11-24T19:50:02.000Z
GUI/Generic/GTasks.py
mnabeelp/PyGUI
58c6c38ccb8e66acdf98dea6b24bef1d9a03147c
[ "MIT" ]
3
2019-09-11T13:22:10.000Z
2020-08-19T20:13:00.000Z
GUI/Generic/GTasks.py
mnabeelp/PyGUI
58c6c38ccb8e66acdf98dea6b24bef1d9a03147c
[ "MIT" ]
4
2020-02-23T16:50:06.000Z
2022-02-10T07:15:35.000Z
# # PyGUI - Tasks - Generic # from GUI.Properties import Properties, overridable_property class Task(Properties): """A Task represents an action to be performed after a specified time interval, either once or repeatedly. Constructor: Task(proc, interval, repeat = False, start = True) Creates a task to call the given proc, which should be a callable object of no arguments, after the specified interval in seconds from the time the task is scheduled. If repeat is true, the task will be automatically re-scheduled each time the proc is called. If start is true, the task will be automatically scheduled upon creation; otherwise the start() method must be called to schedule the task. """ interval = overridable_property('interval', "Time in seconds between firings") repeat = overridable_property('repeat', "Whether to fire repeatedly or once only") def __del__(self): self.stop() scheduled = overridable_property('scheduled', "True if the task is currently scheduled. Read-only.") def start(self): """Schedule the task if it is not already scheduled.""" raise NotImplementedError("GUI.Task.start") def stop(self): """Unschedules the task if it is currently scheduled.""" raise NotImplementedError("GUI.Task.stop")
33.605263
83
0.740799
179
1,277
5.240223
0.424581
0.052239
0.01919
0.027719
0.181237
0.06823
0.06823
0
0
0
0
0
0.179327
1,277
37
84
34.513514
0.895038
0.639781
0
0
0
0
0.320225
0
0
0
0
0
0
1
0.25
false
0
0.083333
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
ea410dc0122ec7353bc207c7a8f3f53b18676252
2,918
py
Python
Communal.Network.v.py
HolocronFoundation/Communal.Network
41eff8ac3ca54897f19cd584e1cfc58f9326ab80
[ "CC0-1.0" ]
1
2019-03-08T18:41:26.000Z
2019-03-08T18:41:26.000Z
Communal.Network.v.py
HolocronFoundation/Communal.Network
41eff8ac3ca54897f19cd584e1cfc58f9326ab80
[ "CC0-1.0" ]
null
null
null
Communal.Network.v.py
HolocronFoundation/Communal.Network
41eff8ac3ca54897f19cd584e1cfc58f9326ab80
[ "CC0-1.0" ]
null
null
null
item: event({channel_index: indexed(uint256), reply_to_index: indexed(uint256), metadata: indexed(uint256)}) # item_index is the index of the sent item in C.N. # TODO: Implement channeling # Channel management struct channel: owner: address name_display: bytes32 name_unique: bytes32 # TODO: finish implementing about: bytes32 css: bytes32 js: bytes32 channels: map(uint256, channel) channel_last_opened: public(uint256) # TODO: Is there functionality which is more core than "reply" last_item_index: public(uint256) item_metadata: public(map(uint256, uint256)) # TODO: Check this is implemented correctly # outer address is the authorizing user owner: constant(address) = 0xd015FB4e0c7f2D0592fa642189a70ce46C90d612 custom_metadata_mask: constant(uint256) = 2 ** (12*8+1) - 1 - 2 # Fills 12 bytes with F, then sets the second to last bit to 0 TODO: Double check this math # TODO: Add owner/management functions - most notably update functionality # Helper methods - used across several disparate paths @public @constant def prep_custom_metadata(custom_metadata: uint256) -> uint256: return bitwise_and(custom_metadata, custom_metadata_mask) @public @constant def generate_metadata(sender: address, other_metadata: uint256) -> uint256: # Default_metadata is 1 bit. # The right bit represents if an item is an IPFS hash of form Qm (sha2-256). This bit is set automatically if there is no metadata sent by the user, but must be set manually if the user sends metadata. # Should this change in the future or you want to do something # different now, you should trigger this flag, but also use custom # metadata to indicate this difference. return shift(convert(sender, uint256), 96) + other_metadata # Functions which feed into check_item_then_iterate_last_item, log.item, and generate_metadata @private def send_item(channel: uint256, reply_to_index: uint256, sender: address, metadata: uint256): assert reply_to_index <= self.last_item_index self.last_item_index += 1 self.item_metadata[self.last_item_index] = self.generate_metadata(sender, metadata) log.item(channel, reply_to_index, item_metadata[self.last_item_index]) # Functions which feed into send_item @public @payable def send_message_user(item: bytes32, channel: uint256, reply_to_index: uint256 = 0): self.send_item(channel, reply_to_index, msg.sender, 0) @public @payable def send_hash_user(item: bytes32, channel: uint256, reply_to_index: uint256 = 0): self.send_item(channel, reply_to_index, msg.sender, 1) @public @payable def send_item_user_with_metadata(item: bytes32, channel: uint256, custom_metadata: uint256, reply_to_index: uint256 = 0): self.send_item(channel, reply_to_index, msg.sender, self.prep_custom_metadata(custom_metadata)) ### Withdraw donations functionality ### @public def withdraw(): send(owner, self.balance)
39.972603
207
0.765593
419
2,918
5.150358
0.338902
0.032437
0.055607
0.044022
0.215941
0.1557
0.113531
0.113531
0.113531
0.113531
0
0.055916
0.154215
2,918
72
208
40.527778
0.818477
0.360521
0
0.255814
0
0
0
0
0
0
0.022839
0.013889
0.023256
0
null
null
0
0
null
null
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
1
0
0
0
0
0
0
0
0
2
ea4c67653d6bf178d84a235b1ed66aa70ed28be1
519
py
Python
demos/reusable/hello/src/hello/web/tests/test_views.py
akornatskyy/wheezy.web
417834db697cf1f78f3a60cc880b9fd25d40c6de
[ "MIT" ]
17
2020-08-29T18:45:51.000Z
2022-03-02T19:37:13.000Z
demos/reusable/hello/src/hello/web/tests/test_views.py
akornatskyy/wheezy.web
417834db697cf1f78f3a60cc880b9fd25d40c6de
[ "MIT" ]
29
2020-07-18T04:34:03.000Z
2021-07-06T09:42:36.000Z
demos/reusable/hello/src/hello/web/tests/test_views.py
akornatskyy/wheezy.web
417834db697cf1f78f3a60cc880b9fd25d40c6de
[ "MIT" ]
1
2022-03-14T08:41:42.000Z
2022-03-14T08:41:42.000Z
import unittest from app import main from wheezy.http.functional import WSGIClient path_for = main.options["path_for"] class HelloTestCase(unittest.TestCase): def setUp(self): self.client = WSGIClient(main) def tearDown(self): self.client = None def path_for(self, name, **kwargs): return "/" + path_for("hello:" + name, **kwargs) def test_welcome(self): assert 200 == self.client.get(self.path_for("welcome")) assert "Hello World!" in self.client.content
23.590909
63
0.666667
67
519
5.074627
0.492537
0.102941
0.082353
0
0
0
0
0
0
0
0
0.007335
0.211946
519
21
64
24.714286
0.823961
0
0
0
0
0
0.065511
0
0
0
0
0
0.142857
1
0.285714
false
0
0.214286
0.071429
0.642857
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
ea50fbdd5b47c4790c000e6a763c6ba66c891802
763
py
Python
chat/models.py
horsehair/unimate
13fd7336307120ea36ff7eb8a28f6d1966222130
[ "MIT" ]
null
null
null
chat/models.py
horsehair/unimate
13fd7336307120ea36ff7eb8a28f6d1966222130
[ "MIT" ]
null
null
null
chat/models.py
horsehair/unimate
13fd7336307120ea36ff7eb8a28f6d1966222130
[ "MIT" ]
null
null
null
from django.db import models from django.db.models import Model, TextField, DateTimeField, ForeignKey, CASCADE from accounts.models import User from rooms.models import Room # Create your models here. class MessageModel(Model): """ This class represents a chat message. It has a owner (user), timestamp and the message body. """ user = ForeignKey(User, on_delete=CASCADE, verbose_name='user', related_name='from_user', db_index=True) room = ForeignKey(Room, on_delete=CASCADE, verbose_name='room', related_name='to_room', db_index=True) timestamp = DateTimeField('timestamp', auto_now_add=True, editable=False, db_index=True) body = TextField('body')
40.157895
81
0.671035
95
763
5.252632
0.463158
0.072144
0.066132
0.088176
0.104208
0
0
0
0
0
0
0
0.235911
763
18
82
42.388889
0.855918
0.154653
0
0
0
0
0.0592
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.75
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
ea5e0c05fc5fd1bd126ce33ac9399b17f9572400
6,349
py
Python
server/app/models.py
ju1115kr/hash-brown
93c5e636404608c7cba889cc9f9e0f3d3d0723b2
[ "Apache-2.0" ]
4
2018-06-27T10:28:54.000Z
2020-03-15T10:44:37.000Z
server/app/models.py
ju1115kr/hash-brown
93c5e636404608c7cba889cc9f9e0f3d3d0723b2
[ "Apache-2.0" ]
9
2018-06-27T10:29:37.000Z
2021-12-13T19:48:39.000Z
server/app/models.py
ju1115kr/hash-brown
93c5e636404608c7cba889cc9f9e0f3d3d0723b2
[ "Apache-2.0" ]
2
2018-07-04T16:54:20.000Z
2018-07-04T16:58:36.000Z
# -*- coding: utf-8 -*- from flask import url_for, current_app, g from werkzeug import secure_filename from werkzeug.security import generate_password_hash, check_password_hash from itsdangerous import TimedJSONWebSignatureSerializer as Serializer from . import db from app.exceptions import ValidationError from datetime import datetime # 유저-뉴스 간 Many-to-Many 관계 테이블 class Star(db.Model): __tablename__ = 'stars' user_id = db.Column(db.Integer, db.ForeignKey('users.id'), primary_key=True) news_id = db.Column(db.Integer, db.ForeignKey('news.id'), primary_key=True) timestamp = db.Column(db.DateTime, default=datetime.utcnow) class User(db.Model): __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(64), unique=True, index=True) ethereum_id = db.Column(db.Text) realname = db.Column(db.Text) password_hash = db.Column(db.String(128)) tier = db.Column(db.Integer) balance = db.Column(db.Integer) stars = db.relationship('Star', foreign_keys=[Star.user_id], backref=db.backref('user', lazy='joined'), lazy='dynamic', cascade='all, delete-orphan') news = db.relationship('News', backref='author', lazy='dynamic') def __init__(self, username, realname, password): self.username = username self.realname = realname self.password = password self.balance = 0 self.tier = 0 def __repr__(self): return '<User %r[%r]>' % (self.username, self.realname) @property def password(self): # password 맴버 변수 직접 접근 차단 raise AttributeError('password is not a readable attrubute') @property def is_authenticated(self): return True @password.setter def password(self, password): self.password_hash = generate_password_hash(password) def verify_password(self, password): return check_password_hash(self.password_hash, password) @staticmethod def generate_auth_token(self, expiration): s = Serializer(current_app.config['SECRET_KEY'], expires_in=expiration) return s.dumps({'id': self.id}) @staticmethod def verify_auth_token(token): s = Serializer(current_app.config['SECRET_KEY']) try: data = s.loads(token) except: return None return User.query.get(data['id']) def to_json(self): # json 출력 루틴 json_user = { 'id': self.id, 'username': self.username, 'realname': self.realname, 'ethereum_id': self.ethereum_id, 'tier': self.tier, 'balance': self.balance, 'stars': [ star.news_id for star in self.stars ], 'starcount': self.stars.count(), } return json_user @staticmethod def from_json(json_user): # json 입력 루틴 user_id = json_user.get('id') user_pw = json_user.get('pw') user_name = json_user.get('name') if user_id is None or user_id == '': raise ValidationError('user does not have a id') elif user_pw is None or user_pw == '': raise ValidationError('user does not have a pw') elif user_name is None or user_name == '': raise ValidationError('user does not have a name') return User(username=user_id, realname=user_name, password=user_pw) class News(db.Model): __tablename__ = 'news' id = db.Column(db.Integer, primary_key=True) author_id = db.Column(db.Integer, db.ForeignKey('users.id')) field = db.Column(db.Text) title = db.Column(db.Text) context = db.Column(db.Text, nullable=False) parsed_context = db.Column(db.Text) created_at = db.Column(db.DateTime, index=True, default=datetime.utcnow) parent_id = db.Column(db.Integer, db.ForeignKey('news.id')) associated = db.relationship('News', lazy='dynamic') refutation = db.Column(db.Boolean) stars = db.relationship('Star', foreign_keys=[Star.news_id], backref=db.backref('news', lazy='joined'), lazy='dynamic', cascade='all, delete-orphan') def __init__(self, field, title, context, parsed_context, author=None): self.field = field self.title = title self.context = context self.parsed_context = parsed_context if author is not None: self.author_name = author.realname self.author = author def __repr__(self): return '<News [%r](%r):%r>' % (self.created_at, self.author_id, self.context) def to_json(self): # json 출력 루틴 json_news = { 'id': self.id, 'author': self.author.username, 'author_name': self.author.realname, 'field': self.field, 'title': self. title, 'context': self.context, 'created_at': self.created_at, 'parent_id': self.parent_id, 'refutation': self.refutation, 'stars': [ star.user_id for star in self.stars ], 'starcount': self.stars.count(), 'associated_reply': self.associated.count() } return json_news @staticmethod def from_json(json_news): # json 입력 루틴 field = json_news.get('field') title = json_news.get('title') context = json_news.get('context') if field is None or field == '': raise ValidationError('news does not have a field') if title is None or title == '': raise ValidationError('news does not have a title') if context is None or context == '': raise ValidationError('news does not have a context') parsed_context = removeEscapeChar(context).lower() news = News(field=field, title=title, context=context, parsed_context=parsed_context) return news def removeEscapeChar(context): #Frontsize의 HTML 태그 제거 import re str = re.sub("(<([^>]+)>)", "", context) str = str.replace('&nbsp;', "").replace('&lt;', "<").replace('&gt;', ">")\ .replace('&amp;', "&").replace('&quot;', '"') return str
35.272222
93
0.599779
766
6,349
4.821149
0.203655
0.041159
0.051449
0.036826
0.245329
0.219334
0.217168
0.118603
0.063905
0.023287
0
0.001747
0.278784
6,349
179
94
35.469274
0.804761
0.021736
0
0.161074
1
0
0.09771
0
0
0
0
0
0
1
0.100671
false
0.080537
0.053691
0.026846
0.42953
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
ea668e4c3f0055d09aecf153fc4a7af6e486eded
388
py
Python
factor_vae/types.py
kiwi0fruit/jats-semi-supervised-pytorch
67e9bb85f09f8ef02e17e495784d1d9a71c3adec
[ "MIT" ]
null
null
null
factor_vae/types.py
kiwi0fruit/jats-semi-supervised-pytorch
67e9bb85f09f8ef02e17e495784d1d9a71c3adec
[ "MIT" ]
null
null
null
factor_vae/types.py
kiwi0fruit/jats-semi-supervised-pytorch
67e9bb85f09f8ef02e17e495784d1d9a71c3adec
[ "MIT" ]
null
null
null
from typing import Tuple from abc import abstractmethod from torch import Tensor from torch.nn import Module class BaseDiscriminator(Module): @abstractmethod def forward_(self, z: Tensor) -> Tuple[Tensor, Tensor]: raise NotImplementedError def forward(self, z: Tensor) -> Tuple[Tensor, Tensor]: # pylint: disable=arguments-differ return self.forward_(z=z)
27.714286
94
0.729381
48
388
5.854167
0.479167
0.064057
0.099644
0.106762
0.270463
0.270463
0.270463
0.270463
0
0
0
0
0.185567
388
13
95
29.846154
0.889241
0.082474
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0.4
0.1
0.8
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
ea7787caeef8cdf78dfed953bd54966edcd2ae6e
150
py
Python
deepstreampy/constants/call_state.py
sapid/deepstreampy-twisted
78025141bb0ac3aadc248d68f9273bf8993fc3d4
[ "MIT" ]
null
null
null
deepstreampy/constants/call_state.py
sapid/deepstreampy-twisted
78025141bb0ac3aadc248d68f9273bf8993fc3d4
[ "MIT" ]
null
null
null
deepstreampy/constants/call_state.py
sapid/deepstreampy-twisted
78025141bb0ac3aadc248d68f9273bf8993fc3d4
[ "MIT" ]
null
null
null
INITIAL = 'INITIAL' CONNECTING = 'CONNECTING' ESTABLISHED = 'ESTABLISHED' ACCEPTED = 'ACCEPTED' DECLINED = 'DECLINED' ENDED = 'ENDED' ERROR = 'ERROR'
18.75
27
0.72
14
150
7.714286
0.5
0
0
0
0
0
0
0
0
0
0
0
0.14
150
7
28
21.428571
0.837209
0
0
0
0
0
0.36
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
ea78ba9051ae04427d4f22dd53746203619b8ac9
369
py
Python
app/__init__.py
abhishtagatya/pandubot
ec0f20b31fc61b5581753711d774213bbf70d438
[ "MIT" ]
1
2018-08-29T12:03:06.000Z
2018-08-29T12:03:06.000Z
app/__init__.py
abhishtagatya/pandubot
ec0f20b31fc61b5581753711d774213bbf70d438
[ "MIT" ]
null
null
null
app/__init__.py
abhishtagatya/pandubot
ec0f20b31fc61b5581753711d774213bbf70d438
[ "MIT" ]
null
null
null
import os import sys from instance.config import DATABASE_URI from flask import Flask from flask_sqlalchemy import SQLAlchemy from flask_compress import Compress app = Flask(__name__) Compress(app) app.config['SQLALCHEMY_DATABASE_URI'] = DATABASE_URI app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False db = SQLAlchemy(app) from app import bot from app import web
20.5
52
0.821138
53
369
5.490566
0.358491
0.113402
0.130584
0
0
0
0
0
0
0
0
0
0.121951
369
17
53
21.705882
0.898148
0
0
0
0
0
0.143631
0.143631
0
0
0
0
0
1
0
false
0
0.615385
0
0.615385
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
ea83c30edcb40ded19cfef34c991c3cc46a06772
2,099
py
Python
app/purchases.py
thowell332/Mini-Amazon
927c387d569aef00275b7d6ecaae891fc16025e9
[ "MIT" ]
null
null
null
app/purchases.py
thowell332/Mini-Amazon
927c387d569aef00275b7d6ecaae891fc16025e9
[ "MIT" ]
null
null
null
app/purchases.py
thowell332/Mini-Amazon
927c387d569aef00275b7d6ecaae891fc16025e9
[ "MIT" ]
null
null
null
from re import S from flask import render_template, redirect, url_for, flash, request from flask_paginate import Pagination, get_page_parameter from flask_login import current_user from flask_wtf import FlaskForm from wtforms import SubmitField from flask_babel import _, lazy_gettext as _l from flask_login import current_user from .models.purchase import Purchase, PurchaseSummary, PurchaseEntry from .models.user import User from flask import Blueprint bp = Blueprint('purchases', __name__) # Route to show a user's past purchases. @bp.route('/purchases', methods=['GET', 'POST']) def purchases(): # Set up pagination. page = request.args.get(get_page_parameter(), type=int, default=1) per_page = 10 start = (page - 1) * per_page # If user is not logged in, redirect. if not current_user.is_authenticated: return redirect(url_for('users.login')) seller_status = User.sellerStatus(current_user.id) # Get list of past purchases. past_purchases = Purchase._get_purchases(current_user.id) pagination = Pagination(page=page, per_page=per_page, total=len(past_purchases), record_name='products') return render_template('purchases.html', purchases=past_purchases[start: start + per_page], pagination=pagination, seller_status=seller_status) # Route to show a specific order. @bp.route('/individual-purchase<purchase_id>', methods=['GET', 'POST']) def individual_purchase(purchase_id): # If user is not logged in, redirect. if not current_user.is_authenticated: return redirect(url_for('users.login')) seller_status = User.sellerStatus(current_user.id) # Get all entries in the purchase and the total price. purchase_entries = Purchase._get_individual_purchase(current_user.id, purchase_id) total_price_paid = Purchase._get_total_purchase_cost(current_user.id, purchase_id) total_price_paid = ('%.2f'%total_price_paid) return render_template('individualPurchase.html', purchase_id=purchase_id, purchase_entries=purchase_entries, total_price_paid=total_price_paid, seller_status=seller_status)
41.98
177
0.769414
291
2,099
5.285223
0.295533
0.064369
0.042263
0.026008
0.26528
0.26528
0.26528
0.219766
0.171652
0.171652
0
0.002773
0.14102
2,099
50
177
41.98
0.85025
0.115293
0
0.25
0
0
0.074054
0.03027
0
0
0
0
0
1
0.0625
false
0
0.34375
0
0.53125
0.0625
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
ea9175a6523f472b33f34201baced746430025fa
290
py
Python
regphot/pyprofit.py
raphaelshirley/regphot
05b382e5360099dadd7599187b5f25c1fcbd5a61
[ "MIT" ]
null
null
null
regphot/pyprofit.py
raphaelshirley/regphot
05b382e5360099dadd7599187b5f25c1fcbd5a61
[ "MIT" ]
null
null
null
regphot/pyprofit.py
raphaelshirley/regphot
05b382e5360099dadd7599187b5f25c1fcbd5a61
[ "MIT" ]
null
null
null
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Wed Feb 1 17:13:54 2017 Should have similar functions as galfit and allow a model object to use functions to calculate chisq and optimse using standard optimisation. @author: rs548 """ import pyprofit def optimise():
18.125
85
0.713793
44
290
4.704545
0.931818
0
0
0
0
0
0
0
0
0
0
0.068085
0.189655
290
15
86
19.333333
0.812766
0.148276
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0.5
null
null
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
2
ea9198eb50dfdf75e05b7e2f2c6b062c8ea681fb
6,061
py
Python
chrome/common/extensions/docs/server2/branch_utility_test.py
pozdnyakov/chromium-crosswalk
0fb25c7278bf1d93e53a3b0bcb75aa8b99d4b26e
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
chrome/common/extensions/docs/server2/branch_utility_test.py
pozdnyakov/chromium-crosswalk
0fb25c7278bf1d93e53a3b0bcb75aa8b99d4b26e
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
chrome/common/extensions/docs/server2/branch_utility_test.py
pozdnyakov/chromium-crosswalk
0fb25c7278bf1d93e53a3b0bcb75aa8b99d4b26e
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os import sys import unittest from branch_utility import BranchUtility from fake_url_fetcher import FakeUrlFetcher from object_store_creator import ObjectStoreCreator class BranchUtilityTest(unittest.TestCase): def setUp(self): self._branch_util = BranchUtility( os.path.join('branch_utility', 'first.json'), os.path.join('branch_utility', 'second.json'), FakeUrlFetcher(os.path.join(sys.path[0], 'test_data')), ObjectStoreCreator.ForTest()) def testSplitChannelNameFromPath(self): self.assertEquals(('stable', 'extensions/stuff.html'), self._branch_util.SplitChannelNameFromPath( 'stable/extensions/stuff.html')) self.assertEquals(('dev', 'extensions/stuff.html'), self._branch_util.SplitChannelNameFromPath( 'dev/extensions/stuff.html')) self.assertEquals(('beta', 'extensions/stuff.html'), self._branch_util.SplitChannelNameFromPath( 'beta/extensions/stuff.html')) self.assertEquals(('trunk', 'extensions/stuff.html'), self._branch_util.SplitChannelNameFromPath( 'trunk/extensions/stuff.html')) self.assertEquals((None, 'extensions/stuff.html'), self._branch_util.SplitChannelNameFromPath( 'extensions/stuff.html')) self.assertEquals((None, 'apps/stuff.html'), self._branch_util.SplitChannelNameFromPath( 'apps/stuff.html')) self.assertEquals((None, 'extensions/dev/stuff.html'), self._branch_util.SplitChannelNameFromPath( 'extensions/dev/stuff.html')) self.assertEquals((None, 'stuff.html'), self._branch_util.SplitChannelNameFromPath( 'stuff.html')) def testNewestChannel(self): self.assertEquals('trunk', self._branch_util.NewestChannel(('trunk', 'dev', 'beta', 'stable'))) self.assertEquals('trunk', self._branch_util.NewestChannel(('stable', 'beta', 'dev', 'trunk'))) self.assertEquals('dev', self._branch_util.NewestChannel(('stable', 'beta', 'dev'))) self.assertEquals('dev', self._branch_util.NewestChannel(('dev', 'beta', 'stable'))) self.assertEquals('beta', self._branch_util.NewestChannel(('beta', 'stable'))) self.assertEquals('beta', self._branch_util.NewestChannel(('stable', 'beta'))) self.assertEquals('stable', self._branch_util.NewestChannel(('stable',))) self.assertEquals('beta', self._branch_util.NewestChannel(('beta',))) self.assertEquals('dev', self._branch_util.NewestChannel(('dev',))) self.assertEquals('trunk', self._branch_util.NewestChannel(('trunk',))) def testGetChannelInfo(self): self.assertEquals('trunk', self._branch_util.GetChannelInfo('trunk').channel) self.assertEquals('trunk', self._branch_util.GetChannelInfo('trunk').branch) self.assertEquals('trunk', self._branch_util.GetChannelInfo('trunk').version) self.assertEquals('dev', self._branch_util.GetChannelInfo('dev').channel) self.assertEquals(1500, self._branch_util.GetChannelInfo('dev').branch) self.assertEquals(28, self._branch_util.GetChannelInfo('dev').version) self.assertEquals('beta', self._branch_util.GetChannelInfo('beta').channel) self.assertEquals(1453, self._branch_util.GetChannelInfo('beta').branch) self.assertEquals(27, self._branch_util.GetChannelInfo('beta').version) self.assertEquals('stable', self._branch_util.GetChannelInfo('stable').channel) self.assertEquals(1410, self._branch_util.GetChannelInfo('stable').branch) self.assertEquals(26, self._branch_util.GetChannelInfo('stable').version) def testGetLatestVersionNumber(self): self.assertEquals(28, self._branch_util.GetLatestVersionNumber()) def testGetBranchForVersion(self): self.assertEquals(1453, self._branch_util.GetBranchForVersion(27)) self.assertEquals(1410, self._branch_util.GetBranchForVersion(26)) self.assertEquals(1364, self._branch_util.GetBranchForVersion(25)) self.assertEquals(1312, self._branch_util.GetBranchForVersion(24)) self.assertEquals(1271, self._branch_util.GetBranchForVersion(23)) self.assertEquals(1229, self._branch_util.GetBranchForVersion(22)) self.assertEquals(1180, self._branch_util.GetBranchForVersion(21)) self.assertEquals(1132, self._branch_util.GetBranchForVersion(20)) self.assertEquals(1084, self._branch_util.GetBranchForVersion(19)) self.assertEquals(1025, self._branch_util.GetBranchForVersion(18)) self.assertEquals(963, self._branch_util.GetBranchForVersion(17)) self.assertEquals(696, self._branch_util.GetBranchForVersion(11)) self.assertEquals(396, self._branch_util.GetBranchForVersion(5)) def testGetChannelForVersion(self): self.assertEquals('trunk', self._branch_util.GetChannelForVersion('trunk')) self.assertEquals('dev', self._branch_util.GetChannelForVersion(28)) self.assertEquals('beta', self._branch_util.GetChannelForVersion(27)) self.assertEquals('stable', self._branch_util.GetChannelForVersion(26)) self.assertEquals('stable', self._branch_util.GetChannelForVersion(22)) self.assertEquals('stable', self._branch_util.GetChannelForVersion(18)) self.assertEquals('stable', self._branch_util.GetChannelForVersion(14)) self.assertEquals(None, self._branch_util.GetChannelForVersion(30)) self.assertEquals(None, self._branch_util.GetChannelForVersion(42)) if __name__ == '__main__': unittest.main()
41.513699
77
0.683881
606
6,061
6.635314
0.19967
0.134295
0.188013
0.10669
0.614275
0.501119
0.355882
0.133549
0.042527
0
0
0.023364
0.187923
6,061
145
78
41.8
0.79358
0.029698
0
0.253846
0
0
0.115875
0.047984
0
0
0
0
0.407692
1
0.053846
false
0
0.046154
0
0.107692
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
2
ea99720b3ead320ff8f07f3efbaae5fb0d1681fb
94
py
Python
aiida_icl/__init__.py
chrisjsewell/aiida-cx1scheduler
fd9a1723f65d3858aee678bf035a7b63a03c5885
[ "MIT" ]
null
null
null
aiida_icl/__init__.py
chrisjsewell/aiida-cx1scheduler
fd9a1723f65d3858aee678bf035a7b63a03c5885
[ "MIT" ]
null
null
null
aiida_icl/__init__.py
chrisjsewell/aiida-cx1scheduler
fd9a1723f65d3858aee678bf035a7b63a03c5885
[ "MIT" ]
2
2020-07-01T07:43:13.000Z
2020-07-07T20:00:02.000Z
""" AiiDA Plugin Template Adapt this template for your own needs. """ __version__ = '0.3.4'
11.75
39
0.691489
14
94
4.357143
0.928571
0
0
0
0
0
0
0
0
0
0
0.038961
0.180851
94
7
40
13.428571
0.753247
0.659574
0
0
0
0
0.208333
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
57605a45872280f1b96cf87232eb6af9882ebf02
1,131
py
Python
console/info.py
alexeysp11/sdc-console-python
237ec357b0883d0d033cd0f5609ac8a4f064f86f
[ "MIT" ]
null
null
null
console/info.py
alexeysp11/sdc-console-python
237ec357b0883d0d033cd0f5609ac8a4f064f86f
[ "MIT" ]
null
null
null
console/info.py
alexeysp11/sdc-console-python
237ec357b0883d0d033cd0f5609ac8a4f064f86f
[ "MIT" ]
null
null
null
class Info: """ Allows to print out information about the application. """ def commands(): print('''Main modules: imu | Inertial Measurement Unit (GPS, gyro, accelerometer) gps | GPS gyro | Gyroscope accel | Accelerometer fuzzy | Fuzzy Controller nn | Neural Network test | Unit-tests for each module exit | Exit ''') def help(): print('''SDC CONSOLE APP SDC stands for Self-Driving Cars. So this app allows you to simulate some modules of SDC within a console. All modules can be called by: sdc module --mode All information modules can be called by: sdc -commands sdc -help ''') def imu(): print('''sdc imu: --p | IMU (position) --v | IMU (velocity) --a | IMU (acceleration) ''') def gps(): print('''sdc gps: --p | GPS (position) --v | GPS (velocity) --a | GPS (acceleration) ''')
23.5625
74
0.482759
116
1,131
4.706897
0.525862
0.043956
0.043956
0.065934
0.084249
0.084249
0
0
0
0
0
0
0.422635
1,131
47
75
24.06383
0.836141
0.047745
0
0.117647
0
0
0.825472
0
0
0
0
0
0
1
0.117647
true
0
0
0
0.147059
0.117647
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
577b488a4c6bb95a24f07ede098c7e6465673424
380
py
Python
src/quotes_crawlspider/quotes/items.py
azzamsa/learn-scrapy
8d408763ff0be21fe2e0933b91b4ad1fe082b3ec
[ "MIT" ]
null
null
null
src/quotes_crawlspider/quotes/items.py
azzamsa/learn-scrapy
8d408763ff0be21fe2e0933b91b4ad1fe082b3ec
[ "MIT" ]
null
null
null
src/quotes_crawlspider/quotes/items.py
azzamsa/learn-scrapy
8d408763ff0be21fe2e0933b91b4ad1fe082b3ec
[ "MIT" ]
null
null
null
# Define here the models for your scraped items # # See documentation in: # https://docs.scrapy.org/en/latest/topics/items.html import scrapy class QuotesItem(scrapy.Item): # define the fields for your item here like: author_name = scrapy.Field() author_location = scrapy.Field() author_date = scrapy.Field() text = scrapy.Field() tags = scrapy.Field()
23.75
53
0.705263
52
380
5.096154
0.615385
0.207547
0.128302
0
0
0
0
0
0
0
0
0
0.186842
380
15
54
25.333333
0.857605
0.426316
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.142857
0
1
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
0
0
0
0
0
1
0
0
2
5782896b4d6e5c85e7c0c81d31dbd8cff1438078
453
py
Python
crawlMp/enums.py
domarm-comat/crawlMp
32b66573f351a2f28fcb7ce8627f8605975f76eb
[ "MIT" ]
1
2021-12-03T15:14:36.000Z
2021-12-03T15:14:36.000Z
crawlMp/enums.py
domarm-comat/crawlMp
32b66573f351a2f28fcb7ce8627f8605975f76eb
[ "MIT" ]
2
2021-12-03T16:10:14.000Z
2021-12-03T18:09:33.000Z
crawlMp/enums.py
domarm-comat/crawlMp
32b66573f351a2f28fcb7ce8627f8605975f76eb
[ "MIT" ]
null
null
null
from enum import Enum from typing import Tuple, Type, Optional class Mode(Enum): SIMPLE = "s" EXTENDED = "e" def __str__(self) -> str: return self.value class Header(Enum): PATH = "Path" NAME = "Name" SIZE = "Size" MODIFIED = "Modified" ACCESSED = "Accessed" INPUT = "Input" OUTPUT = "Output" def __str__(self) -> str: return self.value Header_ref = Tuple[Header, Type, Optional[str]]
16.777778
47
0.602649
55
453
4.8
0.490909
0.090909
0.075758
0.098485
0.212121
0.212121
0.212121
0
0
0
0
0
0.278146
453
26
48
17.423077
0.807339
0
0
0.222222
0
0
0.090508
0
0
0
0
0
0
1
0.111111
false
0
0.111111
0.111111
0.944444
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
2