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
7c33f5d3965a82500aea5886528fb587cb1905ba
447
py
Python
src/utils/helpers.py
solnsumei/claims-management
0a9db243e954fbe390f6f81f64eabd6efa4dcc81
[ "MIT" ]
null
null
null
src/utils/helpers.py
solnsumei/claims-management
0a9db243e954fbe390f6f81f64eabd6efa4dcc81
[ "MIT" ]
null
null
null
src/utils/helpers.py
solnsumei/claims-management
0a9db243e954fbe390f6f81f64eabd6efa4dcc81
[ "MIT" ]
null
null
null
from datetime import datetime from .enums import InvoiceStatus updatable_statuses = [InvoiceStatus.Pending, InvoiceStatus.Verified, InvoiceStatus.Approved] deletable_statuses = [InvoiceStatus.New, InvoiceStatus.Pending, InvoiceStatus.Cancelled] upload_folder = "invoices" def get_claim_folder(date): return f"{date.strftime('%Y/%b')}" def get_date(date_str: str): pass def get_filters(start=None, end=None, status=None): pass
21.285714
92
0.771812
55
447
6.127273
0.581818
0.053412
0.195846
0
0
0
0
0
0
0
0
0
0.123043
447
20
93
22.35
0.859694
0
0
0.181818
0
0
0.071588
0.053691
0
0
0
0
0
1
0.272727
false
0.181818
0.181818
0.090909
0.545455
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
4
7c5195ca5d93f31509fde4ada71cfb110f229bb4
206
py
Python
settings.py
mrrizal/kinesis-learn
d483c9328628b2600f730d5fab1d04e863218161
[ "Unlicense" ]
1
2019-12-20T09:36:46.000Z
2019-12-20T09:36:46.000Z
settings.py
mrrizal/kinesis-learn
d483c9328628b2600f730d5fab1d04e863218161
[ "Unlicense" ]
1
2021-06-02T00:50:39.000Z
2021-06-02T00:50:39.000Z
settings.py
mrrizal/kinesis-learn
d483c9328628b2600f730d5fab1d04e863218161
[ "Unlicense" ]
null
null
null
import os from dotenv import load_dotenv load_dotenv() AWS_ACCESS_KEY_ID = os.getenv('AWS_ACCESS_KEY_ID') AWS_SECRET_KEY = os.getenv('AWS_SECRET_KEY') AWS_DEFAULT_REGION = os.getenv('AWS_DEFAULT_REGION')
22.888889
52
0.815534
35
206
4.342857
0.371429
0.157895
0.217105
0.184211
0
0
0
0
0
0
0
0
0.087379
206
8
53
25.75
0.808511
0
0
0
0
0
0.237864
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
7c6c07404fba19f3ece5545744b038dd5d7b1909
2,576
py
Python
maintenance_mode/settings.py
fpolacov/django-maintenance-mode
ddd222513531165915e32c7e34be1dfbed2b58ce
[ "MIT" ]
null
null
null
maintenance_mode/settings.py
fpolacov/django-maintenance-mode
ddd222513531165915e32c7e34be1dfbed2b58ce
[ "MIT" ]
null
null
null
maintenance_mode/settings.py
fpolacov/django-maintenance-mode
ddd222513531165915e32c7e34be1dfbed2b58ce
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from django.conf import settings from django.utils.module_loading import import_module import os if not hasattr(settings, 'MAINTENANCE_MODE'): settings.MAINTENANCE_MODE = None if not hasattr(settings, 'MAINTENANCE_MODE_GET_CLIENT_IP_ADDRESS'): settings.MAINTENANCE_MODE_GET_CLIENT_IP_ADDRESS = None if not hasattr(settings, 'MAINTENANCE_MODE_GET_TEMPLATE_CONTEXT'): settings.MAINTENANCE_MODE_GET_TEMPLATE_CONTEXT = None if not hasattr(settings, 'MAINTENANCE_MODE_IGNORE_ADMIN_SITE'): settings.MAINTENANCE_MODE_IGNORE_ADMIN_SITE = None if not hasattr(settings, 'MAINTENANCE_MODE_IGNORE_ANONYMOUS_USER'): settings.MAINTENANCE_MODE_IGNORE_ANONYMOUS_USER = False if not hasattr(settings, 'MAINTENANCE_MODE_IGNORE_AUTHENTICATED_USER'): settings.MAINTENANCE_MODE_IGNORE_AUTHENTICATED_USER = False if not hasattr(settings, 'MAINTENANCE_MODE_FOR_USERS_WITH_EMAIL_DOMAIN'): settings.MAINTENANCE_MODE_FOR_USERS_WITH_EMAIL_DOMAIN = [] if not hasattr(settings, 'MAINTENANCE_MODE_IGNORE_IP_ADDRESSES'): settings.MAINTENANCE_MODE_IGNORE_IP_ADDRESSES = None if not hasattr(settings, 'MAINTENANCE_MODE_IGNORE_STAFF'): settings.MAINTENANCE_MODE_IGNORE_STAFF = False if not hasattr(settings, 'MAINTENANCE_MODE_IGNORE_SUPERUSER'): settings.MAINTENANCE_MODE_IGNORE_SUPERUSER = False if not hasattr(settings, 'MAINTENANCE_MODE_IGNORE_TESTS'): settings.MAINTENANCE_MODE_IGNORE_TESTS = False if not hasattr(settings, 'MAINTENANCE_MODE_IGNORE_URLS'): settings.MAINTENANCE_MODE_IGNORE_URLS = None if not hasattr(settings, 'MAINTENANCE_MODE_REDIRECT_URL'): settings.MAINTENANCE_MODE_REDIRECT_URL = None if not hasattr(settings, 'MAINTENANCE_MODE_STATE_BACKEND'): settings.MAINTENANCE_MODE_STATE_BACKEND = 'maintenance_mode.backends.LocalFileBackend' if not hasattr(settings, 'MAINTENANCE_MODE_STATE_FILE_NAME'): settings.MAINTENANCE_MODE_STATE_FILE_NAME = 'maintenance_mode_state.txt' if not hasattr(settings, 'MAINTENANCE_MODE_STATE_FILE_PATH'): settings_module = import_module(os.environ['DJANGO_SETTINGS_MODULE']) settings_path = settings_module.__file__ settings_dir = os.path.dirname(settings_path) settings.MAINTENANCE_MODE_STATE_FILE_PATH = os.path.abspath( os.path.join(os.sep, settings_dir, settings.MAINTENANCE_MODE_STATE_FILE_NAME)) if not hasattr(settings, 'MAINTENANCE_MODE_TEMPLATE'): settings.MAINTENANCE_MODE_TEMPLATE = '503.html' if not hasattr(settings, 'MAINTENANCE_MODE_STATUS_CODE'): settings.MAINTENANCE_MODE_STATUS_CODE = 503
38.447761
90
0.814829
330
2,576
5.912121
0.184848
0.299846
0.436187
0.184521
0.802153
0.652486
0.403895
0.311635
0
0
0
0.003051
0.109472
2,576
66
91
39.030303
0.847428
0.008152
0
0
0
0
0.26557
0.256169
0
0
0
0
0
1
0
false
0
0.090909
0
0.090909
0
0
0
0
null
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
7c6d7c9f30b07aa9eec30f106252cd38674fbe53
152
py
Python
test.py
cldf-datasets/rantanenurageo
8c78b96aece7175277e9083e4e1516a12f7751aa
[ "CC-BY-4.0" ]
null
null
null
test.py
cldf-datasets/rantanenurageo
8c78b96aece7175277e9083e4e1516a12f7751aa
[ "CC-BY-4.0" ]
null
null
null
test.py
cldf-datasets/rantanenurageo
8c78b96aece7175277e9083e4e1516a12f7751aa
[ "CC-BY-4.0" ]
null
null
null
import sys import csv csv.field_size_limit(sys.maxsize) def test_valid(cldf_dataset, cldf_logger): assert cldf_dataset.validate(log=cldf_logger)
16.888889
49
0.809211
24
152
4.833333
0.666667
0.189655
0
0
0
0
0
0
0
0
0
0
0.111842
152
8
50
19
0.859259
0
0
0
0
0
0
0
0
0
0
0
0.2
1
0.2
false
0
0.4
0
0.6
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
7c95728d02b2e8f0a5075dfef693767d3f21e86f
317
py
Python
openghg/store/__init__.py
openghg/openghg
9a05dd6fe3cee6123898b8f390cfaded08dbb408
[ "Apache-2.0" ]
5
2021-03-02T09:04:07.000Z
2022-01-25T09:58:16.000Z
openghg/store/__init__.py
openghg/openghg
9a05dd6fe3cee6123898b8f390cfaded08dbb408
[ "Apache-2.0" ]
229
2020-09-30T15:08:39.000Z
2022-03-31T14:23:55.000Z
openghg/store/__init__.py
openghg/openghg
9a05dd6fe3cee6123898b8f390cfaded08dbb408
[ "Apache-2.0" ]
null
null
null
from ._emissions import Emissions from ._eulerian_model import EulerianModel from ._footprints import Footprints from ._obsmobile import ObsMobile from ._obssurface import ObsSurface from ._metstore import METStore from ._recombination import recombine_datasets, recombine_multisite from ._segment import assign_data
35.222222
67
0.867508
37
317
7.108108
0.459459
0
0
0
0
0
0
0
0
0
0
0
0.104101
317
8
68
39.625
0.926056
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0.125
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
7c9bfb3905e751cb52fa58342258a2c61bcb7b8f
107
py
Python
src/util/getTranscript.py
huytran2khust/liantra
04120d4e1877bd8b9a0bba8fcf89e2c4fa7a1518
[ "MIT" ]
null
null
null
src/util/getTranscript.py
huytran2khust/liantra
04120d4e1877bd8b9a0bba8fcf89e2c4fa7a1518
[ "MIT" ]
2
2021-09-21T09:08:39.000Z
2022-01-22T11:28:01.000Z
src/util/getTranscript.py
huytd2k/liantra
04120d4e1877bd8b9a0bba8fcf89e2c4fa7a1518
[ "MIT" ]
null
null
null
from youtube_transcript_api import YouTubeTranscriptApi YouTubeTranscriptApi.get_transcript('arj7oStGLkU')
35.666667
55
0.906542
10
107
9.4
0.8
0
0
0
0
0
0
0
0
0
0
0.009804
0.046729
107
3
56
35.666667
0.911765
0
0
0
0
0
0.101852
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
7ce252a22c11c18ac7b00ae1b4cc15fa7cb25bd9
1,802
py
Python
nbdev_template/data.py
sachinruk/keraTorch
9fde2c820a6b0b67cbed9990f1b6d8a8e389ccf8
[ "Apache-2.0" ]
4
2020-04-14T02:25:10.000Z
2020-07-09T03:14:25.000Z
nbdev_template/data.py
sachinruk/keraTorch
9fde2c820a6b0b67cbed9990f1b6d8a8e389ccf8
[ "Apache-2.0" ]
3
2020-04-22T06:49:33.000Z
2022-02-26T07:06:30.000Z
nbdev_template/data.py
sachinruk/keraTorch
9fde2c820a6b0b67cbed9990f1b6d8a8e389ccf8
[ "Apache-2.0" ]
1
2020-06-18T14:21:05.000Z
2020-06-18T14:21:05.000Z
# AUTOGENERATED! DO NOT EDIT! File to edit: data.ipynb (unless otherwise specified). __all__ = ['Data', 'TrainData', 'TestData', 'create_db'] # Cell import torch from torch.utils.data import Dataset, DataLoader from fastai.data_block import DataBunch, DatasetType from sklearn.model_selection import train_test_split # import warnings # torch.Tensor.ndim = property(lambda x: x.dim()) # tt = torch.Tensor # Cell class Data(Dataset): """ Load raw x,y data """ def __init__(self, *args): super().__init__() self.data = args def __len__(self): return len(self.data[0]) def __getitem__(self, i): return {f'arg_{i}': torch.Tensor([x[i]]) for i, x in enumerate(self.data)} # Cell class TrainData(Dataset): """ Load raw x,y data """ def __init__(self, x, y): super().__init__() self.x, self.y = x, y def __len__(self): return len(self.x) def __getitem__(self, i): return torch.tensor(self.x[i]), torch.tensor(self.y[i]) class TestData(Dataset): """ Load raw x,y data """ def __init__(self, x): super().__init__() self.x = x def __len__(self): return len(self.x) def __getitem__(self, i): return torch.tensor(self.x[i]) # Cell def create_db(x, y, train_size=0.8, bs=96, random_state=42): """ Take dataframe and convert to Fastai databunch """ X_train, X_test, y_train, y_test = train_test_split(x, y, train_size=train_size) train_ds = TrainData(X_train, y_train) val_ds = TrainData(X_test, y_test) bs = min(bs, len(train_ds)) val_bs = min(bs, len(val_ds)) train_dl = DataLoader(train_ds, bs) val_dl = DataLoader(val_ds, val_bs) return DataBunch(train_dl, val_dl)
22.810127
84
0.625971
264
1,802
3.950758
0.284091
0.038351
0.034516
0.043145
0.252157
0.232023
0.209971
0.209971
0.209971
0.180249
0
0.005117
0.240844
1,802
79
85
22.810127
0.75731
0.158713
0
0.282051
1
0
0.025535
0
0
0
0
0
0
1
0.25641
false
0
0.102564
0.153846
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
1
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
7ce5cc56081ec14198c967a55585d6748a980bad
70
py
Python
authlib/specs/rfc7518/jws_algorithms.py
tk193192/authlib
4c60a628f64c6d385a06ea55e416092726b94d07
[ "BSD-3-Clause" ]
2
2021-04-26T18:17:37.000Z
2021-04-28T21:39:45.000Z
authlib/specs/rfc7518/jws_algorithms.py
tk193192/authlib
4c60a628f64c6d385a06ea55e416092726b94d07
[ "BSD-3-Clause" ]
4
2021-03-19T08:17:59.000Z
2021-06-10T19:34:36.000Z
authlib/specs/rfc7518/jws_algorithms.py
tk193192/authlib
4c60a628f64c6d385a06ea55e416092726b94d07
[ "BSD-3-Clause" ]
2
2021-05-24T20:34:12.000Z
2022-03-26T07:46:17.000Z
from authlib.jose import JWS_ALGORITHMS __all__ = ['JWS_ALGORITHMS']
17.5
39
0.8
9
70
5.555556
0.777778
0.52
0
0
0
0
0
0
0
0
0
0
0.114286
70
3
40
23.333333
0.806452
0
0
0
0
0
0.2
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
6b300d7d324deab797edf61006cd3812cac4ae03
223
py
Python
jupyter/DEBUG/MATH.py
colinsheppard/beam
d823c34bb6ce64a680675864618c76309322ec3d
[ "BSD-3-Clause-LBNL" ]
null
null
null
jupyter/DEBUG/MATH.py
colinsheppard/beam
d823c34bb6ce64a680675864618c76309322ec3d
[ "BSD-3-Clause-LBNL" ]
null
null
null
jupyter/DEBUG/MATH.py
colinsheppard/beam
d823c34bb6ce64a680675864618c76309322ec3d
[ "BSD-3-Clause-LBNL" ]
null
null
null
#!/usr/bin/env python # coding: utf-8 # In[5]: 1 + 1 * 2 # In[4]: 20 // 3 + 20 // 7 ** 2 # In[2]: import random 4 + random.randint(10, 100) # In[5]: import random 4 + random.randint(10, 100) # In[ ]:
6.027027
27
0.497758
38
223
2.921053
0.526316
0.054054
0.234234
0.342342
0.594595
0.594595
0.594595
0.594595
0
0
0
0.170886
0.29148
223
36
28
6.194444
0.531646
0.309417
0
0.666667
0
0
0
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
860dddce693f6b331df7819fedd5b27a87806f53
222
py
Python
lino_book/projects/anna/lib/__init__.py
lino-framework/lino_book
4eab916832cd8f48ff1b9fc8c2789f0b437da0f8
[ "BSD-2-Clause" ]
3
2016-08-25T05:58:09.000Z
2019-12-05T11:13:45.000Z
lino_book/projects/anna/lib/__init__.py
lino-framework/lino_book
4eab916832cd8f48ff1b9fc8c2789f0b437da0f8
[ "BSD-2-Clause" ]
18
2016-11-12T21:38:58.000Z
2019-12-03T17:54:38.000Z
lino_book/projects/anna/lib/__init__.py
lino-framework/lino_book
4eab916832cd8f48ff1b9fc8c2789f0b437da0f8
[ "BSD-2-Clause" ]
9
2016-10-15T11:12:33.000Z
2021-09-22T04:37:37.000Z
# -*- coding: UTF-8 -*- # Copyright 2016 Rumma & Ko Ltd # License: BSD (see file COPYING for details) """Fixtures specific for Lino Care. .. autosummary:: :toctree: tickets """ from lino_xl.lib.tickets import *
14.8
45
0.657658
29
222
5
0.896552
0
0
0
0
0
0
0
0
0
0
0.028249
0.202703
222
14
46
15.857143
0.79096
0.774775
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
862d4ef6a76ace5bba6dc244731eae9033303c04
198
py
Python
pmca/usb/driver/windows/__init__.py
kratz00/Sony-PMCA-RE
d646defa2b4755b4006e3def648272b0e22569cd
[ "MIT" ]
1,313
2015-05-13T22:31:44.000Z
2022-03-31T07:34:01.000Z
pmca/usb/driver/windows/__init__.py
kratz00/Sony-PMCA-RE
d646defa2b4755b4006e3def648272b0e22569cd
[ "MIT" ]
289
2015-05-30T17:31:49.000Z
2022-03-31T09:33:48.000Z
pmca/usb/driver/windows/__init__.py
kratz00/Sony-PMCA-RE
d646defa2b4755b4006e3def648272b0e22569cd
[ "MIT" ]
176
2015-07-08T06:30:28.000Z
2022-03-27T20:15:22.000Z
import re def parseDeviceId(id): match = re.search('(#|\\\\)vid_([a-f0-9]{4})&pid_([a-f0-9]{4})(&|#|\\\\)', id, re.IGNORECASE) return [int(match.group(i), 16) if match else None for i in [2, 3]]
33
94
0.585859
36
198
3.166667
0.722222
0.052632
0.070175
0.087719
0
0
0
0
0
0
0
0.057471
0.121212
198
5
95
39.6
0.597701
0
0
0
0
0.25
0.267677
0.267677
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
1
0
0
0
0
0
0
0
1
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
864c8c6f4c77e199e755d6f4f5ef1336ab39c211
40
py
Python
bot/conversation_handlers/stage_constants.py
gerbigtim/coaching_bot
5b4ef6e207a5017f7b4274d8238550b4988d0a6e
[ "MIT" ]
null
null
null
bot/conversation_handlers/stage_constants.py
gerbigtim/coaching_bot
5b4ef6e207a5017f7b4274d8238550b4988d0a6e
[ "MIT" ]
null
null
null
bot/conversation_handlers/stage_constants.py
gerbigtim/coaching_bot
5b4ef6e207a5017f7b4274d8238550b4988d0a6e
[ "MIT" ]
null
null
null
GENDER, PHOTO, LOCATION, BIO = range(4)
20
39
0.7
6
40
4.666667
1
0
0
0
0
0
0
0
0
0
0
0.029412
0.15
40
1
40
40
0.794118
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
8659c6b99cf0e0795f02accba211283214a75d3a
1,986
py
Python
Python/Scheduling/OptionalTest.py
IdkwhatImD0ing/AlgorithmPractice
2d8d68a6d0168e873d61d1e3873e882bcdaf003f
[ "MIT" ]
null
null
null
Python/Scheduling/OptionalTest.py
IdkwhatImD0ing/AlgorithmPractice
2d8d68a6d0168e873d61d1e3873e882bcdaf003f
[ "MIT" ]
null
null
null
Python/Scheduling/OptionalTest.py
IdkwhatImD0ing/AlgorithmPractice
2d8d68a6d0168e873d61d1e3873e882bcdaf003f
[ "MIT" ]
null
null
null
from OptionalScheduling import AND_OR_Scheduler from nose.tools import assert_equal, assert_true from nose.tools import assert_false, assert_almost_equal from Scheduling import DependencyScheduler from collections import defaultdict import networkx as nx # Library for displaying graphs. import matplotlib.pyplot as plt # And Tests s = AND_OR_Scheduler() s.add_and_task('a', ['b', 'c']) assert_equal(s.available_tasks, {'b', 'c'}) r = s.mark_completed('b') assert_equal(r, set()) assert_equal(s.available_tasks, {'c'}) r = s.mark_completed('c') assert_equal(r, {'a'}) assert_equal(s.available_tasks, {'a'}) r = s.mark_completed('a') assert_equal(r, set()) assert_equal(s.available_tasks, set()) # Or Tests s = AND_OR_Scheduler() s.add_or_task('a', ['b', 'c']) assert_equal(s.available_tasks, {'b', 'c'}) r = s.mark_completed('b') # Now 'a' becomes available. assert_equal(r, {'a'}) # But note that 'c' is also available, even if useless. assert_equal(s.available_tasks, {'a', 'c'}) r = s.mark_completed('a') assert_equal(r, set()) assert_equal(s.available_tasks, {'c'}) r = s.mark_completed('c') assert_equal(r, set()) assert_equal(s.available_tasks, set()) # Testing Both s = AND_OR_Scheduler() s.add_and_task('a', ['b', 'c']) s.add_or_task('b', ['b1', 'b2']) s.add_or_task('c', ['c1', 'c2']) r = s.mark_completed('b1') assert_equal(s.available_tasks, {'b', 'b2', 'c1', 'c2'}) r = s.mark_completed('b') assert_false('a' in s.available_tasks) r = s.mark_completed('c1') assert_false('a' in s.available_tasks) r = s.mark_completed('c') assert_true('a' in s.available_tasks) s = AND_OR_Scheduler() s.add_or_task('a', ['b', 'c']) s.add_and_task('b', ['b1', 'b2']) s.add_and_task('c', ['c1', 'c2']) r = s.mark_completed('b1') assert_equal(s.available_tasks, {'b2', 'c1', 'c2'}) r = s.mark_completed('c1') assert_equal(s.available_tasks, {'b2', 'c2'}) r = s.mark_completed('c2') assert_equal(s.available_tasks, {'b2', 'c'}) r = s.mark_completed('c') assert_true('a' in s.available_tasks)
31.03125
56
0.700906
340
1,986
3.85
0.167647
0.159664
0.183346
0.160428
0.753247
0.701299
0.586707
0.546218
0.546218
0.546218
0
0.012311
0.100201
1,986
64
57
31.03125
0.720201
0.072004
0
0.672727
0
0
0.046815
0
0
0
0
0
0.436364
1
0
false
0
0.127273
0
0.127273
0
0
0
0
null
0
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
4
866c77bcb817f30420b6c8a643ca91f40708db01
233
py
Python
tests/helpers/django_project/api/version.py
nicoddemus/dependencies
74180e2c6098d8ad03bc53c5703bdf8dc61c3ed9
[ "BSD-2-Clause" ]
null
null
null
tests/helpers/django_project/api/version.py
nicoddemus/dependencies
74180e2c6098d8ad03bc53c5703bdf8dc61c3ed9
[ "BSD-2-Clause" ]
null
null
null
tests/helpers/django_project/api/version.py
nicoddemus/dependencies
74180e2c6098d8ad03bc53c5703bdf8dc61c3ed9
[ "BSD-2-Clause" ]
null
null
null
from rest_framework.versioning import BaseVersioning from django_project.api.exceptions import VersionError class DenyVersion(BaseVersioning): def determine_version(self, request, *args, **kwargs): raise VersionError
23.3
58
0.793991
25
233
7.28
0.84
0
0
0
0
0
0
0
0
0
0
0
0.141631
233
9
59
25.888889
0.91
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0.4
0
0.8
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
86900698e4351b8acae488b0ae7d6c793b476344
171
py
Python
PythonModulo1/ex030.py
BossNX/ExerciciosDePython
27c79d284794f65f94d3a07de11429d665ec92da
[ "MIT" ]
null
null
null
PythonModulo1/ex030.py
BossNX/ExerciciosDePython
27c79d284794f65f94d3a07de11429d665ec92da
[ "MIT" ]
null
null
null
PythonModulo1/ex030.py
BossNX/ExerciciosDePython
27c79d284794f65f94d3a07de11429d665ec92da
[ "MIT" ]
null
null
null
número = int(input('Digite um número qualquer: ')) if número % 2 == 0: print('O número {} é PAR'.format(número)) else: print('O número {} é ÍMPAR'.format(número))
28.5
50
0.631579
26
171
4.153846
0.615385
0.111111
0.222222
0.240741
0
0
0
0
0
0
0
0.014388
0.187135
171
5
51
34.2
0.76259
0
0
0
0
0
0.368421
0
0
0
0
0
0
1
0
false
0
0
0
0
0.4
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
86acf378e4e8a1e553c006da8f7b89da1ff07e0a
390
py
Python
FileOperation/IgnoreErroAndNotRelative.py
xiaopingzhong/AlgorithmAndDataStructure
ec385235f56b2ca42974f2f6067f708ab4f693fc
[ "Apache-2.0" ]
null
null
null
FileOperation/IgnoreErroAndNotRelative.py
xiaopingzhong/AlgorithmAndDataStructure
ec385235f56b2ca42974f2f6067f708ab4f693fc
[ "Apache-2.0" ]
null
null
null
FileOperation/IgnoreErroAndNotRelative.py
xiaopingzhong/AlgorithmAndDataStructure
ec385235f56b2ca42974f2f6067f708ab4f693fc
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- """ ************************************************ @Time : 2019-06-13 01:11 @Author : zxp @Project : AlgorithmAndDataStructure @File : IgnoreErroAndNotRelative.py @Description: ================================== 忽略错误文件,忽略没有对应Gt的图像,转而读取下一行 @license: (C) Copyright 2013-2019. ************************************************ """
27.857143
48
0.441026
29
390
5.931034
0.965517
0
0
0
0
0
0
0
0
0
0
0.061047
0.117949
390
13
49
30
0.438953
0.969231
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
86e720510586e7ef4006f835e5e213b162984813
8,793
py
Python
nova/tests/functional/libvirt/test_shared_resource_provider.py
Nexenta/nova
ccecb507ff4bdcdd23d90e7b5b02a22c5a46ecc3
[ "Apache-2.0" ]
1
2020-08-14T02:20:59.000Z
2020-08-14T02:20:59.000Z
nova/tests/functional/libvirt/test_shared_resource_provider.py
Nexenta/nova
ccecb507ff4bdcdd23d90e7b5b02a22c5a46ecc3
[ "Apache-2.0" ]
2
2021-03-31T20:04:16.000Z
2021-12-13T20:45:03.000Z
nova/tests/functional/libvirt/test_shared_resource_provider.py
Nexenta/nova
ccecb507ff4bdcdd23d90e7b5b02a22c5a46ecc3
[ "Apache-2.0" ]
1
2020-07-24T02:31:45.000Z
2020-07-24T02:31:45.000Z
# Copyright (C) 2018 NTT DATA, Inc # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from oslo_utils.fixture import uuidsentinel as uuids import unittest from nova.compute import instance_actions from nova import conf from nova.tests.functional.libvirt import integrated_helpers import nova.tests.unit.image.fake CONF = conf.CONF class SharedStorageProviderUsageTestCase( integrated_helpers.LibvirtProviderUsageBaseTestCase): def setUp(self): super(SharedStorageProviderUsageTestCase, self).setUp() self.start_compute() # TODO(efried): Bug #1784020 @unittest.expectedFailure def test_shared_storage_rp_configuration_with_cn_rp(self): """Test to check whether compute node and shared storage resource provider inventory is configured properly or not. """ # shared storage resource provider shared_RP = self._post_resource_provider( rp_name='shared_resource_provider') # created inventory for shared storage RP inv = {"resource_class": "DISK_GB", "total": 78, "reserved": 0, "min_unit": 1, "max_unit": 78, "step_size": 1, "allocation_ratio": 1.0} self._set_inventory(shared_RP['uuid'], inv) # Added traits to shared storage resource provider self._set_provider_traits(shared_RP['uuid'], ['MISC_SHARES_VIA_AGGREGATE']) # add both cn_rp and shared_rp under one aggregate self._set_aggregate(shared_RP['uuid'], uuids.shr_disk_agg) self._set_aggregate(self.host_uuid, uuids.shr_disk_agg) self.assertIn("DISK_GB", self._get_provider_inventory(self.host_uuid)) # run update_available_resource periodic task after configuring shared # resource provider to update compute node resources self._run_periodics() # we expect that the virt driver stops reporting DISK_GB on the compute # RP as soon as a shared RP with DISK_GB is created in the compute tree self.assertNotIn("DISK_GB", self._get_provider_inventory(self.host_uuid)) # create server self._create_server( image_uuid='155d900f-4e14-4e4c-a73d-069cbf4541e6', flavor_id=1, networks='none', ) # get shared_rp and cn_rp usages shared_rp_usages = self._get_provider_usages(shared_RP['uuid']) cn_rp_usages = self._get_provider_usages(self.host_uuid) # Check if DISK_GB resource is allocated from shared_RP and the # remaining resources are allocated from host_uuid. self.assertEqual({'DISK_GB': 1}, shared_rp_usages) self.assertEqual({'MEMORY_MB': 512, 'VCPU': 1}, cn_rp_usages) def create_shared_storage_rp(self): # shared storage resource provider shared_RP = self._post_resource_provider( rp_name='shared_resource_provider1') # created inventory for shared storage RP inv = {"resource_class": "DISK_GB", "total": 78, "reserved": 0, "min_unit": 1, "max_unit": 78, "step_size": 1, "allocation_ratio": 1.0} self._set_inventory(shared_RP['uuid'], inv) # Added traits to shared storage resource provider self._set_provider_traits(shared_RP['uuid'], ['MISC_SHARES_VIA_AGGREGATE', 'STORAGE_DISK_SSD']) return shared_RP['uuid'] # TODO(efried): Bug #1784020 @unittest.expectedFailure def test_rebuild_instance_with_image_traits_on_shared_rp(self): shared_rp_uuid = self.create_shared_storage_rp() # add both cn_rp and shared_rp under one aggregate self._set_aggregate(shared_rp_uuid, uuids.shr_disk_agg) self._set_aggregate(self.host_uuid, uuids.shr_disk_agg) self.assertIn("DISK_GB", self._get_provider_inventory(self.host_uuid)) # run update_available_resource periodic task after configuring shared # resource provider to update compute node resources self._run_periodics() # we expect that the virt driver stops reporting DISK_GB on the compute # RP as soon as a shared RP with DISK_GB is created in the compute tree self.assertNotIn("DISK_GB", self._get_provider_inventory(self.host_uuid)) server = self._create_server( image_uuid='155d900f-4e14-4e4c-a73d-069cbf4541e6', flavor_id=1, networks='none' ) rebuild_image_ref = ( nova.tests.unit.image.fake.AUTO_DISK_CONFIG_ENABLED_IMAGE_UUID) with nova.utils.temporary_mutation(self.api, microversion='2.35'): self.api.api_put('/images/%s/metadata' % rebuild_image_ref, {'metadata': { 'trait:STORAGE_DISK_SSD': 'required'}}) rebuild_req_body = { 'rebuild': { 'imageRef': rebuild_image_ref } } self.api.api_post('/servers/%s/action' % server['id'], rebuild_req_body) self._wait_for_server_parameter( server, {'OS-EXT-STS:task_state': None}) # get shared_rp and cn_rp usages shared_rp_usages = self._get_provider_usages(shared_rp_uuid) cn_rp_usages = self._get_provider_usages(self.host_uuid) # Check if DISK_GB resource is allocated from shared_RP and the # remaining resources are allocated from host_uuid. self.assertEqual({'DISK_GB': 1}, shared_rp_usages) self.assertEqual({'MEMORY_MB': 512, 'VCPU': 1}, cn_rp_usages) allocs = self._get_allocations_by_server_uuid(server['id']) self.assertIn(self.host_uuid, allocs) server = self.api.get_server(server['id']) self.assertEqual(rebuild_image_ref, server['image']['id']) # TODO(efried): Bug #1784020 @unittest.expectedFailure def test_rebuild_instance_with_image_traits_on_shared_rp_no_valid_host( self): shared_rp_uuid = self.create_shared_storage_rp() # add both cn_rp and shared_rp under one aggregate self._set_aggregate(shared_rp_uuid, uuids.shr_disk_agg) self._set_aggregate(self.host_uuid, uuids.shr_disk_agg) self.assertIn("DISK_GB", self._get_provider_inventory(self.host_uuid)) # run update_available_resource periodic task after configuring shared # resource provider to update compute node resources self._run_periodics() # we expect that the virt driver stops reporting DISK_GB on the compute # RP as soon as a shared RP with DISK_GB is created in the compute tree self.assertNotIn("DISK_GB", self._get_provider_inventory(self.host_uuid)) # create server org_image_id = '155d900f-4e14-4e4c-a73d-069cbf4541e6' server = self._create_server( image_uuid=org_image_id, flavor_id=1, networks='none', ) rebuild_image_ref = ( nova.tests.unit.image.fake.AUTO_DISK_CONFIG_ENABLED_IMAGE_UUID) with nova.utils.temporary_mutation(self.api, microversion='2.35'): self.api.api_put('/images/%s/metadata' % rebuild_image_ref, {'metadata': { 'trait:CUSTOM_FOO': 'required'}}) rebuild_req_body = { 'rebuild': { 'imageRef': rebuild_image_ref } } self.api.api_post('/servers/%s/action' % server['id'], rebuild_req_body) # Look for the failed rebuild action. self._wait_for_action_fail_completion( server, instance_actions.REBUILD, 'rebuild_server') # Assert the server image_ref was rolled back on failure. server = self.api.get_server(server['id']) self.assertEqual(org_image_id, server['image']['id']) # The server should be in ERROR state self.assertEqual('ERROR', server['status']) self.assertIn('No valid host', server['fault']['message'])
41.476415
79
0.644376
1,091
8,793
4.912924
0.217232
0.044776
0.026866
0.01791
0.721455
0.711381
0.705597
0.705597
0.696269
0.679478
0
0.020274
0.270784
8,793
211
80
41.672986
0.815658
0.273854
0
0.596774
0
0
0.122326
0.039613
0
0
0
0.009479
0.120968
1
0.040323
false
0
0.048387
0
0.104839
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
86eb4e35798400b6a3278590f1268b683a2ec734
229
py
Python
scripts/UCSC Phys 133/meter.py
jcschindler01/scope_util
cf463ce730521ecc3877f7eca8ae461cd9fbac3e
[ "MIT" ]
null
null
null
scripts/UCSC Phys 133/meter.py
jcschindler01/scope_util
cf463ce730521ecc3877f7eca8ae461cd9fbac3e
[ "MIT" ]
null
null
null
scripts/UCSC Phys 133/meter.py
jcschindler01/scope_util
cf463ce730521ecc3877f7eca8ae461cd9fbac3e
[ "MIT" ]
null
null
null
import numpy as np import matplotlib.pyplot as plt import scope_utilities.vector_impedance_meter as vm save_directory = "C:/electronics/vector_impedance_meter/datasets/" vm.meter(save_directory=save_directory)
17.615385
67
0.786026
31
229
5.548387
0.580645
0.226744
0.232558
0
0
0
0
0
0
0
0
0
0.152838
229
12
68
19.083333
0.886598
0
0
0
0
0
0.220657
0.220657
0
0
0
0
0
1
0
false
0
0.6
0
0.6
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
1
0
1
0
0
4
8104a19f3b3b1972b86390ad376b77946aeb1708
350
py
Python
code401challengespython/insertion_sort/test_insertion_sort.py
danhuyle508/data-structures-and-algorithms
476f32ebcde0350390e36d32e5dc7911ac9bab09
[ "MIT" ]
null
null
null
code401challengespython/insertion_sort/test_insertion_sort.py
danhuyle508/data-structures-and-algorithms
476f32ebcde0350390e36d32e5dc7911ac9bab09
[ "MIT" ]
null
null
null
code401challengespython/insertion_sort/test_insertion_sort.py
danhuyle508/data-structures-and-algorithms
476f32ebcde0350390e36d32e5dc7911ac9bab09
[ "MIT" ]
null
null
null
from insertion_sort import insertion_sort def test_insertion_sort_one(): arr =[4,1,5,6,3] assert insertion_sort(arr) == [1,3,4,5,6,] def test_insertion_sort_two(): arr =[20,11,14,17,19] assert insertion_sort(arr) == [11,14,17,19,20] def test_insertion_sort_empty(): arr =[] assert insertion_sort(arr) == 'List is empty.'
29.166667
54
0.677143
59
350
3.779661
0.389831
0.466368
0.215247
0.269058
0
0
0
0
0
0
0
0.103093
0.168571
350
12
54
29.166667
0.66323
0
0
0
0
0
0.039886
0
0
0
0
0
0.3
1
0.3
false
0
0.1
0
0.4
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
4
d49f1e1c0d9908d1b949f8d8dc3bec4fddd6ff38
1,642
py
Python
examples/contact_area_analysis.py
ContactEngineering/ContactMechanics
eaa08a5d43c6934f0eb0fc628ee6095d0981f70c
[ "MIT" ]
3
2021-11-08T16:15:21.000Z
2021-12-04T02:05:27.000Z
examples/contact_area_analysis.py
ContactEngineering/ContactMechanics
eaa08a5d43c6934f0eb0fc628ee6095d0981f70c
[ "MIT" ]
14
2021-06-17T14:07:07.000Z
2022-03-11T11:55:44.000Z
examples/contact_area_analysis.py
ContactEngineering/ContactMechanics
eaa08a5d43c6934f0eb0fc628ee6095d0981f70c
[ "MIT" ]
1
2021-09-10T22:20:41.000Z
2021-09-10T22:20:41.000Z
import numpy as np import io import matplotlib.pyplot as plt import SurfaceTopography.Uniform.GeometryAnalysis as CAA with io.StringIO( """ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 """) as file: contacting_points = np.loadtxt(file) nx, ny = contacting_points.shape x, y = np.mgrid[:nx, :ny] fig, ax = plt.subplots() ax.imshow(contacting_points.T, cmap="Greys") iper = CAA.inner_perimeter_area(contacting_points, True, stencil=CAA.nn_stencil) ax.plot(x[iper], y[iper], ".r", label="inner_perimeter, nn") iper = CAA.inner_perimeter_area(contacting_points, True, stencil=CAA.nnn_stencil) ax.plot(x[iper], y[iper], "xr", label="inner_perimeter, nnn") oper = CAA.outer_perimeter_area(contacting_points, True, stencil=CAA.nn_stencil) ax.plot(x[oper], y[oper], "ob", mfc="none", label="outer_perimeter, nn") oper = CAA.outer_perimeter_area(contacting_points, True, stencil=CAA.nnn_stencil) ax.plot(x[oper], y[oper], "+b", label="outer_perimeter, nnn") ax.legend() fig.savefig("caa.pdf")
38.186047
81
0.604141
435
1,642
2.227586
0.124138
0.408669
0.557276
0.672859
0.627451
0.627451
0.627451
0.590299
0.590299
0.584107
0
0.25
0.303289
1,642
42
82
39.095238
0.597028
0
0
0
0
0
0.107256
0
0
0
0
0
0
1
0
false
0
0.190476
0
0.190476
0
0
0
0
null
1
1
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
4
d4aa1d4591d563ca0f894d8bedfb49be13d01dc3
54
py
Python
example/frogpanel/__init__.py
andytwoods/django-debug-toolbar-hack
99d28a596d89844b0bbe2eba4cd34ef391322ab6
[ "BSD-3-Clause" ]
null
null
null
example/frogpanel/__init__.py
andytwoods/django-debug-toolbar-hack
99d28a596d89844b0bbe2eba4cd34ef391322ab6
[ "BSD-3-Clause" ]
null
null
null
example/frogpanel/__init__.py
andytwoods/django-debug-toolbar-hack
99d28a596d89844b0bbe2eba4cd34ef391322ab6
[ "BSD-3-Clause" ]
null
null
null
from example.frogpanel.panel import FrogPanel # noqa
27
53
0.814815
7
54
6.285714
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.12963
54
1
54
54
0.93617
0.074074
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
d4b45dff861ea1010e5fc6190ce43888942ce4c2
231
py
Python
django/app/ideas/admin.py
ajyong/docker-by-example
45c19c7e7a8809aa435875d1e17fe2d8f1da9ec6
[ "MIT" ]
2
2019-01-22T16:49:46.000Z
2022-03-14T04:16:23.000Z
django/app/ideas/admin.py
ajyong/docker-by-example
45c19c7e7a8809aa435875d1e17fe2d8f1da9ec6
[ "MIT" ]
1
2022-02-10T08:03:11.000Z
2022-02-10T08:03:11.000Z
django/app/ideas/admin.py
ajyong/docker-by-example
45c19c7e7a8809aa435875d1e17fe2d8f1da9ec6
[ "MIT" ]
null
null
null
from django.contrib import admin from .models import Idea @admin.register(Idea) class IdeaAdmin(admin.ModelAdmin): list_display = ('id', 'name', 'projected_revenue', 'created', 'modified',) list_display_links = ('name',)
25.666667
78
0.718615
28
231
5.785714
0.714286
0.135802
0
0
0
0
0
0
0
0
0
0
0.134199
231
8
79
28.875
0.81
0
0
0
0
0
0.181818
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.833333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
d4ea84f86fb0d68a52baa3c7c8daa5e6660eca8d
124
py
Python
pyball/models/division.py
SebastianDang/PyBall
d1965aa01477b5ee0db9c0463ec584a7e3997395
[ "MIT" ]
74
2018-03-04T22:58:46.000Z
2021-07-06T12:28:50.000Z
pyball/models/division.py
SebastianDang/PyBall
d1965aa01477b5ee0db9c0463ec584a7e3997395
[ "MIT" ]
18
2018-03-10T19:17:54.000Z
2020-01-04T15:42:47.000Z
pyball/models/division.py
SebastianDang/PyBall
d1965aa01477b5ee0db9c0463ec584a7e3997395
[ "MIT" ]
13
2018-03-06T02:39:38.000Z
2020-01-17T04:38:53.000Z
from dataclasses import dataclass @dataclass class Division: id: int = None name: str = None link: str = None
13.777778
33
0.669355
16
124
5.1875
0.75
0.168675
0
0
0
0
0
0
0
0
0
0
0.266129
124
8
34
15.5
0.912088
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.166667
0
0.833333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
1
0
0
4
d4f9cced80c8234b9c7b37278cecca63d59e96de
21
py
Python
console/django_scantron/__init__.py
tothi/scantron
4bad7a73e51e2784e810167ec3efed48d2cc7715
[ "Apache-2.0" ]
null
null
null
console/django_scantron/__init__.py
tothi/scantron
4bad7a73e51e2784e810167ec3efed48d2cc7715
[ "Apache-2.0" ]
null
null
null
console/django_scantron/__init__.py
tothi/scantron
4bad7a73e51e2784e810167ec3efed48d2cc7715
[ "Apache-2.0" ]
null
null
null
__version__ = "1.37"
10.5
20
0.666667
3
21
3.333333
1
0
0
0
0
0
0
0
0
0
0
0.166667
0.142857
21
1
21
21
0.388889
0
0
0
0
0
0.190476
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
d4fea4d37ba994b7a0ec7d92c7d7e4f26734b2a7
178
py
Python
alarmbutton_backend/alarmbutton/urls.py
Anton-Kyrychek/redbuttonbackend
e6e23f7df7b249b5c3bbd4b5a0df7bd96701dec4
[ "MIT" ]
null
null
null
alarmbutton_backend/alarmbutton/urls.py
Anton-Kyrychek/redbuttonbackend
e6e23f7df7b249b5c3bbd4b5a0df7bd96701dec4
[ "MIT" ]
null
null
null
alarmbutton_backend/alarmbutton/urls.py
Anton-Kyrychek/redbuttonbackend
e6e23f7df7b249b5c3bbd4b5a0df7bd96701dec4
[ "MIT" ]
null
null
null
from django.urls import path from .views import * urlpatterns = [ path('', button), path('reg_code_check/', reg_code_check), # path('get_buttons/', get_buttons), ]
17.8
44
0.662921
23
178
4.869565
0.565217
0.125
0.214286
0
0
0
0
0
0
0
0
0
0.185393
178
9
45
19.777778
0.772414
0.191011
0
0
0
0
0.105634
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
076bcd070cb76c6ce08b3c638f64649439653895
111
py
Python
apps/registro_hora_extra/apps.py
jdochoas99/gestao_rh
a3cf360d1dd9d825cf10768505bed235002d9fdf
[ "MIT" ]
1
2020-11-08T16:44:20.000Z
2020-11-08T16:44:20.000Z
apps/registro_hora_extra/apps.py
jdochoas99/gestao_rh
a3cf360d1dd9d825cf10768505bed235002d9fdf
[ "MIT" ]
7
2020-03-01T19:08:18.000Z
2021-09-22T18:39:28.000Z
apps/registro_hora_extra/apps.py
jdochoas99/gestao_rh
a3cf360d1dd9d825cf10768505bed235002d9fdf
[ "MIT" ]
null
null
null
from django.apps import AppConfig class RegistroHoraExtraConfig(AppConfig): name = 'registro_hora_extra'
18.5
41
0.801802
12
111
7.25
0.916667
0
0
0
0
0
0
0
0
0
0
0
0.135135
111
5
42
22.2
0.90625
0
0
0
0
0
0.171171
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
0787df513d8cff63dbc5b71ffe082440ff833fbe
86
py
Python
thinkami_reusable_app/widgets.py
thinkAmi-sandbox/Django_form_sample
79344495ca1d6120bd932471dd3c5edd7c2995d8
[ "Unlicense" ]
1
2016-04-12T05:58:29.000Z
2016-04-12T05:58:29.000Z
thinkami_reusable_app/widgets.py
thinkAmi-sandbox/Django_form_sample
79344495ca1d6120bd932471dd3c5edd7c2995d8
[ "Unlicense" ]
null
null
null
thinkami_reusable_app/widgets.py
thinkAmi-sandbox/Django_form_sample
79344495ca1d6120bd932471dd3c5edd7c2995d8
[ "Unlicense" ]
null
null
null
from django import forms class DateInput(forms.DateInput): input_type = 'date'
21.5
34
0.732558
11
86
5.636364
0.818182
0
0
0
0
0
0
0
0
0
0
0
0.186047
86
4
35
21.5
0.885714
0
0
0
0
0
0.047619
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
07f9c8462dd77c24ab6f3ef9ef6295f54773f2cb
764
py
Python
setup.py
dddpt/dhs-scraper
fceb44bf0cb333c4de5e81b3c4abb0655a432c87
[ "Apache-2.0" ]
1
2022-01-09T23:02:19.000Z
2022-01-09T23:02:19.000Z
setup.py
dddpt/dhs-scraper
fceb44bf0cb333c4de5e81b3c4abb0655a432c87
[ "Apache-2.0" ]
null
null
null
setup.py
dddpt/dhs-scraper
fceb44bf0cb333c4de5e81b3c4abb0655a432c87
[ "Apache-2.0" ]
null
null
null
from setuptools import setup setup( name='dhs_scraper', version='0.2.0', description='A Scraper for the Historical Dictionary of Switzerland (DHS)', url='https://github.com/dddpt/dhs-scraper', author='Didier Dupertuis', license='Apache License 2.0', packages=['dhs_scraper'], install_requires=[ 'requests>=2.22.0', 'lxml>=4.5.0', 'pandas>=1.3.3' ], setup_requires=['wheel'], classifiers=[ 'Intended Audience :: Science/Research', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9' ], )
29.384615
79
0.589005
87
764
5.126437
0.597701
0.213004
0.280269
0.29148
0
0
0
0
0
0
0
0.04363
0.25
764
25
80
30.56
0.734729
0
0
0.083333
0
0
0.554974
0
0
0
0
0
0
1
0
true
0
0.041667
0
0.041667
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
ed53a2d7f5738fcbb0b0f1bc32708ab5690d3ec1
282
py
Python
timeflux/nodes/sequence.py
HerySon/timeflux
01a5a27a3368afe8b0c1da475f84618e11ffec3b
[ "MIT" ]
123
2019-01-09T08:57:39.000Z
2022-03-18T18:59:51.000Z
timeflux/nodes/sequence.py
HerySon/timeflux
01a5a27a3368afe8b0c1da475f84618e11ffec3b
[ "MIT" ]
43
2019-03-08T10:16:39.000Z
2021-06-14T17:17:18.000Z
timeflux/nodes/sequence.py
HerySon/timeflux
01a5a27a3368afe8b0c1da475f84618e11ffec3b
[ "MIT" ]
18
2019-03-26T08:51:21.000Z
2021-10-14T23:10:33.000Z
"""timeflux.nodes.sequence: generate a sequence""" from timeflux.core.node import Node class Sequence(Node): def __init__(self): """Generate a sequence""" self._current = 0 def update(self): self.o.set([self._current]) self._current += 1
20.142857
50
0.624113
35
282
4.828571
0.542857
0.195266
0.201183
0
0
0
0
0
0
0
0
0.009346
0.241135
282
13
51
21.692308
0.780374
0.22695
0
0
1
0
0
0
0
0
0
0
0
1
0.285714
false
0
0.142857
0
0.571429
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
1
0
0
0
0
1
0
0
4
ed692381317231ed1e397872c7b0ee8217273b3f
42
py
Python
docs/requirements.txt.py
vituocgia/wshop-core
5f6d1ec9e9158f13aab136c5bd901c41e69a1dba
[ "BSD-3-Clause" ]
null
null
null
docs/requirements.txt.py
vituocgia/wshop-core
5f6d1ec9e9158f13aab136c5bd901c41e69a1dba
[ "BSD-3-Clause" ]
null
null
null
docs/requirements.txt.py
vituocgia/wshop-core
5f6d1ec9e9158f13aab136c5bd901c41e69a1dba
[ "BSD-3-Clause" ]
null
null
null
XX XXXXXXXXXXXXX XX XXXXXXXXXXXXXXXXXXX
14
23
0.857143
4
42
9
0.75
0
0
0
0
0
0
0
0
0
0
0
0.142857
42
2
24
21
1
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
ed71f901d9247de62974ba3fbc4f6a4ed2b4a848
132
py
Python
baekjoon/python/printNReverse.py
yskang/AlgorithmPractice
31b76e38b4c2f1e3e29fb029587662a745437912
[ "MIT" ]
null
null
null
baekjoon/python/printNReverse.py
yskang/AlgorithmPractice
31b76e38b4c2f1e3e29fb029587662a745437912
[ "MIT" ]
1
2019-11-04T06:44:04.000Z
2019-11-04T06:46:55.000Z
baekjoon/python/printNReverse.py
yskang/AlgorithmPractice
31b76e38b4c2f1e3e29fb029587662a745437912
[ "MIT" ]
null
null
null
# Print N reverse # https://www.acmicpc.net/problem/2742 print('\n'.join(list(map(str, [x for x in range(int(input()), 0, -1)]))))
26.4
73
0.636364
24
132
3.5
0.875
0.142857
0
0
0
0
0
0
0
0
0
0.051282
0.113636
132
4
74
33
0.666667
0.393939
0
0
0
0
0.025974
0
0
0
0
0
0
1
0
true
0
0
0
0
1
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
4
ed80e10af3d3979bdf38509ff25073f2e5b92de4
869
py
Python
dipferromagtheory/linewidth/kubo.py
LukasBeddrich/dipferromagtheory
f59f6db41d0054385fd011d382f965e087fc6977
[ "MIT" ]
1
2021-10-14T12:22:42.000Z
2021-10-14T12:22:42.000Z
dipferromagtheory/linewidth/kubo.py
LukasBeddrich/dipferromagtheory
f59f6db41d0054385fd011d382f965e087fc6977
[ "MIT" ]
null
null
null
dipferromagtheory/linewidth/kubo.py
LukasBeddrich/dipferromagtheory
f59f6db41d0054385fd011d382f965e087fc6977
[ "MIT" ]
null
null
null
""" Implements all the Kubo relaxation functions. """ import numpy as np #------------------------------------------------------------------------------ from .susceptibility import Chi #------------------------------------------------------------------------------ class Kubo(): """ """ def __init__(self, g, chi=None, gamma=None): """ """ self.g = g self.chi = chi self.gamma = gamma def __call__(self, dir, q): """ """ pass def phiL(self, q): """ """ assert isinstance(self.chi, Chi) # assert isinstance(self.gamma, ) return self.chi.chiL(q) / self.gamma() def phiT(self, q): """ """ assert isinstance(self.chi, Chi) # assert isinstance(self.gamma, ) return self.chi.chiT(q) / self.gamma()
20.690476
79
0.408516
79
869
4.392405
0.392405
0.100865
0.230548
0.121037
0.397695
0.397695
0.397695
0.397695
0.397695
0.397695
0
0
0.29229
869
42
80
20.690476
0.564228
0.32336
0
0.133333
0
0
0
0
0
0
0
0
0.133333
1
0.266667
false
0.066667
0.133333
0
0.6
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
4
71fbad88cab7d1108903530cfb626222b96b1acb
14,651
py
Python
search/rm_search/ofa/nas/efficiency_predictor/latency_lookup_table.py
Ascend-Research/BlockProfile
94a0f065e3632c204af77b736b944d30562468f9
[ "MIT" ]
2
2021-06-09T05:34:44.000Z
2021-12-22T00:57:07.000Z
search/rm_search/ofa/nas/efficiency_predictor/latency_lookup_table.py
Ascend-Research/BlockProfile
94a0f065e3632c204af77b736b944d30562468f9
[ "MIT" ]
null
null
null
search/rm_search/ofa/nas/efficiency_predictor/latency_lookup_table.py
Ascend-Research/BlockProfile
94a0f065e3632c204af77b736b944d30562468f9
[ "MIT" ]
null
null
null
# Once for All: Train One Network and Specialize it for Efficient Deployment # Han Cai, Chuang Gan, Tianzhe Wang, Zhekai Zhang, Song Han # International Conference on Learning Representations (ICLR), 2020. import yaml from search.rm_search.ofa.utils import download_url, make_divisible, MyNetwork __all__ = ['count_conv_flop', 'ProxylessNASLatencyTable', 'MBv3LatencyTable', 'ResNet50LatencyTable'] def count_conv_flop(out_size, in_channels, out_channels, kernel_size, groups): out_h = out_w = out_size delta_ops = in_channels * out_channels * kernel_size * kernel_size * out_h * out_w / groups return delta_ops class LatencyTable(object): def __init__(self, local_dir='~/.ofa/latency_tools/', url='https://hanlab.mit.edu/files/proxylessNAS/LatencyTools/mobile_trim.yaml'): if url.startswith('http'): fname = download_url(url, local_dir, overwrite=True) else: fname = url with open(fname, 'r') as fp: self.lut = yaml.load(fp) @staticmethod def repr_shape(shape): if isinstance(shape, (list, tuple)): return 'x'.join(str(_) for _ in shape) elif isinstance(shape, str): return shape else: return TypeError def query(self, **kwargs): raise NotImplementedError def predict_network_latency(self, net, image_size): raise NotImplementedError def predict_network_latency_given_config(self, net_config, image_size): raise NotImplementedError @staticmethod def count_flops_given_config(net_config, image_size=224): raise NotImplementedError class ProxylessNASLatencyTable(LatencyTable): def query(self, l_type: str, input_shape, output_shape, expand=None, ks=None, stride=None, id_skip=None): """ :param l_type: Layer type must be one of the followings 1. `Conv`: The initial 3x3 conv with stride 2. 2. `Conv_1`: feature_mix_layer 3. `Logits`: All operations after `Conv_1`. 4. `expanded_conv`: MobileInvertedResidual :param input_shape: input shape (h, w, #channels) :param output_shape: output shape (h, w, #channels) :param expand: expansion ratio :param ks: kernel size :param stride: :param id_skip: indicate whether has the residual connection """ infos = [l_type, 'input:%s' % self.repr_shape(input_shape), 'output:%s' % self.repr_shape(output_shape), ] if l_type in ('expanded_conv',): assert None not in (expand, ks, stride, id_skip) infos += ['expand:%d' % expand, 'kernel:%d' % ks, 'stride:%d' % stride, 'idskip:%d' % id_skip] key = '-'.join(infos) return self.lut[key]['mean'] def predict_network_latency(self, net, image_size=224): predicted_latency = 0 # first conv predicted_latency += self.query( 'Conv', [image_size, image_size, 3], [(image_size + 1) // 2, (image_size + 1) // 2, net.first_conv.out_channels] ) # blocks fsize = (image_size + 1) // 2 for block in net.blocks: mb_conv = block.conv shortcut = block.shortcut if mb_conv is None: continue if shortcut is None: idskip = 0 else: idskip = 1 out_fz = int((fsize - 1) / mb_conv.stride + 1) # fsize // mb_conv.stride block_latency = self.query( 'expanded_conv', [fsize, fsize, mb_conv.in_channels], [out_fz, out_fz, mb_conv.out_channels], expand=mb_conv.expand_ratio, ks=mb_conv.kernel_size, stride=mb_conv.stride, id_skip=idskip ) predicted_latency += block_latency fsize = out_fz # feature mix layer predicted_latency += self.query( 'Conv_1', [fsize, fsize, net.feature_mix_layer.in_channels], [fsize, fsize, net.feature_mix_layer.out_channels] ) # classifier predicted_latency += self.query( 'Logits', [fsize, fsize, net.classifier.in_features], [net.classifier.out_features] # 1000 ) return predicted_latency def predict_network_latency_given_config(self, net_config, image_size=224): predicted_latency = 0 # first conv predicted_latency += self.query( 'Conv', [image_size, image_size, 3], [(image_size + 1) // 2, (image_size + 1) // 2, net_config['first_conv']['out_channels']] ) # blocks fsize = (image_size + 1) // 2 for block in net_config['blocks']: mb_conv = block['mobile_inverted_conv'] if 'mobile_inverted_conv' in block else block['conv'] shortcut = block['shortcut'] if mb_conv is None: continue if shortcut is None: idskip = 0 else: idskip = 1 out_fz = int((fsize - 1) / mb_conv['stride'] + 1) block_latency = self.query( 'expanded_conv', [fsize, fsize, mb_conv['in_channels']], [out_fz, out_fz, mb_conv['out_channels']], expand=mb_conv['expand_ratio'], ks=mb_conv['kernel_size'], stride=mb_conv['stride'], id_skip=idskip ) predicted_latency += block_latency fsize = out_fz # feature mix layer predicted_latency += self.query( 'Conv_1', [fsize, fsize, net_config['feature_mix_layer']['in_channels']], [fsize, fsize, net_config['feature_mix_layer']['out_channels']] ) # classifier predicted_latency += self.query( 'Logits', [fsize, fsize, net_config['classifier']['in_features']], [net_config['classifier']['out_features']] # 1000 ) return predicted_latency @staticmethod def count_flops_given_config(net_config, image_size=224): flops = 0 # first conv flops += count_conv_flop((image_size + 1) // 2, 3, net_config['first_conv']['out_channels'], 3, 1) # blocks fsize = (image_size + 1) // 2 for block in net_config['blocks']: mb_conv = block['mobile_inverted_conv'] if 'mobile_inverted_conv' in block else block['conv'] if mb_conv is None: continue out_fz = int((fsize - 1) / mb_conv['stride'] + 1) if mb_conv['mid_channels'] is None: mb_conv['mid_channels'] = round(mb_conv['in_channels'] * mb_conv['expand_ratio']) if mb_conv['expand_ratio'] != 1: # inverted bottleneck flops += count_conv_flop(fsize, mb_conv['in_channels'], mb_conv['mid_channels'], 1, 1) # depth conv flops += count_conv_flop(out_fz, mb_conv['mid_channels'], mb_conv['mid_channels'], mb_conv['kernel_size'], mb_conv['mid_channels']) # point linear flops += count_conv_flop(out_fz, mb_conv['mid_channels'], mb_conv['out_channels'], 1, 1) fsize = out_fz # feature mix layer flops += count_conv_flop(fsize, net_config['feature_mix_layer']['in_channels'], net_config['feature_mix_layer']['out_channels'], 1, 1) # classifier flops += count_conv_flop(1, net_config['classifier']['in_features'], net_config['classifier']['out_features'], 1, 1) return flops / 1e6 # MFLOPs class MBv3LatencyTable(LatencyTable): def query(self, l_type: str, input_shape, output_shape, mid=None, ks=None, stride=None, id_skip=None, se=None, h_swish=None): infos = [l_type, 'input:%s' % self.repr_shape(input_shape), 'output:%s' % self.repr_shape(output_shape), ] if l_type in ('expanded_conv',): assert None not in (mid, ks, stride, id_skip, se, h_swish) infos += ['expand:%d' % mid, 'kernel:%d' % ks, 'stride:%d' % stride, 'idskip:%d' % id_skip, 'se:%d' % se, 'hs:%d' % h_swish] key = '-'.join(infos) return self.lut[key]['mean'] def predict_network_latency(self, net, image_size=224): predicted_latency = 0 # first conv predicted_latency += self.query( 'Conv', [image_size, image_size, 3], [(image_size + 1) // 2, (image_size + 1) // 2, net.first_conv.out_channels] ) # blocks fsize = (image_size + 1) // 2 for block in net.blocks: mb_conv = block.conv shortcut = block.shortcut if mb_conv is None: continue if shortcut is None: idskip = 0 else: idskip = 1 out_fz = int((fsize - 1) / mb_conv.stride + 1) block_latency = self.query( 'expanded_conv', [fsize, fsize, mb_conv.in_channels], [out_fz, out_fz, mb_conv.out_channels], mid=mb_conv.depth_conv.conv.in_channels, ks=mb_conv.kernel_size, stride=mb_conv.stride, id_skip=idskip, se=1 if mb_conv.use_se else 0, h_swish=1 if mb_conv.act_func == 'h_swish' else 0, ) predicted_latency += block_latency fsize = out_fz # final expand layer predicted_latency += self.query( 'Conv_1', [fsize, fsize, net.final_expand_layer.in_channels], [fsize, fsize, net.final_expand_layer.out_channels], ) # global average pooling predicted_latency += self.query( 'AvgPool2D', [fsize, fsize, net.final_expand_layer.out_channels], [1, 1, net.final_expand_layer.out_channels], ) # feature mix layer predicted_latency += self.query( 'Conv_2', [1, 1, net.feature_mix_layer.in_channels], [1, 1, net.feature_mix_layer.out_channels] ) # classifier predicted_latency += self.query( 'Logits', [1, 1, net.classifier.in_features], [net.classifier.out_features] ) return predicted_latency def predict_network_latency_given_config(self, net_config, image_size=224): predicted_latency = 0 # first conv predicted_latency += self.query( 'Conv', [image_size, image_size, 3], [(image_size + 1) // 2, (image_size + 1) // 2, net_config['first_conv']['out_channels']] ) # blocks fsize = (image_size + 1) // 2 for block in net_config['blocks']: mb_conv = block['mobile_inverted_conv'] if 'mobile_inverted_conv' in block else block['conv'] shortcut = block['shortcut'] if mb_conv is None: continue if shortcut is None: idskip = 0 else: idskip = 1 out_fz = int((fsize - 1) / mb_conv['stride'] + 1) if mb_conv['mid_channels'] is None: mb_conv['mid_channels'] = round(mb_conv['in_channels'] * mb_conv['expand_ratio']) block_latency = self.query( 'expanded_conv', [fsize, fsize, mb_conv['in_channels']], [out_fz, out_fz, mb_conv['out_channels']], mid=mb_conv['mid_channels'], ks=mb_conv['kernel_size'], stride=mb_conv['stride'], id_skip=idskip, se=1 if mb_conv['use_se'] else 0, h_swish=1 if mb_conv['act_func'] == 'h_swish' else 0, ) predicted_latency += block_latency fsize = out_fz # final expand layer predicted_latency += self.query( 'Conv_1', [fsize, fsize, net_config['final_expand_layer']['in_channels']], [fsize, fsize, net_config['final_expand_layer']['out_channels']], ) # global average pooling predicted_latency += self.query( 'AvgPool2D', [fsize, fsize, net_config['final_expand_layer']['out_channels']], [1, 1, net_config['final_expand_layer']['out_channels']], ) # feature mix layer predicted_latency += self.query( 'Conv_2', [1, 1, net_config['feature_mix_layer']['in_channels']], [1, 1, net_config['feature_mix_layer']['out_channels']] ) # classifier predicted_latency += self.query( 'Logits', [1, 1, net_config['classifier']['in_features']], [net_config['classifier']['out_features']] ) return predicted_latency @staticmethod def count_flops_given_config(net_config, image_size=224): flops = 0 # first conv flops += count_conv_flop((image_size + 1) // 2, 3, net_config['first_conv']['out_channels'], 3, 1) # blocks fsize = (image_size + 1) // 2 for block in net_config['blocks']: mb_conv = block['mobile_inverted_conv'] if 'mobile_inverted_conv' in block else block['conv'] if mb_conv is None: continue out_fz = int((fsize - 1) / mb_conv['stride'] + 1) if mb_conv['mid_channels'] is None: mb_conv['mid_channels'] = round(mb_conv['in_channels'] * mb_conv['expand_ratio']) if mb_conv['expand_ratio'] != 1: # inverted bottleneck flops += count_conv_flop(fsize, mb_conv['in_channels'], mb_conv['mid_channels'], 1, 1) # depth conv flops += count_conv_flop(out_fz, mb_conv['mid_channels'], mb_conv['mid_channels'], mb_conv['kernel_size'], mb_conv['mid_channels']) if mb_conv['use_se']: # SE layer se_mid = make_divisible(mb_conv['mid_channels'] // 4, divisor=MyNetwork.CHANNEL_DIVISIBLE) flops += count_conv_flop(1, mb_conv['mid_channels'], se_mid, 1, 1) flops += count_conv_flop(1, se_mid, mb_conv['mid_channels'], 1, 1) # point linear flops += count_conv_flop(out_fz, mb_conv['mid_channels'], mb_conv['out_channels'], 1, 1) fsize = out_fz # final expand layer flops += count_conv_flop(fsize, net_config['final_expand_layer']['in_channels'], net_config['final_expand_layer']['out_channels'], 1, 1) # feature mix layer flops += count_conv_flop(1, net_config['feature_mix_layer']['in_channels'], net_config['feature_mix_layer']['out_channels'], 1, 1) # classifier flops += count_conv_flop(1, net_config['classifier']['in_features'], net_config['classifier']['out_features'], 1, 1) return flops / 1e6 # MFLOPs class ResNet50LatencyTable(LatencyTable): def query(self, **kwargs): raise NotImplementedError def predict_network_latency(self, net, image_size): raise NotImplementedError def predict_network_latency_given_config(self, net_config, image_size): raise NotImplementedError @staticmethod def count_flops_given_config(net_config, image_size=224): flops = 0 # input stem for layer_config in net_config['input_stem']: if layer_config['name'] != 'ConvLayer': layer_config = layer_config['conv'] in_channel = layer_config['in_channels'] out_channel = layer_config['out_channels'] out_image_size = int((image_size - 1) / layer_config['stride'] + 1) flops += count_conv_flop(out_image_size, in_channel, out_channel, layer_config['kernel_size'], layer_config.get('groups', 1)) image_size = out_image_size # max pooling image_size = int((image_size - 1) / 2 + 1) # ResNetBottleneckBlocks for block_config in net_config['blocks']: in_channel = block_config['in_channels'] out_channel = block_config['out_channels'] out_image_size = int((image_size - 1) / block_config['stride'] + 1) mid_channel = block_config['mid_channels'] if block_config['mid_channels'] is not None \ else round(out_channel * block_config['expand_ratio']) mid_channel = make_divisible(mid_channel, MyNetwork.CHANNEL_DIVISIBLE) # conv1 flops += count_conv_flop(image_size, in_channel, mid_channel, 1, 1) # conv2 flops += count_conv_flop(out_image_size, mid_channel, mid_channel, block_config['kernel_size'], block_config['groups']) # conv3 flops += count_conv_flop(out_image_size, mid_channel, out_channel, 1, 1) # downsample if block_config['stride'] == 1 and in_channel == out_channel: pass else: flops += count_conv_flop(out_image_size, in_channel, out_channel, 1, 1) image_size = out_image_size # final classifier flops += count_conv_flop(1, net_config['classifier']['in_features'], net_config['classifier']['out_features'], 1, 1) return flops / 1e6 # MFLOPs
37.760309
108
0.69026
2,094
14,651
4.529131
0.097421
0.048714
0.031527
0.039857
0.789751
0.772459
0.752952
0.746942
0.697385
0.679249
0
0.01732
0.17637
14,651
387
109
37.857881
0.768625
0.090233
0
0.616725
0
0
0.159211
0.003389
0
0
0
0
0.006969
1
0.066202
false
0.003484
0.006969
0
0.132404
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
71fcf89a495444f09bea0fa61f506ccbc82e857c
35
py
Python
my_classes/Tuples/.history/name_tuples_20210721185526.py
minefarmer/deep-Dive-1
b0675b853180c5b5781888266ea63a3793b8d855
[ "Unlicense" ]
null
null
null
my_classes/Tuples/.history/name_tuples_20210721185526.py
minefarmer/deep-Dive-1
b0675b853180c5b5781888266ea63a3793b8d855
[ "Unlicense" ]
null
null
null
my_classes/Tuples/.history/name_tuples_20210721185526.py
minefarmer/deep-Dive-1
b0675b853180c5b5781888266ea63a3793b8d855
[ "Unlicense" ]
null
null
null
""" Tuple as Data Structure """
7
28
0.571429
4
35
5
1
0
0
0
0
0
0
0
0
0
0
0
0.257143
35
5
29
7
0.769231
0.657143
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
9c112156c4513486e8baa8df7ace9446b7d06b19
50
py
Python
python/caty/template/core/__init__.py
hidaruma/caty
f71d2ab0a001ea4f7a96a6e02211187ebbf54773
[ "MIT" ]
null
null
null
python/caty/template/core/__init__.py
hidaruma/caty
f71d2ab0a001ea4f7a96a6e02211187ebbf54773
[ "MIT" ]
null
null
null
python/caty/template/core/__init__.py
hidaruma/caty
f71d2ab0a001ea4f7a96a6e02211187ebbf54773
[ "MIT" ]
null
null
null
from caty.template.core.vm import VirtualMachine
16.666667
48
0.84
7
50
6
1
0
0
0
0
0
0
0
0
0
0
0
0.1
50
2
49
25
0.933333
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
9c1c3d0c3b993833faf3623c812cf4a116088532
348
py
Python
config/proxy.py
linex-cd/puf
6da93b485b4881c12975d5af1715480a7bffc45c
[ "Apache-2.0" ]
5
2018-01-02T10:27:52.000Z
2018-05-01T16:01:01.000Z
config/proxy.py
linex-cd/puf
6da93b485b4881c12975d5af1715480a7bffc45c
[ "Apache-2.0" ]
null
null
null
config/proxy.py
linex-cd/puf
6da93b485b4881c12975d5af1715480a7bffc45c
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- system_proxies = None; disable_proxies = {'http': None, 'https': None}; proxies_protocol = "http"; proxies_protocol = "socks5"; defined_proxies = { 'http': proxies_protocol+'://127.0.0.1:8888', 'https': proxies_protocol+'://127.0.0.1:8888', }; proxies = system_proxies; if __name__ == '__main__': pass; #end
17.4
49
0.643678
44
348
4.727273
0.477273
0.288462
0.182692
0.182692
0.240385
0.240385
0.240385
0
0
0
0
0.074576
0.152299
348
20
50
17.4
0.630508
0.071839
0
0
0
0
0.218069
0
0
0
0
0
0
1
0
false
0.090909
0
0
0
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
4
9c267b8e26b6887484ca3e1c5f28fc8d09e2adb2
51,943
py
Python
pyscf/pbc/dft/numint.py
robert-anderson/pyscf
cdc56e168cb15f47e8cdc791a92d689fa9b655af
[ "Apache-2.0" ]
2
2019-05-28T05:25:56.000Z
2019-11-09T02:16:43.000Z
pyscf/pbc/dft/numint.py
robert-anderson/pyscf
cdc56e168cb15f47e8cdc791a92d689fa9b655af
[ "Apache-2.0" ]
2
2019-09-16T17:58:31.000Z
2019-09-22T17:26:01.000Z
pyscf/pbc/dft/numint.py
robert-anderson/pyscf
cdc56e168cb15f47e8cdc791a92d689fa9b655af
[ "Apache-2.0" ]
1
2019-11-09T02:13:16.000Z
2019-11-09T02:13:16.000Z
#!/usr/bin/env python # Copyright 2014-2018 The PySCF Developers. 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. # # Author: Timothy Berkelbach <tim.berkelbach@gmail.com> # Qiming Sun <osirpt.sun@gmail.com> # import sys import ctypes import numpy from pyscf import lib from pyscf.dft import numint from pyscf.dft.numint import eval_mat, _dot_ao_ao, _dot_ao_dm from pyscf.dft.numint import _scale_ao, _contract_rho from pyscf.dft.numint import _rks_gga_wv0, _rks_gga_wv1 from pyscf.dft.numint import _uks_gga_wv0, _uks_gga_wv1 from pyscf.dft.numint import OCCDROP from pyscf.pbc.dft.gen_grid import libpbc, make_mask, BLKSIZE from pyscf.pbc.lib.kpts_helper import is_zero, gamma_point, member #try: ### Moderate speedup by caching eval_ao # from pyscf import pbc # from joblib import Memory # memory = Memory(cachedir='./tmp/', mmap_mode='r', verbose=0) # def memory_cache(f): # g = memory.cache(f) # def maybe_cache(*args, **kwargs): # if pbc.DEBUG: # return g(*args, **kwargs) # else: # return f(*args, **kwargs) # return maybe_cache #except: # memory_cache = lambda f: f def eval_ao(cell, coords, kpt=numpy.zeros(3), deriv=0, relativity=0, shls_slice=None, non0tab=None, out=None, verbose=None): '''Collocate AO crystal orbitals (opt. gradients) on the real-space grid. Args: cell : instance of :class:`Cell` coords : (nx*ny*nz, 3) ndarray The real-space grid point coordinates. Kwargs: kpt : (3,) ndarray The k-point corresponding to the crystal AO. deriv : int AO derivative order. It affects the shape of the return array. If deriv=0, the returned AO values are stored in a (N,nao) array. Otherwise the AO values are stored in an array of shape (M,N,nao). Here N is the number of grids, nao is the number of AO functions, M is the size associated to the derivative deriv. Returns: aoR : ([4,] nx*ny*nz, nao=cell.nao_nr()) ndarray The value of the AO crystal orbitals on the real-space grid by default. If deriv=1, also contains the value of the orbitals gradient in the x, y, and z directions. It can be either complex or float array, depending on the kpt argument. If kpt is not given (gamma point), aoR is a float array. See Also: pyscf.dft.numint.eval_ao ''' ao_kpts = eval_ao_kpts(cell, coords, numpy.reshape(kpt, (-1,3)), deriv, relativity, shls_slice, non0tab, out, verbose) return ao_kpts[0] #@memory_cache def eval_ao_kpts(cell, coords, kpts=None, deriv=0, relativity=0, shls_slice=None, non0tab=None, out=None, verbose=None, **kwargs): ''' Returns: ao_kpts: (nkpts, [comp], ngrids, nao) ndarray AO values at each k-point ''' if kpts is None: if 'kpt' in kwargs: sys.stderr.write('WARN: KNumInt.eval_ao function finds keyword ' 'argument "kpt" and converts it to "kpts"\n') kpts = kwargs['kpt'] else: kpts = numpy.zeros((1,3)) kpts = numpy.reshape(kpts, (-1,3)) comp = (deriv+1)*(deriv+2)*(deriv+3)//6 if cell.cart: feval = 'GTOval_cart_deriv%d' % deriv else: feval = 'GTOval_sph_deriv%d' % deriv return cell.pbc_eval_gto(feval, coords, comp, kpts, shls_slice=shls_slice, non0tab=non0tab, out=out) def eval_rho(cell, ao, dm, non0tab=None, xctype='LDA', hermi=0, verbose=None): '''Collocate the *real* density (opt. gradients) on the real-space grid. Args: cell : instance of :class:`Mole` or :class:`Cell` ao : ([4,] nx*ny*nz, nao=cell.nao_nr()) ndarray The value of the AO crystal orbitals on the real-space grid by default. If xctype='GGA', also contains the value of the gradient in the x, y, and z directions. Returns: rho : ([4,] nx*ny*nz) ndarray The value of the density on the real-space grid. If xctype='GGA', also contains the value of the gradient in the x, y, and z directions. See Also: pyscf.dft.numint.eval_rho ''' if xctype == 'LDA' or xctype == 'HF': ngrids, nao = ao.shape else: ngrids, nao = ao[0].shape if non0tab is None: non0tab = numpy.empty(((ngrids+BLKSIZE-1)//BLKSIZE, cell.nbas), dtype=numpy.uint8) non0tab[:] = 0xff # complex orbitals or density matrix if numpy.iscomplexobj(ao) or numpy.iscomplexobj(dm): shls_slice = (0, cell.nbas) ao_loc = cell.ao_loc_nr() dm = dm.astype(numpy.complex128) # For GGA, function eval_rho returns real(|\nabla i> D_ij <j| + |i> D_ij <\nabla j|) # = real(|\nabla i> D_ij <j| + |i> D_ij <\nabla j|) # = real(|\nabla i> D_ij <j| + conj(|\nabla j> conj(D_ij) < i|)) # = real(|\nabla i> D_ij <j|) + real(|\nabla j> conj(D_ij) < i|) # = real(|\nabla i> [D_ij + (D^\dagger)_ij] <j|) # symmetrization dm (D + D.conj().T) then /2 because the code below computes # 2*real(|\nabla i> D_ij <j|) if not hermi: dm = (dm + dm.conj().T) * .5 def dot_bra(bra, aodm): #:rho = numpy.einsum('pi,pi->p', bra.real, aodm.real) #:rho += numpy.einsum('pi,pi->p', bra.imag, aodm.imag) #:return rho return _contract_rho(bra, aodm) if xctype == 'LDA' or xctype == 'HF': c0 = _dot_ao_dm(cell, ao, dm, non0tab, shls_slice, ao_loc) rho = dot_bra(ao, c0) elif xctype == 'GGA': rho = numpy.empty((4,ngrids)) c0 = _dot_ao_dm(cell, ao[0], dm, non0tab, shls_slice, ao_loc) rho[0] = dot_bra(ao[0], c0) for i in range(1, 4): rho[i] = dot_bra(ao[i], c0) * 2 else: # rho[4] = \nabla^2 rho, rho[5] = 1/2 |nabla f|^2 rho = numpy.empty((6,ngrids)) c0 = _dot_ao_dm(cell, ao[0], dm, non0tab, shls_slice, ao_loc) rho[0] = dot_bra(ao[0], c0) rho[5] = 0 for i in range(1, 4): rho[i] = dot_bra(ao[i], c0) * 2 # *2 for +c.c. c1 = _dot_ao_dm(cell, ao[i], dm, non0tab, shls_slice, ao_loc) rho[5] += dot_bra(ao[i], c1) XX, YY, ZZ = 4, 7, 9 ao2 = ao[XX] + ao[YY] + ao[ZZ] rho[4] = dot_bra(ao2, c0) rho[4] += rho[5] rho[4] *= 2 # *2 for +c.c. rho[5] *= .5 else: # real orbitals and real DM rho = numint.eval_rho(cell, ao, dm, non0tab, xctype, hermi, verbose) return rho def eval_rho2(cell, ao, mo_coeff, mo_occ, non0tab=None, xctype='LDA', verbose=None): '''Refer to `pyscf.dft.numint.eval_rho2` for full documentation. ''' xctype = xctype.upper() if xctype == 'LDA' or xctype == 'HF': ngrids, nao = ao.shape else: ngrids, nao = ao[0].shape if non0tab is None: non0tab = numpy.empty(((ngrids+BLKSIZE-1)//BLKSIZE,cell.nbas), dtype=numpy.uint8) non0tab[:] = 0xff # complex orbitals or density matrix if numpy.iscomplexobj(ao) or numpy.iscomplexobj(mo_coeff): def dot(bra, ket): #:rho = numpy.einsum('pi,pi->p', bra.real, ket.real) #:rho += numpy.einsum('pi,pi->p', bra.imag, ket.imag) #:return rho return _contract_rho(bra, ket) shls_slice = (0, cell.nbas) ao_loc = cell.ao_loc_nr() pos = mo_occ > OCCDROP cpos = numpy.einsum('ij,j->ij', mo_coeff[:,pos], numpy.sqrt(mo_occ[pos])) if pos.sum() > 0: if xctype == 'LDA' or xctype == 'HF': c0 = _dot_ao_dm(cell, ao, cpos, non0tab, shls_slice, ao_loc) rho = dot(c0, c0) elif xctype == 'GGA': rho = numpy.empty((4,ngrids)) c0 = _dot_ao_dm(cell, ao[0], cpos, non0tab, shls_slice, ao_loc) rho[0] = dot(c0, c0) for i in range(1, 4): c1 = _dot_ao_dm(cell, ao[i], cpos, non0tab, shls_slice, ao_loc) rho[i] = dot(c0, c1) * 2 # *2 for +c.c. else: # meta-GGA # rho[4] = \nabla^2 rho, rho[5] = 1/2 |nabla f|^2 rho = numpy.empty((6,ngrids)) c0 = _dot_ao_dm(cell, ao[0], cpos, non0tab, shls_slice, ao_loc) rho[0] = dot(c0, c0) rho[5] = 0 for i in range(1, 4): c1 = _dot_ao_dm(cell, ao[i], cpos, non0tab, shls_slice, ao_loc) rho[i] = dot(c0, c1) * 2 # *2 for +c.c. rho[5]+= dot(c1, c1) XX, YY, ZZ = 4, 7, 9 ao2 = ao[XX] + ao[YY] + ao[ZZ] c1 = _dot_ao_dm(cell, ao2, cpos, non0tab, shls_slice, ao_loc) rho[4] = dot(c0, c1) rho[4]+= rho[5] rho[4]*= 2 rho[5]*= .5 else: if xctype == 'LDA' or xctype == 'HF': rho = numpy.zeros(ngrids) elif xctype == 'GGA': rho = numpy.zeros((4,ngrids)) else: rho = numpy.zeros((6,ngrids)) neg = mo_occ < -OCCDROP if neg.sum() > 0: cneg = numpy.einsum('ij,j->ij', mo_coeff[:,neg], numpy.sqrt(-mo_occ[neg])) if xctype == 'LDA' or xctype == 'HF': c0 = _dot_ao_dm(cell, ao, cneg, non0tab, shls_slice, ao_loc) rho -= dot(c0, c0) elif xctype == 'GGA': c0 = _dot_ao_dm(cell, ao[0], cneg, non0tab, shls_slice, ao_loc) rho[0] -= dot(c0, c0) for i in range(1, 4): c1 = _dot_ao_dm(cell, ao[i], cneg, non0tab, shls_slice, ao_loc) rho[i] -= dot(c0, c1) * 2 # *2 for +c.c. else: c0 = _dot_ao_dm(cell, ao[0], cneg, non0tab, shls_slice, ao_loc) rho[0] -= dot(c0, c0) rho5 = 0 for i in range(1, 4): c1 = _dot_ao_dm(cell, ao[i], cneg, non0tab, shls_slice, ao_loc) rho[i] -= dot(c0, c1) * 2 # *2 for +c.c. rho5 -= dot(c1, c1) XX, YY, ZZ = 4, 7, 9 ao2 = ao[XX] + ao[YY] + ao[ZZ] c1 = _dot_ao_dm(cell, ao2, cneg, non0tab, shls_slice, ao_loc) rho[4] -= dot(c0, c1) * 2 rho[4] -= rho5 * 2 rho[5] -= rho5 * .5 else: rho = numint.eval_rho2(cell, ao, mo_coeff, mo_occ, non0tab, xctype, verbose) return rho def nr_rks(ni, cell, grids, xc_code, dms, spin=0, relativity=0, hermi=0, kpts=None, kpts_band=None, max_memory=2000, verbose=None): '''Calculate RKS XC functional and potential matrix for given meshgrids and density matrix Note: This is a replica of pyscf.dft.numint.nr_rks_vxc with kpts added. This implemented uses slow function in numint, which only calls eval_rho, eval_mat. Faster function uses eval_rho2 which is not yet implemented. Args: ni : an instance of :class:`NumInt` or :class:`KNumInt` cell : instance of :class:`Mole` or :class:`Cell` grids : an instance of :class:`Grids` grids.coords and grids.weights are needed for coordinates and weights of meshgrids. xc_code : str XC functional description. See :func:`parse_xc` of pyscf/dft/libxc.py for more details. dms : 2D/3D array or a list of 2D/3D arrays Density matrices (2D) / density matrices for k-points (3D) Kwargs: spin : int spin polarized if spin = 1 relativity : int No effects. hermi : int No effects max_memory : int or float The maximum size of cache to use (in MB). verbose : int or object of :class:`Logger` No effects. kpts : (3,) ndarray or (nkpts,3) ndarray Single or multiple k-points sampled for the DM. Default is gamma point. kpts_band : (3,) ndarray or (*,3) ndarray A list of arbitrary "band" k-points at which to evaluate the XC matrix. Returns: nelec, excsum, vmat. nelec is the number of electrons generated by numerical integration. excsum is the XC functional value. vmat is the XC potential matrix in 2D array of shape (nao,nao) where nao is the number of AO functions. ''' if kpts is None: kpts = numpy.zeros((1,3)) xctype = ni._xc_type(xc_code) make_rho, nset, nao = ni._gen_rho_evaluator(cell, dms, hermi) nelec = numpy.zeros(nset) excsum = numpy.zeros(nset) vmat = [0]*nset if xctype == 'LDA': ao_deriv = 0 for ao_k1, ao_k2, mask, weight, coords \ in ni.block_loop(cell, grids, nao, ao_deriv, kpts, kpts_band, max_memory): for i in range(nset): rho = make_rho(i, ao_k2, mask, xctype) exc, vxc = ni.eval_xc(xc_code, rho, 0, relativity, 1)[:2] vrho = vxc[0] den = rho*weight nelec[i] += den.sum() excsum[i] += (den*exc).sum() vmat[i] += ni.eval_mat(cell, ao_k1, weight, rho, vxc, mask, xctype, 0, verbose) elif xctype == 'GGA': ao_deriv = 1 for ao_k1, ao_k2, mask, weight, coords \ in ni.block_loop(cell, grids, nao, ao_deriv, kpts, kpts_band, max_memory): for i in range(nset): rho = make_rho(i, ao_k2, mask, xctype) exc, vxc = ni.eval_xc(xc_code, rho, 0, relativity, 1)[:2] den = rho[0]*weight nelec[i] += den.sum() excsum[i] += (den*exc).sum() vmat[i] += ni.eval_mat(cell, ao_k1, weight, rho, vxc, mask, xctype, 0, verbose) elif xctype == 'MGGA': if (any(x in xc_code.upper() for x in ('CC06', 'CS', 'BR89', 'MK00'))): raise NotImplementedError('laplacian in meta-GGA method') ao_deriv = 2 for ao_k1, ao_k2, mask, weight, coords \ in ni.block_loop(cell, grids, nao, ao_deriv, kpts, kpts_band, max_memory): for i in range(nset): rho = make_rho(i, ao_k2, mask, xctype) exc, vxc = ni.eval_xc(xc_code, rho, 0, relativity, 1)[:2] den = rho[0]*weight nelec[i] += den.sum() excsum[i] += (den*exc).sum() vmat[i] += ni.eval_mat(cell, ao_k1, weight, rho, vxc, mask, xctype, 0, verbose) if nset == 1: nelec = nelec[0] excsum = excsum[0] vmat = vmat[0] return nelec, excsum, vmat def nr_uks(ni, cell, grids, xc_code, dms, spin=1, relativity=0, hermi=0, kpts=None, kpts_band=None, max_memory=2000, verbose=None): '''Calculate UKS XC functional and potential matrix for given meshgrids and density matrix Note: This is a replica of pyscf.dft.numint.nr_rks_vxc with kpts added. This implemented uses slow function in numint, which only calls eval_rho, eval_mat. Faster function uses eval_rho2 which is not yet implemented. Args: ni : an instance of :class:`NumInt` or :class:`KNumInt` cell : instance of :class:`Mole` or :class:`Cell` grids : an instance of :class:`Grids` grids.coords and grids.weights are needed for coordinates and weights of meshgrids. xc_code : str XC functional description. See :func:`parse_xc` of pyscf/dft/libxc.py for more details. dms : Density matrices Kwargs: spin : int spin polarized if spin = 1 relativity : int No effects. hermi : int Input density matrices symmetric or not max_memory : int or float The maximum size of cache to use (in MB). verbose : int or object of :class:`Logger` No effects. kpts : (3,) ndarray or (nkpts,3) ndarray Single or multiple k-points sampled for the DM. Default is gamma point. kpts_band : (3,) ndarray or (*,3) ndarray A list of arbitrary "band" k-points at which to evaluate the XC matrix. Returns: nelec, excsum, vmat. nelec is the number of electrons generated by numerical integration. excsum is the XC functional value. vmat is the XC potential matrix in 2D array of shape (nao,nao) where nao is the number of AO functions. ''' if kpts is None: kpts = numpy.zeros((1,3)) xctype = ni._xc_type(xc_code) dma, dmb = _format_uks_dm(dms) nao = dma.shape[-1] make_rhoa, nset = ni._gen_rho_evaluator(cell, dma, hermi)[:2] make_rhob = ni._gen_rho_evaluator(cell, dmb, hermi)[0] nelec = numpy.zeros((2,nset)) excsum = numpy.zeros(nset) vmata = [0]*nset vmatb = [0]*nset if xctype == 'LDA': ao_deriv = 0 for ao_k1, ao_k2, mask, weight, coords \ in ni.block_loop(cell, grids, nao, ao_deriv, kpts, kpts_band, max_memory): for i in range(nset): rho_a = make_rhoa(i, ao_k2, mask, xctype) rho_b = make_rhob(i, ao_k2, mask, xctype) exc, vxc = ni.eval_xc(xc_code, (rho_a, rho_b), 1, relativity, 1, verbose)[:2] vrho = vxc[0] den = rho_a * weight nelec[0,i] += den.sum() excsum[i] += (den*exc).sum() den = rho_b * weight nelec[1,i] += den.sum() excsum[i] += (den*exc).sum() vmata[i] += ni.eval_mat(cell, ao_k1, weight, rho_a, vrho[:,0], mask, xctype, 1, verbose) vmatb[i] += ni.eval_mat(cell, ao_k1, weight, rho_b, vrho[:,1], mask, xctype, 1, verbose) elif xctype == 'GGA': ao_deriv = 1 for ao_k1, ao_k2, mask, weight, coords \ in ni.block_loop(cell, grids, nao, ao_deriv, kpts, kpts_band, max_memory): for i in range(nset): rho_a = make_rhoa(i, ao_k2, mask, xctype) rho_b = make_rhob(i, ao_k2, mask, xctype) exc, vxc = ni.eval_xc(xc_code, (rho_a, rho_b), 1, relativity, 1, verbose)[:2] vrho, vsigma = vxc[:2] den = rho_a[0]*weight nelec[0,i] += den.sum() excsum[i] += (den*exc).sum() den = rho_b[0]*weight nelec[1,i] += den.sum() excsum[i] += (den*exc).sum() vmata[i] += ni.eval_mat(cell, ao_k1, weight, (rho_a,rho_b), (vrho[:,0], (vsigma[:,0],vsigma[:,1])), mask, xctype, 1, verbose) vmatb[i] += ni.eval_mat(cell, ao_k1, weight, (rho_b,rho_a), (vrho[:,1], (vsigma[:,2],vsigma[:,1])), mask, xctype, 1, verbose) elif xctype == 'MGGA': assert(all(x not in xc_code.upper() for x in ('CC06', 'CS', 'BR89', 'MK00'))) ao_deriv = 2 for ao_k1, ao_k2, mask, weight, coords \ in ni.block_loop(cell, grids, nao, ao_deriv, kpts, kpts_band, max_memory): for i in range(nset): rho_a = make_rhoa(i, ao_k2, mask, xctype) rho_b = make_rhob(i, ao_k2, mask, xctype) exc, vxc = ni.eval_xc(xc_code, (rho_a, rho_b), 1, relativity, 1, verbose)[:2] vrho, vsigma, vlapl, vtau = vxc den = rho_a[0]*weight nelec[0,i] += den.sum() excsum[i] += (den*exc).sum() den = rho_b[0]*weight nelec[1,i] += den.sum() excsum[i] += (den*exc).sum() v = (vrho[:,0], (vsigma[:,0],vsigma[:,1]), None, vtau[:,0]) vmata[i] += ni.eval_mat(cell, ao_k1, weight, (rho_a,rho_b), v, mask, xctype, 1, verbose) v = (vrho[:,1], (vsigma[:,2],vsigma[:,1]), None, vtau[:,1]) vmatb[i] += ni.eval_mat(cell, ao_k1, weight, (rho_b,rho_a), v, mask, xctype, 1, verbose) v = None if dma.ndim == vmata[0].ndim: # One set of DMs in the input nelec = nelec[:,0] excsum = excsum[0] vmata = vmata[0] vmatb = vmatb[0] return nelec, excsum, lib.asarray((vmata,vmatb)) def _format_uks_dm(dms): dma, dmb = dms if getattr(dms, 'mo_coeff', None) is not None: #TODO: test whether dm.mo_coeff matching dm mo_coeff = dms.mo_coeff mo_occ = dms.mo_occ if (isinstance(mo_coeff[0], numpy.ndarray) and mo_coeff[0].ndim < dma.ndim): # handle ROKS mo_occa = [numpy.array(occ> 0, dtype=numpy.double) for occ in mo_occ] mo_occb = [numpy.array(occ==2, dtype=numpy.double) for occ in mo_occ] dma = lib.tag_array(dma, mo_coeff=mo_coeff, mo_occ=mo_occa) dmb = lib.tag_array(dmb, mo_coeff=mo_coeff, mo_occ=mo_occb) else: dma = lib.tag_array(dma, mo_coeff=mo_coeff[0], mo_occ=mo_occ[0]) dmb = lib.tag_array(dmb, mo_coeff=mo_coeff[1], mo_occ=mo_occ[1]) return dma, dmb nr_rks_vxc = nr_rks nr_uks_vxc = nr_uks def nr_rks_fxc(ni, cell, grids, xc_code, dm0, dms, relativity=0, hermi=0, rho0=None, vxc=None, fxc=None, kpts=None, max_memory=2000, verbose=None): '''Contract RKS XC kernel matrix with given density matrices Args: ni : an instance of :class:`NumInt` or :class:`KNumInt` cell : instance of :class:`Mole` or :class:`Cell` grids : an instance of :class:`Grids` grids.coords and grids.weights are needed for coordinates and weights of meshgrids. xc_code : str XC functional description. See :func:`parse_xc` of pyscf/dft/libxc.py for more details. dms : 2D/3D array or a list of 2D/3D arrays Density matrices (2D) / density matrices for k-points (3D) Kwargs: hermi : int Input density matrices symmetric or not max_memory : int or float The maximum size of cache to use (in MB). rho0 : float array Zero-order density (and density derivative for GGA). Giving kwargs rho0, vxc and fxc to improve better performance. vxc : float array First order XC derivatives fxc : float array Second order XC derivatives Examples: ''' if kpts is None: kpts = numpy.zeros((1,3)) xctype = ni._xc_type(xc_code) make_rho, nset, nao = ni._gen_rho_evaluator(cell, dms, hermi) if ((xctype == 'LDA' and fxc is None) or (xctype == 'GGA' and rho0 is None)): make_rho0 = ni._gen_rho_evaluator(cell, dm0, 1)[0] ao_loc = cell.ao_loc_nr() vmat = [0] * nset if xctype == 'LDA': ao_deriv = 0 ip = 0 for ao_k1, ao_k2, mask, weight, coords \ in ni.block_loop(cell, grids, nao, ao_deriv, kpts, None, max_memory): ngrid = weight.size if fxc is None: rho = make_rho0(0, ao_k1, mask, xctype) fxc0 = ni.eval_xc(xc_code, rho, 0, relativity, 2, verbose)[2] frr = fxc0[0] else: frr = fxc[0][ip:ip+ngrid] ip += ngrid for i in range(nset): rho1 = make_rho(i, ao_k1, mask, xctype) wv = weight * frr * rho1 vmat[i] += ni._fxc_mat(cell, ao_k1, wv, mask, xctype, ao_loc) elif xctype == 'GGA': ao_deriv = 1 ip = 0 for ao_k1, ao_k2, mask, weight, coords \ in ni.block_loop(cell, grids, nao, ao_deriv, kpts, None, max_memory): ngrid = weight.size if rho0 is None: rho = make_rho0(0, ao_k1, mask, xctype) else: rho = numpy.asarray(rho0[:,ip:ip+ngrid], order='C') if vxc is None or fxc is None: vxc0, fxc0 = ni.eval_xc(xc_code, rho, 0, relativity, 2, verbose)[1:3] else: vxc0 = (None, vxc[1][ip:ip+ngrid]) fxc0 = (fxc[0][ip:ip+ngrid], fxc[1][ip:ip+ngrid], fxc[2][ip:ip+ngrid]) ip += ngrid for i in range(nset): rho1 = make_rho(i, ao_k1, mask, xctype) wv = _rks_gga_wv1(rho, rho1, vxc0, fxc0, weight) vmat[i] += ni._fxc_mat(cell, ao_k1, wv, mask, xctype, ao_loc) # call swapaxes method to swap last two indices because vmat may be a 3D # array (nset,nao,nao) in single k-point mode or a 4D array # (nset,nkpts,nao,nao) in k-points mode for i in range(nset): # for (\nabla\mu) \nu + \mu (\nabla\nu) vmat[i] = vmat[i] + vmat[i].swapaxes(-2,-1).conj() elif xctype == 'MGGA': raise NotImplementedError('meta-GGA') if isinstance(dms, numpy.ndarray) and dms.ndim == vmat[0].ndim: # One set of DMs in the input vmat = vmat[0] return lib.asarray(vmat) def nr_rks_fxc_st(ni, cell, grids, xc_code, dm0, dms_alpha, relativity=0, singlet=True, rho0=None, vxc=None, fxc=None, kpts=None, max_memory=2000, verbose=None): '''Associated to singlet or triplet Hessian Note the difference to nr_rks_fxc, dms_alpha is the response density matrices of alpha spin, alpha+/-beta DM is applied due to singlet/triplet coupling Ref. CPL, 256, 454 ''' if kpts is None: kpts = numpy.zeros((1,3)) xctype = ni._xc_type(xc_code) make_rho, nset, nao = ni._gen_rho_evaluator(cell, dms_alpha) if ((xctype == 'LDA' and fxc is None) or (xctype == 'GGA' and rho0 is None)): make_rho0 = ni._gen_rho_evaluator(cell, dm0, 1)[0] ao_loc = cell.ao_loc_nr() vmat = [0] * nset if xctype == 'LDA': ao_deriv = 0 ip = 0 for ao_k1, ao_k2, mask, weight, coords \ in ni.block_loop(cell, grids, nao, ao_deriv, kpts, None, max_memory): ngrid = weight.size if fxc is None: rho = make_rho0(0, ao_k1, mask, xctype) rho *= .5 # alpha density fxc0 = ni.eval_xc(xc_code, (rho,rho), 1, deriv=2)[2] u_u, u_d, d_d = fxc0[0].T else: u_u, u_d, d_d = fxc[0][ip:ip+ngrid].T ip += ngrid if singlet: frho = u_u + u_d else: frho = u_u - u_d for i in range(nset): rho1 = make_rho(i, ao_k1, mask, xctype) wv = weight * frho * rho1 vmat[i] += ni._fxc_mat(cell, ao_k1, wv, mask, xctype, ao_loc) elif xctype == 'GGA': ao_deriv = 1 ip = 0 for ao_k1, ao_k2, mask, weight, coords \ in ni.block_loop(cell, grids, nao, ao_deriv, kpts, None, max_memory): ngrid = weight.size if vxc is None or fxc is None: rho = make_rho0(0, ao_k1, mask, xctype) rho *= .5 # alpha density vxc0, fxc0 = ni.eval_xc(xc_code, (rho,rho), 1, deriv=2)[1:3] vsigma = vxc0[1].T u_u, u_d, d_d = fxc0[0].T # v2rho2 u_uu, u_ud, u_dd, d_uu, d_ud, d_dd = fxc0[1].T # v2rhosigma uu_uu, uu_ud, uu_dd, ud_ud, ud_dd, dd_dd = fxc0[2].T # v2sigma2 else: rho = rho0[0][:,ip:ip+ngrid] vsigma = vxc[1][ip:ip+ngrid].T u_u, u_d, d_d = fxc[0][ip:ip+ngrid].T # v2rho2 u_uu, u_ud, u_dd, d_uu, d_ud, d_dd = fxc[1][ip:ip+ngrid].T # v2rhosigma uu_uu, uu_ud, uu_dd, ud_ud, ud_dd, dd_dd = fxc[2][ip:ip+ngrid].T # v2sigma2 if singlet: fgamma = vsigma[0] + vsigma[1] * .5 frho = u_u + u_d fgg = uu_uu + .5*ud_ud + 2*uu_ud + uu_dd frhogamma = u_uu + u_dd + u_ud else: fgamma = vsigma[0] - vsigma[1] * .5 frho = u_u - u_d fgg = uu_uu - uu_dd frhogamma = u_uu - u_dd for i in range(nset): # rho1[0 ] = |b><j| z_{bj} # rho1[1:] = \nabla(|b><j|) z_{bj} rho1 = make_rho(i, ao_k1, mask, xctype) wv = _rks_gga_wv1(rho, rho1, (None,fgamma), (frho,frhogamma,fgg), weight) vmat[i] += ni._fxc_mat(cell, ao_k1, wv, mask, xctype, ao_loc) for i in range(nset): # for (\nabla\mu) \nu + \mu (\nabla\nu) vmat[i] = vmat[i] + vmat[i].swapaxes(-2,-1).conj() elif xctype == 'MGGA': raise NotImplementedError('meta-GGA') if isinstance(dms_alpha, numpy.ndarray) and dms_alpha.ndim == vmat[0].ndim: vmat = vmat[0] return lib.asarray(vmat) def nr_uks_fxc(ni, cell, grids, xc_code, dm0, dms, relativity=0, hermi=0, rho0=None, vxc=None, fxc=None, kpts=None, max_memory=2000, verbose=None): '''Contract UKS XC kernel matrix with given density matrices Args: ni : an instance of :class:`NumInt` or :class:`KNumInt` cell : instance of :class:`Mole` or :class:`Cell` grids : an instance of :class:`Grids` grids.coords and grids.weights are needed for coordinates and weights of meshgrids. xc_code : str XC functional description. See :func:`parse_xc` of pyscf/dft/libxc.py for more details. dms : 2D array a list of 2D arrays Density matrix or multiple density matrices Kwargs: hermi : int Input density matrices symmetric or not max_memory : int or float The maximum size of cache to use (in MB). rho0 : float array Zero-order density (and density derivative for GGA). Giving kwargs rho0, vxc and fxc to improve better performance. vxc : float array First order XC derivatives fxc : float array Second order XC derivatives Returns: nelec, excsum, vmat. nelec is the number of electrons generated by numerical integration. excsum is the XC functional value. vmat is the XC potential matrix in 2D array of shape (nao,nao) where nao is the number of AO functions. Examples: ''' if kpts is None: kpts = numpy.zeros((1,3)) xctype = ni._xc_type(xc_code) dma, dmb = _format_uks_dm(dms) nao = dma.shape[-1] make_rhoa, nset = ni._gen_rho_evaluator(cell, dma, hermi)[:2] make_rhob = ni._gen_rho_evaluator(cell, dmb, hermi)[0] if ((xctype == 'LDA' and fxc is None) or (xctype == 'GGA' and rho0 is None)): dm0a, dm0b = _format_uks_dm(dm0) make_rho0a = ni._gen_rho_evaluator(cell, dm0a, 1)[0] make_rho0b = ni._gen_rho_evaluator(cell, dm0b, 1)[0] shls_slice = (0, cell.nbas) ao_loc = cell.ao_loc_nr() vmata = [0] * nset vmatb = [0] * nset if xctype == 'LDA': ao_deriv = 0 ip = 0 for ao_k1, ao_k2, mask, weight, coords \ in ni.block_loop(cell, grids, nao, ao_deriv, kpts, None, max_memory): ngrid = weight.size if fxc is None: rho0a = make_rho0a(0, ao_k1, mask, xctype) rho0b = make_rho0b(0, ao_k1, mask, xctype) fxc0 = ni.eval_xc(xc_code, (rho0a,rho0b), 1, relativity, 2, verbose)[2] u_u, u_d, d_d = fxc0[0].T else: u_u, u_d, d_d = fxc[0][ip:ip+ngrid].T ip += ngrid for i in range(nset): rho1a = make_rhoa(i, ao_k1, mask, xctype) rho1b = make_rhob(i, ao_k1, mask, xctype) wv = u_u * rho1a + u_d * rho1b wv *= weight vmata[i] += ni._fxc_mat(cell, ao_k1, wv, mask, xctype, ao_loc) wv = u_d * rho1a + d_d * rho1b wv *= weight vmatb[i] += ni._fxc_mat(cell, ao_k1, wv, mask, xctype, ao_loc) elif xctype == 'GGA': ao_deriv = 1 ip = 0 for ao_k1, ao_k2, mask, weight, coords \ in ni.block_loop(cell, grids, nao, ao_deriv, kpts, None, max_memory): ngrid = weight.size if rho0 is None: rho0a = make_rho0a(0, ao_k1, mask, xctype) rho0b = make_rho0b(0, ao_k1, mask, xctype) else: rho0a = rho0[0][:,ip:ip+ngrid] rho0b = rho0[1][:,ip:ip+ngrid] if vxc is None or fxc is None: vxc0, fxc0 = ni.eval_xc(xc_code, (rho0a,rho0b), 1, relativity, 2, verbose)[1:3] else: vxc0 = (None, vxc[1][ip:ip+ngrid]) fxc0 = (fxc[0][ip:ip+ngrid], fxc[1][ip:ip+ngrid], fxc[2][ip:ip+ngrid]) ip += ngrid for i in range(nset): rho1a = make_rhoa(i, ao_k1, mask, xctype) rho1b = make_rhob(i, ao_k1, mask, xctype) wva, wvb = _uks_gga_wv1((rho0a,rho0b), (rho1a,rho1b), vxc0, fxc0, weight) vmata[i] += ni._fxc_mat(cell, ao_k1, wva, mask, xctype, ao_loc) vmatb[i] += ni._fxc_mat(cell, ao_k1, wvb, mask, xctype, ao_loc) for i in range(nset): # for (\nabla\mu) \nu + \mu (\nabla\nu) vmata[i] = vmata[i] + vmata[i].swapaxes(-1,-2).conj() vmatb[i] = vmatb[i] + vmatb[i].swapaxes(-1,-2).conj() elif xctype == 'MGGA': raise NotImplementedError('meta-GGA') if dma.ndim == vmata[0].ndim: # One set of DMs in the input vmata = vmata[0] vmatb = vmatb[0] return lib.asarray((vmata,vmatb)) def _fxc_mat(cell, ao, wv, non0tab, xctype, ao_loc): shls_slice = (0, cell.nbas) if xctype == 'LDA' or xctype == 'HF': #:aow = numpy.einsum('pi,p->pi', ao, wv) aow = _scale_ao(ao, wv) mat = _dot_ao_ao(cell, ao, aow, non0tab, shls_slice, ao_loc) else: #:aow = numpy.einsum('npi,np->pi', ao, wv) aow = _scale_ao(ao, wv) mat = _dot_ao_ao(cell, ao[0], aow, non0tab, shls_slice, ao_loc) return mat def cache_xc_kernel(ni, cell, grids, xc_code, mo_coeff, mo_occ, spin=0, kpts=None, max_memory=2000): '''Compute the 0th order density, Vxc and fxc. They can be used in TDDFT, DFT hessian module etc. ''' if kpts is None: kpts = numpy.zeros((1,3)) xctype = ni._xc_type(xc_code) ao_deriv = 0 if xctype == 'GGA': ao_deriv = 1 elif xctype == 'MGGA': raise NotImplementedError('meta-GGA') nao = cell.nao_nr() if spin == 0: rho = [] for ao_k1, ao_k2, mask, weight, coords \ in ni.block_loop(cell, grids, nao, ao_deriv, kpts, None, max_memory): rho.append(ni.eval_rho2(cell, ao_k1, mo_coeff, mo_occ, mask, xctype)) rho = numpy.hstack(rho) else: rhoa = [] rhob = [] for ao_k1, ao_k2, mask, weight, coords \ in ni.block_loop(cell, grids, nao, ao_deriv, kpts, None, max_memory): rhoa.append(ni.eval_rho2(cell, ao_k1, mo_coeff[0], mo_occ[0], mask, xctype)) rhob.append(ni.eval_rho2(cell, ao_k1, mo_coeff[1], mo_occ[1], mask, xctype)) rho = (numpy.hstack(rhoa), numpy.hstack(rhob)) vxc, fxc = ni.eval_xc(xc_code, rho, spin, 0, 2, 0)[1:3] return rho, vxc, fxc def get_rho(ni, cell, dm, grids, kpts=numpy.zeros((1,3)), max_memory=2000): '''Density in real space ''' make_rho, nset, nao = ni._gen_rho_evaluator(cell, dm) assert(nset == 1) rho = numpy.empty(grids.weights.size) p1 = 0 for ao_k1, ao_k2, mask, weight, coords \ in ni.block_loop(cell, grids, nao, 0, kpts, None, max_memory): p0, p1 = p1, p1 + weight.size rho[p0:p1] = make_rho(0, ao_k1, mask, 'LDA') return rho class NumInt(numint.NumInt): '''Generalization of pyscf's NumInt class for a single k-point shift and periodic images. ''' def eval_ao(self, cell, coords, kpt=numpy.zeros(3), deriv=0, relativity=0, shls_slice=None, non0tab=None, out=None, verbose=None): return eval_ao(cell, coords, kpt, deriv, relativity, shls_slice, non0tab, out, verbose) @lib.with_doc(make_mask.__doc__) def make_mask(self, cell, coords, relativity=0, shls_slice=None, verbose=None): return make_mask(cell, coords, relativity, shls_slice, verbose) @lib.with_doc(eval_rho.__doc__) def eval_rho(self, cell, ao, dm, non0tab=None, xctype='LDA', hermi=0, verbose=None): return eval_rho(cell, ao, dm, non0tab, xctype, hermi, verbose) def eval_rho2(self, cell, ao, mo_coeff, mo_occ, non0tab=None, xctype='LDA', verbose=None): return eval_rho2(cell, ao, mo_coeff, mo_occ, non0tab, xctype, verbose) def nr_vxc(self, cell, grids, xc_code, dms, spin=0, relativity=0, hermi=0, kpt=None, kpts_band=None, max_memory=2000, verbose=None): '''Evaluate RKS/UKS XC functional and potential matrix. See :func:`nr_rks` and :func:`nr_uks` for more details. ''' if spin == 0: return self.nr_rks(cell, grids, xc_code, dms, hermi, kpt, kpts_band, max_memory, verbose) else: return self.nr_uks(cell, grids, xc_code, dms, hermi, kpt, kpts_band, max_memory, verbose) @lib.with_doc(nr_rks.__doc__) def nr_rks(self, cell, grids, xc_code, dms, hermi=0, kpt=numpy.zeros(3), kpts_band=None, max_memory=2000, verbose=None): if kpts_band is not None: # To compute Vxc on kpts_band, convert the NumInt object to KNumInt object. ni = KNumInt() ni.__dict__.update(self.__dict__) nao = dms.shape[-1] return ni.nr_rks(cell, grids, xc_code, dms.reshape(-1,1,nao,nao), hermi, kpt.reshape(1,3), kpts_band, max_memory, verbose) return nr_rks(self, cell, grids, xc_code, dms, 0, 0, hermi, kpt, kpts_band, max_memory, verbose) @lib.with_doc(nr_uks.__doc__) def nr_uks(self, cell, grids, xc_code, dms, hermi=0, kpt=numpy.zeros(3), kpts_band=None, max_memory=2000, verbose=None): if kpts_band is not None: # To compute Vxc on kpts_band, convert the NumInt object to KNumInt object. ni = KNumInt() ni.__dict__.update(self.__dict__) nao = dms[0].shape[-1] return ni.nr_uks(cell, grids, xc_code, dms.reshape(-1,1,nao,nao), hermi, kpt.reshape(1,3), kpts_band, max_memory, verbose) return nr_uks(self, cell, grids, xc_code, dms, 1, 0, hermi, kpt, kpts_band, max_memory, verbose) def eval_mat(self, cell, ao, weight, rho, vxc, non0tab=None, xctype='LDA', spin=0, verbose=None): # Guess whether ao is evaluated for kpts_band. When xctype is LDA, ao on grids # should be a 2D array. For other xc functional, ao should be a 3D array. if ao.ndim == 2 or (xctype != 'LDA' and ao.ndim == 3): mat = eval_mat(cell, ao, weight, rho, vxc, non0tab, xctype, spin, verbose) else: nkpts = len(ao) nao = ao[0].shape[-1] mat = numpy.empty((nkpts,nao,nao), dtype=numpy.complex128) for k in range(nkpts): mat[k] = eval_mat(cell, ao[k], weight, rho, vxc, non0tab, xctype, spin, verbose) return mat def _fxc_mat(self, cell, ao, wv, non0tab, xctype, ao_loc): return _fxc_mat(cell, ao, wv, non0tab, xctype, ao_loc) def block_loop(self, cell, grids, nao, deriv=0, kpt=numpy.zeros(3), kpts_band=None, max_memory=2000, non0tab=None, blksize=None): '''Define this macro to loop over grids by blocks. ''' # For UniformGrids, grids.coords does not indicate whehter grids are initialized if grids.non0tab is None: grids.build(with_non0tab=True) grids_coords = grids.coords grids_weights = grids.weights ngrids = grids_coords.shape[0] comp = (deriv+1)*(deriv+2)*(deriv+3)//6 # NOTE to index grids.non0tab, the blksize needs to be the integer multiplier of BLKSIZE if blksize is None: blksize = int(max_memory*1e6/(comp*2*nao*16*BLKSIZE))*BLKSIZE blksize = max(BLKSIZE, min(blksize, ngrids, BLKSIZE*1200)) if non0tab is None: non0tab = grids.non0tab if non0tab is None: non0tab = numpy.empty(((ngrids+BLKSIZE-1)//BLKSIZE,cell.nbas), dtype=numpy.uint8) non0tab[:] = 0xff kpt = numpy.reshape(kpt, 3) if kpts_band is None: kpt1 = kpt2 = kpt else: kpt1 = kpts_band kpt2 = kpt for ip0 in range(0, ngrids, blksize): ip1 = min(ngrids, ip0+blksize) coords = grids_coords[ip0:ip1] weight = grids_weights[ip0:ip1] non0 = non0tab[ip0//BLKSIZE:] ao_k2 = self.eval_ao(cell, coords, kpt2, deriv=deriv, non0tab=non0) if abs(kpt1-kpt2).sum() < 1e-9: ao_k1 = ao_k2 else: ao_k1 = self.eval_ao(cell, coords, kpt1, deriv=deriv) yield ao_k1, ao_k2, non0, weight, coords ao_k1 = ao_k2 = None def _gen_rho_evaluator(self, cell, dms, hermi=0): return numint.NumInt._gen_rho_evaluator(self, cell, dms, hermi) nr_rks_fxc = nr_rks_fxc nr_uks_fxc = nr_uks_fxc cache_xc_kernel = cache_xc_kernel get_rho = get_rho def rsh_and_hybrid_coeff(self, xc_code, spin=0): omega, alpha, hyb = numint.NumInt.rsh_and_hybrid_coeff(self, xc_code, spin) if abs(omega) > 1e-10: raise NotImplementedError return omega, alpha, hyb _NumInt = NumInt class KNumInt(numint.NumInt): '''Generalization of pyscf's NumInt class for k-point sampling and periodic images. ''' def __init__(self, kpts=numpy.zeros((1,3))): numint.NumInt.__init__(self) self.kpts = numpy.reshape(kpts, (-1,3)) def eval_ao(self, cell, coords, kpts=numpy.zeros((1,3)), deriv=0, relativity=0, shls_slice=None, non0tab=None, out=None, verbose=None, **kwargs): return eval_ao_kpts(cell, coords, kpts, deriv, relativity, shls_slice, non0tab, out, verbose) @lib.with_doc(make_mask.__doc__) def make_mask(self, cell, coords, relativity=0, shls_slice=None, verbose=None): return make_mask(cell, coords, relativity, shls_slice, verbose) def eval_rho(self, cell, ao_kpts, dm_kpts, non0tab=None, xctype='LDA', hermi=0, verbose=None): '''Collocate the *real* density (opt. gradients) on the real-space grid. Args: cell : Mole or Cell object ao_kpts : (nkpts, ngrids, nao) ndarray AO values at each k-point dm_kpts: (nkpts, nao, nao) ndarray Density matrix at each k-point Returns: rhoR : (ngrids,) ndarray ''' nkpts = len(ao_kpts) rhoR = 0 for k in range(nkpts): rhoR += eval_rho(cell, ao_kpts[k], dm_kpts[k], non0tab, xctype, hermi, verbose) rhoR *= 1./nkpts return rhoR def eval_rho2(self, cell, ao_kpts, mo_coeff_kpts, mo_occ_kpts, non0tab=None, xctype='LDA', verbose=None): nkpts = len(ao_kpts) rhoR = 0 for k in range(nkpts): rhoR += eval_rho2(cell, ao_kpts[k], mo_coeff_kpts[k], mo_occ_kpts[k], non0tab, xctype, verbose) rhoR *= 1./nkpts return rhoR def nr_vxc(self, cell, grids, xc_code, dms, spin=0, relativity=0, hermi=0, kpts=None, kpts_band=None, max_memory=2000, verbose=None): '''Evaluate RKS/UKS XC functional and potential matrix. See :func:`nr_rks` and :func:`nr_uks` for more details. ''' if spin == 0: return self.nr_rks(cell, grids, xc_code, dms, hermi, kpts, kpts_band, max_memory, verbose) else: return self.nr_uks(cell, grids, xc_code, dms, hermi, kpts, kpts_band, max_memory, verbose) @lib.with_doc(nr_rks.__doc__) def nr_rks(self, cell, grids, xc_code, dms, hermi=0, kpts=None, kpts_band=None, max_memory=2000, verbose=None, **kwargs): if kpts is None: if 'kpt' in kwargs: sys.stderr.write('WARN: KNumInt.nr_rks function finds keyword ' 'argument "kpt" and converts it to "kpts"\n') kpts = kwargs['kpt'] else: kpts = self.kpts kpts = kpts.reshape(-1,3) return nr_rks(self, cell, grids, xc_code, dms, 0, 0, hermi, kpts, kpts_band, max_memory, verbose) @lib.with_doc(nr_uks.__doc__) def nr_uks(self, cell, grids, xc_code, dms, hermi=0, kpts=None, kpts_band=None, max_memory=2000, verbose=None, **kwargs): if kpts is None: if 'kpt' in kwargs: sys.stderr.write('WARN: KNumInt.nr_uks function finds keyword ' 'argument "kpt" and converts it to "kpts"\n') kpts = kwargs['kpt'] else: kpts = self.kpts kpts = kpts.reshape(-1,3) return nr_uks(self, cell, grids, xc_code, dms, 1, 0, hermi, kpts, kpts_band, max_memory, verbose) def eval_mat(self, cell, ao_kpts, weight, rho, vxc, non0tab=None, xctype='LDA', spin=0, verbose=None): nkpts = len(ao_kpts) nao = ao_kpts[0].shape[-1] dtype = numpy.result_type(*ao_kpts) mat = numpy.empty((nkpts,nao,nao), dtype=dtype) for k in range(nkpts): mat[k] = eval_mat(cell, ao_kpts[k], weight, rho, vxc, non0tab, xctype, spin, verbose) return mat def _fxc_mat(self, cell, ao_kpts, wv, non0tab, xctype, ao_loc): nkpts = len(ao_kpts) nao = ao_kpts[0].shape[-1] dtype = numpy.result_type(*ao_kpts) mat = numpy.empty((nkpts,nao,nao), dtype=dtype) for k in range(nkpts): mat[k] = _fxc_mat(cell, ao_kpts[k], wv, non0tab, xctype, ao_loc) return mat def block_loop(self, cell, grids, nao, deriv=0, kpts=numpy.zeros((1,3)), kpts_band=None, max_memory=2000, non0tab=None, blksize=None): '''Define this macro to loop over grids by blocks. ''' if grids.coords is None: grids.build(with_non0tab=True) grids_coords = grids.coords grids_weights = grids.weights ngrids = grids_coords.shape[0] nkpts = len(kpts) comp = (deriv+1)*(deriv+2)*(deriv+3)//6 # NOTE to index grids.non0tab, the blksize needs to be the integer multiplier of BLKSIZE if blksize is None: blksize = int(max_memory*1e6/(comp*2*nkpts*nao*16*BLKSIZE))*BLKSIZE blksize = max(BLKSIZE, min(blksize, ngrids, BLKSIZE*1200)) if non0tab is None: non0tab = grids.non0tab if non0tab is None: non0tab = numpy.empty(((ngrids+BLKSIZE-1)//BLKSIZE,cell.nbas), dtype=numpy.uint8) non0tab[:] = 0xff if kpts_band is not None: kpts_band = numpy.reshape(kpts_band, (-1,3)) where = [member(k, kpts) for k in kpts_band] where = [k_id[0] if len(k_id)>0 else None for k_id in where] for ip0 in range(0, ngrids, blksize): ip1 = min(ngrids, ip0+blksize) coords = grids_coords[ip0:ip1] weight = grids_weights[ip0:ip1] non0 = non0tab[ip0//BLKSIZE:] ao_k1 = ao_k2 = self.eval_ao(cell, coords, kpts, deriv=deriv, non0tab=non0) if kpts_band is not None: ao_k1 = self.eval_ao(cell, coords, kpts_band, deriv=deriv, non0tab=non0) yield ao_k1, ao_k2, non0, weight, coords ao_k1 = ao_k2 = None def _gen_rho_evaluator(self, cell, dms, hermi=0): if getattr(dms, 'mo_coeff', None) is not None: mo_coeff = dms.mo_coeff mo_occ = dms.mo_occ if isinstance(dms[0], numpy.ndarray) and dms[0].ndim == 2: mo_coeff = [mo_coeff] mo_occ = [mo_occ] nao = cell.nao_nr() ndms = len(mo_occ) def make_rho(idm, ao, non0tab, xctype): return self.eval_rho2(cell, ao, mo_coeff[idm], mo_occ[idm], non0tab, xctype) else: if isinstance(dms[0], numpy.ndarray) and dms[0].ndim == 2: dms = [numpy.stack(dms)] #if not hermi: # Density (or response of density) is always real for DFT. # Symmetrizing DM for gamma point should not change the value of # density. However, when k-point is considered, unless dm and # dm.conj().transpose produce the same real part of density, the # symmetrization code below may be incorrect (proof is needed). # # dm.shape = (nkpts, nao, nao) # dms = [(dm+dm.conj().transpose(0,2,1))*.5 for dm in dms] nao = dms[0].shape[-1] ndms = len(dms) def make_rho(idm, ao_kpts, non0tab, xctype): return self.eval_rho(cell, ao_kpts, dms[idm], non0tab, xctype, hermi=hermi) return make_rho, ndms, nao nr_rks_fxc = nr_rks_fxc nr_uks_fxc = nr_uks_fxc cache_xc_kernel = cache_xc_kernel get_rho = get_rho def rsh_and_hybrid_coeff(self, xc_code, spin=0): omega, alpha, hyb = numint.NumInt.rsh_and_hybrid_coeff(self, xc_code, spin) if abs(omega) > 1e-10: raise NotImplementedError return omega, alpha, hyb _KNumInt = KNumInt
41.355892
95
0.545637
7,371
51,943
3.699362
0.074345
0.014523
0.007041
0.012102
0.799069
0.763606
0.734964
0.701592
0.693304
0.658097
0
0.030061
0.337793
51,943
1,255
96
41.388845
0.762683
0.231889
0
0.673519
0
0
0.015093
0
0
0
0.000411
0.000797
0.002418
1
0.050786
false
0
0.01451
0.01451
0.129383
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
9c4e78aa793fe9e71558ddf4e79b4cbb63bb97b7
92
py
Python
Chapter10/url_response_header.py
add54/ADMIN_SYS_PYTHON
5a6d9705537c8663c8f7b0f45d29ccc87b6096e7
[ "MIT" ]
116
2018-12-21T01:05:47.000Z
2022-03-23T21:41:41.000Z
Chapter10/url_response_header.py
add54/ADMIN_SYS_PYTHON
5a6d9705537c8663c8f7b0f45d29ccc87b6096e7
[ "MIT" ]
2
2021-03-31T19:36:19.000Z
2021-06-10T22:29:26.000Z
Chapter10/url_response_header.py
add54/ADMIN_SYS_PYTHON
5a6d9705537c8663c8f7b0f45d29ccc87b6096e7
[ "MIT" ]
147
2018-12-19T14:10:32.000Z
2022-03-20T11:03:20.000Z
import urllib.request x = urllib.request.urlopen('https://www.imdb.com/') print(x.info())
15.333333
51
0.706522
14
92
4.642857
0.785714
0.4
0
0
0
0
0
0
0
0
0
0
0.086957
92
5
52
18.4
0.77381
0
0
0
0
0
0.230769
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0.333333
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
9c7a8b5bba8a18f6762dd43740cf9efc305e6a7b
201
py
Python
algo_trading/signal_detector/apps.py
qz-fordham/algo-trading-microservice
8778daeb90250f7c5c0e772c24d4912326850a37
[ "MIT" ]
1
2022-02-12T08:10:27.000Z
2022-02-12T08:10:27.000Z
algo_trading/signal_detector/apps.py
qz-fordham/algo-trading-microservice
8778daeb90250f7c5c0e772c24d4912326850a37
[ "MIT" ]
null
null
null
algo_trading/signal_detector/apps.py
qz-fordham/algo-trading-microservice
8778daeb90250f7c5c0e772c24d4912326850a37
[ "MIT" ]
1
2022-02-11T03:43:41.000Z
2022-02-11T03:43:41.000Z
from django.apps import AppConfig class SignalDetectorConfig(AppConfig): """ Configure app name due to it has model and need to be added into settings.py """ name = 'signal_detector'
22.333333
80
0.711443
27
201
5.259259
0.888889
0
0
0
0
0
0
0
0
0
0
0
0.218905
201
8
81
25.125
0.904459
0.378109
0
0
0
0
0.137615
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
92ce567a2d03afe77e50b04ee28d7bb3a797f2dc
83
py
Python
api/models.py
taqueci/nomoney
940879ffff0d17724709e642d9c1911ac4e996ce
[ "MIT" ]
null
null
null
api/models.py
taqueci/nomoney
940879ffff0d17724709e642d9c1911ac4e996ce
[ "MIT" ]
2
2020-06-06T13:08:38.000Z
2022-02-10T14:51:16.000Z
api/models.py
taqueci/nomoney
940879ffff0d17724709e642d9c1911ac4e996ce
[ "MIT" ]
null
null
null
# Copyright (C) Takeshi Nakamura. All rights reserved. # Create your models here.
20.75
54
0.746988
11
83
5.636364
1
0
0
0
0
0
0
0
0
0
0
0
0.168675
83
3
55
27.666667
0.898551
0.927711
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
92de015a4f1a2cf3c6c026cc1d2d5af106ab1733
81
py
Python
orangecontrib/wonder/__init__.py
WONDER-project/OASYS1-WONDER
cf6e3620f95c0b14c5c33d13161f615f2ac23b14
[ "Unlicense" ]
null
null
null
orangecontrib/wonder/__init__.py
WONDER-project/OASYS1-WONDER
cf6e3620f95c0b14c5c33d13161f615f2ac23b14
[ "Unlicense" ]
null
null
null
orangecontrib/wonder/__init__.py
WONDER-project/OASYS1-WONDER
cf6e3620f95c0b14c5c33d13161f615f2ac23b14
[ "Unlicense" ]
null
null
null
# namespace declaration __import__("pkg_resources").declare_namespace(__name__)
20.25
55
0.839506
8
81
7.25
0.875
0
0
0
0
0
0
0
0
0
0
0
0.061728
81
3
56
27
0.763158
0.259259
0
0
0
0
0.22807
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
92e7f1fff1ffc27760a1647b704ce8ce49e912e8
296
py
Python
cluster_tools/transformations/__init__.py
constantinpape/cluster_tools
a7e88545b58f8315723bc47583916e1900a7892d
[ "MIT" ]
28
2018-12-09T22:11:52.000Z
2022-02-01T16:48:23.000Z
cluster_tools/transformations/__init__.py
constantinpape/cluster_tools
a7e88545b58f8315723bc47583916e1900a7892d
[ "MIT" ]
16
2019-01-27T10:59:33.000Z
2022-01-11T09:09:24.000Z
cluster_tools/transformations/__init__.py
constantinpape/cluster_tools
a7e88545b58f8315723bc47583916e1900a7892d
[ "MIT" ]
11
2018-12-09T22:11:56.000Z
2021-08-08T20:10:13.000Z
from .transformation_workflows import (AffineTransformationWorkflow, LinearTransformationWorkflow, TransformixCoordinateTransformationWorkflow, TransformixTransformationWorkflow)
59.2
83
0.560811
8
296
20.625
1
0
0
0
0
0
0
0
0
0
0
0
0.418919
296
4
84
74
0.959302
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.25
0
0.25
0
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
13228fa60e5b42fe5b6db9799fb66a062e19c2d2
330
py
Python
make_simples.py
seanandrews/dsalt
797c6c085b6cd0c82fa2a7c8b47d39d49815e7a6
[ "MIT" ]
2
2021-04-28T23:12:09.000Z
2021-05-11T19:56:07.000Z
make_simples.py
seanandrews/dsalt
797c6c085b6cd0c82fa2a7c8b47d39d49815e7a6
[ "MIT" ]
null
null
null
make_simples.py
seanandrews/dsalt
797c6c085b6cd0c82fa2a7c8b47d39d49815e7a6
[ "MIT" ]
1
2021-08-11T19:07:23.000Z
2021-08-11T19:07:23.000Z
import os, sys import numpy as np from csalt.synthesize import make_data from csalt.dmr import * make_data('simple2-default') foo = img_cube('simple2-default') #bar = dmr('simple2-default') #poo = img_cube('simple2-default', cubetype='MOD', makemask=False) #pee = img_cube('simple2-default', cubetype='RES', makemask=False)
20.625
66
0.739394
48
330
4.979167
0.520833
0.292887
0.175732
0.263598
0.242678
0
0
0
0
0
0
0.017123
0.115152
330
15
67
22
0.80137
0.478788
0
0
0
0
0.180723
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
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
1
0
1
0
0
4
134c897b4b60e462e9d81b33bba0f33350d862ae
178
py
Python
landing_page/models.py
luisjorge129/Real-Empire-Studio-Website
47722e89167d7d1db7585f433fa3e6facb9b7207
[ "MIT" ]
null
null
null
landing_page/models.py
luisjorge129/Real-Empire-Studio-Website
47722e89167d7d1db7585f433fa3e6facb9b7207
[ "MIT" ]
null
null
null
landing_page/models.py
luisjorge129/Real-Empire-Studio-Website
47722e89167d7d1db7585f433fa3e6facb9b7207
[ "MIT" ]
null
null
null
from django.db import models from core.models import TimeStampedModel # Create your models here. class Subscribe(TimeStampedModel): email = models.EmailField(unique=True)
19.777778
42
0.792135
22
178
6.409091
0.727273
0
0
0
0
0
0
0
0
0
0
0
0.140449
178
8
43
22.25
0.921569
0.134831
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
134ebafde80cb62688d0b4a2b4024f6d4cb44557
64
py
Python
ttracker/model/actions/float_mana.py
lmeilibr/ttracker
a06cc0876fb1898cc45b168d7d87f37089900dae
[ "MIT" ]
null
null
null
ttracker/model/actions/float_mana.py
lmeilibr/ttracker
a06cc0876fb1898cc45b168d7d87f37089900dae
[ "MIT" ]
null
null
null
ttracker/model/actions/float_mana.py
lmeilibr/ttracker
a06cc0876fb1898cc45b168d7d87f37089900dae
[ "MIT" ]
null
null
null
class FloatMana: def __init__(self, content): pass
12.8
32
0.625
7
64
5.142857
1
0
0
0
0
0
0
0
0
0
0
0
0.296875
64
4
33
16
0.8
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0.333333
0
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
4
13559eea2d4f5a217d75e528685261402aaadf11
41,699
py
Python
assets/catalogue.py
Ishayahu/MJCC-tasks
68ea00dab543e6e4e0f6cf6b6683f3719bb6f3c0
[ "MIT" ]
1
2017-09-25T09:36:46.000Z
2017-09-25T09:36:46.000Z
assets/catalogue.py
Ishayahu/MJCC-tasks
68ea00dab543e6e4e0f6cf6b6683f3719bb6f3c0
[ "MIT" ]
40
2015-05-29T11:25:15.000Z
2015-08-13T10:28:17.000Z
assets/catalogue.py
Ishayahu/MJCC-tasks
68ea00dab543e6e4e0f6cf6b6683f3719bb6f3c0
[ "MIT" ]
null
null
null
# -*- coding:utf-8 -*- # coding=<utf8> # Оперативная память ROM_form_factors = (('SIMM', 'SIMM'), ('DIMM', 'DIMM'), ('FB-DIMM', 'FB-DIMM'), ('SODIMM', 'SODIMM'), ('MicroDIMM', 'MicroDIMM'), ('RIMM', 'RIMM')) ROM_type=(('DDR', 'DDR'), ('DDR2', 'DDR2'), ('DDR3', 'DDR3'), ('RDRAM', 'RDRAM'), ('SDRAM', 'SDRAM')) ROM_firms = (('Corsair', 'Corsair'), ('Crucial', 'Crucial'), ('Foxline', 'Foxline'), ('G.SKILL', 'G.SKILL'), ('HP', 'HP'), ('Hynix', 'Hynix'), ('Kingmax', 'Kingmax'), ('Kingston', 'Kingston'), ('Patriot Memory', 'Patriot Memory'), ('Samsung', 'Samsung'), ('Silicon Power', 'Silicon Power'), ('Transcend', 'Transcend'), ('Acer', 'Acer'), ('ADATA', 'ADATA'), ('AMD', 'AMD'), ('Apacer', 'Apacer'), ('Apple', 'Apple'), ('Ceon', 'Ceon'), ('Chaintech', 'Chaintech'), ('Cisco', 'Cisco'), ('DELL', 'DELL'), ('Digma', 'Digma'), ('Elixir', 'Elixir'), ('EUDAR', 'EUDAR'), ('Exceleram', 'Exceleram'), ('Fujitsu', 'Fujitsu'), ('Fujitsu-Siemens', 'Fujitsu-Siemens'), ('Geil', 'Geil'), ('GoodRAM', 'GoodRAM'), ('Lenovo', 'Lenovo'), ('Micron', 'Micron'), ('Mushkin', 'Mushkin'), ('Nanya', 'Nanya'), ('NCP', 'NCP'), ('OCZ', 'OCZ'), ('PQI', 'PQI'), ('Qumo', 'Qumo'), ('Sony', 'Sony'), ('Spectek', 'Spectek'), ('Sun Microsystems', 'Sun Microsystems'), ('Super Talent', 'Super Talent'), ('TakeMS', 'TakeMS'), ('Team Group', 'Team Group'), ('Toshiba', 'Toshiba'), ('TwinMOS', 'TwinMOS')) ROM_V = (('128', '128'), ('512', '512'), ('1024', '1024'), ('2048', '2048'), ('4096', '4096'), ('8192', '8192')) ROM_clock_frequency = (('100 MHz', '100 MHz'), ('1000 MHz', '1000 MHz'), ('1066 MHz', '1066 MHz'), ('1100 MHz', '1100 MHz'), ('1200 MHz', '1200 MHz'), ('133 MHz', '133 MHz'), ('1333 MHz', '1333 MHz'), ('1375 MHz', '1375 MHz'), ('1600 MHz', '1600 MHz'), ('1750 MHz', '1750 MHz'), ('1800 MHz', '1800 MHz'), ('1866 MHz', '1866 MHz'), ('200 MHz', '200 MHz'), ('2000 MHz', '2000 MHz'), ('2133 MHz', '2133 MHz'), ('2200 MHz', '2200 MHz'), ('2250 MHz', '2250 MHz'), ('2300 MHz', '2300 MHz'), ('2400 MHz', '2400 MHz'), ('2600 MHz', '2600 MHz'), ('266 MHz', '266 MHz'), ('2666 MHz', '2666 MHz'), ('2800 MHz', '2800 MHz'), ('333 MHz', '333 MHz'), ('400 MHz', '400 MHz'), ('500 MHz', '500 MHz'), ('533 MHz', '533 MHz'), ('66 MHz', '66 MHz'), ('667 MHz', '667 MHz'), ('750 MHz', '750 MHz'), ('800 MHz', '800 MHz')) ROM_throughput = (("Don't Know","Don't Know"),('10600 \xd0\x9c\xd0\xb1/\xd1\x81', '10600 \xd0\x9c\xd0\xb1/\xd1\x81'), ('10660 \xd0\x9c\xd0\xb1/\xd1\x81', '10660 \xd0\x9c\xd0\xb1/\xd1\x81'), ('10666 \xd0\x9c\xd0\xb1/\xd1\x81', '10666 \xd0\x9c\xd0\xb1/\xd1\x81'), ('10700 \xd0\x9c\xd0\xb1/\xd1\x81', '10700 \xd0\x9c\xd0\xb1/\xd1\x81'), ('12800 \xd0\x9c\xd0\xb1/\xd1\x81', '12800 \xd0\x9c\xd0\xb1/\xd1\x81'), ('14000 \xd0\x9c\xd0\xb1/\xd1\x81', '14000 \xd0\x9c\xd0\xb1/\xd1\x81'), ('14400 \xd0\x9c\xd0\xb1/\xd1\x81', '14400 \xd0\x9c\xd0\xb1/\xd1\x81'), ('14900 \xd0\x9c\xd0\xb1/\xd1\x81', '14900 \xd0\x9c\xd0\xb1/\xd1\x81'), ('15000 \xd0\x9c\xd0\xb1/\xd1\x81', '15000 \xd0\x9c\xd0\xb1/\xd1\x81'), ('1600 \xd0\x9c\xd0\xb1/\xd1\x81', '1600 \xd0\x9c\xd0\xb1/\xd1\x81'), ('16000 \xd0\x9c\xd0\xb1/\xd1\x81', '16000 \xd0\x9c\xd0\xb1/\xd1\x81'), ('17000 \xd0\x9c\xd0\xb1/\xd1\x81', '17000 \xd0\x9c\xd0\xb1/\xd1\x81'), ('17066 \xd0\x9c\xd0\xb1/\xd1\x81', '17066 \xd0\x9c\xd0\xb1/\xd1\x81'), ('17600 \xd0\x9c\xd0\xb1/\xd1\x81', '17600 \xd0\x9c\xd0\xb1/\xd1\x81'), ('18000 \xd0\x9c\xd0\xb1/\xd1\x81', '18000 \xd0\x9c\xd0\xb1/\xd1\x81'), ('18400 \xd0\x9c\xd0\xb1/\xd1\x81', '18400 \xd0\x9c\xd0\xb1/\xd1\x81'), ('19200 \xd0\x9c\xd0\xb1/\xd1\x81', '19200 \xd0\x9c\xd0\xb1/\xd1\x81'), ('20800 \xd0\x9c\xd0\xb1/\xd1\x81', '20800 \xd0\x9c\xd0\xb1/\xd1\x81'), ('2100 \xd0\x9c\xd0\xb1/\xd1\x81', '2100 \xd0\x9c\xd0\xb1/\xd1\x81'), ('21300 \xd0\x9c\xd0\xb1/\xd1\x81', '21300 \xd0\x9c\xd0\xb1/\xd1\x81'), ('21330 \xd0\x9c\xd0\xb1/\xd1\x81', '21330 \xd0\x9c\xd0\xb1/\xd1\x81'), ('22400 \xd0\x9c\xd0\xb1/\xd1\x81', '22400 \xd0\x9c\xd0\xb1/\xd1\x81'), ('2700 \xd0\x9c\xd0\xb1/\xd1\x81', '2700 \xd0\x9c\xd0\xb1/\xd1\x81'), ('3200 \xd0\x9c\xd0\xb1/\xd1\x81', '3200 \xd0\x9c\xd0\xb1/\xd1\x81'), ('4000 \xd0\x9c\xd0\xb1/\xd1\x81', '4000 \xd0\x9c\xd0\xb1/\xd1\x81'), ('4200 \xd0\x9c\xd0\xb1/\xd1\x81', '4200 \xd0\x9c\xd0\xb1/\xd1\x81'), ('4300 \xd0\x9c\xd0\xb1/\xd1\x81', '4300 \xd0\x9c\xd0\xb1/\xd1\x81'), ('5300 \xd0\x9c\xd0\xb1/\xd1\x81', '5300 \xd0\x9c\xd0\xb1/\xd1\x81'), ('6000 \xd0\x9c\xd0\xb1/\xd1\x81', '6000 \xd0\x9c\xd0\xb1/\xd1\x81'), ('6400 \xd0\x9c\xd0\xb1/\xd1\x81', '6400 \xd0\x9c\xd0\xb1/\xd1\x81'), ('8000 \xd0\x9c\xd0\xb1/\xd1\x81', '8000 \xd0\x9c\xd0\xb1/\xd1\x81'), ('8500 \xd0\x9c\xd0\xb1/\xd1\x81', '8500 \xd0\x9c\xd0\xb1/\xd1\x81'), ('8800 \xd0\x9c\xd0\xb1/\xd1\x81', '8800 \xd0\x9c\xd0\xb1/\xd1\x81'), ('9600 \xd0\x9c\xd0\xb1/\xd1\x81', '9600 \xd0\x9c\xd0\xb1/\xd1\x81')) # Кулеры Cooler_firms = (('Arctic Cooling', 'Arctic Cooling'), ('Cooler Master', 'Cooler Master'), ('Corsair', 'Corsair'), ('Deepcool', 'Deepcool'), ('GlacialTech', 'GlacialTech'), ('Ice Hammer', 'Ice Hammer'), ('Noctua', 'Noctua'), ('Scythe', 'Scythe'), ('Thermalright', 'Thermalright'), ('Thermaltake', 'Thermaltake'), ('Titan', 'Titan'), ('Zalman', 'Zalman'), ('@Lux', '@Lux'), ('AeroCool', 'AeroCool'), ('AIC', 'AIC'), ('Akasa', 'Akasa'), ('Alpenfoehn', 'Alpenfoehn'), ('Antec', 'Antec'), ('ASUS', 'ASUS'), ('Auras', 'Auras'), ('AVC', 'AVC'), ('be quiet!', 'be quiet!'), ('BitFenix', 'BitFenix'), ('Chieftec', 'Chieftec'), ('Coolcox', 'Coolcox'), ('Cooler Tech', 'Cooler Tech'), ('CoolerBoss', 'CoolerBoss'), ('CROWN', 'CROWN'), ('DELL', 'DELL'), ('DELTA', 'DELTA'), ('Dynatron', 'Dynatron'), ('Ebmpapst', 'Ebmpapst'), ('Enermax', 'Enermax'), ('Espada', 'Espada'), ('Evercool', 'Evercool'), ('Exegate', 'Exegate'), ('Floston', 'Floston'), ('Foxconn', 'Foxconn'), ('G.SKILL', 'G.SKILL'), ('GELID Solutions', 'GELID Solutions'), ('Gembird', 'Gembird'), ('GRAND', 'GRAND'), ('Gresso', 'Gresso'), ('Intel', 'Intel'), ('Jetart', 'Jetart'), ('Kinghun', 'Kinghun'), ('Koolance', 'Koolance'), ('larkooler', 'larkooler'), ('LEPA', 'LEPA'), ('LogicPower', 'LogicPower'), ('Manhattan', 'Manhattan'), ('Maxtron', 'Maxtron'), ('NANOXIA', 'NANOXIA'), ('Nexus', 'Nexus'), ('NOISEBLOCKER', 'NOISEBLOCKER'), ('NZXT', 'NZXT'), ('OCZ', 'OCZ'), ('Pangu', 'Pangu'), ('PCcooler', 'PCcooler'), ('Phanteks', 'Phanteks'), ('Prolimatech', 'Prolimatech'), ('Revoltec', 'Revoltec'), ('SilenX', 'SilenX'), ('SilverStone', 'SilverStone'), ('Speeze', 'Speeze'), ('Spire', 'Spire'), ('Spiriter', 'Spiriter'), ('STM', 'STM'), ('SUNON', 'SUNON'), ('Supermicro', 'Supermicro'), ('Sven', 'Sven'), ('ThermalFly', 'ThermalFly'), ('Vantec', 'Vantec'), ('Vizo', 'Vizo'), ('Xigmatek', 'Xigmatek'), ('Xilence', 'Xilence'), ('YATE LOON', 'YATE LOON'), ('ZAWARD', 'ZAWARD'), ('ZEROtherm', 'ZEROtherm')) Cooler_destination = (('\xd0\xb4\xd0\xbb\xd1\x8f \xd0\xb2\xd0\xb8\xd0\xb4\xd0\xb5\xd0\xbe\xd0\xba\xd0\xb0\xd1\x80\xd1\x82\xd1\x8b', '\xd0\xb4\xd0\xbb\xd1\x8f \xd0\xb2\xd0\xb8\xd0\xb4\xd0\xb5\xd0\xbe\xd0\xba\xd0\xb0\xd1\x80\xd1\x82\xd1\x8b'), ('\xd0\xb4\xd0\xbb\xd1\x8f \xd0\xb2\xd0\xb8\xd0\xbd\xd1\x87\xd0\xb5\xd1\x81\xd1\x82\xd0\xb5\xd1\x80\xd0\xb0', '\xd0\xb4\xd0\xbb\xd1\x8f \xd0\xb2\xd0\xb8\xd0\xbd\xd1\x87\xd0\xb5\xd1\x81\xd1\x82\xd0\xb5\xd1\x80\xd0\xb0'), ('\xd0\xb4\xd0\xbb\xd1\x8f \xd0\xba\xd0\xbe\xd1\x80\xd0\xbf\xd1\x83\xd1\x81\xd0\xb0', '\xd0\xb4\xd0\xbb\xd1\x8f \xd0\xba\xd0\xbe\xd1\x80\xd0\xbf\xd1\x83\xd1\x81\xd0\xb0'), ('\xd0\xb4\xd0\xbb\xd1\x8f \xd0\xbf\xd0\xb0\xd0\xbc\xd1\x8f\xd1\x82\xd0\xb8', '\xd0\xb4\xd0\xbb\xd1\x8f \xd0\xbf\xd0\xb0\xd0\xbc\xd1\x8f\xd1\x82\xd0\xb8'), ('\xd0\xb4\xd0\xbb\xd1\x8f \xd0\xbf\xd1\x80\xd0\xbe\xd1\x86\xd0\xb5\xd1\x81\xd1\x81\xd0\xbe\xd1\x80\xd0\xb0', '\xd0\xb4\xd0\xbb\xd1\x8f \xd0\xbf\xd1\x80\xd0\xbe\xd1\x86\xd0\xb5\xd1\x81\xd1\x81\xd0\xbe\xd1\x80\xd0\xb0'), ('\xd0\xb4\xd0\xbb\xd1\x8f \xd1\x87\xd0\xb8\xd0\xbf\xd1\x81\xd0\xb5\xd1\x82\xd0\xb0', '\xd0\xb4\xd0\xbb\xd1\x8f \xd1\x87\xd0\xb8\xd0\xbf\xd1\x81\xd0\xb5\xd1\x82\xd0\xb0'),("CPU fan","CPU fan")) Cooler_sockets = (('Socket A(462)/370', 'Socket A(462)/370'), ('Socket AM2', 'Socket AM2'), ('Socket AM2+', 'Socket AM2+'), ('Socket AM3/AM3+/FM1', 'Socket AM3/AM3+/FM1'), ('Socket FM2', 'Socket FM2'), ('Socket F/\xd0\xa132', 'Socket F/\xd0\xa132'), ('Socket F+', 'Socket F+'), ('Socket G34', 'Socket G34'), ('Socket 754', 'Socket 754'), ('Socket 939', 'Socket 939'), ('Socket 940', 'Socket 940'), ('Socket 478', 'Socket 478'), ('Socket 775', 'Socket 775'), ('Socket 1155/1156', 'Socket 1155/1156'), ('Socket 1366', 'Socket 1366'), ('Socket 1567', 'Socket 1567'), ('Socket 2011', 'Socket 2011'), ('Socket 603', 'Socket 603'), ('Socket 604', 'Socket 604'), ('Socket 771', 'Socket 771')) Cooler_connector = (('3-pin', '3-pin'), ('4-pin Molex', '4-pin Molex'), ('4-pin PWM', '4-pin PWM')) # Хранилища данных Storage_firms = (('ADATA', 'ADATA'), ('Hitachi', 'Hitachi'), ('Intel', 'Intel'), ('Kingston', 'Kingston'), ('OCZ', 'OCZ'), ('Plextor', 'Plextor'), ('Seagate', 'Seagate'), ('Silicon Power', 'Silicon Power'), ('Synology', 'Synology'), ('Toshiba', 'Toshiba'), ('Transcend', 'Transcend'), ('Western Digital', 'Western Digital')) Storage_form_factor = (('1.8"', '1.8"'), ('2.5"', '2.5"'), ('3.5"', '3.5"')) Storage_interfaces = (('SATA', 'SATA'), ('IDE', 'IDE'), ('USB', 'USB'), ('FireWire', 'FireWire'), ('PCI-E', 'PCI-E'), ('SCSI', 'SCSI'), ('SAS', 'SAS'), ('eSATA', 'eSATA'), ('FireWir e800', 'FireWir e800'), ('Fibre Channel', 'Fibre Channel'), ('Thunderbolt', 'Thunderbolt'), ('HSDL', 'HSDL'), ('mSata', 'mSata'), ('Ethernet', 'Ethernet'), ('ExpressCard/34', 'ExpressCard/34'), ('ZIF 40 pin', 'ZIF 40 pin'), ('mini PCI-E', 'mini PCI-E')) Storage_rpm = (('3600 rpm', '3600 rpm'), ('4200 rpm', '4200 rpm'), ('5200 rpm', '5200 rpm'), ('5400 rpm', '5400 rpm'), ('5700 rpm', '5700 rpm'), ('5900 rpm', '5900 rpm'), ('7200 rpm', '7200 rpm'), ('10000 rpm', '10000 rpm'), ('10025 rpm', '10025 rpm'), ('10075 rpm', '10075 rpm'), ('10500 rpm', '10500 rpm'), ('15000 rpm', '15000 rpm')) # Колонки и т.п. Acoustics_firms = (('Creative', 'Creative'), ('Defender', 'Defender'), ('Dialog', 'Dialog'), ('Edifier', 'Edifier'), ('Genius', 'Genius'), ('Harman/Kardon', 'Harman/Kardon'), ('JBL', 'JBL'), ('JetBalance', 'JetBalance'), ('Logitech', 'Logitech'), ('Microlab', 'Microlab'), ('Sven', 'Sven'), ('TopDevice', 'TopDevice'), ('', ''), ('4U', '4U'), ('A4Tech', 'A4Tech'), ('ACME', 'ACME'), ('Acoustic Energy', 'Acoustic Energy'), ('AirTone', 'AirTone'), ('Altec Lansing', 'Altec Lansing'), ('Arctic', 'Arctic'), ('ASUS', 'ASUS'), ('AVE', 'AVE'), ('BBK', 'BBK'), ('Bliss', 'Bliss'), ('Bose', 'Bose'), ('Bowers & Wilkins', 'Bowers & Wilkins'), ('Canyon', 'Canyon'), ('CBR', 'CBR'), ('Cirkuit Planet', 'Cirkuit Planet'), ('Codegen SuperPower', 'Codegen SuperPower'), ('Comep', 'Comep'), ('Cooler Master', 'Cooler Master'), ('Corsair', 'Corsair'), ('CROWN', 'CROWN'), ('DELL', 'DELL'), ('Delux', 'Delux'), ('DeTech', 'DeTech'), ('DIGITUS', 'DIGITUS'), ('Divoom', 'Divoom'), ('DTS', 'DTS'), ('Easy Touch', 'Easy Touch'), ('ENDEVER', 'ENDEVER'), ('Enzatec', 'Enzatec'), ('Espada', 'Espada'), ('F&D', 'F&D'), ('Fujitsu', 'Fujitsu'), ('Fujitsu-Siemens', 'Fujitsu-Siemens'), ('Gear Head', 'Gear Head'), ('Gembird', 'Gembird'), ('Gemix', 'Gemix'), ('GIGABYTE', 'GIGABYTE'), ('GoldenField', 'GoldenField'), ('GRAND', 'GRAND'), ('Grundig', 'Grundig'), ('HAMA', 'HAMA'), ('Hardity', 'Hardity'), ('Hercules', 'Hercules'), ('HP', 'HP'), ('iLuv', 'iLuv'), ('Jet.A', 'Jet.A'), ('k-3', 'k-3'), ('Kinghun', 'Kinghun'), ('Klipsch', 'Klipsch'), ('KME', 'KME'), ('Konoos', 'Konoos'), ('Kreolz', 'Kreolz'), ('KWorld', 'KWorld'), ('Labtec', 'Labtec'), ('LOGICFOX', 'LOGICFOX'), ('Manhattan', 'Manhattan'), ('MB Sound', 'MB Sound'), ('Media-Tech', 'Media-Tech'), ('Mobiledata', 'Mobiledata'), ('Modecom', 'Modecom'), ('MSI', 'MSI'), ('NAKATOMI', 'NAKATOMI'), ('NeoDrive', 'NeoDrive'), ('ORIENT', 'ORIENT'), ('Ozaki', 'Ozaki'), ('Perfeo', 'Perfeo'), ('Philips', 'Philips'), ('Prestigio', 'Prestigio'), ('Ritmix', 'Ritmix'), ('Samsung', 'Samsung'), ('Sanyoo', 'Sanyoo'), ('Scythe', 'Scythe'), ('SmartTrack', 'SmartTrack'), ('SonicGear', 'SonicGear'), ('Sony', 'Sony'), ('Sound Pro', 'Sound Pro'), ('Soundtronix', 'Soundtronix'), ('SPEED', 'SPEED'), ('SPEEDLINK', 'SPEEDLINK'), ('Sweex', 'Sweex'), ('T&D', 'T&D'), ("T'nB", "T'nB"), ('Targa', 'Targa'), ('Titan', 'Titan'), ('Trust', 'Trust'), ('UNITY', 'UNITY'), ('Velton', 'Velton'), ('Vicsone', 'Vicsone'), ('VIGOOLE', 'VIGOOLE'), ('X5Tech', 'X5Tech'), ('XtremeMac', 'XtremeMac'), ('Yubz', 'Yubz'), ('Zalman', 'Zalman')) Acoustics_type = (('1.0', '1.0'), ('2.0', '2.0'), ('2.1', '2.1'), ('4.1', '4.1'), ('5.0', '5.0'), ('5.1', '5.1'), ('6.1', '6.1')) # Телефоны Telephone_firms = (("'Senao", "'Senao"), ("'\\u0414\\u0438\\u0430\\u043b\\u043e\\u0433", "'\\u0414\\u0438\\u0430\\u043b\\u043e\\u0433"), ("'SUPRA", "'SUPRA"), ("'Voxtel", "'Voxtel"), ("'SwissVoice", "'SwissVoice"), ("'\\u041f\\u0430\\u043b\\u0438\\u0445\\u0430", "'\\u041f\\u0430\\u043b\\u0438\\u0445\\u0430"), ("'General Electric", "'General Electric"), ("'Horizont", "'Horizont"), ("'\\u041a\\u041e\\u041c\\u041c\\u0422\\u0415\\u041b", "'\\u041a\\u041e\\u041c\\u041c\\u0422\\u0415\\u041b"), ("'LG", "'LG"), ("'Goodwin", "'Goodwin"), ("'Akai", "'Akai"), ("'Bang & Olufsen", "'Bang & Olufsen"), ("'ALCOM", "'ALCOM"), ("'Plantronics", "'Plantronics"), ("'Siemens", "'Siemens"), ("'\\u041c\\u042d\\u041b\\u0422", "'\\u041c\\u042d\\u041b\\u0422"), ("'Komtel", "'Komtel"), ("'Ritmix", "'Ritmix"), ("'Philips", "'Philips"), ("'Motorola", "'Motorola"), ("'BBK", "'BBK"), ("'Alcatel", "'Alcatel"), ("'Intego", "'Intego"), ("'\\u0412\\u0435\\u043a\\u0442\\u043e\\u0440", "'\\u0412\\u0435\\u043a\\u0442\\u043e\\u0440"), ("'Rolsen", "'Rolsen"), ("'Gigaset", "'Gigaset"), ("'Sagem", "'Sagem"), ("'Euroline", "'Euroline"), ("'\\u0422\\u0435\\u043b\\u0444\\u043e\\u043d", "'\\u0422\\u0435\\u043b\\u0444\\u043e\\u043d"), ("'\\u0424\\u0430\\u044d\\u0442\\u043e\\u043d", "'\\u0424\\u0430\\u044d\\u0442\\u043e\\u043d"), ("'\\u041a\\u043e\\u043b\\u0438\\u0431\\u0440\\u0438", "'\\u041a\\u043e\\u043b\\u0438\\u0431\\u0440\\u0438"), ("'teleGEO", "'teleGEO"), ("'\\u0422\\u0435\\u043b\\u043b\\u0443\\u0440", "'\\u0422\\u0435\\u043b\\u043b\\u0443\\u0440"), ("'LG-Ericsson", "'LG-Ericsson"), ("'Switel", "'Switel"), ("'LG-Nortel", "'LG-Nortel"), ("'Binatone", "'Binatone"), ("'Soul Electronics", "'Soul Electronics"), ("'TeXet", "'TeXet"), ("'Premier", "'Premier"), ("'Unitel City", "'Unitel City"), ("'Orion", "'Orion"), ("'Rotex", "'Rotex"), ("'\\u0422\\u0435\\u043b\\u0442\\u0430", "'\\u0422\\u0435\\u043b\\u0442\\u0430"), ("'Shivaki", "'Shivaki"), ("'Panasonic", "'Panasonic")) Telephone_frequency = (('1880-1900 MHz', '1880-1900 MHz'), ('240-390 MHz', '240-390 MHz'), ('307-343 MHz', '307-343 MHz'), ('31-40 MHz', '31-40 MHz'), ('900/2400 MHz', '900/2400 MHz')) # Батарейки и аккумуляторы Battery_firms = (('Energizer', 'Energizer'), ('Duracell', 'Duracell')) Battery_type = (('AA', 'AA'), ('AAA', 'AAA'), ('C', 'C'), ('D', 'D'), ('PP3 (Krona)', 'PP3 (Krona)')) Optical_Drive_firms = (('3Q', '3Q'), ('Apple', 'Apple'), ('ASUS', 'ASUS'), ('HP', 'HP'), ('Lenovo', 'Lenovo'), ('LG', 'LG'), ('LITE-ON', 'LITE-ON'), ('Pioneer', 'Pioneer'), ('Plextor', 'Plextor'), ('Sony NEC Optiarc', 'Sony NEC Optiarc'), ('Toshiba Samsung Storage Technology', 'Toshiba Samsung Storage Technology'), ('Transcend', 'Transcend'), ('Acer', 'Acer'), ('Buffalo', 'Buffalo'), ('Canyon', 'Canyon'), ('DELL', 'DELL'), ('Foxconn', 'Foxconn'), ('Fujitsu', 'Fujitsu'), ('Intel', 'Intel'), ('Iomega', 'Iomega'), ('Kreolz', 'Kreolz'), ('Lacie', 'Lacie'), ('NU', 'NU'), ('ONEXT', 'ONEXT'), ('Panasonic', 'Panasonic'), ('Rovermate', 'Rovermate'), ('Sun Microsystems', 'Sun Microsystems'), ('Supermicro', 'Supermicro'), ('TEAC', 'TEAC')) Optical_Drive_type = (('BD-RE', 'BD-RE'), ('BD-ROM', 'BD-ROM'), ('BD-ROM/DVD RW', 'BD-ROM/DVD RW'), ('BD-ROM/HD DVD-ROM/DVD RW', 'BD-ROM/HD DVD-ROM/DVD RW'), ('CD-ROM', 'CD-ROM'), ('CD-RW', 'CD-RW'), ('DVD RW', 'DVD RW'), ('DVD RW DL', 'DVD RW DL'), ('DVD-ROM', 'DVD-ROM'), ('DVD/CD-RW', 'DVD/CD-RW')) Optical_Drive_interfaces = (('eSATA/USB', 'eSATA/USB'), ('Ethernet/USB', 'Ethernet/USB'), ('FireWire', 'FireWire'), ('IDE', 'IDE'), ('SATA', 'SATA'), ('USB', 'USB')) Network_equipment_firms = (("'Ubiquiti", "'Ubiquiti"), ("'", "'"), ("'Nano", "'Nano"), ("'SIVVA", "'SIVVA"), ("'3COM", "'3COM"), ("'Huawei", "'Huawei"), ("'Winstars", "'Winstars"), ("'CCK", "'CCK"), ("'HAMA", "'HAMA"), ("'Compex", "'Compex"), ("'Linkpro", "'Linkpro"), ("'Galaxy Innovations", "'Galaxy Innovations"), ("'Allied Telesyn", "'Allied Telesyn"), ("'S-iTECH", "'S-iTECH"), ("'Level One", "'Level One"), ("'Skylink", "'Skylink"), ("'Buro", "'Buro"), ("'SPEEDLINK", "'SPEEDLINK"), ("'GIGABYTE", "'GIGABYTE"), ("'DIGITUS", "'DIGITUS"), ("'Rovermate", "'Rovermate"), ("'GetNet", "'GetNet"), ("'Normann", "'Normann"), ("'Porto", "'Porto"), ("'EUSSO", "'EUSSO"), ("'LOGICFOX", "'LOGICFOX"), ("'Mobiledata", "'Mobiledata"), ("'Cisco", "'Cisco"), ("'2N", "'2N"), ("'Z-Com", "'Z-Com"), ("'Pentagram", "'Pentagram"), ("'Carelink", "'Carelink"), ("'Globo", "'Globo"), ("'Edimax", "'Edimax"), ("'TRENDnet", "'TRENDnet"), ("'Alwise", "'Alwise"), ("'Sweex", "'Sweex"), ("'CYBER", "'CYBER"), ("'QTECH", "'QTECH"), ("'Upvel", "'Upvel"), ("'Fortinet", "'Fortinet"), ("'Qbiq", "'Qbiq"), ("'Novatel Wireless", "'Novatel Wireless"), ("'eXtreme", "'eXtreme"), ("'Petatel", "'Petatel"), ("'\\u041c\\u0422\\u0421", "'\\u041c\\u0422\\u0421"), ("'HP", "'HP"), ("'Proxim", "'Proxim"), ("'Espada", "'Espada"), ("'DrayTek", "'DrayTek"), ("'Eye-Fi", "'Eye-Fi"), ("'Cyclone", "'Cyclone"), ("'Emtec", "'Emtec"), ("'Option", "'Option"), ("'STLab", "'STLab"), ("'Yota", "'Yota"), ("'AMX", "'AMX"), ("'X-Micro", "'X-Micro"), ("'Sony", "'Sony"), ("'Throw", "'Throw"), ("'EnGenius", "'EnGenius"), ("'Motorola", "'Motorola"), ("'Linksys", "'Linksys"), ("'Samsung", "'Samsung"), ("'D-link", "'D-link"), ("'U.S.Robotics", "'U.S.Robotics"), ("'Asotel", "'Asotel"), ("'Qumo", "'Qumo"), ("'Deppa", "'Deppa"), ("'NCENTRA", "'NCENTRA"), ("'Loopcomm", "'Loopcomm"), ("'Western Digital", "'Western Digital"), ("'Buffalo", "'Buffalo"), ("'ORIENT", "'ORIENT"), ("'Planet", "'Planet"), ("'MOXA", "'MOXA"), ("'Seowon Intech", "'Seowon Intech"), ("'SIYOTEAM", "'SIYOTEAM"), ("'Nortel", "'Nortel"), ("'CBR", "'CBR"), ("'Terminal Equipment", "'Terminal Equipment"), ("'LogicPower", "'LogicPower"), ("'ASUS", "'ASUS"), ("'BandRich", "'BandRich"), ("'Opticum", "'Opticum"), ("'\\u0422\\u041e\\u041d\\u041a", "'\\u0422\\u041e\\u041d\\u041a"), ("'Novacom Wireless", "'Novacom Wireless"), ("'Senao", "'Senao"), ("'EDUP", "'EDUP"), ("'Vertex", "'Vertex"), ("'Multico", "'Multico"), ("'Alfa Network", "'Alfa Network"), ("'Creative", "'Creative"), ("'Genius", "'Genius"), ("'NeoDrive", "'NeoDrive"), ("'C-net", "'C-net"), ("'SMC", "'SMC"), ("'X-NET", "'X-NET"), ("'Intellinet", "'Intellinet"), ("'Gemix", "'Gemix"), ("'Arctic", "'Arctic"), ("'OXO Electronics", "'OXO Electronics"), ("'Popcorn Hour", "'Popcorn Hour"), ("'3Q", "'3Q"), ("'Symanitron", "'Symanitron"), ("'BBK", "'BBK"), ("'Intel", "'Intel"), ("'ZTE", "'ZTE"), ("'Palmexx", "'Palmexx"), ("'Powchip", "'Powchip"), ("'Grand-X", "'Grand-X"), ("'Sparklan", "'Sparklan"), ("'Euroline", "'Euroline"), ("'TP-LINK", "'TP-LINK"), ("'Media-Tech", "'Media-Tech"), ("'Edge-Core", "'Edge-Core"), ("'x3", "'x3"), ("'MicroNet", "'MicroNet"), ("'Welltech", "'Welltech"), ("'DT-Link", "'DT-Link"), ("'Belkin", "'Belkin"), ("'Surecom", "'Surecom"), ("'Canyon", "'Canyon"), ("'NETGEAR", "'NETGEAR"), ("'Panasonic", "'Panasonic"), ("'Mobidick", "'Mobidick"), ("'Tenda", "'Tenda"), ("'MSI", "'MSI"), ("'Dynamode", "'Dynamode"), ("'LEXAND", "'LEXAND"), ("'Pheenet", "'Pheenet"), ("'Brickcom", "'Brickcom"), ("'CLiPtec", "'CLiPtec"), ("'AirTies", "'AirTies"), ("'ZyXEL", "'ZyXEL"), ("'SerteC", "'SerteC"), ("'LG", "'LG"), ("'Juniper", "'Juniper"), ("'Acorp", "'Acorp"), ("'Crestron", "'Crestron"), ("'Kreolz", "'Kreolz"), ("'AirLive", "'AirLive"), ("'eVidence", "'eVidence"), ("'REPOTEC", "'REPOTEC"), ("'Promate", "'Promate"), ("'Sandisk", "'Sandisk"), ("'Philips", "'Philips"), ("'InterStep", "'InterStep"), ("'Egreat", "'Egreat"), ("'Alcatel", "'Alcatel"), ("'BEWARD", "'BEWARD"), ("'DELL", "'DELL"), ("'AudioCodes", "'AudioCodes"), ("'Netis", "'Netis"), ("'Encore", "'Encore"), ("'Sitecom", "'Sitecom"), ("'ARC Wireless", "'ARC Wireless"), ("'Apple", "'Apple"), ("'Gemtek", "'Gemtek"), ("'EWEL", "'EWEL"), ("'Gembird", "'Gembird"), ("'Dynamix", "'Dynamix"), ("'MikroTik", "'MikroTik"), ("'Trust", "'Trust")) Network_equipment_type = (('Router', 'Router'), ('Switch', 'Switch'), ('AP', 'AP'), ('Repeater', 'Repeater'), ('Smart Switch', 'Smart Switch')) Network_equipment_WiFi_type = (('802.11a', '802.11a'), ('802.11a/b/g', '802.11a/b/g'), ('802.11ac', '802.11ac'), ('802.11b', '802.11b'), ('802.11g', '802.11g'), ('802.11n', '802.11n')) Printer_firm = (('Brother', 'Brother'), ('Canon', 'Canon'), ('Epson', 'Epson'), ('HP', 'HP'), ('Kyocera', 'Kyocera'), ('Lexmark', 'Lexmark'), ('OKI', 'OKI'), ('Panasonic', 'Panasonic'), ('Ricoh', 'Ricoh'), ('Samsung', 'Samsung'), ('Toshiba', 'Toshiba'), ('Xerox', 'Xerox'), ('DELL', 'DELL'), ('Develop', 'Develop'), ('Flora', 'Flora'), ('Fujifilm', 'Fujifilm'), ('Gestetner', 'Gestetner'), ('HiTi', 'HiTi'), ('KIP', 'KIP'), ('Konica Minolta', 'Konica Minolta'), ('Lomond', 'Lomond'), ('MB', 'MB'), ('Mimaki', 'Mimaki'), ('Mitsubishi Electric', 'Mitsubishi Electric'), ('Mutoh', 'Mutoh'), ('Oce', 'Oce'), ('Pantum', 'Pantum'), ('Philips', 'Philips'), ('Polaroid', 'Polaroid'), ('Riso', 'Riso'), ('Roland', 'Roland'), ('ROWE', 'ROWE'), ('Seiko', 'Seiko'), ('Sharp', 'Sharp'), ('Shinco', 'Shinco'), ('Sony', 'Sony')) Power_suply_firm = (('AeroCool', 'AeroCool'), ('Chieftec', 'Chieftec'), ('Cooler Master', 'Cooler Master'), ('Corsair', 'Corsair'), ('FSP Group', 'FSP Group'), ('HIPER', 'HIPER'), ('HIPRO', 'HIPRO'), ('IN WIN', 'IN WIN'), ('LinkWorld', 'LinkWorld'), ('OCZ', 'OCZ'), ('Sea Sonic Electronics', 'Sea Sonic Electronics'), ('Thermaltake', 'Thermaltake'), ('5bites', '5bites'), ('@Lux', '@Lux'), ('Antec', 'Antec'), ('Aopen', 'Aopen'), ('Ascot', 'Ascot'), ('AXES Line', 'AXES Line'), ('be quiet!', 'be quiet!'), ('Codegen SuperPower', 'Codegen SuperPower'), ('COUGAR', 'COUGAR'), ('CROWN', 'CROWN'), ('CWT', 'CWT'), ('DELTA ELECTRONICS', 'DELTA ELECTRONICS'), ('DeTech', 'DeTech'), ('DTS', 'DTS'), ('EMACS', 'EMACS'), ('Enermax', 'Enermax'), ('Enhance Electronics', 'Enhance Electronics'), ('Espada', 'Espada'), ('ETG', 'ETG'), ('Exegate', 'Exegate'), ('FinePower', 'FinePower'), ('Floston', 'Floston'), ('FOX', 'FOX'), ('Foxline', 'Foxline'), ('Fractal Design', 'Fractal Design'), ('Gembird', 'Gembird'), ('GIGABYTE', 'GIGABYTE'), ('GoldenField', 'GoldenField'), ('Gresso', 'Gresso'), ('HEC', 'HEC'), ('HIGH POWER', 'HIGH POWER'), ('HuntKey', 'HuntKey'), ('Ice Hammer', 'Ice Hammer'), ('Invenom', 'Invenom'), ('LEPA', 'LEPA'), ('LogicPower', 'LogicPower'), ('NaviPower', 'NaviPower'), ('Nexus', 'Nexus'), ('NZXT', 'NZXT'), ('Pangu', 'Pangu'), ('PC Power & Cooling', 'PC Power & Cooling'), ('PowerBox', 'PowerBox'), ('PowerColor', 'PowerColor'), ('PowerExpert', 'PowerExpert'), ('ProLogiX', 'ProLogiX'), ('RaidMAX', 'RaidMAX'), ('Scythe', 'Scythe'), ('SilverStone', 'SilverStone'), ('Spire', 'Spire'), ('STM', 'STM'), ('Velton', 'Velton'), ('Winard', 'Winard'), ('XFX', 'XFX'), ('Xigmatek', 'Xigmatek'), ('Xilence', 'Xilence'), ('Zalman', 'Zalman')) Power_ATX_version = (('1.3', '1.3'), ('2.0', '2.0'), ('2.01', '2.01'), ('2.03', '2.03'), ('2.1', '2.1'), ('2.2', '2.2'), ('2.3', '2.3')) Motherboard_firm = (('ASRock', 'ASRock'), ('ASUS', 'ASUS'), ('Biostar', 'Biostar'), ('ECS', 'ECS'), ('Foxconn', 'Foxconn'), ('GIGABYTE', 'GIGABYTE'), ('Intel', 'Intel'), ('MSI', 'MSI'), ('Pegatron', 'Pegatron'), ('Sapphire', 'Sapphire'), ('Supermicro', 'Supermicro'), ('ZOTAC', 'ZOTAC'), ('3Q', '3Q'), ('ABIT', 'ABIT'), ('EPoX', 'EPoX'), ('EVGA', 'EVGA'), ('Fujitsu', 'Fujitsu'), ('ITZR', 'ITZR'), ('Jetway', 'Jetway'), ('PCCHIPS', 'PCCHIPS'), ('Tyan', 'Tyan'), ('VIA', 'VIA'), ('Wibtek', 'Wibtek')) Motherboard_chipset = (('AMD 480X CrossFire', 'AMD 480X CrossFire'), ('AMD 690G', 'AMD 690G'), ('AMD 740G', 'AMD 740G'), ('AMD 760 MPX', 'AMD 760 MPX'), ('AMD 760G', 'AMD 760G'), ('AMD 770', 'AMD 770'), ('AMD 780V', 'AMD 780V'), ('AMD 785G', 'AMD 785G'), ('AMD 790FX', 'AMD 790FX'), ('AMD 790GX', 'AMD 790GX'), ('AMD 790X', 'AMD 790X'), ('AMD 8111', 'AMD 8111'), ('AMD 8131', 'AMD 8131'), ('AMD 8151', 'AMD 8151'), ('AMD 870', 'AMD 870'), ('AMD 88X', 'AMD 88X'), ('AMD 880G', 'AMD 880G'), ('AMD 890FX', 'AMD 890FX'), ('AMD 890GX', 'AMD 890GX'), ('AMD 970', 'AMD 970'), ('AMD 990FX', 'AMD 990FX'), ('AMD 990X', 'AMD 990X'), ('AMD A45', 'AMD A45'), ('AMD A50M', 'AMD A50M'), ('AMD A55', 'AMD A55'), ('AMD A55E', 'AMD A55E'), ('AMD A68', 'AMD A68'), ('AMD A75', 'AMD A75'), ('AMD A85', 'AMD A85'), ('AMD A85X', 'AMD A85X'), ('AMD Hudson E1', 'AMD Hudson E1'), ('AMD Hudson-D1', 'AMD Hudson-D1'), ('AMD Hudson-D3', 'AMD Hudson-D3'), ('AMD M690E', 'AMD M690E'), ('AMD RS785', 'AMD RS785'), ('AMD RX881', 'AMD RX881'), ('AMD SR5650', 'AMD SR5650'), ('AMD SR5670', 'AMD SR5670'), ('AMD SR5690', 'AMD SR5690'), ('Broadcom HT1000', 'Broadcom HT1000'), ('Intel 3000', 'Intel 3000'), ('Intel 3200', 'Intel 3200'), ('Intel 3210', 'Intel 3210'), ('Intel 3400', 'Intel 3400'), ('Intel 3420', 'Intel 3420'), ('Intel 3450', 'Intel 3450'), ('Intel 5000P', 'Intel 5000P'), ('Intel 5000V', 'Intel 5000V'), ('Intel 5000X', 'Intel 5000X'), ('Intel 5100', 'Intel 5100'), ('Intel 5400', 'Intel 5400'), ('Intel 5500', 'Intel 5500'), ('Intel 5520', 'Intel 5520'), ('Intel 845', 'Intel 845'), ('Intel 845GV', 'Intel 845GV'), ('Intel 848P', 'Intel 848P'), ('Intel 865G', 'Intel 865G'), ('Intel 865GV', 'Intel 865GV'), ('Intel 915P', 'Intel 915P'), ('Intel 945GC', 'Intel 945GC'), ('Intel 945GM', 'Intel 945GM'), ('Intel 945GSE', 'Intel 945GSE'), ('Intel 955X', 'Intel 955X'), ('Intel B75', 'Intel B75'), ('Intel C202', 'Intel C202'), ('Intel C204', 'Intel C204'), ('Intel C206', 'Intel C206'), ('Intel C216', 'Intel C216'), ('Intel C600', 'Intel C600'), ('Intel C602', 'Intel C602'), ('Intel C602-A', 'Intel C602-A'), ('Intel C602J', 'Intel C602J'), ('Intel C604', 'Intel C604'), ('Intel C606', 'Intel C606'), ('Intel E7210', 'Intel E7210'), ('Intel E7221', 'Intel E7221'), ('Intel E7230', 'Intel E7230'), ('Intel E7320', 'Intel E7320'), ('Intel E7500', 'Intel E7500'), ('Intel E7501', 'Intel E7501'), ('Intel E7505', 'Intel E7505'), ('Intel E7520', 'Intel E7520'), ('Intel E7525', 'Intel E7525'), ('Intel G31', 'Intel G31'), ('Intel G41', 'Intel G41'), ('Intel G43', 'Intel G43'), ('Intel G45', 'Intel G45'), ('Intel G965', 'Intel G965'), ('Intel H55', 'Intel H55'), ('Intel H57 Express', 'Intel H57 Express'), ('Intel H61', 'Intel H61'), ('Intel H67', 'Intel H67'), ('Intel H77', 'Intel H77'), ('Intel HM70', 'Intel HM70'), ('Intel ICH8M', 'Intel ICH8M'), ('Intel ICH9', 'Intel ICH9'), ('Intel ICH9R', 'Intel ICH9R'), ('Intel NM10', 'Intel NM10'), ('Intel NM70', 'Intel NM70'), ('Intel P31 Express', 'Intel P31 Express'), ('Intel P43', 'Intel P43'), ('Intel P55', 'Intel P55'), ('Intel P67', 'Intel P67'), ('Intel P67(B3)', 'Intel P67(B3)'), ('Intel P965', 'Intel P965'), ('Intel Q43', 'Intel Q43'), ('Intel Q45', 'Intel Q45'), ('Intel Q57', 'Intel Q57'), ('Intel Q67', 'Intel Q67'), ('Intel Q77', 'Intel Q77'), ('Intel QM67', 'Intel QM67'), ('Intel QM77', 'Intel QM77'), ('Intel S1260', 'Intel S1260'), ('Intel X38', 'Intel X38'), ('Intel X48', 'Intel X48'), ('Intel X58', 'Intel X58'), ('Intel X79', 'Intel X79'), ('Intel Z68', 'Intel Z68'), ('Intel Z75', 'Intel Z75'), ('Intel Z77', 'Intel Z77'), ('Intel Z87', 'Intel Z87'), ('NVIDIA GeForce 6100', 'NVIDIA GeForce 6100'), ('NVIDIA GeForce 6150 SE', 'NVIDIA GeForce 6150 SE'), ('NVIDIA GeForce 7025', 'NVIDIA GeForce 7025'), ('NVIDIA MCP55 Pro', 'NVIDIA MCP55 Pro'), ('NVIDIA MCP61', 'NVIDIA MCP61'), ('NVIDIA MCP61P', 'NVIDIA MCP61P'), ('NVIDIA MCP68S', 'NVIDIA MCP68S'), ('NVIDIA MCP79', 'NVIDIA MCP79'), ('NVIDIA MCP7A-ION', 'NVIDIA MCP7A-ION'), ('NVIDIA nForce 520 LE', 'NVIDIA nForce 520 LE'), ('NVIDIA nForce 550', 'NVIDIA nForce 550'), ('NVIDIA nForce 570 Ultra', 'NVIDIA nForce 570 Ultra'), ('NVIDIA nForce 630a', 'NVIDIA nForce 630a'), ('NVIDIA nForce 680i SLI', 'NVIDIA nForce 680i SLI'), ('NVIDIA nForce 720D', 'NVIDIA nForce 720D'), ('NVIDIA nForce 750a SLI', 'NVIDIA nForce 750a SLI'), ('NVIDIA nForce 980a SLI', 'NVIDIA nForce 980a SLI'), ('NVIDIA nForce Professional 2200', 'NVIDIA nForce Professional 2200'), ('NVIDIA nForce Professional 3600', 'NVIDIA nForce Professional 3600'), ('NVIDIA nForce2', 'NVIDIA nForce2'), ('NVIDIA nForce3 250', 'NVIDIA nForce3 250'), ('NVIDIA nForce4', 'NVIDIA nForce4'), ('NVIDIA nForce4 SLI X16', 'NVIDIA nForce4 SLI X16'), ('NVIDIA nForce4 Ultra', 'NVIDIA nForce4 Ultra'), ('NVIDIA NFP3600', 'NVIDIA NFP3600'), ('ServerWorks BCM5785', 'ServerWorks BCM5785'), ('ServerWorks Grand Champion LE', 'ServerWorks Grand Champion LE'), ('ServerWorks HT1000', 'ServerWorks HT1000'), ('SiS 661GX', 'SiS 661GX'), ('SiS 662', 'SiS 662'), ('SiS 741GX', 'SiS 741GX'), ('ULi M1689', 'ULi M1689'), ('VIA CLE266', 'VIA CLE266'), ('VIA CN700', 'VIA CN700'), ('VIA CN896', 'VIA CN896'), ('VIA K8M800', 'VIA K8M800'), ('VIA K8T800', 'VIA K8T800'), ('VIA K8T800 Pro', 'VIA K8T800 Pro'), ('VIA P4M800', 'VIA P4M800'), ('VIA P4M890', 'VIA P4M890'), ('VIA P4M900', 'VIA P4M900'), ('VIA VX800', 'VIA VX800'), ('VIA VX900', 'VIA VX900'), ('VIA VX900H', 'VIA VX900H')) Motherboard_rom_types = (('DDR DIMM', 'DDR DIMM'), ('DDR2 DIMM', 'DDR2 DIMM'), ('DDR2 FB-DIMM', 'DDR2 FB-DIMM'), ('DDR2 SO-DIMM', 'DDR2 SO-DIMM'), ('DDR2/DDR3 DIMM', 'DDR2/DDR3 DIMM'), ('DDR3 DIMM', 'DDR3 DIMM'), ('DDR3 RDIMM/UDIMM', 'DDR3 RDIMM/UDIMM'), ('DDR3 SO-DIMM', 'DDR3 SO-DIMM')) Motherboard_pci_e_types = (('1.0', '1.0'), ('2.0', '2.0'), ('3.0', '3.0')) Motherboard_integrated_graphics = (('False', 'False'), ('AMD Llano', 'AMD Llano'), ('AMD Radeon HD 6320', 'AMD Radeon HD 6320'), ('AMD Radeon HD 7340', 'AMD Radeon HD 7340'), ('AMD Zacate', 'AMD Zacate'), ('Aspeed AST1300', 'Aspeed AST1300'), ('Aspeed AST2050', 'Aspeed AST2050'), ('Aspeed AST2150', 'Aspeed AST2150'), ('Aspeed AST2300', 'Aspeed AST2300'), ('ATI ES1000', 'ATI ES1000'), ('ATI Radeon HD 4200', 'ATI Radeon HD 4200'), ('ATI Radeon HD 4250', 'ATI Radeon HD 4250'), ('ATI Radeon HD 4290', 'ATI Radeon HD 4290'), ('ATI Radeon HD 6290', 'ATI Radeon HD 6290'), ('ATI Radeon HD 6310', 'ATI Radeon HD 6310'), ('ATI Radeon HD2100', 'ATI Radeon HD2100'), ('ATI Radeon HD3000', 'ATI Radeon HD3000'), ('ATI Radeon HD3100', 'ATI Radeon HD3100'), ('ATI Radeon HD3300', 'ATI Radeon HD3300'), ('ATI Radeon HD6310', 'ATI Radeon HD6310'), ('ATI Radeon X1250', 'ATI Radeon X1250'), ('ATI Rage XL', 'ATI Rage XL'), ('ATI Rage XL PCI', 'ATI Rage XL PCI'), ('Intel Extreme Graphics 2', 'Intel Extreme Graphics 2'), ('Intel GMA 3000', 'Intel GMA 3000'), ('Intel GMA 3100', 'Intel GMA 3100'), ('Intel GMA 3150', 'Intel GMA 3150'), ('Intel GMA 4500', 'Intel GMA 4500'), ('Intel GMA 950', 'Intel GMA 950'), ('Intel GMA X4500', 'Intel GMA X4500'), ('Intel GMA3600', 'Intel GMA3600'), ('Intel GMA3650', 'Intel GMA3650'), ('Intel MCH', 'Intel MCH'), ('Intel PowerVR SGX545', 'Intel PowerVR SGX545'), ('Matrox G200', 'Matrox G200'), ('Matrox G200e', 'Matrox G200e'), ('Matrox G200eW', 'Matrox G200eW'), ('NVIDIA GeForce 6100', 'NVIDIA GeForce 6100'), ('NVIDIA GeForce 6150', 'NVIDIA GeForce 6150'), ('NVIDIA GeForce 7025', 'NVIDIA GeForce 7025'), ('NVIDIA GeForce 9400', 'NVIDIA GeForce 9400'), ('NVIDIA GeForce GT 520', 'NVIDIA GeForce GT 520'), ('SiS Mirage', 'SiS Mirage'), ('SiS Real256', 'SiS Real256'), ('VIA Chrome9', 'VIA Chrome9'), ('VIA UniChrome Pro', 'VIA UniChrome Pro'), ('XGI Volari Z7', 'XGI Volari Z7'), ('XGI Volari Z9s', 'XGI Volari Z9s'), ('XGI XG20', 'XGI XG20')) Motherboard_form_factor = (('ATX', 'ATX'), ('DTX', 'DTX'), ('EATX', 'EATX'), ('Em-ITX', 'Em-ITX'), ('FlexATX', 'FlexATX'), ('HPTX', 'HPTX'), ('mBTX', 'mBTX'), ('mATX', 'mATX'),('microATX', 'microATX'), ('mini-DTX', 'mini-DTX'), ('mini-ITX', 'mini-ITX'), ('SSI CEB', 'SSI CEB'), ('SSI EEB', 'SSI EEB'), ('SSI MEB', 'SSI MEB'), ('SWTX', 'SWTX'), ('thin mini-ITX', 'thin mini-ITX'), ('XL-ATX', 'XL-ATX'), ('NonStandart', 'NonStandart')) Motherboard_sata_raid = (('0', '0'), ('1', '1'), ('10', '10'), ('5', '5'), ('JBOD', 'JBOD'), ('', '')) Motherboard_audio = (("AC'97", "AC'97"), ('EAX', 'EAX'), ('HDA', 'HDA'), ('', '')) CPU_firm = (('AMD', 'AMD'), ('Intel', 'Intel')) CPU_core = (("Don't Know","Don't Know"),('Abu Dhabi', 'Abu Dhabi'), ('Agena', 'Agena'), ('Allendale', 'Allendale'), ('Athens', 'Athens'), ('Banias', 'Banias'), ('Barcelona', 'Barcelona'), ('Beckton', 'Beckton'), ('Bloomfield', 'Bloomfield'), ('Brisbane', 'Brisbane'), ('Budapest', 'Budapest'), ('Callisto', 'Callisto'), ('Cedar Mill', 'Cedar Mill'), ('Clarkdale', 'Clarkdale'), ('Clovertown', 'Clovertown'), ('Conroe', 'Conroe'), ('Conroe-CL', 'Conroe-CL'), ('Conroe-L', 'Conroe-L'), ('Dempsey', 'Dempsey'), ('Deneb', 'Deneb'), ('Dothan', 'Dothan'), ('Dunnington', 'Dunnington'), ('Egypt', 'Egypt'), ('Gainestown', 'Gainestown'), ('Gallatin', 'Gallatin'), ('Gulftown', 'Gulftown'), ('Harpertown', 'Harpertown'), ('Heka', 'Heka'), ('Interlagos', 'Interlagos'), ('Irwindale', 'Irwindale'), ('Istanbul', 'Istanbul'), ('Italy', 'Italy'), ('Ivy Bridge', 'Ivy Bridge'), ('Ivy Bridge-H2', 'Ivy Bridge-H2'), ('Kentsfield', 'Kentsfield'), ('Lisbon', 'Lisbon'), ('Llano', 'Llano'), ('Lynnfield', 'Lynnfield'), ('Magny-Cours', 'Magny-Cours'), ('Merom', 'Merom'), ('Nocona', 'Nocona'), ('Northwood', 'Northwood'), ('Paxville', 'Paxville'), ('Penryn', 'Penryn'), ('Prescott', 'Prescott'), ('Presler', 'Presler'), ('Prestonia', 'Prestonia'), ('Propus', 'Propus'), ('Rana', 'Rana'), ('Regor', 'Regor'), ('Sandy Bridge', 'Sandy Bridge'), ('Sandy Bridge-E', 'Sandy Bridge-E'), ('Sandy Bridge-EN', 'Sandy Bridge-EN'), ('Sandy Bridge-EP', 'Sandy Bridge-EP'), ('Santa Ana', 'Santa Ana'), ('Santa Rosa', 'Santa Rosa'), ('Sargas', 'Sargas'), ('Seoul', 'Seoul'), ('Shanghai', 'Shanghai'), ('Sledgehammer', 'Sledgehammer'), ('Smithfield', 'Smithfield'), ('Sparta', 'Sparta'), ('Thuban', 'Thuban'), ('Tigerton', 'Tigerton'), ('Trinity', 'Trinity'), ('Troy', 'Troy'), ('Tulsa', 'Tulsa'), ('Valencia', 'Valencia'), ('Vishera', 'Vishera'), ('Westmere-EX', 'Westmere-EX'), ('Windsor', 'Windsor'), ('Wolfdale', 'Wolfdale'), ('Woodcrest', 'Woodcrest'), ('Yonah', 'Yonah'), ('Yorkfield', 'Yorkfield'), ('Zambezi', 'Zambezi'), ('Zosma', 'Zosma')) CPU_L1 = (("Don't Know","Don't Know"),('8 Kb', '8 Kb'), ('16 Kb', '16 Kb'), ('48 Kb', '48 Kb'), ('64 Kb', '64 Kb'), ('128 Kb', '128 Kb')) CPU_L2 = (("Don't Know","Don't Know"),('128 Kb', '128 Kb'), ('256 Kb', '256 Kb'), ('512 Kb', '512 Kb'), ('1024 Kb', '1024 Kb'), ('1536 Kb', '1536 Kb'), ('2048 Kb', '2048 Kb'), ('2560 Kb', '2560 Kb'), ('3072 Kb', '3072 Kb'), ('4096 Kb', '4096 Kb'), ('6144 Kb', '6144 Kb'), ('8192 Kb', '8192 Kb'), ('9216 Kb', '9216 Kb'), ('12288 Kb', '12288 Kb'), ('16384 Kb', '16384 Kb')) CPU_L3 = (("Don't Know","Don't Know"),) CPU_technology = (("Don't Know","Don't Know"),('130 nm', '130 nm'), ('22 nm', '22 nm'), ('32 nm', '32 nm'), ('45 nm', '45 nm'), ('65 nm', '65 nm'), ('90 nm', '90 nm')) Case_firm = (('AeroCool', 'AeroCool'), ('Cooler Master', 'Cooler Master'), ('Corsair', 'Corsair'), ('Foxconn', 'Foxconn'), ('GIGABYTE', 'GIGABYTE'), ('IN WIN', 'IN WIN'), ('JSP-TECH', 'JSP-TECH'), ('SilverStone', 'SilverStone'), ('Storm', 'Storm'), ('Thermaltake', 'Thermaltake'), ('Winsis', 'Winsis'), ('Zalman', 'Zalman'), ('', ''), ('3Cott', '3Cott'), ('3Q', '3Q'), ('3R System', '3R System'), ('4U', '4U'), ('@Lux', '@Lux'), ('AIGO', 'AIGO'), ('AiO', 'AiO'), ('AirTone', 'AirTone'), ('Akasa', 'Akasa'), ('Antec', 'Antec'), ('Aopen', 'Aopen'), ('AplusCase', 'AplusCase'), ('Arctic Cooling', 'Arctic Cooling'), ('ARESZE', 'ARESZE'), ('Ascot', 'Ascot'), ('ASUS', 'ASUS'), ('Autograph', 'Autograph'), ('AXES Line', 'AXES Line'), ('AZZA', 'AZZA'), ('BitFenix', 'BitFenix'), ('Brightwins', 'Brightwins'), ('BTC', 'BTC'), ('CASECOM Technology', 'CASECOM Technology'), ('CasePoint', 'CasePoint'), ('CFI Group', 'CFI Group'), ('Chenbro', 'Chenbro'), ('Chieftec', 'Chieftec'), ('Classix', 'Classix'), ('Codegen SuperPower', 'Codegen SuperPower'), ('COLORSit', 'COLORSit'), ('COODMax', 'COODMax'), ('COUGAR', 'COUGAR'), ('Coupden', 'Coupden'), ('Credo', 'Credo'), ('CROWN', 'CROWN'), ('Delux', 'Delux'), ('DeTech', 'DeTech'), ('DTS', 'DTS'), ('DVQ', 'DVQ'), ('Enermax', 'Enermax'), ('ENlight', 'ENlight'), ('Espada', 'Espada'), ('ETG', 'ETG'), ('Eurocase', 'Eurocase'), ('Evolution', 'Evolution'), ('Exegate', 'Exegate'), ('Fast', 'Fast'), ('Floston', 'Floston'), ('FORUM Computers', 'FORUM Computers'), ('FOX', 'FOX'), ('Foxline', 'Foxline'), ('Fractal Design', 'Fractal Design'), ('FrimeCom', 'FrimeCom'), ('Frisby', 'Frisby'), ('Frontier', 'Frontier'), ('FSP Group', 'FSP Group'), ('FST', 'FST'), ('GameTiger', 'GameTiger'), ('Gembird', 'Gembird'), ('GMC', 'GMC'), ('GoldenField', 'GoldenField'), ('GRAND', 'GRAND'), ('Gresso', 'Gresso'), ('Griffon', 'Griffon'), ('HEDY', 'HEDY'), ('HKC', 'HKC'), ('HQ-Tech', 'HQ-Tech'), ('HuntKey', 'HuntKey'), ('iBOX', 'iBOX'), ('iCute', 'iCute'), ('IKONIK', 'IKONIK'), ('Impression', 'Impression'), ('Intel', 'Intel'), ('Inter-Tech', 'Inter-Tech'), ('Invenom', 'Invenom'), ('JCP', 'JCP'), ('JET', 'JET'), ('JNC', 'JNC'), ('KIMPRO', 'KIMPRO'), ('Kinghun', 'Kinghun'), ('KM Korea', 'KM Korea'), ('KME', 'KME'), ('Krauler', 'Krauler'), ('LanCool', 'LanCool'), ('Lct Technology Inc.', 'Lct Technology Inc.'), ('Lian Li', 'Lian Li'), ('LinkWorld', 'LinkWorld'), ('Logic Concept Technology', 'Logic Concept Technology'), ('LogicPower', 'LogicPower'), ('LOOP', 'LOOP'), ('MaxPoint', 'MaxPoint'), ('MEC', 'MEC'), ('Microlab', 'Microlab'), ('Microtech', 'Microtech'), ('Modecom', 'Modecom'), ('Moneual', 'Moneual'), ('Morex', 'Morex'), ('NANOXIA', 'NANOXIA'), ('NaviPower', 'NaviPower'), ('NTS', 'NTS'), ('NZXT', 'NZXT'), ('Optimum', 'Optimum'), ('Pangu', 'Pangu'), ('Point of View', 'Point of View'), ('PowerCase', 'PowerCase'), ('PowerExpert', 'PowerExpert'), ('ProLogiX', 'ProLogiX'), ('Prosource', 'Prosource'), ('RaidMAX', 'RaidMAX'), ('Scythe', 'Scythe'), ('SeulCase', 'SeulCase'), ('Sharkoon', 'Sharkoon'), ('Solarbox', 'Solarbox'), ('SOLIX', 'SOLIX'), ('SPEED', 'SPEED'), ('Spire', 'Spire'), ('Star Technology', 'Star Technology'), ('STC', 'STC'), ('Streacom', 'Streacom'), ('Supermicro', 'Supermicro'), ('Sven', 'Sven'), ('TACENS', 'TACENS'), ('Targa', 'Targa'), ('TEXCONN', 'TEXCONN'), ('Tracer', 'Tracer'), ('Trin', 'Trin'), ('Tsunami', 'Tsunami'), ('V-King', 'V-King'), ('V-Tech', 'V-Tech'), ('Velton', 'Velton'), ('ViewApple Group', 'ViewApple Group'), ('Winard', 'Winard'), ('Winstar', 'Winstar'), ('Xclio', 'Xclio'), ('Xigmatek', 'Xigmatek'), ('Xilence', 'Xilence'), ('Yeong Yang', 'Yeong Yang'), ('Yuhanhi Tec', 'Yuhanhi Tec'), ('Zignum', 'Zignum')) Case_power_suply_place = (('top', 'top'), ('bottom', 'bottom')) Case_form_factor = (('Full-Desktop', 'Full-Desktop'), ('Full-Tower', 'Full-Tower'), ('Micro-Tower', 'Micro-Tower'), ('Midi-Tower', 'Midi-Tower'), ('Mini-Tower', 'Mini-Tower'), ('Slim-Desktop', 'Slim-Desktop'), ('Super-Tower', 'Super-Tower')) Sockets = (('AM2', 'AM2'), ('AM2+', 'AM2+'), ('AM3', 'AM3'), ('AM3+', 'AM3+'), ('BGA437', 'BGA437'), ('C32', 'C32'), ('FM1', 'FM1'), ('FM2', 'FM2'), ('FS1r2', 'FS1r2'), ('G2', 'G2'), ('G2 (rPGA 988B)', 'G2 (rPGA 988B)'), ('G34', 'G34'), ('LGA1150', 'LGA1150'), ('LGA1155', 'LGA1155'), ('LGA1156', 'LGA1156'), ('LGA1356', 'LGA1356'), ('LGA1366', 'LGA1366'), ('LGA2011', 'LGA2011'), ('LGA771', 'LGA771'), ('LGA775', 'LGA775'), ('M', 'M'), ('S1207 (Socket F)', 'S1207 (Socket F)'), ('S462', 'S462'), ('S478', 'S478'), ('S479', 'S479'), ('S603', 'S603'), ('S604', 'S604'), ('S754', 'S754'), ('S939', 'S939'), ('S940', 'S940')) Ethernet_types = (('10 Mb/s', '10 Mb/s'), ('100 Mb/s', '100 Mb/s'), ('1 Gb/s', '1 Gb/s'), ('10 Gb/s', '10 Gb/s'), ('', '')) WiFi_types = (('802.11a/b/g', '802.11a/b/g'), ('802.11n', '802.11n'), ('802.11ac', '802.11ac'), ('False', 'False')) UPS_firm = (('3Cott', '3Cott'), ('APC by Schneider Electric', 'APC by Schneider Electric'), ('CyberPower', 'CyberPower'), ('FSP Group', 'FSP Group'), ('INELT', 'INELT'), ('Ippon', 'Ippon'), ('Powercom', 'Powercom'), ('Powerman', 'Powerman'), ('Powerware', 'Powerware'), ('Sven', 'Sven'), ('Tripp', 'Tripp'), ('Lite', 'Lite'), ('Ресанта', 'Ресанта'), ('AEG', 'AEG'), ('Apollo', 'Apollo'), ('Borri', 'Borri'), ('Codegen SuperPower', 'Codegen SuperPower'), ('CROWN', 'CROWN'), ('Delta ES', 'Delta ES'), ('DeTech', 'DeTech'), ('DNS', 'DNS'), ('Dyno', 'Dyno'), ('EAST', 'EAST'), ('ENEL', 'ENEL'), ('EneltPro', 'EneltPro'), ('Exegate', 'Exegate'), ('Gembird', 'Gembird'), ('Gemix', 'Gemix'), ('General Electric', 'General Electric'), ('Gewald Electric', 'Gewald Electric'), ('Gresso', 'Gresso'), ('Hardity', 'Hardity'), ('Helior', 'Helior'), ('HP', 'HP'), ('Inform', 'Inform'), ('INSAR', 'INSAR'), ('Krauler', 'Krauler'), ('Liebert', 'Liebert'), ('LogicPower', 'LogicPower'), ('Luxeon', 'Luxeon'), ('Mercury', 'Mercury'), ('MGE', 'MGE'), ('Mustek', 'Mustek'), ('N-Power', 'N-Power'), ('Orvaldi', 'Orvaldi'), ('P-Com', 'P-Com'), ('Pilot', 'Pilot'), ('Powerex', 'Powerex'), ('Powerwalker', 'Powerwalker'), ('ProLogiX', 'ProLogiX'), ('Riello', 'Riello'), ('RUCELF', 'RUCELF'), ('Santak', 'Santak'), ('Socomec', 'Socomec'), ('Solby', 'Solby'), ('SVC', 'SVC'), ('Trust', 'Trust'), ('Tuncmatik', 'Tuncmatik'), ('Uniel', 'Uniel'), ('VIR-ELECTRIC', 'VIR-ELECTRIC'), ('Vivaldi', 'Vivaldi'), ('VoltGuard', 'VoltGuard'), ('БАСТИОН', 'БАСТИОН'), ('Исток', 'Исток')) UPS_types = (('Line-Interactive', 'Line-Interactive'), ('Standby', 'Standby'), ('Online', 'Online')) # tuple(((b,b) for b in a.split(' ')))
548.671053
5,418
0.579079
5,128
41,699
4.695008
0.25624
0.019438
0.02542
0.033893
0.216273
0.176524
0.135778
0.111563
0.10417
0.098355
0
0.104213
0.099547
41,699
75
5,419
555.986667
0.536993
0.003909
0
0
0
0.235294
0.630304
0.089968
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
1
1
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
136666bf70ede41ff7b5d9a5cdfa5ec3cdbba499
313
py
Python
web/anuncios/views.py
Hercita/EXAMEN_FINAL
8c6b1bf1b3f12089c7fd9d5c6195cbfeb9574179
[ "CC0-1.0" ]
null
null
null
web/anuncios/views.py
Hercita/EXAMEN_FINAL
8c6b1bf1b3f12089c7fd9d5c6195cbfeb9574179
[ "CC0-1.0" ]
null
null
null
web/anuncios/views.py
Hercita/EXAMEN_FINAL
8c6b1bf1b3f12089c7fd9d5c6195cbfeb9574179
[ "CC0-1.0" ]
null
null
null
from django.shortcuts import render from anuncios.models import Anuncio # Create your views here. def anuncios(request): anuncios = Anuncio.objects.filter(status='publicado') return render(request,'anuncios/index.html',{'anuncios':anuncios}) def home(request): return render(request,"web/index.html")
34.777778
70
0.763578
40
313
5.975
0.575
0.125523
0.158996
0
0
0
0
0
0
0
0
0
0.115016
313
9
71
34.777778
0.862816
0.073482
0
0
0
0
0.17301
0
0
0
0
0
0
1
0.285714
false
0
0.285714
0.142857
0.857143
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
136f09fada94189c64f402e34b48231c22930159
178
py
Python
tests/utils.py
blazewicz/graphql-server-core
ad392b5406d90ae59080fc10799f8ab204c898c5
[ "MIT" ]
null
null
null
tests/utils.py
blazewicz/graphql-server-core
ad392b5406d90ae59080fc10799f8ab204c898c5
[ "MIT" ]
null
null
null
tests/utils.py
blazewicz/graphql-server-core
ad392b5406d90ae59080fc10799f8ab204c898c5
[ "MIT" ]
null
null
null
def as_dicts(results): """Convert execution results to a list of tuples of dicts for better comparison.""" return [result.to_dict(dict_class=dict) for result in results]
44.5
87
0.747191
28
178
4.642857
0.678571
0
0
0
0
0
0
0
0
0
0
0
0.162921
178
3
88
59.333333
0.872483
0.432584
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0
0
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
13a65eaa8207c8b6d54927b4d7c39686b2417468
72
py
Python
jianshu/start.py
hahahaha666/pythonpachong
2cc8303a4baecea4bbc631e90718c49815e41133
[ "MIT" ]
null
null
null
jianshu/start.py
hahahaha666/pythonpachong
2cc8303a4baecea4bbc631e90718c49815e41133
[ "MIT" ]
null
null
null
jianshu/start.py
hahahaha666/pythonpachong
2cc8303a4baecea4bbc631e90718c49815e41133
[ "MIT" ]
null
null
null
from scrapy import cmdline cmdline.execute("scrapy crawl js".split())
36
42
0.763889
10
72
5.5
0.8
0
0
0
0
0
0
0
0
0
0
0
0.125
72
2
42
36
0.873016
0
0
0
0
0
0.208333
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
b9320ab7954f6cd61a1dca85a7f5703889696807
142
py
Python
mappa/models/mappa/grupo.py
guionardo/escoteiros-mappa
e4b119d14920658cc30c89294d6bb8a34d34f684
[ "MIT" ]
null
null
null
mappa/models/mappa/grupo.py
guionardo/escoteiros-mappa
e4b119d14920658cc30c89294d6bb8a34d34f684
[ "MIT" ]
2
2020-08-11T23:19:31.000Z
2020-08-11T23:39:35.000Z
mappa/models/mappa/grupo.py
guionardo/escoteiros-mappa
e4b119d14920658cc30c89294d6bb8a34d34f684
[ "MIT" ]
2
2021-07-10T08:03:32.000Z
2021-07-10T08:12:49.000Z
from base_model import BaseModel class GrupoModel(BaseModel): codigo: int codigoRegiao: str nome: str codigoModalidade: int
15.777778
32
0.725352
16
142
6.375
0.8125
0
0
0
0
0
0
0
0
0
0
0
0.225352
142
8
33
17.75
0.927273
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.166667
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
1
0
0
4
b97d4157ecf084d92ae8388ef708720151ac37b6
217
py
Python
scripts/item/consume_2438671.py
G00dBye/YYMS
1de816fc842b6598d5b4b7896b6ab0ee8f7cdcfb
[ "MIT" ]
54
2019-04-16T23:24:48.000Z
2021-12-18T11:41:50.000Z
scripts/item/consume_2438671.py
G00dBye/YYMS
1de816fc842b6598d5b4b7896b6ab0ee8f7cdcfb
[ "MIT" ]
3
2019-05-19T15:19:41.000Z
2020-04-27T16:29:16.000Z
scripts/item/consume_2438671.py
G00dBye/YYMS
1de816fc842b6598d5b4b7896b6ab0ee8f7cdcfb
[ "MIT" ]
49
2020-11-25T23:29:16.000Z
2022-03-26T16:20:24.000Z
# Created by MechAviv # High Noon Damage Skin | (2438671) if sm.addDamageSkin(2438671): sm.chat("'High Noon Damage Skin' Damage Skin has been added to your account's damage skin collection.") sm.consumeItem()
43.4
108
0.732719
32
217
4.96875
0.65625
0.251572
0.176101
0.226415
0
0
0
0
0
0
0
0.077778
0.170507
217
5
109
43.4
0.805556
0.24424
0
0
0
0
0.574074
0
0
0
0
0
0
1
0
true
0
0
0
0
0
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
b9871d03c73758b1f7b2d2ce1eca4ccfe4f3c6c3
152
py
Python
ej7.py
planetacomputer/pythonsecurity
5b808512afae5bc221715f37f91a0294f4800f19
[ "MIT" ]
null
null
null
ej7.py
planetacomputer/pythonsecurity
5b808512afae5bc221715f37f91a0294f4800f19
[ "MIT" ]
null
null
null
ej7.py
planetacomputer/pythonsecurity
5b808512afae5bc221715f37f91a0294f4800f19
[ "MIT" ]
null
null
null
f = open("months.txt") next = f.readline() items = [] while next != "": print(next) items.append(len(next)) next = f.readline() print items
16.888889
27
0.598684
21
152
4.333333
0.52381
0.10989
0.285714
0
0
0
0
0
0
0
0
0
0.210526
152
9
28
16.888889
0.758333
0
0
0.25
0
0
0.065359
0
0
0
0
0
0
0
null
null
0
0
null
null
0.25
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
b99756b778539c5d05b8a9f3edded5f59cbcc3ef
838
py
Python
src/garage/torch/__init__.py
maciejwolczyk/garage-1
c78843115a51d63f86bca0f3518d8f68fb81bce3
[ "MIT" ]
null
null
null
src/garage/torch/__init__.py
maciejwolczyk/garage-1
c78843115a51d63f86bca0f3518d8f68fb81bce3
[ "MIT" ]
null
null
null
src/garage/torch/__init__.py
maciejwolczyk/garage-1
c78843115a51d63f86bca0f3518d8f68fb81bce3
[ "MIT" ]
1
2020-07-02T16:02:22.000Z
2020-07-02T16:02:22.000Z
"""PyTorch-backed modules and algorithms.""" from garage.torch._functions import compute_advantages from garage.torch._functions import dict_np_to_torch from garage.torch._functions import filter_valids from garage.torch._functions import flatten_batch from garage.torch._functions import global_device from garage.torch._functions import np_to_torch from garage.torch._functions import pad_to_last from garage.torch._functions import product_of_gaussians from garage.torch._functions import set_gpu_mode from garage.torch._functions import torch_to_np from garage.torch._functions import update_module_params __all__ = [ 'compute_advantages', 'dict_np_to_torch', 'filter_valids', 'flatten_batch', 'global_device', 'np_to_torch', 'pad_to_last', 'product_of_gaussians', 'set_gpu_mode', 'torch_to_np', 'update_module_params' ]
44.105263
79
0.831742
121
838
5.322314
0.272727
0.170807
0.256211
0.409938
0.540373
0.121118
0.121118
0.121118
0
0
0
0
0.090692
838
18
80
46.555556
0.845144
0.045346
0
0
0
0
0.198992
0
0
0
0
0
0
1
0
false
0
0.6875
0
0.6875
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
b99bd1c7c9b2cd3e05cbbb493f6bb166bc1b7f53
82
py
Python
apps.py
sursum/buckanjaren
945454add4169fd7eef3ee372f3672de2f623ce6
[ "MIT" ]
null
null
null
apps.py
sursum/buckanjaren
945454add4169fd7eef3ee372f3672de2f623ce6
[ "MIT" ]
6
2021-02-08T20:20:47.000Z
2022-03-11T23:19:29.000Z
apps.py
sursum/buckanjaren
945454add4169fd7eef3ee372f3672de2f623ce6
[ "MIT" ]
null
null
null
from django.apps import AppConfig class BucConfig(AppConfig): name = 'buc'
13.666667
33
0.719512
10
82
5.9
0.9
0
0
0
0
0
0
0
0
0
0
0
0.195122
82
6
34
13.666667
0.893939
0
0
0
0
0
0.036145
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
b9d71910a35b738d81e58ebac3076fc1c48d77eb
296
py
Python
utils/env_vars.py
yu-iskw/elementary
6677fbfed60b88727dd453cbb4e3e34fb5d72738
[ "Apache-2.0" ]
282
2022-02-01T11:43:04.000Z
2022-03-31T15:31:15.000Z
utils/env_vars.py
yu-iskw/elementary
6677fbfed60b88727dd453cbb4e3e34fb5d72738
[ "Apache-2.0" ]
17
2021-09-27T12:15:20.000Z
2022-01-30T10:38:39.000Z
utils/env_vars.py
yu-iskw/elementary
6677fbfed60b88727dd453cbb4e3e34fb5d72738
[ "Apache-2.0" ]
12
2022-02-01T16:20:20.000Z
2022-03-28T18:10:35.000Z
import os def is_flight_mode_on() -> bool: return is_env_var_on('FLIGHTMODE') def is_debug_mode_on() -> bool: return is_env_var_on('DEBUG') def is_env_var_on(env_var) -> bool: if os.getenv(env_var) == '1': print(env_var, ' is on!') return True return False
16.444444
38
0.641892
49
296
3.510204
0.387755
0.209302
0.139535
0.174419
0.302326
0.302326
0.302326
0.302326
0
0
0
0.004405
0.233108
296
17
39
17.411765
0.753304
0
0
0
0
0
0.077703
0
0
0
0
0
0
1
0.3
false
0
0.1
0.2
0.8
0.1
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
1
0
0
0
1
0
0
0
4
b9f6e165ad82958981e471a17ec5b5f3639d137c
221
py
Python
py/tests/testPetriDish/test_PetriDish.py
zcemycl/algoTest
9518fb2b60fd83c85aeb2ab809ff647aaf643f0a
[ "MIT" ]
1
2022-01-26T16:33:45.000Z
2022-01-26T16:33:45.000Z
py/tests/testPetriDish/test_PetriDish.py
zcemycl/algoTest
9518fb2b60fd83c85aeb2ab809ff647aaf643f0a
[ "MIT" ]
null
null
null
py/tests/testPetriDish/test_PetriDish.py
zcemycl/algoTest
9518fb2b60fd83c85aeb2ab809ff647aaf643f0a
[ "MIT" ]
1
2022-01-26T16:35:44.000Z
2022-01-26T16:35:44.000Z
import unittest from parameterized import parameterized as p from solns.petriDish.petriDish import * class UnitTest_PetriDish(unittest.TestCase): @p.expand([ [] ]) def test_naive(self): pass
18.416667
44
0.692308
25
221
6.04
0.64
0
0
0
0
0
0
0
0
0
0
0
0.226244
221
11
45
20.090909
0.883041
0
0
0
0
0
0
0
0
0
0
0
0
1
0.111111
false
0.111111
0.333333
0
0.555556
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
1
1
0
1
0
0
4
6a3316aa9fc91619d484ef583e55fcfec5c46624
191
py
Python
server/rest/views/__init__.py
nking1232/html5-msoy
6e026f1989b15310ad67c050beb69a168c3bdd5f
[ "MIT" ]
null
null
null
server/rest/views/__init__.py
nking1232/html5-msoy
6e026f1989b15310ad67c050beb69a168c3bdd5f
[ "MIT" ]
null
null
null
server/rest/views/__init__.py
nking1232/html5-msoy
6e026f1989b15310ad67c050beb69a168c3bdd5f
[ "MIT" ]
2
2020-12-18T19:19:38.000Z
2020-12-18T19:53:56.000Z
from .session import SessionView from .login import LoginView from .signup import SignupView from .rooms import RoomsView from .profiles import ProfilesView from .cors_serve import cors_serve
31.833333
34
0.848168
26
191
6.153846
0.538462
0.1125
0
0
0
0
0
0
0
0
0
0
0.120419
191
6
35
31.833333
0.952381
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
6a49ccf4165bd2b248fc471fe1df7dcad7da30d0
844
py
Python
main.py
claudiotorresarbe/endereco
301252cf5abd5accaa2e7cd59b5a1b67af4cd164
[ "MIT" ]
null
null
null
main.py
claudiotorresarbe/endereco
301252cf5abd5accaa2e7cd59b5a1b67af4cd164
[ "MIT" ]
null
null
null
main.py
claudiotorresarbe/endereco
301252cf5abd5accaa2e7cd59b5a1b67af4cd164
[ "MIT" ]
null
null
null
from endereco import Endereco data = Endereco('59082310') print(data.mensagem()) print(data.total()) print(data.resultados()) print(data.resultados()[0]['uf']) print(data.resultados()[0]['localidade']) print(data.resultados()[0]['locNoSem']) print(data.resultados()[0]['locNu']) print(data.resultados()[0]['localidadeSubordinada']) print(data.resultados()[0]['logradouroDNEC']) print(data.resultados()[0]['logradouroTextoAdicional']) print(data.resultados()[0]['logradouroTexto']) print(data.resultados()[0]['baiNu']) print(data.resultados()[0]['nomeUnidade']) print(data.resultados()[0]['cep']) print(data.resultados()[0]['tipoCep']) print(data.resultados()[0]['numeroLocalidade']) print(data.resultados()[0]['situacao']) print(data.resultados()[0]['faixasCaixaPostal']) print(data.resultados()[0]['faixasCep'])
31.259259
56
0.700237
96
844
6.15625
0.270833
0.28934
0.546531
0.541455
0
0
0
0
0
0
0
0.030496
0.067536
844
26
57
32.461538
0.720457
0
0
0
0
0
0.223716
0.055012
0
0
0
0
0
1
0
false
0
0.047619
0
0.047619
0.904762
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
4
dbe7b6d5b0f3f09e66edd4ec4107929699ec0e66
141
py
Python
flask_wow/templates/app_tmp/app_name/__init__.py
ganquan881205/Flask-Wow
9a00cf2cf0a58bb99fee9e05b15194ab4bc6d5e3
[ "BSD-3-Clause" ]
3
2020-06-08T02:57:43.000Z
2020-06-08T03:31:32.000Z
flask_wow/templates/app_tmp/app_name/__init__.py
ganquan881205/Flask-Wow
9a00cf2cf0a58bb99fee9e05b15194ab4bc6d5e3
[ "BSD-3-Clause" ]
null
null
null
flask_wow/templates/app_tmp/app_name/__init__.py
ganquan881205/Flask-Wow
9a00cf2cf0a58bb99fee9e05b15194ab4bc6d5e3
[ "BSD-3-Clause" ]
null
null
null
from flask import Blueprint from .views import Hello bp = Blueprint('bp', __name__) bp.add_url_rule('/', view_func=Hello.as_view('hello'))
20.142857
54
0.744681
22
141
4.409091
0.636364
0
0
0
0
0
0
0
0
0
0
0
0.113475
141
7
54
20.142857
0.776
0
0
0
0
0
0.056338
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
1
0
4
e009ea574c154525e4dd40299cbd8c1e8fbb9435
7,044
py
Python
app/migrations/0001_initial.py
raptor419/AMRTrack-AIIMS
7e917d208b407cc2fe4e129f8bc60b7cb315e00d
[ "MIT" ]
null
null
null
app/migrations/0001_initial.py
raptor419/AMRTrack-AIIMS
7e917d208b407cc2fe4e129f8bc60b7cb315e00d
[ "MIT" ]
null
null
null
app/migrations/0001_initial.py
raptor419/AMRTrack-AIIMS
7e917d208b407cc2fe4e129f8bc60b7cb315e00d
[ "MIT" ]
null
null
null
# Generated by Django 2.1.1 on 2020-11-08 16:10 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Hospital', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('hospital_id', models.CharField(max_length=25)), ('name', models.CharField(max_length=50)), ('state', models.CharField(max_length=50)), ('district', models.CharField(max_length=50)), ('hospital', models.CharField(max_length=50)), ('address', models.CharField(max_length=50)), ], ), migrations.CreateModel( name='PathTest', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('test_id', models.CharField(max_length=25)), ('patient_id', models.CharField(max_length=25)), ('date', models.DateField(null=True)), ('hospital', models.CharField(max_length=50)), ('sample_type', models.CharField(max_length=50)), ('organism', models.CharField(max_length=50)), ('department', models.CharField(max_length=50)), ('amikacin', models.IntegerField(default=-1)), ('amoxicillin', models.IntegerField(default=-1)), ('amoxicillin_clavulanate', models.IntegerField(default=-1)), ('amoxicillin_clavulanic_acid', models.IntegerField(default=-1)), ('ampicillin', models.IntegerField(default=-1)), ('ampicillin_sulbactam', models.IntegerField(default=-1)), ('azithromycin', models.IntegerField(default=-1)), ('aztreonam', models.IntegerField(default=-1)), ('bedaquiline', models.IntegerField(default=-1)), ('capreomycin', models.IntegerField(default=-1)), ('carbenicillin', models.IntegerField(default=-1)), ('cefepime', models.IntegerField(default=-1)), ('cefixime', models.IntegerField(default=-1)), ('cefoperazone_sulbactam', models.IntegerField(default=-1)), ('cefotaxime', models.IntegerField(default=-1)), ('cefoxitin', models.IntegerField(default=-1)), ('cefpodoxime', models.IntegerField(default=-1)), ('ceftazidime', models.IntegerField(default=-1)), ('ceftazidime_clavulanic_acid', models.IntegerField(default=-1)), ('ceftriaxone', models.IntegerField(default=-1)), ('ceftriaxone_tazobactem', models.IntegerField(default=-1)), ('cefuroxime', models.IntegerField(default=-1)), ('cephazolin', models.IntegerField(default=-1)), ('chloramphenicol', models.IntegerField(default=-1)), ('ciprofloxacin', models.IntegerField(default=-1)), ('clavulanic_acid', models.IntegerField(default=-1)), ('clindamycin', models.IntegerField(default=-1)), ('clofazimine', models.IntegerField(default=-1)), ('cotrimoxazole', models.IntegerField(default=-1)), ('colistin', models.IntegerField(default=-1)), ('cycloserine_terizidone', models.IntegerField(default=-1)), ('d_cycloserine', models.IntegerField(default=-1)), ('daptomycin', models.IntegerField(default=-1)), ('delamanid', models.IntegerField(default=-1)), ('doripenem', models.IntegerField(default=-1)), ('ertapenem', models.IntegerField(default=-1)), ('erythromycin', models.IntegerField(default=-1)), ('esbl_producer', models.IntegerField(default=-1)), ('ethambutol', models.IntegerField(default=-1)), ('ethionamide', models.IntegerField(default=-1)), ('ethionamide_prothionamide', models.IntegerField(default=-1)), ('feropenem', models.IntegerField(default=-1)), ('fosfomycin', models.IntegerField(default=-1)), ('gatifloxacin', models.IntegerField(default=-1)), ('gentamicin', models.IntegerField(default=-1)), ('high_dose_isoniazid', models.IntegerField(default=-1)), ('imipenem', models.IntegerField(default=-1)), ('imipenem_cisplatin', models.IntegerField(default=-1)), ('imipenem_meropenem', models.IntegerField(default=-1)), ('isoniazid', models.IntegerField(default=-1)), ('kanamycin', models.IntegerField(default=-1)), ('levoflox', models.IntegerField(default=-1)), ('levofloxacin', models.IntegerField(default=-1)), ('linezolid', models.IntegerField(default=-1)), ('meropenem', models.IntegerField(default=-1)), ('moxifloxacin', models.IntegerField(default=-1)), ('nalidixic_acid', models.IntegerField(default=-1)), ('netilmicin', models.IntegerField(default=-1)), ('nitrofurantoin', models.IntegerField(default=-1)), ('norfloxacin', models.IntegerField(default=-1)), ('ofloxacin', models.IntegerField(default=-1)), ('p_aminosalicylic_acid', models.IntegerField(default=-1)), ('penicillin', models.IntegerField(default=-1)), ('piperacillin', models.IntegerField(default=-1)), ('piperacillin_tazobactam', models.IntegerField(default=-1)), ('polymyxin_b', models.IntegerField(default=-1)), ('pristinomycin', models.IntegerField(default=-1)), ('pyrazinamide', models.IntegerField(default=-1)), ('rifampin', models.IntegerField(default=-1)), ('sparfloxacin', models.IntegerField(default=-1)), ('spectinomycin', models.IntegerField(default=-1)), ('streptomycin', models.IntegerField(default=-1)), ('teicoplanin', models.IntegerField(default=-1)), ('tetracycline', models.IntegerField(default=-1)), ('thioacetazone', models.IntegerField(default=-1)), ('ticarcillin', models.IntegerField(default=-1)), ('ticarcillin_clavulanate', models.IntegerField(default=-1)), ('ticarcillin_clavulanic_acid', models.IntegerField(default=-1)), ('tigecycline', models.IntegerField(default=-1)), ('ulifloxacin', models.IntegerField(default=-1)), ('vancomycin', models.IntegerField(default=-1)), ('vancomycin_teicoplanin', models.IntegerField(default=-1)), ], ), ]
57.737705
114
0.569989
581
7,044
6.827883
0.2358
0.37207
0.516763
0.537434
0.430048
0.118477
0.039829
0.039829
0.039829
0.039829
0
0.023605
0.272288
7,044
121
115
58.214876
0.750293
0.006388
0
0.105263
1
0
0.17093
0.040589
0
0
0
0
0
1
0
false
0
0.008772
0
0.04386
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
e01c8ef53b73569817f64dcd76fcd94490df4064
283
py
Python
pyefun/wxefun/component/Image.py
nuo010/pyefun
c1c4dfcfd382a67df005a66958da95aa13c30686
[ "Apache-2.0" ]
94
2021-05-19T04:09:29.000Z
2022-03-27T04:02:30.000Z
pyefun/wxefun/component/Image.py
1431241631/pyefun
ac2290d4bcc8de16c195d2782f3eacd26e5e6ed4
[ "Apache-2.0" ]
11
2021-05-22T06:44:19.000Z
2021-12-27T11:16:06.000Z
pyefun/wxefun/component/Image.py
1431241631/pyefun
ac2290d4bcc8de16c195d2782f3eacd26e5e6ed4
[ "Apache-2.0" ]
21
2021-05-22T21:08:09.000Z
2022-02-24T02:39:06.000Z
import wx.lib.agw.floatspin as floatspin from .wxControl import * class 图片操作(wx.Image, 公用方法): pass def 设置宽度高度(self, width, height, quality=0): return 图片操作(self.Scale(width, height, quality)) def 取位图(self, depth=-1): return self.ConvertToBitmap(depth)
21.769231
55
0.678445
39
283
4.923077
0.666667
0.114583
0.1875
0
0
0
0
0
0
0
0
0.008889
0.204947
283
12
56
23.583333
0.844444
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0.125
0.25
0.25
0.875
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
1
0
0
0
4
e0210ead1900fb0055dd06f4dc884bd49421183b
58
py
Python
debug_serv.py
usermuser/chelhack
aa6c1a2f6f45e79a01aed2308676415c49228425
[ "Apache-2.0" ]
null
null
null
debug_serv.py
usermuser/chelhack
aa6c1a2f6f45e79a01aed2308676415c49228425
[ "Apache-2.0" ]
8
2019-12-26T17:34:23.000Z
2022-02-26T20:48:37.000Z
debug_serv.py
usermuser/chelhack
aa6c1a2f6f45e79a01aed2308676415c49228425
[ "Apache-2.0" ]
1
2019-11-30T05:50:53.000Z
2019-11-30T05:50:53.000Z
from waitress import serve serve(api-v1, listen='*:8080')
19.333333
30
0.741379
9
58
4.777778
0.888889
0
0
0
0
0
0
0
0
0
0
0.096154
0.103448
58
2
31
29
0.730769
0
0
0
0
0
0.103448
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
e069ac1a0d004b32c82e4147a7acacaff4a6bf04
517
py
Python
basic/views.py
sanjarbek16/libercen
bccfdfbfbe6dde6c97ee12cf9caca99e5e5136ca
[ "MIT" ]
2
2020-06-21T11:17:37.000Z
2020-11-01T18:40:20.000Z
basic/views.py
sanjarbek16/libercen
bccfdfbfbe6dde6c97ee12cf9caca99e5e5136ca
[ "MIT" ]
null
null
null
basic/views.py
sanjarbek16/libercen
bccfdfbfbe6dde6c97ee12cf9caca99e5e5136ca
[ "MIT" ]
null
null
null
from django.shortcuts import render from django.contrib.auth.decorators import login_required from common.decorators import ajax_required # Welcome page view def welcome(request): return render(request, 'basic/welcome.html',) # privacy policy def policy(request): return render(request, 'basic/privacy-policy.html',) @login_required @ajax_required def user_menu(request): user = request.user return render(request, 'basic/user_menu.html', {'user': user})
22.478261
60
0.704062
63
517
5.68254
0.380952
0.100559
0.159218
0.201117
0.173184
0
0
0
0
0
0
0
0.199226
517
23
61
22.478261
0.864734
0.061896
0
0
0
0
0.138716
0.05176
0
0
0
0
0
1
0.214286
false
0
0.214286
0.142857
0.642857
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
e070cd546596d4e39a1adf80e04158965281214e
3,691
py
Python
tests/db_table_test.py
davvid/skeletor
2673ce418145ec0b594f2993cba7fd889fdaa349
[ "BSD-3-Clause" ]
2
2016-07-28T06:42:36.000Z
2018-10-30T08:19:55.000Z
tests/db_table_test.py
davvid/skeletor
2673ce418145ec0b594f2993cba7fd889fdaa349
[ "BSD-3-Clause" ]
null
null
null
tests/db_table_test.py
davvid/skeletor
2673ce418145ec0b594f2993cba7fd889fdaa349
[ "BSD-3-Clause" ]
null
null
null
import unittest from tests import testlib from skeletor.db import table class DBTableTestCase(unittest.TestCase): def setUp(self): self.name = 'test' self.email = 'test@example.com' self.context = testlib.create_database(self) self.table = table.Table('users') def test_new_user(self): context = self.context user = self.table.new(name=self.name, context=context) self.assertEqual(user['name'], self.name) def test_find_by_id(self): context = self.context user = self.table.new(name=self.name, email=self.email, context=context) self.assertEqual(user['name'], self.name) user_id = user['id'] user = self.table.find_by_id(user_id, context=context) self.assertEqual(user['name'], self.name) def test_update_user(self): context = self.context user = self.table.new(name=self.name, email=self.email, context=context) self.assertEqual(user['name'], self.name) user_id = user['id'] self.table.update(user_id, name='updated', context=context) user = self.table.find_by_id(user_id, context=context) self.assertEqual(user['name'], 'updated') def test_duplicate_user(self): context = self.context user = self.table.new(email=self.email, context=context) self.assertEqual(user['email'], self.email) user = self.table.new(email=self.email, context=context) self.assertEqual(user, None) def test_fetchall(self): context = self.context self.table.new(email='a', context=context) self.table.new(email='b', context=context) all_users = self.table.fetchall(context=context) self.assertEqual(len(all_users), 2) self.assertEqual(all_users[0]['email'], 'a') self.assertEqual(all_users[1]['email'], 'b') def test_filter_by(self): context = self.context self.table.new(name='first', email='a', context=context) self.table.new(name='second', email='b', context=context) user = self.table.filter_by(email='a', context=context) self.assertEqual(user['email'], 'a') user = self.table.filter_by(name='second', email='a', context=context) self.assertEqual(user, None) def test_ifilter_by(self): context = self.context self.table.new(name='first', email='A', context=context) self.table.new(name='second', email='B', context=context) user = self.table.ifilter_by(email='a', context=context) self.assertEqual(user['email'], 'A') user = self.table.ifilter_by(name='Second', email='A', context=context) self.assertEqual(user, None) def test_select_all(self): context = self.context self.table.new(name='a', email='a', context=context) self.table.new(name='a', email='a2', context=context) self.table.new(name='b', email='b', context=context) users = self.table.select_all(name='a', context=context) self.assertEqual(len(users), 2) self.assertEqual(users[0]['email'], 'a') self.assertEqual(users[1]['email'], 'a2') def test_delete(self): context = self.context self.table.new(email='a', context=context) self.table.new(email='b', context=context) all_users = self.table.fetchall(context=context) self.assertEqual(len(all_users), 2) self.table.delete(email='a', context=context) all_users = self.table.fetchall(context=context) self.assertEqual(len(all_users), 1) self.assertEqual(all_users[0]['email'], 'b') if __name__ == '__main__': unittest.main()
35.152381
80
0.636684
482
3,691
4.773859
0.103734
0.167319
0.164276
0.189048
0.790526
0.758801
0.701434
0.698392
0.661452
0.650152
0
0.003792
0.214034
3,691
104
81
35.490385
0.789383
0
0
0.417722
0
0
0.047142
0
0
0
0
0
0.253165
1
0.126582
false
0
0.037975
0
0.177215
0
0
0
0
null
0
0
1
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
e073cb600e6d7e293d488ebb12f47bc1559840dc
295
py
Python
ex2.py
wf539/LearnPythonHardWay
854fb5324465f49d163c901c6e2eee5788df172a
[ "MIT" ]
null
null
null
ex2.py
wf539/LearnPythonHardWay
854fb5324465f49d163c901c6e2eee5788df172a
[ "MIT" ]
null
null
null
ex2.py
wf539/LearnPythonHardWay
854fb5324465f49d163c901c6e2eee5788df172a
[ "MIT" ]
null
null
null
# A comment, so you can read your program later. # Anything after the # is ignored by Python. print "I could have code like this." # And the comment after is ignored. # You could also use a comment to "disable" or comment out a piece of code: # print "This won't run." print "This will run."
29.5
75
0.715254
53
295
3.981132
0.679245
0.075829
0
0
0
0
0
0
0
0
0
0
0.20678
295
9
76
32.777778
0.901709
0.745763
0
0
0
0
0.617647
0
0
0
0
0
0
0
null
null
0
0
null
null
1
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
1
0
null
0
0
0
0
1
0
0
0
0
0
0
1
0
4
0eefcba7526a23d2afdfd64156ae27ec0f5a3b12
154
py
Python
mkdocs_github_dashboard/__init__.py
OUXT-Polaris/mkdocs_github_dashboard
121d2cc0740c945ada34b8f2a0f7a9b01b36312c
[ "Apache-2.0" ]
1
2021-12-07T14:09:04.000Z
2021-12-07T14:09:04.000Z
mkdocs_github_dashboard/__init__.py
OUXT-Polaris/mkdocs_github_dashboard
121d2cc0740c945ada34b8f2a0f7a9b01b36312c
[ "Apache-2.0" ]
null
null
null
mkdocs_github_dashboard/__init__.py
OUXT-Polaris/mkdocs_github_dashboard
121d2cc0740c945ada34b8f2a0f7a9b01b36312c
[ "Apache-2.0" ]
null
null
null
"""Top-level package for mkdocs-github-dashboard.""" __author__ = """mkdocs-github-dashboard""" __email__ = 'ms.kataoka@gmail.com' __version__ = '0.1.0'
25.666667
52
0.714286
20
154
4.9
0.8
0.244898
0.428571
0
0
0
0
0
0
0
0
0.021429
0.090909
154
5
53
30.8
0.678571
0.298701
0
0
0
0
0.470588
0.22549
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
16110a6b2cfb8d175e8fe75cf237ee322614407f
258
py
Python
python/src/main/python/pyalink/alink/stream/display_utils/abstract_display_service.py
wenwei8268/Alink
c00702538c95a32403985ebd344eb6aeb81749a7
[ "Apache-2.0" ]
null
null
null
python/src/main/python/pyalink/alink/stream/display_utils/abstract_display_service.py
wenwei8268/Alink
c00702538c95a32403985ebd344eb6aeb81749a7
[ "Apache-2.0" ]
null
null
null
python/src/main/python/pyalink/alink/stream/display_utils/abstract_display_service.py
wenwei8268/Alink
c00702538c95a32403985ebd344eb6aeb81749a7
[ "Apache-2.0" ]
null
null
null
from abc import ABC, abstractmethod class AbstractDisplayService(ABC): @abstractmethod def accept_items(self, items): raise Exception("Not implemented.") @abstractmethod def stop(self): raise Exception("Not implemented.")
19.846154
43
0.693798
26
258
6.846154
0.576923
0.191011
0.191011
0.314607
0
0
0
0
0
0
0
0
0.217054
258
12
44
21.5
0.881188
0
0
0.5
0
0
0.124031
0
0
0
0
0
0
1
0.25
false
0
0.125
0
0.5
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
4
16267d89f5d749ebc156b05b6baeedf634ed6e6a
164
py
Python
neurotic/testing/fixtures.py
necromuralist/Neurotic-Networking
20f46dec5d890bd57abd802b6ebf219f0e8e7611
[ "MIT" ]
null
null
null
neurotic/testing/fixtures.py
necromuralist/Neurotic-Networking
20f46dec5d890bd57abd802b6ebf219f0e8e7611
[ "MIT" ]
3
2021-01-11T01:42:31.000Z
2021-11-10T19:44:25.000Z
neurotic/testing/fixtures.py
necromuralist/Neurotic-Networking
20f46dec5d890bd57abd802b6ebf219f0e8e7611
[ "MIT" ]
null
null
null
import pytest class Katamari: """A holder of things""" @pytest.fixture def katamari(): """fixture to generate a Katamari object""" return Katamari()
14.909091
47
0.670732
20
164
5.5
0.7
0
0
0
0
0
0
0
0
0
0
0
0.207317
164
10
48
16.4
0.846154
0.341463
0
0
1
0
0
0
0
0
0
0
0
1
0.2
true
0
0.2
0
0.8
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
1
0
0
0
null
0
0
0
0
0
0
1
0
0
0
1
0
0
4
164374e385b97e4247fac322ddb17d9fb1e7e0c7
803
py
Python
smartpms/config/smartpms.py
vignesharumainayagam/smartpms-latest
9a106bdfb9dc039a57e4616e1b0981ba5fcf3ebf
[ "MIT" ]
null
null
null
smartpms/config/smartpms.py
vignesharumainayagam/smartpms-latest
9a106bdfb9dc039a57e4616e1b0981ba5fcf3ebf
[ "MIT" ]
null
null
null
smartpms/config/smartpms.py
vignesharumainayagam/smartpms-latest
9a106bdfb9dc039a57e4616e1b0981ba5fcf3ebf
[ "MIT" ]
null
null
null
from __future__ import unicode_literals from frappe import _ def get_data(): return [ { "label": _("Vessel"), "items": [ { "type": "doctype", "name": "Vessel" }, ] }, { "label": _("Masters"), "items": [ { "type": "doctype", "name": "Functional Block" }, { "type": "doctype", "name": "SubFunctional Block" }, { "type": "doctype", "name": "Equipment" }, { "type": "doctype", "name": "Sub Equipment" } ] }, { "label": _("Maintenance & Defects"), "items": [ { "type": "doctype", "name": "Maintenance" }, { "type": "doctype", "name": "Defect" }, { "type": "page", "name": "tree-view", }, ] }, ]
13.610169
39
0.418431
58
803
5.62069
0.482759
0.236196
0.322086
0.184049
0
0
0
0
0
0
0
0
0.373599
803
58
40
13.844828
0.648111
0
0
0.192308
0
0
0.3375
0
0
0
0
0
0
1
0.019231
true
0
0.038462
0.019231
0.076923
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
1661c96e5e9f895fe06313fe664ad35b057de5a6
252
py
Python
models/likes.py
JesperKauppinen/paint-webapp
772ac2b071c3cb1a984673c2f55f1de8d7692d2f
[ "MIT" ]
null
null
null
models/likes.py
JesperKauppinen/paint-webapp
772ac2b071c3cb1a984673c2f55f1de8d7692d2f
[ "MIT" ]
4
2021-11-27T04:02:58.000Z
2021-12-02T16:43:07.000Z
models/likes.py
JesperKauppinen/paint-webapp
772ac2b071c3cb1a984673c2f55f1de8d7692d2f
[ "MIT" ]
null
null
null
from . import db class Likes(db.Model): __tablename__ = 'likes' id = db.Column(db.Integer, primary_key=True) user_id = db.Column(db.Integer, db.ForeignKey('users.id')) artwork_id = db.Column(db.Integer, db.ForeignKey('artworks.id'))
25.2
68
0.686508
37
252
4.486486
0.486486
0.072289
0.180723
0.216867
0.487952
0.373494
0.373494
0
0
0
0
0
0.15873
252
9
69
28
0.783019
0
0
0
0
0
0.095618
0
0
0
0
0
0
1
0
false
0
0.166667
0
1
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
4
1664da716517f8370b3bacbda5fb0937db565bc2
231
py
Python
Easy/find-n-unique-integers-sum-up-to-zero.py
BrynjarGeir/LeetCode
dbd57e645c5398dec538b6466215b61491c8d1d9
[ "MIT" ]
null
null
null
Easy/find-n-unique-integers-sum-up-to-zero.py
BrynjarGeir/LeetCode
dbd57e645c5398dec538b6466215b61491c8d1d9
[ "MIT" ]
null
null
null
Easy/find-n-unique-integers-sum-up-to-zero.py
BrynjarGeir/LeetCode
dbd57e645c5398dec538b6466215b61491c8d1d9
[ "MIT" ]
null
null
null
class Solution: def sumZero(self, n: int) -> List[int]: ans = [] for i in range(n//2): ans.append(i+1) ans.append(-i-1) if n % 2 != 0: ans.append(0) return ans
25.666667
43
0.4329
33
231
3.030303
0.575758
0.27
0.2
0.22
0
0
0
0
0
0
0
0.044776
0.419913
231
9
44
25.666667
0.701493
0
0
0
0
0
0
0
0
0
0
0
0
1
0.111111
false
0
0
0
0.333333
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
1668eae29621fd8db128fcf48b44c911b38a9b6e
53,115
py
Python
ismore/ismore_bmi_lib.py
srsummerson/bmi_python
7eca891f078ce15b2b9cf85f1309346d6fb9fccb
[ "Apache-2.0" ]
null
null
null
ismore/ismore_bmi_lib.py
srsummerson/bmi_python
7eca891f078ce15b2b9cf85f1309346d6fb9fccb
[ "Apache-2.0" ]
12
2020-07-31T18:58:31.000Z
2022-02-10T14:36:00.000Z
ismore/ismore_bmi_lib.py
srsummerson/bmi_python
7eca891f078ce15b2b9cf85f1309346d6fb9fccb
[ "Apache-2.0" ]
4
2020-03-06T15:39:00.000Z
2021-05-26T17:03:21.000Z
''' BMI code specific to the ISMORE project ''' import numpy as np from riglib.stereo_opengl import ik from riglib.bmi import feedback_controllers from riglib.bmi.state_space_models import State, StateSpace, offset_state, _gen_A from riglib.bmi.assist import Assister from riglib.bmi.clda import Learner, FeedbackControllerLearner import pickle from utils.angle_utils import * from utils.constants import * ###################### ## State-space models ###################### class StateSpaceArmAssist(StateSpace): def __init__(self): max_vel = 2 # cm/s max_ang_vel = 7.5 * deg_to_rad super(StateSpaceArmAssist, self).__init__( State('aa_px', stochastic=False, drives_obs=False, order=0, min_val=0., max_val=42.), State('aa_py', stochastic=False, drives_obs=False, order=0, min_val=0., max_val=30.), State('aa_ppsi', stochastic=False, drives_obs=False, order=0), State('aa_vx', stochastic=True, drives_obs=True, order=1, min_val=-max_vel, max_val=max_vel), State('aa_vy', stochastic=True, drives_obs=True, order=1, min_val=-max_vel, max_val=max_vel), State('aa_vpsi', stochastic=True, drives_obs=True, order=1, min_val=-max_ang_vel, max_val=max_ang_vel), offset_state ) def get_ssm_matrices(self, update_rate=0.1): # for now, just use a fixed vel_decay for A and vel_var for W # regardless of the value of update_rate vel_decay = 1. A = _gen_A(1, update_rate, 0, vel_decay, 1, ndim=3) A[5,5] = .8 vel_var = 7. W = _gen_A(0, 0, 0, vel_var, 0, ndim=3) # there is no separate _gen_W function W[5,5] = .1 # Control input matrix for SSM for control inputs I = np.mat(np.eye(3)) B = np.vstack([0*I, update_rate*1000 * I, np.zeros([1, 3])]) return A, B, W class StateSpaceReHand(StateSpace): def __init__(self): max_ang_vel = 7.5 * deg_to_rad super(StateSpaceReHand, self).__init__( State('rh_pthumb', stochastic=False, drives_obs=False, order=0), State('rh_pindex', stochastic=False, drives_obs=False, order=0), State('rh_pfing3', stochastic=False, drives_obs=False, order=0), State('rh_pprono', stochastic=False, drives_obs=False, order=0), State('rh_vthumb', stochastic=True, drives_obs=True, order=1, min_val=-max_ang_vel, max_val=max_ang_vel), State('rh_vindex', stochastic=True, drives_obs=True, order=1, min_val=-max_ang_vel, max_val=max_ang_vel), State('rh_vfing3', stochastic=True, drives_obs=True, order=1, min_val=-max_ang_vel, max_val=max_ang_vel), State('rh_vprono', stochastic=True, drives_obs=True, order=1, min_val=-max_ang_vel, max_val=max_ang_vel), offset_state ) def get_ssm_matrices(self, update_rate=0.1): # for now, just use a fixed vel_decay for A and vel_var for W # regardless of the value of update_rate vel_decay = .8 A = _gen_A(1, update_rate, 0, vel_decay, 1, ndim=4) vel_var = .1 W = _gen_A(0, 0, 0, vel_var, 0, ndim=4) # there is no separate _gen_W function # Control input matrix for SSM for control inputs I = np.mat(np.eye(4)) B = np.vstack([0*I, update_rate*1000 * I, np.zeros([1, 4])]) return A, B, W class StateSpaceIsMore(StateSpace): def __init__(self): max_vel = 2 # cm/s max_ang_vel = 7.5 * deg_to_rad super(StateSpaceIsMore, self).__init__( # position states State('aa_px', stochastic=False, drives_obs=False, order=0, min_val=0., max_val=42.), State('aa_py', stochastic=False, drives_obs=False, order=0, min_val=0., max_val=30.), State('aa_ppsi', stochastic=False, drives_obs=False, order=0), State('rh_pthumb', stochastic=False, drives_obs=False, order=0), State('rh_pindex', stochastic=False, drives_obs=False, order=0), State('rh_pfing3', stochastic=False, drives_obs=False, order=0), State('rh_pprono', stochastic=False, drives_obs=False, order=0), # velocity states State('aa_vx', stochastic=True, drives_obs=True, order=1, min_val=-max_vel, max_val=max_vel), State('aa_vy', stochastic=True, drives_obs=True, order=1, min_val=-max_vel, max_val=max_vel), State('aa_vpsi', stochastic=True, drives_obs=True, order=1, min_val=-max_ang_vel, max_val=max_ang_vel), State('rh_vthumb', stochastic=True, drives_obs=True, order=1, min_val=-max_ang_vel, max_val=max_ang_vel), State('rh_vindex', stochastic=True, drives_obs=True, order=1, min_val=-max_ang_vel, max_val=max_ang_vel), State('rh_vfing3', stochastic=True, drives_obs=True, order=1, min_val=-max_ang_vel, max_val=max_ang_vel), State('rh_vprono', stochastic=True, drives_obs=True, order=1, min_val=-max_ang_vel, max_val=max_ang_vel), # offset state offset_state ) def get_ssm_matrices(self, update_rate=0.1): # for now, just use a fixed vel_decay for A and vel_var for W # regardless of the value of update_rate vel_decay = .8 A = _gen_A(1, update_rate, 0, vel_decay, 1, ndim=7) A[7,7] = 1. A[8, 8] =1. #vel_var = .1 vel_var = 0.005 W = _gen_A(0, 0, 0, vel_var, 0, ndim=7) # there is no separate _gen_W function # W[7,7] = 7 # W[8, 8] = 7 W[7, 7] = 0.5 W[8, 8] = 0.5 W[9, 9] = 0.01 # Control input matrix for SSM for control inputs I = np.mat(np.eye(7)) B = np.vstack([0*I, update_rate*1000 * I, np.zeros([1, 7])]) return A, B, W class StateSpaceDummy(StateSpace): def __init__(self): max_vel = 2 # cm/s max_ang_vel = 7.5 * deg_to_rad super(StateSpaceDummy, self).__init__( State('aa_px', stochastic=False, drives_obs=False, order=0, min_val=0., max_val=42.), State('aa_py', stochastic=False, drives_obs=False, order=0, min_val=0., max_val=30.), State('aa_ppsi', stochastic=False, drives_obs=False, order=0), State('aa_vx', stochastic=True, drives_obs=True, order=1, min_val=-max_vel, max_val=max_vel), State('aa_vy', stochastic=True, drives_obs=True, order=1, min_val=-max_vel, max_val=max_vel), State('aa_vpsi', stochastic=True, drives_obs=True, order=1, min_val=-max_ang_vel, max_val=max_ang_vel), offset_state ) def get_ssm_matrices(self, update_rate=0.1): # for now, just use a fixed vel_decay for A and vel_var for W # regardless of the value of update_rate vel_decay = 1. A = _gen_A(1, update_rate, 0, vel_decay, 1, ndim=3) A[5,5] = .8 vel_var = 7. W = _gen_A(0, 0, 0, vel_var, 0, ndim=3) # there is no separate _gen_W function W[5,5] = .1 # Control input matrix for SSM for control inputs I = np.mat(np.eye(3)) B = np.vstack([0*I, update_rate*1000 * I, np.zeros([1, 3])]) return A, B, W ####################################################################### ##### Assisters and Learners based on formal feedback controllers ##### ####################################################################### from riglib.bmi.feedback_controllers import LQRController from riglib.bmi.assist import FeedbackControllerAssist, FeedbackControllerAssist_StateSpecAssistLevels class LQRController_accel_limit_armassist(LQRController): def __init__(self, *args, **kwargs): self.prev_assister_output = np.nan self.accel_lim_armassist = .1 self.accel_lim_psi = .02 print 'LQRController' super(LQRController_accel_limit_armassist, self).__init__(*args, **kwargs) def calc_next_state(self, current_state, target_state, mode=None): current_state = np.mat(current_state).reshape(-1,1) target_state = np.mat(target_state).reshape(-1,1) assister_output = self.A * current_state + self.B * self.F * (target_state - current_state) if np.sum(assister_output[3:6]) != 0: if np.any(np.isnan(self.prev_assister_output)): self.prev_assister_output = np.zeros_like(assister_output) assister_output_accel = assister_output - self.prev_assister_output for i in np.arange(3,5): if assister_output_accel[i, 0] > self.accel_lim_armassist: assister_output[i, 0] = self.prev_assister_output[i, 0] + self.accel_lim_armassist elif assister_output_accel[i, 0] < -1*self.accel_lim_armassist: assister_output[i, 0] = self.prev_assister_output[i, 0] - self.accel_lim_armassist for i in [5]: if assister_output_accel[i, 0] > self.accel_lim_psi: assister_output[i, 0] = self.prev_assister_output[i, 0] + self.accel_lim_psi elif assister_output_accel[i, 0] < -1*self.accel_lim_psi: assister_output[i, 0] = self.prev_assister_output[i, 0] - self.accel_lim_psi self.prev_assister_output = assister_output return assister_output class LQRController_accel_limit_rehand(LQRController): def __init__(self, *args, **kwargs): self.prev_assister_output = np.nan self.accel_lim = .02 print 'LQRController' super(LQRController_accel_limit_rehand, self).__init__(*args, **kwargs) def calc_next_state(self, current_state, target_state, mode=None): current_state = np.mat(current_state).reshape(-1,1) target_state = np.mat(target_state).reshape(-1,1) assister_output = self.A * current_state + self.B * self.F * (target_state - current_state) if np.sum(assister_output[4:8]) != 0: if np.any(np.isnan(self.prev_assister_output)): self.prev_assister_output = np.zeros_like(assister_output) assister_output_accel = assister_output - self.prev_assister_output # print 'assister output accel', np.squeeze(assister_output_accel) for i in np.arange(4,8): if assister_output_accel[i, 0] > self.accel_lim: assister_output[i, 0] = self.prev_assister_output[i, 0] + self.accel_lim elif assister_output_accel[i, 0] < -1*self.accel_lim: assister_output[i, 0] = self.prev_assister_output[i, 0] - self.accel_lim self.prev_assister_output = assister_output return assister_output class LQRController_accel_limit_ismore(LQRController): def __init__(self, *args, **kwargs): self.prev_assister_output = np.nan self.accel_lim_armassist = .5#.1 self.accel_lim_psi = .5#.02 self.accel_lim_rehand = .5#.02 # # nerea -- acceleration limit removed # self.accel_lim_armassist = np.inf # self.accel_lim_psi = np.inf # self.accel_lim_rehand = np.inf # print 'LQRController' super(LQRController_accel_limit_ismore, self).__init__(*args, **kwargs) def calc_next_state(self, current_state, target_state, mode=None): current_state = np.mat(current_state).reshape(-1,1) target_state = np.mat(target_state).reshape(-1,1) assister_output = self.B * self.F * (target_state - current_state) if np.sum(assister_output[7:14]) != 0: if np.any(np.isnan(self.prev_assister_output)): self.prev_assister_output = np.zeros_like(assister_output) #print 'assister_output', assister_output[7:14] assister_output_accel = assister_output - self.prev_assister_output #print 'assister output accel', np.squeeze(assister_output_accel) for i in np.arange(7,9): if assister_output_accel[i, 0] > self.accel_lim_armassist: assister_output[i, 0] = self.prev_assister_output[i, 0] + self.accel_lim_armassist elif assister_output_accel[i, 0] < -1*self.accel_lim_armassist: assister_output[i, 0] = self.prev_assister_output[i, 0] - self.accel_lim_armassist for i in [9]: if assister_output_accel[i, 0] > self.accel_lim_psi: assister_output[i, 0] = self.prev_assister_output[i, 0] + self.accel_lim_psi elif assister_output_accel[i, 0] < -1*self.accel_lim_psi: assister_output[i, 0] = self.prev_assister_output[i, 0] - self.accel_lim_psi for i in np.arange(10,14): #print "accel rh", assister_output_accel[i, 0] if assister_output_accel[i, 0] > self.accel_lim_rehand: print "excedeed rh accel limit in DoF ", i assister_output[i, 0] = self.prev_assister_output[i, 0] + self.accel_lim_rehand elif assister_output_accel[i, 0] < -1*self.accel_lim_rehand: print "excedeed rh accel limit" assister_output[i, 0] = self.prev_assister_output[i, 0] - self.accel_lim_rehand #print 'assister_output_accel after', assister_output - self.prev_assister_output self.prev_assister_output = assister_output return assister_output class LQRController_accel_limit_only_base_ismore(LQRController_accel_limit_ismore): def __init__(self, *args, **kwargs): super(LQRController_accel_limit_only_base_ismore, self).__init__(*args, **kwargs) self.prev_assister_output = np.nan self.accel_lim_armassist = np.inf self.accel_lim_psi = np.inf self.accel_lim_rehand = np.inf class LQRController_ismore_w_rest(LQRController): def calc_next_state(self, current_state, target_state, mode=None): if mode in ['rest', 'emg_rest']: ts = current_state.copy() else: ts = target_state.copy() current_state = np.mat(current_state).reshape(-1,1) target_state = np.mat(ts).reshape(-1,1) ns = self.A * current_state + self.B * self.F * (target_state - current_state) return ns ssm = StateSpaceArmAssist() A, B, _ = ssm.get_ssm_matrices() #Q = np.mat(np.diag([10., 10., 10., 5, 5, 5, 0])) Q = np.mat(np.diag([1., 1., 1., 5, 5, 5, 0])) R = 1e6 * np.mat(np.diag([1., 1., 1.])) arm_assist_controller = LQRController(A, B, Q, R) ssm = StateSpaceReHand() A, B, _ = ssm.get_ssm_matrices() Q = 0.1*np.mat(np.diag([1., 1., 1., 1., 10., 10., 10., 10., 0])) R = 1e5 * np.mat(np.diag([1., 1., 1., 1.])) #for bmi: 1e7 rehand_controller = LQRController(A, B, Q, R) ssm = StateSpaceIsMore() A, B, _ = ssm.get_ssm_matrices() Q = 0.1*np.mat(np.diag([10., 10., 10., 1., 1., 1., 1., 5, 5, 5, 10., 10., 10., 10., 0])) R = 1e5 * np.mat(np.diag([1., 1., 1.,1., 1., 1., 1.])) #for bmi =1e6 ; to make it faster, changed from 1e6 to 1e5 ismore_controller = LQRController(A, B, Q, R) ismore_controller_w_rest = LQRController_ismore_w_rest(A, B, Q, R) ##################### For BMI SIMS ##################### ssm = StateSpaceArmAssist() A, B, _ = ssm.get_ssm_matrices() Q = np.mat(np.diag([10., 10., 1., 5, 5, .5, 0])) #Q = np.mat(np.diag([1., 1., 1., 5, 5, 5, 0])) R = 1e6 * np.mat(np.diag([1., 1., 1.])) arm_assist_controller_bmi_sims = LQRController(A, B, Q, R) ssm = StateSpaceReHand() A, B, _ = ssm.get_ssm_matrices() #Q = np.mat(np.diag([1., 1., 1., 1., .5, .5, .5, .5, 0])) Q = np.mat(np.diag([1., 1., 1., 1., .5, .5, .5, .5, 0])) R = 1e6 * np.mat(np.diag([1., 1., 1., 1.])) #for bmi: 1e7 rehand_controller_bmi_sims = LQRController(A, B, Q, R) # ssm = StateSpaceIsMore() # A, B, _ = ssm.get_ssm_matrices() # Q = 0.1*np.mat(np.diag([10., 10., 10., 1., 1., 1., 1., 5, 5, 5, .5, .5, .5, .5, 0])) # R = 1e6 * np.mat(np.diag(np.ones(7,))) #for bmi =1e6 ; to make it faster, changed from 1e6 to 1e5 # ismore_controller = LQRController(A, B, Q, R) class iBMIAssister(Assister): ''' Summary: IBMI Assister modifies Assister output to bound velocities ''' def __init__(self, ssm, *args, **kwargs): super(iBMIAssister, self).__init__(*args, **kwargs) self.ssm = ssm self.min_motor_vel = 1e-3 #states that drive obs: self.vel_states = np.nonzero(ssm.state_order==1)[0] def __call__(self, *args, **kwargs): asst = super(iBMIAssister, self).__call__(*args, **kwargs) return self.bound_vel_states(asst) def bound_vel_states(self, asst): if 'Bu' in asst: asst_in = asst['Bu'].copy() asst_ky = 'Bu' elif 'x_assist' in asst: asst_in = asst['x_assist'].copy() asst_ky = 'x_assist' asst_in[self.vel_states, 0] = self._bnd(asst_in[self.vel_states, 0]) asst[asst_ky] = asst_in return asst def _bnd(self, vals): val_bnd = [] vals_arr = np.squeeze(np.array(vals)) for iv, vl in enumerate(vals_arr): if vl < 0: vl_gain=-1 else: vl_gain = 1 vl_adj = vl_gain*np.max([np.abs(vl), self.min_motor_vel]) val_bnd.append(vl_adj) return np.array(val_bnd) ############################################### ################ LFC Assisters ################# ################################################ class ArmAssistLFCAssister(iBMIAssister, FeedbackControllerAssist): ''' Assister for ArmAssist which uses an infinite-horizon LQR controller ''' def __init__(self, *args, **kwargs): super(ArmAssistLFCAssister, self).__init__(StateSpaceArmAssist(), arm_assist_controller, style='mixing') class ReHandLFCAssister(iBMIAssister, FeedbackControllerAssist): def __init__(self, *args, **kwargs): super(ReHandLFCAssister, self).__init__(StateSpaceReHand(), rehand_controller, style='mixing') #class IsMoreLFCAssister(Assister): #it was like this before, ask Suraj class IsMoreLFCAssister(iBMIAssister, FeedbackControllerAssist): def __init__(self, *args, **kwargs): super(IsMoreLFCAssister, self).__init__(StateSpaceIsMore(), ismore_controller, style='mixing') ############################################### ####### Orthogonal Damping Assisters ########## ################################################ class OrthoAssist(iBMIAssister): def __init__(self, *args, **kwargs): super(OrthoAssist, self).__init__(*args, **kwargs) def calc_assisted_BMI_state(self, *args, **kwargs): assist_kw = super(OrthoAssist, self).calc_assisted_BMI_state(*args, **kwargs) assist_kw['ortho_damp_assist'] = True return assist_kw class ArmAssistLFCOrthoDampAssister(ArmAssistLFCAssister, OrthoAssist): def __init__(self, *args, **kwargs): super(ArmAssistLFCOrthoDampAssister, self).__init__(*args, **kwargs) class ReHandLFCOrthoDampAssister(ReHandLFCAssister, OrthoAssist): def __init__(self, *args, **kwargs): super(ReHandLFCOrthoDampAssister, self).__init__(*args, **kwargs) class IsMoreLFCOrthoDampAssister(IsMoreLFCAssister, OrthoAssist): def __init__(self, *args, **kwargs): super(IsMoreLFCOrthoDampAssister, self).__init__(*args, **kwargs) class IsMoreLFCOrthoDamp_diff_assist(IsMoreLFCAssister, OrthoAssist, FeedbackControllerAssist_StateSpecAssistLevels): def __init__(self, *args, **kwargs): super(IsMoreLFCOrthoDamp_diff_assist, self).__init__(*args, **kwargs) ############################################### ################ OFC Assisters ################# ################################################ class ArmAssistOFCLearner(FeedbackControllerLearner): def __init__(self, batch_size, *args, **kwargs): super(ArmAssistOFCLearner, self).__init__(batch_size, arm_assist_controller) class ReHandOFCLearner(FeedbackControllerLearner): def __init__(self, batch_size, *args, **kwargs): super(ReHandOFCLearner, self).__init__(batch_size, rehand_controller) class IsMoreOFCLearner(FeedbackControllerLearner): def __init__(self, batch_size, *args, **kwargs): super(IsMoreOFCLearner, self).__init__(batch_size, ismore_controller) class IsMoreOFCLearning_w_Rest(FeedbackControllerLearner): def __init__(self, batch_size, *args, **kwargs): super(IsMoreOFCLearning_w_Rest, self).__init__(batch_size, ismore_controller_w_rest) ############################################################### ##### Assisters and Learners based on more ad-hoc methods ##### ##############################################################3 class ArmAssistAssister(Assister): '''Simple assister that moves ArmAssist position towards the xy target at a constant speed, and towards the psi target at a constant angular speed. When within a certain xy distance or angular distance of the target, these speeds are reduced.''' def __init__(self, *args, **kwargs): ''' Docstring Parameters ---------- Returns ------- ''' self.call_rate = kwargs.pop('call_rate', 10) # secs self.xy_speed = kwargs.pop('xy_speed', 2.) # cm/s self.xy_cutoff = kwargs.pop('xy_cutoff', 2.) # cm self.psi_speed = kwargs.pop('psi_speed', 8.*deg_to_rad) # rad/s self.psi_cutoff = kwargs.pop('psi_cutoff', 5.*deg_to_rad) # rad def calc_assisted_BMI_state(self, current_state, target_state, assist_level, mode=None, **kwargs): ''' Docstring Parameters ---------- Returns ------- ''' if assist_level > 0: xy_pos = np.array(current_state[0:2, 0]).ravel() psi_pos = np.array(current_state[ 2, 0]).ravel() target_xy_pos = np.array(target_state[0:2, 0]).ravel() target_psi_pos = np.array(target_state[ 2, 0]).ravel() assist_xy_pos, assist_xy_vel = self._xy_assist(xy_pos, target_xy_pos) assist_psi_pos, assist_psi_vel = self._psi_assist(psi_pos, target_psi_pos) # if mode == 'hold': # print 'task state is "hold", setting assist vels to 0' # assist_xy_vel[:] = 0. # assist_psi_vel[:] = 0. Bu = assist_level * np.hstack([assist_xy_pos, assist_psi_pos, assist_xy_vel, assist_psi_vel, 1]) Bu = np.mat(Bu.reshape(-1, 1)) assist_weight = assist_level else: Bu = None assist_weight = 0. return dict(Bu=Bu, assist_level=assist_weight) # return Bu, assist_weight def _xy_assist(self, xy_pos, target_xy_pos): ''' Docstring Parameters ---------- Returns ------- ''' diff_vec = target_xy_pos - xy_pos dist_to_target = np.linalg.norm(diff_vec) dir_to_target = diff_vec / (np.spacing(1) + dist_to_target) # if xy distance is below xy_cutoff (e.g., target radius), use smaller speed if dist_to_target < self.xy_cutoff: frac = 0.5 * dist_to_target / self.xy_cutoff assist_xy_vel = frac * self.xy_speed * dir_to_target else: assist_xy_vel = self.xy_speed * dir_to_target assist_xy_pos = xy_pos + assist_xy_vel/self.call_rate return assist_xy_pos, assist_xy_vel def _psi_assist(self, psi_pos, target_psi_pos): ''' Docstring Parameters ---------- Returns ------- ''' psi_diff = angle_subtract(target_psi_pos, psi_pos) # if angular distance is below psi_cutoff, use smaller speed if abs(psi_diff) < self.psi_cutoff: assist_psi_vel = 0.5 * (psi_diff / self.psi_cutoff) * self.psi_speed else: assist_psi_vel = np.sign(psi_diff) * self.psi_speed assist_psi_pos = psi_pos + assist_psi_vel/self.call_rate return assist_psi_pos, assist_psi_vel class ReHandAssister(Assister): '''Simple assister that moves ReHand joint angles towards their angular targets at a constant angular speed. When angles are close to the target angles, these speeds are reduced.''' def __init__(self, *args, **kwargs): ''' Docstring Parameters ---------- Returns ------- ''' self.call_rate = kwargs.pop('call_rate' , 10) # secs self.ang_speed = kwargs.pop('ang_speed', 8.*deg_to_rad) # rad/s self.ang_cutoff = kwargs.pop('ang_cutoff', 5.*deg_to_rad) # rad def calc_assisted_BMI_state(self, current_state, target_state, assist_level, mode=None, **kwargs): ''' Docstring Parameters ---------- Returns ------- ''' if assist_level > 0: assist_rh_pos = np.zeros((0, 1)) assist_rh_vel = np.zeros((0, 1)) for i in range(4): rh_i_pos = np.array(current_state[i, 0]).ravel() target_rh_i_pos = np.array(target_state[i, 0]).ravel() assist_rh_i_pos, assist_rh_i_vel = self._angle_assist(rh_i_pos, target_rh_i_pos) assist_rh_pos = np.vstack([assist_rh_pos, assist_rh_i_pos]) assist_rh_vel = np.vstack([assist_rh_vel, assist_rh_i_vel]) # if mode == 'hold': # print 'task state is "hold", setting assist vels to 0' # assist_rh_vel[:] = 0. Bu = assist_level * np.vstack([assist_rh_pos, assist_rh_vel, 1]) Bu = np.mat(Bu.reshape(-1, 1)) assist_weight = assist_level else: Bu = None assist_weight = 0. return dict(Bu=Bu, assist_level=assist_weight) # return Bu, assist_weight def _angle_assist(self, ang_pos, target_ang_pos): ''' Docstring Parameters ---------- Returns ------- ''' ang_diff = angle_subtract(target_ang_pos, ang_pos) if abs(ang_diff) > self.ang_cutoff: assist_ang_vel = np.sign(ang_diff) * self.ang_speed else: assist_ang_vel = 0.5 * (ang_diff / self.ang_cutoff) * self.ang_speed assist_ang_pos = ang_pos + assist_ang_vel/self.call_rate return assist_ang_pos, assist_ang_vel class IsMoreAssister(Assister): '''Combines an ArmAssistAssister and a ReHandAssister.''' def __init__(self, *args, **kwargs): ''' Docstring Parameters ---------- Returns ------- ''' self.aa_assister = ArmAssistAssister(*args, **kwargs) self.rh_assister = ReHandAssister(*args, **kwargs) def calc_assisted_BMI_state(self, current_state, target_state, assist_level, mode=None, **kwargs): ''' Docstring Parameters ---------- Returns ------- ''' if assist_level > 0: aa_current_state = np.vstack([current_state[0:3], current_state[7:10], 1]) aa_target_state = np.vstack([target_state[0:3], target_state[7:10], 1]) aa_Bu = self.aa_assister.calc_assisted_BMI_state(aa_current_state, aa_target_state, assist_level, mode=mode, **kwargs)['Bu'] rh_current_state = np.vstack([current_state[3:7], current_state[10:14], 1]) rh_target_state = np.vstack([target_state[3:7], target_state[10:14], 1]) rh_Bu = self.rh_assister.calc_assisted_BMI_state(rh_current_state, rh_target_state, assist_level, mode=mode, **kwargs)['Bu'] Bu = np.vstack([aa_Bu[0:3], rh_Bu[0:4], aa_Bu[3:6], rh_Bu[4:8], assist_level * 1]) Bu = np.mat(Bu.reshape(-1, 1)) assist_weight = assist_level else: Bu = None assist_weight = 0. return dict(Bu=Bu, assist_level=assist_weight) # return Bu, assist_weight # LFC iBMI assisters # not inheriting from LinearFeedbackControllerAssist/SSMLFCAssister because: # - use of "special angle subtraction" when doing target_state - current_state # - meant to be used with 'weighted_avg_lfc'=True decoder kwarg, and thus # assist_weight is set to assist_level, not to 0 # increasing the values in the 'R' matrix you're more heavily weighting the velocity input in the cost function. from riglib.bmi.feedback_controllers import LQRController from riglib.bmi.assist import FeedbackControllerAssist ssm = StateSpaceArmAssist() A, B, _ = ssm.get_ssm_matrices() Q = np.mat(np.diag([10., 10., 10., 5, 5, 5, 0])) R = 1e8 * np.mat(np.diag([1., 1., 1.])) arm_assist_controller2 = LQRController(A, B, Q, R) ssm = StateSpaceReHand() A, B, _ = ssm.get_ssm_matrices() Q = np.mat(np.diag([1., 1., 1., 1., 0.5, 0.5, 0.5, 0.5, 0])) R = 1e6 * np.mat(np.diag([1., 1., 1., 1.])) rehand_controller2 = LQRController(A, B, Q, R) ##-------------------------------------------------## ssm = StateSpaceArmAssist() A, B, _ = ssm.get_ssm_matrices() # Same LQR controller but with different values to use them in the go_to_start phase of the playbacktrajectories task #Q = np.mat(np.diag([10., 10., 10., 5, 5, 5, 0])) # original values # Q = np.mat(np.diag([30., 30., 30., 10, 10, 10, 0])) # Q = np.mat(np.diag([50., 50., 50., 10, 10, 10, 0])) # R = 1e6 * np.mat(np.diag([1., 1., 1.])) # original values R = 1e6 * np.mat(np.diag([1., 1., 1.])) #arm_assist_controller_go_to_start = LQRController(A, B, Q, R) # arm_assist_controller_go_to_start = LQRController_accel_limit_armassist(A, B, Q, R) ssm = StateSpaceReHand() A, B, _ = ssm.get_ssm_matrices() # Same LQR controller but with different values to use them in the go_to_start phase of the playbacktrajectories task #Q = np.mat(np.diag([1., 1., 1., 1., 0.5, 0.5, 0.5, 0.5, 0])) #original values # Q = np.mat(np.diag([30., 30., 30.,30., 10, 10, 10, 10, 0])) R = 1e6 * np.mat(np.diag([1., 1., 1., 1.])) #rehand_controller_go_to_start = LQRController(A, B, Q, R) # rehand_controller_go_to_start = LQRController_accel_limit_rehand(A, B, Q, R) ssm = StateSpaceIsMore() A, B, _ = ssm.get_ssm_matrices() #Q = np.mat(np.diag([15., 15., 15.,15., 15., 15.,15., 5, 5, 5, 5, 5, 5, 5, 0])) Q = np.mat(np.diag([30., 30., 30.,30., 30., 30.,30., 10, 10, 10, 10, 10, 10, 10, 0])) # Q = np.mat(np.diag([50., 50., 50.,50., 50., 50.,50., 10, 10, 10, 10, 10, 10, 10, 0])) # Q = np.mat(np.diag([70., 70., 70.,70., 70., 70.,70., 10., 10., 10.,10., 10., 10.,10., 0])) # Q matrix for cyclic movements # Q = np.mat(np.diag([80., 80., 80.,80., 80., 80.,80., 1., 1., 1., 1., 1., 1., 1., 0])) #Q = np.mat(np.diag([80., 80., 80.,80., 80., 80.,80., 10., 10., 10., 10., 10., 10., 10., 0])) R = 1e6 * np.mat(np.diag([1., 1., 1., 1., 1., 1., 1.])) #original: 1e6 # ismore_controller_go_to_start = LQRController_accel_limit_ismore(A, B, Q, R) ##-------------------------------------------------## # class ArmAssistLFCAssister(FeedbackControllerAssist): # ''' # Assister for ArmAssist which uses an infinite-horizon LQR controller # ''' # def __init__(self, *args, **kwargs): # super(ArmAssistLFCAssister, self).__init__(arm_assist_controller, style='mixing') #self.A = A #self.B = B #self.Q = Q #self.R = R #self.F = feedback_controllers.LQRController.dlqr(A, B, Q, R) # def calc_assisted_BMI_state(self, current_state, target_state, assist_level, mode=None, **kwargs): # '''TODO.''' # diff = target_state - current_state # diff[2] = angle_subtract(target_state[2], current_state[2]) # Bu = assist_level * self.B*self.F*diff # assist_weight = assist_level # return dict(Bu=Bu, assist_level=assist_weight) # # return Bu, assist_weight class ReHandLFCAssister(FeedbackControllerAssist): def __init__(self, *args, **kwargs): super(ReHandLFCAssister, self).__init__(rehand_controller2, style='mixing') # ssm = StateSpaceReHand() # A, B, _ = ssm.get_ssm_matrices() # Q = np.mat(np.diag([1., 1., 1., 1., 0, 0, 0, 0, 0])) # R = 1e6 * np.mat(np.diag([1., 1., 1., 1.])) # self.A = A # self.B = B # self.Q = Q # self.R = R # self.F = feedback_controllers.LQRController.dlqr(A, B, Q, R) # def calc_assisted_BMI_state(self, current_state, target_state, assist_level, mode=None, **kwargs): # '''TODO.''' # diff = target_state - current_state # for i in range(4): # diff[i] = angle_subtract(target_state[i], current_state[i]) # Bu = assist_level * self.B*self.F*diff # assist_weight = assist_level # return dict(Bu=Bu, assist_level=assist_weight) # # return Bu, assist_weight # class IsMoreLFCAssister(Assister): # ''' # Docstring # Parameters # ---------- # Returns # ------- # ''' # def __init__(self, *args, **kwargs): # ''' # Docstring # Parameters # ---------- # Returns # ------- # ''' # ssm = StateSpaceIsMore() # A, B, _ = ssm.get_ssm_matrices() # Q = np.mat(np.diag([7., 7., 7., 7., 7., 7., 7., 0, 0, 0, 0, 0, 0, 0, 0])) # R = 1e6 * np.mat(np.diag([1., 1., 1., 1., 1., 1., 1.])) # self.A = A # self.B = B # self.Q = Q # self.R = R # self.F = feedback_controllers.LQRController.dlqr(A, B, Q, R) # def calc_assisted_BMI_state(self, current_state, target_state, assist_level, mode=None, **kwargs): # '''TODO.''' # diff = target_state - current_state # for i in range(2, 7): # diff[i] = angle_subtract(target_state[i], current_state[i]) # Bu = assist_level * self.B*self.F*diff # assist_weight = assist_level # return dict(Bu=Bu, assist_level=assist_weight) # # return Bu, assist_weight ###################################################################################################################### ##### Same LFCAssisters but with different values to use them in the go_to_start phase of the playbacktrajectories task ###################################################################################################################### class ArmAssistLFCAssisterGoToStart(FeedbackControllerAssist): ''' Assister for ArmAssist which uses an infinite-horizon LQR controller ''' def __init__(self, *args, **kwargs): ssm = StateSpaceArmAssist() A, B, _ = ssm.get_ssm_matrices() # R = 1e6 * np.mat(np.diag([1., 1., 1.])) # original values R = 1e6 * np.mat(np.diag([1., 1., 1.])) Q0 = np.mat(np.diag([10., 10., 10., 10, 10, 5, 0])) Q1 = np.mat(np.diag([30., 30., 30., 10, 10, 10, 0])) Q2 = np.mat(np.diag([50., 50., 40., 10, 10, 10, 0])) Q3 = np.mat(np.diag([70., 70., 50., 10.,10.,10., 0])) if kwargs['speed'] == 'very-low': # Q = np.mat(np.diag([30., 30., 30., 10, 10, 10, 0])) arm_assist_controller_go_to_start = LQRController_accel_limit_armassist(A, B, Q0, R) elif kwargs['speed'] == 'low': # Q = np.mat(np.diag([30., 30., 30., 10, 10, 10, 0])) arm_assist_controller_go_to_start = LQRController_accel_limit_armassist(A, B, Q1, R) elif kwargs['speed'] == 'medium': # Q = np.mat(np.diag([50., 50., 50., 10, 10, 10, 0])) arm_assist_controller_go_to_start = LQRController_accel_limit_armassist(A, B, Q2, R) elif kwargs['speed'] == 'high': # print "before Q", Q # Q = np.mat(np.diag([70., 70., 70., 10., 10.,10., 0])) arm_assist_controller_go_to_start = LQRController_accel_limit_armassist(A, B, Q3, R) super(ArmAssistLFCAssisterGoToStart, self).__init__(arm_assist_controller_go_to_start, style='mixing') class ReHandLFCAssisterGoToStart(FeedbackControllerAssist): def __init__(self, *args, **kwargs): ssm = StateSpaceReHand() A, B, _ = ssm.get_ssm_matrices() R = 1e6 * np.mat(np.diag([1., 1., 1., 1.])) Q0 = np.mat(np.diag([10., 10., 10.,10., 10, 10, 10, 10, 0])) Q1 = np.mat(np.diag([30., 30., 30.,30., 10, 10, 10, 10, 0])) Q2 = np.mat(np.diag([50., 50., 50.,50., 10, 10, 10, 10, 0])) Q3 = np.mat(np.diag([70., 70., 70.,70., 10.,10.,10.,10.,0])) if kwargs['speed'] == 'very-low': rehand_controller_go_to_start = LQRController_accel_limit_rehand(A, B, Q0, R) elif kwargs['speed'] == 'low': rehand_controller_go_to_start = LQRController_accel_limit_rehand(A, B, Q1, R) elif kwargs['speed'] == 'medium': rehand_controller_go_to_start = LQRController_accel_limit_rehand(A, B, Q2, R) elif kwargs['speed'] == 'high': rehand_controller_go_to_start = LQRController_accel_limit_rehand(A, B, Q3, R) super(ReHandLFCAssisterGoToStart, self).__init__(rehand_controller_go_to_start, style='mixing') class IsMoreLFCAssisterGoToStart(FeedbackControllerAssist): def __init__(self, *args, **kwargs): ssm = StateSpaceIsMore() A, B, _ = ssm.get_ssm_matrices() R = 1e6 * np.mat(np.diag([1., 1., 1., 1., 1., 1., 1.])) #original: 1e6 Q0 = np.mat(np.diag([10., 10., 10.,10., 10., 10.,10., 10, 10, 1, 10, 10, 10, 10, 0])) Q1 = np.mat(np.diag([30., 30., 30.,30., 30., 30.,30., 10, 10, 1, 10, 10, 10, 10, 0])) Q2 = np.mat(np.diag([50., 50., 40.,50., 50., 50.,50., 10, 10, 10, 10, 10, 10, 10, 0])) Q3 = np.mat(np.diag([70., 70., 50.,70., 70., 70.,70., 10.,10.,10.,10.,10.,10.,10.,0])) Q4 = np.mat(np.diag([100., 100., 100.,100., 100., 100.,100., 10.,10.,10.,10.,10.,10.,10.,0])) Q5 = np.mat(np.diag([150., 150., 150.,150., 150., 150.,150., 10.,10.,10.,10.,10.,10.,10.,0])) if kwargs['speed'] == 'very-low': ismore_controller_go_to_start = LQRController_accel_limit_ismore(A, B, Q0, R) if kwargs['speed'] == 'low': ismore_controller_go_to_start = LQRController_accel_limit_ismore(A, B, Q1, R) elif kwargs['speed'] == 'medium': ismore_controller_go_to_start = LQRController_accel_limit_ismore(A, B, Q2, R) elif kwargs['speed'] == 'high': ismore_controller_go_to_start = LQRController_accel_limit_ismore(A, B, Q3, R) elif kwargs['speed'] == 'very-high': ismore_controller_go_to_start = LQRController_accel_limit_ismore(A, B, Q4, R) elif kwargs['speed'] == 'super-high': ismore_controller_go_to_start = LQRController_accel_limit_ismore(A, B, Q5, R) super(IsMoreLFCAssisterGoToStart, self).__init__(ismore_controller_go_to_start, style='mixing') class IsMoreLFCAssister_diff_assist(FeedbackControllerAssist_StateSpecAssistLevels): def __init__(self, *args, **kwargs): ssm = StateSpaceIsMore() A, B, _ = ssm.get_ssm_matrices() R = 1e6 * np.mat(np.diag([1., 1., 1., 1., 1., 1., 1.])) #original: 1e6 Q0 = np.mat(np.diag([10., 10., 10.,10., 10., 10.,10., 10, 10, 1, 10, 10, 10, 10, 0])) Q1 = np.mat(np.diag([30., 30., 30.,30., 30., 30.,30., 10, 10, 1, 10, 10, 10, 10, 0])) Q2 = np.mat(np.diag([50., 50., 40.,50., 50., 50.,50., 10, 10, 10, 10, 10, 10, 10, 0])) Q3 = np.mat(np.diag([70., 70., 50.,70., 70., 70.,70., 10.,10.,10.,10.,10.,10.,10.,0])) Q4 = np.mat(np.diag([100., 100., 100.,100., 100., 100.,100., 10.,10.,10.,10.,10.,10.,10.,0])) Q5 = np.mat(np.diag([150., 150., 150.,150., 150., 150.,150., 10.,10.,10.,10.,10.,10.,10.,0])) if kwargs['speed'] == 'very-low': ismore_controller_go_to_start = LQRController_accel_limit_ismore(A, B, Q0, R) if kwargs['speed'] == 'low': ismore_controller_go_to_start = LQRController_accel_limit_ismore(A, B, Q1, R) elif kwargs['speed'] == 'medium': ismore_controller_go_to_start = LQRController_accel_limit_ismore(A, B, Q2, R) elif kwargs['speed'] == 'high': ismore_controller_go_to_start = LQRController_accel_limit_ismore(A, B, Q3, R) elif kwargs['speed'] == 'very-high': ismore_controller_go_to_start = LQRController_accel_limit_ismore(A, B, Q4, R) elif kwargs['speed'] == 'super-high': ismore_controller_go_to_start = LQRController_accel_limit_ismore(A, B, Q5, R) super(IsMoreLFCAssister_diff_assist, self).__init__(ismore_controller_go_to_start, style='mixing') class IsMoreLFCAssister_diff_assist_high_accel_hand(FeedbackControllerAssist_StateSpecAssistLevels): def __init__(self, *args, **kwargs): ssm = StateSpaceIsMore() A, B, _ = ssm.get_ssm_matrices() R = 1e6 * np.mat(np.diag([1., 1., 1., 1., 1., 1., 1.])) #original: 1e6 Q0 = np.mat(np.diag([10., 10., 10.,10., 10., 10.,10., 10, 10, 1, 10, 10, 10, 10, 0])) Q1 = np.mat(np.diag([30., 30., 30.,30., 30., 30.,30., 10, 10, 1, 10, 10, 10, 10, 0])) Q2 = np.mat(np.diag([50., 50., 40.,50., 50., 50.,50., 10, 10, 10, 10, 10, 10, 10, 0])) Q3 = np.mat(np.diag([70., 70., 50.,70., 70., 70.,70., 10.,10.,10.,10.,10.,10.,10.,0])) Q4 = np.mat(np.diag([100., 100., 100.,100., 100., 100.,100., 10.,10.,10.,10.,10.,10.,10.,0])) Q5 = np.mat(np.diag([150., 150., 150.,150., 150., 150.,150., 10.,10.,10.,10.,10.,10.,10.,0])) if kwargs['speed'] == 'very-low': ismore_controller_go_to_start = LQRController_accel_limit_only_base_ismore(A, B, Q0, R) if kwargs['speed'] == 'low': ismore_controller_go_to_start = LQRController_accel_limit_only_base_ismore(A, B, Q1, R) elif kwargs['speed'] == 'medium': ismore_controller_go_to_start = LQRController_accel_limit_only_base_ismore(A, B, Q2, R) elif kwargs['speed'] == 'high': ismore_controller_go_to_start = LQRController_accel_limit_only_base_ismore(A, B, Q3, R) elif kwargs['speed'] == 'very-high': ismore_controller_go_to_start = LQRController_accel_limit_only_base_ismore(A, B, Q4, R) elif kwargs['speed'] == 'super-high': ismore_controller_go_to_start = LQRController_accel_limit_only_base_ismore(A, B, Q5, R) super(IsMoreLFCAssister_diff_assist_high_accel_hand, self).__init__(ismore_controller_go_to_start, style='mixing') # class IsMoreLFCAssisterGoToStart(Assister): # ''' # Docstring # Parameters # ---------- # Returns # ------- # ''' # def __init__(self, *args, **kwargs): # ''' # Docstring # Parameters # ---------- # Returns # ------- # ''' # ssm = StateSpaceIsMore() # A, B, _ = ssm.get_ssm_matrices() # self.prev_assister_output = np.nan # self.accel_lim_armassist = 100#.9 # self.accel_lim_rehand = 10#.02 # #Q = np.mat(np.diag([7., 7., 7., 7., 7., 7., 7., 0, 0, 0, 0, 0, 0, 0, 0])) #original values # Q = np.mat(np.diag([15., 15., 15.,15., 15., 15.,15., 5, 5, 5, 5, 5, 5, 5, 0])) # R = 1e6 * np.mat(np.diag([1., 1., 1., 1., 1., 1., 1.])) # #nerea # # Q = np.mat(np.diag([5., 5., 5.,5., 5., 5.,5., 0, 0, 0, 0, 0, 0, 0, 0])) # # R = 1e6 * np.mat(np.diag([1., 1., 1., 1., 1., 1., 1.])) # self.A = A # self.B = B # self.Q = Q # self.R = R # self.F = feedback_controllers.LQRController.dlqr(A, B, Q, R) # def calc_assisted_BMI_state(self, current_state, target_state, assist_level, mode=None, **kwargs): # '''TODO.''' # diff = target_state - current_state # for i in range(2, 7): # diff[i] = angle_subtract(target_state[i], current_state[i]) # Bu = assist_level * self.B*self.F*diff # # limit acceleration # if np.sum(Bu[8:16]) != 0: # if np.any(np.isnan(self.prev_assister_output)): # self.prev_assister_output = np.zeros_like(Bu) # assister_output_accel = Bu - self.prev_assister_output # #print 'dBU output', np.squeeze(assister_output_accel) # for i in np.arange(7,10): # if assister_output_accel[i, 0] > self.accel_lim_armassist: # Bu[i, 0] = self.prev_assister_output[i, 0] + self.accel_lim_armassist # elif assister_output_accel[i, 0] < -1*self.accel_lim_armassist: # Bu[i, 0] = self.prev_assister_output[i, 0] - self.accel_lim_armassist # for i in np.arange(10,14): # if assister_output_accel[i, 0] > self.accel_lim_rehand: # Bu[i, 0] = self.prev_assister_output[i, 0] + self.accel_lim_rehand # elif assister_output_accel[i, 0] < -1*self.accel_lim_rehand: # Bu[i, 0] = self.prev_assister_output[i, 0] - self.accel_lim_rehand # print 'Bu', Bu # self.prev_assister_output = Bu # assist_weight = assist_level # return dict(x_assist=Bu, assist_level=assist_weight) # # return Bu, assist_weight ################### ## iBMI learners ## ################### # simple iBMI learners that just use an "assister" object class ArmAssistLearner(Learner): ''' Docstring Parameters ---------- Returns ------- ''' def __init__(self, *args, **kwargs): ''' Docstring Parameters ---------- Returns ------- ''' decoder_binlen = kwargs.pop('decoder_binlen', 0.1) assist_speed = kwargs.pop('assist_speed', 2.) target_radius = kwargs.pop('target_radius', 2.) assister_kwargs = dict(decoder_binlen=decoder_binlen, target_radius=target_radius, assist_speed=assist_speed) self.assister = assist.ArmAssistAssister(**assister_kwargs) super(ArmAssistLearner, self).__init__(*args, **kwargs) self.input_state_index = -1 def calc_int_kin(self, decoder_state, target_state, decoder_output, task_state, state_order=None): """Calculate/estimate the intended ArmAssist kinematics.""" current_state = decoder_state[:, None] # assister expects shape to be (7, 1) target_state = target_state[:, None] # assister expects shape to be (7, 1) intended_state = self.assister(current_state, target_state, 1)[0] return intended_state def __call__(self, neural_features, decoder_state, target_state, decoder_output, task_state, state_order=None): '''Calculate the intended kinematics and pair with the neural data.''' super(ArmAssistLearner, self).__call__(neural_features, decoder_state, target_state, decoder_output, task_state, state_order=state_order) class ReHandLearner(Learner): ''' Docstring Parameters ---------- Returns ------- ''' def __init__(self, *args, **kwargs): ''' Docstring Parameters ---------- Returns ------- ''' decoder_binlen = kwargs.pop('decoder_binlen', 0.1) assist_speed = kwargs.pop('assist_speed', 2.) target_radius = kwargs.pop('target_radius', 2.) assister_kwargs = dict(decoder_binlen=decoder_binlen, target_radius=target_radius, assist_speed=assist_speed) self.assister = assist.ReHandAssister(**assister_kwargs) super(ReHandLearner, self).__init__(*args, **kwargs) self.input_state_index = -1 def calc_int_kin(self, decoder_state, target_state, decoder_output, task_state, state_order=None): """Calculate/estimate the intended ReHand kinematics.""" current_state = decoder_state[:, None] # assister expects shape to be (9, 1) target_state = target_state[:, None] # assister expects shape to be (9, 1) intended_state = self.assister(current_state, target_state, 1)[0] return intended_state def __call__(self, neural_features, decoder_state, target_state, decoder_output, task_state, state_order=None): '''Calculate the intended kinematics and pair with the neural data.''' super(ReHandLearner, self).__call__(neural_features, decoder_state, target_state, decoder_output, task_state, state_order=state_order) class IsMoreLearner(Learner): ''' Docstring Parameters ---------- Returns ------- ''' def __init__(self, *args, **kwargs): ''' Docstring Parameters ---------- Returns ------- ''' decoder_binlen = kwargs.pop('decoder_binlen', 0.1) assist_speed = kwargs.pop('assist_speed', 2.) target_radius = kwargs.pop('target_radius', 2.) assister_kwargs = dict(decoder_binlen=decoder_binlen, target_radius=target_radius, assist_speed=assist_speed) self.assister = assist.IsMoreAssister(**assister_kwargs) super(IsMoreLearner, self).__init__(*args, **kwargs) self.input_state_index = -1 def calc_int_kin(self, decoder_state, target_state, decoder_output, task_state, state_order=None): """Calculate/estimate the intended ArmAssist+ReHand kinematics.""" current_state = decoder_state[:, None] # assister expects shape to be (15, 1) target_state = target_state[:, None] # assister expects shape to be (15, 1) intended_state = self.assister(current_state, target_state, 1)[0] return intended_state def __call__(self, neural_features, decoder_state, target_state, decoder_output, task_state, state_order=None): '''Calculate the intended kinematics and pair with the neural data.''' super(IsMoreLearner, self).__call__(neural_features, decoder_state, target_state, decoder_output, task_state, state_order=state_order) ######################################## # Define some dictionaries below so that we don't have to always write: # if self.plant_type == 'ArmAssist': # ... # elif self.plant_type == 'ReHand': # ... SSM_CLS_DICT = { 'ArmAssist': StateSpaceArmAssist, 'ReHand': StateSpaceReHand, 'IsMore': StateSpaceIsMore, 'DummyPlant': StateSpaceDummy, 'IsMoreEMGControl': StateSpaceIsMore, 'IsMoreHybridControl': StateSpaceIsMore, 'IsMorePlantHybridBMISoftSafety': StateSpaceIsMore, } ASSISTER_CLS_DICT = { 'ArmAssist': ArmAssistAssister, 'ReHand': ReHandAssister, 'IsMore': IsMoreAssister, } LFC_ASSISTER_CLS_DICT = { 'ArmAssist': ArmAssistLFCAssister, 'ReHand': ReHandLFCAssister, 'IsMore': IsMoreLFCAssister, } LFC_GO_TO_START_ASSISTER_CLS_DICT_OG = { 'ArmAssist': ArmAssistLFCAssisterGoToStart, 'ReHand': ReHandLFCAssisterGoToStart, 'IsMore': IsMoreLFCAssisterGoToStart, 'IsMoreHybridControl': IsMoreLFCAssisterGoToStart, 'IsMoreEMGControl': IsMoreLFCAssisterGoToStart, 'IsMorePlantHybridBMISoftSafety': IsMoreLFCAssisterGoToStart, } LFC_GO_TO_START_ASSISTER_CLS_DICT = { 'IsMore': IsMoreLFCAssister_diff_assist, 'IsMoreHybridControl': IsMoreLFCAssister_diff_assist, 'IsMorePlantHybridBMISoftSafety': IsMoreLFCAssister_diff_assist_high_accel_hand, } # GOAL_CALCULATOR_CLS_DICT = { # 'ArmAssist': ArmAssistControlGoal, # 'ReHand': ReHandControlGoal, # 'IsMore': IsMoreControlGoal, # } LEARNER_CLS_DICT = { 'ArmAssist': ArmAssistLearner, 'ReHand': ReHandLearner, 'IsMore': IsMoreLearner, } OFC_LEARNER_CLS_DICT = { 'ArmAssist': ArmAssistOFCLearner, 'ReHand': ReHandOFCLearner, 'IsMore': IsMoreOFCLearner, } OFC_LEARNER_CLS_DICT_w_REST = { 'IsMore': IsMoreOFCLearning_w_Rest, 'IsMoreHybridControl': IsMoreOFCLearning_w_Rest } ORTHO_DAMP_ASSIST_CLS_DICT = { 'ArmAssist': ArmAssistLFCOrthoDampAssister, 'ReHand': ReHandLFCOrthoDampAssister, #'IsMore': IsMoreLFCOrthoDampAssister, 'IsMore': IsMoreLFCOrthoDamp_diff_assist, }
41.142525
145
0.591754
6,988
53,115
4.226388
0.060675
0.026952
0.030067
0.027358
0.779779
0.742297
0.709995
0.690018
0.668552
0.64722
0
0.046647
0.252113
53,115
1,290
146
41.174419
0.696833
0.201902
0
0.501543
0
0
0.033696
0.002347
0
0
0
0.00155
0
0
null
null
0.012346
0.020062
null
null
0.006173
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
16b88bd0e3151002d508f0086e766d996a11eac0
125
py
Python
WebScrapingWithPython/SomeCode/Wiki.py
broccolii/LearnPython
fd48062d065d5475f5197836942b87db976f1de8
[ "MIT" ]
null
null
null
WebScrapingWithPython/SomeCode/Wiki.py
broccolii/LearnPython
fd48062d065d5475f5197836942b87db976f1de8
[ "MIT" ]
null
null
null
WebScrapingWithPython/SomeCode/Wiki.py
broccolii/LearnPython
fd48062d065d5475f5197836942b87db976f1de8
[ "MIT" ]
null
null
null
from urllib.request import urlopen from bs4 import BeautifulSoup html = urlopen("http://en.wikipedia.org/wiki/kevin_bacon")
25
58
0.8
18
125
5.5
0.833333
0
0
0
0
0
0
0
0
0
0
0.00885
0.096
125
4
59
31.25
0.867257
0
0
0
0
0
0.32
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
bc41679ce17c43ca6334413d5f67f9a25fb22b80
282
py
Python
neurolab/data/__init__.py
udday2014/HebbianLearning
e0d17e53e3db8ce54b8fdd901702d2d6e0633732
[ "MIT" ]
6
2020-01-08T05:36:09.000Z
2022-02-09T21:07:04.000Z
neurolab/data/__init__.py
GabrieleLagani/HebbianPCA
2736bb3017fa30ad2c160c891d42361bc5894df5
[ "MIT" ]
null
null
null
neurolab/data/__init__.py
GabrieleLagani/HebbianPCA
2736bb3017fa30ad2c160c891d42361bc5894df5
[ "MIT" ]
2
2022-03-04T08:28:44.000Z
2022-03-16T19:00:34.000Z
from .data import * from .custaugm import * from .mnist import * from .smallnorb import * from .eth80 import * from .stl10 import * from .cifar10 import * from .cifar100 import * from .tinyimagenet import * from .caltech101 import * from .caltech256 import * from .imagenet import *
23.5
27
0.748227
36
282
5.861111
0.388889
0.521327
0
0
0
0
0
0
0
0
0
0.06383
0.166667
282
12
28
23.5
0.834043
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
bc4552cebcdad390ad26e38d1cac9fdb99e9fb21
8,995
py
Python
sdk/python/pulumi_azure_native/apimanagement/v20170301/__init__.py
pulumi-bot/pulumi-azure-native
f7b9490b5211544318e455e5cceafe47b628e12c
[ "Apache-2.0" ]
null
null
null
sdk/python/pulumi_azure_native/apimanagement/v20170301/__init__.py
pulumi-bot/pulumi-azure-native
f7b9490b5211544318e455e5cceafe47b628e12c
[ "Apache-2.0" ]
null
null
null
sdk/python/pulumi_azure_native/apimanagement/v20170301/__init__.py
pulumi-bot/pulumi-azure-native
f7b9490b5211544318e455e5cceafe47b628e12c
[ "Apache-2.0" ]
null
null
null
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** # Export this package's modules as members: from ._enums import * from .api import * from .api_diagnostic import * from .api_diagnostic_logger import * from .api_issue import * from .api_issue_attachment import * from .api_issue_comment import * from .api_management_service import * from .api_operation import * from .api_operation_policy import * from .api_policy import * from .api_release import * from .api_schema import * from .api_version_set import * from .authorization_server import * from .backend import * from .certificate import * from .diagnostic import * from .diagnostic_logger import * from .email_template import * from .get_api import * from .get_api_diagnostic import * from .get_api_issue import * from .get_api_issue_attachment import * from .get_api_issue_comment import * from .get_api_management_service import * from .get_api_management_service_sso_token import * from .get_api_operation import * from .get_api_operation_policy import * from .get_api_policy import * from .get_api_release import * from .get_api_schema import * from .get_api_version_set import * from .get_authorization_server import * from .get_backend import * from .get_certificate import * from .get_diagnostic import * from .get_email_template import * from .get_group import * from .get_identity_provider import * from .get_logger import * from .get_open_id_connect_provider import * from .get_policy import * from .get_product import * from .get_product_policy import * from .get_property import * from .get_subscription import * from .get_tag import * from .get_tag_by_api import * from .get_tag_by_operation import * from .get_tag_by_product import * from .get_tag_description import * from .get_user import * from .group import * from .group_user import * from .identity_provider import * from .logger import * from .notification_recipient_email import * from .notification_recipient_user import * from .open_id_connect_provider import * from .policy import * from .product import * from .product_api import * from .product_group import * from .product_policy import * from .property import * from .subscription import * from .tag import * from .tag_by_api import * from .tag_by_operation import * from .tag_by_product import * from .tag_description import * from .user import * from ._inputs import * from . import outputs def _register_module(): import pulumi from ... import _utilities class Module(pulumi.runtime.ResourceModule): _version = _utilities.get_semver_version() def version(self): return Module._version def construct(self, name: str, typ: str, urn: str) -> pulumi.Resource: if typ == "azure-native:apimanagement/v20170301:Api": return Api(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:ApiDiagnostic": return ApiDiagnostic(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:ApiDiagnosticLogger": return ApiDiagnosticLogger(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:ApiIssue": return ApiIssue(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:ApiIssueAttachment": return ApiIssueAttachment(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:ApiIssueComment": return ApiIssueComment(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:ApiManagementService": return ApiManagementService(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:ApiOperation": return ApiOperation(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:ApiOperationPolicy": return ApiOperationPolicy(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:ApiPolicy": return ApiPolicy(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:ApiRelease": return ApiRelease(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:ApiSchema": return ApiSchema(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:ApiVersionSet": return ApiVersionSet(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:AuthorizationServer": return AuthorizationServer(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:Backend": return Backend(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:Certificate": return Certificate(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:Diagnostic": return Diagnostic(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:DiagnosticLogger": return DiagnosticLogger(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:EmailTemplate": return EmailTemplate(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:Group": return Group(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:GroupUser": return GroupUser(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:IdentityProvider": return IdentityProvider(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:Logger": return Logger(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:NotificationRecipientEmail": return NotificationRecipientEmail(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:NotificationRecipientUser": return NotificationRecipientUser(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:OpenIdConnectProvider": return OpenIdConnectProvider(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:Policy": return Policy(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:Product": return Product(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:ProductApi": return ProductApi(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:ProductGroup": return ProductGroup(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:ProductPolicy": return ProductPolicy(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:Property": return Property(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:Subscription": return Subscription(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:Tag": return Tag(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:TagByApi": return TagByApi(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:TagByOperation": return TagByOperation(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:TagByProduct": return TagByProduct(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:TagDescription": return TagDescription(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-native:apimanagement/v20170301:User": return User(name, pulumi.ResourceOptions(urn=urn)) else: raise Exception(f"unknown resource type {typ}") _module_instance = Module() pulumi.runtime.register_resource_module("azure-native", "apimanagement/v20170301", _module_instance) _register_module()
49.972222
104
0.701056
972
8,995
6.359054
0.133745
0.119722
0.155315
0.213558
0.553794
0.457208
0.436499
0.436499
0.436499
0.436499
0
0.044845
0.204225
8,995
179
105
50.251397
0.818664
0.022568
0
0
1
0
0.225219
0.220781
0
0
0
0
0
1
0.018072
false
0
0.463855
0.006024
0.73494
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
1
0
1
0
0
4
bc517ab5b846e6136072448bb655177e1efa57fc
86
py
Python
DEV-CONN/DC_project/DC_app/apps.py
stali1234/dev-conn
55c0ada5b44902c092ffa4250d5561d8b5f3dd11
[ "Apache-2.0" ]
2
2020-10-08T05:44:30.000Z
2021-01-02T02:41:13.000Z
DEV-CONN/DC_project/DC_app/apps.py
rayansailani/DEV-CONN
9ee97ee7c2e7bcb5651ffa7c94b85b16532b19a5
[ "Apache-2.0" ]
5
2021-03-19T02:01:15.000Z
2022-03-12T00:24:05.000Z
DEV-CONN/DC_project/DC_app/apps.py
rayansailani/DEV-CONN
9ee97ee7c2e7bcb5651ffa7c94b85b16532b19a5
[ "Apache-2.0" ]
3
2020-07-27T16:44:41.000Z
2020-09-03T15:26:22.000Z
from django.apps import AppConfig class DcAppConfig(AppConfig): name = 'DC_app'
14.333333
33
0.744186
11
86
5.727273
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.174419
86
5
34
17.2
0.887324
0
0
0
0
0
0.069767
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
bc702a15df9e69fbf5c71a796bacdf33181a0c2e
1,206
py
Python
user.py
Sundaybrian/python-pass-locker
62c52a17ff1bbe97cd453fbf38b93ff17f02ed6d
[ "MIT" ]
null
null
null
user.py
Sundaybrian/python-pass-locker
62c52a17ff1bbe97cd453fbf38b93ff17f02ed6d
[ "MIT" ]
null
null
null
user.py
Sundaybrian/python-pass-locker
62c52a17ff1bbe97cd453fbf38b93ff17f02ed6d
[ "MIT" ]
null
null
null
class User: ''' Class that generates a new instance of a passlocker user __init__method that helps us to define properties for our objects Args: name:New user name password:New user password ''' user_list=[] def __init__(self,name,password): self.name=name self.password=password def save_user(self): ''' save user method that saves user obj into user list ''' User.user_list.append(self) @classmethod def display_users(cls): ''' Method that returns users using the password locker app ''' return cls.user_list @classmethod def user_verified(cls,name,password): ''' Method that takes a user login info & returns a boolean true if the details are correct Args: name:User name to search password:password to match Return: Boolean true if they both match to a user & false if it doesn't ''' for user in cls.user_list: if user.name==name and user.password==password: return True return False
21.157895
96
0.572139
148
1,206
4.560811
0.405405
0.059259
0.032593
0
0
0
0
0
0
0
0
0
0.366501
1,206
56
97
21.535714
0.883508
0.435323
0
0.125
1
0
0
0
0
0
0
0
0
1
0.25
false
0.25
0
0
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
1
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
4
bc71a7bfdcf617047e464095fa4065f3696b996c
60
py
Python
execicios/ex047/Tparaes.py
Israel97f/Exercicios-de-Python
5d3054187977deeb3fadbd7bb1cdee035c609a61
[ "MIT" ]
null
null
null
execicios/ex047/Tparaes.py
Israel97f/Exercicios-de-Python
5d3054187977deeb3fadbd7bb1cdee035c609a61
[ "MIT" ]
null
null
null
execicios/ex047/Tparaes.py
Israel97f/Exercicios-de-Python
5d3054187977deeb3fadbd7bb1cdee035c609a61
[ "MIT" ]
null
null
null
for c in range(2, 50, 2): print('\033[36m{}'.format(c))
20
33
0.55
12
60
2.75
0.833333
0
0
0
0
0
0
0
0
0
0
0.183673
0.183333
60
2
34
30
0.489796
0
0
0
0
0
0.166667
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
4
bc807a7b4a85abe6e70fd0d228a90dc018aa7635
495
py
Python
MADDPG/maddpg-master/maddpg/__init__.py
lqy0057/MADDPG-Congestion-Control-Based-on-OMNET-
495f817b3e7342a66315848a0a50acb569dba863
[ "MIT" ]
3
2020-07-11T14:44:28.000Z
2020-08-27T03:35:00.000Z
MADDPG/maddpg-master/maddpg/__init__.py
QuanyiLi/MADDPG-Congestion-Control-Based-on-OMNETPP
495f817b3e7342a66315848a0a50acb569dba863
[ "MIT" ]
null
null
null
MADDPG/maddpg-master/maddpg/__init__.py
QuanyiLi/MADDPG-Congestion-Control-Based-on-OMNETPP
495f817b3e7342a66315848a0a50acb569dba863
[ "MIT" ]
null
null
null
class AgentTrainer(object):#作为MADDPGtrainer的父类,以下函数在子类中被重构 def __init__(self, name, model, obs_shape, act_space, args): raise NotImplemented() def action(self, obs): raise NotImplemented()#如果这个方法行不通就找别的方法来完成https://www.jianshu.com/p/a8613baefa30 def process_experience(self, obs, act, rew, new_obs, done, terminal): raise NotImplemented() def preupdate(self): raise NotImplemented() def update(self, agents): raise NotImplemented()
33
87
0.69899
53
495
6.377358
0.622642
0.281065
0.195266
0
0
0
0
0
0
0
0
0.015113
0.19798
495
15
88
33
0.836272
0.173737
0
0.454545
0
0
0
0
0
0
0
0
0
1
0.454545
false
0
0
0
0.545455
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
bc8427c20aead97423ed8cfaf63fa56bb0af2671
67
py
Python
VacationPy/api_keys.py
supraja2710/python-api-challenge
2fc1dd541f8516c16b1f61e385ca74223893556a
[ "ADSL" ]
null
null
null
VacationPy/api_keys.py
supraja2710/python-api-challenge
2fc1dd541f8516c16b1f61e385ca74223893556a
[ "ADSL" ]
null
null
null
VacationPy/api_keys.py
supraja2710/python-api-challenge
2fc1dd541f8516c16b1f61e385ca74223893556a
[ "ADSL" ]
null
null
null
# Google API Key g_key = "AIzaSyAJC6CU7i-v4drBB3zR630wB6FgxucUFf8"
22.333333
49
0.820896
7
67
7.714286
0.857143
0
0
0
0
0
0
0
0
0
0
0.15
0.104478
67
2
50
33.5
0.75
0.208955
0
0
0
0
0.764706
0.764706
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
bc8e0ed94d6e8e7485a7c4db7ef6cd101fd0c3a0
132
py
Python
Easy/461. Hamming Distance/solution (3).py
czs108/LeetCode-Solutions
889f5b6a573769ad077a6283c058ed925d52c9ec
[ "MIT" ]
3
2020-05-09T12:55:09.000Z
2022-03-11T18:56:05.000Z
Easy/461. Hamming Distance/solution (3).py
czs108/LeetCode-Solutions
889f5b6a573769ad077a6283c058ed925d52c9ec
[ "MIT" ]
null
null
null
Easy/461. Hamming Distance/solution (3).py
czs108/LeetCode-Solutions
889f5b6a573769ad077a6283c058ed925d52c9ec
[ "MIT" ]
1
2022-03-11T18:56:16.000Z
2022-03-11T18:56:16.000Z
# 461. Hamming Distance class Solution: def hammingDistance(self, x: int, y: int) -> int: return bin(x ^ y).count('1')
22
53
0.613636
19
132
4.263158
0.789474
0
0
0
0
0
0
0
0
0
0
0.039604
0.234848
132
6
54
22
0.762376
0.159091
0
0
0
0
0.009091
0
0
0
0
0
0
1
0.333333
false
0
0
0.333333
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
4
bc93d094534321665a4f11464278c77f0d9d1b52
81
py
Python
webapp/dog_breed_app.py
abdullahtarek/dog_breed_webapp
1c64a0c45bb8e2d993255bd98144e96b5163fde1
[ "MIT" ]
null
null
null
webapp/dog_breed_app.py
abdullahtarek/dog_breed_webapp
1c64a0c45bb8e2d993255bd98144e96b5163fde1
[ "MIT" ]
10
2020-09-26T00:58:17.000Z
2022-03-12T00:25:13.000Z
webapp/dog_breed_app.py
abdullahtarek/dog_breed_webapp
1c64a0c45bb8e2d993255bd98144e96b5163fde1
[ "MIT" ]
null
null
null
from dog_breed_web_app import app app.run(host='0.0.0.0', port=6006, debug=True)
27
46
0.753086
18
81
3.222222
0.722222
0.103448
0.103448
0
0
0
0
0
0
0
0
0.108108
0.08642
81
2
47
40.5
0.675676
0
0
0
0
0
0.08642
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
bcad16f68022b6e30f70455f9d812f7d1838bc13
126
py
Python
python/testData/quickFixes/PyRenameElementQuickFixTest/renameAwaitClassInPy36.py
aviator737x/intellij-community
12beb125a6931dd204262eca358be63510af0476
[ "Apache-2.0" ]
null
null
null
python/testData/quickFixes/PyRenameElementQuickFixTest/renameAwaitClassInPy36.py
aviator737x/intellij-community
12beb125a6931dd204262eca358be63510af0476
[ "Apache-2.0" ]
null
null
null
python/testData/quickFixes/PyRenameElementQuickFixTest/renameAwaitClassInPy36.py
aviator737x/intellij-community
12beb125a6931dd204262eca358be63510af0476
[ "Apache-2.0" ]
null
null
null
class <warning descr="Python version 3.7 does not allow 'async' and 'await' as names">a<caret>wait</warning>(object): pass
63
117
0.722222
21
126
4.333333
0.952381
0
0
0
0
0
0
0
0
0
0
0.018349
0.134921
126
2
118
63
0.816514
0
0
0
0
0
0.488189
0
0
0
0
0
0
0
null
null
0.5
0
null
null
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
1
0
0
1
0
0
0
0
0
4
4c2da3b8fe105f07ffe28c98e0ebcb2b37c60149
1,030
py
Python
src/Solution_class.py
themihabyte/operations_research_course_work
88cb3455775e4720fc5071c20ad1a115b510555e
[ "MIT" ]
null
null
null
src/Solution_class.py
themihabyte/operations_research_course_work
88cb3455775e4720fc5071c20ad1a115b510555e
[ "MIT" ]
null
null
null
src/Solution_class.py
themihabyte/operations_research_course_work
88cb3455775e4720fc5071c20ad1a115b510555e
[ "MIT" ]
null
null
null
class Solution: labs = [] def __init__(self, T): self.z = 0 self.x = [] for i in range(T): self.x.append(0) def calculate_z(self): if len(self.labs) == 0: return 0 self.z = 0 for i in range(len(self.labs)): for j in range(self.x[i]+1): self.z += self.labs[i].P[j] def __str__(self): return "Z = {:.3f}, x = {}".format(self.z, self.x) def __eq__(self, value): if isinstance(value, Solution): if len(self.x) != len(value.x): return False for i in range(len(self.x)): if self.x[i] != value.x[i]: return False return True return NotImplemented def __lt__(self, value): return self.z < value.z def __le__(self, value): return self.z <= value.z def __gt__(self, value): return self.z > value.z def __ge__(self, value): return self.z >= value.z
24.52381
58
0.482524
142
1,030
3.295775
0.246479
0.08547
0.128205
0.162393
0.318376
0.318376
0.241453
0.185897
0
0
0
0.011058
0.385437
1,030
42
59
24.52381
0.728278
0
0
0.121212
0
0
0.017459
0
0
0
0
0
0
1
0.242424
false
0
0
0.151515
0.606061
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
4c73aa9b59b60445be1a0a7301a6e906f9eb5b38
484
py
Python
static_province.py
byscut/azrael-py27
76eaa29556a9f58e7425e5c0fefeddb5332a923e
[ "WTFPL" ]
null
null
null
static_province.py
byscut/azrael-py27
76eaa29556a9f58e7425e5c0fefeddb5332a923e
[ "WTFPL" ]
null
null
null
static_province.py
byscut/azrael-py27
76eaa29556a9f58e7425e5c0fefeddb5332a923e
[ "WTFPL" ]
null
null
null
# -*- coding: utf-8 -*- # @Time : 2017/11/23 上午10:01 # @Author : Azrael.Bai # @File : static_province.py province_dict={} with open('/Users/haizhi/province.data') as f: for line in f.readlines(): province = line.strip().replace('省','') if province_dict.has_key(province): province_dict[province] = province_dict[province] + 1 else: province_dict[province] = 1 for key, value in province_dict.items(): print key, value
26.888889
65
0.615702
64
484
4.53125
0.609375
0.248276
0.206897
0.193103
0
0
0
0
0
0
0
0.04065
0.237603
484
17
66
28.470588
0.745257
0.21281
0
0
0
0
0.074468
0.071809
0
0
0
0
0
0
null
null
0
0
null
null
0.1
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
4c77e6a9df20d1e1e2cfe8d7405bd6fe92dba1af
1,641
py
Python
daskperiment/backend/redis.py
takumiohym/daskperiment
292752f29a9f77b948b2a5050122109b8f4fe148
[ "BSD-3-Clause" ]
null
null
null
daskperiment/backend/redis.py
takumiohym/daskperiment
292752f29a9f77b948b2a5050122109b8f4fe148
[ "BSD-3-Clause" ]
null
null
null
daskperiment/backend/redis.py
takumiohym/daskperiment
292752f29a9f77b948b2a5050122109b8f4fe148
[ "BSD-3-Clause" ]
1
2021-03-24T07:32:20.000Z
2021-03-24T07:32:20.000Z
from daskperiment.backend.base import _NoSQLBackend from daskperiment.util.log import get_logger logger = get_logger(__name__) class RedisBackend(_NoSQLBackend): _SEP = ':' def __init__(self, experiment_id, uri): super().__init__(experiment_id) import redis if isinstance(uri, redis.ConnectionPool): self._pool = uri # TODO: properly build uri from ConnectionPool # distinguish protocol from Pool uri = 'redis://{host}:{port}/{db}'.format(**uri.connection_kwargs) self.uri = uri @property def pool(self): if not hasattr(self, '_pool'): import redis self._pool = redis.ConnectionPool.from_url(self.uri) return self._pool @property def client(self): if not hasattr(self, '_client'): import redis self._client = redis.StrictRedis(connection_pool=self.pool, charset="utf-8", decode_responses=True) return self._client def set(self, key, value): return self.client.set(key, value) def get(self, key): return self.client.get(key) def keys(self, key): keys = self.client.keys(key) return [key.decode('utf-8') for key in keys] def append_list(self, key, value): return self.client.rpush(key, value) def get_list(self, key): return self.client.lrange(key, 0, -1) def increment(self, key): return self.client.incr(key) def _delete_cache(self): self.client.flushdb()
26.047619
78
0.586837
191
1,641
4.863874
0.350785
0.107643
0.103337
0.054898
0.17761
0.06028
0
0
0
0
0
0.00353
0.309567
1,641
62
79
26.467742
0.816417
0.045704
0
0.121951
0
0
0.03135
0.016635
0
0
0
0.016129
0
1
0.243902
false
0
0.121951
0.121951
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
1
0
0
0
1
1
0
0
4
d5d36d225572c57c79fe0cdb5edf50f0d8965944
1,414
py
Python
tuplex/python/tuplex/utils/framework.py
rahulyesantharao/tuplex
03733a57ccb5a3770eecaf1c3adcfb520ed82138
[ "Apache-2.0" ]
778
2021-06-30T03:40:43.000Z
2022-03-28T20:40:20.000Z
tuplex/python/tuplex/utils/framework.py
rahulyesantharao/tuplex
03733a57ccb5a3770eecaf1c3adcfb520ed82138
[ "Apache-2.0" ]
41
2021-07-05T17:55:56.000Z
2022-03-31T15:27:19.000Z
tuplex/python/tuplex/utils/framework.py
rahulyesantharao/tuplex
03733a57ccb5a3770eecaf1c3adcfb520ed82138
[ "Apache-2.0" ]
39
2021-07-01T02:40:33.000Z
2022-03-30T21:46:55.000Z
#!/usr/bin/env python3 #----------------------------------------------------------------------------------------------------------------------# # # # Tuplex: Blazing Fast Python Data Science # # # # # # (c) 2017 - 2021, Tuplex team # # Created by Leonhard Spiegelberg first on 8/3/2021 # # License: Apache 2.0 # #----------------------------------------------------------------------------------------------------------------------# # this file contains Framework specific exceptions class TuplexException(Exception): """Base Exception class on which all Tuplex Framework specific exceptions are based""" pass class UDFCodeExtractionError(TuplexException): """thrown when UDF code extraction/reflection failed""" pass
74.421053
120
0.25389
61
1,414
5.885246
0.803279
0.094708
0.150418
0
0
0
0
0
0
0
0
0.026275
0.542433
1,414
19
121
74.421053
0.528594
0.893211
0
0.5
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
4
d5defc6018511349fcfd86809da6aa5192b0d2e1
1,763
py
Python
question.py
SunzeY/AutoTest_UI
cfa63e6e68b29af4d63808a3416f9d8da993a7a1
[ "MIT" ]
null
null
null
question.py
SunzeY/AutoTest_UI
cfa63e6e68b29af4d63808a3416f9d8da993a7a1
[ "MIT" ]
null
null
null
question.py
SunzeY/AutoTest_UI
cfa63e6e68b29af4d63808a3416f9d8da993a7a1
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- # @Time : 2021-07-31 19:34 # @Author : Ze Yi Sun # @Site : BUAA # @File : question.py # @Software: PyCharm class Question(object): def __init__(self, statement: str): self.statement = statement def show(self): return "None" def check_correctness(self, answer: str) -> bool: return True class ChoiceQuestion(Question): def __init__(self, statement: str, correct_answer: set): super().__init__(statement) self.correct_answer = correct_answer def show(self): return self.statement def check_correctness(self, answer: set) -> bool: if answer == self.correct_answer: return True else: return False def answer(self): return self.correct_answer class JudgmentQuestion(Question): def __init__(self, statement: str, correct_answer: str): super().__init__(statement) self.correct_answer = correct_answer def show(self): return self.statement def check_correctness(self, answer: str) -> bool: if answer == self.correct_answer: return True else: return False def answer(self): if self.correct_answer == "n": return "False" else: return "True" class ShortAnswerQuestion(Question): def __init__(self, statement: str, standard_answer: str): super().__init__(statement) self.correct_answer = standard_answer def show(self): return self.statement def check_correctness(self, answer: str) -> bool: if answer == self.correct_answer: return True else: return False def answer(self): return self.correct_answer
24.150685
61
0.614294
198
1,763
5.232323
0.232323
0.163127
0.147683
0.07722
0.730695
0.708494
0.678571
0.643822
0.513514
0.513514
0
0.010367
0.288712
1,763
72
62
24.486111
0.815789
0.066931
0
0.693878
0
0
0.008547
0
0
0
0
0
0
1
0.306122
false
0
0
0.142857
0.693878
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
d5f05c43fea0d065e32eba6b8cc15742ef5e287b
134
py
Python
ratings/forms.py
dimalik/reading_group
5324468c7d31a648654fab820e283d13a76d1b93
[ "MIT" ]
null
null
null
ratings/forms.py
dimalik/reading_group
5324468c7d31a648654fab820e283d13a76d1b93
[ "MIT" ]
null
null
null
ratings/forms.py
dimalik/reading_group
5324468c7d31a648654fab820e283d13a76d1b93
[ "MIT" ]
null
null
null
from django import forms from ratings.models import Rating class RatingForm(forms.ModelForm): class Meta: model = Rating
19.142857
34
0.738806
17
134
5.823529
0.705882
0
0
0
0
0
0
0
0
0
0
0
0.208955
134
7
35
19.142857
0.933962
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.4
0
0.8
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
d5f0e575408911d69b55fbfa2378db0a60670231
302
py
Python
models/user_models.py
htrismicristo/finanzapp_api
3d3ed061256c1908664f3d20dd8fe67bd765e9a1
[ "MIT" ]
null
null
null
models/user_models.py
htrismicristo/finanzapp_api
3d3ed061256c1908664f3d20dd8fe67bd765e9a1
[ "MIT" ]
null
null
null
models/user_models.py
htrismicristo/finanzapp_api
3d3ed061256c1908664f3d20dd8fe67bd765e9a1
[ "MIT" ]
null
null
null
from pydantic import BaseModel class UserIn(BaseModel): username: str password: str budget = 0 # class UserSign(BaseModel): # username: str # password: str # budget: int class UserOut(BaseModel): username: str budget: str class Config: orm_mode = True
14.380952
30
0.639073
34
302
5.647059
0.529412
0.265625
0.3125
0.291667
0.385417
0.385417
0
0
0
0
0
0.00463
0.284768
302
20
31
15.1
0.884259
0.258278
0
0.2
0
0
0
0
0
0
0
0
0
1
0
false
0.1
0.1
0
0.9
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
4
d5f557de8e80f90297a1982d4ba6ecfa764cad2d
2,765
py
Python
build/android/pylib/host_driven/tests_annotations.py
nagineni/chromium-crosswalk
5725642f1c67d0f97e8613ec1c3e8107ab53fdf8
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
19
2015-02-19T21:08:27.000Z
2021-11-19T07:16:49.000Z
build/android/pylib/host_driven/tests_annotations.py
j4ckfrost/android_external_chromium_org
a1a3dad8b08d1fcf6b6b36c267158ed63217c780
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
8
2015-08-31T06:39:59.000Z
2021-12-04T14:53:28.000Z
build/android/pylib/host_driven/tests_annotations.py
j4ckfrost/android_external_chromium_org
a1a3dad8b08d1fcf6b6b36c267158ed63217c780
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
10
2015-08-28T16:44:03.000Z
2019-07-17T17:37:34.000Z
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Annotations for host-driven tests.""" import os class AnnotatedFunctions(object): """A container for annotated methods.""" _ANNOTATED = {} @staticmethod def _AddFunction(annotation, function): """Adds an annotated function to our container. Args: annotation: the annotation string. function: the function. Returns: The function passed in. """ module_name = os.path.splitext(os.path.basename( function.__globals__['__file__']))[0] qualified_function_name = '.'.join([module_name, function.func_name]) function_list = AnnotatedFunctions._ANNOTATED.get(annotation, []) function_list.append(qualified_function_name) AnnotatedFunctions._ANNOTATED[annotation] = function_list return function @staticmethod def IsAnnotated(annotation, qualified_function_name): """True if function name (module.function) contains the annotation. Args: annotation: the annotation string. qualified_function_name: the qualified function name. Returns: True if module.function contains the annotation. """ return qualified_function_name in AnnotatedFunctions._ANNOTATED.get( annotation, []) @staticmethod def GetTestAnnotations(qualified_function_name): """Returns a list containing all annotations for the given function. Args: qualified_function_name: the qualified function name. Returns: List of all annotations for this function. """ return [annotation for annotation, tests in AnnotatedFunctions._ANNOTATED.iteritems() if qualified_function_name in tests] # The following functions are annotations used for the host-driven tests. def Smoke(function): return AnnotatedFunctions._AddFunction('Smoke', function) def SmallTest(function): return AnnotatedFunctions._AddFunction('SmallTest', function) def MediumTest(function): return AnnotatedFunctions._AddFunction('MediumTest', function) def LargeTest(function): return AnnotatedFunctions._AddFunction('LargeTest', function) def EnormousTest(function): return AnnotatedFunctions._AddFunction('EnormousTest', function) def FlakyTest(function): return AnnotatedFunctions._AddFunction('FlakyTest', function) def DisabledTest(function): return AnnotatedFunctions._AddFunction('DisabledTest', function) def Feature(feature_list): def _AddFeatures(function): for feature in feature_list: AnnotatedFunctions._AddFunction('Feature:%s' % feature, function) return AnnotatedFunctions._AddFunction('Feature', function) return _AddFeatures
29.414894
78
0.746112
294
2,765
6.85034
0.302721
0.065541
0.10427
0.170804
0.119166
0.051639
0.051639
0.051639
0
0
0
0.002179
0.169982
2,765
93
79
29.731183
0.875381
0.311031
0
0.073171
0
0
0.05097
0
0
0
0
0
0
1
0.292683
false
0
0.02439
0.170732
0.658537
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
9122c7e7b6bbe16f615517347236ec0291cf9539
313
py
Python
scripts/SDL_Interface/InterfaceGenerator.py
jasonoscar88/Photon-v2
90649196c436261d28cc2300511b78ac88236448
[ "MIT" ]
88
2017-01-21T18:20:16.000Z
2021-12-21T02:32:04.000Z
scripts/SDL_Interface/InterfaceGenerator.py
jasonoscar88/Photon-v2
90649196c436261d28cc2300511b78ac88236448
[ "MIT" ]
72
2017-07-28T10:00:35.000Z
2021-11-09T18:36:23.000Z
scripts/SDL_Interface/InterfaceGenerator.py
jasonoscar88/Photon-v2
90649196c436261d28cc2300511b78ac88236448
[ "MIT" ]
8
2017-03-19T12:19:10.000Z
2020-05-19T15:15:05.000Z
from SDLInterface import SDLInterface from abc import abstractmethod class InterfaceGenerator: def __init__(self): pass @abstractmethod def add_interface(self, sdl_interface: SDLInterface): pass @abstractmethod def generate(self, output_directory): pass @abstractmethod def name(self): pass
14.227273
54
0.779553
35
313
6.771429
0.514286
0.227848
0.265823
0
0
0
0
0
0
0
0
0
0.159744
313
21
55
14.904762
0.901141
0
0
0.5
0
0
0
0
0
0
0
0
0
1
0.285714
false
0.285714
0.142857
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
1
0
1
0
0
0
0
0
4
9129c87b62d778a7d0cd03c3055272683eddb7c5
1,324
py
Python
pyhandle/tests/testcases/utilconfig_unit_test.py
merretbuurman/PYHANDLE
3c621eda80e26fdec945d4d42f6b62d0dcc70726
[ "Apache-2.0" ]
7
2017-11-22T14:43:09.000Z
2020-12-10T05:46:51.000Z
pyhandle/tests/testcases/utilconfig_unit_test.py
merretbuurman/PYHANDLE
3c621eda80e26fdec945d4d42f6b62d0dcc70726
[ "Apache-2.0" ]
18
2017-05-10T10:29:12.000Z
2021-02-10T23:16:27.000Z
pyhandle/tests/testcases/utilconfig_unit_test.py
merretbuurman/PYHANDLE
3c621eda80e26fdec945d4d42f6b62d0dcc70726
[ "Apache-2.0" ]
13
2017-05-24T12:55:27.000Z
2021-09-26T20:07:28.000Z
import sys if sys.version_info < (2, 7): import unittest2 as unittest else: import unittest from pyhandle.util import get_valid_https_verify class UtilConfigTestCase(unittest.TestCase): def test_valid_https_verify_bool_true(self): """Test return bool True when getting bool True""" self.assertEqual(get_valid_https_verify(True), True) def test_valid_https_verify_string_true(self): """Test return bool True when getting string True""" self.assertEqual(get_valid_https_verify('True'), True) def test_valid_https_verify_string_false(self): """Test return bool False when getting string False""" self.assertEqual(get_valid_https_verify('False'), False) def test_valid_https_verify_unicode_string_true(self): """Test return bool True when getting unicode string True""" self.assertEqual(get_valid_https_verify(u'True'), True) def test_valid_https_verify_unicode_string_false(self): """Test return bool False when getting unicode string False""" self.assertEqual(get_valid_https_verify(u'False'), False) def test_valid_https_verify_bool_string(self): """Test return string when getting a string value in https_verify""" self.assertEqual(get_valid_https_verify('ca_cert.crt'), 'ca_cert.crt')
36.777778
78
0.73565
184
1,324
4.983696
0.217391
0.167939
0.226827
0.145038
0.729553
0.729553
0.65867
0.535442
0.342421
0.163577
0
0.002752
0.176737
1,324
35
79
37.828571
0.838532
0.237915
0
0
0
0
0.040942
0
0
0
0
0
0.315789
1
0.315789
false
0
0.210526
0
0.578947
0
0
0
0
null
0
1
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
1
0
0
0
0
1
0
0
4
912b4f2d69fb92433909676a4ce0dc333ef2737c
1,668
py
Python
minitasks/cs111-splitting-up-stub.py
jfarrell-bsu/CS111-resources
d1744f088d789a4512ee1cf6102e4767d483d69f
[ "MIT" ]
null
null
null
minitasks/cs111-splitting-up-stub.py
jfarrell-bsu/CS111-resources
d1744f088d789a4512ee1cf6102e4767d483d69f
[ "MIT" ]
null
null
null
minitasks/cs111-splitting-up-stub.py
jfarrell-bsu/CS111-resources
d1744f088d789a4512ee1cf6102e4767d483d69f
[ "MIT" ]
null
null
null
# # Author: # Date: # Description: # # # Single string containing CSV formatted song data # "artist,album,title,duration" # Note: Duration is specified in seconds # singleSongCSV = "Jimmy Buffett,Songs You Know by Heart,Cheeseburger in Paradise,172" # # List of strings containing CSV formatted song data # songList = ['Jimmy Buffett,Songs You Know by Heart,Cheeseburger in Paradise,172', 'Jimmy Buffett,Songs You Know by Heart,He Went to Paris,209', 'Jimmy Buffett,Songs You Know by Heart,Fins,205', 'Jimmy Buffett,Songs You Know by Heart,Son of a Son of a Sailor,205', 'Jimmy Buffett,Songs You Know by Heart,A Pirate Looks at Forty,232', 'Jimmy Buffett,Songs You Know by Heart,Margaritaville,251', 'Jimmy Buffett,Songs You Know by Heart,Come Monday,189', 'Jimmy Buffett,Songs You Know by Heart,Changes in Latitudes Changes in Attitudes,195', "Jimmy Buffett,Songs You Know by Heart,Why Don't We Get Drunk,162", 'Jimmy Buffett,Songs You Know by Heart,Pencil Thin Mustache,170', 'Jimmy Buffett,Songs You Know by Heart,Grapefruit-Juicy Fruit,176', 'Jimmy Buffett,Songs You Know by Heart,Boat Drinks,157', 'Jimmy Buffett,Songs You Know by Heart,Volcano,218'] # Display nicely formatted song details for a # string provided in the following format: # "Artist,Album,Title,Duration" # # Parameters # song - String containing comma separated song details # # Return # none def printSong(song): # # call printSong() to print singleSongCSV # # # use a for loop and printSong() to print each song in songList #
30.888889
98
0.68705
236
1,668
4.855932
0.419492
0.146597
0.207679
0.244328
0.47993
0.427574
0.427574
0.157068
0.097731
0.097731
0
0.032685
0.229616
1,668
53
99
31.471698
0.859144
0.299161
0
0
0
0
0.747147
0.040386
0
0
0
0
0
0
null
null
0
0
null
null
0.066667
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
1
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
e6b4ff33b54d0983636ccfcdaadcbd00da865cbb
4,878
py
Python
rdfframes/test_queries/test_nested_queries.py
qcri/RDFframe
2a50105479051c134cc5eddc9e20d55b755ef765
[ "MIT" ]
13
2019-07-06T00:10:11.000Z
2022-02-20T02:14:16.000Z
rdfframes/test_queries/test_nested_queries.py
qcri/RDFrame
2a50105479051c134cc5eddc9e20d55b755ef765
[ "MIT" ]
1
2019-05-20T08:51:42.000Z
2019-05-20T08:51:42.000Z
rdfframes/test_queries/test_nested_queries.py
qcri/RDFframe
2a50105479051c134cc5eddc9e20d55b755ef765
[ "MIT" ]
3
2020-04-17T10:50:37.000Z
2022-03-23T01:30:16.000Z
import time from rdfframes.knowledge_graph import KnowledgeGraph from rdfframes.dataset.rdfpredicate import PredicateDirection def test_expand_after_group_by(): start = time.time() # create a knowledge graph to store the graph uri and prefixes graph = KnowledgeGraph('twitter', 'https://twitter.com', prefixes={ "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "sioc": "http://rdfs.org/sioc/ns#", "sioct": "http://rdfs.org/sioc/types#", "to": "http://twitter.com/ontology/", "dcterms": "http://purl.org/dc/terms/", "xsd": "http://www.example.org/", "foaf": "http://xmlns.com/foaf/0.1/" }) # return all the instances of the tweet class dataset = graph.entities(class_name='sioct:microblogPost', new_dataset_name='tweets', entities_col_name='tweet') sparql_query = dataset.to_sparql() print("sparql_query 1 =\n{}\n".format(sparql_query)) # expand each tweet by the following features: text and tweep ds = dataset.expand(src_col_name='tweet', predicate_list=[ ('sioc:has_creater', 'tweep'), ('sioc:content', 'text') ]) sparql_query = ds.to_sparql() print("sparql_query 2 =\n{}\n".format(sparql_query)) # return all the tweets of users whose tweep tweeted 250-300 twweets gds = ds.group_by(groupby_cols_list=['tweep'])\ .count('tweet', 'tweets_count')\ .filter({'tweets_count': ['> {}'.format(250), '< {}'.format(300)]}) sparql_query = gds.to_sparql() print("sparql_query 3 =\n{}\n".format(sparql_query)) # expand these tweets by the following features: date, media, hashtags, users mentioned gds = gds.expand(src_col_name='tweep', predicate_list=[ ('sioc:has_creater', 'tweet', False, PredicateDirection.INCOMING)]) sparql_query = gds.to_sparql() print("sparql_query 3.1 =\n{}\n".format(sparql_query)) gds = gds.expand(src_col_name='tweet', predicate_list=[ ('dcterms:created', 'date'), ('sioc:content', 'text'), ('to:hasmedia', 'multimedia'), ('to:hashashtag', 'hashtag'), ('sioc:mentions', 'users_mentioned') ]) sparql_query = gds.to_sparql() print("sparql_query 4 =\n{}\n\n\n\n".format(sparql_query)) # select all the tweets and their features gds = gds.select_cols(['tweet', 'tweep', 'text', 'date', 'multimedia', 'hashtag', 'users_mentioned']) # ds.print_query_structure() gds.print_query_structure() sparql_query = gds.to_sparql() end_transformation = time.time() print('Transformed in {} sec'.format(end_transformation-start)) print("sparql_query 5 =\n{}\n".format(sparql_query)) def test_filter_after_group_by(): start = time.time() # create a knowledge graph to store the graph uri and prefixes graph = KnowledgeGraph('twitter', 'https://twitter.com', prefixes={ "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "sioc": "http://rdfs.org/sioc/ns#", "sioct": "http://rdfs.org/sioc/types#", "to": "http://twitter.com/ontology/", "dcterms": "http://purl.org/dc/terms/", "xsd": "http://www.example.org/", "foaf": "http://xmlns.com/foaf/0.1/" }) # return all the instances of the tweet class dataset = graph.entities(class_name='sioct:microblogPost', new_dataset_name='tweets', entities_col_name='tweet') # expand each tweet by the following features: text and tweep ds = dataset.expand(src_col_name='tweet', predicate_list=[ ('sioc:has_creater', 'tweep'), ('sioc:content', 'text') ]) # return all the tweets of users whose tweep tweeted 250-300 twweets gds = ds.group_by(groupby_cols_list=['tweep'])\ .count('tweet', 'tweets_count')\ .filter(conditions_dict={'tweets_count': ['> {}'.format(250), '< {}'.format(300)]}) # expand these tweets by the following features: date, media, hashtags, users mentioned # TODO: Bug. implement filter fully gds = gds.filter({'tweep': ' >= aa'}) gds.print_query_structure() sparql_query = gds.to_sparql() end_transformation = time.time() print('Transformed in {} sec'.format(end_transformation-start)) print("sparql_query 1 =\n{}\n".format(sparql_query)) if __name__ == '__main__': #test_expand_after_group_by() test_filter_after_group_by()
44.752294
105
0.578516
567
4,878
4.797178
0.223986
0.084926
0.041176
0.036029
0.821691
0.755515
0.709559
0.697059
0.683088
0.633824
0
0.015228
0.273063
4,878
108
106
45.166667
0.751833
0.156827
0
0.675
0
0
0.277344
0
0
0
0
0.009259
0
1
0.025
false
0
0.0375
0
0.0625
0.1375
0
0
0
null
0
0
0
1
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
e6f16dfe048462cd44d456353e1f549f2d167aff
244
py
Python
apps/comun/admin.py
WilliamColmenares/Access_control
6c4d07a55307fe9f876a796d3e7273188b7569d4
[ "MIT" ]
2
2017-06-22T13:50:56.000Z
2021-09-16T14:07:50.000Z
apps/comun/admin.py
WilliamColmenares/Access_control
6c4d07a55307fe9f876a796d3e7273188b7569d4
[ "MIT" ]
null
null
null
apps/comun/admin.py
WilliamColmenares/Access_control
6c4d07a55307fe9f876a796d3e7273188b7569d4
[ "MIT" ]
2
2017-06-08T17:18:29.000Z
2021-04-17T22:20:34.000Z
from django.contrib import admin from apps.comun.models import Direccion, Asentamiento, Municipio, Entidad admin.site.register(Direccion) admin.site.register(Asentamiento) admin.site.register(Municipio) admin.site.register(Entidad)
24.4
74
0.79918
30
244
6.5
0.466667
0.184615
0.348718
0
0
0
0
0
0
0
0
0
0.110656
244
9
75
27.111111
0.898618
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
fc11e541379ec9f34a5fc7d103f848e06093282b
2,395
py
Python
src/iemws/models/obhistory.py
akrherz/iem-json-services
13fa3d7434c1ff3d0379f3b921d30ea79423dae8
[ "Apache-2.0" ]
null
null
null
src/iemws/models/obhistory.py
akrherz/iem-json-services
13fa3d7434c1ff3d0379f3b921d30ea79423dae8
[ "Apache-2.0" ]
null
null
null
src/iemws/models/obhistory.py
akrherz/iem-json-services
13fa3d7434c1ff3d0379f3b921d30ea79423dae8
[ "Apache-2.0" ]
null
null
null
"""Models for currents API.""" # pylint: disable=no-name-in-module from typing import List from pydantic import BaseModel, Field class ObHistoryDataItem(BaseModel): """Data Schema.""" utc_valid: str = Field(..., title="UTC Timestamp") local_valid: str = Field(..., title="Local Station Timestamp") tmpf: float = Field(..., title="Air Temperature [F]") dwpf: float = Field(..., title="Dew Point Temperature [F]") relh: float = Field(..., title="Relative Humidity [%]") feel: float = Field(..., title="Feels Like Temperature [F]") sknt: float = Field(..., title="Wind Speed [kts]") gust: float = Field(..., title="Wind Gust [kts]") drct: float = Field(..., title="Wind Direction [deg]") vsby: float = Field(..., title="Visibility [miles]") skyc1: str = Field(..., title="Cloud Coverage Code Level 1") skyl1: str = Field(..., title="Cloud Base Level 1 [ft]") skyc2: str = Field(..., title="Cloud Coverage Code Level 2") skyl2: str = Field(..., title="Cloud Base Level 2 [ft]") skyc3: str = Field(..., title="Cloud Coverage Code Level 3") skyl3: str = Field(..., title="Cloud Base Level 3 [ft]") skyc4: str = Field(..., title="Cloud Coverage Code Level 4") skyl4: str = Field(..., title="Cloud Base Level 4 [ft]") alti: float = Field(..., title="Altimeter [inch]") mslp: float = Field(..., title="Sea Level Pressure [mb]") p01i: float = Field(..., title="ASOS 60 Minute Precipitation Accum [inch]") phour: float = Field(..., title="Precip since top of the hour [inch]") max_tmpf_6hr: float = Field(..., title="ASOS 6 Hour Max Temperature [F]") min_tmpf_6hr: float = Field(..., title="ASOS 6 Hour Min Temperature [F]") p03i: float = Field(..., title="ASOS 3 Hour Precipitation Accum [inch]") p06i: float = Field(..., title="ASOS 6 Hour Precipitation Accum [inch]") p24i: float = Field(..., title="ASOS 24 Hour Precipitation Accum [inch]") raw: str = Field(..., title="METAR or SHEF information") max_tmpf_6hr: float = Field(..., title="METAR 6 Hour Max Temp [F]") min_tmpf_6hr: float = Field(..., title="METAR 6 Hour Min Temp [F]") wxcodes: str = Field(..., title="Present Weather METAR Codes") snowdepth: str = Field(..., title="Snow Depth [inch]") class ObHistorySchema(BaseModel): """The schema used by this service.""" data: List[ObHistoryDataItem]
48.877551
79
0.63048
315
2,395
4.761905
0.371429
0.213333
0.19
0.096
0.274667
0.274667
0.182667
0.084
0
0
0
0.019507
0.186639
2,395
48
80
49.895833
0.750513
0.043841
0
0
0
0
0.354881
0
0
0
0
0
0
1
0
true
0
0.054054
0
1
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
1
0
0
4
fc2d156b4a7cd5e699f8b8655096e544d140f34a
1,099
py
Python
2020/day15_test.py
natbodington/advent_of_code
aa246c76730a1d5ca29ec632a265b31b0c752d94
[ "MIT" ]
null
null
null
2020/day15_test.py
natbodington/advent_of_code
aa246c76730a1d5ca29ec632a265b31b0c752d94
[ "MIT" ]
null
null
null
2020/day15_test.py
natbodington/advent_of_code
aa246c76730a1d5ca29ec632a265b31b0c752d94
[ "MIT" ]
null
null
null
import day15 ITERS = 2020 def test_example1(): intro_seq = [0, 3, 6] final_move = day15.play_game(intro_seq, ITERS) assert final_move == 436, f"Error: {final_move}" def test_example2(): intro_seq = [1, 3, 2] final_move = day15.play_game(intro_seq, ITERS) assert final_move == 1, f"Error: {final_move}" def test_example3(): intro_seq = [2, 1, 3] final_move = day15.play_game(intro_seq, ITERS) assert final_move == 10, f"Error: {final_move}" def test_example4(): intro_seq = [1, 2, 3] final_move = day15.play_game(intro_seq, ITERS) assert final_move == 27, f"Error: {final_move}" def test_example5(): intro_seq = [2, 3, 1] final_move = day15.play_game(intro_seq, ITERS) assert final_move == 78, f"Error: {final_move}" def test_example6(): intro_seq = [3, 2, 1] final_move = day15.play_game(intro_seq, ITERS) assert final_move == 438, f"Error: {final_move}" def test_example7(): intro_seq = [3, 1, 2] final_move = day15.play_game(intro_seq, ITERS) assert final_move == 1836, f"Error: {final_move}"
21.54902
53
0.657871
172
1,099
3.918605
0.19186
0.280415
0.145401
0.186944
0.724036
0.724036
0.52819
0.52819
0.52819
0.52819
0
0.074627
0.207461
1,099
50
54
21.98
0.699196
0
0
0.233333
0
0
0.121019
0
0
0
0
0
0.233333
1
0.233333
false
0
0.033333
0
0.266667
0
0
0
0
null
1
0
1
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
1
0
0
0
0
0
0
0
4
fc3ce069b6138b270e53b0a042262cabf49d19d4
125
py
Python
firewall/app/main/utils/custom_exception.py
vivitek/box
82b8f9fec3b92b38b8587e18bdfeb08d50708d03
[ "CC-BY-4.0" ]
2
2020-05-28T14:39:46.000Z
2020-06-19T18:38:46.000Z
firewall/app/main/utils/custom_exception.py
vivitek/deep-thought
9f0e3ec1e1c1dbc14466ec8ebd24ae83e6fcee94
[ "CC-BY-4.0" ]
35
2020-06-19T18:43:47.000Z
2021-04-02T13:23:30.000Z
firewall/app/main/utils/custom_exception.py
vivitek/box
82b8f9fec3b92b38b8587e18bdfeb08d50708d03
[ "CC-BY-4.0" ]
1
2020-09-01T16:08:49.000Z
2020-09-01T16:08:49.000Z
class CustomException(Exception): def __init__(self, reason, code): self.reason = reason self.code = code
31.25
37
0.656
14
125
5.571429
0.571429
0.25641
0
0
0
0
0
0
0
0
0
0
0.248
125
4
38
31.25
0.829787
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
4
fc40491e62252c460c727a4b317ce0604d58ea00
722
py
Python
ml-agents-envs/mlagents/envs/base_unity_environment.py
Model2TypeE/ml-agents
f1fb5be3698df60b6e32df4051ccc17fa86e4668
[ "Apache-2.0" ]
11
2019-04-12T13:17:11.000Z
2021-01-26T16:19:32.000Z
ml-agents-envs/mlagents/envs/base_unity_environment.py
Datguypotato/ml-agents
4ea5986b985f36d0a61246247d4b561a9b689288
[ "Apache-2.0" ]
null
null
null
ml-agents-envs/mlagents/envs/base_unity_environment.py
Datguypotato/ml-agents
4ea5986b985f36d0a61246247d4b561a9b689288
[ "Apache-2.0" ]
7
2021-02-01T10:17:40.000Z
2021-12-17T16:44:32.000Z
from abc import ABC, abstractmethod from typing import Dict from mlagents.envs import AllBrainInfo, BrainParameters class BaseUnityEnvironment(ABC): @abstractmethod def step(self, vector_action=None, memory=None, text_action=None, value=None) -> AllBrainInfo: pass @abstractmethod def reset(self, config=None, train_mode=True) -> AllBrainInfo: pass @property @abstractmethod def global_done(self): pass @property @abstractmethod def external_brains(self) -> Dict[str, BrainParameters]: pass @property @abstractmethod def reset_parameters(self) -> Dict[str, str]: pass @abstractmethod def close(self): pass
21.235294
98
0.6759
77
722
6.25974
0.454545
0.211618
0.161826
0.180498
0
0
0
0
0
0
0
0
0.242382
722
33
99
21.878788
0.88117
0
0
0.6
0
0
0
0
0
0
0
0
0
1
0.24
false
0.24
0.12
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
1
0
1
0
0
0
0
0
4