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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7f78b3e71640fb7eac704e0b8c9153589e150331 | 1,732 | py | Python | tensorflow_transform/beam/__init__.py | rtg0795/transform | ee1a769f0e359a8722dca7b434a3b499396a140f | [
"Apache-2.0"
] | null | null | null | tensorflow_transform/beam/__init__.py | rtg0795/transform | ee1a769f0e359a8722dca7b434a3b499396a140f | [
"Apache-2.0"
] | null | null | null | tensorflow_transform/beam/__init__.py | rtg0795/transform | ee1a769f0e359a8722dca7b434a3b499396a140f | [
"Apache-2.0"
] | null | null | null | # Copyright 2017 Google 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.
"""Module level imports for tensorflow_transform.beam."""
# pylint: disable=wildcard-import
# The doc-generator's `explicit_package_contents_filter` requires that
# sub-modules you want documented are explicitly imported.
# Also: analyzer_impls registers implementation of analyzers.
from tensorflow_transform.beam import analyzer_cache
from tensorflow_transform.beam import analyzer_impls
from tensorflow_transform.beam import experimental
from tensorflow_transform.beam.context import Context
from tensorflow_transform.beam.impl import AnalyzeAndTransformDataset
from tensorflow_transform.beam.impl import AnalyzeDataset
from tensorflow_transform.beam.impl import AnalyzeDatasetWithCache
from tensorflow_transform.beam.impl import TransformDataset
from tensorflow_transform.beam.tft_beam_io import *
# pylint: enable=wildcard-import
# TF 2.6 split support for filesystems such as Amazon S3 out to the
# `tensorflow_io` package. Hence, this import is needed wherever we touch the
# filesystem.
try:
import tensorflow_io as _ # pytype: disable=import-error # pylint: disable=g-import-not-at-top
except ModuleNotFoundError:
pass
| 44.410256 | 97 | 0.812933 | 242 | 1,732 | 5.731405 | 0.545455 | 0.136986 | 0.165826 | 0.175198 | 0.189618 | 0.165826 | 0 | 0 | 0 | 0 | 0 | 0.007275 | 0.127021 | 1,732 | 38 | 98 | 45.578947 | 0.910053 | 0.629908 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.076923 | 0.769231 | 0 | 0.769231 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 5 |
7fb4f11d0f739a679fcbbd2ac728c4c59160ccfd | 1,952 | py | Python | src/wgan/plotting.py | chrismolli/redes_neuronales_semester_project | 3309d102b809b395af39f7b570927e23d10db5ea | [
"MIT"
] | null | null | null | src/wgan/plotting.py | chrismolli/redes_neuronales_semester_project | 3309d102b809b395af39f7b570927e23d10db5ea | [
"MIT"
] | null | null | null | src/wgan/plotting.py | chrismolli/redes_neuronales_semester_project | 3309d102b809b395af39f7b570927e23d10db5ea | [
"MIT"
] | null | null | null | import matplotlib.pyplot as plt
import pandas as pd
import matplotlib.ticker as ticker
def plot_csv_log(model_directory):
# read log
log = pd.read_csv(model_directory+"/log.csv", sep=",")
fig, ax1 = plt.subplots(figsize=(5,2))
ax1.set_xlabel('Epoch')
ax1.set_ylabel('Wasserstein Distance', color="C0")
ax1.plot(log["epoch"], log["w_distance"], label="c_loss_real", color="C0")
ax2 = ax1.twinx() # instantiate a second axes that shares the same x-axis
ax2.set_ylabel('Generator Loss', color="C2") # we already handled the x-label with ax1
ax2.plot(log["epoch"],log["g_loss"],label="g_loss", color="C2")
fig.tight_layout() # otherwise the right y-label is slightly clipped
plt.savefig(model_directory+"/loss.pdf")
plt.close()
def plot_csv_log_v2(model_directory, max_epoch=None):
# read log
log = pd.read_csv(model_directory+"/log.csv", sep=",")
if max_epoch:
log = log[:max_epoch]
fig, ax1 = plt.subplots(figsize=(5,3))
ax1.set_xlabel('Epoch')
ax1.set_ylabel('Generator Loss', color="C2") # we already handled the x-label with ax1
ax1.plot(log["epoch"],log["g_loss"],label="g_loss", color="C2")
ax1.yaxis.set_major_formatter(ticker.FormatStrFormatter("%.1e"))
fig.tight_layout() # otherwise the right y-label is slightly clipped
if max_epoch:
ax1.set_xlim([0,max_epoch])
plt.savefig(model_directory+"/generator_loss.pdf")
plt.close()
fig, ax1 = plt.subplots(figsize=(5, 2))
ax1.set_xlabel('Epoch')
ax1.set_ylabel('Wasserstein Distance', color="C0")
ax1.plot(log["epoch"], log["w_distance"], label="c_loss_real", color="C0")
ax1.yaxis.set_major_formatter(ticker.FormatStrFormatter("%.1e"))
fig.tight_layout() # otherwise the right y-label is slightly clipped
if max_epoch:
ax1.set_xlim([0,max_epoch])
plt.savefig(model_directory + "/wassertstein_distance.pdf")
plt.close() | 32 | 91 | 0.679303 | 292 | 1,952 | 4.373288 | 0.267123 | 0.037588 | 0.04307 | 0.046985 | 0.74863 | 0.74628 | 0.726703 | 0.711042 | 0.711042 | 0.711042 | 0 | 0.025262 | 0.168545 | 1,952 | 61 | 92 | 32 | 0.761553 | 0.151127 | 0 | 0.615385 | 0 | 0 | 0.160703 | 0.015767 | 0 | 0 | 0 | 0 | 0.025641 | 1 | 0.051282 | false | 0 | 0.076923 | 0 | 0.128205 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 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 | 5 |
7fb7471d00c1f827045472423287f2b77e1c4b43 | 210 | py | Python | moto/cloudformation/__init__.py | symroe/moto | 4e106995af6f2820273528fca8a4e9ee288690a5 | [
"Apache-2.0"
] | null | null | null | moto/cloudformation/__init__.py | symroe/moto | 4e106995af6f2820273528fca8a4e9ee288690a5 | [
"Apache-2.0"
] | 1 | 2022-02-19T02:10:45.000Z | 2022-02-19T02:15:52.000Z | moto/cloudformation/__init__.py | symroe/moto | 4e106995af6f2820273528fca8a4e9ee288690a5 | [
"Apache-2.0"
] | null | null | null | from .models import cloudformation_backends
from ..core.models import base_decorator
cloudformation_backend = cloudformation_backends["us-east-1"]
mock_cloudformation = base_decorator(cloudformation_backends)
| 35 | 61 | 0.861905 | 24 | 210 | 7.25 | 0.541667 | 0.37931 | 0.310345 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005128 | 0.071429 | 210 | 5 | 62 | 42 | 0.887179 | 0 | 0 | 0 | 0 | 0 | 0.042857 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 5 |
f6ad8af980611e31f0f28d63cb0e9f3c66349556 | 19 | py | Python | Step 2 The Fundamentals/Algorithms/Sorting/sorting_examples.py | jyeh20/interview-prep | 031cead76a68ee5ade184628c4096300b6ff5df3 | [
"MIT"
] | null | null | null | Step 2 The Fundamentals/Algorithms/Sorting/sorting_examples.py | jyeh20/interview-prep | 031cead76a68ee5ade184628c4096300b6ff5df3 | [
"MIT"
] | null | null | null | Step 2 The Fundamentals/Algorithms/Sorting/sorting_examples.py | jyeh20/interview-prep | 031cead76a68ee5ade184628c4096300b6ff5df3 | [
"MIT"
] | 1 | 2021-03-19T02:20:21.000Z | 2021-03-19T02:20:21.000Z | # Sorting Examples
| 9.5 | 18 | 0.789474 | 2 | 19 | 7.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.157895 | 19 | 1 | 19 | 19 | 0.9375 | 0.842105 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
89e0dfe61160ddaa9e1cb37e5bfd3511042777f7 | 214 | py | Python | shopify/orders/objects/note_attribute.py | alikhan126/python-shopify-api | 656cdf1af99485b25be545e2ed527bcb653076fd | [
"Unlicense"
] | 10 | 2016-12-29T06:53:21.000Z | 2022-03-01T10:35:32.000Z | shopify/orders/objects/note_attribute.py | alikhan126/python-shopify-api | 656cdf1af99485b25be545e2ed527bcb653076fd | [
"Unlicense"
] | 4 | 2016-12-30T15:12:47.000Z | 2021-07-24T07:14:20.000Z | shopify/orders/objects/note_attribute.py | alikhan126/python-shopify-api | 656cdf1af99485b25be545e2ed527bcb653076fd | [
"Unlicense"
] | 8 | 2016-12-29T19:13:39.000Z | 2022-03-22T18:02:58.000Z | from ...base import BaseParser
class NoteAttribute(BaseParser):
@property
def name(self):
return self._dict.get('name')
@property
def value(self):
return self._dict.get('value')
| 16.461538 | 38 | 0.635514 | 25 | 214 | 5.36 | 0.56 | 0.164179 | 0.208955 | 0.268657 | 0.313433 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.242991 | 214 | 12 | 39 | 17.833333 | 0.82716 | 0 | 0 | 0.25 | 0 | 0 | 0.042056 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.125 | 0.25 | 0.75 | 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 | 1 | 0 | 0 | 0 | 5 |
89e80de340fd9b74366ebd4eccca530787dd882a | 101 | py | Python | toontown/pets/PetDCImportsAI.py | LittleNed/toontown-stride | 1252a8f9a8816c1810106006d09c8bdfe6ad1e57 | [
"Apache-2.0"
] | 3 | 2020-01-02T08:43:36.000Z | 2020-07-05T08:59:02.000Z | toontown/pets/PetDCImportsAI.py | NoraTT/Historical-Commits-Project-Altis-Source | fe88e6d07edf418f7de6ad5b3d9ecb3d0d285179 | [
"Apache-2.0"
] | null | null | null | toontown/pets/PetDCImportsAI.py | NoraTT/Historical-Commits-Project-Altis-Source | fe88e6d07edf418f7de6ad5b3d9ecb3d0d285179 | [
"Apache-2.0"
] | 4 | 2019-06-20T23:45:23.000Z | 2020-10-14T20:30:15.000Z | if hasattr(simbase, 'wantPets') and simbase.wantPets:
from toontown.pets import DistributedPetAI
| 33.666667 | 53 | 0.792079 | 12 | 101 | 6.666667 | 0.833333 | 0.375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.128713 | 101 | 2 | 54 | 50.5 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0.079208 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
89f8ce2f414e4b529e02538500902e7802bb51e7 | 454 | py | Python | accesslink-API/accesslink/endpoints/resource.py | mendelson/polar-data-analysis | 04c7b8615d88e3966e8a71c4353ad23c61ff022d | [
"MIT"
] | 115 | 2017-10-26T16:59:51.000Z | 2022-03-29T13:56:48.000Z | accesslink-API/accesslink/endpoints/resource.py | mendelson/polar-data-analysis | 04c7b8615d88e3966e8a71c4353ad23c61ff022d | [
"MIT"
] | 14 | 2018-01-08T10:02:05.000Z | 2022-02-17T16:05:01.000Z | accesslink-API/accesslink/endpoints/resource.py | mendelson/polar-data-analysis | 04c7b8615d88e3966e8a71c4353ad23c61ff022d | [
"MIT"
] | 61 | 2017-10-27T10:38:17.000Z | 2022-03-11T20:03:52.000Z | #!/usr/bin/env python
class Resource(object):
def __init__(self, oauth):
self.oauth = oauth
def _get(self, *args, **kwargs):
return self.oauth.get(*args, **kwargs)
def _post(self, *args, **kwargs):
return self.oauth.post(*args, **kwargs)
def _put(self, *args, **kwargs):
return self.oauth.put(*args, **kwargs)
def _delete(self, *args, **kwargs):
return self.oauth.delete(*args, **kwargs) | 23.894737 | 49 | 0.599119 | 58 | 454 | 4.551724 | 0.310345 | 0.30303 | 0.212121 | 0.30303 | 0.439394 | 0.439394 | 0 | 0 | 0 | 0 | 0 | 0 | 0.229075 | 454 | 19 | 49 | 23.894737 | 0.754286 | 0.044053 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.454545 | false | 0 | 0 | 0.363636 | 0.909091 | 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 | 1 | 0 | 0 | 0 | 5 |
d63652614733a0fbafc795ca6354efb802f1c806 | 72 | py | Python | image_matting/modules/salient_object_detector/u2net/__init__.py | image-matting/backend | bbf502539cf70822dadb5eded31529d5e66c6276 | [
"Apache-2.0"
] | 1 | 2022-01-22T04:12:48.000Z | 2022-01-22T04:12:48.000Z | image_matting/modules/salient_object_detector/u2net/__init__.py | image-matting/backend | bbf502539cf70822dadb5eded31529d5e66c6276 | [
"Apache-2.0"
] | 4 | 2021-12-23T14:02:17.000Z | 2022-01-26T18:44:06.000Z | image_matting/modules/salient_object_detector/u2net/__init__.py | image-matting/backend | bbf502539cf70822dadb5eded31529d5e66c6276 | [
"Apache-2.0"
] | null | null | null | from u2net.u2_salient_object_detector import U2NetSalientObjectDetector
| 36 | 71 | 0.930556 | 8 | 72 | 8 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.044118 | 0.055556 | 72 | 1 | 72 | 72 | 0.897059 | 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 | 1 | 0 | 0 | 5 |
c3b1b837476eada98b8f417f8ee524f08cbbbed4 | 107 | py | Python | train_lib/clients/fhir/__init__.py | PHT-EU/train-container-library | b0c94c3a543fad48681b4c7f2f16f56f32054e71 | [
"MIT"
] | 1 | 2021-12-16T12:06:30.000Z | 2021-12-16T12:06:30.000Z | train_lib/clients/fhir/__init__.py | PHT-EU/train-container-library | b0c94c3a543fad48681b4c7f2f16f56f32054e71 | [
"MIT"
] | 35 | 2021-11-02T09:19:39.000Z | 2022-03-31T13:24:33.000Z | train_lib/clients/fhir/__init__.py | PHT-Medic/train-container-library | b0c94c3a543fad48681b4c7f2f16f56f32054e71 | [
"MIT"
] | null | null | null | from .fhir_client import PHTFhirClient
from .fhir_query_builder import build_query_string, load_query_file
| 35.666667 | 67 | 0.88785 | 16 | 107 | 5.5 | 0.6875 | 0.181818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.084112 | 107 | 2 | 68 | 53.5 | 0.897959 | 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 | 1 | 0 | 0 | 5 |
c3cbfd3ec13ce6af561114a8707599f9e6da5516 | 4,860 | py | Python | api/GetStudentInfo.py | hackxg/CQUPT-SDK | cb2d1b93a813561e924c1d9eb6c4acfdbabc9185 | [
"MIT"
] | 4 | 2020-06-23T17:03:21.000Z | 2021-12-19T05:04:00.000Z | api/GetStudentInfo.py | hackxg/CQUPT-SDK | cb2d1b93a813561e924c1d9eb6c4acfdbabc9185 | [
"MIT"
] | null | null | null | api/GetStudentInfo.py | hackxg/CQUPT-SDK | cb2d1b93a813561e924c1d9eb6c4acfdbabc9185 | [
"MIT"
] | null | null | null | import requests
import GetCookie
import LoginApi
import GetUrl
# @author Longm
# @date 2020/6/23 16:34
# Blog https://Longm.top
from lxml import etree
def getinfo1(username,password):#学生基本信息
if LoginApi.getlogin(username, password)== '登录成功':
url=GetUrl.jwzx()
cookies=GetCookie.get(username)
seesion = requests.session()
seesion.cookies['PHPSESSID'] = cookies
try:
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0",
"Accept": "*/*",
"Accept-Language": "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3",
"Accept-Encoding": "gzip, deflate",
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"Referer": "https://ids.cqupt.edu.cn/authserver/login?service=http%3A%2F%2Fjwc.cqupt.edu.cn%2Ftysfrz%2Findex.php",
"X-Requested-With": "XMLHttpRequest",
"Connection": "keep-alive",
"Pragma": "no-cache",
"Cache-Control": "no-cache"
}
req=seesion.get(url+'/user.php',headers=headers)
json = getdata1(req.text)
return json
except:
data = {
"data": {},
"code": "1"
}
return data
else:
data = {
"data": {},
"code": "1"
}
return data
def getinfo2(username,password):
if LoginApi.getlogin(username, password)== '登录成功':
url=GetUrl.jwzx()
cookies=GetCookie.get(username)
seesion = requests.session()
seesion.cookies['PHPSESSID'] = cookies
try:
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0",
"Accept": "*/*",
"Accept-Language": "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3",
"Accept-Encoding": "gzip, deflate",
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"Referer": "https://ids.cqupt.edu.cn/authserver/login?service=http%3A%2F%2Fjwc.cqupt.edu.cn%2Ftysfrz%2Findex.php",
"X-Requested-With": "XMLHttpRequest",
"Connection": "keep-alive",
"Pragma": "no-cache",
"Cache-Control": "no-cache"
}
req=seesion.get(url+'/student/xj.php',headers=headers)
json = getdata2(req.text)
return json
except:
data = {
"data": {},
"code": "1"
}
return data
else:
data = {
"data": {},
"code": "1"
}
return data
def getinfo3(username,password):
if LoginApi.getlogin(username, password)== '登录成功':
StudentId=GetCookie.getStudentId(username)
url = GetUrl.jwzx()
cookies = GetCookie.get(username)
seesion = requests.session()
seesion.cookies['PHPSESSID'] = cookies
try:
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0",
"Accept": "*/*",
"Accept-Language": "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3",
"Accept-Encoding": "gzip, deflate",
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"Referer": "https://ids.cqupt.edu.cn/authserver/login?service=http%3A%2F%2Fjwc.cqupt.edu.cn%2Ftysfrz%2Findex.php",
"X-Requested-With": "XMLHttpRequest",
"Connection": "keep-alive",
"Pragma": "no-cache",
"Cache-Control": "no-cache"
}
req = seesion.get(url + '/showstupic.php?xh='+StudentId, headers=headers)
base64_data = req.content # 使用base64进行加密
return base64_data
except:
pass
def getdata1(text):
html = etree.HTML(text)
temp = html.xpath(r'//tbody//tr//td/text()')
stuNumber = temp[1]
realName = temp[3]
grade = temp[5]
academy = temp[9]
data = {"data":{
"stuNumber": stuNumber,
"realName": realName,
"grade": grade,
"academy": academy},
"code":"0"
}
return data
def getdata2(text):
html = etree.HTML(text)
idtemp = html.xpath(r'//*[@id="xjTabs-xjInfo"]/table/tr[8]//text()') #身份证号 2 出生年月 4
colleg = html.xpath(r'//*[@id="xjTabs-xjInfo"]/table/tr[14]//text()') # 考生号 2 通知书号 4
id=idtemp[2]
Bdate=idtemp[5]
ksh=colleg[2]
tzsh=colleg[5]
data = {
"data":{
"id": id,
"Bdate": Bdate,
"ksh": ksh,
"tzsh": tzsh
},
"code":"0"
}
return data
| 35.474453 | 130 | 0.510494 | 537 | 4,860 | 4.616387 | 0.268156 | 0.007261 | 0.024203 | 0.020976 | 0.723679 | 0.706737 | 0.706737 | 0.706737 | 0.653489 | 0.653489 | 0 | 0.043411 | 0.331687 | 4,860 | 136 | 131 | 35.735294 | 0.719828 | 0.021605 | 0 | 0.618321 | 0 | 0.068702 | 0.327223 | 0.067004 | 0 | 0 | 0 | 0 | 0 | 1 | 0.038168 | false | 0.053435 | 0.038168 | 0 | 0.145038 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 5 |
c3f0df21d6b42c9ffc986dc1b4e33f0b5f600806 | 142 | py | Python | models/__init__.py | gfoo/fastapi-demo | 44ceb9e94fa833841756136c3b446f192a311dde | [
"Unlicense"
] | null | null | null | models/__init__.py | gfoo/fastapi-demo | 44ceb9e94fa833841756136c3b446f192a311dde | [
"Unlicense"
] | null | null | null | models/__init__.py | gfoo/fastapi-demo | 44ceb9e94fa833841756136c3b446f192a311dde | [
"Unlicense"
] | null | null | null | # import models for autogenerate alembic stuffs
# do ont change order
from .user import DBUser # noqa
from .project import DBProject # noqa
| 28.4 | 47 | 0.774648 | 20 | 142 | 5.5 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.183099 | 142 | 4 | 48 | 35.5 | 0.948276 | 0.528169 | 0 | 0 | 1 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
7f11e1bd68886edf5c1bb44e20df8cc2d5580834 | 2,467 | py | Python | default_encode_settings.py | nick3633/multibitrate-video-encode | 174c0a9b75976c045bfb7fb4e647b979d677ee19 | [
"Apache-2.0"
] | null | null | null | default_encode_settings.py | nick3633/multibitrate-video-encode | 174c0a9b75976c045bfb7fb4e647b979d677ee19 | [
"Apache-2.0"
] | null | null | null | default_encode_settings.py | nick3633/multibitrate-video-encode | 174c0a9b75976c045bfb7fb4e647b979d677ee19 | [
"Apache-2.0"
] | null | null | null | encode_settings = '''
{
"video_encode_list": {
"2160p.hevc": {
"codec": "hevc",
"dr": "sdr",
"codded_width": "3840",
"codded_height": "2160",
"maxrate": "30000",
"bufsize": "40000",
"encode_speed": "medium",
"encode_profile": "main10",
"encode_extra_settings": "--aq-mode 3",
"crf": "20"
},
"1080p.hevc": {
"codec": "hevc",
"dr": "sdr",
"codded_width": "1920",
"codded_height": "1080",
"maxrate": "12000",
"bufsize": "16000",
"encode_speed": "medium",
"encode_profile": "main10",
"encode_extra_settings": "--aq-mode 3",
"crf": "18"
},
"480p.hevc": {
"codec": "hevc",
"dr": "sdr",
"codded_width": "854",
"codded_height": "480",
"maxrate": "3750",
"bufsize": "5000",
"encode_speed": "medium",
"encode_profile": "main10",
"encode_extra_settings": "--aq-mode 3",
"crf": "16"
},
"2160p.hevc.hdr": {
"codec": "hevc",
"dr": "hdr",
"codded_width": "3840",
"codded_height": "2160",
"maxrate": "30000",
"bufsize": "40000",
"encode_speed": "medium",
"encode_profile": "main10",
"encode_extra_settings": "--aq-mode 3",
"crf": "17"
},
"1080p.hevc.hdr": {
"codec": "hevc",
"dr": "hdr",
"codded_width": "1920",
"codded_height": "1080",
"maxrate": "12000",
"bufsize": "16000",
"encode_speed": "medium",
"encode_profile": "main10",
"encode_extra_settings": "--aq-mode 3",
"crf": "15"
},
"1080p.avc": {
"codec": "avc",
"dr": "sdr",
"codded_width": "1920",
"codded_height": "1080",
"maxrate": "12000",
"bufsize": "16000",
"encode_speed": "medium",
"encode_profile": "high",
"encode_extra_settings": "",
"crf": "18"
},
"480p.avc": {
"codec": "avc",
"dr": "sdr",
"codded_width": "854",
"codded_height": "480",
"maxrate": "3750",
"bufsize": "5000",
"encode_speed": "medium",
"encode_profile": "main",
"encode_extra_settings": "",
"crf": "16"
}
},
"video_other_settings": {
"chunked_encoding": true,
"sdr_highest_res_only": false,
"hdr_highest_res_only": true,
"replace_sdr_with_hdr": true,
"hls_compatible": true,
"hls_compatible_settings": {
"keyint_second": 6
}
}
}
''' | 24.67 | 45 | 0.498987 | 241 | 2,467 | 4.854772 | 0.253112 | 0.065812 | 0.101709 | 0.137607 | 0.760684 | 0.760684 | 0.760684 | 0.704274 | 0.668376 | 0.668376 | 0 | 0.099032 | 0.287799 | 2,467 | 100 | 46 | 24.67 | 0.566875 | 0 | 0 | 0.65 | 0 | 0 | 0.98987 | 0.115883 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
613387317dc05f4afcd105f121ff1b666878e113 | 33 | py | Python | fitnessfirstsg/__init__.py | terencelimzhengwei/fitnessfirstsg-api | 72fe27ea7befaf3cd13ffab48c888fd7b18531a9 | [
"MIT"
] | null | null | null | fitnessfirstsg/__init__.py | terencelimzhengwei/fitnessfirstsg-api | 72fe27ea7befaf3cd13ffab48c888fd7b18531a9 | [
"MIT"
] | null | null | null | fitnessfirstsg/__init__.py | terencelimzhengwei/fitnessfirstsg-api | 72fe27ea7befaf3cd13ffab48c888fd7b18531a9 | [
"MIT"
] | 1 | 2021-01-24T03:04:34.000Z | 2021-01-24T03:04:34.000Z | from fitnessfirstsg.api import *
| 16.5 | 32 | 0.818182 | 4 | 33 | 6.75 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121212 | 33 | 1 | 33 | 33 | 0.931034 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 5 |
6149bb405df705adf31203c6415f86be31e95182 | 378 | py | Python | core/mutation_fuzzer/data_generators/__init__.py | ShreyasTheOne/Super-Duper-Fuzzer | b667e2dca3e49a370634ad4b0bd826aca06136b7 | [
"MIT"
] | null | null | null | core/mutation_fuzzer/data_generators/__init__.py | ShreyasTheOne/Super-Duper-Fuzzer | b667e2dca3e49a370634ad4b0bd826aca06136b7 | [
"MIT"
] | null | null | null | core/mutation_fuzzer/data_generators/__init__.py | ShreyasTheOne/Super-Duper-Fuzzer | b667e2dca3e49a370634ad4b0bd826aca06136b7 | [
"MIT"
] | null | null | null | from core.mutation_fuzzer.data_generators.bool_generator import BoolGenerator
from core.mutation_fuzzer.data_generators.int_generator import IntGenerator
from core.mutation_fuzzer.data_generators.str_generator import StrGenerator
from core.mutation_fuzzer.data_generators.list_generator import ListGenerator
__all__ = [BoolGenerator, IntGenerator, StrGenerator, ListGenerator]
| 54 | 77 | 0.891534 | 45 | 378 | 7.133333 | 0.377778 | 0.099688 | 0.199377 | 0.274143 | 0.448598 | 0.448598 | 0 | 0 | 0 | 0 | 0 | 0 | 0.060847 | 378 | 6 | 78 | 63 | 0.904225 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.8 | 0 | 0.8 | 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 | 1 | 0 | 0 | 5 |
614f984c887badcd24599e07f60834e91bfd6157 | 113 | py | Python | sqlite_utils/__init__.py | seattleflu/sqlite-utils | d0cdaaaf00249230e847be3a3b393ee2689fbfe4 | [
"Apache-2.0"
] | 729 | 2018-07-15T02:13:50.000Z | 2022-03-28T21:54:15.000Z | sqlite_utils/__init__.py | seattleflu/sqlite-utils | d0cdaaaf00249230e847be3a3b393ee2689fbfe4 | [
"Apache-2.0"
] | 396 | 2018-08-12T22:50:57.000Z | 2022-03-29T23:52:39.000Z | sqlite_utils/__init__.py | seattleflu/sqlite-utils | d0cdaaaf00249230e847be3a3b393ee2689fbfe4 | [
"Apache-2.0"
] | 65 | 2019-02-01T17:32:18.000Z | 2022-03-10T09:55:46.000Z | from .db import Database
from .utils import suggest_column_types
__all__ = ["Database", "suggest_column_types"]
| 22.6 | 46 | 0.79646 | 15 | 113 | 5.466667 | 0.6 | 0.317073 | 0.439024 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.115044 | 113 | 4 | 47 | 28.25 | 0.82 | 0 | 0 | 0 | 0 | 0 | 0.247788 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 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 | 1 | 0 | 0 | 0 | 0 | 5 |
615e8393cfdd4c82793888d827ce172ba732c73b | 42 | py | Python | cifar/step2/tensor_compression/__init__.py | chatzikon/DNN-COMPRESSION | 5c19ab740048052426a77eb5bc7a56ab3fae93e9 | [
"MIT"
] | 9 | 2020-05-06T10:14:11.000Z | 2021-07-09T10:12:22.000Z | ilscvr/step2/tensor_compression/__init__.py | chatzikon/DNN-COMPRESSION | 5c19ab740048052426a77eb5bc7a56ab3fae93e9 | [
"MIT"
] | null | null | null | ilscvr/step2/tensor_compression/__init__.py | chatzikon/DNN-COMPRESSION | 5c19ab740048052426a77eb5bc7a56ab3fae93e9 | [
"MIT"
] | null | null | null | from .compress import get_compressed_model | 42 | 42 | 0.904762 | 6 | 42 | 6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.071429 | 42 | 1 | 42 | 42 | 0.923077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 5 |
617d64c03a1ba4046d214f339c05ea45d08f4651 | 139 | py | Python | sanic_template/error/exc.py | aragentum/sanic-template | c73c874e4612f0eaca8a6174999f76239b4a2078 | [
"MIT"
] | 2 | 2020-09-03T17:46:31.000Z | 2021-08-08T02:15:56.000Z | sanic_template/error/exc.py | aragentum/sanic-template | c73c874e4612f0eaca8a6174999f76239b4a2078 | [
"MIT"
] | null | null | null | sanic_template/error/exc.py | aragentum/sanic-template | c73c874e4612f0eaca8a6174999f76239b4a2078 | [
"MIT"
] | null | null | null | from sanic.exceptions import SanicException, add_status_code
@add_status_code(400)
class SQLOperationException(SanicException):
pass
| 19.857143 | 60 | 0.834532 | 16 | 139 | 7 | 0.75 | 0.160714 | 0.232143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.024194 | 0.107914 | 139 | 6 | 61 | 23.166667 | 0.879032 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.25 | 0.25 | 0 | 0.5 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 5 |
617e9936a0e55bb2dd26d63454d15a34224bc7dd | 116 | py | Python | example0/ex.py | cjaques/pybind_examples | d0756e7150ef238e80020d5ce8d4c28c17d267e5 | [
"MIT"
] | 16 | 2019-02-18T14:46:36.000Z | 2022-02-19T18:28:28.000Z | example0/ex.py | cjaques/pybind_examples | d0756e7150ef238e80020d5ce8d4c28c17d267e5 | [
"MIT"
] | null | null | null | example0/ex.py | cjaques/pybind_examples | d0756e7150ef238e80020d5ce8d4c28c17d267e5 | [
"MIT"
] | 5 | 2018-05-03T00:28:29.000Z | 2022-02-10T10:59:38.000Z | import numpy as np
import example
a = np.ones((10,3))
b = np.ones((10,3))*3
c = example.add_arrays(a, b)
print(c)
| 12.888889 | 28 | 0.646552 | 25 | 116 | 2.96 | 0.56 | 0.162162 | 0.216216 | 0.243243 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.072165 | 0.163793 | 116 | 8 | 29 | 14.5 | 0.690722 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.166667 | 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 | 1 | 0 | 0 | 0 | 0 | 5 |
4ee973be808c5a952b221f7b2bb83001444b07ef | 219 | py | Python | public_html/API/util.py | jlambert23/COP4331 | 49ae9563d596d16d0aaa2095da43047f353b052c | [
"MIT"
] | null | null | null | public_html/API/util.py | jlambert23/COP4331 | 49ae9563d596d16d0aaa2095da43047f353b052c | [
"MIT"
] | null | null | null | public_html/API/util.py | jlambert23/COP4331 | 49ae9563d596d16d0aaa2095da43047f353b052c | [
"MIT"
] | null | null | null | import json
def throwErr(message):
print(json.dumps({'error': "" + message + ""}))
def getjson():
import sys
return json.load(sys.stdin)
def sendjson(message):
print(json.dumps(message))
| 16.846154 | 51 | 0.611872 | 26 | 219 | 5.153846 | 0.538462 | 0.179104 | 0.238806 | 0.313433 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.232877 | 219 | 12 | 52 | 18.25 | 0.797619 | 0 | 0 | 0 | 0 | 0 | 0.022831 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.375 | false | 0 | 0.25 | 0 | 0.75 | 0.25 | 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 | 1 | 0 | 0 | 5 |
f63ea86b11b24bf2e320d1ed2a671c2faa1a7fc3 | 14,632 | py | Python | autotest/t022_test.py | hansonmcoombs/flopy | 49398983c36d381992621d5bf698ea7f78fc0014 | [
"CC0-1.0",
"BSD-3-Clause"
] | null | null | null | autotest/t022_test.py | hansonmcoombs/flopy | 49398983c36d381992621d5bf698ea7f78fc0014 | [
"CC0-1.0",
"BSD-3-Clause"
] | null | null | null | autotest/t022_test.py | hansonmcoombs/flopy | 49398983c36d381992621d5bf698ea7f78fc0014 | [
"CC0-1.0",
"BSD-3-Clause"
] | null | null | null | # Test SWR binary read functionality
import os
import flopy
pth = os.path.join("..", "examples", "data", "swr_test")
files = (
"SWR004.stg",
"SWR004.flow",
"SWR004.vel",
"swr005.qaq",
"SWR004.str",
"SWR004.obs",
)
def test_swr_binary_stage(ipos=0):
fpth = os.path.join(pth, files[ipos])
sobj = flopy.utils.SwrStage(fpth)
assert isinstance(
sobj, flopy.utils.SwrStage
), "SwrStage object not created"
nrecords = sobj.get_nrecords()
assert nrecords == (18, 0), "SwrStage records does not equal (18, 0)"
ntimes = sobj.get_ntimes()
assert ntimes == 336, "SwrStage ntimes does not equal 336"
for idx in range(ntimes):
r = sobj.get_data(idx=idx)
assert (
r is not None
), "SwrStage could not read data with get_data(idx=)"
assert r.shape == (
18,
), "SwrStage stage data shape does not equal (18,)"
assert (
len(r.dtype.names) == 2
), "SwrStage stage data dtype does not have 2 entries"
kswrkstpkper = sobj.get_kswrkstpkper()
assert kswrkstpkper.shape == (
336,
3,
), "SwrStage kswrkstpkper shape does not equal (336, 3)"
for kkk in kswrkstpkper:
r = sobj.get_data(kswrkstpkper=kkk)
assert (
r is not None
), "SwrStage could not read data with get_data(kswrkstpkper=)"
assert r.shape == (
18,
), "SwrStage stage data shape does not equal (18,)"
assert (
len(r.dtype.names) == 2
), "SwrStage stage data dtype does not have 2 entries"
times = sobj.get_times()
assert len(times) == 336, "SwrStage times length does not equal 336"
for time in times:
r = sobj.get_data(totim=time)
assert (
r is not None
), "SwrStage could not read data with get_data(tottim=)"
assert r.shape == (
18,
), "SwrStage stage data shape does not equal (18,)"
assert (
len(r.dtype.names) == 2
), "SwrStage stage data dtype does not have 2 entries"
ts = sobj.get_ts(irec=17)
assert ts.shape == (
336,
), "SwrStage stage timeseries shape does not equal (336,)"
assert (
len(ts.dtype.names) == 2
), "SwrStage stage time series stage data dtype does not have 2 entries"
# plt.plot(ts['totim'], ts['stage'])
# plt.show()
return
def test_swr_binary_budget(ipos=1):
fpth = os.path.join(pth, files[ipos])
sobj = flopy.utils.SwrBudget(fpth)
assert isinstance(
sobj, flopy.utils.SwrBudget
), "SwrBudget object not created"
nrecords = sobj.get_nrecords()
assert nrecords == (18, 0), "SwrBudget records does not equal (18, 0)"
ntimes = sobj.get_ntimes()
assert ntimes == 336, "SwrBudget ntimes does not equal 336"
for idx in range(ntimes):
r = sobj.get_data(idx=idx)
assert (
r is not None
), "SwrBudget could not read data with get_data(idx=)"
assert r.shape == (
18,
), "SwrBudget budget data shape does not equal (18,)"
assert (
len(r.dtype.names) == 15
), "SwrBudget data dtype does not have 15 entries"
# plt.bar(range(18), r['inf-out'])
# plt.show()
kswrkstpkper = sobj.get_kswrkstpkper()
assert kswrkstpkper.shape == (
336,
3,
), "SwrBudget kswrkstpkper shape does not equal (336, 3)"
for kkk in kswrkstpkper:
r = sobj.get_data(kswrkstpkper=kkk)
assert (
r is not None
), "SwrBudget could not read data with get_data(kswrkstpkper=)"
assert r.shape == (
18,
), "SwrBudget budget data shape does not equal (18,)"
assert (
len(r.dtype.names) == 15
), "SwrBudget budget data dtype does not have 15 entries"
times = sobj.get_times()
assert len(times) == 336, "SwrBudget times length does not equal 336"
for time in times:
r = sobj.get_data(totim=time)
assert (
r is not None
), "SwrBudget could not read data with get_data(tottim=)"
assert r.shape == (
18,
), "SwrBudget budget data shape does not equal (18,)"
assert (
len(r.dtype.names) == 15
), "SwrBudget budget data dtype does not have 15 entries"
ts = sobj.get_ts(irec=17)
assert ts.shape == (
336,
), "SwrBudget budget timeseries shape does not equal (336,)"
assert (
len(ts.dtype.names) == 15
), "SwrBudget time series budget data dtype does not have 15 entries"
# plt.plot(ts['totim'], ts['qbcflow'])
# plt.show()
return
def test_swr_binary_qm(ipos=2):
fpth = os.path.join(pth, files[ipos])
sobj = flopy.utils.SwrFlow(fpth)
assert isinstance(sobj, flopy.utils.SwrFlow), "SwrFlow object not created"
nrecords = sobj.get_nrecords()
assert nrecords == (40, 18), "SwrFlow records does not equal (40, 18)"
connect = sobj.get_connectivity()
assert connect.shape == (
40,
3,
), "SwrFlow connectivity shape does not equal (40, 3)"
ntimes = sobj.get_ntimes()
assert ntimes == 336, "SwrFlow ntimes does not equal 336"
for idx in range(ntimes):
r = sobj.get_data(idx=idx)
assert r is not None, "SwrFlow could not read data with get_data(idx=)"
assert r.shape == (40,), "SwrFlow qm data shape does not equal (40,)"
assert (
len(r.dtype.names) == 3
), "SwrFlow qm data dtype does not have 3 entries"
# plt.bar(range(40), r['flow'])
# plt.show()
kswrkstpkper = sobj.get_kswrkstpkper()
assert kswrkstpkper.shape == (
336,
3,
), "SwrFlow kswrkstpkper shape does not equal (336, 3)"
for kkk in kswrkstpkper:
r = sobj.get_data(kswrkstpkper=kkk)
assert (
r is not None
), "SwrFlow could not read data with get_data(kswrkstpkper=)"
assert r.shape == (40,), "SwrFlow qm data shape does not equal (40,)"
assert (
len(r.dtype.names) == 3
), "SwrFlow qm data dtype does not have 3 entries"
times = sobj.get_times()
assert len(times) == 336, "SwrFlow times length does not equal 336"
for time in times:
r = sobj.get_data(totim=time)
assert (
r is not None
), "SwrFlow could not read data with get_data(tottim=)"
assert r.shape == (40,), "SwrFlow qm data shape does not equal (40,)"
assert (
len(r.dtype.names) == 3
), "SwrFlow qm data dtype does not have 3 entries"
ts = sobj.get_ts(irec=17, iconn=16)
assert ts.shape == (
336,
), "SwrFlow qm timeseries shape does not equal (336,)"
assert (
len(ts.dtype.names) == 3
), "SwrFlow time series qm data dtype does not have 3 entries"
ts2 = sobj.get_ts(irec=16, iconn=17)
assert ts2.shape == (
336,
), "SwrFlow qm timeseries shape does not equal (336,)"
assert (
len(ts2.dtype.names) == 3
), "SwrFlow time series qm data dtype does not have 3 entries"
# plt.plot(ts['totim'], ts['velocity'])
# plt.plot(ts2['totim'], ts2['velocity'])
# plt.show()
return
def test_swr_binary_qaq(ipos=3):
fpth = os.path.join(pth, files[ipos])
sobj = flopy.utils.SwrExchange(fpth, verbose=True)
assert isinstance(
sobj, flopy.utils.SwrExchange
), "SwrExchange object not created"
nrecords = sobj.get_nrecords()
assert nrecords == (19, 0), "SwrExchange records does not equal (19, 0)"
ntimes = sobj.get_ntimes()
assert ntimes == 350, "SwrExchange ntimes does not equal 350"
for idx in range(ntimes):
r = sobj.get_data(idx=idx)
assert (
r is not None
), "SwrExchange could not read data with get_data(idx=)"
assert r.shape == (
21,
), "SwrExchange qaq data shape does not equal (21,)"
assert (
len(r.dtype.names) == 11
), "SwrExchange qaq data dtype does not have 11 entries"
# plt.bar(range(21), r['qaq'])
# plt.show()
kswrkstpkper = sobj.get_kswrkstpkper()
assert kswrkstpkper.shape == (
350,
3,
), "SwrExchange kswrkstpkper shape does not equal (350, 3)"
for kkk in kswrkstpkper:
r = sobj.get_data(kswrkstpkper=kkk)
assert (
r is not None
), "SwrExchange could not read data with get_data(kswrkstpkper=)"
assert r.shape == (
21,
), "SwrExchange qaq data shape does not equal (21,)"
assert (
len(r.dtype.names) == 11
), "SwrExchange qaq data dtype does not have 11 entries"
times = sobj.get_times()
assert len(times) == 350, "SwrExchange times length does not equal 350"
for time in times:
r = sobj.get_data(totim=time)
assert (
r is not None
), "SwrExchange could not read data with get_data(tottim=)"
assert r.shape == (
21,
), "SwrExchange qaq data shape does not equal (21,)"
assert (
len(r.dtype.names) == 11
), "SwrExchange qaq data dtype does not have 11 entries"
ts = sobj.get_ts(irec=17, klay=0)
assert ts.shape == (
350,
), "SwrExchange timeseries shape does not equal (350,)"
assert (
len(ts.dtype.names) == 11
), "SwrExchange time series qaq data dtype does not have 11 entries"
# plt.plot(ts['totim'], ts['qaq'])
# plt.show()
return
def test_swr_binary_structure(ipos=4):
fpth = os.path.join(pth, files[ipos])
sobj = flopy.utils.SwrStructure(fpth, verbose=True)
assert isinstance(
sobj, flopy.utils.SwrStructure
), "SwrStructure object not created"
nrecords = sobj.get_nrecords()
assert nrecords == (18, 0), "SwrStructure records does not equal (18, 0)"
ntimes = sobj.get_ntimes()
assert ntimes == 336, "SwrStructure ntimes does not equal 336"
for idx in range(ntimes):
r = sobj.get_data(idx=idx)
assert (
r is not None
), "SwrStructure could not read data with get_data(idx=)"
assert r.shape == (
2,
), "SwrStructure structure data shape does not equal (2,)"
assert (
len(r.dtype.names) == 8
), "SwrStructure structure data dtype does not have 8 entries"
kswrkstpkper = sobj.get_kswrkstpkper()
assert kswrkstpkper.shape == (
336,
3,
), "SwrStructure kswrkstpkper shape does not equal (336, 3)"
for kkk in kswrkstpkper:
r = sobj.get_data(kswrkstpkper=kkk)
assert (
r is not None
), "SwrStructure could not read data with get_data(kswrkstpkper=)"
assert r.shape == (
2,
), "SwrStructure structure data shape does not equal (2,)"
assert (
len(r.dtype.names) == 8
), "SwrStructure structure data dtype does not have 8 entries"
times = sobj.get_times()
assert len(times) == 336, "SwrStructure times length does not equal 336"
for time in times:
r = sobj.get_data(totim=time)
assert (
r is not None
), "SwrStructure could not read data with get_data(tottim=)"
assert r.shape == (
2,
), "SwrStructure structure data shape does not equal (2,)"
assert (
len(r.dtype.names) == 8
), "SwrStructure structure data dtype does not have 8 entries"
ts = sobj.get_ts(irec=17, istr=0)
assert ts.shape == (
336,
), "SwrStructure timeseries shape does not equal (336,)"
assert (
len(ts.dtype.names) == 8
), "SwrStructure time series structure data dtype does not have 8 entries"
# plt.plot(ts['totim'], ts['strflow'])
# plt.show()
obs3 = sobj.get_ts(irec=17, istr=0)
return
def test_swr_binary_obs(ipos=5):
fpth = os.path.join(pth, files[ipos])
sobj = flopy.utils.SwrObs(fpth)
assert isinstance(sobj, flopy.utils.SwrObs), "SwrObs object not created"
nobs = sobj.get_nobs()
assert nobs == 9, "SwrObs numobs does not equal 9"
obsnames = sobj.get_obsnames()
assert len(obsnames) == 9, "SwrObs number of obsnames does not equal 9"
ntimes = sobj.get_ntimes()
assert ntimes == 336, "SwrObs numtimes does not equal 336"
times = sobj.get_times()
assert len(times) == 336, "SwrFile times length does not equal 336"
ts = sobj.get_data()
assert ts.shape == (
336,
), "SwrObs length of data array does not equal (336,)"
assert (
len(ts.dtype.names) == 10
), "SwrObs data does not have totim + 9 observations"
ts = sobj.get_data(obsname="OBS5")
assert ts.shape == (
336,
), "SwrObs length of data array does not equal (336,)"
assert (
len(ts.dtype.names) == 2
), "SwrObs data does not have totim + 1 observation"
# plt.plot(ts['totim'], ts['OBS5'])
# plt.show()
for idx in range(ntimes):
d = sobj.get_data(idx=idx)
assert d.shape == (
1,
), "SwrObs length of data array does not equal (1,)"
assert (
len(d.dtype.names) == nobs + 1
), "SwrObs data does not have nobs + 1"
for time in times:
d = sobj.get_data(totim=time)
assert d.shape == (
1,
), "SwrObs length of data array does not equal (1,)"
assert (
len(d.dtype.names) == nobs + 1
), "SwrObs data does not have nobs + 1"
# test get_dataframes()
try:
import pandas as pd
for idx in range(ntimes):
df = sobj.get_dataframe(idx=idx, timeunit="S")
assert isinstance(df, pd.DataFrame), "A DataFrame was not returned"
assert df.shape == (1, nobs + 1), "data shape is not (1, 10)"
for time in times:
df = sobj.get_dataframe(totim=time, timeunit="S")
assert isinstance(df, pd.DataFrame), "A DataFrame was not returned"
assert df.shape == (1, nobs + 1), "data shape is not (1, 10)"
df = sobj.get_dataframe(timeunit="S")
assert isinstance(df, pd.DataFrame), "A DataFrame was not returned"
assert df.shape == (336, nobs + 1), "data shape is not (336, 10)"
except ImportError:
print("pandas not available...")
return
if __name__ == "__main__":
test_swr_binary_obs()
test_swr_binary_stage()
test_swr_binary_budget()
test_swr_binary_qm()
test_swr_binary_qaq()
test_swr_binary_structure()
| 30.293996 | 79 | 0.587821 | 1,938 | 14,632 | 4.378741 | 0.074303 | 0.061867 | 0.070705 | 0.054089 | 0.813222 | 0.785883 | 0.745699 | 0.711289 | 0.676526 | 0.635635 | 0 | 0.039451 | 0.298387 | 14,632 | 482 | 80 | 30.356846 | 0.787162 | 0.03424 | 0 | 0.674797 | 0 | 0 | 0.339854 | 0.008151 | 0 | 0 | 0 | 0 | 0.276423 | 1 | 0.01626 | false | 0 | 0.01084 | 0 | 0.04336 | 0.00271 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 5 |
f64b0de484e60e1e3c084444c766e530a122c9f9 | 24 | py | Python | changes.py | ukBaz/webhook-test | 7846e9142bbe5ec1dc72c7b9644f845112acbeb1 | [
"MIT"
] | null | null | null | changes.py | ukBaz/webhook-test | 7846e9142bbe5ec1dc72c7b9644f845112acbeb1 | [
"MIT"
] | 1 | 2019-08-11T11:24:01.000Z | 2019-08-11T11:36:17.000Z | changes.py | ukBaz/webhook-test | 7846e9142bbe5ec1dc72c7b9644f845112acbeb1 | [
"MIT"
] | null | null | null | # Modification 1 for PR
| 12 | 23 | 0.75 | 4 | 24 | 4.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.052632 | 0.208333 | 24 | 1 | 24 | 24 | 0.894737 | 0.875 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
f6617544f8d05db53bea99258a6631436ac225b5 | 76 | py | Python | collectibles/collectible.py | csvoss/todo-collector | 51469a7471da062f0d991872cb932e20d642393e | [
"MIT"
] | null | null | null | collectibles/collectible.py | csvoss/todo-collector | 51469a7471da062f0d991872cb932e20d642393e | [
"MIT"
] | null | null | null | collectibles/collectible.py | csvoss/todo-collector | 51469a7471da062f0d991872cb932e20d642393e | [
"MIT"
] | 2 | 2018-03-27T01:09:38.000Z | 2021-07-02T00:55:55.000Z | class Collectible(object):
# TODO: write template methods here
pass
| 19 | 39 | 0.710526 | 9 | 76 | 6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.223684 | 76 | 3 | 40 | 25.333333 | 0.915254 | 0.434211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | 0 | 1 | 0 | true | 0.5 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 5 |
9c9c00d87ace682595041f97850134cfc4990758 | 36 | py | Python | tests/components/plex/__init__.py | domwillcode/home-assistant | f170c80bea70c939c098b5c88320a1c789858958 | [
"Apache-2.0"
] | 30,023 | 2016-04-13T10:17:53.000Z | 2020-03-02T12:56:31.000Z | tests/components/plex/__init__.py | jagadeeshvenkatesh/core | 1bd982668449815fee2105478569f8e4b5670add | [
"Apache-2.0"
] | 31,101 | 2020-03-02T13:00:16.000Z | 2022-03-31T23:57:36.000Z | tests/components/plex/__init__.py | jagadeeshvenkatesh/core | 1bd982668449815fee2105478569f8e4b5670add | [
"Apache-2.0"
] | 11,956 | 2016-04-13T18:42:31.000Z | 2020-03-02T09:32:12.000Z | """Tests for the Plex component."""
| 18 | 35 | 0.666667 | 5 | 36 | 4.8 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.138889 | 36 | 1 | 36 | 36 | 0.774194 | 0.805556 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
9ce83ec3e19a563e9b51d243cade1a1cd32c0896 | 42 | py | Python | 002-kernel-and-systemcall/hello_python.py | satoru-takeuchi/youtube-sample | bae4c675445ab3cd363a17f2d1b3433993ec5bbb | [
"MIT"
] | 5 | 2020-07-11T14:00:58.000Z | 2020-11-30T15:11:27.000Z | 002-kernel-and-systemcall/hello_python.py | satoru-takeuchi/youtube-sample | bae4c675445ab3cd363a17f2d1b3433993ec5bbb | [
"MIT"
] | null | null | null | 002-kernel-and-systemcall/hello_python.py | satoru-takeuchi/youtube-sample | bae4c675445ab3cd363a17f2d1b3433993ec5bbb | [
"MIT"
] | 1 | 2021-12-18T17:48:38.000Z | 2021-12-18T17:48:38.000Z | #!/usr/bin/python3
print("hello Python")
| 10.5 | 21 | 0.690476 | 6 | 42 | 4.833333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.026316 | 0.095238 | 42 | 3 | 22 | 14 | 0.736842 | 0.404762 | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 1 | 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 | 1 | 0 | 5 |
9ced749abde51d38bc6fffc1d4a2838ba56d0883 | 302 | py | Python | {{ cookiecutter.app_name }}/factories.py | epicserve/cookiecutter-django-base-app | 789afe726d2a14d980fb270147bfdc95c23df4bc | [
"BSD-3-Clause"
] | 1 | 2015-01-05T06:52:41.000Z | 2015-01-05T06:52:41.000Z | {{ cookiecutter.app_name }}/factories.py | epicserve/cookiecutter-django-base-app | 789afe726d2a14d980fb270147bfdc95c23df4bc | [
"BSD-3-Clause"
] | null | null | null | {{ cookiecutter.app_name }}/factories.py | epicserve/cookiecutter-django-base-app | 789afe726d2a14d980fb270147bfdc95c23df4bc | [
"BSD-3-Clause"
] | null | null | null | import factory
from . import models
class {{ cookiecutter.model_name }}Factory(factory.DjangoModelFactory):
FACTORY_FOR = models.{{ cookiecutter.model_name }}
title = factory.Sequence(lambda n: 'Title {0}'.format(n))
description = factory.Sequence(lambda n: 'Description {0}'.format(n))
| 30.2 | 73 | 0.725166 | 36 | 302 | 6 | 0.472222 | 0.157407 | 0.194444 | 0.203704 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007692 | 0.139073 | 302 | 9 | 74 | 33.555556 | 0.823077 | 0 | 0 | 0 | 0 | 0 | 0.07947 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.333333 | null | null | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
147ab2aa23abee91f81e86038f61990003431558 | 55 | py | Python | altair/vegalite/schema.py | zjffdu/altair | cd34b03ce011f16616f7c6c59a3c60436b679302 | [
"BSD-3-Clause"
] | 1 | 2021-03-10T00:36:53.000Z | 2021-03-10T00:36:53.000Z | altair/vegalite/schema.py | zjffdu/altair | cd34b03ce011f16616f7c6c59a3c60436b679302 | [
"BSD-3-Clause"
] | null | null | null | altair/vegalite/schema.py | zjffdu/altair | cd34b03ce011f16616f7c6c59a3c60436b679302 | [
"BSD-3-Clause"
] | 1 | 2017-08-23T17:52:59.000Z | 2017-08-23T17:52:59.000Z | """Altair schema wrappers"""
from .v2.schema import *
| 13.75 | 28 | 0.690909 | 7 | 55 | 5.428571 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021277 | 0.145455 | 55 | 3 | 29 | 18.333333 | 0.787234 | 0.4 | 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 | 1 | 0 | 0 | 5 |
1ad430b7e52fce76e235ec384ed7efa3efd1ac1b | 43 | py | Python | ilovethrice.py | Flowlesyewitahe/my-sister-is-yelling-while-i-am-coding | af1fda85a678583482d2842922f7a6c6f7ff263a | [
"Apache-2.0"
] | null | null | null | ilovethrice.py | Flowlesyewitahe/my-sister-is-yelling-while-i-am-coding | af1fda85a678583482d2842922f7a6c6f7ff263a | [
"Apache-2.0"
] | null | null | null | ilovethrice.py | Flowlesyewitahe/my-sister-is-yelling-while-i-am-coding | af1fda85a678583482d2842922f7a6c6f7ff263a | [
"Apache-2.0"
] | null | null | null | import time
import meow
meow
time.sleep(3)
| 8.6 | 13 | 0.790698 | 8 | 43 | 4.25 | 0.625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027027 | 0.139535 | 43 | 4 | 14 | 10.75 | 0.891892 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 5 |
212fe7eb567438c5285a05eaeab524dd48622597 | 2,718 | py | Python | tasrif/test_scripts/test_pipeline_SlidingWindowOperator.py | qcri/tasrif | 327bc1eccb8f8e11d8869ba65a7c72ad038aa094 | [
"BSD-3-Clause"
] | 20 | 2021-12-06T10:41:54.000Z | 2022-03-13T16:25:43.000Z | tasrif/test_scripts/test_pipeline_SlidingWindowOperator.py | qcri/tasrif | 327bc1eccb8f8e11d8869ba65a7c72ad038aa094 | [
"BSD-3-Clause"
] | 33 | 2021-12-06T08:27:18.000Z | 2022-03-14T05:07:53.000Z | tasrif/test_scripts/test_pipeline_SlidingWindowOperator.py | qcri/tasrif | 327bc1eccb8f8e11d8869ba65a7c72ad038aa094 | [
"BSD-3-Clause"
] | 2 | 2022-02-07T08:06:48.000Z | 2022-02-14T07:13:42.000Z | # +
import pandas as pd
from tasrif.processing_pipeline.custom import SlidingWindowOperator
df = pd.DataFrame(
[
["2020-02-16 11:45:00", 27, 102.5],
["2020-02-16 12:00:00", 27, 68.5],
["2020-02-16 12:15:00", 27, 40.0],
["2020-02-16 15:15:00", 27, 282.5],
["2020-02-16 15:30:00", 27, 275.0],
["2020-02-16 15:45:00", 27, 250.0],
["2020-02-16 16:00:00", 27, 235.0],
["2020-02-16 16:15:00", 27, 206.5],
["2020-02-16 16:30:00", 27, 191.0],
["2020-02-16 16:45:00", 27, 166.5],
["2020-02-16 17:00:00", 27, 171.5],
["2020-02-16 17:15:00", 27, 152.0],
["2020-02-16 17:30:00", 27, 124.0],
["2020-02-16 17:45:00", 27, 106.0],
["2020-02-16 18:00:00", 27, 96.5],
["2020-02-16 18:15:00", 27, 86.5],
["2020-02-16 18:30:00", 27, 78.0],
["2020-02-16 18:45:00", 27, 71.5],
["2020-02-16 19:00:00", 27, 64.5],
["2020-02-16 19:15:00", 27, 51.0],
["2020-02-16 19:30:00", 27, 50.666668],
["2020-02-16 19:45:00", 27, 41.0],
["2020-02-16 20:00:00", 27, 40.0],
["2020-02-16 20:15:00", 27, 40.0],
["2020-02-16 20:30:00", 27, 40.0],
["2020-02-16 14:45:00", 31, 125.0],
["2020-02-16 15:00:00", 31, 140.5],
["2020-02-16 15:15:00", 31, 183.0],
["2020-02-16 15:30:00", 31, 222.0],
["2020-02-16 15:45:00", 31, 234.5],
["2020-02-16 16:00:00", 31, 249.0],
["2020-02-16 16:15:00", 31, 245.5],
["2020-02-16 16:30:00", 31, 236.0],
["2020-02-16 16:45:00", 31, 223.0],
["2020-02-16 17:00:00", 31, 208.0],
["2020-02-16 17:15:00", 31, 194.0],
["2020-02-16 17:30:00", 31, 186.0],
["2020-02-16 17:45:00", 31, 177.0],
["2020-02-16 18:00:00", 31, 171.0],
["2020-02-16 18:15:00", 31, 164.0],
["2020-02-16 18:30:00", 31, 156.0],
["2020-02-16 18:45:00", 31, 157.0],
["2020-02-16 19:00:00", 31, 158.0],
["2020-02-16 19:15:00", 31, 158.5],
["2020-02-16 19:30:00", 31, 150.0],
["2020-02-16 19:45:00", 31, 145.0],
["2020-02-16 20:00:00", 31, 137.0],
["2020-02-16 20:15:00", 31, 141.0],
["2020-02-16 20:45:00", 31, 146.0],
["2020-02-16 21:00:00", 31, 141.0],
],
columns=["dateTime", "patientID", "CGM"],
)
df["dateTime"] = pd.to_datetime(df["dateTime"])
df
# +
op = SlidingWindowOperator(
winsize="1h15t",
time_col="dateTime",
label_col="CGM",
participant_identifier="patientID",
)
df_timeseries, df_labels, df_label_time, df_pids = op.process(df)[0]
df_timeseries
| 36.24 | 69 | 0.4805 | 504 | 2,718 | 2.569444 | 0.184524 | 0.23166 | 0.30888 | 0.236293 | 0.552124 | 0.502703 | 0.271042 | 0.040927 | 0 | 0 | 0 | 0.505327 | 0.274834 | 2,718 | 74 | 70 | 36.72973 | 0.1517 | 0.001104 | 0 | 0 | 0 | 0 | 0.383245 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.029851 | 0 | 0.029851 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
0d03016bfc357a0c430b8a7e2d7a97034e3eeb38 | 250 | py | Python | random_attendee.py | oakoneric/programmierung-ss19 | 819a789020d7e280b1cb54f14494674e6772adce | [
"MIT"
] | 9 | 2019-04-10T21:32:59.000Z | 2019-07-29T14:58:17.000Z | random_attendee.py | oakoneric/programmierung-ss19 | 819a789020d7e280b1cb54f14494674e6772adce | [
"MIT"
] | null | null | null | random_attendee.py | oakoneric/programmierung-ss19 | 819a789020d7e280b1cb54f14494674e6772adce | [
"MIT"
] | 1 | 2021-07-19T14:07:26.000Z | 2021-07-19T14:07:26.000Z | import random
print('-----------------------------------------------')
num = int(input('number of attendees: '))
print('the next task is reserved for student no. ' + str(random.randint(1,num)))
print('-----------------------------------------------') | 50 | 80 | 0.432 | 24 | 250 | 4.5 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004348 | 0.08 | 250 | 5 | 81 | 50 | 0.465217 | 0 | 0 | 0.4 | 0 | 0 | 0.625498 | 0.374502 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0.6 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
0d34b13772c5f53593d2a77ee5b045784d7cadf8 | 216 | py | Python | gammapy/catalog/__init__.py | QRemy/gammapy | fe799e8a8e792d216fdb11fb7abcb64d58f273dd | [
"BSD-3-Clause"
] | null | null | null | gammapy/catalog/__init__.py | QRemy/gammapy | fe799e8a8e792d216fdb11fb7abcb64d58f273dd | [
"BSD-3-Clause"
] | null | null | null | gammapy/catalog/__init__.py | QRemy/gammapy | fe799e8a8e792d216fdb11fb7abcb64d58f273dd | [
"BSD-3-Clause"
] | null | null | null | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Source catalogs."""
from .core import *
from .fermi import *
from .gammacat import *
from .hawc import *
from .hess import *
from .registry import *
| 24 | 63 | 0.722222 | 31 | 216 | 5.032258 | 0.645161 | 0.320513 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005587 | 0.171296 | 216 | 8 | 64 | 27 | 0.865922 | 0.365741 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
0d38607e07e5b0bdcf75c5cc5d3736d4f580ae8e | 89 | py | Python | phonotactics/onsets/__init__.py | shlomo-Kallner/coventreiya | aa0773693220025f8d2c23644a2c5d9d884773e9 | [
"Apache-2.0"
] | null | null | null | phonotactics/onsets/__init__.py | shlomo-Kallner/coventreiya | aa0773693220025f8d2c23644a2c5d9d884773e9 | [
"Apache-2.0"
] | null | null | null | phonotactics/onsets/__init__.py | shlomo-Kallner/coventreiya | aa0773693220025f8d2c23644a2c5d9d884773e9 | [
"Apache-2.0"
] | null | null | null |
__package__ = "onsets"
__all__ = [ "onsets" , "ver_1_5_1" , "ver_1_5_5" , "ver_1_5_7" ]
| 22.25 | 64 | 0.640449 | 16 | 89 | 2.5 | 0.4375 | 0.3 | 0.375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121622 | 0.168539 | 89 | 3 | 65 | 29.666667 | 0.418919 | 0 | 0 | 0 | 0 | 0 | 0.443182 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
b4c026c3867d8cc65b9b2ae93811b641d0abb47a | 2,626 | py | Python | cityyouthmatrix/apps/accounts/views.py | johnathaningle/CityYouthMatrix | b4ad244d92c97f3e20a923e18babf1ed1d278a87 | [
"MIT"
] | 1 | 2020-06-13T11:26:31.000Z | 2020-06-13T11:26:31.000Z | cityyouthmatrix/apps/accounts/views.py | jingle1000/CityYouthMatrix | b4ad244d92c97f3e20a923e18babf1ed1d278a87 | [
"MIT"
] | 2 | 2021-03-30T13:37:26.000Z | 2021-04-08T21:01:26.000Z | cityyouthmatrix/apps/accounts/views.py | johnathaningle/CityYouthMatrix | b4ad244d92c97f3e20a923e18babf1ed1d278a87 | [
"MIT"
] | null | null | null | from django.shortcuts import redirect, render, resolve_url
from django.contrib.auth.decorators import login_required
from django.http import HttpRequest
# Create your views here.
def login_success(request):
if request.user.is_anonymous:
return redirect('/')
if request.user.is_superuser:
return redirect('/admin')
try:
if request.user.driver:
return redirect('driver/driver')
else:
return redirect("family-info") #this needs to be changed
except:
return redirect("driver/driver")
def dispatcher(request: HttpRequest):
return render(request, "accounts/dispatcher/dispatcher.html")
def home(request: HttpRequest):
return render(request, "accounts/home.html")
def manage_drivers(request: HttpRequest):
return render(request, "accounts/dispatcher/manage-drivers.html")
def manage_families(request: HttpRequest):
return render(request, "accounts/dispatcher/manage-families.html")
def family_info(request: HttpRequest):
return render(request, "accounts/dispatcher/family-info.html")
def driver_info(request: HttpRequest):
return render(request, "accounts/dispatcher/driver-info.html")
def manage_trips(request: HttpRequest):
return render(request, "accounts/dispatcher/manage-trips.html")
def trip_info(request: HttpRequest):
return render(request, "accounts/dispatcher/trip-info.html")
def broadcast(request: HttpRequest):
return render(request, "accounts/dispatcher/broadcast.html")
def notifications(request: HttpRequest):
return render(request, "accounts/dispatcher/notifications.html")
def dispatcher_profile(request: HttpRequest):
return render(request, "accounts/dispatcher/profile.html")
def manage_rules(request: HttpRequest):
return render(request, "accounts/dispatcher/rules.html")
def new_trip(request: HttpRequest):
return render(request, "accounts/dispatcher/new-trip.html")
#driver views
@login_required(login_url="")
def driver(request: HttpRequest):
return render(request, "accounts/driver/driver.html")
@login_required(login_url="")
def driver_profile(request: HttpRequest):
return render(request, "accounts/driver/driver-profile.html")
@login_required(login_url="")
def driver_notifications(request: HttpRequest):
return render(request, "accounts/driver/notifications.html")
@login_required(login_url="")
def driver_site_rules(request: HttpRequest):
return render(request, "accounts/driver/site-rules.html")
@login_required(login_url="")
def driver_trip_info(request: HttpRequest):
return render(request, "accounts/driver/trip-info.html")
| 32.419753 | 70 | 0.756283 | 312 | 2,626 | 6.269231 | 0.176282 | 0.165644 | 0.220859 | 0.276074 | 0.628834 | 0.628834 | 0.590491 | 0.271472 | 0 | 0 | 0 | 0 | 0.12719 | 2,626 | 80 | 71 | 32.825 | 0.853403 | 0.022468 | 0 | 0.089286 | 0 | 0 | 0.250878 | 0.226687 | 0 | 0 | 0 | 0 | 0 | 1 | 0.339286 | false | 0 | 0.053571 | 0.321429 | 0.803571 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 5 |
b4c17f942fa059c7585a6643066701e9c0dd71e9 | 31 | py | Python | ui/custom_pb/__init__.py | magnusjwatson2786/pyDM | 0551a6365a07d336f7dd1d6713c3891954666278 | [
"MIT"
] | null | null | null | ui/custom_pb/__init__.py | magnusjwatson2786/pyDM | 0551a6365a07d336f7dd1d6713c3891954666278 | [
"MIT"
] | null | null | null | ui/custom_pb/__init__.py | magnusjwatson2786/pyDM | 0551a6365a07d336f7dd1d6713c3891954666278 | [
"MIT"
] | null | null | null | from . custompb import CustomPb | 31 | 31 | 0.83871 | 4 | 31 | 6.5 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.129032 | 31 | 1 | 31 | 31 | 0.962963 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 5 |
b4c63c54c056420a5ba181bbde6af71700a5fe18 | 37 | py | Python | loutilities/flask/user/__init__.py | louking/loutilities | 7a7bb27b09b8d6e3a411153b604858aaec397fc6 | [
"Apache-2.0"
] | 1 | 2020-03-16T12:47:08.000Z | 2020-03-16T12:47:08.000Z | loutilities/flask/user/__init__.py | louking/loutilities | 7a7bb27b09b8d6e3a411153b604858aaec397fc6 | [
"Apache-2.0"
] | 35 | 2015-07-11T14:57:30.000Z | 2022-03-12T00:53:44.000Z | loutilities/flask/user/__init__.py | louking/loutilities | 7a7bb27b09b8d6e3a411153b604858aaec397fc6 | [
"Apache-2.0"
] | null | null | null | from loutilities.user.tables import * | 37 | 37 | 0.837838 | 5 | 37 | 6.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.081081 | 37 | 1 | 37 | 37 | 0.911765 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 5 |
b4ed0e39bcbae9f1790f742d07466bd82c14d320 | 66 | py | Python | planningpoker/views/__init__.py | not-raspberry/planningpoker | 75113821d479f9973b41c39ad77940801c5e9525 | [
"MIT"
] | null | null | null | planningpoker/views/__init__.py | not-raspberry/planningpoker | 75113821d479f9973b41c39ad77940801c5e9525 | [
"MIT"
] | null | null | null | planningpoker/views/__init__.py | not-raspberry/planningpoker | 75113821d479f9973b41c39ad77940801c5e9525 | [
"MIT"
] | null | null | null | from planningpoker.views import status, moderator, player # noqa
| 33 | 65 | 0.80303 | 8 | 66 | 6.625 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.136364 | 66 | 1 | 66 | 66 | 0.929825 | 0.060606 | 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 | 1 | 0 | 0 | 5 |
3713c75621f670b4526bc031e734e4b7453a0c35 | 85 | py | Python | tccli/services/tiw/__init__.py | ivandksun/tencentcloud-cli-intl-en | 41b84e339918961b8bc92f7498e56347d21e16d3 | [
"Apache-2.0"
] | 47 | 2018-05-31T11:26:25.000Z | 2022-03-08T02:12:45.000Z | tccli/services/tiw/__init__.py | ivandksun/tencentcloud-cli-intl-en | 41b84e339918961b8bc92f7498e56347d21e16d3 | [
"Apache-2.0"
] | 23 | 2018-06-14T10:46:30.000Z | 2022-02-28T02:53:09.000Z | tccli/services/tiw/__init__.py | ivandksun/tencentcloud-cli-intl-en | 41b84e339918961b8bc92f7498e56347d21e16d3 | [
"Apache-2.0"
] | 22 | 2018-10-22T09:49:45.000Z | 2022-03-30T08:06:04.000Z | # -*- coding: utf-8 -*-
from tccli.services.tiw.tiw_client import action_caller
| 21.25 | 55 | 0.694118 | 12 | 85 | 4.75 | 0.916667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014085 | 0.164706 | 85 | 4 | 56 | 21.25 | 0.788732 | 0.247059 | 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 | 1 | 0 | 0 | 5 |
2e926f614d626aed0c3dfb6308c9fe3b7cc55ba6 | 48,035 | py | Python | tests/io/hdf_utils/test_model.py | sulaymandesai/pyUSID | fa4d152856e4717c92b1fbe34222eb2e1c042707 | [
"MIT"
] | null | null | null | tests/io/hdf_utils/test_model.py | sulaymandesai/pyUSID | fa4d152856e4717c92b1fbe34222eb2e1c042707 | [
"MIT"
] | null | null | null | tests/io/hdf_utils/test_model.py | sulaymandesai/pyUSID | fa4d152856e4717c92b1fbe34222eb2e1c042707 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 3 15:07:16 2017
@author: Suhas Somnath
"""
from __future__ import division, print_function, unicode_literals, absolute_import
import unittest
import os
import sys
import h5py
import numpy as np
import dask.array as da
import shutil
sys.path.append("../../pyUSID/")
from pyUSID.io import hdf_utils, write_utils, USIDataset
from tests.io import data_utils
if sys.version_info.major == 3:
unicode = str
class TestModel(unittest.TestCase):
def setUp(self):
data_utils.make_beps_file()
data_utils.make_sparse_sampling_file()
data_utils.make_incomplete_measurement_file()
data_utils.make_relaxation_file()
def tearDown(self):
for file_path in [data_utils.std_beps_path,
data_utils.sparse_sampling_path,
data_utils.incomplete_measurement_path,
data_utils.relaxation_path]:
data_utils.delete_existing_file(file_path)
class TestGetDimensionality(TestModel):
def test_legal_no_sort(self):
self.__helper_no_sort(hdf_dsets=True)
self.__helper_no_sort(hdf_dsets=False)
def __helper_no_sort(self, hdf_dsets=True):
with h5py.File(data_utils.std_beps_path, mode='r') as h5_f:
h5_dsets = [h5_f['/Raw_Measurement/Spectroscopic_Indices'],
h5_f['/Raw_Measurement/source_main-Fitter_000/Spectroscopic_Indices'],
h5_f['/Raw_Measurement/Position_Indices']]
expected_shapes = [[7, 2],
[7],
[5, 3]]
for h5_dset, exp_shape in zip(h5_dsets, expected_shapes):
if not hdf_dsets:
h5_dset = h5_dset[()]
self.assertTrue(np.all(exp_shape == hdf_utils.get_dimensionality(h5_dset)))
def test_legal_w_sort(self):
with h5py.File(data_utils.std_beps_path, mode='r') as h5_f:
h5_dsets = [h5_f['/Raw_Measurement/Spectroscopic_Indices'],
h5_f['/Raw_Measurement/source_main-Fitter_000/Spectroscopic_Indices'],
h5_f['/Raw_Measurement/Position_Indices']]
expected_shapes = [[2, 7],
[7],
[3, 5]]
sort_orders = [[1, 0],
[0],
[1, 0]]
for h5_dset, s_oder, exp_shape in zip(h5_dsets, sort_orders, expected_shapes):
self.assertTrue(np.all(exp_shape == hdf_utils.get_dimensionality(h5_dset, index_sort=s_oder)))
def test_not_hdf_dset(self):
for obj in [15, 'srds']:
with self.assertRaises(TypeError):
_ = hdf_utils.get_dimensionality(obj)
def test_invalid_sort(self):
with h5py.File(data_utils.std_beps_path, mode='r') as h5_f:
h5_dset = h5_f['/Raw_Measurement/Spectroscopic_Indices']
with self.assertRaises(ValueError):
_ = hdf_utils.get_dimensionality(h5_dset, index_sort=[3, 4])
_ = hdf_utils.get_dimensionality(h5_dset, index_sort=['a', np.arange(5)])
class TestGetSortOrder(TestModel):
def test_invalid_types(self):
with h5py.File(data_utils.std_beps_path, mode='r') as h5_f:
for obj in ['fdfdfd', h5_f]:
with self.assertRaises(TypeError):
_ = hdf_utils.get_sort_order(obj)
def test_simple(self):
with h5py.File(data_utils.std_beps_path, mode='r') as h5_f:
h5_dsets = [h5_f['/Raw_Measurement/Spectroscopic_Indices'],
h5_f['/Raw_Measurement/source_main-Fitter_000/Spectroscopic_Indices'],
h5_f['/Raw_Measurement/Position_Indices']]
expected_order = [[0, 1], [0], [0, 1]]
for h5_dset, exp_order in zip(h5_dsets, expected_order):
self.assertTrue(np.all(exp_order == hdf_utils.get_sort_order(h5_dset)))
def test_reversed(self):
with h5py.File(data_utils.std_beps_path, mode='r') as h5_f:
h5_dsets = [np.flipud(h5_f['/Raw_Measurement/Spectroscopic_Indices']),
h5_f['/Raw_Measurement/source_main-Fitter_000/Spectroscopic_Indices'],
np.fliplr(h5_f['/Raw_Measurement/Position_Indices'])]
expected_order = [[1, 0], [0], [1, 0]]
for h5_dset, exp_order in zip(h5_dsets, expected_order):
self.assertTrue(np.all(exp_order == hdf_utils.get_sort_order(h5_dset)))
class TestGetUnitValues(TestModel):
def test_source_spec_all(self):
with h5py.File(data_utils.std_beps_path, mode='r') as h5_f:
h5_inds = h5_f['/Raw_Measurement/Spectroscopic_Indices']
h5_vals = h5_f['/Raw_Measurement/Spectroscopic_Values']
expected = {}
for dim_name in ['Bias', 'Cycle']:
expected[dim_name] = h5_f['/Raw_Measurement/' + dim_name][()]
ret_val = hdf_utils.get_unit_values(h5_inds, h5_vals)
self.assertEqual(len(expected), len(ret_val))
for key, exp in expected.items():
self.assertTrue(np.allclose(exp, ret_val[key]))
def test_source_spec_all_explicit(self):
with h5py.File(data_utils.std_beps_path, mode='r') as h5_f:
h5_inds = h5_f['/Raw_Measurement/Spectroscopic_Indices']
h5_vals = h5_f['/Raw_Measurement/Spectroscopic_Values']
expected = {}
for dim_name in ['Bias', 'Cycle']:
expected[dim_name] = h5_f['/Raw_Measurement/' + dim_name][()]
ret_val = hdf_utils.get_unit_values(h5_inds, h5_vals, dim_names=['Cycle', 'Bias'])
self.assertEqual(len(expected), len(ret_val))
for key, exp in expected.items():
self.assertTrue(np.allclose(exp, ret_val[key]))
def test_illegal_key(self):
with h5py.File(data_utils.std_beps_path, mode='r') as h5_f:
h5_inds = h5_f['/Raw_Measurement/Spectroscopic_Indices']
h5_vals = h5_f['/Raw_Measurement/Spectroscopic_Values']
with self.assertRaises(KeyError):
_ = hdf_utils.get_unit_values(h5_inds, h5_vals, dim_names=['Cycle', 'Does not exist'])
def test_illegal_dset(self):
with h5py.File(data_utils.std_beps_path, mode='r') as h5_f:
h5_inds = h5_f['/Raw_Measurement/Spectroscopic_Indices']
h5_vals = h5_f['/Raw_Measurement/Ancillary']
with self.assertRaises(ValueError):
_ = hdf_utils.get_unit_values(h5_inds, h5_vals, dim_names=['Cycle', 'Bias'])
def test_source_spec_single(self):
with h5py.File(data_utils.std_beps_path, mode='r') as h5_f:
h5_inds = h5_f['/Raw_Measurement/Spectroscopic_Indices']
h5_vals = h5_f['/Raw_Measurement/Spectroscopic_Values']
expected = {'Bias': h5_f['/Raw_Measurement/Bias'][()]}
ret_val = hdf_utils.get_unit_values(h5_inds, h5_vals, dim_names='Bias')
self.assertEqual(len(expected), len(ret_val))
for key, exp in expected.items():
self.assertTrue(np.allclose(exp, ret_val[key]))
def test_source_pos_all(self):
with h5py.File(data_utils.std_beps_path, mode='r') as h5_f:
h5_inds = h5_f['/Raw_Measurement/Position_Indices']
h5_vals = h5_f['/Raw_Measurement/Position_Values']
expected = {}
for dim_name in ['X', 'Y']:
expected[dim_name] = h5_f['/Raw_Measurement/' + dim_name][()]
ret_val = hdf_utils.get_unit_values(h5_inds, h5_vals)
self.assertEqual(len(expected), len(ret_val))
for key, exp in expected.items():
self.assertTrue(np.allclose(exp, ret_val[key]))
def test_source_pos_single(self):
with h5py.File(data_utils.std_beps_path, mode='r') as h5_f:
h5_inds = h5_f['/Raw_Measurement/Position_Indices']
h5_vals = h5_f['/Raw_Measurement/Position_Values']
expected = {'Y': h5_f['/Raw_Measurement/Y'][()]}
ret_val = hdf_utils.get_unit_values(h5_inds, h5_vals, dim_names='Y')
self.assertEqual(len(expected), len(ret_val))
for key, exp in expected.items():
self.assertTrue(np.allclose(exp, ret_val[key]))
def test_all_dim_names_not_provided(self):
with h5py.File(data_utils.std_beps_path, mode='r') as h5_f:
h5_inds = h5_f['/Raw_Measurement/Position_Indices'][()]
h5_vals = h5_f['/Raw_Measurement/Position_Values'][()]
with self.assertRaises(TypeError):
_ = hdf_utils.get_unit_values(h5_inds, h5_vals, dim_names=['Y'])
def test_dependent_dim(self):
with h5py.File(data_utils.relaxation_path, mode='r') as h5_f:
h5_inds = h5_f['/Measurement_000/Channel_000/Spectroscopic_Indices']
h5_vals = h5_f['/Measurement_000/Channel_000/Spectroscopic_Values']
spec_dim_names = hdf_utils.get_attr(h5_inds, 'labels')
ret_dict = hdf_utils.get_unit_values(h5_inds, h5_vals)
for dim_ind, dim_name in enumerate(spec_dim_names):
exp_val = hdf_utils.get_attr(h5_inds, 'unit_vals_dim_' + str(dim_ind))
act_val = ret_dict[dim_name]
self.assertTrue(np.allclose(exp_val, act_val))
def test_sparse_samp_no_attr(self):
# What should the user expect this function to do? throw an error.
# Without the attribute, this function will have no idea that it is looking at a sparse sampling case
# it will return the first and second columns of vals blindly
with h5py.File(data_utils.sparse_sampling_path, mode='r') as h5_f:
h5_inds = h5_f['/Measurement_000/Channel_000/Position_Indices']
h5_vals = h5_f['/Measurement_000/Channel_000/Position_Values']
dim_names = hdf_utils.get_attr(h5_inds, 'labels')
ret_dict = hdf_utils.get_unit_values(h5_inds, h5_vals)
for dim_ind, dim_name in enumerate(dim_names):
exp_val = h5_vals[:, dim_ind]
act_val = ret_dict[dim_name]
self.assertTrue(np.allclose(exp_val, act_val))
def test_sparse_samp_w_attr(self):
# What should the user expect this function to do? throw an error.
with h5py.File(data_utils.sparse_sampling_path, mode='r') as h5_f:
h5_inds = h5_f['/Measurement_000/Channel_001/Position_Indices']
h5_vals = h5_f['/Measurement_000/Channel_001/Position_Values']
with self.assertRaises(ValueError):
_ = hdf_utils.get_unit_values(h5_inds, h5_vals, dim_names=['Y'])
def test_incomp_dim_no_attr(self):
# What should the user expect this function to do? throw an error.
# Given that the unit values for each tile are different, it should throw a ValueError for X.
# Even though we know Y is incomplete, it won't know since it wasn't looking at X.
# However, now this function will automatically find unit values for ALL dimensions just to catch such scenarios
with h5py.File(data_utils.incomplete_measurement_path, mode='r') as h5_f:
h5_inds = h5_f['/Measurement_000/Channel_000/Position_Indices']
h5_vals = h5_f['/Measurement_000/Channel_000/Position_Values']
with self.assertRaises(ValueError):
_ = hdf_utils.get_unit_values(h5_inds, h5_vals)
with self.assertRaises(ValueError):
_ = hdf_utils.get_unit_values(h5_inds, h5_vals, dim_names=['X'])
with self.assertRaises(ValueError):
_ = hdf_utils.get_unit_values(h5_inds, h5_vals, dim_names=['Y'])
class TestReshapeToNDims(TestModel):
def test_h5_already_sorted(self):
with h5py.File(data_utils.std_beps_path, mode='r') as h5_f:
nd_slow_to_fast = h5_f['/Raw_Measurement/n_dim_form'][()]
h5_main = h5_f['/Raw_Measurement/source_main']
# Data is always slowest to fastest
# Anc dims arranged from fastest to slowest
# Expecting data dims to be arranged according to anc dims order
n_dim, success, labels = hdf_utils.reshape_to_n_dims(h5_main, get_labels=True, sort_dims=False,
lazy=False, verbose=True)
self.assertTrue(np.all([x == y for x, y in zip(labels, ['X', 'Y', 'Bias', 'Cycle'])]))
self.assertTrue(success)
nd_fast_to_slow = nd_slow_to_fast.transpose(1, 0, 3, 2)
self.assertTrue(np.allclose(nd_fast_to_slow, n_dim))
# Anc dims arranged from fastest to slowest
# Expecting data dims to be arranged according to slow to fast
n_dim, success, labels = hdf_utils.reshape_to_n_dims(h5_main, get_labels=True, sort_dims=True,
lazy=False, verbose=True)
self.assertTrue(success)
self.assertTrue(np.all([x == y for x, y in zip(labels, ['Y', 'X', 'Cycle', 'Bias'])]))
self.assertTrue(np.allclose(nd_slow_to_fast, n_dim))
def test_h5_manually_provided_anc_dsets_h5(self):
with h5py.File(data_utils.std_beps_path, mode='r') as h5_f:
nd_slow_to_fast = h5_f['/Raw_Measurement/n_dim_form'][()]
nd_fast_to_slow = nd_slow_to_fast.transpose(1, 0, 3, 2)
exp_labs = ['X', 'Y', 'Bias', 'Cycle']
h5_main = h5_f['/Raw_Measurement/source_main']
h5_pos_inds = h5_f['/Raw_Measurement/Position_Indices']
h5_spec_inds = h5_f['/Raw_Measurement/Spectroscopic_Indices']
# BOTH POS AND SPEC
n_dim, success, labels = hdf_utils.reshape_to_n_dims(h5_main,
h5_pos=h5_pos_inds,
h5_spec=h5_spec_inds,
get_labels=True,
sort_dims=False,
lazy=False, verbose=True)
self.assertTrue(np.all([x == y for x, y in zip(labels, exp_labs)]))
self.assertTrue(success)
self.assertTrue(np.allclose(nd_fast_to_slow, n_dim))
# ONLY POS:
n_dim, success, labels = hdf_utils.reshape_to_n_dims(h5_main,
h5_pos=h5_pos_inds,
h5_spec=None,
get_labels=True,
sort_dims=False,
lazy=False,
verbose=True)
self.assertTrue(np.all([x == y for x, y in zip(labels, exp_labs)]))
self.assertTrue(success)
self.assertTrue(np.allclose(nd_fast_to_slow, n_dim))
# ONLY SPEC
n_dim, success, labels = hdf_utils.reshape_to_n_dims(h5_main,
h5_pos=None,
h5_spec=h5_spec_inds,
get_labels=True,
sort_dims=False,
lazy=False,
verbose=True)
self.assertTrue(np.all([x == y for x, y in zip(labels, exp_labs)]))
self.assertTrue(success)
self.assertTrue(np.allclose(nd_fast_to_slow, n_dim))
def test_h5_not_main_dset(self):
with h5py.File(data_utils.std_beps_path, mode='r') as h5_f:
h5_main = h5_f['/Raw_Measurement/Ancillary']
h5_pos = h5_f['/Raw_Measurement/Position_Indices']
h5_spec = h5_f['/Raw_Measurement/Spectroscopic_Indices']
# Not main
with self.assertRaises(ValueError):
_ = hdf_utils.reshape_to_n_dims(h5_main)
# Not main and not helping that we are supplign incompatible ancillary datasets
with self.assertRaises(ValueError):
_ = hdf_utils.reshape_to_n_dims(h5_main, h5_pos=h5_pos, h5_spec=h5_spec)
# main but we are supplign incompatible ancillary datasets
h5_main = h5_f['/Raw_Measurement/source_main-Fitter_000/results_main']
with self.assertRaises(ValueError):
_ = hdf_utils.reshape_to_n_dims(h5_main, h5_pos=h5_pos, h5_spec=h5_spec)
def build_main_anc_4d(self):
num_rows = 3
num_cols = 5
num_cycles = 2
num_cycle_pts = 7
# arrange as fast, slow
pos_inds = np.vstack((np.tile(np.arange(num_cols), num_rows),
np.repeat(np.arange(num_rows), num_cols))).T
# arrange as fast, slow
spec_inds = np.vstack((np.tile(np.arange(num_cycle_pts), num_cycles),
np.repeat(np.arange(num_cycles), num_cycle_pts)))
# Data is arranged from slowest to fastest
main_nd = np.zeros(shape=(num_rows, num_cols, num_cycles,
num_cycle_pts), dtype=np.uint8)
for row_ind in range(num_rows):
for col_ind in range(num_cols):
for cycle_ind in range(num_cycles):
# for bias_ind in range(num_cycle_pts):
val = 1E+3*row_ind + 1E+2*col_ind + 1E+1*cycle_ind + np.arange(num_cycle_pts)
main_nd[row_ind, col_ind, cycle_ind] = val
return main_nd, pos_inds, spec_inds
def base_comparison_4d(self, flip_pos_inds, flip_spec_inds, lazy_in=False,
lazy_out=False, verbose=False):
# Generated Data dims from slowest to fastest
exp_nd_s2f, pos_inds, spec_inds = self.build_main_anc_4d()
# nd (Y, X, Cycle, Bias)
main_2d = exp_nd_s2f.reshape(np.prod(exp_nd_s2f.shape[:2]),
np.prod(exp_nd_s2f.shape[2:]))
# Dimension names arranged from slowest to fastest
labs_s2f = ['Position Dimension 1', 'Position Dimension 0',
'Spectral Dimension 1', 'Spectral Dimension 0']
# Generated ancillary dimensions are arranged from fastest to slowest
# Unless any flipping is requested, as-is order should be fast to slow
as_is_nd_order = [1, 0, 3, 2]
# Unless any flipping is requested, s2f order is already in place
s2f_lab_order = [0, 1, 2, 3]
if flip_pos_inds:
# arranged as slow to fast
pos_inds = np.fliplr(pos_inds)
as_is_nd_order = as_is_nd_order[:2][::-1] + as_is_nd_order[2:]
s2f_lab_order = [1, 0] + s2f_lab_order[2:]
if flip_spec_inds:
# arranged as slow to fast
as_is_nd_order = as_is_nd_order[:2] + as_is_nd_order[2:][::-1]
s2f_lab_order = s2f_lab_order[:2] + [3, 2]
spec_inds = np.flipud(spec_inds)
if lazy_in:
main_2d = da.from_array(main_2d, chunks=main_2d.shape)
pos_inds = da.from_array(pos_inds, chunks=pos_inds.shape)
spec_inds = da.from_array(spec_inds, chunks=spec_inds.shape)
n_dim, suc, labs = hdf_utils.reshape_to_n_dims(main_2d,
h5_pos=pos_inds,
h5_spec=spec_inds, sort_dims=True,
get_labels=True,
lazy=lazy_out,
verbose=verbose)
if lazy_out:
self.assertIsInstance(n_dim, da.core.Array)
self.assertTrue(np.allclose(exp_nd_s2f, n_dim))
self.assertTrue(suc)
# labels were auto-generated and these will be flipped blindly
exp_labs = np.array(labs_s2f)[s2f_lab_order]
self.assertTrue(np.all([x == y for x, y in zip(labs, exp_labs)]))
if verbose:
print('~~~~~~~~~~~~~~~~~~~~~~ UNSORTED ~~~~~~~~~~~~~~~~~~~~~~~~~')
n_dim, suc, labs = hdf_utils.reshape_to_n_dims(main_2d,
h5_pos=pos_inds,
h5_spec=spec_inds,
sort_dims=False,
get_labels=True,
lazy=lazy_out,
verbose=verbose)
if lazy_out:
self.assertIsInstance(n_dim, da.core.Array)
# Rearrange the dim labels and N-dim form from slow-to-fast to:
if verbose:
print('N-dim order will be permuted as: {}'.format(as_is_nd_order))
print('Labels will be permuted as: {}'.format([1, 0, 3, 2]))
exp_nd = exp_nd_s2f.transpose(tuple(as_is_nd_order))
"""
This is sort of confusing:
No matter how the pos / spec dims are ordered, the names will always
start as P0, P1, S0, S1
"""
exp_labs = np.array(labs_s2f)[[1, 0, 3, 2]]
if verbose:
print('Expected N-dim shape: {} and labels: {}'
''.format(exp_nd.shape, exp_labs))
self.assertTrue(np.allclose(exp_nd, n_dim))
self.assertTrue(suc)
self.assertTrue(np.all([x == y for x, y in zip(labs, exp_labs)]))
def test_numpy_ordinary(self):
self.base_comparison_4d(False, False)
def test_dask_input(self):
self.base_comparison_4d(False, False, lazy_in=True, lazy_out=False)
def test_dask_output(self):
self.base_comparison_4d(False, False, lazy_in=False, lazy_out=True)
def test_dask_all(self):
self.base_comparison_4d(False, False, lazy_in=True, lazy_out=True)
def test_numpy_pos_inds_order_flipped(self):
self.base_comparison_4d(True, False)
def test_numpy_spec_inds_order_flipped(self):
# This is the same situation as in BEPS
self.base_comparison_4d(False, True)
def test_numpy_both_inds_order_flipped(self):
self.base_comparison_4d(True, True)
def test_dask_all_both_inds_order_flipped(self):
self.base_comparison_4d(True, True, lazy_in=True, lazy_out=True)
def build_main_anc_1_2d(self, is_2d=True, is_spec=False):
num_rows = 2
num_cols = 3
# arrange as fast, slow
pos_inds = np.vstack((np.tile(np.arange(num_cols), num_rows),
np.repeat(np.arange(num_rows), num_cols))).T
# Data is arranged from slowest to fastest
main_nd = np.random.randint(0, high=255, size=(num_rows, num_cols),
dtype=np.uint8)
if not is_2d:
pos_inds = np.expand_dims(np.arange(num_rows), axis=1)
main_nd = np.random.randint(0, high=255, size=num_rows,
dtype=np.uint8)
spec_inds= np.expand_dims([0], axis=0)
if is_spec:
return main_nd, spec_inds, pos_inds.T
return main_nd, pos_inds, spec_inds
def base_comparison_1_2d(self, is_2d, is_spec, flip_inds,
lazy_in=False, lazy_out=False):
# Data is always stored from fastest to slowest
# By default the ancillary dimensions are arranged from fastest to slowest
main_nd, pos_inds, spec_inds = self.build_main_anc_1_2d(is_2d=is_2d,
is_spec=is_spec)
main_2d = main_nd.reshape(-1, 1)
main_nd_w_sing = np.expand_dims(main_nd, axis=-1)
if is_spec:
main_2d = main_2d.T
main_nd_w_sing = np.expand_dims(main_nd, axis=0)
# nd (Y, X)
order = [1, 0, 2]
if is_spec:
order = [0, 2, 1]
if flip_inds:
# arranged as slow to fast
if is_spec:
spec_inds = np.flipud(spec_inds)
order = [0] + order[1:][::-1]
else:
pos_inds = np.fliplr(pos_inds)
order = order[:2][::-1] + [2]
print('2D: {}, Spec: {}, Flip: {}'.format(is_2d, is_spec, flip_inds))
print('Main data shapes ND: {}, 2D: {}'.format(main_nd.shape, main_2d.shape))
print(main_nd)
print(main_2d)
if lazy_in:
main_2d = da.from_array(main_2d, chunks=main_2d.shape)
n_dim, success = hdf_utils.reshape_to_n_dims(main_2d, h5_pos=pos_inds,
h5_spec=spec_inds,
sort_dims=True,
get_labels=False,
lazy=lazy_out,
verbose=True)
if lazy_out:
self.assertIsInstance(n_dim, da.core.Array)
self.assertTrue(np.allclose(main_nd_w_sing, n_dim))
print('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~')
n_dim, success = hdf_utils.reshape_to_n_dims(main_2d, h5_pos=pos_inds,
h5_spec=spec_inds,
sort_dims=False,
get_labels=False,
lazy=lazy_out,
verbose=True)
if lazy_out:
self.assertIsInstance(n_dim, da.core.Array)
if is_2d:
main_nd_w_sing = main_nd_w_sing.transpose(order)
self.assertTrue(np.allclose(main_nd_w_sing, n_dim))
def test_numpy_ordinary_1d_pos(self):
self.base_comparison_1_2d(False, False, False)
def test_dask_in_ordinary_1d_pos(self):
self.base_comparison_1_2d(False, False, False,
lazy_in=True, lazy_out=False)
def test_dask_out_ordinary_1d_pos(self):
self.base_comparison_1_2d(False, False, False,
lazy_in=False, lazy_out=True)
def test_dask_all_ordinary_1d_pos(self):
self.base_comparison_1_2d(False, False, False,
lazy_in=True, lazy_out=True)
def test_numpy_ordinary_1d_spec(self):
self.base_comparison_1_2d(False, True, False)
def test_dask_in_ordinary_1d_spec(self):
self.base_comparison_1_2d(False, True, False,
lazy_in=True, lazy_out=False)
def test_dask_out_ordinary_1d_spec(self):
self.base_comparison_1_2d(False, True, False,
lazy_in=False, lazy_out=True)
def test_dask_all_ordinary_1d_spec(self):
self.base_comparison_1_2d(False, True, False,
lazy_in=True, lazy_out=True)
def test_numpy_ordinary_2d_pos(self):
self.base_comparison_1_2d(True, False, False)
def test_numpy_ordinary_2d_spec(self):
self.base_comparison_1_2d(True, True, False)
def test_h5_both_inds_flipped(self):
# Flipping both the spec and pos dimensions means that the order in which
# the data is stored is the same order in which dimensions are arranged
# In other words, sort should make no difference at all!
file_path = 'reshape_to_n_dim_sort_required.h5'
data_utils.delete_existing_file(file_path)
with h5py.File(file_path, mode='w') as h5_f:
h5_raw_grp = h5_f.create_group('Raw_Measurement')
main_nd, source_pos_data, source_spec_data = self.build_main_anc_4d()
# arrange as slow, fast instead of fast, slow
source_pos_data = np.fliplr(source_pos_data)
# make spectroscopic slow, fast instead of fast, slow
source_spec_data = np.flipud(source_spec_data)
source_dset_name = 'source_main'
# Arrange from slow to fast
pos_attrs = {'units': ['nm', 'um'], 'labels': ['Y', 'X']}
#def build_ind_val_dsets(name, inds, attrs, is_spec):
h5_pos_inds = h5_raw_grp.create_dataset('Position_Indices', data=source_pos_data, dtype=np.uint16)
data_utils.write_aux_reg_ref(h5_pos_inds, pos_attrs['labels'], is_spec=False)
data_utils.write_string_list_as_attr(h5_pos_inds, pos_attrs)
h5_pos_vals = h5_raw_grp.create_dataset('Position_Values', data=source_pos_data, dtype=np.float32)
data_utils.write_aux_reg_ref(h5_pos_vals, pos_attrs['labels'], is_spec=False)
data_utils.write_string_list_as_attr(h5_pos_vals, pos_attrs)
source_main_data = main_nd.reshape(np.prod(main_nd.shape[:2]),
np.prod(main_nd.shape[2:]))
h5_source_main = h5_raw_grp.create_dataset(source_dset_name, data=source_main_data)
data_utils.write_safe_attrs(h5_source_main, {'units': 'A', 'quantity': 'Current'})
# Remember to set from slow to faset
source_spec_attrs = {'units': ['', 'V'], 'labels': ['Cycle', 'Bias']}
h5_source_spec_inds = h5_raw_grp.create_dataset('Spectroscopic_Indices', data=source_spec_data,
dtype=np.uint16)
data_utils.write_aux_reg_ref(h5_source_spec_inds, source_spec_attrs['labels'], is_spec=True)
data_utils.write_string_list_as_attr(h5_source_spec_inds, source_spec_attrs)
h5_source_spec_vals = h5_raw_grp.create_dataset('Spectroscopic_Values', data=source_spec_data,
dtype=np.float32)
data_utils.write_aux_reg_ref(h5_source_spec_vals, source_spec_attrs['labels'], is_spec=True)
data_utils.write_string_list_as_attr(h5_source_spec_vals, source_spec_attrs)
# Now need to link as main!
for dset in [h5_pos_inds, h5_pos_vals, h5_source_spec_inds, h5_source_spec_vals]:
h5_source_main.attrs[dset.name.split('/')[-1]] = dset.ref
n_dim, success, labels = hdf_utils.reshape_to_n_dims(h5_source_main, get_labels=True, sort_dims=True,
lazy=False, verbose=False)
self.assertTrue(np.all([x == y for x, y in zip(labels, ['Y', 'X', 'Cycle', 'Bias'])]))
self.assertTrue(np.allclose(main_nd, n_dim))
expected_n_dim = main_nd # np.transpose(main_nd, [1, 0, 3, 2])
n_dim, success, labels = hdf_utils.reshape_to_n_dims(
h5_source_main, get_labels=True, sort_dims=False,
lazy=False, verbose=False)
self.assertTrue(np.all([x == y for x, y in zip(labels, ['Y', 'X', 'Cycle', 'Bias'])]))
self.assertTrue(np.allclose(expected_n_dim, n_dim))
os.remove(file_path)
def test_h5_beps_field(self):
# Flipping both the spec and pos dimensions means that the order in which
# the data is stored is the same order in which dimensions are arranged
# In other words, sort should make no difference at all!
file_path = 'reshape_to_n_dim_sort_required.h5'
data_utils.delete_existing_file(file_path)
with h5py.File(file_path, mode='w') as h5_f:
h5_raw_grp = h5_f.create_group('Raw_Measurement')
num_rows = 3
num_cols = 5
num_fields = 2
num_cycle_pts = 7
# arrange as fast, slow
source_pos_data = np.vstack(
(np.tile(np.arange(num_cols), num_rows),
np.repeat(np.arange(num_rows), num_cols))).T
# arrange as fast, slow
source_spec_data = np.vstack(
(np.tile(np.arange(num_fields), num_cycle_pts),
np.repeat(np.arange(num_cycle_pts), num_fields),))
# Data is arranged from slowest to fastest
test = np.vstack((np.arange(num_cycle_pts) * -1 - 1,
np.arange(num_cycle_pts) + 1))
main_nd = np.zeros(
shape=(num_rows, num_cols, num_fields, num_cycle_pts),
dtype=np.float16)
for row_ind in range(num_rows):
for col_ind in range(num_cols):
main_nd[
row_ind, col_ind] = 1E+3 * row_ind + 1E+2 * col_ind + test
main_nd = main_nd.transpose(0, 1, 3, 2)
source_dset_name = 'source_main'
# Arrange from fast to slow
pos_attrs = {'units': ['nm', 'um'], 'labels': ['X', 'Y']}
h5_pos_inds = h5_raw_grp.create_dataset('Position_Indices',
data=source_pos_data,
dtype=np.uint16)
data_utils.write_aux_reg_ref(h5_pos_inds, pos_attrs['labels'],
is_spec=False)
data_utils.write_string_list_as_attr(h5_pos_inds, pos_attrs)
h5_pos_vals = h5_raw_grp.create_dataset('Position_Values',
data=source_pos_data,
dtype=np.float32)
data_utils.write_aux_reg_ref(h5_pos_vals, pos_attrs['labels'],
is_spec=False)
data_utils.write_string_list_as_attr(h5_pos_vals, pos_attrs)
source_main_data = main_nd.reshape(np.prod(main_nd.shape[:2]),
np.prod(main_nd.shape[2:]))
h5_source_main = h5_raw_grp.create_dataset(source_dset_name,
data=source_main_data)
data_utils.write_safe_attrs(h5_source_main,
{'units': 'A', 'quantity': 'Current'})
# Remember to set from fast to slow
source_spec_attrs = {'units': ['', 'V'],
'labels': ['Field', 'Bias']}
h5_source_spec_inds = h5_raw_grp.create_dataset(
'Spectroscopic_Indices', data=source_spec_data,
dtype=np.uint16)
data_utils.write_aux_reg_ref(h5_source_spec_inds,
source_spec_attrs['labels'],
is_spec=True)
data_utils.write_string_list_as_attr(h5_source_spec_inds,
source_spec_attrs)
h5_source_spec_vals = h5_raw_grp.create_dataset(
'Spectroscopic_Values', data=source_spec_data,
dtype=np.float32)
data_utils.write_aux_reg_ref(h5_source_spec_vals,
source_spec_attrs['labels'],
is_spec=True)
data_utils.write_string_list_as_attr(h5_source_spec_vals,
source_spec_attrs)
# Now need to link as main!
for dset in [h5_pos_inds, h5_pos_vals, h5_source_spec_inds,
h5_source_spec_vals]:
h5_source_main.attrs[dset.name.split('/')[-1]] = dset.ref
n_dim, success, labels = hdf_utils.reshape_to_n_dims(
h5_source_main, get_labels=True, sort_dims=True,
lazy=False, verbose=False)
self.assertTrue(np.all(
[x == y for x, y in zip(labels, ['Y', 'X', 'Bias', 'Field'])]))
self.assertTrue(np.allclose(main_nd, n_dim))
expected_n_dim = np.transpose(main_nd, [1, 0, 3, 2])
n_dim, success, labels = hdf_utils.reshape_to_n_dims(
h5_source_main, get_labels=True, sort_dims=False,
lazy=False, verbose=False)
self.assertTrue(np.all(
[x == y for x, y in zip(labels, ['X', 'Y', 'Field', 'Bias'])]))
self.assertTrue(np.allclose(expected_n_dim, n_dim))
os.remove(file_path)
class TestReshapeFromNDims(TestModel):
def test_pos_and_spec_provided(self):
num_rows = 3
num_cols = 5
num_cycles = 2
num_cycle_pts = 7
# the N dimensional dataset should be arranged in the following order:
# [positions slowest to fastest, spectroscopic slowest to fastest]
source_nd = np.zeros(shape=(num_rows, num_cols, num_cycles, num_cycle_pts), dtype=np.float16)
expected_2d = np.zeros(shape=(num_rows * num_cols, num_cycle_pts * num_cycles), dtype=np.float16)
for row_ind in range(num_rows):
for col_ind in range(num_cols):
for cycle_ind in range(num_cycles):
for bias_ind in range(num_cycle_pts):
val = 1E+3 * row_ind + 1E+2 * col_ind + 1E+1 * cycle_ind + bias_ind
expected_2d[row_ind * num_cols + col_ind, cycle_ind * num_cycle_pts + bias_ind] = val
source_nd[row_ind, col_ind, cycle_ind, bias_ind] = val
# case 1: Pos and Spec both arranged as slow to fast:
source_pos_data = np.vstack((np.repeat(np.arange(num_rows), num_cols),
np.tile(np.arange(num_cols), num_rows))).T
source_spec_data = np.vstack((np.repeat(np.arange(num_cycles), num_cycle_pts),
np.tile(np.arange(num_cycle_pts), num_cycles)))
ret_2d, success = hdf_utils.reshape_from_n_dims(source_nd, h5_pos=source_pos_data, h5_spec=source_spec_data)
self.assertTrue(success)
self.assertTrue(np.allclose(ret_2d, expected_2d))
# case 2: Only Pos arranged as slow to fast:
main_pos_sorted = np.transpose(source_nd, (0, 1, 3, 2))
source_pos_data = np.vstack((np.repeat(np.arange(num_rows), num_cols),
np.tile(np.arange(num_cols), num_rows))).T
source_spec_data = np.vstack((np.tile(np.arange(num_cycle_pts), num_cycles),
np.repeat(np.arange(num_cycles), num_cycle_pts),))
ret_2d, success = hdf_utils.reshape_from_n_dims(main_pos_sorted, h5_pos=source_pos_data,
h5_spec=source_spec_data)
self.assertTrue(success)
self.assertTrue(np.allclose(ret_2d, expected_2d))
# case 3: only Spec arranged as slow to fast:
main_spec_sorted = np.transpose(source_nd, (1, 0, 2, 3))
source_pos_data = np.vstack((np.tile(np.arange(num_cols), num_rows),
np.repeat(np.arange(num_rows), num_cols))).T
source_spec_data = np.vstack((np.repeat(np.arange(num_cycles), num_cycle_pts),
np.tile(np.arange(num_cycle_pts), num_cycles)))
ret_2d, success = hdf_utils.reshape_from_n_dims(main_spec_sorted, h5_pos=source_pos_data,
h5_spec=source_spec_data)
self.assertTrue(success)
self.assertTrue(np.allclose(ret_2d, expected_2d))
# case 4: neither pos nor spec arranged as slow to fast:
main_not_sorted = np.transpose(source_nd, (1, 0, 3, 2))
source_pos_data = np.vstack((np.tile(np.arange(num_cols), num_rows),
np.repeat(np.arange(num_rows), num_cols))).T
source_spec_data = np.vstack((np.tile(np.arange(num_cycle_pts), num_cycles),
np.repeat(np.arange(num_cycles), num_cycle_pts),))
ret_2d, success = hdf_utils.reshape_from_n_dims(main_not_sorted, h5_pos=source_pos_data,
h5_spec=source_spec_data)
self.assertTrue(success)
self.assertTrue(np.allclose(ret_2d, expected_2d))
def test_pos_and_spec_may_may_not_be_provided(self):
num_rows = 3
num_cols = 5
num_cycles = 2
num_cycle_pts = 7
# the N dimensional dataset should be arranged in the following order:
# [positions slowest to fastest, spectroscopic slowest to fastest]
source_nd = np.zeros(shape=(num_rows, num_cols, num_cycles, num_cycle_pts), dtype=np.float16)
expected_2d = np.zeros(shape=(num_rows * num_cols, num_cycle_pts * num_cycles), dtype=np.float16)
for row_ind in range(num_rows):
for col_ind in range(num_cols):
for cycle_ind in range(num_cycles):
for bias_ind in range(num_cycle_pts):
val = 1E+3 * row_ind + 1E+2 * col_ind + 1E+1 * cycle_ind + bias_ind
expected_2d[row_ind * num_cols + col_ind, cycle_ind * num_cycle_pts + bias_ind] = val
source_nd[row_ind, col_ind, cycle_ind, bias_ind] = val
source_pos_data = np.vstack((np.repeat(np.arange(num_rows), num_cols),
np.tile(np.arange(num_cols), num_rows))).T
source_spec_data = np.vstack((np.repeat(np.arange(num_cycles), num_cycle_pts),
np.tile(np.arange(num_cycle_pts), num_cycles)))
# case 1: only pos provided:
ret_2d, success = hdf_utils.reshape_from_n_dims(source_nd, h5_pos=source_pos_data)
self.assertTrue(success)
self.assertTrue(np.allclose(ret_2d, expected_2d))
# case 2: only spec provided:
ret_2d, success = hdf_utils.reshape_from_n_dims(source_nd, h5_spec=source_spec_data)
self.assertTrue(success)
self.assertTrue(np.allclose(ret_2d, expected_2d))
# case 3: neither pos nor spec provided:
with self.assertRaises(ValueError):
_ = hdf_utils.reshape_from_n_dims(source_nd)
class TestWriteMainDataset(TestModel):
def base_write(self, lazy_main=False, empty_main=False, pre_pos=False,
pre_spec=False, to_new_file=False):
file_path = 'test.h5'
new_file_path = 'new.h5'
data_utils.delete_existing_file(file_path)
main_data = np.random.rand(15, 14)
main_data_name = 'Test_Main'
quantity = 'Current'
dset_units = 'nA'
pos_sizes = [5, 3]
pos_names = ['X', 'Y']
pos_units = ['nm', 'um']
pos_dims = []
for length, name, units in zip(pos_sizes, pos_names, pos_units):
pos_dims.append(write_utils.Dimension(name, units, np.arange(length)))
pos_data = np.vstack((np.tile(np.arange(5), 3),
np.repeat(np.arange(3), 5))).T
spec_sizes = [7, 2]
spec_names = ['Bias', 'Cycle']
spec_units = ['V', '']
spec_dims = []
for length, name, units in zip(spec_sizes, spec_names, spec_units):
spec_dims.append(write_utils.Dimension(name, units, np.arange(length)))
spec_data = np.vstack((np.tile(np.arange(7), 2),
np.repeat(np.arange(2), 7)))
input_data = main_data
kwargs = {}
if lazy_main:
input_data = da.from_array(main_data, chunks=main_data.shape)
if empty_main:
input_data = main_data.shape
kwargs.update({'dtype': np.float16})
with h5py.File(file_path, mode='w') as h5_f:
if pre_spec:
h5_spec_inds, h5_spec_vals = hdf_utils.write_ind_val_dsets(
h5_f, spec_dims, is_spectral=True)
spec_dims = None
kwargs.update({'h5_spec_inds': h5_spec_inds,
'h5_spec_vals': h5_spec_vals})
if pre_pos:
h5_pos_inds, h5_pos_vals = hdf_utils.write_ind_val_dsets(h5_f,
pos_dims,
is_spectral=False)
pos_dims = None
kwargs.update({'h5_pos_inds': h5_pos_inds,
'h5_pos_vals': h5_pos_vals})
targ_loc = h5_f
if to_new_file:
h5_f_2 = h5py.File(new_file_path, mode='w')
targ_loc = h5_f_2
usid_main = hdf_utils.write_main_dataset(targ_loc, input_data, main_data_name, quantity, dset_units, pos_dims,
spec_dims, main_dset_attrs=None, slow_to_fast=False, verbose=True, **kwargs)
self.assertIsInstance(usid_main, USIDataset)
self.assertEqual(usid_main.name.split('/')[-1], main_data_name)
self.assertEqual(usid_main.parent, targ_loc)
if not empty_main:
self.assertTrue(np.allclose(main_data, usid_main[()]))
data_utils.validate_aux_dset_pair(self, targ_loc, usid_main.h5_pos_inds, usid_main.h5_pos_vals, pos_names, pos_units,
pos_data, h5_main=usid_main, is_spectral=False, slow_to_fast=False)
data_utils.validate_aux_dset_pair(self, targ_loc, usid_main.h5_spec_inds, usid_main.h5_spec_vals, spec_names, spec_units,
spec_data, h5_main=usid_main, is_spectral=True, slow_to_fast=False)
if to_new_file:
os.remove(new_file_path)
os.remove(file_path)
def test_numpy_small(self):
self.base_write()
def test_dask_small(self):
self.base_write(lazy_main=True)
def test_empty_main(self):
self.base_write(empty_main=True)
def test_write_main_existing_pos_aux(self):
self.base_write(pre_pos=True, pre_spec=False)
def test_write_main_existing_pos_aux_diff_file(self):
self.base_write(pre_pos=True, pre_spec=False, to_new_file=True)
def test_write_main_existing_spec_aux(self):
self.base_write(pre_pos=False, pre_spec=True)
def test_write_main_existing_spec_aux_diff_file(self):
self.base_write(pre_pos=False, pre_spec=True, to_new_file=True)
def test_write_main_both_existing_aux(self):
self.base_write(pre_pos=True, pre_spec=True)
def test_write_main_both_existing_aux_diff_file(self):
self.base_write(pre_pos=True, pre_spec=True, to_new_file=True)
def test_prod_sizes_mismatch(self):
file_path = 'test.h5'
data_utils.delete_existing_file(file_path)
main_data = np.random.rand(15, 14)
main_data_name = 'Test_Main'
quantity = 'Current'
dset_units = 'nA'
pos_sizes = [5, 15] # too many steps in the Y direction
pos_names = ['X', 'Y']
pos_units = ['nm', 'um']
pos_dims = []
for length, name, units in zip(pos_sizes, pos_names, pos_units):
pos_dims.append(write_utils.Dimension(name, units, np.arange(length)))
spec_sizes = [7, 2]
spec_names = ['Bias', 'Cycle']
spec_units = ['V', '']
spec_dims = []
for length, name, units in zip(spec_sizes, spec_names, spec_units):
spec_dims.append(write_utils.Dimension(name, units, np.arange(length)))
with h5py.File(file_path, mode='w') as h5_f:
with self.assertRaises(ValueError):
_ = hdf_utils.write_main_dataset(h5_f, main_data, main_data_name, quantity, dset_units, pos_dims,
spec_dims)
os.remove(file_path)
if __name__ == '__main__':
unittest.main()
| 47.939122 | 133 | 0.5771 | 6,324 | 48,035 | 4.036211 | 0.062302 | 0.010108 | 0.010343 | 0.029305 | 0.817003 | 0.779471 | 0.739393 | 0.701508 | 0.672439 | 0.65904 | 0 | 0.023279 | 0.3257 | 48,035 | 1,001 | 134 | 47.987013 | 0.764773 | 0.071719 | 0 | 0.51897 | 0 | 0 | 0.069287 | 0.046424 | 0 | 0 | 0 | 0 | 0.111111 | 1 | 0.084011 | false | 0 | 0.01355 | 0 | 0.111111 | 0.01355 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 5 |
2efc89bb6947e4617f353fcbc4a4133aef37f473 | 38 | py | Python | test.py | dickensas/demodatetime | f9d08b2d3b22ceb94fdb256a53097db5e5525514 | [
"MIT"
] | 2 | 2020-10-24T20:14:42.000Z | 2022-01-14T10:18:40.000Z | test.py | dickensas/demodatetime | f9d08b2d3b22ceb94fdb256a53097db5e5525514 | [
"MIT"
] | null | null | null | test.py | dickensas/demodatetime | f9d08b2d3b22ceb94fdb256a53097db5e5525514 | [
"MIT"
] | 1 | 2021-09-17T21:08:16.000Z | 2021-09-17T21:08:16.000Z | import myModule
myModule.helloworld() | 19 | 21 | 0.842105 | 4 | 38 | 8 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.078947 | 38 | 2 | 21 | 19 | 0.914286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 5 |
258d8d02d53a7773fde42703ba3efc7b573c73d1 | 3,416 | py | Python | application/common/httpclient.py | teomoney1999/fn_backend | ba10c1aa2a46a4b5bd3a51212eba335991b173b0 | [
"MIT"
] | null | null | null | application/common/httpclient.py | teomoney1999/fn_backend | ba10c1aa2a46a4b5bd3a51212eba335991b173b0 | [
"MIT"
] | null | null | null | application/common/httpclient.py | teomoney1999/fn_backend | ba10c1aa2a46a4b5bd3a51212eba335991b173b0 | [
"MIT"
] | null | null | null | import aiohttp
import asyncio
import ujson
import json as json_load
import requests
from gatco.response import json
from application.server import app
class HTTPClient(object):
# def __init__(self, url=None):
# pass
#self._url = url
@staticmethod
async def get(url, params=None, headers={}):
#resp = None
headers["Content-Type"] = "application/json"
async with aiohttp.ClientSession(headers=headers) as session:
async with session.get(url, params=params) as response:
if (response.status == 200) or (response.status == 201):
try:
resp = await response.json()
return resp
except:
return {"error_code": "HTTP_ERROR", "error_message": await response.text()}
else:
return {"error_code": "HTTP_ERROR", "error_message": await response.text()}
return {"error_code": "UNKNOWN_ERROR", "error_message": ""}
@staticmethod
async def post(url, data, headers={}):
#resp = None
# if not ("private_replies" in url):
headers["Content-Type"] = "application/json"
async with aiohttp.ClientSession(headers=headers, json_serialize=ujson.dumps) as session:
async with session.post(url, json=data) as response:
if (response.status == 200) or (response.status == 201):
try:
resp = await response.json()
return resp
except:
return {"error_code": "HTTP_ERROR", "error_message": await response.text()}
else:
return {"error_code": "HTTP_ERROR", "error_message": await response.text()}
return {"error_code": "UNKNOWN_ERROR", "error_message": ""}
@staticmethod
def sync_post(url, data, headers={}):
try:
requests.post(url, data=json_load.dumps(data), headers=headers)
return {'ok': True}
except:
return {'ok': False}
@staticmethod
async def put(url, data, headers={}):
#resp = None
headers["Content-Type"] = "application/json"
async with aiohttp.ClientSession(headers=headers, json_serialize=ujson.dumps) as session:
async with session.put(url, json=data) as response:
if (response.status == 200) or (response.status == 201):
resp = await response.json()
return resp
else:
return {"error_code": "HTTP_ERROR", "error_message": await response.text()}
return {"error_code": "UNKNOWN_ERROR", "error_message": "unknown_error"}
@staticmethod
async def delete(url, params=None, headers={}):
#resp = None
headers["Content-Type"] = "application/json"
async with aiohttp.ClientSession(headers=headers, json_serialize=ujson.dumps) as session:
async with session.delete(url, params=params) as response:
if (response.status == 200) or (response.status == 201):
resp = await response.json()
return resp
else:
return {"error_code": "HTTP_ERROR", "error_message": await response.text()}
return {"error_code": "UNKNOWN_ERROR", "error_message": ""}
| 41.658537 | 99 | 0.568501 | 358 | 3,416 | 5.304469 | 0.178771 | 0.068457 | 0.078989 | 0.060032 | 0.775671 | 0.747235 | 0.747235 | 0.747235 | 0.747235 | 0.747235 | 0 | 0.010287 | 0.317037 | 3,416 | 81 | 100 | 42.17284 | 0.803686 | 0.038349 | 0 | 0.661538 | 0 | 0 | 0.143773 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.015385 | false | 0 | 0.107692 | 0 | 0.384615 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 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 | 5 |
2591e75db33a366e50c9e1e036fe36736bd9b6f5 | 96 | py | Python | tests/conftest.py | ChrisPappalardo/python-devtools | fb0021b3e6815348a28c1d2bf11b50b8f0bd511a | [
"MIT"
] | 487 | 2017-08-21T11:59:24.000Z | 2022-03-30T09:39:55.000Z | tests/conftest.py | ChrisPappalardo/python-devtools | fb0021b3e6815348a28c1d2bf11b50b8f0bd511a | [
"MIT"
] | 92 | 2017-09-08T17:50:50.000Z | 2022-02-28T09:22:19.000Z | tests/conftest.py | ChrisPappalardo/python-devtools | fb0021b3e6815348a28c1d2bf11b50b8f0bd511a | [
"MIT"
] | 26 | 2019-07-26T15:36:00.000Z | 2022-03-31T11:59:39.000Z | import os
def pytest_sessionstart(session):
os.environ.pop('PY_DEVTOOLS_HIGHLIGHT', None)
| 16 | 49 | 0.770833 | 13 | 96 | 5.461538 | 0.923077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | 96 | 5 | 50 | 19.2 | 0.845238 | 0 | 0 | 0 | 0 | 0 | 0.21875 | 0.21875 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
2598f3376017cd77c56c77c1514b488b896a4022 | 191 | py | Python | office365/sharepoint/fields/field_multi_choice.py | theodoriss/Office365-REST-Python-Client | 3bd7a62dadcd3f0a0aceeaff7584fff3fd44886e | [
"MIT"
] | 544 | 2016-08-04T17:10:16.000Z | 2022-03-31T07:17:20.000Z | office365/sharepoint/fields/field_multi_choice.py | theodoriss/Office365-REST-Python-Client | 3bd7a62dadcd3f0a0aceeaff7584fff3fd44886e | [
"MIT"
] | 438 | 2016-10-11T12:24:22.000Z | 2022-03-31T19:30:35.000Z | office365/sharepoint/fields/field_multi_choice.py | theodoriss/Office365-REST-Python-Client | 3bd7a62dadcd3f0a0aceeaff7584fff3fd44886e | [
"MIT"
] | 202 | 2016-08-22T19:29:40.000Z | 2022-03-30T20:26:15.000Z | from office365.sharepoint.fields.field import Field
class FieldMultiChoice(Field):
"""Specifies a field (2) that contains one or more values from a set of specified values."""
pass
| 27.285714 | 96 | 0.748691 | 27 | 191 | 5.296296 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025316 | 0.172775 | 191 | 6 | 97 | 31.833333 | 0.879747 | 0.450262 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.333333 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 5 |
25d9ae6145952a23c1f2562b132ce916cf1467b7 | 36 | py | Python | tests/__init__.py | gpp-rnd/gpplot | 627a2feb398fe8de5539ee6d0ae3150079578a7a | [
"MIT"
] | 2 | 2020-06-19T19:35:14.000Z | 2020-07-22T17:24:02.000Z | tests/__init__.py | gpp-rnd/gpplot | 627a2feb398fe8de5539ee6d0ae3150079578a7a | [
"MIT"
] | 1 | 2020-08-23T21:47:57.000Z | 2020-08-23T21:47:57.000Z | tests/__init__.py | gpp-rnd/gpplot | 627a2feb398fe8de5539ee6d0ae3150079578a7a | [
"MIT"
] | null | null | null | """Unit test package for gpplot."""
| 18 | 35 | 0.666667 | 5 | 36 | 4.8 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.138889 | 36 | 1 | 36 | 36 | 0.774194 | 0.805556 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
25f6397805e4f929cfded83227fe22b77ab7f330 | 38 | py | Python | torch/distributed/_shard/sharding_plan/__init__.py | lkct/pytorch | ec62901a2c38b63d12843e0f079bdeb7644d8714 | [
"Intel"
] | null | null | null | torch/distributed/_shard/sharding_plan/__init__.py | lkct/pytorch | ec62901a2c38b63d12843e0f079bdeb7644d8714 | [
"Intel"
] | null | null | null | torch/distributed/_shard/sharding_plan/__init__.py | lkct/pytorch | ec62901a2c38b63d12843e0f079bdeb7644d8714 | [
"Intel"
] | null | null | null | from .api import (
ShardingPlan
)
| 9.5 | 18 | 0.657895 | 4 | 38 | 6.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.263158 | 38 | 3 | 19 | 12.666667 | 0.892857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 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 | 1 | 0 | 0 | 0 | 0 | 5 |
d335ce1175e84d687aac1c07426eb1c872cff61c | 120 | py | Python | sshsysmon/lib/plugins/__init__.py | zix99/sshsysmon | 091a28f2d28795f05e12a158bef22a10c87de8ff | [
"MIT"
] | 46 | 2016-03-13T20:57:24.000Z | 2022-03-21T13:37:04.000Z | sshsysmon/lib/plugins/__init__.py | zix99/sshmon | 091a28f2d28795f05e12a158bef22a10c87de8ff | [
"MIT"
] | 5 | 2016-03-15T10:00:54.000Z | 2021-04-30T01:41:02.000Z | sshsysmon/lib/plugins/__init__.py | zix99/sshmon | 091a28f2d28795f05e12a158bef22a10c87de8ff | [
"MIT"
] | 9 | 2016-09-23T09:37:31.000Z | 2021-05-11T11:26:46.000Z | from .driver import Driver
from .inspector import Inspector
from .channel import Channel
from .loader import loadPlugin | 24 | 32 | 0.833333 | 16 | 120 | 6.25 | 0.4375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.133333 | 120 | 5 | 33 | 24 | 0.961538 | 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 | 1 | 0 | 0 | 5 |
d372fc68d4c19f4295ea58429d8bbd9fdfc3437e | 177 | py | Python | quiz/models/__init__.py | manikagarg/iQuiz | 99b2550eeedb92134a631d71fdb017844f81ef78 | [
"MIT"
] | null | null | null | quiz/models/__init__.py | manikagarg/iQuiz | 99b2550eeedb92134a631d71fdb017844f81ef78 | [
"MIT"
] | null | null | null | quiz/models/__init__.py | manikagarg/iQuiz | 99b2550eeedb92134a631d71fdb017844f81ef78 | [
"MIT"
] | 1 | 2021-09-26T14:10:28.000Z | 2021-09-26T14:10:28.000Z | from .quiz import *
from .lti_user import *
from .question import *
from .response import *
from .outcome_service_data import *
from .oauth_nonce import *
from .answer import *
| 22.125 | 35 | 0.762712 | 25 | 177 | 5.24 | 0.52 | 0.458015 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.158192 | 177 | 7 | 36 | 25.285714 | 0.879195 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
d3a05faaadf1d86f12d9704bf4885fe804ee0a07 | 45 | py | Python | app/publisher/exceptions.py | petechd/eq-questionnaire-runner | 1c5b182a7f8bc878cfdd767ae080410fa679abd6 | [
"MIT"
] | 27 | 2015-10-02T17:27:54.000Z | 2021-04-05T12:39:16.000Z | app/publisher/exceptions.py | petechd/eq-questionnaire-runner | 1c5b182a7f8bc878cfdd767ae080410fa679abd6 | [
"MIT"
] | 1,836 | 2015-09-16T09:59:03.000Z | 2022-03-30T14:27:06.000Z | app/publisher/exceptions.py | petechd/eq-questionnaire-runner | 1c5b182a7f8bc878cfdd767ae080410fa679abd6 | [
"MIT"
] | 20 | 2016-09-09T16:56:12.000Z | 2021-11-12T06:09:27.000Z | class PublicationFailed(Exception):
pass
| 15 | 35 | 0.777778 | 4 | 45 | 8.75 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.155556 | 45 | 2 | 36 | 22.5 | 0.921053 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 5 |
6c9709748658d5cc69a8fd185e8f9860fb6c2c62 | 20 | py | Python | subtl/__init__.py | packetloop/subtl | 983f7647f3ca9d1bf3aa8dab38ff88b0a0fe4f5f | [
"BSD-3-Clause"
] | 1 | 2017-05-31T08:53:49.000Z | 2017-05-31T08:53:49.000Z | subtl/__init__.py | packetloop/subtl | 983f7647f3ca9d1bf3aa8dab38ff88b0a0fe4f5f | [
"BSD-3-Clause"
] | null | null | null | subtl/__init__.py | packetloop/subtl | 983f7647f3ca9d1bf3aa8dab38ff88b0a0fe4f5f | [
"BSD-3-Clause"
] | null | null | null | from subtl import *
| 10 | 19 | 0.75 | 3 | 20 | 5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | 20 | 1 | 20 | 20 | 0.9375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 5 |
6ce1958064b7f5a02834182e9979d4bcec213a33 | 31 | py | Python | by_requests/direct_scrappy.py | 118020071/bilibili_scrapper | 56e5c854bb141d34bf6b228aafcc3044e56906e9 | [
"Apache-2.0"
] | null | null | null | by_requests/direct_scrappy.py | 118020071/bilibili_scrapper | 56e5c854bb141d34bf6b228aafcc3044e56906e9 | [
"Apache-2.0"
] | null | null | null | by_requests/direct_scrappy.py | 118020071/bilibili_scrapper | 56e5c854bb141d34bf6b228aafcc3044e56906e9 | [
"Apache-2.0"
] | null | null | null | import requests, bs4, openpyxl
| 15.5 | 30 | 0.806452 | 4 | 31 | 6.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.037037 | 0.129032 | 31 | 1 | 31 | 31 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 5 |
9f0664fe4f446048650b3430a48faf8202e600bf | 774 | py | Python | src/comodash_api_client_lowlevel/test/test_query.py | ComotionLabs/dash-sdk | 8ab532dd58cbcb85969bb84503678cd54b3b2bfe | [
"Apache-2.0"
] | 1 | 2021-06-19T18:44:31.000Z | 2021-06-19T18:44:31.000Z | src/comodash_api_client_lowlevel/test/test_query.py | ComotionLabs/dash-sdk | 8ab532dd58cbcb85969bb84503678cd54b3b2bfe | [
"Apache-2.0"
] | null | null | null | src/comodash_api_client_lowlevel/test/test_query.py | ComotionLabs/dash-sdk | 8ab532dd58cbcb85969bb84503678cd54b3b2bfe | [
"Apache-2.0"
] | 3 | 2021-06-25T14:50:50.000Z | 2021-09-16T13:00:29.000Z | """
Comotion Dash API
Comotion Dash API # noqa: E501
The version of the OpenAPI document: 2.0
Generated by: https://openapi-generator.tech
"""
import sys
import unittest
import comodash_api_client_lowlevel
from comodash_api_client_lowlevel.model.query_status import QueryStatus
globals()['QueryStatus'] = QueryStatus
from comodash_api_client_lowlevel.model.query import Query
class TestQuery(unittest.TestCase):
"""Query unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def testQuery(self):
"""Test Query"""
# FIXME: construct object with mandatory attributes with example values
# model = Query() # noqa: E501
pass
if __name__ == '__main__':
unittest.main()
| 20.368421 | 79 | 0.686047 | 93 | 774 | 5.516129 | 0.548387 | 0.064327 | 0.099415 | 0.146199 | 0.152047 | 0.152047 | 0.152047 | 0 | 0 | 0 | 0 | 0.013356 | 0.226098 | 774 | 37 | 80 | 20.918919 | 0.843072 | 0.348837 | 0 | 0.2 | 1 | 0 | 0.040598 | 0 | 0 | 0 | 0 | 0.027027 | 0 | 1 | 0.2 | false | 0.2 | 0.333333 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 5 |
9f15782d17954c52a616a6d4d50c12cf70e4439a | 49 | py | Python | nexinfosys/ie_exports/ilcd_lca.py | MAGIC-nexus/nis-backend | dd425925321134f66884f60b202a59b38b7786a0 | [
"BSD-3-Clause"
] | 6 | 2019-05-31T23:02:30.000Z | 2022-01-07T22:56:50.000Z | nexinfosys/ie_exports/ilcd_lca.py | ENVIRO-Module/nis-backend | fd86cf30f79f53cdccddd2a5479507d32f914d4e | [
"BSD-3-Clause"
] | 2 | 2021-12-03T18:22:42.000Z | 2021-12-13T19:57:15.000Z | nexinfosys/ie_exports/ilcd_lca.py | ENVIRO-Module/nis-backend | fd86cf30f79f53cdccddd2a5479507d32f914d4e | [
"BSD-3-Clause"
] | 3 | 2019-04-05T16:45:09.000Z | 2021-03-17T12:05:44.000Z | """
Export to European LifeCycle Data (ELCD)
""" | 12.25 | 40 | 0.673469 | 6 | 49 | 5.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.163265 | 49 | 4 | 41 | 12.25 | 0.804878 | 0.816327 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
9f254da899f2fc731bc0abc721eb9e3bb20c2a17 | 405 | py | Python | mintools/minql/impl/sql/client.py | bitstein/elements-explorer | ec9e5caa1bc6f209d2fbcea9d9d240075b7a179e | [
"MIT"
] | null | null | null | mintools/minql/impl/sql/client.py | bitstein/elements-explorer | ec9e5caa1bc6f209d2fbcea9d9d240075b7a179e | [
"MIT"
] | null | null | null | mintools/minql/impl/sql/client.py | bitstein/elements-explorer | ec9e5caa1bc6f209d2fbcea9d9d240075b7a179e | [
"MIT"
] | null | null | null |
from ...interface import MinqlBaseClient
class SqlMinqlClient(MinqlBaseClient):
def update(self, table_name, row):
raise NotImplementedError
def insert(self, table_name, row):
raise NotImplementedError
def put(self, table_name, row):
if self._get(table_name, row['id']):
return self.update(table_name, row)
return self.insert(table_name, row)
| 23.823529 | 47 | 0.676543 | 48 | 405 | 5.5625 | 0.416667 | 0.202247 | 0.269663 | 0.179775 | 0.322097 | 0.322097 | 0.322097 | 0 | 0 | 0 | 0 | 0 | 0.22963 | 405 | 16 | 48 | 25.3125 | 0.855769 | 0 | 0 | 0.2 | 0 | 0 | 0.004951 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3 | false | 0 | 0.1 | 0 | 0.7 | 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 | 1 | 0 | 0 | 5 |
9f25db3c135d6a27d728058ea84b93fa007ca642 | 176 | py | Python | api/edge_api/identities/exceptions.py | SolidStateGroup/Bullet-Train-API | ea47ccbdadf665a806ae4e0eff6ad1a2f1b0ba19 | [
"BSD-3-Clause"
] | 126 | 2019-12-13T18:41:43.000Z | 2020-11-10T13:33:55.000Z | api/edge_api/identities/exceptions.py | SolidStateGroup/Bullet-Train-API | ea47ccbdadf665a806ae4e0eff6ad1a2f1b0ba19 | [
"BSD-3-Clause"
] | 30 | 2019-12-12T16:52:01.000Z | 2020-11-09T18:55:29.000Z | api/edge_api/identities/exceptions.py | SolidStateGroup/Bullet-Train-API | ea47ccbdadf665a806ae4e0eff6ad1a2f1b0ba19 | [
"BSD-3-Clause"
] | 20 | 2020-02-14T21:55:36.000Z | 2020-11-03T22:29:03.000Z | from rest_framework import status
from rest_framework.exceptions import APIException
class TraitPersistenceError(APIException):
status_code = status.HTTP_400_BAD_REQUEST
| 25.142857 | 50 | 0.857955 | 21 | 176 | 6.904762 | 0.666667 | 0.110345 | 0.234483 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019108 | 0.107955 | 176 | 6 | 51 | 29.333333 | 0.904459 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
9f638b6e74c30030ec1333193fcf82598a3da603 | 48 | py | Python | buildscripts/tests/resmokelib/powercycle/__init__.py | benety/mongo | 203430ac9559f82ca01e3cbb3b0e09149fec0835 | [
"Apache-2.0"
] | null | null | null | buildscripts/tests/resmokelib/powercycle/__init__.py | benety/mongo | 203430ac9559f82ca01e3cbb3b0e09149fec0835 | [
"Apache-2.0"
] | null | null | null | buildscripts/tests/resmokelib/powercycle/__init__.py | benety/mongo | 203430ac9559f82ca01e3cbb3b0e09149fec0835 | [
"Apache-2.0"
] | null | null | null | """Empty init file to make the linter happy."""
| 24 | 47 | 0.6875 | 8 | 48 | 4.125 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 48 | 1 | 48 | 48 | 0.825 | 0.854167 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
9f7bebac78f76b2da6cffc220fe92a37de56007d | 315 | py | Python | app/endpoints/__init__.py | H1bro/library | 0a444ba2be117a92dd3b881ff46bc7b38d0d8d71 | [
"BSD-2-Clause"
] | null | null | null | app/endpoints/__init__.py | H1bro/library | 0a444ba2be117a92dd3b881ff46bc7b38d0d8d71 | [
"BSD-2-Clause"
] | 1 | 2019-12-22T23:38:29.000Z | 2019-12-22T23:38:29.000Z | app/endpoints/__init__.py | H1bro/library | 0a444ba2be117a92dd3b881ff46bc7b38d0d8d71 | [
"BSD-2-Clause"
] | null | null | null |
from .library import books_blueprint
def register_blueprints_books(app):
app.register_blueprint(books_blueprint)
#####################################################
from .library import litterateurs_blueprint
def register_blueprints_litterateurs(app):
app.register_blueprint(litterateurs_blueprint)
| 22.5 | 53 | 0.695238 | 30 | 315 | 6.966667 | 0.333333 | 0.105263 | 0.162679 | 0.287081 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.092063 | 315 | 13 | 54 | 24.230769 | 0.730769 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.333333 | 0 | 0.666667 | 1 | 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 | 1 | 0 | 1 | 1 | 0 | 5 |
9fcc8142cdc65677928f5a3138aa3704a2068f1c | 28 | py | Python | spendee/__init__.py | dionysio/spendee | 6c66e528115d6219434607e46c2cc24e9fbeb790 | [
"MIT"
] | 12 | 2019-12-30T02:15:20.000Z | 2022-03-26T09:25:59.000Z | spendee/__init__.py | dionysio/spendee | 6c66e528115d6219434607e46c2cc24e9fbeb790 | [
"MIT"
] | 4 | 2020-12-02T19:52:32.000Z | 2021-11-15T11:16:24.000Z | spendee/__init__.py | dionysio/spendee | 6c66e528115d6219434607e46c2cc24e9fbeb790 | [
"MIT"
] | 3 | 2020-05-02T19:02:18.000Z | 2021-11-06T05:58:52.000Z | from .spendee import Spendee | 28 | 28 | 0.857143 | 4 | 28 | 6 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.107143 | 28 | 1 | 28 | 28 | 0.96 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 5 |
4c95064192269967b8601ad9c0fc50cb867e519d | 61 | py | Python | wgm/cli/privacybot/__init__.py | Skylaski-VPN/WireGuard-Gateway-Manager | 5cacbbc2318fdf662cd4793a786e3c7b9b74c5c4 | [
"MIT"
] | 1 | 2021-11-28T21:26:58.000Z | 2021-11-28T21:26:58.000Z | wgm/cli/privacybot/__init__.py | Skylaski-VPN/WireGuard-Gateway-Manager | 5cacbbc2318fdf662cd4793a786e3c7b9b74c5c4 | [
"MIT"
] | 2 | 2021-04-07T18:10:07.000Z | 2021-04-07T21:41:35.000Z | wgm/cli/privacybot/__init__.py | Skylaski-VPN/WireGuard-Gateway-Manager | 5cacbbc2318fdf662cd4793a786e3c7b9b74c5c4 | [
"MIT"
] | 2 | 2021-04-07T16:13:55.000Z | 2021-04-23T18:33:22.000Z | # Privacybot init
from .privacybot import get_repeer_list
| 10.166667 | 39 | 0.803279 | 8 | 61 | 5.875 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.163934 | 61 | 5 | 40 | 12.2 | 0.921569 | 0.245902 | 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 | 1 | 0 | 0 | 5 |
4cc438aa4aa7959412c380286a037b9fc8fa7ffb | 234 | py | Python | Lab_5/Test Task_3.py | spencerperley/CPE_101 | 9ae3c5a0042780f824de5edee275b35cdb0bbaec | [
"MIT"
] | 1 | 2022-01-12T21:48:23.000Z | 2022-01-12T21:48:23.000Z | Lab_5/Test Task_3.py | spencerperley/CPE_101 | 9ae3c5a0042780f824de5edee275b35cdb0bbaec | [
"MIT"
] | null | null | null | Lab_5/Test Task_3.py | spencerperley/CPE_101 | 9ae3c5a0042780f824de5edee275b35cdb0bbaec | [
"MIT"
] | null | null | null | from Task_3 import *
def testFilterPalendrome():
assert filter_pallendromes(["abdba","abcde","ddddd"]) == ["abdba","ddddd"]
assert filter_pallendromes(["abdka","abcde","dddkd"]) == []
testFilterPalendrome()
print("Pass") | 29.25 | 78 | 0.675214 | 23 | 234 | 6.73913 | 0.695652 | 0.154839 | 0.309677 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004878 | 0.123932 | 234 | 8 | 79 | 29.25 | 0.75122 | 0 | 0 | 0 | 0 | 0 | 0.187234 | 0 | 0 | 0 | 0 | 0 | 0.333333 | 1 | 0.166667 | true | 0.166667 | 0.166667 | 0 | 0.333333 | 0.166667 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 5 |
e2199daba72680167ccbc0335e5409f57084699d | 2,371 | py | Python | solutions/day3.py | qkleinfelter/AdventOfCode2021 | fdb72e35d3d8a0971b3f8914d4f9b034e6acbbc8 | [
"MIT"
] | null | null | null | solutions/day3.py | qkleinfelter/AdventOfCode2021 | fdb72e35d3d8a0971b3f8914d4f9b034e6acbbc8 | [
"MIT"
] | null | null | null | solutions/day3.py | qkleinfelter/AdventOfCode2021 | fdb72e35d3d8a0971b3f8914d4f9b034e6acbbc8 | [
"MIT"
] | null | null | null | from collections import Counter
def solution():
data = [x for x in open(r'inputs\day3.in').read().strip().split("\n")]
print('Part 1 result: ' + str(part1(data)))
print('Part 2 result: ' + str(part2(data)))
def part1(data):
gamma = ""
epsilon = ""
for i in range(len(data[0])):
# counts the amount of times each character appears at this bit in data
common = Counter([x[i] for x in data])
# more common bit goes into gamma, less common bit goes into epsilon
if common['0'] > common['1']:
gamma += "0"
epsilon += "1"
else:
gamma += "1"
epsilon += "0"
# convert gamma and epsilon from binary to decimal, and multiply for result
return int(gamma, 2) * int(epsilon, 2)
def part2(data):
oxygen = ""
co2 = ""
for i in range(len(data[0])):
# counts the amount of times each character appears at this bit in data
common = Counter([x[i] for x in data])
if common['0'] > common['1']:
# only keep pieces of data if there is a 0 at the current bit, since it is the most common here
data = [x for x in data if x[i] == '0']
else:
# only keep pieces of data if there is a 1 at the current bit, since it is the most common here
data = [x for x in data if x[i] == '1']
# stop when we only have 1 piece remaining
if len(data) == 1:
oxygen = data[0]
break
data = [x for x in open(r'inputs\day3.in').read().strip().split("\n")]
for i in range(len(data[0])):
# counts the amount of times each character appears at this bit in data
common = Counter([x[i] for x in data])
if common['0'] > common['1']:
# only keep pieces of data if there is a 0 at the current bit, since it is the least common here
data = [x for x in data if x[i] == '1']
else:
# only keep pieces of data if there is a 1 at the current bit, since it is the least common here
data = [x for x in data if x[i] == '0']
# stop when we only have 1 piece remaining
if len(data) == 1:
c02 = data[0]
break
# convert oxygen and c02 from binary to decimal, and multiply for result
return (int(oxygen, 2) * int(c02, 2))
solution() | 35.924242 | 108 | 0.561788 | 375 | 2,371 | 3.552 | 0.213333 | 0.045045 | 0.040541 | 0.052553 | 0.748499 | 0.736486 | 0.736486 | 0.736486 | 0.736486 | 0.736486 | 0 | 0.02884 | 0.327288 | 2,371 | 66 | 109 | 35.924242 | 0.80627 | 0.371573 | 0 | 0.536585 | 0 | 0 | 0.051421 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.073171 | false | 0 | 0.02439 | 0 | 0.146341 | 0.04878 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 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 | 5 |
e23248af07e5b6a53ce60bde9b5e82f3b6677bd3 | 20,738 | py | Python | pria_lifechem/models/stage_cross_validation.py | chao1224/pria_lifechem | 1fd892505a45695c6197f8d711a8a37589cd7097 | [
"MIT"
] | 5 | 2018-05-14T10:15:13.000Z | 2021-03-15T17:18:10.000Z | pria_lifechem/models/stage_cross_validation.py | chao1224/pria_lifechem | 1fd892505a45695c6197f8d711a8a37589cd7097 | [
"MIT"
] | 5 | 2018-05-05T21:04:11.000Z | 2019-06-24T22:05:35.000Z | pria_lifechem/models/stage_cross_validation.py | chao1224/pria_lifechem | 1fd892505a45695c6197f8d711a8a37589cd7097 | [
"MIT"
] | 2 | 2019-10-18T23:42:27.000Z | 2020-07-08T19:46:14.000Z | import argparse
import pandas as pd
import csv
import numpy as np
import json
import keras
import sys
from keras.models import Sequential
from keras.layers import Dense, Dropout
from keras.layers.normalization import BatchNormalization
from keras.optimizers import SGD, Adam
from sklearn.cross_validation import StratifiedShuffleSplit
from sklearn.grid_search import ParameterGrid
from pria_lifechem.function import *
from pria_lifechem.evaluation import *
from pria_lifechem.models.CallBacks import *
from pria_lifechem.models.deep_classification import *
from pria_lifechem.models.deep_regression import *
from pria_lifechem.models.vanilla_lstm import *
from pria_lifechem.models.tree_net import *
def run_single_classification(running_index, use_duplicate=False):
if running_index >= cross_validation_upper_bound:
raise ValueError('Process number out of limit. At most {}.'.format(cross_validation_upper_bound-1))
with open(config_json_file, 'r') as f:
conf = json.load(f)
label_name_list = conf['label_name_list']
print 'label_name_list ', label_name_list
# specify dataset
k = 5
directory = '../../dataset/fixed_dataset/fold_{}/'.format(k)
file_list = []
for i in range(k):
file_list.append('{}file_{}.csv'.format(directory, i))
file_list = np.array(file_list)
# read data
test_index = running_index / 4
val_index = running_index % 4 + (running_index % 4 >= test_index)
complete_index = np.arange(k)
train_index = np.where((complete_index != test_index) & (complete_index != val_index))[0]
print train_index
train_file_list = file_list[train_index]
val_file_list = file_list[val_index:val_index+1]
test_file_list = file_list[test_index:test_index+1]
print 'train files ', train_file_list
print 'val files ', val_file_list
print 'test files ', test_file_list
train_pd = filter_out_missing_values(read_merged_data(train_file_list), label_list=label_name_list)
val_pd = filter_out_missing_values(read_merged_data(val_file_list), label_list=label_name_list)
test_pd = filter_out_missing_values(read_merged_data(test_file_list), label_list=label_name_list)
# extract data, and split training data into training and val
X_train, y_train = extract_feature_and_label(train_pd,
feature_name='Fingerprints',
label_name_list=label_name_list)
X_val, y_val = extract_feature_and_label(val_pd,
feature_name='Fingerprints',
label_name_list=label_name_list)
X_test, y_test = extract_feature_and_label(test_pd,
feature_name='Fingerprints',
label_name_list=label_name_list)
print 'done data preparation'
if use_duplicate:
X_complement = []
y_complement = []
pos_count = 0
for index in range(y_train.shape[0]):
label = y_train[index, 0]
if label == 1:
pos_count += 1
for _ in range(500):
X_complement.append(X_train[index])
y_complement.append(y_train[index])
X_complement = np.array(X_complement)
y_complement = np.array(y_complement)
X_train = np.vstack((X_train, X_complement))
y_train = np.vstack((y_train, y_complement))
task = SingleClassification(conf=conf)
task.train_and_predict(X_train, y_train, X_val, y_val, X_test, y_test, PMTNN_weight_file)
store_data(transform_json_to_csv(config_json_file), config_csv_file)
return
def run_single_regression(running_index):
if running_index >= cross_validation_upper_bound:
raise ValueError('Process number out of limit. At most {}.'.format(cross_validation_upper_bound-1))
with open(config_json_file, 'r') as f:
conf = json.load(f)
label_name_list = conf['label_name_list']
print 'label_name_list ', label_name_list
# specify dataset
k = 5
directory = '../../dataset/fixed_dataset/fold_{}/'.format(k)
file_list = []
for i in range(k):
file_list.append('{}file_{}.csv'.format(directory, i))
file_list = np.array(file_list)
# read data
test_index = running_index / 4
val_index = running_index % 4 + (running_index % 4 >= test_index)
complete_index = np.arange(k)
train_index = np.where((complete_index != test_index) & (complete_index != val_index))[0]
print train_index
train_file_list = file_list[train_index]
val_file_list = file_list[val_index:val_index+1]
test_file_list = file_list[test_index:test_index+1]
print 'train files ', train_file_list
print 'val files ', val_file_list
print 'test files ', test_file_list
train_pd = filter_out_missing_values(read_merged_data(train_file_list), label_list=label_name_list)
val_pd = filter_out_missing_values(read_merged_data(val_file_list), label_list=label_name_list)
test_pd = filter_out_missing_values(read_merged_data(test_file_list), label_list=label_name_list)
# extract data, and split training data into training and val
X_train, y_train = extract_feature_and_label(train_pd,
feature_name='Fingerprints',
label_name_list=label_name_list)
X_val, y_val = extract_feature_and_label(val_pd,
feature_name='Fingerprints',
label_name_list=label_name_list)
X_test, y_test = extract_feature_and_label(test_pd,
feature_name='Fingerprints',
label_name_list=label_name_list)
y_train_classification = reshape_data_into_2_dim(y_train[:, 0])
y_train_regression = reshape_data_into_2_dim(y_train[:, 1])
y_val_classification = reshape_data_into_2_dim(y_val[:, 0])
y_val_regression = reshape_data_into_2_dim(y_val[:, 1])
y_test_classification = reshape_data_into_2_dim(y_test[:, 0])
y_test_regression = reshape_data_into_2_dim(y_test[:, 1])
print 'done data preparation'
task = SingleRegression(conf=conf)
task.train_and_predict(X_train, y_train_regression, y_train_classification,
X_val, y_val_regression, y_val_classification,
X_test, y_test_regression, y_test_classification,
PMTNN_weight_file)
store_data(transform_json_to_csv(config_json_file), config_csv_file)
return
def run_vanilla_lstm(running_index):
if running_index >= cross_validation_upper_bound:
raise ValueError('Process number out of limit. At most {}.'.format(cross_validation_upper_bound-1))
with open(config_json_file, 'r') as f:
conf = json.load(f)
label_name_list = conf['label_name_list']
print 'label_name_list ', label_name_list
# specify dataset
k = 5
directory = '../../dataset/fixed_dataset/fold_{}/'.format(k)
file_list = []
for i in range(k):
file_list.append('{}file_{}.csv'.format(directory, i))
file_list = np.array(file_list)
# read data
test_index = running_index / 4
val_index = running_index % 4 + (running_index % 4 >= test_index)
complete_index = np.arange(k)
train_index = np.where((complete_index != test_index) & (complete_index != val_index))[0]
print train_index
train_file_list = file_list[train_index]
val_file_list = file_list[val_index:val_index + 1]
test_file_list = file_list[test_index:test_index + 1]
print 'train files ', train_file_list
print 'val files ', val_file_list
print 'test files ', test_file_list
# TODO: No validation set for LSTM, may merge with train set
train_pd = filter_out_missing_values(read_merged_data(train_file_list), label_list=label_name_list)
val_pd = filter_out_missing_values(read_merged_data(val_file_list), label_list=label_name_list)
test_pd = filter_out_missing_values(read_merged_data(test_file_list), label_list=label_name_list)
# extract data, and split training data into training and val
X_train, y_train = extract_SMILES_and_label(train_pd,
feature_name='SMILES',
label_name_list=label_name_list,
SMILES_mapping_json_file=SMILES_mapping_json_file)
X_val, y_val = extract_SMILES_and_label(val_pd,
feature_name='SMILES',
label_name_list=label_name_list,
SMILES_mapping_json_file=SMILES_mapping_json_file)
X_test, y_test = extract_SMILES_and_label(test_pd,
feature_name='SMILES',
label_name_list=label_name_list,
SMILES_mapping_json_file=SMILES_mapping_json_file)
print 'done data preparation'
task = VanillaLSTM(conf)
X_train = sequence.pad_sequences(X_train, maxlen=task.padding_length)
X_val = sequence.pad_sequences(X_val, maxlen=task.padding_length)
X_test = sequence.pad_sequences(X_test, maxlen=task.padding_length)
task.train_and_predict(X_train, y_train, X_val, y_val, X_test, y_test, PMTNN_weight_file)
store_config(conf, config_csv_file)
return
def run_tree_net(running_index):
if running_index >= cross_validation_upper_bound:
raise ValueError('Process number out of limit. At most {}.'.format(cross_validation_upper_bound-1))
with open(config_json_file, 'r') as f:
conf = json.load(f)
label_name_list = conf['label_name_list']
print 'label_name_list ', label_name_list
k = 5
directory = '../../dataset/fixed_dataset/fold_{}/'.format(k)
file_list = []
for i in range(k):
file_list.append('{}file_{}.csv'.format(directory, i))
file_list = np.array(file_list)
# read data
test_index = running_index / 4
val_index = running_index % 4 + (running_index % 4 >= test_index)
complete_index = np.arange(k)
train_index = np.where((complete_index != test_index) & (complete_index != val_index))[0]
print train_index
train_file_list = file_list[train_index]
val_file_list = file_list[val_index:val_index+1]
test_file_list = file_list[test_index:test_index+1]
print 'train files ', train_file_list
print 'val files ', val_file_list
print 'test files ', test_file_list
train_pd = read_merged_data(train_file_list)
val_pd = read_merged_data(val_file_list)
test_pd = read_merged_data(test_file_list)
# extract data, and split training data into training and val
X_train, y_train = extract_feature_and_label(train_pd,
feature_name='Fingerprints',
label_name_list=label_name_list)
X_val, y_val = extract_feature_and_label(val_pd,
feature_name='Fingerprints',
label_name_list=label_name_list)
X_test, y_test = extract_feature_and_label(test_pd,
feature_name='Fingerprints',
label_name_list=label_name_list)
y_train_classification = reshape_data_into_2_dim(y_train[:, 0])
y_train_regression = reshape_data_into_2_dim(y_train[:, 1])
y_val_classification = reshape_data_into_2_dim(y_val[:, 0])
y_val_regression = reshape_data_into_2_dim(y_val[:, 1])
y_test_classification = reshape_data_into_2_dim(y_test[:, 0])
y_test_regression = reshape_data_into_2_dim(y_test[:, 1])
print 'done data preparation'
task = TreeNet(conf)
task.train_and_predict_ensemble(X_train, y_train_regression, y_train_classification,
X_val, y_val_regression, y_val_classification,
X_test, y_test_regression, y_test_classification,
PMTNN_weight_file)
return
def run_multiple_classification(running_index):
if running_index >= cross_validation_upper_bound:
raise ValueError('Process number out of limit. At most {}.'.format(cross_validation_upper_bound-1))
with open(config_json_file, 'r') as f:
conf = json.load(f)
label_name_list = conf['label_name_list']
print 'label_name_list ', label_name_list
# specify dataset
k = 5
directory = '../../dataset/keck_pcba/fold_{}/'.format(k)
file_list = []
for i in range(k):
file_list.append('{}file_{}.csv'.format(directory, i))
file_list = np.array(file_list)
# read data
test_index = running_index / 4
val_index = running_index % 4 + (running_index % 4 >= test_index)
complete_index = np.arange(k)
train_index = np.where((complete_index != test_index) & (complete_index != val_index))[0]
print train_index
train_file_list = file_list[train_index]
val_file_list = file_list[val_index:val_index + 1]
test_file_list = file_list[test_index:test_index + 1]
print 'train files ', train_file_list
print 'val files ', val_file_list
print 'test files ', test_file_list
train_pd = read_merged_data(train_file_list)
train_pd.fillna(0, inplace=True)
val_pd = read_merged_data(val_file_list)
val_pd.fillna(0, inplace=True)
# TODO: may only consider Keck label
test_pd = read_merged_data(test_file_list)
test_pd.fillna(0, inplace=True)
multi_name_list = train_pd.columns[-128:].tolist()
multi_name_list.extend(label_name_list)
print 'multi_name_list ', multi_name_list
X_train, y_train = extract_feature_and_label(train_pd,
feature_name='Fingerprints',
label_name_list=multi_name_list)
X_val, y_val = extract_feature_and_label(val_pd,
feature_name='Fingerprints',
label_name_list=multi_name_list)
X_test, y_test = extract_feature_and_label(test_pd,
feature_name='Fingerprints',
label_name_list=multi_name_list)
sample_weight_dir = '../../dataset/sample_weights/keck_pcba/fold_5/'
file_list = []
for i in range(k):
file_list.append('sample_weight_{}.csv'.format(i))
sample_weight_file = [sample_weight_dir + f_ for f_ in file_list]
sample_weight_file = np.array(sample_weight_file)
sample_weight_pd = read_merged_data(sample_weight_file[train_index])
_, sample_weight = extract_feature_and_label(sample_weight_pd,
feature_name='Fingerprints',
label_name_list=multi_name_list)
print 'done data preparation'
task = MultiClassification(conf=conf)
task.train_and_predict(X_train, y_train, X_val, y_val, X_test, y_test,
sample_weight=sample_weight,
PMTNN_weight_file=PMTNN_weight_file,
score_file=score_file)
store_data(transform_json_to_csv(config_json_file), config_csv_file)
return
def run_dnn_rf(running_index):
if running_index >= cross_validation_upper_bound:
raise ValueError('Process number out of limit. At most {}.'.format(cross_validation_upper_bound-1))
with open(config_json_file, 'r') as f:
conf = json.load(f)
# TODO: debug
conf['fitting']['nb_epoch'] = 200
conf['fitting']['early_stopping']['patience'] = 50
label_name_list = conf['label_name_list']
print 'label_name_list ', label_name_list
# specify dataset
k = 5
directory = '../../dataset/fixed_dataset/fold_{}/'.format(k)
file_list = []
for i in range(k):
file_list.append('{}file_{}.csv'.format(directory, i))
file_list = np.array(file_list)
# read data
test_index = running_index / 4
val_index = running_index % 4 + (running_index % 4 >= test_index)
complete_index = np.arange(k)
train_index = np.where((complete_index != test_index) & (complete_index != val_index))[0]
print train_index
train_file_list = file_list[train_index]
val_file_list = file_list[val_index:val_index+1]
test_file_list = file_list[test_index:test_index+1]
print 'train files ', train_file_list
print 'val files ', val_file_list
print 'test files ', test_file_list
train_pd = read_merged_data(train_file_list)
val_pd = read_merged_data(val_file_list)
test_pd = read_merged_data(test_file_list)
# extract data, and split training data into training and val
X_train, y_train = extract_feature_and_label(train_pd,
feature_name='Fingerprints',
label_name_list=label_name_list)
X_val, y_val = extract_feature_and_label(val_pd,
feature_name='Fingerprints',
label_name_list=label_name_list)
X_test, y_test = extract_feature_and_label(test_pd,
feature_name='Fingerprints',
label_name_list=label_name_list)
print 'done data preparation'
# TODO: remove debugging info
# conf['fitting']['nb_epoch'] = 1
task = DNN_RF(conf=conf)
print
print 'This is STNN'
task.train_and_predict(X_train, y_train, X_val, y_val, X_test, y_test, PMTNN_weight_file)
print
print 'This is STNN+RF'
task.get_rf(X_train, y_train, X_val, y_val, X_test, y_test)
return
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--config_json_file', dest="config_json_file",
action="store", required=True)
parser.add_argument('--PMTNN_weight_file', dest="PMTNN_weight_file",
action="store", required=True)
parser.add_argument('--config_csv_file', dest="config_csv_file",
action="store", required=True)
parser.add_argument('--process_num', dest='process_num', type=int,
action='store', required=True)
parser.add_argument('--SMILES_mapping_json_file', dest='SMILES_mapping_json_file',
action='store', required=False, default= '../../json/SMILES_mapping.json')
parser.add_argument('--score_file', dest='score_file',
action='store', required=False)
parser.add_argument('--model', dest='model',
action='store', required=True)
parser.add_argument('--cross_validation_upper_bound', dest='cross_validation_upper_bound', type=int,
action='store', required=False, default=20)
parser.add_argument('--seed', dest='seed', type=int,
action='store', required=False, default=None)
given_args = parser.parse_args()
print 'Seed is {}'.format(given_args.seed)
if given_args.seed is not None:
np.random.seed(given_args.seed)
config_json_file = given_args.config_json_file
PMTNN_weight_file = given_args.PMTNN_weight_file
config_csv_file = given_args.config_csv_file
cross_validation_upper_bound = given_args.cross_validation_upper_bound
process_num = int(given_args.process_num)
model = given_args.model
if model == 'single_classification':
run_single_classification(process_num)
elif model == 'single_regression':
run_single_regression(process_num)
elif model == 'vanilla_lstm':
SMILES_mapping_json_file = given_args.SMILES_mapping_json_file
run_vanilla_lstm(process_num)
elif model == 'multi_classification':
score_file = given_args.score_file
run_multiple_classification(process_num)
elif model == 'tree_net':
run_tree_net(process_num)
elif model == 'single_dnn_rf':
run_dnn_rf(process_num)
else:
raise Exception('No such model! Should be among [{}, {}, {}, {}, {}].'.format(
'single_classification',
'single_regression',
'vanilla_lstm',
'multi_classification',
'tree_net',
'single_dnn_rf'
))
| 42.670782 | 107 | 0.649677 | 2,718 | 20,738 | 4.534952 | 0.078366 | 0.064254 | 0.071718 | 0.041376 | 0.774947 | 0.730488 | 0.716696 | 0.70404 | 0.688301 | 0.688301 | 0 | 0.00621 | 0.262369 | 20,738 | 485 | 108 | 42.758763 | 0.799569 | 0.029174 | 0 | 0.670157 | 0 | 0 | 0.100144 | 0.021779 | 0 | 0 | 0 | 0.002062 | 0 | 0 | null | null | 0 | 0.052356 | null | null | 0.151832 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
e23619ea08a235266f7322b699a5160ec301f4bf | 343 | py | Python | myfinalproject/museos/admin.py | apayol/X-Serv-Practica-Museos | ca17d12418273f718c006ba9d9f33624ccb1f008 | [
"Apache-2.0"
] | null | null | null | myfinalproject/museos/admin.py | apayol/X-Serv-Practica-Museos | ca17d12418273f718c006ba9d9f33624ccb1f008 | [
"Apache-2.0"
] | null | null | null | myfinalproject/museos/admin.py | apayol/X-Serv-Practica-Museos | ca17d12418273f718c006ba9d9f33624ccb1f008 | [
"Apache-2.0"
] | 1 | 2021-07-03T09:05:59.000Z | 2021-07-03T09:05:59.000Z | from museos.models import Seleccionado
from museos.models import ConfigUsuario
from museos.models import Comentario
from django.contrib import admin
# Register your models here.
from museos.models import Museo
admin.site.register(Museo)
admin.site.register(Comentario)
admin.site.register(ConfigUsuario)
admin.site.register(Seleccionado)
| 21.4375 | 39 | 0.833819 | 45 | 343 | 6.355556 | 0.333333 | 0.13986 | 0.223776 | 0.307692 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.099125 | 343 | 15 | 40 | 22.866667 | 0.925566 | 0.075802 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.555556 | 0 | 0.555556 | 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 | 1 | 0 | 0 | 5 |
e2990a46c896e8d8a11220e2cd5f312f6093f4d5 | 283 | py | Python | synonym_dict/__init__.py | bkuczenski/synonym_dict | 0968e63c3dc37f1ff383befc9c2805cd9014a3b6 | [
"BSD-3-Clause"
] | null | null | null | synonym_dict/__init__.py | bkuczenski/synonym_dict | 0968e63c3dc37f1ff383befc9c2805cd9014a3b6 | [
"BSD-3-Clause"
] | 5 | 2020-12-29T07:38:25.000Z | 2021-03-17T18:27:17.000Z | synonym_dict/__init__.py | bkuczenski/synonym_dict | 0968e63c3dc37f1ff383befc9c2805cd9014a3b6 | [
"BSD-3-Clause"
] | null | null | null | from .lower_dict import LowerDict
from .synonym_dict import SynonymDict, MergeError, TermExists
from .synonym_set import SynonymSet
from .compartments import Compartment, CompartmentManager, InconsistentLineage, NonSpecificCompartment
from .flowables import Flowable, FlowablesDict
| 40.428571 | 102 | 0.865724 | 29 | 283 | 8.344828 | 0.655172 | 0.082645 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.095406 | 283 | 6 | 103 | 47.166667 | 0.945313 | 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 | 1 | 0 | 0 | 5 |
2c5e014ee79145ced3d8b00a852b5ed1e67c057b | 156 | py | Python | src/foobar/widgets/__init__.py | jwodder/mypy-bug-20220227 | 257c65d2944e5589414aeaa24d0290a45aa2159a | [
"MIT"
] | null | null | null | src/foobar/widgets/__init__.py | jwodder/mypy-bug-20220227 | 257c65d2944e5589414aeaa24d0290a45aa2159a | [
"MIT"
] | null | null | null | src/foobar/widgets/__init__.py | jwodder/mypy-bug-20220227 | 257c65d2944e5589414aeaa24d0290a45aa2159a | [
"MIT"
] | null | null | null | from .base import Widget, WidgetSpec
from .blue import BlueWidget
from .red import RedWidget
__all__ = ["BlueWidget", "RedWidget", "Widget", "WidgetSpec"]
| 26 | 61 | 0.75641 | 18 | 156 | 6.333333 | 0.555556 | 0.280702 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.128205 | 156 | 5 | 62 | 31.2 | 0.838235 | 0 | 0 | 0 | 0 | 0 | 0.224359 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.75 | 0 | 0.75 | 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 | 1 | 0 | 0 | 5 |
2c5f06f6e6b733a7008306aa567549cab3e70d5c | 43 | py | Python | Ex3.py | akhilsambasivan/PythonPractices | 887a26ca172329e9d232dcdf2b993b2a6bb6584b | [
"MIT"
] | 1 | 2019-07-26T16:30:15.000Z | 2019-07-26T16:30:15.000Z | Ex3.py | akhilsambasivan/PythonPractices | 887a26ca172329e9d232dcdf2b993b2a6bb6584b | [
"MIT"
] | null | null | null | Ex3.py | akhilsambasivan/PythonPractices | 887a26ca172329e9d232dcdf2b993b2a6bb6584b | [
"MIT"
] | null | null | null | name = "Akhil Sambasivan"
print(name[:-1])c | 21.5 | 25 | 0.697674 | 7 | 43 | 4.285714 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025641 | 0.093023 | 43 | 2 | 26 | 21.5 | 0.74359 | 0 | 0 | 0 | 0 | 0 | 0.363636 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.5 | 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 | 1 | 0 | 5 |
2c72810ff99f63dfc7d7899c9b90eb1a961e6f6b | 249 | py | Python | ex008.py | jefernathan/Python | 2f840a625e8d46d41ab36df07ef50ae15a03c5ab | [
"MIT"
] | null | null | null | ex008.py | jefernathan/Python | 2f840a625e8d46d41ab36df07ef50ae15a03c5ab | [
"MIT"
] | null | null | null | ex008.py | jefernathan/Python | 2f840a625e8d46d41ab36df07ef50ae15a03c5ab | [
"MIT"
] | null | null | null | # Escreva um programa que leia um valor em metros e o exiba convertido em centímetros e milímetros.
metros = float(input('Digite um valor em metros: '))
print(f'{metros} metros tem {metros * 100:.0f} centímetros e {metros * 1000:.0f} milímetros')
| 41.5 | 99 | 0.73494 | 39 | 249 | 4.692308 | 0.589744 | 0.076503 | 0.098361 | 0.163934 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.043062 | 0.160643 | 249 | 5 | 100 | 49.8 | 0.832536 | 0.389558 | 0 | 0 | 0 | 0.5 | 0.733333 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
2c789017a4f07084881aac80168c647e92e92b89 | 171 | py | Python | test/__init__.py | NREL/wp3-precon | c1c163007d16986d04bc34deefbf1c1e1c754aa8 | [
"BSD-3-Clause"
] | null | null | null | test/__init__.py | NREL/wp3-precon | c1c163007d16986d04bc34deefbf1c1e1c754aa8 | [
"BSD-3-Clause"
] | null | null | null | test/__init__.py | NREL/wp3-precon | c1c163007d16986d04bc34deefbf1c1e1c754aa8 | [
"BSD-3-Clause"
] | null | null | null | from pathlib import Path
example_data_path = Path(__file__).parents[1].resolve() / "examples" / "data" / "la_haute_borne"
example_data_path_str = str(example_data_path)
| 28.5 | 96 | 0.77193 | 25 | 171 | 4.76 | 0.6 | 0.277311 | 0.378151 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006536 | 0.105263 | 171 | 5 | 97 | 34.2 | 0.771242 | 0 | 0 | 0 | 0 | 0 | 0.152047 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 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 | 1 | 0 | 0 | 0 | 0 | 5 |
2ccd04ef9d5bc6648e55566c5b83b0bb1e334972 | 39,725 | py | Python | compiler/parsetab.py | olefran/Pound | 737a245602df600a6de8df9b749cddf17f4127f6 | [
"MIT"
] | 1 | 2020-04-21T09:30:17.000Z | 2020-04-21T09:30:17.000Z | compiler/parsetab.py | olefran/Patitoplusplus | 737a245602df600a6de8df9b749cddf17f4127f6 | [
"MIT"
] | null | null | null | compiler/parsetab.py | olefran/Patitoplusplus | 737a245602df600a6de8df9b749cddf17f4127f6 | [
"MIT"
] | null | null | null |
# parsetab.py
# This file is automatically generated. Do not edit.
# pylint: disable=W,C,R
_tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'PROGRAMleftPLUSMINUSleftMULTDIVMODrightEQUALleftANDORAND CHAR COMA COMMENT COMPARE CTE_CH CTE_F CTE_I CTE_STRING DESDE DET_ARR DIFFERENT DIV DOTCOMA ENTONCES EQUAL ESCRIBE FLOAT FUNCION HACER HASTA HAZ ID INT INV_ARR LBRACKET LEE LESS LESSEQUAL LPAREN LSTAPLE MIENTRAS MINUS MOD MORE MOREEQUAL MULT NOT NULL OR PLUS PRINCIPAL PROGRAMA RBRACKET REGRESA RPAREN RSTAPLE SI SINO STRING TRANS_ARR VAR VOIDempty :PROGRAM : PROGRAMA r_goto_main ID DOTCOMA VARS r_save_vars FUNCTIONS MAIN r_print_constantsMAIN : PRINCIPAL r_save_func LPAREN RPAREN r_register_princ r_save_param_func VARS r_save_vars r_end_princ r_func_set BLOQUE r_func_end VARS : VAR VAR_AUX\n | emptyVAR_AUX : TIPO IDS VAR_AUX\n | emptyTIPO : INT r_save_type\n | FLOAT r_save_type\n | CHAR r_save_type\n | STRING r_save_typeIDS : ID r_register_var ARRDIM r_populate_r DOTCOMA\n | ID r_register_var ARRDIM r_populate_r COMA IDSARRDIM : r_register_arr LSTAPLE CTE_I r_register_dim ARRDIM_AUX RSTAPLE ARRDIM\n | emptyARRDIM_AUX : COMA CTE_I r_register_dim ARRDIM_AUX\n | emptyFUNCTIONS : FUNCTION FUNCTIONS\n | emptyFUNCTION : FUNCION TIPO ID r_save_func r_register_func LPAREN PARAM RPAREN r_save_param_func VARS r_save_vars r_func_set BLOQUE r_func_end\n | FUNCION VOID r_save_type ID r_save_func r_register_func LPAREN PARAM RPAREN r_save_param_func VARS r_save_vars r_func_set BLOQUE r_func_endPARAM : TIPO ID r_register_var PARAM_AUX\n | emptyPARAM_AUX : COMA PARAM\n | emptyBLOQUE : LBRACKET ESTATUTOS RBRACKETESTATUTOS : ESTATUTO ESTATUTOS\n | emptyESTATUTO : ASIGNACION DOTCOMA\n | FUN DOTCOMA\n | COND\n | WRITE DOTCOMA\n | READ DOTCOMA\n | RETURN DOTCOMAASIGNACION : ID r_seen_operand_id ARRACC EQUAL r_seen_operator EXPRESION r_seen_equalARRACC : LSTAPLE r_check_dim EXPRESION r_create_quad ARRACC_AUX RSTAPLE r_close_arracc\n | emptyARRACC_AUX : COMA r_add_dim EXPRESION r_create_quad ARRACC_AUX\n | emptyEXPRESION : SUBEXP r_seen_subexp EXPRESION_AUXEXPRESION_AUX : AND r_seen_operator EXPRESION\n | OR r_seen_operator EXPRESION\n | emptySUBEXP : EXP r_seen_exp SUBEXP_AUXSUBEXP_AUX : COMPARACION SUBEXP\n | emptyCOMPARACION : MORE r_seen_operator\n | LESS r_seen_operator\n | COMPARE r_seen_operator\n | DIFFERENT r_seen_operator\n | MOREEQUAL r_seen_operator\n | LESSEQUAL r_seen_operatorEXP : TERMINO r_seen_term EXP_AUXEXP_AUX : PLUS r_seen_operator EXP\n | MINUS r_seen_operator EXP\n | emptyTERMINO : FACTOR r_seen_factor TERMINO_AUXTERMINO_AUX : MULT r_seen_operator TERMINO r_seen_term\n | DIV r_seen_operator TERMINO r_seen_term\n | MOD r_seen_operator TERMINO r_seen_term\n | emptyFACTOR : NOT r_seen_unary_operator FACTOR_AUX\n | FACTOR_AUXFACTOR_AUX : SIGN LPAREN r_seen_operator EXPRESION RPAREN r_pop_fake_bottom\n | SIGN CTE ARROPSIGN : PLUS r_seen_unary_operator\n | MINUS r_seen_unary_operator\n | emptyCTE : CTE_I r_seen_operand\n | CTE_F r_seen_operand\n | CTE_CH r_seen_operand\n | CTE_STRING r_seen_operand\n | FUN\n | ID r_seen_operand_id ARRACC ARROP : DET_ARR r_seen_operator_mat\n | TRANS_ARR r_seen_operator_mat\n | INV_ARR r_seen_operator_mat\n | emptyFUN : ID r_check_func LPAREN r_create_bottom FUN_AUX RPAREN r_pop_fake_bottom r_go_subFUN_AUX : EXPRESION r_check_param COMA FUN_AUX\n | EXPRESION r_check_param\n | emptyCOND : IF\n | FOR\n | WHILEIF : SI LPAREN EXPRESION r_check_int RPAREN ENTONCES IF2 r_if_endIF2 : BLOQUE IF_AUX\n | CONDIF_AUX : SINO r_else_start BLOQUE\n | emptyWHILE : MIENTRAS r_set_while LPAREN EXPRESION r_check_int RPAREN WHILE_AUX WHILE2 r_while_endWHILE2 : BLOQUE\n | CONDWHILE_AUX : HAZ\n | empty FOR : DESDE ASIGNACION r_set_for HASTA EXPRESION r_for_gen HACER FOR2 r_for_endFOR2 : BLOQUE\n | CONDWRITE : ESCRIBE LPAREN WRITE_AUX RPARENWRITE_AUX : EXPRESION r_escribe WRITE_AUXSUBWRITE_AUXSUB : COMA WRITE_AUX\n | emptyREAD : LEE LPAREN READ_AUX RPARENREAD_AUX : ID r_seen_operand_id ARRDIM r_lee READ_AUXSUBREAD_AUXSUB : COMA READ_AUX\n | emptyRETURN : REGRESA LPAREN EXPRESION RPAREN r_regresa\n | REGRESA LPAREN NULL RPARENr_save_type : r_save_func : r_register_func : r_register_var : r_register_arr : r_register_dim : r_populate_r : r_check_dim : r_create_quad : r_add_dim : r_close_arracc : r_register_princ : r_end_princ : r_seen_operand : r_seen_operand_id :r_seen_operator : r_seen_unary_operator : r_seen_operator_mat : r_seen_equal : r_seen_subexp : r_seen_exp : r_seen_term : r_seen_factor : r_pop_fake_bottom : r_create_bottom : r_check_int : r_if_end : r_else_start : r_set_while : r_while_end : r_set_for : r_for_gen : r_for_end : r_save_param_func : r_save_vars : r_func_set : r_func_end : r_check_func : r_check_param : r_go_sub : r_goto_main : r_regresa : r_escribe : r_lee : r_print_constants : '
_lr_action_items = {'PROGRAMA':([0,],[2,]),'$end':([1,27,34,88,92,114,],[0,-153,-2,-145,-3,-26,]),'ID':([2,3,11,13,14,15,16,23,24,25,26,30,31,37,50,58,89,94,98,103,104,105,110,114,116,117,118,119,120,123,124,125,126,133,135,142,144,145,146,147,154,156,157,158,165,166,174,175,181,183,187,189,192,193,196,198,199,200,201,202,203,205,206,209,210,211,214,235,236,238,239,240,241,242,243,244,245,246,247,248,260,263,273,275,276,277,283,291,292,294,295,296,297,298,299,300,304,305,307,],[-149,4,22,-109,-109,-109,-109,-8,-9,-10,-11,36,-109,43,22,66,102,102,-31,-83,-84,-85,128,-26,-29,-30,-32,-33,-34,-1,149,-1,-1,-116,-133,-125,173,-125,-125,-68,-1,-124,-1,-1,-1,-124,-66,-67,-1,-1,-68,-1,-124,-124,-1,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-1,-1,-1,-47,-48,-49,-50,-51,-52,-1,-1,-1,-1,-1,-118,-1,149,-135,-1,-88,-1,-86,-87,-90,-141,-97,-98,-138,-92,-93,-96,-91,-89,]),'DOTCOMA':([4,22,33,38,40,44,69,75,96,97,99,100,101,134,138,139,140,141,143,159,161,162,163,164,167,168,169,170,171,172,173,176,178,179,191,194,195,197,204,207,208,212,213,215,216,217,218,219,220,221,222,223,224,226,230,232,237,250,251,252,253,258,262,264,265,266,267,268,269,270,271,282,284,286,287,288,289,301,],[5,-112,-1,-115,-15,49,-1,-14,116,117,118,119,120,-37,-128,-129,-130,-131,-63,-99,-1,-1,-1,-1,-1,-122,-122,-122,-122,-73,-123,-103,-150,-108,-40,-43,-44,-46,-53,-56,-57,-61,-62,-65,-126,-126,-126,-78,-69,-70,-71,-72,-1,-107,-127,-132,-45,-75,-76,-77,-74,-35,-148,-41,-42,-54,-55,-130,-130,-130,-132,-119,-79,-58,-59,-60,-64,-36,]),'VAR':([5,46,52,57,67,73,74,82,],[7,-120,-142,7,-142,7,-142,7,]),'FUNCION':([5,6,7,8,9,10,12,18,21,32,49,55,112,114,130,131,155,],[-1,-143,-1,-5,20,-4,-7,20,-1,-6,-12,-13,-145,-26,-20,-145,-21,]),'PRINCIPAL':([5,6,7,8,9,10,12,17,18,19,21,29,32,49,55,112,114,130,131,155,],[-1,-143,-1,-5,-1,-4,-7,28,-1,-19,-1,-18,-6,-12,-13,-145,-26,-20,-145,-21,]),'INT':([7,20,21,49,53,55,61,79,],[13,13,13,-12,13,-13,13,13,]),'FLOAT':([7,20,21,49,53,55,61,79,],[14,14,14,-12,14,-13,14,14,]),'CHAR':([7,20,21,49,53,55,61,79,],[15,15,15,-12,15,-13,15,15,]),'STRING':([7,20,21,49,53,55,61,79,],[16,16,16,-12,16,-13,16,16,]),'LBRACKET':([7,8,10,12,21,32,46,49,52,55,57,65,67,71,73,74,77,81,82,84,86,87,90,91,113,255,257,278,279,280,281,293,303,],[-1,-5,-4,-7,-1,-6,-120,-12,-142,-13,-1,-143,-142,-121,-1,-142,-144,-143,-1,89,-144,-143,89,-144,89,89,-1,89,89,-94,-95,-136,89,]),'VOID':([20,],[31,]),'COMA':([22,33,38,40,44,51,56,66,69,70,72,75,76,134,137,138,139,140,141,143,149,160,161,162,163,164,167,168,169,170,171,172,173,177,184,186,191,194,195,197,204,207,208,212,213,215,216,217,218,219,220,221,222,223,224,225,231,232,233,237,250,251,252,253,254,262,264,265,266,267,268,269,270,271,282,284,286,287,288,289,301,302,306,],[-112,-1,-115,-15,50,-114,63,-112,-1,-114,79,-14,63,-37,-151,-128,-129,-130,-131,-63,-123,189,-1,-1,-1,-1,-1,-122,-122,-122,-122,-73,-123,-1,-117,-147,-40,-43,-44,-46,-53,-56,-57,-61,-62,-65,-126,-126,-126,-78,-69,-70,-71,-72,-1,-152,260,-132,263,-45,-75,-76,-77,-74,273,-148,-41,-42,-54,-55,-130,-130,-130,-132,-119,-79,-58,-59,-60,-64,-36,-117,260,]),'LSTAPLE':([22,33,39,69,102,121,128,149,173,177,224,],[-112,-113,45,-113,-123,133,-123,-123,-123,-113,133,]),'LPAREN':([28,35,36,42,43,47,48,54,102,106,107,108,109,111,122,123,125,126,129,133,135,142,144,145,146,147,154,156,157,158,165,166,173,174,175,181,183,187,189,192,193,196,198,199,200,201,202,203,205,206,209,210,211,214,235,236,238,239,240,241,242,243,244,245,246,247,248,260,263,283,],[-110,41,-110,-111,-110,53,-111,61,-146,123,124,125,126,-137,135,-1,-1,-1,154,-116,-133,-125,166,-125,-125,-68,-1,-124,-1,-1,-1,-124,-146,-66,-67,-1,-1,-68,-1,-124,-124,-1,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-1,-1,-1,-47,-48,-49,-50,-51,-52,-1,-1,-1,-1,-1,-118,-1,-1,]),'RPAREN':([40,41,53,59,60,61,66,68,69,72,75,78,79,80,85,134,135,136,137,138,139,140,141,143,148,149,150,151,152,158,160,161,162,163,164,167,168,169,170,171,172,173,177,180,182,185,186,187,188,190,191,194,195,197,204,207,208,212,213,215,216,217,218,219,220,221,222,223,224,225,229,232,233,234,237,249,250,251,252,253,254,262,263,264,265,266,267,268,269,270,271,272,274,282,284,285,286,287,288,289,290,301,],[-15,46,-1,67,-23,-1,-112,74,-1,-1,-14,-22,-1,-25,-24,-37,-133,159,-151,-128,-129,-130,-131,-63,176,-123,178,179,-134,-1,-1,-1,-1,-1,-1,-1,-122,-122,-122,-122,-73,-123,-1,227,-134,232,-147,-82,-100,-102,-40,-43,-44,-46,-53,-56,-57,-61,-62,-65,-126,-126,-126,-78,-69,-70,-71,-72,-1,-152,257,-132,-81,-101,-45,271,-75,-76,-77,-74,-1,-148,-1,-41,-42,-54,-55,-130,-130,-130,-132,-104,-106,-119,-79,-80,-58,-59,-60,-64,-105,-36,]),'CTE_I':([45,63,123,125,126,133,135,142,144,145,146,147,154,156,157,158,165,166,174,175,181,183,187,189,192,193,196,198,199,200,201,202,203,205,206,209,210,211,214,235,236,238,239,240,241,242,243,244,245,246,247,248,260,263,283,],[51,70,-1,-1,-1,-116,-133,-125,168,-125,-125,-68,-1,-124,-1,-1,-1,-124,-66,-67,-1,-1,-68,-1,-124,-124,-1,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-1,-1,-1,-47,-48,-49,-50,-51,-52,-1,-1,-1,-1,-1,-118,-1,-1,]),'RSTAPLE':([51,56,62,64,70,76,83,134,138,139,140,141,143,161,162,163,164,167,168,169,170,171,172,173,184,191,194,195,197,204,207,208,212,213,215,216,217,218,219,220,221,222,223,224,231,232,237,250,251,252,253,259,261,262,264,265,266,267,268,269,270,271,282,284,286,287,288,289,301,302,306,308,],[-114,-1,69,-17,-114,-1,-16,-37,-128,-129,-130,-131,-63,-1,-1,-1,-1,-1,-122,-122,-122,-122,-73,-123,-117,-40,-43,-44,-46,-53,-56,-57,-61,-62,-65,-126,-126,-126,-78,-69,-70,-71,-72,-1,-1,-132,-45,-75,-76,-77,-74,282,-39,-148,-41,-42,-54,-55,-130,-130,-130,-132,-119,-79,-58,-59,-60,-64,-36,-117,-1,-38,]),'RBRACKET':([89,93,94,95,98,103,104,105,114,115,116,117,118,119,120,275,276,277,291,292,294,295,296,297,298,299,300,304,305,307,],[-1,114,-1,-28,-31,-83,-84,-85,-26,-27,-29,-30,-32,-33,-34,-135,-1,-88,-86,-87,-90,-141,-97,-98,-138,-92,-93,-96,-91,-89,]),'ESCRIBE':([89,94,98,103,104,105,114,116,117,118,119,120,275,276,277,291,292,294,295,296,297,298,299,300,304,305,307,],[106,106,-31,-83,-84,-85,-26,-29,-30,-32,-33,-34,-135,-1,-88,-86,-87,-90,-141,-97,-98,-138,-92,-93,-96,-91,-89,]),'LEE':([89,94,98,103,104,105,114,116,117,118,119,120,275,276,277,291,292,294,295,296,297,298,299,300,304,305,307,],[107,107,-31,-83,-84,-85,-26,-29,-30,-32,-33,-34,-135,-1,-88,-86,-87,-90,-141,-97,-98,-138,-92,-93,-96,-91,-89,]),'REGRESA':([89,94,98,103,104,105,114,116,117,118,119,120,275,276,277,291,292,294,295,296,297,298,299,300,304,305,307,],[108,108,-31,-83,-84,-85,-26,-29,-30,-32,-33,-34,-135,-1,-88,-86,-87,-90,-141,-97,-98,-138,-92,-93,-96,-91,-89,]),'SI':([89,94,98,103,104,105,114,116,117,118,119,120,255,257,275,276,277,278,279,280,281,291,292,294,295,296,297,298,299,300,304,305,307,],[109,109,-31,-83,-84,-85,-26,-29,-30,-32,-33,-34,109,-1,-135,-1,-88,109,109,-94,-95,-86,-87,-90,-141,-97,-98,-138,-92,-93,-96,-91,-89,]),'DESDE':([89,94,98,103,104,105,114,116,117,118,119,120,255,257,275,276,277,278,279,280,281,291,292,294,295,296,297,298,299,300,304,305,307,],[110,110,-31,-83,-84,-85,-26,-29,-30,-32,-33,-34,110,-1,-135,-1,-88,110,110,-94,-95,-86,-87,-90,-141,-97,-98,-138,-92,-93,-96,-91,-89,]),'MIENTRAS':([89,94,98,103,104,105,114,116,117,118,119,120,255,257,275,276,277,278,279,280,281,291,292,294,295,296,297,298,299,300,304,305,307,],[111,111,-31,-83,-84,-85,-26,-29,-30,-32,-33,-34,111,-1,-135,-1,-88,111,111,-94,-95,-86,-87,-90,-141,-97,-98,-138,-92,-93,-96,-91,-89,]),'EQUAL':([102,121,128,132,134,282,301,],[-123,-1,-123,156,-37,-119,-36,]),'SINO':([114,276,],[-26,293,]),'NOT':([123,125,126,133,135,154,156,157,158,166,181,183,189,192,193,196,198,199,200,201,202,203,205,206,209,210,211,214,235,236,238,239,240,241,242,243,244,245,246,247,248,260,263,283,],[142,142,142,-116,-133,142,-124,142,142,-124,142,142,142,-124,-124,142,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,142,142,142,-47,-48,-49,-50,-51,-52,142,142,142,142,142,-118,142,142,]),'PLUS':([123,125,126,133,134,135,140,141,142,143,154,156,157,158,163,164,165,166,167,168,169,170,171,172,173,181,183,189,192,193,196,198,199,200,201,202,203,205,206,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,232,235,236,238,239,240,241,242,243,244,245,246,247,248,250,251,252,253,260,262,263,268,269,270,271,282,283,284,286,287,288,289,301,],[145,145,145,-116,-37,-133,-130,-131,-125,-63,145,-124,145,145,205,-1,145,-124,-1,-122,-122,-122,-122,-73,-123,145,145,145,-124,-124,145,-124,-124,-124,-124,-124,-124,-124,-124,-57,-124,-124,-124,-61,-62,145,-65,-126,-126,-126,-78,-69,-70,-71,-72,-1,-132,145,145,-47,-48,-49,-50,-51,-52,145,145,145,145,145,-75,-76,-77,-74,-118,-148,145,-130,-130,-130,-132,-119,145,-79,-58,-59,-60,-64,-36,]),'MINUS':([123,125,126,133,134,135,140,141,142,143,154,156,157,158,163,164,165,166,167,168,169,170,171,172,173,181,183,189,192,193,196,198,199,200,201,202,203,205,206,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,232,235,236,238,239,240,241,242,243,244,245,246,247,248,250,251,252,253,260,262,263,268,269,270,271,282,283,284,286,287,288,289,301,],[146,146,146,-116,-37,-133,-130,-131,-125,-63,146,-124,146,146,206,-1,146,-124,-1,-122,-122,-122,-122,-73,-123,146,146,146,-124,-124,146,-124,-124,-124,-124,-124,-124,-124,-124,-57,-124,-124,-124,-61,-62,146,-65,-126,-126,-126,-78,-69,-70,-71,-72,-1,-132,146,146,-47,-48,-49,-50,-51,-52,146,146,146,146,146,-75,-76,-77,-74,-118,-148,146,-130,-130,-130,-132,-119,146,-79,-58,-59,-60,-64,-36,]),'CTE_F':([123,125,126,133,135,142,144,145,146,147,154,156,157,158,165,166,174,175,181,183,187,189,192,193,196,198,199,200,201,202,203,205,206,209,210,211,214,235,236,238,239,240,241,242,243,244,245,246,247,248,260,263,283,],[-1,-1,-1,-116,-133,-125,169,-125,-125,-68,-1,-124,-1,-1,-1,-124,-66,-67,-1,-1,-68,-1,-124,-124,-1,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-1,-1,-1,-47,-48,-49,-50,-51,-52,-1,-1,-1,-1,-1,-118,-1,-1,]),'CTE_CH':([123,125,126,133,135,142,144,145,146,147,154,156,157,158,165,166,174,175,181,183,187,189,192,193,196,198,199,200,201,202,203,205,206,209,210,211,214,235,236,238,239,240,241,242,243,244,245,246,247,248,260,263,283,],[-1,-1,-1,-116,-133,-125,170,-125,-125,-68,-1,-124,-1,-1,-1,-124,-66,-67,-1,-1,-68,-1,-124,-124,-1,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-1,-1,-1,-47,-48,-49,-50,-51,-52,-1,-1,-1,-1,-1,-118,-1,-1,]),'CTE_STRING':([123,125,126,133,135,142,144,145,146,147,154,156,157,158,165,166,174,175,181,183,187,189,192,193,196,198,199,200,201,202,203,205,206,209,210,211,214,235,236,238,239,240,241,242,243,244,245,246,247,248,260,263,283,],[-1,-1,-1,-116,-133,-125,171,-125,-125,-68,-1,-124,-1,-1,-1,-124,-66,-67,-1,-1,-68,-1,-124,-124,-1,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-124,-1,-1,-1,-47,-48,-49,-50,-51,-52,-1,-1,-1,-1,-1,-118,-1,-1,]),'NULL':([125,],[151,]),'HASTA':([127,134,138,139,140,141,143,153,161,162,163,164,167,168,169,170,171,172,173,191,194,195,197,204,207,208,212,213,215,216,217,218,219,220,221,222,223,224,230,232,237,250,251,252,253,258,262,264,265,266,267,268,269,270,271,282,284,286,287,288,289,301,],[-139,-37,-128,-129,-130,-131,-63,181,-1,-1,-1,-1,-1,-122,-122,-122,-122,-73,-123,-40,-43,-44,-46,-53,-56,-57,-61,-62,-65,-126,-126,-126,-78,-69,-70,-71,-72,-1,-127,-132,-45,-75,-76,-77,-74,-35,-148,-41,-42,-54,-55,-130,-130,-130,-132,-119,-79,-58,-59,-60,-64,-36,]),'DET_ARR':([134,167,168,169,170,171,172,173,220,221,222,223,224,232,253,262,282,284,301,],[-37,216,-122,-122,-122,-122,-73,-123,-69,-70,-71,-72,-1,-132,-74,-148,-119,-79,-36,]),'TRANS_ARR':([134,167,168,169,170,171,172,173,220,221,222,223,224,232,253,262,282,284,301,],[-37,217,-122,-122,-122,-122,-73,-123,-69,-70,-71,-72,-1,-132,-74,-148,-119,-79,-36,]),'INV_ARR':([134,167,168,169,170,171,172,173,220,221,222,223,224,232,253,262,282,284,301,],[-37,218,-122,-122,-122,-122,-73,-123,-69,-70,-71,-72,-1,-132,-74,-148,-119,-79,-36,]),'MULT':([134,141,143,164,167,168,169,170,171,172,173,213,215,216,217,218,219,220,221,222,223,224,232,250,251,252,253,262,271,282,284,289,301,],[-37,-131,-63,209,-1,-122,-122,-122,-122,-73,-123,-62,-65,-126,-126,-126,-78,-69,-70,-71,-72,-1,-132,-75,-76,-77,-74,-148,-132,-119,-79,-64,-36,]),'DIV':([134,141,143,164,167,168,169,170,171,172,173,213,215,216,217,218,219,220,221,222,223,224,232,250,251,252,253,262,271,282,284,289,301,],[-37,-131,-63,210,-1,-122,-122,-122,-122,-73,-123,-62,-65,-126,-126,-126,-78,-69,-70,-71,-72,-1,-132,-75,-76,-77,-74,-148,-132,-119,-79,-64,-36,]),'MOD':([134,141,143,164,167,168,169,170,171,172,173,213,215,216,217,218,219,220,221,222,223,224,232,250,251,252,253,262,271,282,284,289,301,],[-37,-131,-63,211,-1,-122,-122,-122,-122,-73,-123,-62,-65,-126,-126,-126,-78,-69,-70,-71,-72,-1,-132,-75,-76,-77,-74,-148,-132,-119,-79,-64,-36,]),'MORE':([134,139,140,141,143,162,163,164,167,168,169,170,171,172,173,204,207,208,212,213,215,216,217,218,219,220,221,222,223,224,232,250,251,252,253,262,266,267,268,269,270,271,282,284,286,287,288,289,301,],[-37,-129,-130,-131,-63,198,-1,-1,-1,-122,-122,-122,-122,-73,-123,-53,-56,-57,-61,-62,-65,-126,-126,-126,-78,-69,-70,-71,-72,-1,-132,-75,-76,-77,-74,-148,-54,-55,-130,-130,-130,-132,-119,-79,-58,-59,-60,-64,-36,]),'LESS':([134,139,140,141,143,162,163,164,167,168,169,170,171,172,173,204,207,208,212,213,215,216,217,218,219,220,221,222,223,224,232,250,251,252,253,262,266,267,268,269,270,271,282,284,286,287,288,289,301,],[-37,-129,-130,-131,-63,199,-1,-1,-1,-122,-122,-122,-122,-73,-123,-53,-56,-57,-61,-62,-65,-126,-126,-126,-78,-69,-70,-71,-72,-1,-132,-75,-76,-77,-74,-148,-54,-55,-130,-130,-130,-132,-119,-79,-58,-59,-60,-64,-36,]),'COMPARE':([134,139,140,141,143,162,163,164,167,168,169,170,171,172,173,204,207,208,212,213,215,216,217,218,219,220,221,222,223,224,232,250,251,252,253,262,266,267,268,269,270,271,282,284,286,287,288,289,301,],[-37,-129,-130,-131,-63,200,-1,-1,-1,-122,-122,-122,-122,-73,-123,-53,-56,-57,-61,-62,-65,-126,-126,-126,-78,-69,-70,-71,-72,-1,-132,-75,-76,-77,-74,-148,-54,-55,-130,-130,-130,-132,-119,-79,-58,-59,-60,-64,-36,]),'DIFFERENT':([134,139,140,141,143,162,163,164,167,168,169,170,171,172,173,204,207,208,212,213,215,216,217,218,219,220,221,222,223,224,232,250,251,252,253,262,266,267,268,269,270,271,282,284,286,287,288,289,301,],[-37,-129,-130,-131,-63,201,-1,-1,-1,-122,-122,-122,-122,-73,-123,-53,-56,-57,-61,-62,-65,-126,-126,-126,-78,-69,-70,-71,-72,-1,-132,-75,-76,-77,-74,-148,-54,-55,-130,-130,-130,-132,-119,-79,-58,-59,-60,-64,-36,]),'MOREEQUAL':([134,139,140,141,143,162,163,164,167,168,169,170,171,172,173,204,207,208,212,213,215,216,217,218,219,220,221,222,223,224,232,250,251,252,253,262,266,267,268,269,270,271,282,284,286,287,288,289,301,],[-37,-129,-130,-131,-63,202,-1,-1,-1,-122,-122,-122,-122,-73,-123,-53,-56,-57,-61,-62,-65,-126,-126,-126,-78,-69,-70,-71,-72,-1,-132,-75,-76,-77,-74,-148,-54,-55,-130,-130,-130,-132,-119,-79,-58,-59,-60,-64,-36,]),'LESSEQUAL':([134,139,140,141,143,162,163,164,167,168,169,170,171,172,173,204,207,208,212,213,215,216,217,218,219,220,221,222,223,224,232,250,251,252,253,262,266,267,268,269,270,271,282,284,286,287,288,289,301,],[-37,-129,-130,-131,-63,203,-1,-1,-1,-122,-122,-122,-122,-73,-123,-53,-56,-57,-61,-62,-65,-126,-126,-126,-78,-69,-70,-71,-72,-1,-132,-75,-76,-77,-74,-148,-54,-55,-130,-130,-130,-132,-119,-79,-58,-59,-60,-64,-36,]),'AND':([134,138,139,140,141,143,161,162,163,164,167,168,169,170,171,172,173,195,197,204,207,208,212,213,215,216,217,218,219,220,221,222,223,224,232,237,250,251,252,253,262,266,267,268,269,270,271,282,284,286,287,288,289,301,],[-37,-128,-129,-130,-131,-63,192,-1,-1,-1,-1,-122,-122,-122,-122,-73,-123,-44,-46,-53,-56,-57,-61,-62,-65,-126,-126,-126,-78,-69,-70,-71,-72,-1,-132,-45,-75,-76,-77,-74,-148,-54,-55,-130,-130,-130,-132,-119,-79,-58,-59,-60,-64,-36,]),'OR':([134,138,139,140,141,143,161,162,163,164,167,168,169,170,171,172,173,195,197,204,207,208,212,213,215,216,217,218,219,220,221,222,223,224,232,237,250,251,252,253,262,266,267,268,269,270,271,282,284,286,287,288,289,301,],[-37,-128,-129,-130,-131,-63,193,-1,-1,-1,-1,-122,-122,-122,-122,-73,-123,-44,-46,-53,-56,-57,-61,-62,-65,-126,-126,-126,-78,-69,-70,-71,-72,-1,-132,-45,-75,-76,-77,-74,-148,-54,-55,-130,-130,-130,-132,-119,-79,-58,-59,-60,-64,-36,]),'HACER':([134,138,139,140,141,143,161,162,163,164,167,168,169,170,171,172,173,191,194,195,197,204,207,208,212,213,215,216,217,218,219,220,221,222,223,224,228,232,237,250,251,252,253,256,262,264,265,266,267,268,269,270,271,282,284,286,287,288,289,301,],[-37,-128,-129,-130,-131,-63,-1,-1,-1,-1,-1,-122,-122,-122,-122,-73,-123,-40,-43,-44,-46,-53,-56,-57,-61,-62,-65,-126,-126,-126,-78,-69,-70,-71,-72,-1,-140,-132,-45,-75,-76,-77,-74,278,-148,-41,-42,-54,-55,-130,-130,-130,-132,-119,-79,-58,-59,-60,-64,-36,]),'ENTONCES':([227,],[255,]),'HAZ':([257,],[280,]),}
_lr_action = {}
for _k, _v in _lr_action_items.items():
for _x,_y in zip(_v[0],_v[1]):
if not _x in _lr_action: _lr_action[_x] = {}
_lr_action[_x][_k] = _y
del _lr_action_items
_lr_goto_items = {'PROGRAM':([0,],[1,]),'r_goto_main':([2,],[3,]),'VARS':([5,57,73,82,],[6,65,81,87,]),'empty':([5,7,9,18,21,33,53,56,57,61,69,72,73,76,79,82,89,94,121,123,125,126,154,157,158,160,161,162,163,164,165,167,177,181,183,189,196,214,224,231,235,236,244,245,246,247,248,254,257,263,276,283,306,],[8,12,19,19,12,40,60,64,8,60,40,80,8,64,60,8,95,95,134,147,147,147,147,147,187,190,194,197,207,212,147,219,40,147,147,147,147,147,134,261,147,147,147,147,147,147,147,274,281,187,294,147,261,]),'r_save_vars':([6,65,81,87,],[9,71,86,91,]),'VAR_AUX':([7,21,],[10,32,]),'TIPO':([7,20,21,53,61,79,],[11,30,11,58,58,58,]),'FUNCTIONS':([9,18,],[17,29,]),'FUNCTION':([9,18,],[18,18,]),'IDS':([11,50,],[21,55,]),'r_save_type':([13,14,15,16,31,],[23,24,25,26,37,]),'MAIN':([17,],[27,]),'r_register_var':([22,66,],[33,72,]),'r_print_constants':([27,],[34,]),'r_save_func':([28,36,43,],[35,42,48,]),'ARRDIM':([33,69,177,],[38,75,225,]),'r_register_arr':([33,69,177,],[39,39,39,]),'r_populate_r':([38,],[44,]),'r_register_func':([42,48,],[47,54,]),'r_register_princ':([46,],[52,]),'r_register_dim':([51,70,],[56,76,]),'r_save_param_func':([52,67,74,],[57,73,82,]),'PARAM':([53,61,79,],[59,68,85,]),'ARRDIM_AUX':([56,76,],[62,83,]),'r_end_princ':([71,],[77,]),'PARAM_AUX':([72,],[78,]),'r_func_set':([77,86,91,],[84,90,113,]),'BLOQUE':([84,90,113,255,278,279,303,],[88,112,131,276,296,299,307,]),'r_func_end':([88,112,131,],[92,130,155,]),'ESTATUTOS':([89,94,],[93,115,]),'ESTATUTO':([89,94,],[94,94,]),'ASIGNACION':([89,94,110,],[96,96,127,]),'FUN':([89,94,144,],[97,97,172,]),'COND':([89,94,255,278,279,],[98,98,277,297,300,]),'WRITE':([89,94,],[99,99,]),'READ':([89,94,],[100,100,]),'RETURN':([89,94,],[101,101,]),'IF':([89,94,255,278,279,],[103,103,103,103,103,]),'FOR':([89,94,255,278,279,],[104,104,104,104,104,]),'WHILE':([89,94,255,278,279,],[105,105,105,105,105,]),'r_seen_operand_id':([102,128,149,173,],[121,121,177,224,]),'r_check_func':([102,173,],[122,122,]),'r_set_while':([111,],[129,]),'ARRACC':([121,224,],[132,253,]),'WRITE_AUX':([123,189,],[136,234,]),'EXPRESION':([123,125,126,154,157,158,181,183,189,214,235,236,263,283,],[137,150,152,182,184,186,228,230,137,249,264,265,186,302,]),'SUBEXP':([123,125,126,154,157,158,181,183,189,196,214,235,236,263,283,],[138,138,138,138,138,138,138,138,138,237,138,138,138,138,138,]),'EXP':([123,125,126,154,157,158,181,183,189,196,214,235,236,244,245,263,283,],[139,139,139,139,139,139,139,139,139,139,139,139,139,266,267,139,139,]),'TERMINO':([123,125,126,154,157,158,181,183,189,196,214,235,236,244,245,246,247,248,263,283,],[140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,268,269,270,140,140,]),'FACTOR':([123,125,126,154,157,158,181,183,189,196,214,235,236,244,245,246,247,248,263,283,],[141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,]),'FACTOR_AUX':([123,125,126,154,157,158,165,181,183,189,196,214,235,236,244,245,246,247,248,263,283,],[143,143,143,143,143,143,213,143,143,143,143,143,143,143,143,143,143,143,143,143,143,]),'SIGN':([123,125,126,154,157,158,165,181,183,189,196,214,235,236,244,245,246,247,248,263,283,],[144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,]),'READ_AUX':([124,273,],[148,290,]),'r_set_for':([127,],[153,]),'r_check_dim':([133,],[157,]),'r_create_bottom':([135,],[158,]),'r_escribe':([137,],[160,]),'r_seen_subexp':([138,],[161,]),'r_seen_exp':([139,],[162,]),'r_seen_term':([140,268,269,270,],[163,286,287,288,]),'r_seen_factor':([141,],[164,]),'r_seen_unary_operator':([142,145,146,],[165,174,175,]),'CTE':([144,],[167,]),'r_check_int':([152,182,],[180,229,]),'r_seen_operator':([156,166,192,193,198,199,200,201,202,203,205,206,209,210,211,],[183,214,235,236,238,239,240,241,242,243,244,245,246,247,248,]),'FUN_AUX':([158,263,],[185,285,]),'WRITE_AUXSUB':([160,],[188,]),'EXPRESION_AUX':([161,],[191,]),'SUBEXP_AUX':([162,],[195,]),'COMPARACION':([162,],[196,]),'EXP_AUX':([163,],[204,]),'TERMINO_AUX':([164,],[208,]),'ARROP':([167,],[215,]),'r_seen_operand':([168,169,170,171,],[220,221,222,223,]),'r_regresa':([178,],[226,]),'r_create_quad':([184,302,],[231,306,]),'r_check_param':([186,],[233,]),'r_seen_operator_mat':([216,217,218,],[250,251,252,]),'r_lee':([225,],[254,]),'r_for_gen':([228,],[256,]),'r_seen_equal':([230,],[258,]),'ARRACC_AUX':([231,306,],[259,308,]),'r_pop_fake_bottom':([232,271,],[262,289,]),'READ_AUXSUB':([254,],[272,]),'IF2':([255,],[275,]),'WHILE_AUX':([257,],[279,]),'r_add_dim':([260,],[283,]),'r_go_sub':([262,],[284,]),'r_if_end':([275,],[291,]),'IF_AUX':([276,],[292,]),'FOR2':([278,],[295,]),'WHILE2':([279,],[298,]),'r_close_arracc':([282,],[301,]),'r_else_start':([293,],[303,]),'r_for_end':([295,],[304,]),'r_while_end':([298,],[305,]),}
_lr_goto = {}
for _k, _v in _lr_goto_items.items():
for _x, _y in zip(_v[0], _v[1]):
if not _x in _lr_goto: _lr_goto[_x] = {}
_lr_goto[_x][_k] = _y
del _lr_goto_items
_lr_productions = [
("S' -> PROGRAM","S'",1,None,None,None),
('empty -> <empty>','empty',0,'p_empty','parser.py',25),
('PROGRAM -> PROGRAMA r_goto_main ID DOTCOMA VARS r_save_vars FUNCTIONS MAIN r_print_constants','PROGRAM',9,'p_PROGRAM','parser.py',33),
('MAIN -> PRINCIPAL r_save_func LPAREN RPAREN r_register_princ r_save_param_func VARS r_save_vars r_end_princ r_func_set BLOQUE r_func_end','MAIN',12,'p_MAIN','parser.py',45),
('VARS -> VAR VAR_AUX','VARS',2,'p_VARS','parser.py',50),
('VARS -> empty','VARS',1,'p_VARS','parser.py',51),
('VAR_AUX -> TIPO IDS VAR_AUX','VAR_AUX',3,'p_VAR_AUX','parser.py',56),
('VAR_AUX -> empty','VAR_AUX',1,'p_VAR_AUX','parser.py',57),
('TIPO -> INT r_save_type','TIPO',2,'p_TIPO','parser.py',63),
('TIPO -> FLOAT r_save_type','TIPO',2,'p_TIPO','parser.py',64),
('TIPO -> CHAR r_save_type','TIPO',2,'p_TIPO','parser.py',65),
('TIPO -> STRING r_save_type','TIPO',2,'p_TIPO','parser.py',66),
('IDS -> ID r_register_var ARRDIM r_populate_r DOTCOMA','IDS',5,'p_IDS','parser.py',73),
('IDS -> ID r_register_var ARRDIM r_populate_r COMA IDS','IDS',6,'p_IDS','parser.py',74),
('ARRDIM -> r_register_arr LSTAPLE CTE_I r_register_dim ARRDIM_AUX RSTAPLE ARRDIM','ARRDIM',7,'p_ARRDIM','parser.py',81),
('ARRDIM -> empty','ARRDIM',1,'p_ARRDIM','parser.py',82),
('ARRDIM_AUX -> COMA CTE_I r_register_dim ARRDIM_AUX','ARRDIM_AUX',4,'p_ARRDIM_AUX','parser.py',88),
('ARRDIM_AUX -> empty','ARRDIM_AUX',1,'p_ARRDIM_AUX','parser.py',89),
('FUNCTIONS -> FUNCTION FUNCTIONS','FUNCTIONS',2,'p_FUNCTIONS','parser.py',94),
('FUNCTIONS -> empty','FUNCTIONS',1,'p_FUNCTIONS','parser.py',95),
('FUNCTION -> FUNCION TIPO ID r_save_func r_register_func LPAREN PARAM RPAREN r_save_param_func VARS r_save_vars r_func_set BLOQUE r_func_end','FUNCTION',14,'p_FUNCTION','parser.py',107),
('FUNCTION -> FUNCION VOID r_save_type ID r_save_func r_register_func LPAREN PARAM RPAREN r_save_param_func VARS r_save_vars r_func_set BLOQUE r_func_end','FUNCTION',15,'p_FUNCTION','parser.py',108),
('PARAM -> TIPO ID r_register_var PARAM_AUX','PARAM',4,'p_PARAM','parser.py',115),
('PARAM -> empty','PARAM',1,'p_PARAM','parser.py',116),
('PARAM_AUX -> COMA PARAM','PARAM_AUX',2,'p_PARAM_AUX','parser.py',121),
('PARAM_AUX -> empty','PARAM_AUX',1,'p_PARAM_AUX','parser.py',122),
('BLOQUE -> LBRACKET ESTATUTOS RBRACKET','BLOQUE',3,'p_BLOQUE','parser.py',127),
('ESTATUTOS -> ESTATUTO ESTATUTOS','ESTATUTOS',2,'p_ESTATUTOS','parser.py',132),
('ESTATUTOS -> empty','ESTATUTOS',1,'p_ESTATUTOS','parser.py',133),
('ESTATUTO -> ASIGNACION DOTCOMA','ESTATUTO',2,'p_ESTATUTO','parser.py',138),
('ESTATUTO -> FUN DOTCOMA','ESTATUTO',2,'p_ESTATUTO','parser.py',139),
('ESTATUTO -> COND','ESTATUTO',1,'p_ESTATUTO','parser.py',140),
('ESTATUTO -> WRITE DOTCOMA','ESTATUTO',2,'p_ESTATUTO','parser.py',141),
('ESTATUTO -> READ DOTCOMA','ESTATUTO',2,'p_ESTATUTO','parser.py',142),
('ESTATUTO -> RETURN DOTCOMA','ESTATUTO',2,'p_ESTATUTO','parser.py',143),
('ASIGNACION -> ID r_seen_operand_id ARRACC EQUAL r_seen_operator EXPRESION r_seen_equal','ASIGNACION',7,'p_ASIGNACION','parser.py',151),
('ARRACC -> LSTAPLE r_check_dim EXPRESION r_create_quad ARRACC_AUX RSTAPLE r_close_arracc','ARRACC',7,'p_ARRACC','parser.py',159),
('ARRACC -> empty','ARRACC',1,'p_ARRACC','parser.py',160),
('ARRACC_AUX -> COMA r_add_dim EXPRESION r_create_quad ARRACC_AUX','ARRACC_AUX',5,'p_ARRACC_AUX','parser.py',167),
('ARRACC_AUX -> empty','ARRACC_AUX',1,'p_ARRACC_AUX','parser.py',168),
('EXPRESION -> SUBEXP r_seen_subexp EXPRESION_AUX','EXPRESION',3,'p_EXPRESION','parser.py',174),
('EXPRESION_AUX -> AND r_seen_operator EXPRESION','EXPRESION_AUX',3,'p_EXPRESION_AUX','parser.py',180),
('EXPRESION_AUX -> OR r_seen_operator EXPRESION','EXPRESION_AUX',3,'p_EXPRESION_AUX','parser.py',181),
('EXPRESION_AUX -> empty','EXPRESION_AUX',1,'p_EXPRESION_AUX','parser.py',182),
('SUBEXP -> EXP r_seen_exp SUBEXP_AUX','SUBEXP',3,'p_SUBEXP','parser.py',188),
('SUBEXP_AUX -> COMPARACION SUBEXP','SUBEXP_AUX',2,'p_SUBEXP_AUX','parser.py',193),
('SUBEXP_AUX -> empty','SUBEXP_AUX',1,'p_SUBEXP_AUX','parser.py',194),
('COMPARACION -> MORE r_seen_operator','COMPARACION',2,'p_COMPARACION','parser.py',200),
('COMPARACION -> LESS r_seen_operator','COMPARACION',2,'p_COMPARACION','parser.py',201),
('COMPARACION -> COMPARE r_seen_operator','COMPARACION',2,'p_COMPARACION','parser.py',202),
('COMPARACION -> DIFFERENT r_seen_operator','COMPARACION',2,'p_COMPARACION','parser.py',203),
('COMPARACION -> MOREEQUAL r_seen_operator','COMPARACION',2,'p_COMPARACION','parser.py',204),
('COMPARACION -> LESSEQUAL r_seen_operator','COMPARACION',2,'p_COMPARACION','parser.py',205),
('EXP -> TERMINO r_seen_term EXP_AUX','EXP',3,'p_EXP','parser.py',211),
('EXP_AUX -> PLUS r_seen_operator EXP','EXP_AUX',3,'p_EXP_AUX','parser.py',217),
('EXP_AUX -> MINUS r_seen_operator EXP','EXP_AUX',3,'p_EXP_AUX','parser.py',218),
('EXP_AUX -> empty','EXP_AUX',1,'p_EXP_AUX','parser.py',219),
('TERMINO -> FACTOR r_seen_factor TERMINO_AUX','TERMINO',3,'p_TERMINO','parser.py',225),
('TERMINO_AUX -> MULT r_seen_operator TERMINO r_seen_term','TERMINO_AUX',4,'p_TERMINO_AUX','parser.py',232),
('TERMINO_AUX -> DIV r_seen_operator TERMINO r_seen_term','TERMINO_AUX',4,'p_TERMINO_AUX','parser.py',233),
('TERMINO_AUX -> MOD r_seen_operator TERMINO r_seen_term','TERMINO_AUX',4,'p_TERMINO_AUX','parser.py',234),
('TERMINO_AUX -> empty','TERMINO_AUX',1,'p_TERMINO_AUX','parser.py',235),
('FACTOR -> NOT r_seen_unary_operator FACTOR_AUX','FACTOR',3,'p_FACTOR','parser.py',242),
('FACTOR -> FACTOR_AUX','FACTOR',1,'p_FACTOR','parser.py',243),
('FACTOR_AUX -> SIGN LPAREN r_seen_operator EXPRESION RPAREN r_pop_fake_bottom','FACTOR_AUX',6,'p_FACTOR_AUX','parser.py',253),
('FACTOR_AUX -> SIGN CTE ARROP','FACTOR_AUX',3,'p_FACTOR_AUX','parser.py',254),
('SIGN -> PLUS r_seen_unary_operator','SIGN',2,'p_SIGN','parser.py',262),
('SIGN -> MINUS r_seen_unary_operator','SIGN',2,'p_SIGN','parser.py',263),
('SIGN -> empty','SIGN',1,'p_SIGN','parser.py',264),
('CTE -> CTE_I r_seen_operand','CTE',2,'p_CTE','parser.py',270),
('CTE -> CTE_F r_seen_operand','CTE',2,'p_CTE','parser.py',271),
('CTE -> CTE_CH r_seen_operand','CTE',2,'p_CTE','parser.py',272),
('CTE -> CTE_STRING r_seen_operand','CTE',2,'p_CTE','parser.py',273),
('CTE -> FUN','CTE',1,'p_CTE','parser.py',274),
('CTE -> ID r_seen_operand_id ARRACC','CTE',3,'p_CTE','parser.py',275),
('ARROP -> DET_ARR r_seen_operator_mat','ARROP',2,'p_ARROP','parser.py',281),
('ARROP -> TRANS_ARR r_seen_operator_mat','ARROP',2,'p_ARROP','parser.py',282),
('ARROP -> INV_ARR r_seen_operator_mat','ARROP',2,'p_ARROP','parser.py',283),
('ARROP -> empty','ARROP',1,'p_ARROP','parser.py',284),
('FUN -> ID r_check_func LPAREN r_create_bottom FUN_AUX RPAREN r_pop_fake_bottom r_go_sub','FUN',8,'p_FUN','parser.py',291),
('FUN_AUX -> EXPRESION r_check_param COMA FUN_AUX','FUN_AUX',4,'p_FUN_AUX','parser.py',297),
('FUN_AUX -> EXPRESION r_check_param','FUN_AUX',2,'p_FUN_AUX','parser.py',298),
('FUN_AUX -> empty','FUN_AUX',1,'p_FUN_AUX','parser.py',299),
('COND -> IF','COND',1,'p_COND','parser.py',304),
('COND -> FOR','COND',1,'p_COND','parser.py',305),
('COND -> WHILE','COND',1,'p_COND','parser.py',306),
('IF -> SI LPAREN EXPRESION r_check_int RPAREN ENTONCES IF2 r_if_end','IF',8,'p_IF','parser.py',313),
('IF2 -> BLOQUE IF_AUX','IF2',2,'p_IF2','parser.py',318),
('IF2 -> COND','IF2',1,'p_IF2','parser.py',319),
('IF_AUX -> SINO r_else_start BLOQUE','IF_AUX',3,'p_IF_AUX','parser.py',325),
('IF_AUX -> empty','IF_AUX',1,'p_IF_AUX','parser.py',326),
('WHILE -> MIENTRAS r_set_while LPAREN EXPRESION r_check_int RPAREN WHILE_AUX WHILE2 r_while_end','WHILE',9,'p_WHILE','parser.py',334),
('WHILE2 -> BLOQUE','WHILE2',1,'p_WHILE2','parser.py',339),
('WHILE2 -> COND','WHILE2',1,'p_WHILE2','parser.py',340),
('WHILE_AUX -> HAZ','WHILE_AUX',1,'p_WHILE_AUX','parser.py',345),
('WHILE_AUX -> empty','WHILE_AUX',1,'p_WHILE_AUX','parser.py',346),
('FOR -> DESDE ASIGNACION r_set_for HASTA EXPRESION r_for_gen HACER FOR2 r_for_end','FOR',9,'p_FOR','parser.py',354),
('FOR2 -> BLOQUE','FOR2',1,'p_FOR2','parser.py',359),
('FOR2 -> COND','FOR2',1,'p_FOR2','parser.py',360),
('WRITE -> ESCRIBE LPAREN WRITE_AUX RPAREN','WRITE',4,'p_WRITE','parser.py',365),
('WRITE_AUX -> EXPRESION r_escribe WRITE_AUXSUB','WRITE_AUX',3,'p_WRITE_AUX','parser.py',371),
('WRITE_AUXSUB -> COMA WRITE_AUX','WRITE_AUXSUB',2,'p_WRITE_AUXSUB','parser.py',376),
('WRITE_AUXSUB -> empty','WRITE_AUXSUB',1,'p_WRITE_AUXSUB','parser.py',377),
('READ -> LEE LPAREN READ_AUX RPAREN','READ',4,'p_READ','parser.py',382),
('READ_AUX -> ID r_seen_operand_id ARRDIM r_lee READ_AUXSUB','READ_AUX',5,'p_READ_AUX','parser.py',389),
('READ_AUXSUB -> COMA READ_AUX','READ_AUXSUB',2,'p_READ_AUXSUB','parser.py',394),
('READ_AUXSUB -> empty','READ_AUXSUB',1,'p_READ_AUXSUB','parser.py',395),
('RETURN -> REGRESA LPAREN EXPRESION RPAREN r_regresa','RETURN',5,'p_RETURN','parser.py',401),
('RETURN -> REGRESA LPAREN NULL RPAREN','RETURN',4,'p_RETURN','parser.py',402),
('r_save_type -> <empty>','r_save_type',0,'p_r_save_type','parser.py',419),
('r_save_func -> <empty>','r_save_func',0,'p_r_save_func','parser.py',425),
('r_register_func -> <empty>','r_register_func',0,'p_r_register_func','parser.py',431),
('r_register_var -> <empty>','r_register_var',0,'p_r_register_var','parser.py',451),
('r_register_arr -> <empty>','r_register_arr',0,'p_r_register_arr','parser.py',478),
('r_register_dim -> <empty>','r_register_dim',0,'p_r_register_dim','parser.py',489),
('r_populate_r -> <empty>','r_populate_r',0,'p_r_populate_r','parser.py',509),
('r_check_dim -> <empty>','r_check_dim',0,'p_r_check_dim','parser.py',537),
('r_create_quad -> <empty>','r_create_quad',0,'p_r_create_quad','parser.py',551),
('r_add_dim -> <empty>','r_add_dim',0,'p_r_add_dim','parser.py',594),
('r_close_arracc -> <empty>','r_close_arracc',0,'p_r_close_arracc','parser.py',602),
('r_register_princ -> <empty>','r_register_princ',0,'p_r_register_princ','parser.py',642),
('r_end_princ -> <empty>','r_end_princ',0,'p_r_end_princ','parser.py',650),
('r_seen_operand -> <empty>','r_seen_operand',0,'p_r_seen_operand','parser.py',657),
('r_seen_operand_id -> <empty>','r_seen_operand_id',0,'p_r_seen_operand_id','parser.py',664),
('r_seen_operator -> <empty>','r_seen_operator',0,'p_r_seen_operator','parser.py',671),
('r_seen_unary_operator -> <empty>','r_seen_unary_operator',0,'p_r_seen_unary_operator','parser.py',678),
('r_seen_operator_mat -> <empty>','r_seen_operator_mat',0,'p_r_seen_operator_mat','parser.py',692),
('r_seen_equal -> <empty>','r_seen_equal',0,'p_r_seen_equal','parser.py',700),
('r_seen_subexp -> <empty>','r_seen_subexp',0,'p_r_seen_subexp','parser.py',707),
('r_seen_exp -> <empty>','r_seen_exp',0,'p_r_seen_exp','parser.py',714),
('r_seen_term -> <empty>','r_seen_term',0,'p_r_seen_term','parser.py',721),
('r_seen_factor -> <empty>','r_seen_factor',0,'p_r_seen_factor','parser.py',728),
('r_pop_fake_bottom -> <empty>','r_pop_fake_bottom',0,'p_r_pop_fake_bottom','parser.py',735),
('r_create_bottom -> <empty>','r_create_bottom',0,'p_r_create_bottom','parser.py',741),
('r_check_int -> <empty>','r_check_int',0,'p_r_check_int','parser.py',748),
('r_if_end -> <empty>','r_if_end',0,'p_r_if_end','parser.py',755),
('r_else_start -> <empty>','r_else_start',0,'p_r_else_start','parser.py',762),
('r_set_while -> <empty>','r_set_while',0,'p_r_set_while','parser.py',769),
('r_while_end -> <empty>','r_while_end',0,'p_r_while_end','parser.py',776),
('r_set_for -> <empty>','r_set_for',0,'p_r_set_for','parser.py',783),
('r_for_gen -> <empty>','r_for_gen',0,'p_r_for_gen','parser.py',790),
('r_for_end -> <empty>','r_for_end',0,'p_r_for_end','parser.py',797),
('r_save_param_func -> <empty>','r_save_param_func',0,'p_r_save_param_func','parser.py',804),
('r_save_vars -> <empty>','r_save_vars',0,'p_r_save_vars','parser.py',811),
('r_func_set -> <empty>','r_func_set',0,'p_r_func_set','parser.py',818),
('r_func_end -> <empty>','r_func_end',0,'p_r_func_end','parser.py',825),
('r_check_func -> <empty>','r_check_func',0,'p_r_check_func','parser.py',832),
('r_check_param -> <empty>','r_check_param',0,'p_r_check_param','parser.py',841),
('r_go_sub -> <empty>','r_go_sub',0,'p_r_go_sub','parser.py',849),
('r_goto_main -> <empty>','r_goto_main',0,'p_r_goto_main','parser.py',857),
('r_regresa -> <empty>','r_regresa',0,'p_r_regresa','parser.py',864),
('r_escribe -> <empty>','r_escribe',0,'p_r_escribe','parser.py',871),
('r_lee -> <empty>','r_lee',0,'p_r_lee','parser.py',878),
('r_print_constants -> <empty>','r_print_constants',0,'p_r_print_constants','parser.py',885),
]
| 215.896739 | 16,748 | 0.666407 | 8,088 | 39,725 | 3.113254 | 0.071835 | 0.04861 | 0.027522 | 0.031454 | 0.58614 | 0.534988 | 0.498173 | 0.482168 | 0.466362 | 0.434988 | 0 | 0.338148 | 0.046595 | 39,725 | 183 | 16,749 | 217.076503 | 0.326688 | 0.002115 | 0 | 0.011561 | 1 | 0.00578 | 0.386921 | 0.012413 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.023121 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
e2c9ebf48a2f930a70bce8e702fc0b264badab6f | 167 | py | Python | docs/_build/jupyter_execute/vignette_example.py | connixu/ny_artsy_date | 212a83086e8ca046bc6eda5ebecc5aacad3f63e6 | [
"MIT"
] | 1 | 2021-12-21T21:14:04.000Z | 2021-12-21T21:14:04.000Z | docs/_build/jupyter_execute/vignette_example.py | connixu/ny_artsy_date | 212a83086e8ca046bc6eda5ebecc5aacad3f63e6 | [
"MIT"
] | null | null | null | docs/_build/jupyter_execute/vignette_example.py | connixu/ny_artsy_date | 212a83086e8ca046bc6eda5ebecc5aacad3f63e6 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# coding: utf-8
# # Example usage
#
# To use `ny_artsy_date` in a project:
# In[1]:
import ny_artsy_date
print(ny_artsy_date.__version__)
| 11.133333 | 38 | 0.694611 | 28 | 167 | 3.785714 | 0.75 | 0.198113 | 0.311321 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014493 | 0.173653 | 167 | 14 | 39 | 11.928571 | 0.753623 | 0.562874 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0.5 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 5 |
e2f757494dea94643e41c72bc77817cb9afbe220 | 165 | py | Python | budgetcenter/budgetcenter/doctype/auroville_maintenance_item_table/test_auroville_maintenance_item_table.py | yuvabedev/budgetcenter | d3307500fa9fa71c0d292951282f1f6f135ff510 | [
"MIT"
] | null | null | null | budgetcenter/budgetcenter/doctype/auroville_maintenance_item_table/test_auroville_maintenance_item_table.py | yuvabedev/budgetcenter | d3307500fa9fa71c0d292951282f1f6f135ff510 | [
"MIT"
] | 3 | 2022-01-04T06:30:57.000Z | 2022-01-19T06:42:40.000Z | budgetcenter/budgetcenter/doctype/auroville_maintenance_item_table/test_auroville_maintenance_item_table.py | yuvabedev/budgetcenter | d3307500fa9fa71c0d292951282f1f6f135ff510 | [
"MIT"
] | null | null | null | # Copyright (c) 2021, Yuvavbe and Contributors
# See license.txt
# import frappe
import unittest
class TestAurovilleMaintenanceItemTable(unittest.TestCase):
pass
| 18.333333 | 59 | 0.806061 | 18 | 165 | 7.388889 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027778 | 0.127273 | 165 | 8 | 60 | 20.625 | 0.895833 | 0.448485 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.333333 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 5 |
39077c53fc87c57c3ab243a037c79342656727e6 | 85 | py | Python | venddb/views.py | PHSCRC/vendingserver | 2f3e8920a58f11d241b5fe862aba3eeedd57c9e3 | [
"Apache-2.0"
] | null | null | null | venddb/views.py | PHSCRC/vendingserver | 2f3e8920a58f11d241b5fe862aba3eeedd57c9e3 | [
"Apache-2.0"
] | null | null | null | venddb/views.py | PHSCRC/vendingserver | 2f3e8920a58f11d241b5fe862aba3eeedd57c9e3 | [
"Apache-2.0"
] | null | null | null | from django.shortcuts import render
from . import models
# Create your views here.
| 14.166667 | 35 | 0.776471 | 12 | 85 | 5.5 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.176471 | 85 | 5 | 36 | 17 | 0.942857 | 0.270588 | 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 | 1 | 0 | 0 | 5 |
1a309402d864a31e994ffddb348a018bcad1fd82 | 190 | py | Python | python_modules/libraries/dagstermill/dagstermill_tests/test_repository.py | bitdotioinc/dagster | 4fe395a37b206b1a48b956fa5dd72bf698104cca | [
"Apache-2.0"
] | 1 | 2021-04-27T19:49:59.000Z | 2021-04-27T19:49:59.000Z | python_modules/libraries/dagstermill/dagstermill_tests/test_repository.py | bitdotioinc/dagster | 4fe395a37b206b1a48b956fa5dd72bf698104cca | [
"Apache-2.0"
] | 7 | 2022-03-16T06:55:04.000Z | 2022-03-18T07:03:25.000Z | python_modules/libraries/dagstermill/dagstermill_tests/test_repository.py | bitdotioinc/dagster | 4fe395a37b206b1a48b956fa5dd72bf698104cca | [
"Apache-2.0"
] | 1 | 2020-08-20T14:20:31.000Z | 2020-08-20T14:20:31.000Z | from dagstermill.examples.repository import notebook_repo
from dagster import RepositoryDefinition
def test_dagstermill_repo():
assert isinstance(notebook_repo, RepositoryDefinition)
| 23.75 | 58 | 0.852632 | 20 | 190 | 7.9 | 0.65 | 0.151899 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.105263 | 190 | 7 | 59 | 27.142857 | 0.929412 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.25 | true | 0 | 0.5 | 0 | 0.75 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
1a519329eb4ae5d7f7b589948e2782d816f96ba8 | 257 | py | Python | backend/apps/cmdb/serializers/__init__.py | codelieche/erp | 96861ff63a63a93918fbd5181ffb2646446d0eec | [
"MIT"
] | null | null | null | backend/apps/cmdb/serializers/__init__.py | codelieche/erp | 96861ff63a63a93918fbd5181ffb2646446d0eec | [
"MIT"
] | 29 | 2020-06-05T19:57:11.000Z | 2022-02-26T13:42:36.000Z | backend/apps/cmdb/serializers/__init__.py | codelieche/erp | 96861ff63a63a93918fbd5181ffb2646446d0eec | [
"MIT"
] | null | null | null | # -*- coding:utf-8 -*-
from .model import ModelSerializer, ModelInfoSerializer
from .field import FieldModelSerializer
from .instance import InstanceModelSerializer
from .value import ValueModelSerializer
from .permission import PermissionModelSerializer
| 28.555556 | 55 | 0.836576 | 24 | 257 | 8.958333 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004348 | 0.105058 | 257 | 8 | 56 | 32.125 | 0.930435 | 0.077821 | 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 | 1 | 0 | 0 | 5 |
1a55878182214db9af28b16a925071cd8590d067 | 384 | py | Python | api/service/dao/demand.py | feiwencaho/sharezone | 0a72cef8d9c1b6fa8e007c2df55d32fbdb43fa23 | [
"Apache-2.0"
] | null | null | null | api/service/dao/demand.py | feiwencaho/sharezone | 0a72cef8d9c1b6fa8e007c2df55d32fbdb43fa23 | [
"Apache-2.0"
] | 6 | 2021-03-18T21:23:50.000Z | 2022-03-11T23:32:30.000Z | api/service/dao/demand.py | hifeiwenchao/sharezone | 0a72cef8d9c1b6fa8e007c2df55d32fbdb43fa23 | [
"Apache-2.0"
] | null | null | null | from api.models import Demand
from django.db.models import Count
def create(**kwargs):
return Demand.objects.create(**kwargs)
def get_demand(**kwargs):
return Demand.objects.filter(**kwargs).first()
def get_demands(**kwargs):
return Demand.objects.filter(**kwargs).all()
def demand_count(user):
return Demand.objects.all().annotate(demand_count=Count("user"))
| 20.210526 | 68 | 0.726563 | 52 | 384 | 5.288462 | 0.384615 | 0.174545 | 0.276364 | 0.272727 | 0.269091 | 0.269091 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | 384 | 18 | 69 | 21.333333 | 0.818452 | 0 | 0 | 0 | 0 | 0 | 0.010417 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0 | 0.2 | 0.4 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 5 |
1aa8161a54e886314d199d5040a01206b88e29be | 181 | py | Python | mysite/editor/admin.py | dkaimekin/zhana-aygerim-backend | 306f28b019fe6bce982bbd10a8f50c1d7da9bfe4 | [
"MIT"
] | null | null | null | mysite/editor/admin.py | dkaimekin/zhana-aygerim-backend | 306f28b019fe6bce982bbd10a8f50c1d7da9bfe4 | [
"MIT"
] | null | null | null | mysite/editor/admin.py | dkaimekin/zhana-aygerim-backend | 306f28b019fe6bce982bbd10a8f50c1d7da9bfe4 | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import Image, User, Order
# Register your models here.
admin.site.register(User)
admin.site.register(Order)
admin.site.register(Image) | 25.857143 | 38 | 0.801105 | 27 | 181 | 5.37037 | 0.481481 | 0.186207 | 0.351724 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.099448 | 181 | 7 | 39 | 25.857143 | 0.889571 | 0.143646 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 5 |
46b9b3aac93acec1d59e41dcbf9e55a686f617ac | 77 | py | Python | src/dcllottery/__init__.py | deepcloudlabs/lottery | 06185e68bc4168b306108890dea02fa23a14106d | [
"MIT"
] | null | null | null | src/dcllottery/__init__.py | deepcloudlabs/lottery | 06185e68bc4168b306108890dea02fa23a14106d | [
"MIT"
] | null | null | null | src/dcllottery/__init__.py | deepcloudlabs/lottery | 06185e68bc4168b306108890dea02fa23a14106d | [
"MIT"
] | 1 | 2021-09-07T21:45:16.000Z | 2021-09-07T21:45:16.000Z | print("dcllottery package is loaded!")
# all initialization code goes here
| 25.666667 | 39 | 0.766234 | 10 | 77 | 5.9 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.155844 | 77 | 2 | 40 | 38.5 | 0.907692 | 0.428571 | 0 | 0 | 0 | 0 | 0.725 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
204833f44fdc1cdbb2c535a00990a8166815824e | 50 | py | Python | neupy/plots/__init__.py | FrostByte266/neupy | 4b7127e5e4178b0cce023ba36542f5ad3f1d798c | [
"MIT"
] | 801 | 2015-09-23T09:24:47.000Z | 2022-03-29T19:19:03.000Z | neupy/plots/__init__.py | FrostByte266/neupy | 4b7127e5e4178b0cce023ba36542f5ad3f1d798c | [
"MIT"
] | 277 | 2015-09-22T19:48:50.000Z | 2022-03-11T23:25:32.000Z | neupy/plots/__init__.py | FrostByte266/neupy | 4b7127e5e4178b0cce023ba36542f5ad3f1d798c | [
"MIT"
] | 194 | 2015-09-23T15:03:57.000Z | 2022-03-31T13:54:46.000Z | from .hinton import *
from .saliency_map import *
| 16.666667 | 27 | 0.76 | 7 | 50 | 5.285714 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.16 | 50 | 2 | 28 | 25 | 0.880952 | 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 | 1 | 0 | 0 | 5 |
2059cefa76346776224cacf36bdb3d0d57d8af8c | 189 | py | Python | pysdds/__init__.py | nikitakuklev/pySDDS | 3f5a104712813b7494b56ff959a5feef1271d889 | [
"MIT"
] | null | null | null | pysdds/__init__.py | nikitakuklev/pySDDS | 3f5a104712813b7494b56ff959a5feef1271d889 | [
"MIT"
] | null | null | null | pysdds/__init__.py | nikitakuklev/pySDDS | 3f5a104712813b7494b56ff959a5feef1271d889 | [
"MIT"
] | null | null | null | __author__ = "Nikita Kuklev"
from .readers import read
from .writers import write
from .structures import SDDSFile
from . import _version
__version__ = _version.get_versions()['version']
| 21 | 48 | 0.78836 | 23 | 189 | 6 | 0.608696 | 0.202899 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.132275 | 189 | 8 | 49 | 23.625 | 0.841463 | 0 | 0 | 0 | 0 | 0 | 0.10582 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
6489ef6c9e076cdf2e75ccca30d4a6b07b5d710f | 141 | py | Python | ex2.py | AyeNandar/python-exercises | 63936b53a48dafd96b7e9b222167faf5124bb86c | [
"MIT"
] | null | null | null | ex2.py | AyeNandar/python-exercises | 63936b53a48dafd96b7e9b222167faf5124bb86c | [
"MIT"
] | null | null | null | ex2.py | AyeNandar/python-exercises | 63936b53a48dafd96b7e9b222167faf5124bb86c | [
"MIT"
] | null | null | null | print("hello world")
print("hello again")
print("I like typing this")
print("This is fun")
print('Yay!Printing')
print("Hello to mandalay")
| 17.625 | 27 | 0.70922 | 22 | 141 | 4.545455 | 0.636364 | 0.3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.113475 | 141 | 7 | 28 | 20.142857 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0.571429 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 5 |
649501c5d0d34f0b765ec2e4f2ac40fd42a786b6 | 477 | py | Python | Python/creational_patterns/prototype/framework/manager.py | ploukareas/Design-Patterns | 8effde38d73ae9058c3028c97ef395644a90d55b | [
"BSD-3-Clause",
"MIT"
] | 28 | 2018-09-28T07:45:35.000Z | 2022-02-12T12:25:05.000Z | Python/creational_patterns/prototype/framework/manager.py | ploukareas/Design-Patterns | 8effde38d73ae9058c3028c97ef395644a90d55b | [
"BSD-3-Clause",
"MIT"
] | null | null | null | Python/creational_patterns/prototype/framework/manager.py | ploukareas/Design-Patterns | 8effde38d73ae9058c3028c97ef395644a90d55b | [
"BSD-3-Clause",
"MIT"
] | 5 | 2021-05-10T23:19:55.000Z | 2022-03-04T20:26:35.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# ˅
# ˄
class Manager(object):
# ˅
# ˄
def __init__(self):
self.__display = {}
# ˅
pass
# ˄
def register_display(self, display_name, display):
# ˅
self.__display[display_name] = display
# ˄
def get_display(self, display_name):
# ˅
d = self.__display[display_name]
return d.clone()
# ˄
# ˅
# ˄
# ˅
# ˄
| 11.925 | 54 | 0.454927 | 56 | 477 | 3.839286 | 0.410714 | 0.255814 | 0.167442 | 0.204651 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00346 | 0.39413 | 477 | 39 | 55 | 12.230769 | 0.692042 | 0.146751 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0.111111 | 0 | 0 | 0.555556 | 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 | 1 | 0 | 0 | 5 |
6496ac9adfad2d47a85aa69ea7cbd929d7137633 | 640 | py | Python | examples/custom_env_basic/custom_env.py | ZimmermanGroup/conformer-rl | beb98cbee6ba6efba686d7c6eebbf33fd737f279 | [
"MIT"
] | 9 | 2021-09-03T18:46:46.000Z | 2022-03-22T05:47:20.000Z | examples/custom_env_basic/custom_env.py | ZimmermanGroup/conformer-rl | beb98cbee6ba6efba686d7c6eebbf33fd737f279 | [
"MIT"
] | 4 | 2021-07-15T03:57:26.000Z | 2021-08-03T06:27:28.000Z | examples/custom_env_basic/custom_env.py | ZimmermanGroup/conformer-rl | beb98cbee6ba6efba686d7c6eebbf33fd737f279 | [
"MIT"
] | 1 | 2022-03-17T01:59:36.000Z | 2022-03-17T01:59:36.000Z | from conformer_rl.environments import ConformerEnv
from conformer_rl.environments.environment_components.action_mixins import DiscreteActionMixin
from conformer_rl.environments.environment_components.obs_mixins import AtomTypeGraphObsMixin
from conformer_rl.environments.environment_components.reward_mixins import GibbsPruningRewardMixin
import gym
# construct custom environment from pre-built environment mixins
class TestEnv(DiscreteActionMixin, AtomTypeGraphObsMixin, GibbsPruningRewardMixin, ConformerEnv):
pass
# register the environment with OpenAI gym
gym.register(
id='TestEnv-v0',
entry_point='custom_env:TestEnv'
) | 42.666667 | 98 | 0.864063 | 69 | 640 | 7.84058 | 0.463768 | 0.096118 | 0.110906 | 0.19963 | 0.266174 | 0.266174 | 0 | 0 | 0 | 0 | 0 | 0.001712 | 0.0875 | 640 | 15 | 99 | 42.666667 | 0.924658 | 0.160938 | 0 | 0 | 0 | 0 | 0.052336 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.090909 | 0.454545 | 0 | 0.545455 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 5 |
64a506c7696d74384c4bb78560f091d6cc4141e4 | 153 | py | Python | KID/agent/__init__.py | microsoft/KID | a23e9d819b53605b6426170124feed10288c6f8b | [
"MIT"
] | 13 | 2022-03-22T11:45:54.000Z | 2022-03-30T18:16:46.000Z | KID/agent/__init__.py | microsoft/KID | a23e9d819b53605b6426170124feed10288c6f8b | [
"MIT"
] | null | null | null | KID/agent/__init__.py | microsoft/KID | a23e9d819b53605b6426170124feed10288c6f8b | [
"MIT"
] | null | null | null | """Agent package"""
from KID.agent.base_agent import BaseAgent
from KID.agent.kid_agent import KIDAgent
__all__ = [
'BaseAgent',
'KIDAgent',
]
| 15.3 | 42 | 0.705882 | 19 | 153 | 5.368421 | 0.473684 | 0.235294 | 0.235294 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.169935 | 153 | 9 | 43 | 17 | 0.80315 | 0.084967 | 0 | 0 | 0 | 0 | 0.126866 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 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 | 1 | 0 | 0 | 0 | 0 | 5 |
b3c92ac05ad01920971a443a2829b8d348c79573 | 123 | py | Python | tests/plugin/testplugin_invalid.py | xcgx/streamlink | b635e0d9d0fe9363817a96ec7d31faefed95cb57 | [
"BSD-2-Clause"
] | 10 | 2017-04-10T18:25:41.000Z | 2021-09-15T20:14:58.000Z | tests/plugin/testplugin_invalid.py | xcgx/streamlink | b635e0d9d0fe9363817a96ec7d31faefed95cb57 | [
"BSD-2-Clause"
] | 9 | 2020-04-04T09:49:52.000Z | 2020-04-21T01:52:02.000Z | tests/plugin/testplugin_invalid.py | xcgx/streamlink | b635e0d9d0fe9363817a96ec7d31faefed95cb57 | [
"BSD-2-Clause"
] | 12 | 2022-01-30T23:34:18.000Z | 2022-03-26T17:09:43.000Z | class TestPluginInvalid:
pass
# does not inherit from streamlink.plugin.plugin.Plugin
__plugin__ = TestPluginInvalid
| 17.571429 | 55 | 0.804878 | 13 | 123 | 7.307692 | 0.692308 | 0.378947 | 0.378947 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.146341 | 123 | 6 | 56 | 20.5 | 0.904762 | 0.430894 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.333333 | 0 | 0 | 0.333333 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 5 |
b3e3db85ce6777c44676ed9a253b57311494863c | 67 | py | Python | KD_Lib/KD/text/BERT2LSTM/__init__.py | PiaCuk/KD_Lib | 153299d484e4c6b33793749709dbb0f33419f190 | [
"MIT"
] | 360 | 2020-05-11T08:18:20.000Z | 2022-03-31T01:48:43.000Z | KD_Lib/KD/text/BERT2LSTM/__init__.py | PiaCuk/KD_Lib | 153299d484e4c6b33793749709dbb0f33419f190 | [
"MIT"
] | 91 | 2020-05-11T08:14:56.000Z | 2022-03-30T05:29:03.000Z | KD_Lib/KD/text/BERT2LSTM/__init__.py | PiaCuk/KD_Lib | 153299d484e4c6b33793749709dbb0f33419f190 | [
"MIT"
] | 39 | 2020-05-11T08:06:47.000Z | 2022-03-29T05:11:18.000Z | from .bert2lstm import BERT2LSTM
from .utils import get_essentials
| 22.333333 | 33 | 0.850746 | 9 | 67 | 6.222222 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.033898 | 0.119403 | 67 | 2 | 34 | 33.5 | 0.915254 | 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 | 1 | 0 | 0 | 5 |
b3f9a5ad3a652326685a3fb2ac94fb05eae616cb | 43 | py | Python | tests/components/ambiclimate/__init__.py | domwillcode/home-assistant | f170c80bea70c939c098b5c88320a1c789858958 | [
"Apache-2.0"
] | 30,023 | 2016-04-13T10:17:53.000Z | 2020-03-02T12:56:31.000Z | tests/components/ambiclimate/__init__.py | jagadeeshvenkatesh/core | 1bd982668449815fee2105478569f8e4b5670add | [
"Apache-2.0"
] | 31,101 | 2020-03-02T13:00:16.000Z | 2022-03-31T23:57:36.000Z | tests/components/ambiclimate/__init__.py | jagadeeshvenkatesh/core | 1bd982668449815fee2105478569f8e4b5670add | [
"Apache-2.0"
] | 11,956 | 2016-04-13T18:42:31.000Z | 2020-03-02T09:32:12.000Z | """Tests for the Ambiclimate component."""
| 21.5 | 42 | 0.72093 | 5 | 43 | 6.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.116279 | 43 | 1 | 43 | 43 | 0.815789 | 0.837209 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
37480f6229f0dff1491ea05d0545a86de3f674fa | 43 | py | Python | pythonpower.py | Vemassa/hacktoberfest-1 | 1979b83285650e6ed642330314b2273052ee8b5f | [
"MIT"
] | null | null | null | pythonpower.py | Vemassa/hacktoberfest-1 | 1979b83285650e6ed642330314b2273052ee8b5f | [
"MIT"
] | null | null | null | pythonpower.py | Vemassa/hacktoberfest-1 | 1979b83285650e6ed642330314b2273052ee8b5f | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
print("LAst ONEEE") | 14.333333 | 22 | 0.697674 | 7 | 43 | 4.285714 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025641 | 0.093023 | 43 | 3 | 23 | 14.333333 | 0.74359 | 0.488372 | 0 | 0 | 0 | 0 | 0.454545 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 1 | 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 | 1 | 0 | 5 |
3764b33b10d08545206ae966fc9832419595fdd3 | 174 | py | Python | pdfop/pdfopex.py | szintakacseva/PythonTutorial | c32c8a7e00871e542d74c4c5bd56ee499bf0b6c3 | [
"Apache-2.0"
] | null | null | null | pdfop/pdfopex.py | szintakacseva/PythonTutorial | c32c8a7e00871e542d74c4c5bd56ee499bf0b6c3 | [
"Apache-2.0"
] | null | null | null | pdfop/pdfopex.py | szintakacseva/PythonTutorial | c32c8a7e00871e542d74c4c5bd56ee499bf0b6c3 | [
"Apache-2.0"
] | null | null | null | '''
def pdfmerge():
with file('C:/'+filename, 'rb') as fd:
merger.append(PdfFileReader(fd))
#if os.path.exists('C:/'+filename): os.remove('C:/'+filename)
''' | 29 | 65 | 0.58046 | 23 | 174 | 4.391304 | 0.73913 | 0.267327 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 174 | 6 | 66 | 29 | 0.696552 | 0.954023 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 1 | 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 | 5 |
37a435956fa79af223a599be1487119094642d71 | 3,599 | py | Python | Code/datasets.py | shikhar-srivastava/CCMCL | 52283b2b046e8e389a16fb67d0f45f33f7a22768 | [
"Apache-2.0"
] | 1 | 2021-10-06T16:19:20.000Z | 2021-10-06T16:19:20.000Z | Code/datasets.py | shikhar-srivastava/CCMCL | 52283b2b046e8e389a16fb67d0f45f33f7a22768 | [
"Apache-2.0"
] | null | null | null | Code/datasets.py | shikhar-srivastava/CCMCL | 52283b2b046e8e389a16fb67d0f45f33f7a22768 | [
"Apache-2.0"
] | 1 | 2021-09-02T03:36:48.000Z | 2021-09-02T03:36:48.000Z | """
This file contains data sets for continual learning.
"""
import tensorflow as tf
import tensorflow_datasets as tfds
import abc
# Disable progress bar
tfds.disable_progress_bar()
class DataSet(abc.ABC):
# Base class for data set classes
@abc.abstractmethod
def __init__(self):
pass
def filter_fn(self, batch, classes):
return tf.reduce_any(tf.math.equal(batch["label"], classes))
def get_split(self, classes):
train_data = self.train_data.filter(lambda x: self.filter_fn(x, classes))
val_data = self.val_data.filter(lambda x: self.filter_fn(x, classes))
test_data = self.test_data.filter(lambda x: self.filter_fn(x, classes))
return train_data, val_data, test_data
def get_all(self):
return self.train_data, self.val_data, self.test_data
class SplitMNIST(DataSet):
def __init__(self, num_validation):
self.train_data = tfds.load(name="mnist", split="train[{:d}:]".format(int(num_validation)))
self.val_data = tfds.load(name="mnist", split="train[:{:d}]".format(int(num_validation)))
self.test_data = tfds.load(name="mnist", split="test")
class SplitEMNIST(DataSet):
def __init__(self, num_validation):
self.train_data = tfds.load(name="emnist/letters", split="train[{:d}:]".format(int(num_validation)))
self.val_data = tfds.load(name="emnist/letters", split="train[:{:d}]".format(int(num_validation)))
self.test_data = tfds.load(name="emnist/letters", split="test")
class SplitFashionMNIST(DataSet):
def __init__(self, num_validation):
self.train_data = tfds.load(name="fashion_mnist", split="train[{:d}:]".format(int(num_validation)))
self.val_data = tfds.load(name="fashion_mnist", split="train[:{:d}]".format(int(num_validation)))
self.test_data = tfds.load(name="fashion_mnist", split="test")
class SplitCIFAR10(DataSet):
def __init__(self, num_validation):
self.train_data = tfds.load(name="cifar10", split="train[{:d}:]".format(int(num_validation)))
self.val_data = tfds.load(name="cifar10", split="train[:{:d}]".format(int(num_validation)))
self.test_data = tfds.load(name="cifar10", split="test")
class SplitCIFAR100(DataSet):
def __init__(self, num_validation):
self.train_data = tfds.load(name="cifar100", split="train[{:d}:]".format(int(num_validation)))
self.val_data = tfds.load(name="cifar100", split="train[:{:d}]".format(int(num_validation)))
self.test_data = tfds.load(name="cifar100", split="test")
class SplitOMNIGLOT(DataSet):
def __init__(self, num_validation):
self.train_data = tfds.load(name="omniglot", split="train[{:d}:]".format(int(num_validation)))
self.val_data = tfds.load(name="omniglot", split="train[:{:d}]".format(int(num_validation)))
self.test_data = tfds.load(name="omniglot", split="test")
class SplitSVHN(DataSet):
def __init__(self, num_validation):
self.train_data = tfds.load(name="svhn_cropped", split="train[{:d}:]".format(int(num_validation)))
self.val_data = tfds.load(name="svhn_cropped", split="train[:{:d}]".format(int(num_validation)))
self.test_data = tfds.load(name="svhn_cropped", split="test")
class SplitCaltech101(DataSet):
def __init__(self, num_validation):
self.train_data = tfds.load(name="caltech101", split="train[{:d}:]".format(int(num_validation)))
self.val_data = tfds.load(name="caltech101", split="train[:{:d}]".format(int(num_validation)))
self.test_data = tfds.load(name="caltech101", split="test")
| 41.848837 | 108 | 0.682134 | 492 | 3,599 | 4.762195 | 0.142276 | 0.133163 | 0.174136 | 0.163892 | 0.736236 | 0.736236 | 0.709347 | 0.68758 | 0.68758 | 0.640205 | 0 | 0.010458 | 0.149764 | 3,599 | 85 | 109 | 42.341176 | 0.755229 | 0.029453 | 0 | 0.140351 | 0 | 0 | 0.132032 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.210526 | false | 0.017544 | 0.052632 | 0.035088 | 0.473684 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
37b370ab4bbc99054b46f9195ac6f5106a78ff67 | 123 | py | Python | test_gpsimage.py | dima-kov/gpsimage | 29faa4922071f3b2ccc2ac630bfb43d16095453e | [
"Apache-2.0"
] | 4 | 2017-03-20T03:15:19.000Z | 2022-01-09T08:42:33.000Z | test_gpsimage.py | dima-kov/gpsimage | 29faa4922071f3b2ccc2ac630bfb43d16095453e | [
"Apache-2.0"
] | 3 | 2017-03-06T18:09:09.000Z | 2022-03-11T23:19:17.000Z | test_gpsimage.py | dima-kov/gpsimage | 29faa4922071f3b2ccc2ac630bfb43d16095453e | [
"Apache-2.0"
] | 5 | 2017-03-06T17:48:08.000Z | 2021-04-25T08:40:23.000Z | #!/usr/bin/python
# coding: utf8
import gpsimage
import pytest
import unittest
def test_entry_points():
gpsimage.open | 13.666667 | 24 | 0.764228 | 17 | 123 | 5.411765 | 0.823529 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009524 | 0.146341 | 123 | 9 | 25 | 13.666667 | 0.866667 | 0.235772 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | true | 0 | 0.6 | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
809ec4bdd948caaabf9750201f9f1323941de17b | 160 | py | Python | classifier/utilities.py | ilhamadun/chili-quality-classifier | 5501f59b6e1f23659acfb0c34f5dcb35ec7c17b9 | [
"MIT"
] | null | null | null | classifier/utilities.py | ilhamadun/chili-quality-classifier | 5501f59b6e1f23659acfb0c34f5dcb35ec7c17b9 | [
"MIT"
] | null | null | null | classifier/utilities.py | ilhamadun/chili-quality-classifier | 5501f59b6e1f23659acfb0c34f5dcb35ec7c17b9 | [
"MIT"
] | null | null | null | import re
def _atoi(text):
return int(text) if text.isdigit() else text
def natural_keys(text):
return [_atoi(c) for c in re.split(r'(\d+)', text)]
| 16 | 55 | 0.65 | 28 | 160 | 3.607143 | 0.642857 | 0.19802 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.19375 | 160 | 9 | 56 | 17.777778 | 0.782946 | 0 | 0 | 0 | 0 | 0 | 0.03125 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0 | 0.2 | 0.4 | 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 | 1 | 0 | 0 | 5 |
80bba13abb99537985ceb44e7b7c05d3df5bab41 | 138 | py | Python | resilience/actions/__init__.py | vishalbelsare/resilience | 596a9b8224fc6168bd6ee5718ea6c57425b7f273 | [
"Apache-2.0"
] | 7 | 2020-04-04T20:55:21.000Z | 2021-11-15T10:42:44.000Z | resilience/actions/__init__.py | vishalbelsare/resilience | 596a9b8224fc6168bd6ee5718ea6c57425b7f273 | [
"Apache-2.0"
] | 1 | 2020-06-19T04:26:35.000Z | 2020-09-25T04:50:00.000Z | resilience/actions/__init__.py | vishalbelsare/resilience | 596a9b8224fc6168bd6ee5718ea6c57425b7f273 | [
"Apache-2.0"
] | 4 | 2020-04-16T19:10:33.000Z | 2020-09-24T17:54:21.000Z | from .PullFunding import PullFunding
from .RedeemShares import RedeemShares
from .PayLoan import PayLoan
from .SellAsset import SellAsset
| 27.6 | 38 | 0.855072 | 16 | 138 | 7.375 | 0.375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.115942 | 138 | 4 | 39 | 34.5 | 0.967213 | 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 | 1 | 0 | 0 | 5 |
80d1b7dd4883befc428939509ace4cd8180af211 | 174 | py | Python | sw/groundstation/gs/test/test_geo_decimal_degrees.py | nzjrs/wasp | b763309af59e7784811baa6dd80e17dba1b27d81 | [
"MIT"
] | 2 | 2021-07-11T13:47:17.000Z | 2021-11-08T11:21:51.000Z | sw/groundstation/gs/test/test_geo_decimal_degrees.py | nzjrs/wasp | b763309af59e7784811baa6dd80e17dba1b27d81 | [
"MIT"
] | null | null | null | sw/groundstation/gs/test/test_geo_decimal_degrees.py | nzjrs/wasp | b763309af59e7784811baa6dd80e17dba1b27d81 | [
"MIT"
] | 2 | 2015-10-03T06:24:07.000Z | 2016-01-21T11:36:20.000Z | import doctest
import gs.geo.decimaldegrees as decimaldegrees
# Run doctest
def _test():
return doctest.testmod(decimaldegrees)
if __name__ == "__main__":
_test()
| 15.818182 | 46 | 0.741379 | 20 | 174 | 5.95 | 0.7 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 174 | 10 | 47 | 17.4 | 0.82069 | 0.063218 | 0 | 0 | 0 | 0 | 0.049689 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | true | 0 | 0.333333 | 0.166667 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 5 |
03d096bb12152027bd03cf9276beae76b2baebf8 | 5,037 | py | Python | machine_learning/optimize_architecture.py | Yannick947/deep_bau | 878cbc452cee8f1e7832ccdd54e5c3ef598702e1 | [
"MIT"
] | 2 | 2021-04-23T20:11:32.000Z | 2021-04-25T21:33:31.000Z | machine_learning/optimize_architecture.py | Yannick947/deep_bau | 878cbc452cee8f1e7832ccdd54e5c3ef598702e1 | [
"MIT"
] | null | null | null | machine_learning/optimize_architecture.py | Yannick947/deep_bau | 878cbc452cee8f1e7832ccdd54e5c3ef598702e1 | [
"MIT"
] | 1 | 2021-04-25T22:04:20.000Z | 2021-04-25T22:04:20.000Z | import datetime
from machine_learning.classfication_models import create_bayesian_classifier, create_bayesian_dummy_classifier
import numpy as np
import pandas as pd
import kerastuner as kt
from machine_learning.utils import get_datagen_split
import machine_learning.models
import machine_learning.classfication_models
from machine_learning.models import create_hyperband_model
from machine_learning.data_generator import BauGenerator
BATCH_SIZE = 256
LOOK_AHEAD_SIZE = 1
LOOK_BACK_WINDOW_SIZE = 10
def dummy_classification(df: pd.DataFrame):
df_train, df_val = get_datagen_split(df)
datagen_train = BauGenerator(df=df_train, batch_size=BATCH_SIZE,
window_size=LOOK_BACK_WINDOW_SIZE,
look_ahead_steps=LOOK_AHEAD_SIZE)
datagen_val = BauGenerator(df=df_val, batch_size=BATCH_SIZE,
window_size=LOOK_BACK_WINDOW_SIZE,
look_ahead_steps=LOOK_AHEAD_SIZE)
machine_learning.classfication_models.HYPER_NUM_ROWS_DF = datagen_train.X_batches.shape[2]
machine_learning.classfication_models.HYPER_NUM_OUTPUT_FIELDS = datagen_train.Y_batches.shape[
1]
machine_learning.classfication_models.HYPER_WINDOW_SIZE = LOOK_BACK_WINDOW_SIZE
machine_learning.classfication_models.HYPER_LOOK_AHEAD_SIZE = LOOK_AHEAD_SIZE
tuner = kt.BayesianOptimization(create_bayesian_dummy_classifier,
objective='val_accuracy',
max_trials=100,
project_name="arch_opt_")
tuner.search(datagen_train,
validation_data=datagen_val,
epochs=60,
callbacks=[],
workers=16)
best_model = tuner.get_best_models(1)[0]
best_hyperparameters = tuner.get_best_hyperparameters(1)[0]
print(best_hyperparameters)
def bayesian_classification_optimization(df: pd.DataFrame):
df_train, df_val = get_datagen_split(df)
datagen_train = BauGenerator(df=df_train, batch_size=BATCH_SIZE,
window_size=LOOK_BACK_WINDOW_SIZE,
look_ahead_steps=LOOK_AHEAD_SIZE)
datagen_val = BauGenerator(df=df_val, batch_size=BATCH_SIZE,
window_size=LOOK_BACK_WINDOW_SIZE,
look_ahead_steps=LOOK_AHEAD_SIZE)
machine_learning.classfication_models.HYPER_NUM_ROWS_DF = datagen_train.X_batches.shape[2]
machine_learning.classfication_models.HYPER_NUM_OUTPUT_FIELDS = datagen_train.Y_batches.shape[
1]
machine_learning.classfication_models.HYPER_WINDOW_SIZE = LOOK_BACK_WINDOW_SIZE
machine_learning.classfication_models.HYPER_LOOK_AHEAD_SIZE = LOOK_AHEAD_SIZE
tuner = kt.BayesianOptimization(create_bayesian_classifier,
objective='val_loss',
max_trials=200)
tuner.search(datagen_train,
validation_data=datagen_val,
epochs=150,
callbacks=[],
workers=16)
best_model = tuner.get_best_models(1)[0]
best_hyperparameters = tuner.get_best_hyperparameters(1)[0]
print(best_hyperparameters)
def hyperband_optimization(df: pd.DataFrame):
df_train, df_val = get_datagen_split(df)
datagen_train = BauGenerator(df=df_train, binarize_activity_hours=False, batch_size=BATCH_SIZE,
window_size=LOOK_BACK_WINDOW_SIZE,
look_ahead_steps=LOOK_AHEAD_SIZE)
datagen_val = BauGenerator(df=df_val, binarize_activity_hours=False, batch_size=BATCH_SIZE,
window_size=LOOK_BACK_WINDOW_SIZE,
look_ahead_steps=LOOK_AHEAD_SIZE)
machine_learning.models.HYPER_NUM_ROWS_DF = datagen_train.X_batches.shape[2]
machine_learning.models.HYPER_NUM_OUTPUT_FIELDS = datagen_train.Y_batches.shape[2]
machine_learning.models.HYPER_WINDOW_SIZE = LOOK_BACK_WINDOW_SIZE
machine_learning.models.HYPER_LOOK_AHEAD_SIZE = LOOK_AHEAD_SIZE
tuner = kt.BayesianOptimization(create_hyperband_model,
objective='val_binary_accuracy',
max_trials=200)
tuner.search(datagen_train,
validation_data=datagen_val,
epochs=70,
callbacks=[],
workers=16)
best_model = tuner.get_best_models(1)[0]
best_hyperparameters = tuner.get_best_hyperparameters(1)[0]
print(best_hyperparameters)
if __name__ == '__main__':
PERCENTAGE_USED_DATA = 0.7
working_hours = pd.read_csv(
"./data/preprocessed/df_deep_bau.csv", error_bad_lines=False, sep=',', index_col=False)
start_index = int((1 - PERCENTAGE_USED_DATA) * working_hours.shape[0])
working_hours = working_hours[start_index:]
df = working_hours.select_dtypes([np.number])
dummy_classification(df)
| 40.296 | 110 | 0.680365 | 592 | 5,037 | 5.33277 | 0.180743 | 0.054165 | 0.066519 | 0.107697 | 0.726322 | 0.726322 | 0.726322 | 0.721254 | 0.721254 | 0.704466 | 0 | 0.013323 | 0.254914 | 5,037 | 124 | 111 | 40.620968 | 0.827871 | 0 | 0 | 0.55914 | 0 | 0 | 0.018265 | 0.006949 | 0 | 0 | 0 | 0 | 0 | 1 | 0.032258 | false | 0 | 0.107527 | 0 | 0.139785 | 0.032258 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 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 | 5 |
03ddec181c20f22f44755ec04b2fa018e9de71e1 | 199 | py | Python | pydecorator/__init__.py | luciancooper/pydecorator | 4617699378782dfd917f2d9c41ad3162bb1fb2ef | [
"MIT"
] | 2 | 2019-01-18T02:13:47.000Z | 2019-01-18T02:14:21.000Z | pydecorator/__init__.py | luciancooper/pydecorator | 4617699378782dfd917f2d9c41ad3162bb1fb2ef | [
"MIT"
] | null | null | null | pydecorator/__init__.py | luciancooper/pydecorator | 4617699378782dfd917f2d9c41ad3162bb1fb2ef | [
"MIT"
] | null | null | null | from .generator import _list as list,_set as set,_tuple as tuple,_dict as dict,_str as str
from .sort import *
from .transform import *
from .file import *
from .numpy import *
from .pandas import *
| 28.428571 | 90 | 0.753769 | 33 | 199 | 4.393939 | 0.424242 | 0.275862 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.170854 | 199 | 6 | 91 | 33.166667 | 0.878788 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
03f9cbf3c216c7c09671425c5c8f23316b0c3842 | 208 | py | Python | inconnu/vr/__init__.py | tiltowait/inconnu | 6cca5fed520899d159537701b695c94222d8dc45 | [
"MIT"
] | 4 | 2021-09-06T20:18:13.000Z | 2022-02-05T17:08:44.000Z | inconnu/vr/__init__.py | tiltowait/inconnu | 6cca5fed520899d159537701b695c94222d8dc45 | [
"MIT"
] | 7 | 2021-09-13T00:46:57.000Z | 2022-01-11T06:38:50.000Z | inconnu/vr/__init__.py | tiltowait/inconnu | 6cca5fed520899d159537701b695c94222d8dc45 | [
"MIT"
] | 2 | 2021-11-27T22:24:53.000Z | 2022-03-16T21:05:00.000Z | """Defines the imported interfaces for performing rolls."""
from . import dicemoji
from .parse import parse, perform_roll, display_outcome, prepare_roll, needs_character
from .rolldisplay import RollDisplay
| 34.666667 | 86 | 0.817308 | 26 | 208 | 6.384615 | 0.730769 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.115385 | 208 | 5 | 87 | 41.6 | 0.902174 | 0.254808 | 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 | 1 | 0 | 0 | 5 |
ff1afae7144bee166a489613ca8bf55cac700aab | 78 | py | Python | setup.py | x522758754/XlsTools | 2e0fc0e66acaee28e64072b251fb956bb65d1474 | [
"MIT"
] | null | null | null | setup.py | x522758754/XlsTools | 2e0fc0e66acaee28e64072b251fb956bb65d1474 | [
"MIT"
] | null | null | null | setup.py | x522758754/XlsTools | 2e0fc0e66acaee28e64072b251fb956bb65d1474 | [
"MIT"
] | null | null | null | from distutils.core import setup
import py2exe
setup (console=['xlsToTxt.py']) | 26 | 32 | 0.794872 | 11 | 78 | 5.636364 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014085 | 0.089744 | 78 | 3 | 33 | 26 | 0.859155 | 0 | 0 | 0 | 0 | 0 | 0.139241 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
455163f67c5ec5155e23f789e0310c90e1e29be2 | 336 | py | Python | mlp/interfaces.py | guidj/mlp | 06e60cffde8c8a7f60cebf0e329efae116042e61 | [
"Apache-2.0"
] | null | null | null | mlp/interfaces.py | guidj/mlp | 06e60cffde8c8a7f60cebf0e329efae116042e61 | [
"Apache-2.0"
] | null | null | null | mlp/interfaces.py | guidj/mlp | 06e60cffde8c8a7f60cebf0e329efae116042e61 | [
"Apache-2.0"
] | null | null | null | """
Interfaces
"""
class Model(object):
def fit(self, X, y):
raise NotImplemented('%s is not implemented' % self.__name__)
def transform(self, X):
raise NotImplemented('%s is not implemented' % self.__name__)
def coefficients(self):
raise NotImplemented('%s is not implemented' % self.__name__)
| 21 | 69 | 0.64881 | 40 | 336 | 5.15 | 0.45 | 0.276699 | 0.291262 | 0.320388 | 0.669903 | 0.669903 | 0.669903 | 0.669903 | 0.456311 | 0 | 0 | 0 | 0.22619 | 336 | 15 | 70 | 22.4 | 0.792308 | 0.029762 | 0 | 0.428571 | 0 | 0 | 0.198113 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.428571 | false | 0 | 0 | 0 | 0.571429 | 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 | 1 | 0 | 0 | 5 |
458544a783382596b32991b3d343a5f6d5eda117 | 46 | py | Python | App/config.py | inishchith/HelpOff | 8e0e58f1b9172ab4081ceefabe926399d0f72bee | [
"MIT"
] | 5 | 2018-04-01T12:27:08.000Z | 2018-04-03T06:56:25.000Z | App/config.py | inishchith/HelpOff | 8e0e58f1b9172ab4081ceefabe926399d0f72bee | [
"MIT"
] | null | null | null | App/config.py | inishchith/HelpOff | 8e0e58f1b9172ab4081ceefabe926399d0f72bee | [
"MIT"
] | 1 | 2018-04-01T12:35:18.000Z | 2018-04-01T12:35:18.000Z | YOUR_API_KEY = "" # Enter your API Key here.
| 15.333333 | 44 | 0.673913 | 8 | 46 | 3.625 | 0.625 | 0.482759 | 0.689655 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.217391 | 46 | 2 | 45 | 23 | 0.805556 | 0.521739 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 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 | 5 |
458562f5d3922617fccf08df00a2adce28ef299a | 105 | py | Python | profile_api/admin.py | Rajmohanraj/profiles-rest-api | ccb8d6d90a62bc3603041940bf9e2e10a89899c2 | [
"MIT"
] | null | null | null | profile_api/admin.py | Rajmohanraj/profiles-rest-api | ccb8d6d90a62bc3603041940bf9e2e10a89899c2 | [
"MIT"
] | null | null | null | profile_api/admin.py | Rajmohanraj/profiles-rest-api | ccb8d6d90a62bc3603041940bf9e2e10a89899c2 | [
"MIT"
] | null | null | null | from django.contrib import admin
from profile_api import models
admin.site.register(models.UserProfile) | 21 | 39 | 0.847619 | 15 | 105 | 5.866667 | 0.733333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.095238 | 105 | 5 | 39 | 21 | 0.926316 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 5 |
45b5ec502ab05658dc0bc2fac330e33f0ae0c805 | 37 | py | Python | tests/__init__.py | souravaich/pyquote | ac48640d238f4e8d5c20b206180144b82d47cb20 | [
"MIT"
] | 1 | 2020-12-31T19:54:00.000Z | 2020-12-31T19:54:00.000Z | tests/__init__.py | souravaich/pyquote | ac48640d238f4e8d5c20b206180144b82d47cb20 | [
"MIT"
] | null | null | null | tests/__init__.py | souravaich/pyquote | ac48640d238f4e8d5c20b206180144b82d47cb20 | [
"MIT"
] | null | null | null | """Unit test package for pyquote."""
| 18.5 | 36 | 0.675676 | 5 | 37 | 5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.135135 | 37 | 1 | 37 | 37 | 0.78125 | 0.810811 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
b34af5614c63b7d01424a5db056ec4ed016eeb3d | 5,416 | py | Python | tests/test_bulk_select_model_dicts.py | solismaam/django-bulk-load | c8a4fd3f67b7087ddfd9afc311c8807548df4fdc | [
"MIT"
] | 4 | 2022-01-27T05:40:17.000Z | 2022-03-09T09:27:48.000Z | tests/test_bulk_select_model_dicts.py | solismaam/django-bulk-load | c8a4fd3f67b7087ddfd9afc311c8807548df4fdc | [
"MIT"
] | null | null | null | tests/test_bulk_select_model_dicts.py | solismaam/django-bulk-load | c8a4fd3f67b7087ddfd9afc311c8807548df4fdc | [
"MIT"
] | 2 | 2022-03-04T21:31:25.000Z | 2022-03-13T18:06:08.000Z | from datetime import datetime, timezone
from django.test import TestCase
from django_bulk_load import bulk_select_model_dicts
from .test_project.models import (
TestComplexModel,
TestForeignKeyModel,
)
class E2ETestBulkInsertChangedModels(TestCase):
def test_empty_get(self):
self.assertEqual(
bulk_select_model_dicts(
model_class=TestComplexModel,
filter_field_names=[],
filter_data=[],
select_field_names=[],
),
[],
)
def test_single_select(self):
foreign = TestForeignKeyModel()
foreign.save()
saved_model = TestComplexModel(
integer_field=123,
string_field="hello",
json_field=dict(fun="run"),
datetime_field=datetime(2018, 1, 5, 3, 4, 5, tzinfo=timezone.utc),
test_foreign=foreign,
)
saved_model.save()
result_dicts = bulk_select_model_dicts(
model_class=TestComplexModel,
filter_field_names=["integer_field"],
filter_data=[(123,)],
select_field_names=["string_field", "json_field", "test_foreign_id"],
)
self.assertEqual(len(result_dicts), 1)
for attr in ["integer_field", "string_field", "json_field", "test_foreign_id"]:
self.assertEqual(getattr(saved_model, attr), result_dicts[0][attr])
def test_multi_select(self):
saved_model1 = TestComplexModel(
integer_field=1, json_field=None, string_field="hello1"
)
saved_model1.save()
saved_model2 = TestComplexModel(
integer_field=2, json_field=None, string_field="hello2"
)
saved_model2.save()
saved_model3 = TestComplexModel(
integer_field=3, json_field=None, string_field="hello3"
)
saved_model3.save()
result_dicts = bulk_select_model_dicts(
model_class=TestComplexModel,
filter_field_names=["id"],
filter_data=[(saved_model1.id,), (saved_model2.id,), (saved_model3.id,)],
select_field_names=["integer_field", "string_field", "json_field"],
)
# Sort the results, so the order is the same
result_dicts.sort(key=lambda result_dict: result_dict["id"])
self.assertEqual(len(result_dicts), 3)
for attr in ["integer_field", "string_field", "json_field"]:
self.assertEqual(getattr(saved_model1, attr), result_dicts[0][attr])
self.assertEqual(getattr(saved_model2, attr), result_dicts[1][attr])
self.assertEqual(getattr(saved_model3, attr), result_dicts[2][attr])
def test_multi_model_get_pk_fields(self):
saved_model1 = TestComplexModel(
integer_field=1, json_field=None, string_field="hello1"
)
saved_model1.save()
saved_model2 = TestComplexModel(
integer_field=2, json_field=None, string_field="hello2"
)
saved_model2.save()
saved_model3 = TestComplexModel(
integer_field=3, json_field=None, string_field="hello3"
)
saved_model3.save()
result_dicts = bulk_select_model_dicts(
model_class=TestComplexModel,
filter_field_names=["integer_field", "string_field"],
filter_data=[
(saved_model1.integer_field, saved_model1.string_field),
(saved_model2.integer_field, saved_model2.string_field),
(saved_model3.integer_field, saved_model3.string_field),
],
select_field_names=["json_field"],
)
# Sort the results, so the order is the same
result_dicts.sort(key=lambda result_dict: result_dict["integer_field"])
self.assertEqual(len(result_dicts), 3)
for attr in ["integer_field", "string_field", "json_field"]:
self.assertEqual(getattr(saved_model1, attr), result_dicts[0][attr])
self.assertEqual(getattr(saved_model2, attr), result_dicts[1][attr])
self.assertEqual(getattr(saved_model3, attr), result_dicts[2][attr])
def test_multi_model_matches_multiple(self):
saved_model1 = TestComplexModel(
integer_field=1, json_field=dict(a="b"), string_field="hello1"
)
saved_model1.save()
# Same as model above except different json_field
saved_model2 = TestComplexModel(
integer_field=1, json_field=None, string_field="hello1"
)
saved_model2.save()
saved_model3 = TestComplexModel(
integer_field=2, json_field=None, string_field="hello2"
)
saved_model3.save()
result_dicts = bulk_select_model_dicts(
model_class=TestComplexModel,
filter_field_names=["integer_field", "string_field"],
select_field_names=["json_field", "id"],
filter_data=[(saved_model1.integer_field, saved_model1.string_field)],
)
# Sort the results, so the order is the same
result_dicts.sort(key=lambda result_dict: result_dict["id"])
self.assertEqual(len(result_dicts), 2)
for attr in ["integer_field", "string_field", "json_field"]:
self.assertEqual(getattr(saved_model1, attr), result_dicts[0][attr])
self.assertEqual(getattr(saved_model2, attr), result_dicts[1][attr])
| 36.843537 | 87 | 0.633309 | 607 | 5,416 | 5.317957 | 0.135091 | 0.085502 | 0.086741 | 0.075279 | 0.769207 | 0.751859 | 0.727385 | 0.711276 | 0.704771 | 0.652107 | 0 | 0.021058 | 0.263479 | 5,416 | 146 | 88 | 37.09589 | 0.788167 | 0.032496 | 0 | 0.448276 | 0 | 0 | 0.075263 | 0 | 0 | 0 | 0 | 0 | 0.12069 | 1 | 0.043103 | false | 0 | 0.034483 | 0 | 0.086207 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 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 | 5 |
2fd6d05cb7b38f794e5f8f35b3c0cc9f9adb4ad3 | 5,853 | py | Python | or_suite/envs/inventory_control_multiple_suppliers/inventory_control_test.py | JasmineSamadi/ORSuite | e2b2b0a5b497ea6566e794dcef1f176081fca4ce | [
"MIT"
] | 4 | 2021-12-01T10:56:17.000Z | 2022-02-06T17:07:43.000Z | or_suite/envs/inventory_control_multiple_suppliers/inventory_control_test.py | JasmineSamadi/ORSuite | e2b2b0a5b497ea6566e794dcef1f176081fca4ce | [
"MIT"
] | 2 | 2021-08-11T13:25:01.000Z | 2022-03-20T19:23:23.000Z | or_suite/envs/inventory_control_multiple_suppliers/inventory_control_test.py | JasmineSamadi/ORSuite | e2b2b0a5b497ea6566e794dcef1f176081fca4ce | [
"MIT"
] | 2 | 2021-07-27T02:39:37.000Z | 2022-02-14T21:03:15.000Z | import gym
import numpy as np
import sys
from scipy.stats import poisson
from .. import env_configs
import pytest
from stable_baselines3.common.env_checker import check_env
# These tests are for 2 suppliers
CONFIG = env_configs.inventory_control_multiple_suppliers_default_config
env = gym.make('MultipleSuppliers-v0', config=CONFIG)
lead_times = CONFIG['lead_times']
sum_L = 0 # Sum of all leadtimes
for x in range(len(lead_times)):
sum_L += lead_times[x]
CONFIG3 = {'lead_times': [5, 1, 8],
'demand_dist': lambda x: np.random.poisson(10),
'supplier_costs': [100, 105, 90],
'hold_cost': 1,
'backorder_cost': 19,
'max_inventory': 1000,
'max_order': 20,
'epLen': 500,
'starting_state': None,
'neg_inventory': True}
env3 = gym.make('MultipleSuppliers-v0', config=CONFIG3)
L3 = CONFIG3['lead_times']
sum_L3 = 0 # Sum of all leadtimes
for x in range(len(L3)):
sum_L3 += L3[x]
def test_initial_state():
# Testing state is correct length
assert len(env.state) == sum_L + \
1, "State array is not the same as the sum of all leading times plus one"
# Testing that state has all 0s as starting values.
for i in range(sum_L):
assert env.state[i] == 0, "State array has not been initialized to all zeros"
assert env.state[-1] == env.max_inventory, "Last index is not max"
# Test to see if timestep starts at zero
assert env.timestep == 0, "Timestep does not start at 0"
# Testing if starting state is part of observation space
assert env.observation_space.contains(
env.state), "Starting state is not present in given observation space"
def test_step():
np.random.seed(10)
newState, reward, done, info = env.step([1, 15])
# Test if new state is part of observation space
assert env.observation_space.contains(
newState), "Returned state is not part of given observation space after step"
# Test to see if returned reward is a float
assert type(reward) == float, "Reward is not a float"
assert reward == -1852.0
expected_state = [1, 0, 0, 0, 0, 15, 987]
for i in range(sum_L + 1):
assert env.state[i] == expected_state[i], "New state does not match expected state at index {}".format(
i)
# Do step again
newState, reward, done, info = env.step([1, 15])
# Test if new state is part of observation space
assert env.observation_space.contains(
newState), "Returned state is not part of given observation space after step"
assert reward == -2042.0
expected_state = [1, 0, 0, 0, 15, 15, 977]
for i in range(sum_L + 1):
assert env.state[i] == expected_state[i], "New state does not match expected state at index {}".format(
i)
check_env(env, skip_render_check=True)
def test_bad_action():
# Testing to see if action not in action space raises an exception
with pytest.raises(AssertionError):
env.step(
[0, 0, 0])
def test_reset():
env.reset()
assert env.timestep == 0, "Timestep not set to 0 on reset"
for i in range(sum_L):
assert env.state[i] == env.starting_state[i], "State not set back to starting state on reset at index {}".format(
i)
assert env.state[-1] == env.max_inventory
# These tests are for three suppliers
def test_initial_state_three():
# Testing state is correct length
assert len(env3.state) == sum_L3 + \
1, "State array is not the same as the sum of all leading times plus one"
# Testing that state has all 0s as starting values.
for i in range(sum_L3):
assert env3.state[i] == 0, "State array has not been initialized to all zeros"
assert env3.state[-1] == env3.max_inventory, "Last index is not max"
# Test to see if timestep starts at zero
assert env3.timestep == 0, "Timestep does not start at 0"
# Testing if starting state is part of observation space
assert env3.observation_space.contains(
env3.state), "Starting state is not present in given observation space"
def test_step_three():
np.random.seed(10)
newState, reward, done, info = env3.step([1, 15, 4])
# Test if new state is part of observation space
assert env3.observation_space.contains(
newState), "Returned state is not part of given observation space after step"
# Test to see if returned reward is a float
assert type(reward) == float, "Reward is not a float"
assert reward == -2282.0
expected_state = [0, 0, 0, 0, 1, 15, 0, 0, 0, 0, 0, 0, 0, 4, 987]
for i in range(sum_L3 + 1):
assert env3.state[i] == expected_state[i], "New state does not match expected state at index {}".format(
i)
# Do step again
newState, reward, done, info = env3.step([1, 15, 4])
# Test if new state is part of observation space
assert env3.observation_space.contains(
newState), "Returned state is not part of given observation space after step"
assert reward == -2206.0
expected_state = [0, 0, 0, 1, 1, 15, 0, 0, 0, 0, 0, 0, 4, 4, 991]
for i in range(sum_L3 + 1):
assert env3.state[i] == expected_state[i], "New state does not match expected state at index {}".format(
i)
check_env(env3, skip_render_check=True)
def test_bad_action_three():
# Testing to see if action not in action space raises an exception
with pytest.raises(AssertionError):
env3.step(
[])
def test_reset_three():
env3.reset()
assert env.timestep == 0, "Timestep not set to 0 on reset"
for i in range(sum_L3):
assert env3.state[i] == env3.starting_state[i], "State not set back to starting state on reset at index {}".format(
i)
assert env3.state[-1] == env3.max_inventory
| 33.255682 | 123 | 0.655049 | 904 | 5,853 | 4.152655 | 0.17146 | 0.012254 | 0.012786 | 0.00959 | 0.808471 | 0.790623 | 0.779968 | 0.730155 | 0.699254 | 0.699254 | 0 | 0.041893 | 0.245515 | 5,853 | 175 | 124 | 33.445714 | 0.808197 | 0.15223 | 0 | 0.388889 | 0 | 0 | 0.261591 | 0 | 0 | 0 | 0 | 0 | 0.296296 | 1 | 0.074074 | false | 0 | 0.064815 | 0 | 0.138889 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 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 | 5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.