hexsha stringlengths 40 40 | size int64 5 2.06M | ext stringclasses 11
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 3 251 | max_stars_repo_name stringlengths 4 130 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 3 251 | max_issues_repo_name stringlengths 4 130 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 116k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 251 | max_forks_repo_name stringlengths 4 130 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 1 1.05M | avg_line_length float64 1 1.02M | max_line_length int64 3 1.04M | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aeca5f1921632d7c1be82445181945bbbb66f42a | 901 | py | Python | cogs/insult.py | nikhilvayeda/Bhendi-Bot-3 | 2268e4310b91d6f3d62fe7bb642c3a57f623e215 | [
"MIT"
] | 8 | 2020-10-02T04:35:01.000Z | 2021-11-08T10:38:32.000Z | cogs/insult.py | nikhilvayeda/Bhendi-Bot-3 | 2268e4310b91d6f3d62fe7bb642c3a57f623e215 | [
"MIT"
] | 8 | 2020-10-05T07:45:38.000Z | 2021-03-13T22:02:28.000Z | cogs/insult.py | nikhilvayeda/Bhendi-Bot-3 | 2268e4310b91d6f3d62fe7bb642c3a57f623e215 | [
"MIT"
] | 2 | 2020-10-15T05:38:13.000Z | 2020-10-29T11:41:16.000Z | import json
import requests
import discord
from discord.ext import commands
| 26.5 | 96 | 0.593785 |
aecc522dc3defa35037e11a7262e7658ad5e8c35 | 1,873 | py | Python | util/monitor.py | reservoirlabs/G2-Mininet | 4e0dd6b5367a1d51ee65310e59fc3b0ba55575b8 | [
"BSD-3-Clause"
] | 2 | 2021-08-20T08:29:49.000Z | 2022-02-25T02:08:26.000Z | util/monitor.py | reservoirlabs/G2-Mininet | 4e0dd6b5367a1d51ee65310e59fc3b0ba55575b8 | [
"BSD-3-Clause"
] | 2 | 2019-11-27T09:54:35.000Z | 2019-12-05T15:52:03.000Z | util/monitor.py | reservoirlabs/G2-Mininet | 4e0dd6b5367a1d51ee65310e59fc3b0ba55575b8 | [
"BSD-3-Clause"
] | 2 | 2020-03-12T14:38:06.000Z | 2022-03-20T10:15:13.000Z | """
G2_RIGHTS.
This module defines Monitor class to monitor CPU and memory utilization.
Pre-requisite non-standard Python module(s):
psutil
"""
import time
import threading
import psutil
| 25.310811 | 91 | 0.549386 |
aecd3d71119eb36cd9ff199e7ad910beb0a003d1 | 2,888 | py | Python | IO_supervisor.py | dwalley/SICXE | f3d019301e82712a1e94c6936b667bb5c93bbce0 | [
"MIT"
] | null | null | null | IO_supervisor.py | dwalley/SICXE | f3d019301e82712a1e94c6936b667bb5c93bbce0 | [
"MIT"
] | null | null | null | IO_supervisor.py | dwalley/SICXE | f3d019301e82712a1e94c6936b667bb5c93bbce0 | [
"MIT"
] | null | null | null | # Module which defines how the I/O system works
import sys, os
from Registers import *
from random import *
from binascii import *
| 30.723404 | 79 | 0.602147 |
aecfa8737eda8f66522d65be9eaa0ff115eeee4b | 364 | py | Python | ProblemSolving/mini_max_sum.py | Akasan/HackerRankResult | 71549236975cae5e8303570ae352c0e93d0e22b5 | [
"MIT"
] | null | null | null | ProblemSolving/mini_max_sum.py | Akasan/HackerRankResult | 71549236975cae5e8303570ae352c0e93d0e22b5 | [
"MIT"
] | null | null | null | ProblemSolving/mini_max_sum.py | Akasan/HackerRankResult | 71549236975cae5e8303570ae352c0e93d0e22b5 | [
"MIT"
] | null | null | null | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the miniMaxSum function below.
if __name__ == '__main__':
arr = list(map(int, input().rstrip().split()))
miniMaxSum(arr)
| 17.333333 | 50 | 0.678571 |
aecfc854993f2f476c1f4760e4745a5af412f1bd | 15,322 | py | Python | spiders/spiders/spiders/qunar.py | jiangxuewen16/hq-crawler | f03ec1e454513307e335943f224f4d927eaf2bbf | [
"MIT"
] | 1 | 2021-02-25T08:33:40.000Z | 2021-02-25T08:33:40.000Z | spiders/spiders/spiders/qunar.py | jiangxuewen16/hq-crawler | f03ec1e454513307e335943f224f4d927eaf2bbf | [
"MIT"
] | null | null | null | spiders/spiders/spiders/qunar.py | jiangxuewen16/hq-crawler | f03ec1e454513307e335943f224f4d927eaf2bbf | [
"MIT"
] | 2 | 2021-03-08T07:25:16.000Z | 2021-12-07T15:28:02.000Z | # -*- coding: utf-8 -*-
import json
import math
import random
import time
import requests
import scrapy
from scrapy.http import HtmlResponse
from scrapy import Request
from spiders.common import OTA
from spiders.items.spot import spot
from spiders.items.price import price
'''
tag
'''
| 48.487342 | 424 | 0.547513 |
aed49e56a367c6273f6328e65eb9c26caf7bc5da | 5,941 | py | Python | stage_2_semantic/not_used/subsample.py | grtzsohalf/Audio-Phonetic-and-Semantic-Embedding | 1207cb61ec4587f38817b030a1e92cb315ebd178 | [
"MIT"
] | 2 | 2019-08-09T00:49:25.000Z | 2019-09-30T06:37:07.000Z | stage_2_semantic/not_used/subsample.py | grtzsohalf/Audio-Phonetic-and-Semantic-Embedding | 1207cb61ec4587f38817b030a1e92cb315ebd178 | [
"MIT"
] | null | null | null | stage_2_semantic/not_used/subsample.py | grtzsohalf/Audio-Phonetic-and-Semantic-Embedding | 1207cb61ec4587f38817b030a1e92cb315ebd178 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import argparse
import os
import sys
import random
import math
from tqdm import tqdm
from collections import Counter
import operator
import numpy as np
FLAGS = None
next_random = 1
if __name__ == '__main__':
parser = argparse.ArgumentParser(description =
'transform text format features into tfrecords')
parser.add_argument(
'example_dir',
metavar='<example dir>',
type=str,
help='example dir'
)
parser.add_argument(
'label_dir',
metavar='<label dir>',
type=str,
help='label dir'
)
parser.add_argument(
'utter_dir',
metavar='<utter dir>',
type=str,
help='utter dir'
)
parser.add_argument(
'subsampled_example_dir',
metavar='<subsampled example dir>',
type=str,
help='subsampled_example_dir'
)
parser.add_argument(
'subsampled_label_dir',
metavar='<subsampled label dir>',
type=str,
help='subsampled_label_dir'
)
parser.add_argument(
'subsampled_utter_dir',
metavar='<subsampled utter dir>',
type=str,
help='subsampled_utter_dir'
)
parser.add_argument(
'sampling',
metavar='<subsampling factor>',
type=float,
help='subsampling factor'
)
parser.add_argument(
'min_count',
metavar='<min count>',
type=int,
help='min count'
)
parser.add_argument(
'--feats_dim',
metavar='<feats-dim>',
type=int,
default=256,
help='feature dimension'
)
parser.add_argument(
'--norm_var',
metavar='<True|False>',
type=bool,
default=False,
help='Normalize Variance of each sentence'
)
parser.add_argument(
'--norm_mean',
metavar='<True|False>',
type=bool,
default=False,
help='Normalize mean of each sentence'
)
FLAGS = parser.parse_args()
main()
| 35.57485 | 104 | 0.508669 |
aed4b5966f761ef3662819b99d5360ad4611d44f | 819 | py | Python | scripts/hofstede_csv_to_dict.py | tuejari/yoshi-2 | 2247e2c2820928c0e8ecd1b535a72ca74a5c5281 | [
"Apache-2.0"
] | 2 | 2021-12-02T14:05:40.000Z | 2021-12-27T08:49:48.000Z | scripts/hofstede_csv_to_dict.py | tuejari/yoshi-2 | 2247e2c2820928c0e8ecd1b535a72ca74a5c5281 | [
"Apache-2.0"
] | null | null | null | scripts/hofstede_csv_to_dict.py | tuejari/yoshi-2 | 2247e2c2820928c0e8ecd1b535a72ca74a5c5281 | [
"Apache-2.0"
] | null | null | null | import pandas as pd
# Read the Hofstede indices into a pandas dataframe
data = pd.read_csv("..\\data\\Hofstede Insights - Manual 2021-05-13.csv", delimiter=",", index_col="country")
# Transform all data in the dataframe to strings
data["pdi"] = data["pdi"].astype(str)
data["idv"] = data["idv"].astype(str)
data["mas"] = data["mas"].astype(str)
data["uai"] = data["uai"].astype(str)
result = ""
for country, row in data.iterrows():
# Generate the C# code to add the Hofstede metrics to a dictionary of the form:
# Dictionary<string, (int Pdi, int Idv, int Mas, int Uai)>
result += "{ \"" + country.lower() + "\", (" + row["pdi"] + ", " + row["idv"] + ", " + row["mas"] + ", " + row["uai"] + ") },\n"
# Print the result so we can copy the generated c# code from the console
print(result) | 40.95 | 132 | 0.62149 |
aed61ba31c0649cb1a7854a5aa110c70142265a0 | 269 | py | Python | cmd_creator_b.py | azeznassar/JavaScriptToUML | 53cccc1bba635114f03d966fd2f0f2f2d2d74bae | [
"MIT"
] | 5 | 2020-08-16T09:25:42.000Z | 2022-01-19T21:00:48.000Z | cmd_creator_b.py | azeznassar/JavaScriptToUML | 53cccc1bba635114f03d966fd2f0f2f2d2d74bae | [
"MIT"
] | null | null | null | cmd_creator_b.py | azeznassar/JavaScriptToUML | 53cccc1bba635114f03d966fd2f0f2f2d2d74bae | [
"MIT"
] | 4 | 2020-08-19T09:05:13.000Z | 2021-08-03T17:25:53.000Z | # pylint: disable="import-error"
from command_line_creator import CommandLineCreator
from current_cmd_b import CurrentCMD_B | 29.888889 | 51 | 0.773234 |
aed70cd25520bf0f360431c3625a8328524dbc40 | 1,744 | py | Python | WideResNet2.py | styanddty/Wide-resnet-fashionMnist | f281f1e3e3c2b55be20620290d6e0535fcc70d98 | [
"MIT"
] | 4 | 2018-05-12T01:53:20.000Z | 2020-11-10T09:35:01.000Z | WideResNet2.py | styanddty/Wide-resnet-fashionMnist | f281f1e3e3c2b55be20620290d6e0535fcc70d98 | [
"MIT"
] | null | null | null | WideResNet2.py | styanddty/Wide-resnet-fashionMnist | f281f1e3e3c2b55be20620290d6e0535fcc70d98 | [
"MIT"
] | 1 | 2018-11-25T20:03:56.000Z | 2018-11-25T20:03:56.000Z | from utils import _conv2d, _bn, _block
import tensorflow as tf | 42.536585 | 145 | 0.612959 |
aed73b39402bd942e4be1fdb0e1b2019a73a5408 | 21,700 | py | Python | src/pyadobemc/pyadobemc.py | andymaheshw/SiteCatalystPy | 3bb82b1c5cd6ee130e9a3c7b52a1c364913a9506 | [
"MIT"
] | null | null | null | src/pyadobemc/pyadobemc.py | andymaheshw/SiteCatalystPy | 3bb82b1c5cd6ee130e9a3c7b52a1c364913a9506 | [
"MIT"
] | null | null | null | src/pyadobemc/pyadobemc.py | andymaheshw/SiteCatalystPy | 3bb82b1c5cd6ee130e9a3c7b52a1c364913a9506 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 06 00:27:21 2016
@author: maheshwa
"""
from __future__ import print_function
import requests
import time
import binascii
import hashlib
import json
# Authentication
| 36.593592 | 118 | 0.6553 |
aed80772e26b65068e4088dd2031244a8b43228b | 2,750 | py | Python | tests/testingutils.py | dnephin/Tron | bd0f763421c6de50551e9a4b0e4a1c0c8ceb450a | [
"Apache-2.0"
] | null | null | null | tests/testingutils.py | dnephin/Tron | bd0f763421c6de50551e9a4b0e4a1c0c8ceb450a | [
"Apache-2.0"
] | null | null | null | tests/testingutils.py | dnephin/Tron | bd0f763421c6de50551e9a4b0e4a1c0c8ceb450a | [
"Apache-2.0"
] | null | null | null | import logging
import functools
import mock
from testify import TestCase, setup
from testify import class_setup, class_teardown
from testify import teardown
import time
from tron.utils import timeutils
log = logging.getLogger(__name__)
# TODO: remove when replaced with tron.eventloop
# TODO: remove
def retry(max_tries=3, delay=0.1, exceptions=(KeyError, IndexError)):
"""A function decorator for re-trying an operation. Useful for MongoDB
which is only eventually consistent.
"""
return wrapper
# TODO: remove when replaced with mock
def autospec_method(method, *args, **kwargs):
"""create an autospec for an instance method."""
mocked_method = mock.create_autospec(method, *args, **kwargs)
setattr(method.im_self, method.__name__, mocked_method)
| 28.645833 | 77 | 0.661091 |
aed8dca665c2fddde4b08f8f8f84ab30b49b9928 | 10,397 | py | Python | classes/App.py | JeanExtreme002/Aim-Coach | 25369e036073bc1fe95efdcad34b6648b1498672 | [
"BSD-3-Clause"
] | 1 | 2019-07-31T18:21:10.000Z | 2019-07-31T18:21:10.000Z | classes/App.py | JeanExtreme002/Aim-Training | 25369e036073bc1fe95efdcad34b6648b1498672 | [
"BSD-3-Clause"
] | null | null | null | classes/App.py | JeanExtreme002/Aim-Training | 25369e036073bc1fe95efdcad34b6648b1498672 | [
"BSD-3-Clause"
] | null | null | null | from classes.Display import Display
from classes.FinalScoreboard import FinalScoreboard
from classes.Sounds import Sounds
from classes.TargetArea import TargetArea
from classes.Target import Target
from classes.Text import Text
from classes.Timer import Timer
from time import time
import pygame
| 33.756494 | 141 | 0.598346 |
aeda62809d73ce75af8f774735efd74dd45b137f | 3,501 | py | Python | tests/conftest.py | kown7/pymergevcd | b4716b5aff49c7c496cae4f70fda0e5d52231e1b | [
"MIT"
] | 1 | 2021-02-27T21:22:16.000Z | 2021-02-27T21:22:16.000Z | tests/conftest.py | kown7/pymergevcd | b4716b5aff49c7c496cae4f70fda0e5d52231e1b | [
"MIT"
] | 1 | 2021-10-21T18:44:59.000Z | 2021-10-21T18:44:59.000Z | tests/conftest.py | kown7/pymergevcd | b4716b5aff49c7c496cae4f70fda0e5d52231e1b | [
"MIT"
] | null | null | null | """Provide test fixtures"""
import logging
import os
import pytest
import vcd
# pylint: disable=too-many-locals
| 46.065789 | 79 | 0.509854 |
aedc557dd8c720698321e37793a35e36a2e095e9 | 1,408 | py | Python | bot.py | tungr/CoeusBot | 90bdc869a1f8c077a1f88dcf1335d20a19d49fee | [
"MIT"
] | null | null | null | bot.py | tungr/CoeusBot | 90bdc869a1f8c077a1f88dcf1335d20a19d49fee | [
"MIT"
] | null | null | null | bot.py | tungr/CoeusBot | 90bdc869a1f8c077a1f88dcf1335d20a19d49fee | [
"MIT"
] | null | null | null | import discord, os
from discord.ext import commands
from discord.ext.commands import has_permissions, bot_has_permissions
from dotenv import load_dotenv
client = commands.Bot(command_prefix='-')
client.remove_command('help')
client.remove_command('reload')
# Loads a cog
# Unloads a cog
# Reloads a cog
load_dotenv()
# Grabs cogs from cogs directory
for fname in os.listdir(os.getenv('COGS')):
if fname.endswith('.py'):
client.load_extension(f'cogs.{fname[:-3]}')
else:
print(f'Unable to load {fname[:-3]}')
client.run(os.getenv('TOKEN')) | 30.608696 | 69 | 0.736506 |
aede0775f444057271755bf3520984120506d311 | 2,177 | py | Python | setup.py | llaurabat91/topic-modelling-tools | 9b53f52e5671005642faf065e993e19f0b249e5c | [
"MIT"
] | null | null | null | setup.py | llaurabat91/topic-modelling-tools | 9b53f52e5671005642faf065e993e19f0b249e5c | [
"MIT"
] | null | null | null | setup.py | llaurabat91/topic-modelling-tools | 9b53f52e5671005642faf065e993e19f0b249e5c | [
"MIT"
] | null | null | null | import sys
from setuptools import setup
from setuptools.extension import Extension
### unit tests for this package
import topicmodel_tests
### set include dirs for numpy
try:
import numpy
except ImportError:
numpy_already_installed = False
from distutils.sysconfig import get_python_lib
include_numpy_dir = get_python_lib()+"/numpy/core/include"
else:
numpy_already_installed = True
include_numpy_dir = numpy.get_include()
### Cython - rebuild the .c from the .pyx file if there, or if not, just use the .c
try:
from Cython.Distutils import build_ext
## from Cython.Build import cythonize
except ImportError:
use_cython = False
else:
use_cython = True
cmdclass = { }
ext_modules = [ ]
if use_cython:
ext_modules += [
Extension("topicmodels.samplers.samplers_lda",
["topicmodels/samplers/samplers_lda.pyx"],
include_dirs=[
include_numpy_dir,
],
)
]
cmdclass.update({ 'build_ext': build_ext })
else:
ext_modules += [
Extension("topicmodels.samplers.samplers_lda",
["topicmodels/samplers/samplers_lda.c"],
include_dirs=[
include_numpy_dir,
],
)
]
setup(name = "topic-modelling-tools",
version="0.6dev",
author="Stephen Hansen",
url="https://github.com/alan-turing-institute/topic-modelling-tools",
author_email="stephen.hansen@economics.ox.ac.uk",
ext_modules=ext_modules,
packages=['topicmodels', 'topicmodel_tests', 'topicmodels.LDA', 'topicmodels.multimix','topicmodels.samplers'],
package_data={'topicmodels': ['*.txt']},
cmdclass=cmdclass,
license="LICENSE",
description = "Python library that performs Latent Dirichlet Allocation using Gibbs sampling.",
long_description = open("README.md").read(),
install_requires=[
"numpy >= 1.13.3",
"nltk >= 3.2.4",
"pandas >= 0.20.3",
"scipy >= 0.19.1",
"Cython >= 0.20.1"
],
test_suite = 'topicmodel_tests.my_test_suite'
)
| 28.272727 | 117 | 0.618741 |
aedff3138bbb43e485ad12558c8ec12fb523b030 | 3,311 | py | Python | game/tests/models/test_ownership.py | gafderks/monopoly-vue | 4d18938508412476b19d205258a6339ff1f5975a | [
"MIT"
] | null | null | null | game/tests/models/test_ownership.py | gafderks/monopoly-vue | 4d18938508412476b19d205258a6339ff1f5975a | [
"MIT"
] | 172 | 2020-10-01T18:38:15.000Z | 2022-03-28T19:20:11.000Z | game/tests/models/test_ownership.py | gafderks/monopoly-vue | 4d18938508412476b19d205258a6339ff1f5975a | [
"MIT"
] | null | null | null | import datetime
from unittest import mock
import pytz
from django.core.exceptions import ValidationError
from django.db import IntegrityError
from django.test import TestCase
from game.models import Ownership, Game, Player, RealEstate
from game.tests.factories.ownership import OwnershipFactory
from game.tests.factories.player import PlayerFactory
from game.tests.factories.realestate import RealEstateFactory
| 39.416667 | 85 | 0.712776 |
aee1d165304e92ca3a56f102fa49637d4eb2d084 | 4,637 | py | Python | anyHR/constraint/node/Node.py | figlerg/anyHR | 418742aa10634338c405de87b2ee1cbe08ae8a9e | [
"BSD-3-Clause"
] | 1 | 2021-08-14T17:59:51.000Z | 2021-08-14T17:59:51.000Z | anyHR/constraint/node/Node.py | figlerg/anyHR | 418742aa10634338c405de87b2ee1cbe08ae8a9e | [
"BSD-3-Clause"
] | 2 | 2022-03-27T13:38:19.000Z | 2022-03-31T15:20:26.000Z | anyHR/constraint/node/Node.py | figlerg/anyHR | 418742aa10634338c405de87b2ee1cbe08ae8a9e | [
"BSD-3-Clause"
] | 1 | 2022-03-27T08:31:23.000Z | 2022-03-27T08:31:23.000Z | # from constraint.node.SubstitutorVisitor import SubstitutorVisitor
from enum import Enum
# for visitor class. Using isinstance breaks when importing from outside
| 25.478022 | 128 | 0.587233 |
aee1d58bc63210b255b76deaef25027f91fb2561 | 464 | py | Python | shop/store/migrations/0004_auto_20210328_2032.py | Mykytenkovladislav/book_shop_and_warehouse | 60852e5ed3869291e73623b8b8d7901d39d66c9d | [
"MIT"
] | null | null | null | shop/store/migrations/0004_auto_20210328_2032.py | Mykytenkovladislav/book_shop_and_warehouse | 60852e5ed3869291e73623b8b8d7901d39d66c9d | [
"MIT"
] | null | null | null | shop/store/migrations/0004_auto_20210328_2032.py | Mykytenkovladislav/book_shop_and_warehouse | 60852e5ed3869291e73623b8b8d7901d39d66c9d | [
"MIT"
] | null | null | null | # Generated by Django 3.1.7 on 2021-03-28 20:32
from django.db import migrations, models
| 24.421053 | 125 | 0.62931 |
aee3b41530ad1d83d280d311e7b96dac16a5ac08 | 12,327 | py | Python | crop_rotator/core/classes.py | Bahusson/crop_rotator | c1d86d36ce1867a84b927708f92c62c7815250a4 | [
"MIT"
] | 1 | 2021-05-08T07:04:45.000Z | 2021-05-08T07:04:45.000Z | crop_rotator/core/classes.py | Bahusson/crop_rotator | c1d86d36ce1867a84b927708f92c62c7815250a4 | [
"MIT"
] | 80 | 2020-11-18T20:35:12.000Z | 2021-06-13T08:08:36.000Z | crop_rotator/core/classes.py | Bahusson/crop_rotator | c1d86d36ce1867a84b927708f92c62c7815250a4 | [
"MIT"
] | null | null | null | from .snippets import (
remove_repeating,
flare,
list_appending_long,
level_off,
)
import itertools
import copy
from core.models import RotatorAdminPanel
# Nakadka na django do obsugi dodatku tumaczeniowego django-modeltranslation.
# Bo tak jest po prostu atwiej...
# Klasa aduje stron po dodaniu opcji typu panel admina.
# Klasa liczy interakcje w crop plannerze - (klasa-slave)
# Klasa obchodzi bdy zwizane z uywaniem wzornika
# CropPlanner tam gdzie nie potrzeba analizowa treci.
# Klasa analizuje podozmian pod ktem bdw i synergii.
def count_sources_pages(main_source):
sourcelist = []
for source in PageElement(main_source).allelements:
sourcelist.append([source.at_data_string, str(source.pages_from), str(source.pages_to)])
sourcelist1 = []
remove_repeating(sourcelist1, sourcelist)
sourcelist2 = copy.deepcopy(sourcelist1)
sourcelist3 = []
# Niewydajne - popraw!
for source in sourcelist1:
for source_bis in sourcelist2:
if source[0] == source_bis[0]:
if any(source[0] in sl for sl in sourcelist3):
for sublist in sourcelist3:
if source[0] in sublist:
if source[2] == "None":
sublist[1].append((source[1],))
else:
sublist[1].append((source[1], source[2]))
else:
sourcelist3.append([source[0], [(source[1], source[2])]])
sourcelist4 = []
for source in sourcelist3:
newsource = []
remove_repeating(newsource, source[1])
newsource.sort()
sourcelist4.append([source[0], newsource])
flare(sourcelist4)
# Do adowania po raz pierwszy na serwer.
try:
edit_delay_sec = PageElement(RotatorAdminPanel).baseattrs.evaluated_plan_cooldown
lurk_delay_min = PageElement(RotatorAdminPanel).baseattrs.lurk_plan_cooldown
except:
edit_delay_sec = 60
lurk_delay_min = 15
| 35.834302 | 101 | 0.564695 |
aee4f9bbfdac79e9118eae4558fc269abff34caa | 11,972 | py | Python | ai/RLPlayer.py | Unn20/achtung_die_kurve | e2dbb1752c070cfc398e415d5a427384c0230f3c | [
"MIT"
] | null | null | null | ai/RLPlayer.py | Unn20/achtung_die_kurve | e2dbb1752c070cfc398e415d5a427384c0230f3c | [
"MIT"
] | null | null | null | ai/RLPlayer.py | Unn20/achtung_die_kurve | e2dbb1752c070cfc398e415d5a427384c0230f3c | [
"MIT"
] | null | null | null | import copy
import math
import random
import numpy as np
import torch
from game.Player import Player
| 43.064748 | 157 | 0.628383 |
aee5927bf583c22f6d9d0f89495d9cdad0d60cd0 | 4,761 | py | Python | Intervention_Scenarios/helpers/what_if_helpers.py | tomtuamnuq/covasim-dds | 1e3ce8f9dda6908ca20040a3b532495de3bdc4c1 | [
"Apache-2.0"
] | 2 | 2022-03-11T09:48:19.000Z | 2022-03-20T09:06:31.000Z | Intervention_Scenarios/helpers/what_if_helpers.py | AzadehKSH/covasim-dds | 8bbaf4ffbebb4904ea56142d40043d2259ec7f25 | [
"Apache-2.0"
] | null | null | null | Intervention_Scenarios/helpers/what_if_helpers.py | AzadehKSH/covasim-dds | 8bbaf4ffbebb4904ea56142d40043d2259ec7f25 | [
"Apache-2.0"
] | null | null | null | from functools import partial
from typing import Tuple
import covasim as cv
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as st
delta_variant = cv.variant('delta', days=0) # delta is the dominant variant in germany
# Define baseline parameters
baseline_pars = dict(
start_day='2022-01-01',
n_days=60,
pop_type='hybrid',
pop_size=10_000,
pop_infected=int(get_current_infected_ratio() * 10000),
location='Germany',
use_waning=True, # use dynamically calculated immunity
n_beds_hosp=80, # https://tradingeconomics.com/germany/hospital-beds - 8 per 1000 people
n_beds_icu=62, # https://tradingeconomics.com/germany/icu-beds - 620 per 100.000 people
variants=[delta_variant],
)
# calculate by hand for reference
# plot by hand for reference
def _inf_thresh(self: cv.Intervention, sim: cv.Sim, thresh: int):
''' Dynamically define on and off days with respect to the number of infected people.
See https://docs.idmod.org/projects/covasim/en/latest/tutorials/tut_interventions.html#Dynamic-triggering'''
if sim.people.infectious.sum() > thresh:
if not self.active:
self.active = True
self.t_on = sim.t
self.plot_days.append(self.t_on)
else:
if self.active:
self.active = False
self.t_off = sim.t
self.plot_days.append(self.t_off)
return [self.t_on, self.t_off]
def init_intervention_for_inf_thresh(c: cv.Intervention):
"""Setup attributes for `inf_thresh_callback`"""
c.t_on = np.nan
c.t_off = np.nan
c.active = False
c.plot_days = []
return c
| 38.707317 | 129 | 0.692502 |
aee5c643860aef69edc1c551fc556f5c1921368e | 25,812 | py | Python | src/nba_history/player_data.py | odonnell31/nba_history | bfcaffa265ee193f1faf4e6786ddc7d2cbfc9142 | [
"MIT"
] | null | null | null | src/nba_history/player_data.py | odonnell31/nba_history | bfcaffa265ee193f1faf4e6786ddc7d2cbfc9142 | [
"MIT"
] | null | null | null | src/nba_history/player_data.py | odonnell31/nba_history | bfcaffa265ee193f1faf4e6786ddc7d2cbfc9142 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 16 11:45:09 2021
@author: Michael ODonnell
@purpose: scrape NBA draft picks by year
"""
# import needed libraries
import requests
from bs4 import BeautifulSoup
import pandas as pd
import time
# function to scrape a list of years of NBA Drafts
# function to scrape a list of years for NBA PLayer total stats
# function to scrape a list of years for NBA PLayer per game stats
# function to scrape a list of years for NBA PLayer total stats
# function to scrape a list of years for NBA PLayer shooting stats
# function to scrape All Stars by year
# function to scrape a list of years for NBA PLayer shooting stats | 43.675127 | 200 | 0.535371 |
aee70f5de0ae2c6851fc83893a601e60e16a4182 | 19,651 | py | Python | aristotle/apps/marc/bots/aspbots.py | jermnelson/Discover-Aristotle | cc1ff79915d715801890a3a8642099304916adfa | [
"Apache-2.0"
] | 7 | 2015-03-13T09:56:16.000Z | 2021-05-03T13:39:05.000Z | aristotle/apps/marc/bots/aspbots.py | jermnelson/Discover-Aristotle | cc1ff79915d715801890a3a8642099304916adfa | [
"Apache-2.0"
] | 1 | 2021-04-06T16:30:00.000Z | 2021-04-06T16:43:57.000Z | aristotle/apps/marc/bots/aspbots.py | jermnelson/Discover-Aristotle | cc1ff79915d715801890a3a8642099304916adfa | [
"Apache-2.0"
] | 2 | 2015-12-18T16:51:07.000Z | 2016-02-26T09:56:42.000Z | import urlparse,urllib2,re
import datetime,logging
from marcbots import MARCImportBot
from pymarc import Field
| 38.009671 | 125 | 0.558292 |
aee96f06eaeca2b9830d780ade1fc0b516e69f02 | 1,915 | py | Python | sqlalchemy/sqlalchemy-0.3.6+codebay/sqlalchemy/ext/assignmapper.py | nakedible/vpnease-l2tp | 0fcda6a757f2bc5c37f4753b3cd8b1c6d282db5c | [
"WTFPL"
] | 5 | 2015-04-16T08:36:17.000Z | 2017-05-12T17:20:12.000Z | sqlalchemy/sqlalchemy-0.3.6+codebay/sqlalchemy/ext/assignmapper.py | nakedible/vpnease-l2tp | 0fcda6a757f2bc5c37f4753b3cd8b1c6d282db5c | [
"WTFPL"
] | null | null | null | sqlalchemy/sqlalchemy-0.3.6+codebay/sqlalchemy/ext/assignmapper.py | nakedible/vpnease-l2tp | 0fcda6a757f2bc5c37f4753b3cd8b1c6d282db5c | [
"WTFPL"
] | 4 | 2015-03-19T14:39:51.000Z | 2019-01-23T08:22:55.000Z | from sqlalchemy import mapper, util, Query, exceptions
import types
| 43.522727 | 171 | 0.632898 |
aee9791412aca3b9a70fc201a6a8bbfc83e5a9e9 | 210 | py | Python | SmartTE/Signals/UndoSignals.py | smartboyathome/SmartTE | 373a721f17e9a1f3d1bbe5c9c101c638de3fa96d | [
"BSD-3-Clause"
] | 1 | 2020-07-15T19:53:27.000Z | 2020-07-15T19:53:27.000Z | SmartTE/Signals/UndoSignals.py | smartboyathome/SmartTE | 373a721f17e9a1f3d1bbe5c9c101c638de3fa96d | [
"BSD-3-Clause"
] | null | null | null | SmartTE/Signals/UndoSignals.py | smartboyathome/SmartTE | 373a721f17e9a1f3d1bbe5c9c101c638de3fa96d | [
"BSD-3-Clause"
] | null | null | null | UNDO_EMPTY = 'undostack-empty'
UNDO_NOT_EMPTY = 'undostack-not-empty'
REDO_EMPTY = 'redostack-empty'
REDO_NOT_EMPTY = 'redostack-not-empty'
UNDO_CHANGED = 'undostack-changed'
REDO_CHANGED = 'redostack-changed'
| 30 | 38 | 0.790476 |
aeebb225c84833a15d25e565e8ec5e80d876a03e | 3,564 | py | Python | Mod.py | christoffaloffagus/Clint-Bot-3000 | e2da367ceb7459d9c081a17c9e24ef08d76f3e53 | [
"MIT"
] | null | null | null | Mod.py | christoffaloffagus/Clint-Bot-3000 | e2da367ceb7459d9c081a17c9e24ef08d76f3e53 | [
"MIT"
] | null | null | null | Mod.py | christoffaloffagus/Clint-Bot-3000 | e2da367ceb7459d9c081a17c9e24ef08d76f3e53 | [
"MIT"
] | null | null | null | import discord
from discord.ext import commands
from os import system
#
#
# @client.command(pass_context=True)
# async def clear_all(ctx):
# channel = ctx.message.channel
# count = 0
#
# while True:
# messages = []
# async for message in client.logs_from(channel, 100):
# messages.append(message)
# length = len(messages)
#
# if length == 1:
# await client.delete_message(messages[0])
# elif length > 100:
# print(f'ERROR: Messages had {length} messages which is over the 100 limit')
# messages = messages[:100]
# await client.delete_messages(messages)
#
# if length == 0:
# break
# else:
# print(length, 'messages being deleted')
# count += length
# print('Total messages deleted:', count)
#
#
# @client.command()
# async def spam(*args):
# amount = int(args[0])
# if len(args) > 1:
# time = float(args[1])
# else:
# time = 1
# for i in range(int(amount)):
# await client.say('Spam!')
# await asyncio.sleep(float(time))
#
#
# @client.command()
# async def list_ch():
# s = '\n'.join([ch for ch in all_channels])
# await client.say(s)
#
#
# @client.command()
# async def tell(*args):
# room = args[0]
# text = ' '.join(args[1:])
#
# await client.send_message(all_channels[room], text)
#
#
# @client.command()
# async def bot_game(*args):
# game = discord.Game(name=' '.join(args))
# await client.change_presence(game=game)
# class Fun:
# def __init__(self, client):
# self.client = client
#
# @commands.commands()
# async def
| 26.796992 | 89 | 0.564534 |
aeed0b8abb2aadc143c55c6677cfe9445bb8a6a9 | 1,316 | py | Python | examples/dictation grammar example.py | onchiptech/pyjsgf | f7ff26323e5e602ea10e7d302610c2fcb46234d6 | [
"MIT"
] | 40 | 2018-01-24T23:01:27.000Z | 2022-01-19T03:33:37.000Z | examples/dictation grammar example.py | onchiptech/pyjsgf | f7ff26323e5e602ea10e7d302610c2fcb46234d6 | [
"MIT"
] | 31 | 2018-03-01T07:58:27.000Z | 2022-01-13T12:07:45.000Z | examples/dictation grammar example.py | onchiptech/pyjsgf | f7ff26323e5e602ea10e7d302610c2fcb46234d6 | [
"MIT"
] | 21 | 2017-11-14T09:11:17.000Z | 2022-02-02T15:32:57.000Z | """
Example showing use of the jsgf.ext DictationGrammar class for matching and
compiling rules that use regular JSGF expansions like Literal and Sequence as
well as Dictation expansions.
"""
from jsgf import PublicRule, Sequence
from jsgf.ext import Dictation, DictationGrammar
if __name__ == '__main__':
main()
| 31.333333 | 79 | 0.718085 |
aeeff92da6880272b842617fa1cd1119d5a74e02 | 2,534 | py | Python | pyclustering/cluster/tests/integration/it_hsyncnet.py | JosephChataignon/pyclustering | bf4f51a472622292627ec8c294eb205585e50f52 | [
"BSD-3-Clause"
] | 1,013 | 2015-01-26T19:50:14.000Z | 2022-03-31T07:38:48.000Z | pyclustering/cluster/tests/integration/it_hsyncnet.py | peterlau0626/pyclustering | bf4f51a472622292627ec8c294eb205585e50f52 | [
"BSD-3-Clause"
] | 542 | 2015-01-20T16:44:32.000Z | 2022-01-29T14:57:20.000Z | pyclustering/cluster/tests/integration/it_hsyncnet.py | peterlau0626/pyclustering | bf4f51a472622292627ec8c294eb205585e50f52 | [
"BSD-3-Clause"
] | 262 | 2015-03-19T07:28:12.000Z | 2022-03-30T07:28:24.000Z | """!
@brief Integration-tests for Hierarchical Sync (HSyncNet) algorithm.
@authors Andrei Novikov (pyclustering@yandex.ru)
@date 2014-2020
@copyright BSD-3-Clause
"""
import unittest;
import matplotlib;
matplotlib.use('Agg');
from pyclustering.cluster.tests.hsyncnet_templates import HsyncnetTestTemplates;
from pyclustering.nnet import solve_type;
from pyclustering.samples.definitions import SIMPLE_SAMPLES;
from pyclustering.core.tests import remove_library;
| 41.540984 | 133 | 0.753749 |
aef1f46a6f4fb6e4545b68a9cb41e8f97c07f8ea | 92 | py | Python | custom/plugins/setup_oer_reports_pre.py | M-Spencer-94/configNOW | 56828587253202089e77cfdfcf5329f2a7f09b3f | [
"PSF-2.0",
"Apache-2.0",
"MIT"
] | 3 | 2019-07-09T20:02:48.000Z | 2021-11-21T20:00:37.000Z | custom/plugins/setup_oer_reports_pre.py | M-Spencer-94/configNOW | 56828587253202089e77cfdfcf5329f2a7f09b3f | [
"PSF-2.0",
"Apache-2.0",
"MIT"
] | null | null | null | custom/plugins/setup_oer_reports_pre.py | M-Spencer-94/configNOW | 56828587253202089e77cfdfcf5329f2a7f09b3f | [
"PSF-2.0",
"Apache-2.0",
"MIT"
] | null | null | null | import common.assertions as assertions | 23 | 38 | 0.836957 |
aef2d0ce8b0f340445dbcd09415dd30f5aa7f265 | 758 | py | Python | material/curso_em_video/ex085.py | sergiodealencar/courses | c9d86b27b0185cc82624b01ed76653dbc12554a3 | [
"MIT"
] | null | null | null | material/curso_em_video/ex085.py | sergiodealencar/courses | c9d86b27b0185cc82624b01ed76653dbc12554a3 | [
"MIT"
] | null | null | null | material/curso_em_video/ex085.py | sergiodealencar/courses | c9d86b27b0185cc82624b01ed76653dbc12554a3 | [
"MIT"
] | null | null | null | lista = [[], []]
valor = 0
for c in range(1, 8):
valor = int(input(f'Digite o {c}o. valor: '))
if valor % 2 == 0:
lista[0].append(valor)
else:
lista[1].append(valor)
print('-=' * 30)
print(f'Os valores pares digitados foram: {sorted(lista[0])}')
print(f'Os valores mpres digitados foram: {sorted(lista[1])}')
# meu cdigo (funcionou tambm):
# lista = [[], []]
# temp = []
# for c in range(1, 8):
# temp.append(int(input(f'Digite o {c}o valor: ')))
# if temp[c] % 2 == 0:
# lista[0].append(temp[c])
# else:
# lista[1].append(temp[c])
# print('-=' * 30)
# sorted(lista)
# print(f'Os valores pares digitados foram: {sorted(lista[0])}')
# print(f'Os valores mpres digitados foram: {sorted(lista[1])}')
| 29.153846 | 65 | 0.575198 |
aef488759816cabfb40bd3b6063dcdfb1b53455d | 3,216 | py | Python | ane_research/utils/kendall_top_k.py | michaeljneely/sparse-attention-explanation | 658b181f67963fe22dd0489bd9b37bdbd05110c1 | [
"MIT"
] | 2 | 2020-03-25T22:13:09.000Z | 2021-01-06T04:28:03.000Z | ane_research/utils/kendall_top_k.py | michaeljneely/sparse-attention-explanation | 658b181f67963fe22dd0489bd9b37bdbd05110c1 | [
"MIT"
] | null | null | null | ane_research/utils/kendall_top_k.py | michaeljneely/sparse-attention-explanation | 658b181f67963fe22dd0489bd9b37bdbd05110c1 | [
"MIT"
] | null | null | null | '''Top-k kendall-tau distance.
This module generalise kendall-tau as defined in [1].
It returns a distance: 0 for identical (in the sense of top-k) lists and 1 if completely different.
Example:
Simply call kendall_top_k with two same-length arrays of ratings (or also rankings), length of the top elements k (default is the maximum length possible), and p (default is 0, see [1]) as parameters:
import kendall
a = np.array([1,2,3,4,5])
b = np.array([5,4,3,2,1])
kendall.kendall_top_k(a,b,k=4)
Author: Alessandro Checco
https://github.com/AlessandroChecco
References
[1] Fagin, Ronald, Ravi Kumar, and D. Sivakumar. 'Comparing top k lists.' SIAM Journal on Discrete Mathematics 17.1 (2003): 134-160.
'''
# pylint: disable=E1101
# pylint incorrectly identifies some types as tuples
import math
import numpy as np
import scipy.stats as stats
import scipy.special as special
def kendall_top_k(a, b, k=None, kIsNonZero=False, p=0.5):
'''
kendall_top_k(np.array,np.array,k,p)
This function generalise kendall-tau as defined in
[1] Fagin, Ronald, Ravi Kumar, and D. Sivakumar. 'Comparing top k lists.' SIAM Journal on Discrete Mathematics 17.1 (2003): 134-160.
It returns a distance: 1 for identical (in the sense of top-k) lists and -1 if completely different.
Example:
Simply call it with two same-length arrays of ratings (or also rankings),
length of the top elements k (default is the maximum length possible), and p (default is 0, see [1]) as parameters:
$ a = np.array([1,2,3,4,5])
$ b = np.array([5,4,3,2,1])
$ kendall_top_k(a,b,k=4)
If the kIsNonZero option is True, k is set to the amount of non-zero values in a or b, depending on which has least.
'''
a = np.array(a)
b = np.array(b)
if kIsNonZero:
anz, bnz = np.count_nonzero(a), np.count_nonzero(b)
k = min(np.count_nonzero(a), np.count_nonzero(b))
#print('anz={}, bnz={}, k={}'.format(anz, bnz, k))
elif k is None:
k = a.size
if a.size != b.size:
raise NameError('The two arrays need to have same lengths')
k = min(k,a.size)
a_top_k = np.argpartition(a,-k)[-k:]
b_top_k = np.argpartition(b,-k)[-k:]
common_items = np.intersect1d(a_top_k,b_top_k)
only_in_a = np.setdiff1d(a_top_k, common_items)
only_in_b = np.setdiff1d(b_top_k, common_items)
# case 1
kendall = (1 - (stats.kendalltau(a[common_items], b[common_items])[0] / 2 + 0.5)) * common_items.size**2
if np.isnan(kendall): # degenerate case with only one item (not defined by Kendall)
#print('DEGENERATE CASE <= 1 in common')
kendall = 0
#case 2 (& 3 ?)
test = 0
for i in common_items:
for j in only_in_a:
if a[i] < a[j]:
test += 1
for j in only_in_b:
if b[i] < b[j]:
test += 1
kendall += test
# case 4
kendall += 2 * p * special.binom(k-common_items.size, 2)
# case 3
kendall /= (only_in_a.size + only_in_b.size + common_items.size)**2 #normalization
kendall = -2 * kendall + 1 # change to correct range
return (kendall, k)
| 34.212766 | 204 | 0.634639 |
aef7c4bd6270658e2d5f6a301a21f1fd8ae19292 | 619 | py | Python | test/math/test_matmul.py | ctgk/bayes | 96eab9305eaeecc5a5b032cdf92a8285de4f60bf | [
"MIT"
] | 21 | 2019-01-08T05:58:41.000Z | 2021-11-26T14:24:11.000Z | test/math/test_matmul.py | ctgk/bayes | 96eab9305eaeecc5a5b032cdf92a8285de4f60bf | [
"MIT"
] | null | null | null | test/math/test_matmul.py | ctgk/bayes | 96eab9305eaeecc5a5b032cdf92a8285de4f60bf | [
"MIT"
] | 11 | 2019-05-04T13:44:19.000Z | 2021-08-05T04:26:19.000Z | import unittest
import numpy as np
import bayesnet as bn
if __name__ == '__main__':
unittest.main()
| 22.925926 | 51 | 0.534733 |
aef90fca9fea526b2891e7df58b0f264aee383cd | 2,387 | py | Python | test.py | VegaSera/SWNDiscordBot2 | cb73b9d51591b6af9f2a1a603ea0dd8a7161020c | [
"MIT"
] | 2 | 2020-09-08T18:08:55.000Z | 2021-06-22T17:13:32.000Z | test.py | VegaSera/SWNDiscordBot2 | cb73b9d51591b6af9f2a1a603ea0dd8a7161020c | [
"MIT"
] | null | null | null | test.py | VegaSera/SWNDiscordBot2 | cb73b9d51591b6af9f2a1a603ea0dd8a7161020c | [
"MIT"
] | 1 | 2020-06-30T19:12:27.000Z | 2020-06-30T19:12:27.000Z |
newchar = char()
#newchar.raise_stat()
# print(newchar.cha)
# newchar.raise_stat()
# print(newchar.cha)
#
# class_type = None
# list(class_type)
# print(class_type, type(class_type))
#
# listthing = [0, 1, 2, 3, 4, 5]
#
# for i in listthing:
# if i == 2:
# listthing.append(1)
# elif i == 1:
# print("I FOUND A ONE! HOPEFULLY I'LL FIND ANOTHER")
# elif i == 3:
# listthing.remove(i)
# print(listthing)
#
# import random
#
# featuredict = {1:"Amphibian",2:"Bird",3:"Fish",4:"Insect",5:"Mammal",6:"Reptile",7:"Spider",8:"Exotic"}
# print(random.choice(featuredict))
print("Function output", returns_tuple())
x, y, z = returns_tuple()
print("x =", x)
print("y =", y)
print("z =", z) | 27.436782 | 105 | 0.492669 |
aef99003b57d71ccb53d2879735f4b65ddc02caf | 4,519 | py | Python | modules/friday/loginator.py | roshanmaind/Nico | 5495cf88111403f22e34e3b13badf7535ddd0b4d | [
"MIT"
] | 2 | 2019-03-14T01:06:37.000Z | 2020-06-04T04:35:36.000Z | modules/friday/loginator.py | roshanmaind/Nico | 5495cf88111403f22e34e3b13badf7535ddd0b4d | [
"MIT"
] | null | null | null | modules/friday/loginator.py | roshanmaind/Nico | 5495cf88111403f22e34e3b13badf7535ddd0b4d | [
"MIT"
] | 1 | 2020-02-11T09:54:12.000Z | 2020-02-11T09:54:12.000Z | from kivy.app import App
from kivy.config import Config
Config.set('graphics', 'width', '500')
Config.set('graphics', 'height', '640')
Config.set('graphics', 'resizable', False)
Config.set('kivy','window_icon','data/friday/res/icon.ico')
#from kivy.core.window import Window
from kivy.uix.screenmanager import ScreenManager, Screen, FadeTransition
from kivy.properties import StringProperty, BooleanProperty
import h5py
import os
root_path = os.path.realpath(__file__)
root_path = root_path[:len(root_path)- 27]
from kivy.core.window import Window
g_user = None
dbg = None
def login(user):
global g_user
g_user = user
global dbg
with h5py.File(str(root_path + "data/friday/users.hdf5"), "r") as users_file:
database = users_file["users"]
database = list(database)
for i in range(len(database)):
database[i] = [attrib.decode("utf8") for attrib in database[i]]
dbg = database
Login().run()
#Window.close()
return g_user
if __name__ == "__main__":
login({})
| 24.82967 | 106 | 0.652578 |
aefcef00d9aee8a184d745a314bbf87059c90545 | 380 | py | Python | 13-Introduction to Data Visualization with Matplotlib/Chapter_3/05-Adding error-bars to a bar chart.py | Pegasus-01/Data-manipulation-and-merging-with-pandas | 5346678d25820d9fe352bd70294484ecd96fccf7 | [
"Apache-2.0"
] | 1 | 2021-05-08T11:09:27.000Z | 2021-05-08T11:09:27.000Z | 13-Introduction to Data Visualization with Matplotlib/Chapter_3/05-Adding error-bars to a bar chart.py | Pegasus-01/Data-manipulation-and-merging-with-pandas | 5346678d25820d9fe352bd70294484ecd96fccf7 | [
"Apache-2.0"
] | 1 | 2022-03-12T15:42:14.000Z | 2022-03-12T15:42:14.000Z | 13-Introduction to Data Visualization with Matplotlib/Chapter_3/05-Adding error-bars to a bar chart.py | Pegasus-01/Data-manipulation-and-merging-with-pandas | 5346678d25820d9fe352bd70294484ecd96fccf7 | [
"Apache-2.0"
] | 1 | 2021-04-30T18:24:19.000Z | 2021-04-30T18:24:19.000Z | fig, ax = plt.subplots()
# Add a bar for the rowing "Height" column mean/std
ax.bar("Rowing", mens_rowing["Height"].mean(), yerr=mens_rowing["Height"].std())
# Add a bar for the gymnastics "Height" column mean/std
ax.bar("Gymnastics", mens_gymnastics["Height"].mean(), yerr=mens_gymnastics["Height"].std())
# Label the y-axis
ax.set_ylabel("Height (cm)")
plt.show() | 31.666667 | 93 | 0.684211 |
aefede202bad9f729cfa7d6d686317776413a990 | 503 | py | Python | itests/pages/role_users.py | aneeq009/merou | 7a87b43aaf64244932fa460842132a2d9329e704 | [
"Apache-2.0"
] | 58 | 2017-05-26T06:46:24.000Z | 2022-03-25T20:55:51.000Z | itests/pages/role_users.py | aneeq009/merou | 7a87b43aaf64244932fa460842132a2d9329e704 | [
"Apache-2.0"
] | 74 | 2017-06-16T17:48:37.000Z | 2022-03-28T23:09:54.000Z | itests/pages/role_users.py | aneeq009/merou | 7a87b43aaf64244932fa460842132a2d9329e704 | [
"Apache-2.0"
] | 43 | 2017-05-20T22:11:51.000Z | 2022-03-25T00:24:56.000Z | from __future__ import annotations
from itests.pages.base import BaseModal, BasePage
| 26.473684 | 61 | 0.739563 |
aefeff0d7e3ecd3fdcf33e006a4f377fb496e7f7 | 6,141 | py | Python | hybrid/GAN-Sentence/model.py | vishalbelsare/Deep-Learning-Tensorflow | 1590bfc7007aa53aaab72493e7d6f8154f3ec99b | [
"MIT"
] | 51 | 2017-08-04T12:54:49.000Z | 2022-03-04T08:23:46.000Z | hybrid/GAN-Sentence/model.py | Jeansding/Deep-Learning-Tensorflow | 1590bfc7007aa53aaab72493e7d6f8154f3ec99b | [
"MIT"
] | 3 | 2017-09-24T13:44:30.000Z | 2018-12-23T11:43:34.000Z | hybrid/GAN-Sentence/model.py | vishalbelsare/Deep-Learning-Tensorflow | 1590bfc7007aa53aaab72493e7d6f8154f3ec99b | [
"MIT"
] | 45 | 2017-08-04T02:36:32.000Z | 2022-03-04T08:23:50.000Z | import tensorflow as tf
import numpy as np
import parse
| 63.309278 | 205 | 0.765511 |
aeffe251e30362d499c33484220e03c6b09531a5 | 987 | py | Python | extracting_information/extract_payments.py | ErikOSorensen/mmrisk_instrument | 3a1bf587ec08362a4c24f8a40064142a5307c94c | [
"BSD-3-Clause"
] | null | null | null | extracting_information/extract_payments.py | ErikOSorensen/mmrisk_instrument | 3a1bf587ec08362a4c24f8a40064142a5307c94c | [
"BSD-3-Clause"
] | null | null | null | extracting_information/extract_payments.py | ErikOSorensen/mmrisk_instrument | 3a1bf587ec08362a4c24f8a40064142a5307c94c | [
"BSD-3-Clause"
] | null | null | null | from mmr2web.models import *
import datetime
def get_payments_file(nok_per_usd=9.1412):
"""Default exchange rate taken from Norges Bank, Nov 22, 2019."""
payments_out = open("payments_mmrisk.csv", "w")
payments_out.write("amount,message\n")
total_payment = 0
for s in Situation.objects.filter(selected=True):
if s.choice_risk:
amount = DICE[s.die.dienumber]['eyes'][s.draw-1] / nok_per_usd
message = "In mmr2 - someone decided to throw a dice on your behalf."
if amount==0:
amount=0.01
message = "In mmr - someone decided to throw a dice on your behalf and you were unlucky."
else:
amount = s.safe_amount / nok_per_usd
message = "In mmr2 - someone decided for the safe amount on your behalf."
payments_out.write("%3.2f,%s\n" % (amount, message))
total_payment += amount
payments_out.close()
return total_payment
get_payments_file()
| 37.961538 | 105 | 0.637285 |
4e002a3d2a0b17bea2d95b12a32b8e97ea924162 | 1,488 | py | Python | tests/extmod/uasyncio_threadsafeflag.py | ProofDx/micropython | 321d1897c34f16243edf2c94913d7cf877a013d1 | [
"MIT"
] | 13,648 | 2015-01-01T01:34:51.000Z | 2022-03-31T16:19:53.000Z | tests/extmod/uasyncio_threadsafeflag.py | ProofDx/micropython | 321d1897c34f16243edf2c94913d7cf877a013d1 | [
"MIT"
] | 7,092 | 2015-01-01T07:59:11.000Z | 2022-03-31T23:52:18.000Z | tests/extmod/uasyncio_threadsafeflag.py | ProofDx/micropython | 321d1897c34f16243edf2c94913d7cf877a013d1 | [
"MIT"
] | 4,942 | 2015-01-02T11:48:50.000Z | 2022-03-31T19:57:10.000Z | # Test Event class
try:
import uasyncio as asyncio
except ImportError:
print("SKIP")
raise SystemExit
import micropython
try:
micropython.schedule
except AttributeError:
print("SKIP")
raise SystemExit
try:
# Unix port can't select/poll on user-defined types.
import uselect as select
poller = select.poll()
poller.register(asyncio.ThreadSafeFlag())
except TypeError:
print("SKIP")
raise SystemExit
asyncio.run(main())
| 18.6 | 56 | 0.633065 |
4e00da2e34037c4502cad55e6ab548d6d329f370 | 2,861 | py | Python | tests/TestItemkind.py | ORTECScientificBenchmarks/ortec-scientific-benchmarks-loadbuilding | 8b1f5c58d930448a29195355d28fda856f4705b2 | [
"MIT"
] | 4 | 2018-05-23T22:48:42.000Z | 2020-04-21T10:21:30.000Z | tests/TestItemkind.py | ORTECScientificBenchmarks/ortec-scientific-benchmarks-loadbuilding | 8b1f5c58d930448a29195355d28fda856f4705b2 | [
"MIT"
] | null | null | null | tests/TestItemkind.py | ORTECScientificBenchmarks/ortec-scientific-benchmarks-loadbuilding | 8b1f5c58d930448a29195355d28fda856f4705b2 | [
"MIT"
] | null | null | null | import unittest
from ortec.scientific.benchmarks.loadbuilding.instance.ThreeDitemkind import ThreeDitemkind
TestCase = unittest.TestSuite()
TestCase.addTest(unittest.TestLoader().loadTestsFromTestCase(TestItemkind)) | 42.073529 | 92 | 0.688221 |
4e02feb6bd33bf7b2f8ebc85d438cb20d237fd9e | 30 | py | Python | blind_blizzards/data/game.py | Starwort/code-jam-5 | c11ab7508ca8c68fe64f33118a3a44956c0a8292 | [
"MIT"
] | null | null | null | blind_blizzards/data/game.py | Starwort/code-jam-5 | c11ab7508ca8c68fe64f33118a3a44956c0a8292 | [
"MIT"
] | null | null | null | blind_blizzards/data/game.py | Starwort/code-jam-5 | c11ab7508ca8c68fe64f33118a3a44956c0a8292 | [
"MIT"
] | 1 | 2019-06-28T21:59:41.000Z | 2019-06-28T21:59:41.000Z | from .structs import GameNode
| 15 | 29 | 0.833333 |
4e031c5ec8a60556bf8f5a17d8935996db1b3e9d | 292 | py | Python | netpen/utils.py | defcronyke/netpen | 66bf5c4401752a6ad9f411f04d88c0189281f8fb | [
"MIT"
] | 27 | 2021-07-13T14:41:59.000Z | 2022-03-19T09:48:50.000Z | netpen/utils.py | defcronyke/netpen | 66bf5c4401752a6ad9f411f04d88c0189281f8fb | [
"MIT"
] | 7 | 2021-07-13T20:12:04.000Z | 2022-02-23T18:16:47.000Z | netpen/utils.py | defcronyke/netpen | 66bf5c4401752a6ad9f411f04d88c0189281f8fb | [
"MIT"
] | 3 | 2021-07-13T15:25:01.000Z | 2021-11-18T09:57:09.000Z | import socket
import ipaddress
| 20.857143 | 61 | 0.678082 |
4e039a12924bbf9ee1073f9918fa1b333ccf4193 | 4,370 | py | Python | Python/biopsy/binding_hit.py | JohnReid/biopsy | 1eeb714ba5b53f2ecf776d865d32e2078cbc0338 | [
"MIT"
] | null | null | null | Python/biopsy/binding_hit.py | JohnReid/biopsy | 1eeb714ba5b53f2ecf776d865d32e2078cbc0338 | [
"MIT"
] | null | null | null | Python/biopsy/binding_hit.py | JohnReid/biopsy | 1eeb714ba5b53f2ecf776d865d32e2078cbc0338 | [
"MIT"
] | null | null | null | #
# Copyright John Reid 2006
#
from _biopsy import *
Hit.__str__ = _hit_str
HitLocation.start = _location_start
HitLocation.end = _location_end
def _location_overlap( location1, location2 ):
"""Do two hits overlap?"""
if location1.position < location2.position:
return location1.end() > location2.position
else:
return location2.end() > location1.position
HitLocation.overlap = _location_overlap
def _location_separation( location1, location2 ):
"""The separation between two locations"""
if location1.position >= location2.end():
return location1.position - location2.end()
else:
return location2.position - location1.end()
HitLocation.separation = _location_separation
HitVec.__str__ = _hits_str
def get_max_p_binding_over_hits( hits ):
"""Takes a list of hits and returns a dictionary mapping binder names to max( p(binding) ) across all hits"""
result = { }
for hit in hits:
if not result.has_key( hit.binder ) or result[hit.binder] < hit.p_binding:
result[hit.binder] = hit.p_binding
return result
def find_pair_in_analysis(
analysis,
pair,
max_separation = None,
separation = None
):
"""Finds in which analyses a pair of TFs bind
analysis: Analysis
pair: A tuple ( binder1, binder2, orientation1, orientation2 )
max_separation: If specified determines maximum separation
separation: If specified determines exact separation (over-rides max_separation)
Returns a list of keys for the analyses
"""
result = { }
for k in analysis.get_keys():
hits = analysis.get_hits_for( k )
found_pairs = find_pair_in_hits( hits, pair, max_separation, separation )
if found_pairs:
result[ k ] = found_pairs
return result
def find_pair_in_hits(
hits,
pair,
max_separation = None,
separation = None
):
"""Finds the locations where a pair of TFs bind in a sequence of hits
hits: The hits
pair: A tuple ( binder1, binder2, orientation1, orientation2 )
max_separation: If specified determines maximum separation
separation: If specified determines exact separation (overrides max_separation)
returns a sequence of pairs of hits that satisfy the criteria
"""
( binder1, binder2, orientation1, orientation2 ) = pair
result = [ ]
for h1 in hits:
if binder1 != h1.binder: continue
for h2 in hits:
if binder2 != h2.binder: continue
if h1.location.overlap( h2.location ): continue
distance = h1.location.separation( h2.location )
if None != separation and separation != distance: continue
if None != max_separation and max_separation < distance: continue
if h1.location.position < h2.location.position:
if (
h1.location.positive_strand != orientation1
or
h2.location.positive_strand != orientation2
): continue
else:
if (
h1.location.positive_strand == orientation1
or
h2.location.positive_strand == orientation2
): continue
result.append( ( h1, h2 ) )
return result
def hit_over_threshold_predicate(threshold):
"@return: A function that returns True if the hit is over the threshold given."
def predicate(hit):
"@return: True iff the hit's score is above the threshold."
return hit.p_binding >= threshold
return predicate
def hits_above_threshold(hits, threshold):
"@return: Those hits above the threshold."
return filter(hit_over_threshold_predicate(threshold), hits)
| 30.774648 | 113 | 0.643936 |
4e0443002a9f7388df8a4ecc7a67f5770910ff51 | 8,384 | py | Python | epithet/epithet.py | mitodl/epithet | 4f95054fbdfbae0e9d6db2e3309993d00a8a6867 | [
"MIT"
] | null | null | null | epithet/epithet.py | mitodl/epithet | 4f95054fbdfbae0e9d6db2e3309993d00a8a6867 | [
"MIT"
] | null | null | null | epithet/epithet.py | mitodl/epithet | 4f95054fbdfbae0e9d6db2e3309993d00a8a6867 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import click
from github import Github
from github.GithubException import RateLimitExceededException
if __name__ == "__main__":
main(obj={})
| 40.699029 | 89 | 0.532085 |
4e04cfd6696b1d79b63702e52778fdde33cbdd79 | 1,876 | py | Python | Tarea1/utilities.py | aleluman/CC5114 | aae4ea9faf0a7cb3eb3bf53f8eecaf209aebf4d6 | [
"MIT"
] | null | null | null | Tarea1/utilities.py | aleluman/CC5114 | aae4ea9faf0a7cb3eb3bf53f8eecaf209aebf4d6 | [
"MIT"
] | null | null | null | Tarea1/utilities.py | aleluman/CC5114 | aae4ea9faf0a7cb3eb3bf53f8eecaf209aebf4d6 | [
"MIT"
] | null | null | null | import numpy as np
def normalize(matrix, nh=1, nl=0):
"""Normalizes each column in a matrix by calculating its maximum
and minimum values, the parameters nh and nl specify the final range
of the normalized values"""
return (matrix - matrix.min(0)) * ((nh - nl) / matrix.ptp(0)) + nl
def one_hot_encoding(array):
"""Encodes each unique label in 'array' in a vector of the same length as
the number of unique labels. This vector is filled with zeros and a 1
representing the position assigned to the label"""
labels = np.unique(array)
number_of_labels = labels.size
encoded = {}
for i in range(number_of_labels):
encoding = np.zeros(number_of_labels)
encoding[i] = 1
encoded[labels[i]] = encoding
return encoded
def encode(array, encoding):
"""Encodes 'array' with the encoding specified in encoding.
This value must be a dictionary"""
encoded = []
for i in array:
encoded.append(encoding[i])
return encoded
def load_data_wrapper(name, input_cols, output_col, output_type="float", delimiter=None):
"""Wrapper to load the desired data in an easier way. It returns the normalized and encoded
data, alongside with the size of the values in the inputs and outputs to initialize
the neural network correctly"""
data_x = np.loadtxt(name, usecols=input_cols, delimiter=delimiter)
data_x = normalize(data_x)
data_y = np.loadtxt(name, usecols=output_col, delimiter=delimiter, dtype=output_type)
encoding = one_hot_encoding(data_y)
data_y = encode(data_y, encoding)
# x_len will be the number of input neurons, and y_len the number of output neurons
x_len = np.shape(data_x)[1]
y_len = np.shape(data_y)[1]
data = [[np.reshape(x, (x_len, 1)), np.reshape(y, (y_len, 1))] for x, y in zip(data_x, data_y)]
return data, x_len, y_len
| 39.083333 | 99 | 0.695096 |
4e051ec8fbfa4fdbb801b562f9028e2cec2f9219 | 1,304 | py | Python | tests/test_searcher.py | jrdelmar/cbis | 6cce46680555d622ecea88f2ee2721209810abbe | [
"MIT"
] | 1 | 2019-03-19T14:10:19.000Z | 2019-03-19T14:10:19.000Z | tests/test_searcher.py | jrdelmar/cbis | 6cce46680555d622ecea88f2ee2721209810abbe | [
"MIT"
] | 14 | 2020-01-28T22:38:54.000Z | 2022-03-11T23:43:34.000Z | tests/test_searcher.py | jrdelmar/cbis | 6cce46680555d622ecea88f2ee2721209810abbe | [
"MIT"
] | null | null | null | from pyimagesearch.searcher import Searcher
from pyimagesearch.utils import *
import pytest
indexPath = "D:/APP/cbis/"
verbose = True
#test Search class
pred_file = "D://APP//cbis//tests//out//predictions_test.csv"
top_k = 20
| 29.636364 | 78 | 0.713957 |
4e08b9785d412b27c9f6fb1800aa24f2a6fc367a | 9,484 | py | Python | ntfs.py | kartone/INDXRipper | 88e663115b8705b1bb153b28fd74f943c515b9ca | [
"MIT"
] | null | null | null | ntfs.py | kartone/INDXRipper | 88e663115b8705b1bb153b28fd74f943c515b9ca | [
"MIT"
] | null | null | null | ntfs.py | kartone/INDXRipper | 88e663115b8705b1bb153b28fd74f943c515b9ca | [
"MIT"
] | null | null | null | """
Provides functions for working with NTFS volumes
Author: Harel Segev
05/16/2020
"""
from construct import Struct, Padding, Computed, IfThenElse, BytesInteger, Const, Enum, Array, FlagsEnum, Switch, Tell
from construct import PaddedString, Pointer, Seek, Optional, StopIf, RepeatUntil, Padded
from construct import Int8ul, Int16ul, Int32ul, Int64ul, Int8sl
from dataruns import get_dataruns, NonResidentStream
from sys import exit as sys_exit
BOOT_SECTOR = Struct(
"OffsetInImage" / Tell,
Padding(3),
"Magic" / Optional(Const(b'NTFS')),
StopIf(lambda this: this.Magic is None),
Padding(4),
"BytsPerSec" / Int16ul,
"SecPerClus" / Int8ul,
"BytsPerClus" / Computed(lambda this: this.BytsPerSec * this.SecPerClus),
Padding(34),
"MftClusNumber" / Int64ul,
Padding(8),
"BytsOrClusPerRec" / Int8sl,
"BytsPerRec" / IfThenElse(
lambda this: this.BytsOrClusPerRec > 0,
Computed(lambda this: this.BytsOrClusPerRec * this.BytsPerClus),
Computed(lambda this: 2 ** abs(this.BytsOrClusPerRec)),
),
Padding(3),
"BytsOrClusPerIndx" / Int8sl,
"BytsPerIndx" / IfThenElse(
lambda this: this.BytsOrClusPerIndx > 0,
Computed(lambda this: this.BytsOrClusPerIndx * this.BytsPerClus),
Computed(lambda this: 2 ** abs(this.BytsOrClusPerIndx)),
),
"BytsPerMftChunk" / IfThenElse(
lambda this: this.BytsPerClus > this.BytsPerRec,
Computed(lambda this: this.BytsPerClus),
Computed(lambda this: this.BytsPerRec)
),
)
FILE_REFERENCE = Struct(
"FileRecordNumber" / BytesInteger(6, swapped=True, signed=False),
"SequenceNumber" / Int16ul
)
FILE_RECORD_HEADER = Struct(
"OffsetInChunk" / Tell,
"Magic" / Optional(Const(b'FILE')),
StopIf(lambda this: this.Magic is None),
"UpdateSequenceOffset" / Int16ul,
"UpdateSequenceSize" / Int16ul,
Padding(8),
"SequenceNumber" / Int16ul,
Padding(2),
"FirstAttributeOffset" / Int16ul,
"Flags" / FlagsEnum(Int16ul, IN_USE=1, DIRECTORY=2),
Padding(8),
"BaseRecordReference" / FILE_REFERENCE,
Seek(lambda this: this.UpdateSequenceOffset + this.OffsetInChunk),
"UpdateSequenceNumber" / Int16ul,
"UpdateSequenceArray" / Array(lambda this: this.UpdateSequenceSize - 1, Int16ul)
)
FILE_RECORD_HEADERS = Struct(
"RecordHeaders" / Array(
lambda this: this._.records_per_chunk,
Padded(lambda this: this._.bytes_per_record, FILE_RECORD_HEADER)
)
)
ATTRIBUTE_HEADER = Struct(
"EndOfRecordSignature" / Optional(Const(b'\xFF\xFF\xFF\xFF')),
StopIf(lambda this: this.EndOfRecordSignature is not None),
"OffsetInChunk" / Tell,
"Type" / Enum(Int32ul, FILE_NAME=0x30, INDEX_ALLOCATION=0xA0, DATA=0x80),
"Length" / Int32ul,
"Residence" / Enum(Int8ul, RESIDENT=0x00, NON_RESIDENT=0x01),
"NameLength" / Int8ul,
"NameOffset" / Int16ul,
"AttributeName" / Pointer(lambda this: this.NameOffset + this.OffsetInChunk,
PaddedString(lambda this: 2 * this.NameLength, "utf16")),
Padding(4),
"Metadata" / Switch(
lambda this: this.Residence,
{
"RESIDENT":
Struct(
"AttributeLength" / Int32ul,
"AttributeOffset" / Int16ul,
),
"NON_RESIDENT":
Struct(
Padding(16),
"DataRunsOffset" / Int16ul,
Padding(6),
"AllocatedSize" / Int64ul,
"RealSize" / Int64ul,
)
}
),
Seek(lambda this: this.Length + this.OffsetInChunk)
)
ATTRIBUTE_HEADERS = Struct(
Seek(lambda this: this._.offset),
"AttributeHeaders" / RepeatUntil(lambda obj, lst, ctx: obj.EndOfRecordSignature is not None, ATTRIBUTE_HEADER)
)
FILENAME_ATTRIBUTE = Struct(
"ParentDirectoryReference" / FILE_REFERENCE,
Padding(56),
"FilenameLengthInCharacters" / Int8ul,
"FilenameNamespace" / Enum(Int8ul, POSIX=0, WIN32=1, DOS=2, WIN32_DOS=3),
"FilenameInUnicode" / PaddedString(lambda this: this.FilenameLengthInCharacters * 2, "utf16")
)
| 33.75089 | 119 | 0.690953 |
4e09007daa6d9ebbc5192124ce8ef2f0a488eb4d | 7,130 | py | Python | day24_mzn.py | galleon/adventofcode2021 | 2bf626821d8e2b2278c0009ef4f008433c3c3788 | [
"MIT"
] | null | null | null | day24_mzn.py | galleon/adventofcode2021 | 2bf626821d8e2b2278c0009ef4f008433c3c3788 | [
"MIT"
] | null | null | null | day24_mzn.py | galleon/adventofcode2021 | 2bf626821d8e2b2278c0009ef4f008433c3c3788 | [
"MIT"
] | null | null | null | from ortools.linear_solver import pywraplp
from ortools.sat.python import cp_model
my_program = [
["inp", "w"],
["mul", "x", "0"],
["add", "x", "z"],
["mod", "x", "26"],
["div", "z", "1"],
["add", "x", "12"],
["eql", "x", "w"],
["eql", "x", "0"],
["mul", "y", "0"],
["add", "y", "25"],
["mul", "y", "x"],
["add", "y", "1"],
["mul", "z", "y"],
["mul", "y", "0"],
["add", "y", "w"],
["add", "y", "6"],
["mul", "y", "x"],
["add", "z", "y"],
["inp", "w"],
["mul", "x", "0"],
["add", "x", "z"],
["mod", "x", "26"],
["div", "z", "1"],
["add", "x", "10"],
["eql", "x", "w"],
["eql", "x", "0"],
["mul", "y", "0"],
["add", "y", "25"],
["mul", "y", "x"],
["add", "y", "1"],
["mul", "z", "y"],
["mul", "y", "0"],
["add", "y", "w"],
["add", "y", "6"],
["mul", "y", "x"],
["add", "z", "y"],
["inp", "w"],
["mul", "x", "0"],
["add", "x", "z"],
["mod", "x", "26"],
["div", "z", "1"],
["add", "x", "13"],
["eql", "x", "w"],
["eql", "x", "0"],
["mul", "y", "0"],
["add", "y", "25"],
["mul", "y", "x"],
["add", "y", "1"],
["mul", "z", "y"],
["mul", "y", "0"],
["add", "y", "w"],
["add", "y", "3"],
["mul", "y", "x"],
["add", "z", "y"],
["inp", "w"],
["mul", "x", "0"],
["add", "x", "z"],
["mod", "x", "26"],
["div", "z", "26"],
["add", "x", "-11"],
["eql", "x", "w"],
["eql", "x", "0"],
["mul", "y", "0"],
["add", "y", "25"],
["mul", "y", "x"],
["add", "y", "1"],
["mul", "z", "y"],
["mul", "y", "0"],
["add", "y", "w"],
["add", "y", "11"],
["mul", "y", "x"],
["add", "z", "y"],
["inp", "w"],
["mul", "x", "0"],
["add", "x", "z"],
["mod", "x", "26"],
["div", "z", "1"],
["add", "x", "13"],
["eql", "x", "w"],
["eql", "x", "0"],
["mul", "y", "0"],
["add", "y", "25"],
["mul", "y", "x"],
["add", "y", "1"],
["mul", "z", "y"],
["mul", "y", "0"],
["add", "y", "w"],
["add", "y", "9"],
["mul", "y", "x"],
["add", "z", "y"],
["inp", "w"],
["mul", "x", "0"],
["add", "x", "z"],
["mod", "x", "26"],
["div", "z", "26"],
["add", "x", "-1"],
["eql", "x", "w"],
["eql", "x", "0"],
["mul", "y", "0"],
["add", "y", "25"],
["mul", "y", "x"],
["add", "y", "1"],
["mul", "z", "y"],
["mul", "y", "0"],
["add", "y", "w"],
["add", "y", "3"],
["mul", "y", "x"],
["add", "z", "y"],
["inp", "w"],
["mul", "x", "0"],
["add", "x", "z"],
["mod", "x", "26"],
["div", "z", "1"],
["add", "x", "10"],
["eql", "x", "w"],
["eql", "x", "0"],
["mul", "y", "0"],
["add", "y", "25"],
["mul", "y", "x"],
["add", "y", "1"],
["mul", "z", "y"],
["mul", "y", "0"],
["add", "y", "w"],
["add", "y", "13"],
["mul", "y", "x"],
["add", "z", "y"],
["inp", "w"],
["mul", "x", "0"],
["add", "x", "z"],
["mod", "x", "26"],
["div", "z", "1"],
["add", "x", "11"],
["eql", "x", "w"],
["eql", "x", "0"],
["mul", "y", "0"],
["add", "y", "25"],
["mul", "y", "x"],
["add", "y", "1"],
["mul", "z", "y"],
["mul", "y", "0"],
["add", "y", "w"],
["add", "y", "6"],
["mul", "y", "x"],
["add", "z", "y"],
["inp", "w"],
["mul", "x", "0"],
["add", "x", "z"],
["mod", "x", "26"],
["div", "z", "26"],
["add", "x", "0"],
["eql", "x", "w"],
["eql", "x", "0"],
["mul", "y", "0"],
["add", "y", "25"],
["mul", "y", "x"],
["add", "y", "1"],
["mul", "z", "y"],
["mul", "y", "0"],
["add", "y", "w"],
["add", "y", "14"],
["mul", "y", "x"],
["add", "z", "y"],
["inp", "w"],
["mul", "x", "0"],
["add", "x", "z"],
["mod", "x", "26"],
["div", "z", "1"],
["add", "x", "10"],
["eql", "x", "w"],
["eql", "x", "0"],
["mul", "y", "0"],
["add", "y", "25"],
["mul", "y", "x"],
["add", "y", "1"],
["mul", "z", "y"],
["mul", "y", "0"],
["add", "y", "w"],
["add", "y", "10"],
["mul", "y", "x"],
["add", "z", "y"],
["inp", "w"],
["mul", "x", "0"],
["add", "x", "z"],
["mod", "x", "26"],
["div", "z", "26"],
["add", "x", "-5"],
["eql", "x", "w"],
["eql", "x", "0"],
["mul", "y", "0"],
["add", "y", "25"],
["mul", "y", "x"],
["add", "y", "1"],
["mul", "z", "y"],
["mul", "y", "0"],
["add", "y", "w"],
["add", "y", "12"],
["mul", "y", "x"],
["add", "z", "y"],
["inp", "w"],
["mul", "x", "0"],
["add", "x", "z"],
["mod", "x", "26"],
["div", "z", "26"],
["add", "x", "-16"],
["eql", "x", "w"],
["eql", "x", "0"],
["mul", "y", "0"],
["add", "y", "25"],
["mul", "y", "x"],
["add", "y", "1"],
["mul", "z", "y"],
["mul", "y", "0"],
["add", "y", "w"],
["add", "y", "10"],
["mul", "y", "x"],
["add", "z", "y"],
["inp", "w"],
["mul", "x", "0"],
["add", "x", "z"],
["mod", "x", "26"],
["div", "z", "26"],
["add", "x", "-7"],
["eql", "x", "w"],
["eql", "x", "0"],
["mul", "y", "0"],
["add", "y", "25"],
["mul", "y", "x"],
["add", "y", "1"],
["mul", "z", "y"],
["mul", "y", "0"],
["add", "y", "w"],
["add", "y", "11"],
["mul", "y", "x"],
["add", "z", "y"],
["inp", "w"],
["mul", "x", "0"],
["add", "x", "z"],
["mod", "x", "26"],
["div", "z", "26"],
["add", "x", "-11"],
["eql", "x", "w"],
["eql", "x", "0"],
["mul", "y", "0"],
["add", "y", "25"],
["mul", "y", "x"],
["add", "y", "1"],
["mul", "z", "y"],
["mul", "y", "0"],
["add", "y", "w"],
["add", "y", "15"],
["mul", "y", "x"],
["add", "z", "y"],
]
if __name__ == "__main__":
main()
| 23.453947 | 88 | 0.274474 |
4e0c94378cede26866700f316056f4a9b045008f | 486 | py | Python | writer.py | ZitRos/edu-text-analysis | a03f22f9c6e72e4cac4d38b9e963d1554cae35d0 | [
"MIT"
] | 9 | 2017-11-28T22:42:06.000Z | 2021-01-27T05:05:52.000Z | writer.py | ZitRos/edu-text-analysis | a03f22f9c6e72e4cac4d38b9e963d1554cae35d0 | [
"MIT"
] | null | null | null | writer.py | ZitRos/edu-text-analysis | a03f22f9c6e72e4cac4d38b9e963d1554cae35d0 | [
"MIT"
] | 1 | 2022-02-08T21:55:29.000Z | 2022-02-08T21:55:29.000Z | import xlsxwriter
from slugify import slugify
import os
| 24.3 | 58 | 0.746914 |
4e0ca604df69608c9b3245228eab46db3a285865 | 4,251 | py | Python | src/4. Ajuste de curvas/Metodos/MC_multilineal.py | thonyblaz/Numerical-Methods | fdeccb9e2eba4a1eb7892ab3a55bd6169c430502 | [
"MIT"
] | 1 | 2021-04-24T20:47:26.000Z | 2021-04-24T20:47:26.000Z | src/4. Ajuste de curvas/Metodos/MC_multilineal.py | Desarrollador2021/Numerical-Methods | fdeccb9e2eba4a1eb7892ab3a55bd6169c430502 | [
"MIT"
] | null | null | null | src/4. Ajuste de curvas/Metodos/MC_multilineal.py | Desarrollador2021/Numerical-Methods | fdeccb9e2eba4a1eb7892ab3a55bd6169c430502 | [
"MIT"
] | 1 | 2021-04-24T20:47:03.000Z | 2021-04-24T20:47:03.000Z |
import numpy as np
# datos de prueba
#set 1
""" agua = [27.5, 28, 28.8, 29.1, 30, 31, 32]
cal = [2, 3.5, 4.5, 2.5, 8.5, 10.5, 13.5]
puzo = [18, 16.5, 10.5, 2.5, 9, 4.5, 1.5]
dr = [5, 2, 3, 4, 1, 2, 3]
gh = [7, 2, 1, 1, 1, 6, 7]
puzos = [15, 15.5, 11.5, 5, 5, 3, 1]
variables_data = [cal, puzo]
variable = ['u', 'v']
variables_data = [cal, puzo, dr, gh, puzos]
variable = ['u', 'v', 'w', 'z', 's'] """
#set 2
""" u=[0.02,0.02,0.02,0.02,0.1,0.1,0.1,0.1,0.18,0.18,0.18,0.18]
v=[1000,1100,1200,1300,1000,1100,1200,1300,1000,1100,1200,1300]
fuv=[78.9,65.1,55.2,56.4,80.9,69.7,57.4,55.4,85.3,71.8,60.7,58.9]
variables_data = [u,v]
variable = ['u', 'v'] """
""" agua = [27.5, 28, 28.8, 29.1, 30, 31, 32]
cal = [2, 3.5, 4.5, 2.5, 8.5, 10.5, 13.5]
puzo = [18, 16.5, 10.5, 2.5, 9, 4.5, 1.5]
variables_data = [cal, puzo]
variable = ['u', 'v']
multilineal(agua, variables_data, variable) """
| 28.152318 | 71 | 0.584098 |
4e0d346534f0cd20c64f85f0fdb70567bfe1e8d7 | 354 | py | Python | Aulas/Aula1_print.py | alessonsousa/Python3 | 49600ff4368f999c0fb608c796e2d11942edf09f | [
"MIT"
] | null | null | null | Aulas/Aula1_print.py | alessonsousa/Python3 | 49600ff4368f999c0fb608c796e2d11942edf09f | [
"MIT"
] | null | null | null | Aulas/Aula1_print.py | alessonsousa/Python3 | 49600ff4368f999c0fb608c796e2d11942edf09f | [
"MIT"
] | null | null | null | #Para mostra qualquer coisa na tela, Voc usa o print()
print('Alesson', 'Sousa', sep='_')# O funo sep='-' fala para o print o que colocar para separa os nome
print('Alesson', 'Sousa', sep='_', end='\n')#esse end='' para fala o que vc quer no final da linha do print
#Exemplo
#123.456.789-00
print('123','456','789', sep='.', end='-')
print('00') | 32.181818 | 109 | 0.652542 |
4e0e4eb43146dfe5157fdb0bd9781b0b55961a7f | 232 | py | Python | Day04/file_Closures.py | DongHenry/Py71 | 6e06cc4cda62daecba34ffbea4a8f03590a9098f | [
"MIT"
] | null | null | null | Day04/file_Closures.py | DongHenry/Py71 | 6e06cc4cda62daecba34ffbea4a8f03590a9098f | [
"MIT"
] | null | null | null | Day04/file_Closures.py | DongHenry/Py71 | 6e06cc4cda62daecba34ffbea4a8f03590a9098f | [
"MIT"
] | null | null | null | #
# add
# add()
num1 = func()
num2 = sum(2)
print(num2(5))
print(type(num1))
print(type(num2))
| 10.545455 | 20 | 0.534483 |
4e0f55cd3aa79697bce0973576f40551777dd8c0 | 728 | py | Python | liquid/python/tags/inherited.py | pemontto/liquidpy | bf84d631a2ecab0c020ba883bf2a09042715f772 | [
"Apache-2.0"
] | null | null | null | liquid/python/tags/inherited.py | pemontto/liquidpy | bf84d631a2ecab0c020ba883bf2a09042715f772 | [
"Apache-2.0"
] | null | null | null | liquid/python/tags/inherited.py | pemontto/liquidpy | bf84d631a2ecab0c020ba883bf2a09042715f772 | [
"Apache-2.0"
] | null | null | null | """About tags inherited from standard mode
Attributes
BASE_GRAMMAR: The base grammar for python mode
tag_manager: The tag manager for python mode
"""
from pathlib import Path
from ...tags.manager import TagManager as TagManagerStandard
from ...tags.grammar import Grammar
from ...tags.tag import Tag as TagStandard
BASE_GRAMMAR = Grammar(Path(__file__).parent / 'grammar.lark') # type: Grammar
# pylint: disable=invalid-name
tag_manager = TagManager() # type: TagManager
| 29.12 | 78 | 0.741758 |
4e0fdb2ce2d3bb69607900f9e65b83e79e178cdd | 201 | py | Python | data_loader/__init__.py | kunato/style_swap_tensorflow | ab136c20fa5351852f1f4c986bed5b25eee3b890 | [
"Apache-2.0"
] | null | null | null | data_loader/__init__.py | kunato/style_swap_tensorflow | ab136c20fa5351852f1f4c986bed5b25eee3b890 | [
"Apache-2.0"
] | null | null | null | data_loader/__init__.py | kunato/style_swap_tensorflow | ab136c20fa5351852f1f4c986bed5b25eee3b890 | [
"Apache-2.0"
] | null | null | null | # data_loader
# __init__.py
from data_loader.image_data_loader import ImageDataLoader
from data_loader.coco_data_loader import COCODataLoader
from data_loader.tf_example_loader import TFExampleLoader
| 28.714286 | 57 | 0.885572 |
4e10795466a7d1953a59fef51a1851c39d5083a4 | 2,131 | py | Python | cms_articles/migrations/0008_cms_3_4.py | snegovick/django-cms-articles | f7397bd5e303be6ed50bc53b71e27e40f4087f94 | [
"BSD-3-Clause"
] | 9 | 2016-04-18T15:59:50.000Z | 2019-09-12T07:11:15.000Z | cms_articles/migrations/0008_cms_3_4.py | snegovick/django-cms-articles | f7397bd5e303be6ed50bc53b71e27e40f4087f94 | [
"BSD-3-Clause"
] | 6 | 2019-01-22T17:53:48.000Z | 2020-07-19T17:35:31.000Z | cms_articles/migrations/0008_cms_3_4.py | snegovick/django-cms-articles | f7397bd5e303be6ed50bc53b71e27e40f4087f94 | [
"BSD-3-Clause"
] | 4 | 2017-02-10T17:19:30.000Z | 2020-02-02T16:58:20.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2017-02-25 11:38
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
| 46.326087 | 236 | 0.670108 |
4e1250b3a0035feb90528471a9285da3a2f81ada | 1,561 | py | Python | tests/test_torchvision.py | osai-ai/dockai | 61cf10567cced9b8a5af2855ec880e8730532916 | [
"MIT"
] | null | null | null | tests/test_torchvision.py | osai-ai/dockai | 61cf10567cced9b8a5af2855ec880e8730532916 | [
"MIT"
] | null | null | null | tests/test_torchvision.py | osai-ai/dockai | 61cf10567cced9b8a5af2855ec880e8730532916 | [
"MIT"
] | null | null | null | from time import sleep
import pytest
import torch
from torchvision.ops import roi_align
| 31.857143 | 95 | 0.647662 |
4e14a820dce8b0c05972db39e72bc127d5d06743 | 3,550 | py | Python | vcf_reader.py | ZhiGroup/ROH-DICE | 5a2edfd04e285fe1f40bb199117c03a33b176984 | [
"MIT"
] | 1 | 2021-09-01T15:46:26.000Z | 2021-09-01T15:46:26.000Z | vcf_reader.py | ZhiGroup/ROH-DICE | 5a2edfd04e285fe1f40bb199117c03a33b176984 | [
"MIT"
] | 1 | 2021-05-21T13:13:55.000Z | 2021-05-25T17:56:06.000Z | vcf_reader.py | ZhiGroup/ROH-DICE | 5a2edfd04e285fe1f40bb199117c03a33b176984 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# =============================================================================
# Created By : Ardalan Naseri
# Created Date: Mon September 21 2020
# =============================================================================
"""The module is a VCF reader to parse input VCF file."""
import gzip
import random
| 31.415929 | 117 | 0.468169 |
4e15463f1bd86c58fab84d9a5933a630bf1642d9 | 899 | py | Python | linux/.config/qtile/lib/layouts.py | joserc87/config-files | ca90f1591d249ac39abb946d169654a7c3346833 | [
"MIT"
] | null | null | null | linux/.config/qtile/lib/layouts.py | joserc87/config-files | ca90f1591d249ac39abb946d169654a7c3346833 | [
"MIT"
] | null | null | null | linux/.config/qtile/lib/layouts.py | joserc87/config-files | ca90f1591d249ac39abb946d169654a7c3346833 | [
"MIT"
] | null | null | null | """
Layout definitions
"""
from libqtile import layout
from .settings import COLS
from libqtile.config import Match
_layout_common_settings = dict(
border_focus=COLS['purple_4'],
border_normal=COLS['dark_1'],
single_border_width=0,
)
_max_layout_settings = {
**_layout_common_settings,
"border_focus": None
}
# Layouts
floating_layout = layout.Floating(float_rules=[
Match(wm_class='float'),
Match(wm_class='floating'),
Match(wm_class="zoom"),
])
layouts = [
layout.MonadTall(name='GapsBig', **_layout_common_settings, margin=192),
layout.MonadTall(name='GapsSmall', **_layout_common_settings, margin=48),
# layout.Floating(**_layout_common_settings),
# layout.VerticalTile(name='VerticalTile'),
layout.Max(name='Full', **_layout_common_settings),
# layout.Zoomy(**_layout_common_settings),
# layout.Slice(**_layout_common_settings),
]
| 26.441176 | 77 | 0.724138 |
4e15597d3a91189d8d9a4e8575fb172c9d0972ad | 2,865 | py | Python | neighbor/tests.py | Elianehbmna/Neighborhood | 3e684fe813904f10fca7f3ea8c71adb1f2bc6a3d | [
"MIT"
] | null | null | null | neighbor/tests.py | Elianehbmna/Neighborhood | 3e684fe813904f10fca7f3ea8c71adb1f2bc6a3d | [
"MIT"
] | 5 | 2020-02-12T03:17:58.000Z | 2021-09-08T01:23:33.000Z | neighbor/tests.py | Elianehbmna/Neighbourhood | 3e684fe813904f10fca7f3ea8c71adb1f2bc6a3d | [
"MIT"
] | null | null | null | from django.test import TestCase
from django.contrib.auth.models import User
from .models import Profile, Neighbourhood, Post, Business
# Create your tests here.
| 26.045455 | 89 | 0.622339 |
4e15cecc08b1cde9ac107937e12fe6ec9240cb6d | 190 | py | Python | api/suids/urls.py | CenterForOpenScience/SHARE | c7715af2881f6fa23197d4e7c381d90169a90ed1 | [
"Apache-2.0"
] | 87 | 2015-01-06T18:24:45.000Z | 2021-08-08T07:59:40.000Z | api/suids/urls.py | fortress-biotech/SHARE | 9c5a05dd831447949fa6253afec5225ff8ab5d4f | [
"Apache-2.0"
] | 442 | 2015-01-01T19:16:01.000Z | 2022-03-30T21:10:26.000Z | api/suids/urls.py | fortress-biotech/SHARE | 9c5a05dd831447949fa6253afec5225ff8ab5d4f | [
"Apache-2.0"
] | 67 | 2015-03-10T16:32:58.000Z | 2021-11-12T16:33:41.000Z | from rest_framework.routers import SimpleRouter
from api.suids import views
router = SimpleRouter()
router.register(r'suids', views.SuidViewSet, basename='suid')
urlpatterns = router.urls
| 23.75 | 61 | 0.805263 |
4e1a4e1f3d76e5fdbb618878f0f9c68ef36c94ef | 13,944 | py | Python | src/flintfiller/dataframe_to_frame_parser.py | discipl/flintfiller | 15d220c980a962ac2c4b7ac232f091666ab24e66 | [
"Apache-2.0"
] | null | null | null | src/flintfiller/dataframe_to_frame_parser.py | discipl/flintfiller | 15d220c980a962ac2c4b7ac232f091666ab24e66 | [
"Apache-2.0"
] | null | null | null | src/flintfiller/dataframe_to_frame_parser.py | discipl/flintfiller | 15d220c980a962ac2c4b7ac232f091666ab24e66 | [
"Apache-2.0"
] | null | null | null | """
Copyright (C) 2020 Nederlandse Organisatie voor Toegepast Natuur-
wetenschappelijk Onderzoek TNO / TNO, Netherlands Organisation for
applied scientific research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@author: Maaike de Boer, Roos Bakker
@contact: maaike.deboer@tno.nl, roos.bakker@tno.nl
"""
import ast
# This script transforms POStagged text to a FLINT frame.
import json
from typing import Tuple
import pandas as pd
action_verbs = ['aanbrengen', 'aanwijzen', 'achterwege blijven', 'afnemen', 'afwijken', 'afwijzen',
'ambtshalve verlenen', 'ambtshalve verlengen', 'annuleren', 'behandelen', 'beheren', 'bepalen',
'beperken', 'betreden', 'beveiligen', 'bevelen', 'bevorderen', 'bieden gelegenheid', 'bijhouden',
'buiten behandeling stellen', 'buiten werking stellen', 'doorzoeken', 'erop wijzen',
'gebruiken maken van', 'gedwongen ontruimen', 'geven', 'heffen', 'in bewaring stellen',
'in de gelegenheid stellen zich te doen horen', 'in kennis stellen', 'in werking doen treden',
'in werking stellen', 'indienen', 'innemen', 'instellen', 'intrekken', 'invorderen', 'inwilligen',
'maken', 'naar voren brengen', 'nemen', 'niet in behandeling nemen', 'niet-ontvankelijk verklaren',
'nogmaals verlengen', 'om niet vervoeren', 'onderwerpen', 'onderzoeken', 'ongewenstverklaren',
'onmiddellijk bepalen', 'onmiddellijk verlaten', 'ontnemen', 'ontvangen', 'opheffen', 'opleggen',
'oproepen', 'overbrengen', 'overdragen', 'plaatsen', 'schorsen', 'schriftelijk in kennis stellen',
'schriftelijk laten weten', 'schriftelijk mededelen', 'schriftelijk naar voren brengen', 'signaleren',
'sluiten', 'staande houden', 'stellen', 'straffen', 'ter hand stellen', 'teruggeven',
'tijdelijk in bewaring nemen', 'toetsen', 'toezenden', 'uitstellen', 'uitvaardigen', 'uitzetten',
'van rechtswege verkrijgen', 'vaststellen', 'vergelijken', 'verhalen', 'verhogen', 'verklaren',
'verkorten', 'verkrijgen', 'verlaten', 'verlenen', 'verlengen', 'verplichten', 'verschaffen',
'verstrekken', 'verzoeken', 'voegen', 'vorderen', 'vragen', 'willigen', 'weigeren', 'wijzigen']
set_propernouns = ["PRP", "PRP$", "NNP", "NNPS"]
list_act = []
list_fact = []
global facts_list
# This is a first version!
# if __name__ == '__main__':
# method = "TOGS"
# base = 'C:\\Users\\boermhtd\\PycharmProjects\\calculemus\\nlp\\data\\csv_files\\postagged\\'
# if method == "TOGS":
# csv_file = base + 'BWBR0043324_2020-03-31_0_TOGS_postagged.csv'
# elif method == "TOZO":
# csv_file = base + 'BWBR0043402_2020-04-22_0_TOZO_postagged.csv'
# elif method == "AWB":
# csv_file = base + 'BWBR0005537_2020-04-15_0_AWB_postagged.csv'
#
# #'BWBR0011823_2019-02-27_Vreemdelingenwet_postagged.csv'
#
# output_file = method + '_new.json'
# dataframe_to_frame_parser(csv_file, output_file)
#
# act_file = "acts_" + method + ".csv"
# df_act = pd.DataFrame(list_act, columns = ['action', 'sentence'])
# df_act.to_csv(act_file, index=False)
#
# fact_file = "facts_" + method + ".csv"
# df_fact = pd.DataFrame(list_fact, columns = ['fact', 'definition'])
# df_fact.to_csv(fact_file, index=False)
# # df = read_csv_to_df(str(csv_file))
# flint_frames = create_flint_frames(df)
# write_flint_frames_to_json(flint_frames)
| 41.748503 | 118 | 0.590863 |
4e1a546f6ea25dfb6456e34048120a18e209eaa0 | 208 | py | Python | celery_task/__init__.py | yougaUsth/simple-celery | 08ecf86933507dee79429f6e906c7d2eb799856c | [
"MIT"
] | null | null | null | celery_task/__init__.py | yougaUsth/simple-celery | 08ecf86933507dee79429f6e906c7d2eb799856c | [
"MIT"
] | null | null | null | celery_task/__init__.py | yougaUsth/simple-celery | 08ecf86933507dee79429f6e906c7d2eb799856c | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from celery import Celery, platforms
app = Celery("task")
app.config_from_object('celery_task.celery_config')
platforms.C_FORCE_ROOT = True
| 18.909091 | 51 | 0.769231 |
4e1b7e1efb40a138e872299167e3dc139051bf3e | 4,677 | py | Python | tools/webcam/webcam_apis/nodes/mmdet_node.py | pallgeuer/mmpose | d3c17d5e6bdb9dbaca19f3bf53aa2802105355fd | [
"Apache-2.0"
] | null | null | null | tools/webcam/webcam_apis/nodes/mmdet_node.py | pallgeuer/mmpose | d3c17d5e6bdb9dbaca19f3bf53aa2802105355fd | [
"Apache-2.0"
] | null | null | null | tools/webcam/webcam_apis/nodes/mmdet_node.py | pallgeuer/mmpose | d3c17d5e6bdb9dbaca19f3bf53aa2802105355fd | [
"Apache-2.0"
] | null | null | null | # Copyright (c) OpenMMLab. All rights reserved.
from typing import List, Optional, Union
import numpy as np
from .builder import NODES
from .node import MultiInputNode, Node
try:
from mmdet.apis import inference_detector, init_detector
has_mmdet = True
except (ImportError, ModuleNotFoundError):
has_mmdet = False
| 32.034247 | 79 | 0.584135 |
4e1ef7bc29a97c874523d2f21ef24ab69fc641da | 708 | py | Python | cursos_complementarios/estructuras_datos_lineales_python/modulo_II_arrays/utils/cube.py | EdinsonRequena/articicial-inteligence-and-data-science | 953566220e64cbd8f732c2667b818da807bb54c0 | [
"MIT"
] | 30 | 2020-06-19T16:21:04.000Z | 2022-02-19T01:48:39.000Z | cursos_complementarios/estructuras_datos_lineales_python/modulo_II_arrays/utils/cube.py | Samsuesca/articicial-inteligence-and-data-science | 953566220e64cbd8f732c2667b818da807bb54c0 | [
"MIT"
] | 87 | 2021-02-12T04:42:13.000Z | 2021-09-20T04:25:29.000Z | cursos_complementarios/estructuras_datos_lineales_python/modulo_II_arrays/utils/cube.py | Samsuesca/articicial-inteligence-and-data-science | 953566220e64cbd8f732c2667b818da807bb54c0 | [
"MIT"
] | 11 | 2020-08-13T04:04:01.000Z | 2022-01-20T20:10:43.000Z |
from .array import Array
from .grid import Grid
| 27.230769 | 77 | 0.574859 |
4e210c17ece556dcd920b2bb641d6a18a1587dc6 | 8,015 | py | Python | testing/plugin_instance_tests.py | nanome-ai/nanome-plugin-api | f2ce6a5e3123ee7449a90c2659f3891124289f4a | [
"MIT"
] | 1 | 2020-04-10T09:47:54.000Z | 2020-04-10T09:47:54.000Z | testing/plugin_instance_tests.py | nanome-ai/nanome-plugin-api | f2ce6a5e3123ee7449a90c2659f3891124289f4a | [
"MIT"
] | 10 | 2019-05-30T18:29:10.000Z | 2020-02-15T02:16:42.000Z | testing/plugin_instance_tests.py | nanome-ai/nanome-plugin-api | f2ce6a5e3123ee7449a90c2659f3891124289f4a | [
"MIT"
] | 2 | 2020-02-04T02:56:21.000Z | 2020-04-25T20:05:16.000Z | import os
import sys
import unittest
import uuid
from nanome import PluginInstance
from nanome.api.plugin_instance import _DefaultPlugin
from nanome.api import structure, ui
from nanome.util import enums, Vector3, Quaternion, config
if sys.version_info.major >= 3:
from unittest.mock import MagicMock
else:
# Python 2.7 way of getting magicmock. Requires pip install mock
from mock import MagicMock
| 35.464602 | 92 | 0.684841 |
4e21313453a76bb801fcf7c786e4c9fa435345a5 | 3,175 | py | Python | tests/test_bandits.py | tmcclintock/MultiArmedBandits | bb3214a5687c750ef86f02d6f6e84a4b73d58dcf | [
"MIT"
] | null | null | null | tests/test_bandits.py | tmcclintock/MultiArmedBandits | bb3214a5687c750ef86f02d6f6e84a4b73d58dcf | [
"MIT"
] | 1 | 2020-07-27T00:51:41.000Z | 2020-07-27T00:51:41.000Z | tests/test_bandits.py | tmcclintock/MultiArmedBandits | bb3214a5687c750ef86f02d6f6e84a4b73d58dcf | [
"MIT"
] | null | null | null | """
Tests of bandits.
"""
import numpy as np
import pytest
from unittest import TestCase
from bandit.bandit import (
CustomBandit,
EpsGreedyBandit,
GreedyBandit,
RandomBandit,
)
from bandit.environment import Environment
from bandit.reward import GaussianReward
| 29.12844 | 68 | 0.605669 |
4e23be7cefc4b12688cd6b844ea628c44fb0147c | 265 | py | Python | src/parsimony/__init__.py | ryanfeather/parsimony | 0d3bbe247b47234a0c15962e538b2f04609c4a33 | [
"MIT"
] | 1 | 2018-07-02T11:08:29.000Z | 2018-07-02T11:08:29.000Z | src/parsimony/__init__.py | ryanfeather/parsimony | 0d3bbe247b47234a0c15962e538b2f04609c4a33 | [
"MIT"
] | 5 | 2015-03-19T13:29:29.000Z | 2015-04-04T19:47:01.000Z | src/parsimony/__init__.py | ryanfeather/parsimony | 0d3bbe247b47234a0c15962e538b2f04609c4a33 | [
"MIT"
] | null | null | null | from .release import __version__
from .generate import generate, mark_dirty, dirty, clean
from .exceptions import ParsimonyException
from . import generators
from . import configuration
from . import persistence
from .defaults import set_defaults
set_defaults() | 22.083333 | 56 | 0.822642 |
4e269250407fa19774fcf1e0e1854392032b9961 | 569 | py | Python | pyrecard/subscription/plan.py | DiegoMagg/pyrecard | 4a7adc0342703b4eae6c42eabd2f7cd5e1a4d10f | [
"MIT"
] | 6 | 2020-09-03T12:56:49.000Z | 2020-09-03T13:28:31.000Z | pyrecard/subscription/plan.py | DiegoMagg/pyrecard | 4a7adc0342703b4eae6c42eabd2f7cd5e1a4d10f | [
"MIT"
] | 4 | 2020-08-25T15:28:54.000Z | 2020-08-31T17:08:13.000Z | pyrecard/subscription/plan.py | DiegoMagg/pyrecard | 4a7adc0342703b4eae6c42eabd2f7cd5e1a4d10f | [
"MIT"
] | null | null | null | from pyrecard.utils.pyrequest import pyrequest
PLAN_PATH = '/assinaturas/v1/plans'
| 19.62069 | 66 | 0.706503 |
4e26c8f3d5348e863a10d16b62007dbfcaa204c5 | 1,126 | py | Python | setup.py | TimSusa/aptly-api-cli | 011ba8e7f464726b336b53f6b2cbdc4490b5180c | [
"MIT"
] | 17 | 2016-03-15T10:07:27.000Z | 2022-03-07T17:55:01.000Z | setup.py | TimSusa/aptly-api-cli | 011ba8e7f464726b336b53f6b2cbdc4490b5180c | [
"MIT"
] | 2 | 2016-03-15T12:50:58.000Z | 2018-04-17T03:45:17.000Z | setup.py | TimSusa/aptly-api-cli | 011ba8e7f464726b336b53f6b2cbdc4490b5180c | [
"MIT"
] | 5 | 2017-05-07T20:01:49.000Z | 2018-06-06T13:43:02.000Z | try:
from setuptools import setup, find_packages
from pkg_resources import Requirement, resource_filename
except ImportError:
from distutils.core import setup, find_packages
setup(
name='Aptly-Api-Cli',
version='0.1',
url='https://github.com/TimSusa/aptly_api_cli',
license='MIT',
keywords="aptly aptly-server debian",
author='Tim Susa',
author_email='timsusa@gmx.de',
description='This cli executes remote calls to the Aptly server, without blocking the Aptly database.',
long_description=__doc__,
packages=find_packages(),
package_dir={'aptly_cli': 'aptly_cli'},
# packages=['aptly_cli', 'aptly_cli.api', 'aptly_cli.cli', 'aptly_cli.util'],
# py_modules=['aptly_cli.api.api', 'cli'],
entry_points={
'console_scripts': [
'aptly-cli=aptly_cli.cli.cli:main'
]
},
# data_files=[
# ('configs', ['configs/aptly-cli.conf']),
# ],
# package_data={'configs': ['aptly_cli/configs/aptly-cli.conf']},
platforms='any'
)
filename = resource_filename(Requirement.parse("Aptly-Api-Cli"), "configs/aptly-cli.conf")
| 33.117647 | 107 | 0.667851 |
4e27d12ca0167eeef14eeab8dc9bfe483d5dc2db | 417 | py | Python | 2018-04/2018-04-11.py | shangpf1/python_study | 6730519ce7b5cf4612e1c778ae5876cfbb748a4f | [
"MIT"
] | null | null | null | 2018-04/2018-04-11.py | shangpf1/python_study | 6730519ce7b5cf4612e1c778ae5876cfbb748a4f | [
"MIT"
] | null | null | null | 2018-04/2018-04-11.py | shangpf1/python_study | 6730519ce7b5cf4612e1c778ae5876cfbb748a4f | [
"MIT"
] | null | null | null |
emp_1 = Employee('hello','world',1900)
emp_2 = Employee('test','world',2000)
print(emp_1)
print(emp_2)
print(emp_1.fullname())
print(emp_2.fullname())
| 18.130435 | 52 | 0.606715 |
4e28e3321377547a62600b472fa76b37318df52d | 37,697 | py | Python | instances/passenger_demand/pas-20210421-2109-int1/68.py | LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure | bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11 | [
"BSD-3-Clause"
] | null | null | null | instances/passenger_demand/pas-20210421-2109-int1/68.py | LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure | bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11 | [
"BSD-3-Clause"
] | null | null | null | instances/passenger_demand/pas-20210421-2109-int1/68.py | LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure | bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11 | [
"BSD-3-Clause"
] | null | null | null |
"""
PASSENGERS
"""
numPassengers = 2290
passenger_arriving = (
(0, 5, 9, 3, 0, 0, 3, 7, 5, 2, 1, 0), # 0
(2, 4, 10, 6, 0, 0, 2, 3, 4, 2, 4, 0), # 1
(4, 9, 7, 4, 2, 0, 4, 5, 7, 4, 6, 0), # 2
(9, 9, 6, 4, 1, 0, 9, 8, 2, 5, 3, 0), # 3
(4, 6, 4, 8, 2, 0, 5, 6, 7, 3, 3, 0), # 4
(4, 3, 5, 3, 1, 0, 5, 8, 2, 2, 0, 0), # 5
(2, 2, 4, 5, 2, 0, 1, 1, 7, 1, 1, 0), # 6
(2, 3, 3, 5, 1, 0, 3, 2, 4, 2, 2, 0), # 7
(2, 7, 5, 5, 0, 0, 6, 3, 4, 8, 1, 0), # 8
(1, 9, 7, 4, 2, 0, 8, 7, 4, 8, 2, 0), # 9
(3, 5, 7, 3, 0, 0, 4, 10, 4, 3, 3, 0), # 10
(1, 4, 6, 2, 1, 0, 2, 3, 6, 8, 0, 0), # 11
(5, 2, 1, 2, 0, 0, 4, 9, 6, 2, 1, 0), # 12
(5, 1, 5, 3, 1, 0, 2, 4, 3, 7, 1, 0), # 13
(3, 6, 6, 2, 1, 0, 5, 4, 0, 4, 0, 0), # 14
(4, 2, 7, 2, 1, 0, 7, 10, 7, 4, 2, 0), # 15
(4, 6, 5, 5, 1, 0, 1, 14, 4, 1, 1, 0), # 16
(3, 5, 4, 2, 3, 0, 3, 5, 2, 6, 1, 0), # 17
(4, 4, 8, 2, 2, 0, 3, 5, 6, 3, 0, 0), # 18
(2, 7, 7, 2, 0, 0, 7, 2, 6, 1, 3, 0), # 19
(3, 7, 7, 2, 0, 0, 8, 9, 3, 1, 2, 0), # 20
(2, 8, 6, 2, 1, 0, 5, 5, 4, 3, 0, 0), # 21
(4, 6, 4, 1, 3, 0, 7, 4, 4, 5, 1, 0), # 22
(1, 5, 4, 3, 1, 0, 1, 5, 3, 5, 3, 0), # 23
(2, 9, 4, 1, 0, 0, 6, 6, 4, 7, 2, 0), # 24
(4, 8, 7, 2, 2, 0, 3, 6, 4, 1, 4, 0), # 25
(4, 6, 5, 2, 4, 0, 2, 0, 2, 4, 0, 0), # 26
(3, 4, 6, 4, 2, 0, 5, 10, 2, 3, 3, 0), # 27
(3, 12, 6, 3, 1, 0, 4, 12, 4, 2, 3, 0), # 28
(7, 8, 3, 3, 1, 0, 3, 3, 3, 4, 2, 0), # 29
(1, 12, 5, 0, 4, 0, 1, 4, 4, 5, 0, 0), # 30
(5, 8, 8, 3, 5, 0, 4, 7, 0, 4, 3, 0), # 31
(1, 14, 4, 4, 0, 0, 7, 7, 2, 3, 1, 0), # 32
(3, 7, 4, 2, 1, 0, 2, 5, 3, 2, 2, 0), # 33
(1, 7, 3, 3, 1, 0, 4, 11, 3, 5, 0, 0), # 34
(2, 5, 5, 4, 0, 0, 7, 6, 4, 5, 0, 0), # 35
(4, 7, 7, 3, 2, 0, 5, 7, 5, 1, 0, 0), # 36
(2, 6, 9, 8, 0, 0, 3, 9, 8, 0, 1, 0), # 37
(3, 4, 6, 2, 4, 0, 4, 5, 2, 0, 1, 0), # 38
(2, 6, 6, 1, 1, 0, 5, 7, 3, 8, 1, 0), # 39
(3, 8, 8, 3, 0, 0, 4, 3, 4, 9, 2, 0), # 40
(2, 3, 2, 2, 1, 0, 4, 9, 3, 6, 3, 0), # 41
(1, 8, 10, 0, 0, 0, 5, 12, 4, 4, 4, 0), # 42
(4, 11, 3, 2, 2, 0, 6, 5, 5, 4, 3, 0), # 43
(2, 7, 12, 2, 1, 0, 1, 4, 4, 1, 1, 0), # 44
(0, 9, 5, 1, 4, 0, 10, 4, 4, 6, 0, 0), # 45
(5, 4, 4, 0, 1, 0, 2, 4, 5, 3, 2, 0), # 46
(2, 5, 4, 0, 0, 0, 5, 9, 5, 5, 0, 0), # 47
(1, 10, 3, 4, 1, 0, 3, 3, 4, 4, 1, 0), # 48
(4, 6, 3, 4, 2, 0, 3, 6, 5, 2, 1, 0), # 49
(3, 6, 4, 5, 0, 0, 5, 9, 7, 3, 1, 0), # 50
(3, 6, 7, 2, 1, 0, 4, 5, 1, 3, 8, 0), # 51
(3, 11, 2, 4, 2, 0, 5, 7, 4, 7, 0, 0), # 52
(3, 8, 7, 3, 2, 0, 6, 9, 4, 3, 2, 0), # 53
(2, 7, 9, 1, 3, 0, 7, 6, 5, 2, 2, 0), # 54
(5, 10, 5, 2, 2, 0, 4, 5, 4, 4, 2, 0), # 55
(2, 6, 6, 1, 5, 0, 3, 3, 2, 3, 2, 0), # 56
(3, 3, 2, 3, 0, 0, 5, 6, 4, 8, 0, 0), # 57
(2, 7, 5, 2, 2, 0, 0, 1, 2, 3, 0, 0), # 58
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # 59
)
station_arriving_intensity = (
(2.649651558384548, 6.796460700757575, 7.9942360218509, 6.336277173913043, 7.143028846153846, 4.75679347826087), # 0
(2.6745220100478, 6.872041598712823, 8.037415537524994, 6.371564387077295, 7.196566506410256, 4.7551721391908215), # 1
(2.699108477221734, 6.946501402918069, 8.07957012282205, 6.406074879227053, 7.248974358974359, 4.753501207729468), # 2
(2.72339008999122, 7.019759765625, 8.120668982969152, 6.4397792119565205, 7.300204326923078, 4.7517809103260875), # 3
(2.747345978441128, 7.091736339085298, 8.160681323193373, 6.472647946859904, 7.350208333333334, 4.750011473429951), # 4
(2.7709552726563262, 7.162350775550646, 8.199576348721793, 6.504651645531401, 7.39893830128205, 4.748193123490338), # 5
(2.794197102721686, 7.231522727272727, 8.237323264781493, 6.535760869565218, 7.446346153846154, 4.746326086956522), # 6
(2.817050598722076, 7.299171846503226, 8.273891276599542, 6.565946180555556, 7.492383814102565, 4.744410590277778), # 7
(2.8394948907423667, 7.365217785493826, 8.309249589403029, 6.595178140096618, 7.537003205128205, 4.7424468599033816), # 8
(2.8615091088674274, 7.429580196496212, 8.343367408419024, 6.623427309782609, 7.580156249999999, 4.740435122282609), # 9
(2.8830723831821286, 7.492178731762065, 8.376213938874606, 6.65066425120773, 7.621794871794872, 4.738375603864734), # 10
(2.9041638437713395, 7.55293304354307, 8.407758385996857, 6.676859525966184, 7.661870993589743, 4.736268531099034), # 11
(2.92476262071993, 7.611762784090908, 8.437969955012854, 6.7019836956521734, 7.700336538461538, 4.734114130434782), # 12
(2.944847844112769, 7.668587605657268, 8.46681785114967, 6.726007321859903, 7.737143429487181, 4.731912628321256), # 13
(2.9643986440347283, 7.723327160493828, 8.494271279634388, 6.748900966183574, 7.772243589743589, 4.729664251207729), # 14
(2.9833941505706756, 7.775901100852272, 8.520299445694086, 6.770635190217391, 7.8055889423076925, 4.7273692255434785), # 15
(3.001813493805482, 7.826229078984287, 8.544871554555842, 6.791180555555555, 7.8371314102564105, 4.725027777777778), # 16
(3.019635803824017, 7.874230747141554, 8.567956811446729, 6.810507623792271, 7.866822916666667, 4.722640134359904), # 17
(3.03684021071115, 7.919825757575757, 8.589524421593831, 6.82858695652174, 7.894615384615387, 4.72020652173913), # 18
(3.053405844551751, 7.962933762538579, 8.609543590224222, 6.845389115338164, 7.9204607371794875, 4.717727166364734), # 19
(3.0693118354306894, 8.003474414281705, 8.62798352256498, 6.860884661835749, 7.944310897435898, 4.71520229468599), # 20
(3.084537313432836, 8.041367365056816, 8.644813423843189, 6.875044157608696, 7.9661177884615375, 4.712632133152174), # 21
(3.099061408643059, 8.076532267115601, 8.660002499285918, 6.887838164251208, 7.985833333333332, 4.710016908212561), # 22
(3.1128632511462295, 8.108888772709737, 8.673519954120252, 6.899237243357488, 8.003409455128205, 4.707356846316426), # 23
(3.125921971027217, 8.138356534090908, 8.685334993573264, 6.909211956521739, 8.018798076923076, 4.704652173913043), # 24
(3.1382166983708903, 8.164855203510802, 8.695416822872037, 6.917732865338165, 8.03195112179487, 4.701903117451691), # 25
(3.1497265632621207, 8.188304433221099, 8.703734647243644, 6.9247705314009655, 8.042820512820512, 4.699109903381642), # 26
(3.160430695785777, 8.208623875473483, 8.710257671915166, 6.930295516304349, 8.051358173076924, 4.696272758152174), # 27
(3.1703082260267292, 8.22573318251964, 8.714955102113683, 6.934278381642512, 8.057516025641025, 4.69339190821256), # 28
(3.1793382840698468, 8.239552006611252, 8.717796143066266, 6.936689689009662, 8.061245993589743, 4.690467580012077), # 29
(3.1875, 8.25, 8.71875, 6.9375, 8.0625, 4.6875), # 30
(3.1951370284526854, 8.258678799715907, 8.718034948671496, 6.937353656045752, 8.062043661347518, 4.683376259786773), # 31
(3.202609175191816, 8.267242897727273, 8.715910024154589, 6.93691748366013, 8.06068439716312, 4.677024758454107), # 32
(3.2099197969948845, 8.275691228693182, 8.712405570652175, 6.936195772058824, 8.058436835106383, 4.66850768365817), # 33
(3.217072250639386, 8.284022727272728, 8.70755193236715, 6.935192810457517, 8.05531560283688, 4.657887223055139), # 34
(3.224069892902813, 8.292236328124998, 8.701379453502415, 6.933912888071895, 8.051335328014185, 4.645225564301183), # 35
(3.23091608056266, 8.300330965909092, 8.69391847826087, 6.932360294117648, 8.046510638297873, 4.630584895052474), # 36
(3.2376141703964194, 8.308305575284091, 8.68519935084541, 6.9305393178104575, 8.040856161347516, 4.614027402965184), # 37
(3.2441675191815853, 8.31615909090909, 8.675252415458937, 6.9284542483660125, 8.034386524822695, 4.595615275695485), # 38
(3.250579483695652, 8.323890447443182, 8.664108016304347, 6.926109375, 8.027116356382978, 4.57541070089955), # 39
(3.2568534207161126, 8.331498579545455, 8.651796497584542, 6.923508986928105, 8.019060283687942, 4.5534758662335495), # 40
(3.26299268702046, 8.338982421874999, 8.638348203502416, 6.920657373366013, 8.010232934397163, 4.529872959353657), # 41
(3.269000639386189, 8.34634090909091, 8.62379347826087, 6.917558823529411, 8.000648936170213, 4.504664167916042), # 42
(3.2748806345907933, 8.353572975852272, 8.608162666062801, 6.914217626633987, 7.990322916666666, 4.477911679576878), # 43
(3.2806360294117645, 8.360677556818182, 8.591486111111111, 6.910638071895424, 7.979269503546099, 4.449677681992337), # 44
(3.286270180626598, 8.367653586647727, 8.573794157608697, 6.906824448529411, 7.967503324468085, 4.420024362818591), # 45
(3.291786445012788, 8.374500000000001, 8.555117149758455, 6.902781045751634, 7.955039007092199, 4.389013909711811), # 46
(3.297188179347826, 8.381215731534091, 8.535485431763284, 6.898512152777777, 7.941891179078015, 4.356708510328169), # 47
(3.3024787404092075, 8.387799715909091, 8.514929347826087, 6.894022058823529, 7.928074468085106, 4.323170352323839), # 48
(3.307661484974424, 8.39425088778409, 8.493479242149759, 6.889315053104576, 7.91360350177305, 4.288461623354989), # 49
(3.312739769820972, 8.40056818181818, 8.471165458937199, 6.884395424836602, 7.898492907801418, 4.252644511077794), # 50
(3.317716951726343, 8.406750532670454, 8.448018342391304, 6.879267463235294, 7.882757313829787, 4.215781203148426), # 51
(3.322596387468031, 8.412796875, 8.424068236714975, 6.87393545751634, 7.86641134751773, 4.177933887223055), # 52
(3.3273814338235295, 8.41870614346591, 8.39934548611111, 6.868403696895425, 7.849469636524823, 4.139164750957854), # 53
(3.332075447570333, 8.424477272727271, 8.373880434782608, 6.8626764705882355, 7.831946808510638, 4.099535982008995), # 54
(3.336681785485933, 8.430109197443182, 8.347703426932366, 6.856758067810458, 7.813857491134752, 4.05910976803265), # 55
(3.341203804347826, 8.435600852272726, 8.320844806763285, 6.8506527777777775, 7.795216312056738, 4.017948296684991), # 56
(3.345644860933504, 8.440951171875001, 8.29333491847826, 6.844364889705882, 7.77603789893617, 3.9761137556221886), # 57
(3.3500083120204605, 8.44615909090909, 8.265204106280192, 6.837898692810458, 7.756336879432624, 3.9336683325004165), # 58
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 59
)
passenger_arriving_acc = (
(0, 5, 9, 3, 0, 0, 3, 7, 5, 2, 1, 0), # 0
(2, 9, 19, 9, 0, 0, 5, 10, 9, 4, 5, 0), # 1
(6, 18, 26, 13, 2, 0, 9, 15, 16, 8, 11, 0), # 2
(15, 27, 32, 17, 3, 0, 18, 23, 18, 13, 14, 0), # 3
(19, 33, 36, 25, 5, 0, 23, 29, 25, 16, 17, 0), # 4
(23, 36, 41, 28, 6, 0, 28, 37, 27, 18, 17, 0), # 5
(25, 38, 45, 33, 8, 0, 29, 38, 34, 19, 18, 0), # 6
(27, 41, 48, 38, 9, 0, 32, 40, 38, 21, 20, 0), # 7
(29, 48, 53, 43, 9, 0, 38, 43, 42, 29, 21, 0), # 8
(30, 57, 60, 47, 11, 0, 46, 50, 46, 37, 23, 0), # 9
(33, 62, 67, 50, 11, 0, 50, 60, 50, 40, 26, 0), # 10
(34, 66, 73, 52, 12, 0, 52, 63, 56, 48, 26, 0), # 11
(39, 68, 74, 54, 12, 0, 56, 72, 62, 50, 27, 0), # 12
(44, 69, 79, 57, 13, 0, 58, 76, 65, 57, 28, 0), # 13
(47, 75, 85, 59, 14, 0, 63, 80, 65, 61, 28, 0), # 14
(51, 77, 92, 61, 15, 0, 70, 90, 72, 65, 30, 0), # 15
(55, 83, 97, 66, 16, 0, 71, 104, 76, 66, 31, 0), # 16
(58, 88, 101, 68, 19, 0, 74, 109, 78, 72, 32, 0), # 17
(62, 92, 109, 70, 21, 0, 77, 114, 84, 75, 32, 0), # 18
(64, 99, 116, 72, 21, 0, 84, 116, 90, 76, 35, 0), # 19
(67, 106, 123, 74, 21, 0, 92, 125, 93, 77, 37, 0), # 20
(69, 114, 129, 76, 22, 0, 97, 130, 97, 80, 37, 0), # 21
(73, 120, 133, 77, 25, 0, 104, 134, 101, 85, 38, 0), # 22
(74, 125, 137, 80, 26, 0, 105, 139, 104, 90, 41, 0), # 23
(76, 134, 141, 81, 26, 0, 111, 145, 108, 97, 43, 0), # 24
(80, 142, 148, 83, 28, 0, 114, 151, 112, 98, 47, 0), # 25
(84, 148, 153, 85, 32, 0, 116, 151, 114, 102, 47, 0), # 26
(87, 152, 159, 89, 34, 0, 121, 161, 116, 105, 50, 0), # 27
(90, 164, 165, 92, 35, 0, 125, 173, 120, 107, 53, 0), # 28
(97, 172, 168, 95, 36, 0, 128, 176, 123, 111, 55, 0), # 29
(98, 184, 173, 95, 40, 0, 129, 180, 127, 116, 55, 0), # 30
(103, 192, 181, 98, 45, 0, 133, 187, 127, 120, 58, 0), # 31
(104, 206, 185, 102, 45, 0, 140, 194, 129, 123, 59, 0), # 32
(107, 213, 189, 104, 46, 0, 142, 199, 132, 125, 61, 0), # 33
(108, 220, 192, 107, 47, 0, 146, 210, 135, 130, 61, 0), # 34
(110, 225, 197, 111, 47, 0, 153, 216, 139, 135, 61, 0), # 35
(114, 232, 204, 114, 49, 0, 158, 223, 144, 136, 61, 0), # 36
(116, 238, 213, 122, 49, 0, 161, 232, 152, 136, 62, 0), # 37
(119, 242, 219, 124, 53, 0, 165, 237, 154, 136, 63, 0), # 38
(121, 248, 225, 125, 54, 0, 170, 244, 157, 144, 64, 0), # 39
(124, 256, 233, 128, 54, 0, 174, 247, 161, 153, 66, 0), # 40
(126, 259, 235, 130, 55, 0, 178, 256, 164, 159, 69, 0), # 41
(127, 267, 245, 130, 55, 0, 183, 268, 168, 163, 73, 0), # 42
(131, 278, 248, 132, 57, 0, 189, 273, 173, 167, 76, 0), # 43
(133, 285, 260, 134, 58, 0, 190, 277, 177, 168, 77, 0), # 44
(133, 294, 265, 135, 62, 0, 200, 281, 181, 174, 77, 0), # 45
(138, 298, 269, 135, 63, 0, 202, 285, 186, 177, 79, 0), # 46
(140, 303, 273, 135, 63, 0, 207, 294, 191, 182, 79, 0), # 47
(141, 313, 276, 139, 64, 0, 210, 297, 195, 186, 80, 0), # 48
(145, 319, 279, 143, 66, 0, 213, 303, 200, 188, 81, 0), # 49
(148, 325, 283, 148, 66, 0, 218, 312, 207, 191, 82, 0), # 50
(151, 331, 290, 150, 67, 0, 222, 317, 208, 194, 90, 0), # 51
(154, 342, 292, 154, 69, 0, 227, 324, 212, 201, 90, 0), # 52
(157, 350, 299, 157, 71, 0, 233, 333, 216, 204, 92, 0), # 53
(159, 357, 308, 158, 74, 0, 240, 339, 221, 206, 94, 0), # 54
(164, 367, 313, 160, 76, 0, 244, 344, 225, 210, 96, 0), # 55
(166, 373, 319, 161, 81, 0, 247, 347, 227, 213, 98, 0), # 56
(169, 376, 321, 164, 81, 0, 252, 353, 231, 221, 98, 0), # 57
(171, 383, 326, 166, 83, 0, 252, 354, 233, 224, 98, 0), # 58
(171, 383, 326, 166, 83, 0, 252, 354, 233, 224, 98, 0), # 59
)
passenger_arriving_rate = (
(2.649651558384548, 5.43716856060606, 4.79654161311054, 2.534510869565217, 1.428605769230769, 0.0, 4.75679347826087, 5.714423076923076, 3.801766304347826, 3.1976944087403596, 1.359292140151515, 0.0), # 0
(2.6745220100478, 5.497633278970258, 4.822449322514997, 2.5486257548309177, 1.439313301282051, 0.0, 4.7551721391908215, 5.757253205128204, 3.8229386322463768, 3.2149662150099974, 1.3744083197425645, 0.0), # 1
(2.699108477221734, 5.557201122334455, 4.8477420736932295, 2.562429951690821, 1.4497948717948717, 0.0, 4.753501207729468, 5.799179487179487, 3.8436449275362317, 3.23182804912882, 1.3893002805836137, 0.0), # 2
(2.72339008999122, 5.6158078125, 4.872401389781491, 2.575911684782608, 1.4600408653846155, 0.0, 4.7517809103260875, 5.840163461538462, 3.863867527173912, 3.2482675931876606, 1.403951953125, 0.0), # 3
(2.747345978441128, 5.673389071268238, 4.896408793916024, 2.589059178743961, 1.4700416666666667, 0.0, 4.750011473429951, 5.880166666666667, 3.883588768115942, 3.2642725292773487, 1.4183472678170594, 0.0), # 4
(2.7709552726563262, 5.729880620440516, 4.919745809233076, 2.6018606582125603, 1.47978766025641, 0.0, 4.748193123490338, 5.91915064102564, 3.9027909873188404, 3.279830539488717, 1.432470155110129, 0.0), # 5
(2.794197102721686, 5.785218181818181, 4.942393958868895, 2.614304347826087, 1.4892692307692306, 0.0, 4.746326086956522, 5.957076923076922, 3.9214565217391306, 3.294929305912597, 1.4463045454545453, 0.0), # 6
(2.817050598722076, 5.83933747720258, 4.964334765959725, 2.626378472222222, 1.498476762820513, 0.0, 4.744410590277778, 5.993907051282052, 3.939567708333333, 3.309556510639817, 1.459834369300645, 0.0), # 7
(2.8394948907423667, 5.89217422839506, 4.985549753641817, 2.638071256038647, 1.5074006410256409, 0.0, 4.7424468599033816, 6.0296025641025635, 3.9571068840579704, 3.3236998357612113, 1.473043557098765, 0.0), # 8
(2.8615091088674274, 5.943664157196969, 5.006020445051414, 2.649370923913043, 1.5160312499999997, 0.0, 4.740435122282609, 6.064124999999999, 3.9740563858695652, 3.3373469633676094, 1.4859160392992423, 0.0), # 9
(2.8830723831821286, 5.993742985409652, 5.025728363324764, 2.660265700483092, 1.5243589743589743, 0.0, 4.738375603864734, 6.097435897435897, 3.990398550724638, 3.3504855755498424, 1.498435746352413, 0.0), # 10
(2.9041638437713395, 6.042346434834456, 5.044655031598114, 2.6707438103864733, 1.5323741987179484, 0.0, 4.736268531099034, 6.129496794871794, 4.0061157155797105, 3.3631033543987425, 1.510586608708614, 0.0), # 11
(2.92476262071993, 6.089410227272726, 5.062781973007712, 2.680793478260869, 1.5400673076923075, 0.0, 4.734114130434782, 6.16026923076923, 4.021190217391304, 3.375187982005141, 1.5223525568181815, 0.0), # 12
(2.944847844112769, 6.134870084525814, 5.080090710689802, 2.690402928743961, 1.547428685897436, 0.0, 4.731912628321256, 6.189714743589744, 4.035604393115942, 3.386727140459868, 1.5337175211314535, 0.0), # 13
(2.9643986440347283, 6.1786617283950624, 5.096562767780632, 2.699560386473429, 1.5544487179487176, 0.0, 4.729664251207729, 6.217794871794871, 4.049340579710144, 3.397708511853755, 1.5446654320987656, 0.0), # 14
(2.9833941505706756, 6.220720880681816, 5.112179667416451, 2.708254076086956, 1.5611177884615384, 0.0, 4.7273692255434785, 6.2444711538461535, 4.062381114130434, 3.408119778277634, 1.555180220170454, 0.0), # 15
(3.001813493805482, 6.26098326318743, 5.126922932733505, 2.716472222222222, 1.5674262820512819, 0.0, 4.725027777777778, 6.2697051282051275, 4.074708333333333, 3.4179486218223363, 1.5652458157968574, 0.0), # 16
(3.019635803824017, 6.299384597713242, 5.140774086868038, 2.724203049516908, 1.5733645833333332, 0.0, 4.722640134359904, 6.293458333333333, 4.0863045742753625, 3.4271827245786914, 1.5748461494283106, 0.0), # 17
(3.03684021071115, 6.3358606060606055, 5.153714652956299, 2.7314347826086958, 1.578923076923077, 0.0, 4.72020652173913, 6.315692307692308, 4.097152173913043, 3.435809768637532, 1.5839651515151514, 0.0), # 18
(3.053405844551751, 6.370347010030863, 5.165726154134533, 2.738155646135265, 1.5840921474358973, 0.0, 4.717727166364734, 6.336368589743589, 4.107233469202898, 3.4438174360896885, 1.5925867525077158, 0.0), # 19
(3.0693118354306894, 6.402779531425363, 5.1767901135389875, 2.7443538647342995, 1.5888621794871793, 0.0, 4.71520229468599, 6.355448717948717, 4.11653079710145, 3.4511934090259917, 1.6006948828563408, 0.0), # 20
(3.084537313432836, 6.433093892045452, 5.186888054305913, 2.750017663043478, 1.5932235576923073, 0.0, 4.712632133152174, 6.372894230769229, 4.125026494565217, 3.4579253695372754, 1.608273473011363, 0.0), # 21
(3.099061408643059, 6.46122581369248, 5.19600149957155, 2.7551352657004826, 1.5971666666666662, 0.0, 4.710016908212561, 6.388666666666665, 4.132702898550725, 3.464000999714367, 1.61530645342312, 0.0), # 22
(3.1128632511462295, 6.487111018167789, 5.204111972472151, 2.759694897342995, 1.6006818910256408, 0.0, 4.707356846316426, 6.402727564102563, 4.139542346014493, 3.4694079816481005, 1.6217777545419472, 0.0), # 23
(3.125921971027217, 6.5106852272727265, 5.211200996143958, 2.763684782608695, 1.6037596153846152, 0.0, 4.704652173913043, 6.415038461538461, 4.1455271739130435, 3.474133997429305, 1.6276713068181816, 0.0), # 24
(3.1382166983708903, 6.531884162808641, 5.217250093723222, 2.7670931461352657, 1.606390224358974, 0.0, 4.701903117451691, 6.425560897435896, 4.150639719202899, 3.4781667291488145, 1.6329710407021603, 0.0), # 25
(3.1497265632621207, 6.550643546576878, 5.222240788346187, 2.7699082125603858, 1.6085641025641022, 0.0, 4.699109903381642, 6.434256410256409, 4.154862318840579, 3.4814938588974575, 1.6376608866442195, 0.0), # 26
(3.160430695785777, 6.566899100378786, 5.226154603149099, 2.772118206521739, 1.6102716346153847, 0.0, 4.696272758152174, 6.441086538461539, 4.158177309782609, 3.484103068766066, 1.6417247750946966, 0.0), # 27
(3.1703082260267292, 6.580586546015712, 5.228973061268209, 2.7737113526570045, 1.6115032051282048, 0.0, 4.69339190821256, 6.446012820512819, 4.160567028985507, 3.4859820408454727, 1.645146636503928, 0.0), # 28
(3.1793382840698468, 6.591641605289001, 5.230677685839759, 2.7746758756038647, 1.6122491987179486, 0.0, 4.690467580012077, 6.448996794871794, 4.162013813405797, 3.487118457226506, 1.6479104013222503, 0.0), # 29
(3.1875, 6.6, 5.23125, 2.775, 1.6124999999999998, 0.0, 4.6875, 6.449999999999999, 4.1625, 3.4875, 1.65, 0.0), # 30
(3.1951370284526854, 6.606943039772726, 5.230820969202898, 2.7749414624183006, 1.6124087322695035, 0.0, 4.683376259786773, 6.449634929078014, 4.162412193627451, 3.4872139794685983, 1.6517357599431814, 0.0), # 31
(3.202609175191816, 6.613794318181818, 5.229546014492753, 2.7747669934640515, 1.6121368794326238, 0.0, 4.677024758454107, 6.448547517730495, 4.162150490196078, 3.4863640096618354, 1.6534485795454545, 0.0), # 32
(3.2099197969948845, 6.620552982954545, 5.227443342391305, 2.774478308823529, 1.6116873670212764, 0.0, 4.66850768365817, 6.446749468085105, 4.161717463235294, 3.4849622282608697, 1.6551382457386363, 0.0), # 33
(3.217072250639386, 6.627218181818182, 5.224531159420289, 2.7740771241830067, 1.6110631205673758, 0.0, 4.657887223055139, 6.444252482269503, 4.16111568627451, 3.4830207729468596, 1.6568045454545455, 0.0), # 34
(3.224069892902813, 6.633789062499998, 5.220827672101449, 2.773565155228758, 1.6102670656028368, 0.0, 4.645225564301183, 6.441068262411347, 4.160347732843137, 3.480551781400966, 1.6584472656249996, 0.0), # 35
(3.23091608056266, 6.6402647727272734, 5.2163510869565215, 2.7729441176470586, 1.6093021276595745, 0.0, 4.630584895052474, 6.437208510638298, 4.159416176470589, 3.477567391304347, 1.6600661931818184, 0.0), # 36
(3.2376141703964194, 6.6466444602272725, 5.211119610507246, 2.7722157271241827, 1.6081712322695032, 0.0, 4.614027402965184, 6.432684929078013, 4.158323590686274, 3.474079740338164, 1.6616611150568181, 0.0), # 37
(3.2441675191815853, 6.652927272727272, 5.205151449275362, 2.7713816993464047, 1.6068773049645388, 0.0, 4.595615275695485, 6.427509219858155, 4.157072549019607, 3.4701009661835744, 1.663231818181818, 0.0), # 38
(3.250579483695652, 6.659112357954545, 5.198464809782608, 2.7704437499999996, 1.6054232712765955, 0.0, 4.57541070089955, 6.421693085106382, 4.155665625, 3.4656432065217384, 1.6647780894886361, 0.0), # 39
(3.2568534207161126, 6.6651988636363635, 5.191077898550724, 2.7694035947712417, 1.6038120567375882, 0.0, 4.5534758662335495, 6.415248226950353, 4.154105392156863, 3.4607185990338163, 1.6662997159090909, 0.0), # 40
(3.26299268702046, 6.671185937499998, 5.1830089221014495, 2.768262949346405, 1.6020465868794325, 0.0, 4.529872959353657, 6.40818634751773, 4.152394424019608, 3.455339281400966, 1.6677964843749995, 0.0), # 41
(3.269000639386189, 6.677072727272728, 5.174276086956522, 2.767023529411764, 1.6001297872340425, 0.0, 4.504664167916042, 6.40051914893617, 4.150535294117646, 3.4495173913043478, 1.669268181818182, 0.0), # 42
(3.2748806345907933, 6.682858380681817, 5.164897599637681, 2.7656870506535944, 1.5980645833333331, 0.0, 4.477911679576878, 6.3922583333333325, 4.148530575980392, 3.4432650664251203, 1.6707145951704543, 0.0), # 43
(3.2806360294117645, 6.688542045454545, 5.154891666666667, 2.7642552287581696, 1.5958539007092198, 0.0, 4.449677681992337, 6.383415602836879, 4.146382843137254, 3.4365944444444443, 1.6721355113636363, 0.0), # 44
(3.286270180626598, 6.694122869318181, 5.144276494565218, 2.7627297794117642, 1.593500664893617, 0.0, 4.420024362818591, 6.374002659574468, 4.144094669117647, 3.4295176630434785, 1.6735307173295453, 0.0), # 45
(3.291786445012788, 6.6996, 5.133070289855073, 2.761112418300653, 1.5910078014184397, 0.0, 4.389013909711811, 6.364031205673759, 4.14166862745098, 3.4220468599033818, 1.6749, 0.0), # 46
(3.297188179347826, 6.704972585227273, 5.12129125905797, 2.759404861111111, 1.588378235815603, 0.0, 4.356708510328169, 6.353512943262412, 4.139107291666666, 3.4141941727053133, 1.6762431463068181, 0.0), # 47
(3.3024787404092075, 6.710239772727273, 5.108957608695651, 2.757608823529411, 1.5856148936170211, 0.0, 4.323170352323839, 6.3424595744680845, 4.136413235294117, 3.4059717391304343, 1.6775599431818182, 0.0), # 48
(3.307661484974424, 6.715400710227271, 5.096087545289855, 2.75572602124183, 1.5827207003546098, 0.0, 4.288461623354989, 6.330882801418439, 4.133589031862745, 3.3973916968599034, 1.6788501775568176, 0.0), # 49
(3.312739769820972, 6.720454545454543, 5.082699275362319, 2.7537581699346405, 1.5796985815602835, 0.0, 4.252644511077794, 6.318794326241134, 4.130637254901961, 3.388466183574879, 1.6801136363636358, 0.0), # 50
(3.317716951726343, 6.725400426136363, 5.068811005434783, 2.7517069852941174, 1.5765514627659571, 0.0, 4.215781203148426, 6.306205851063829, 4.127560477941176, 3.3792073369565214, 1.6813501065340908, 0.0), # 51
(3.322596387468031, 6.730237499999999, 5.054440942028985, 2.7495741830065357, 1.573282269503546, 0.0, 4.177933887223055, 6.293129078014184, 4.124361274509804, 3.3696272946859898, 1.6825593749999999, 0.0), # 52
(3.3273814338235295, 6.7349649147727275, 5.039607291666666, 2.7473614787581697, 1.5698939273049646, 0.0, 4.139164750957854, 6.279575709219858, 4.121042218137255, 3.359738194444444, 1.6837412286931819, 0.0), # 53
(3.332075447570333, 6.739581818181817, 5.024328260869565, 2.745070588235294, 1.5663893617021276, 0.0, 4.099535982008995, 6.2655574468085105, 4.117605882352941, 3.3495521739130427, 1.6848954545454542, 0.0), # 54
(3.336681785485933, 6.744087357954545, 5.008622056159419, 2.7427032271241827, 1.5627714982269503, 0.0, 4.05910976803265, 6.251085992907801, 4.114054840686275, 3.3390813707729463, 1.6860218394886362, 0.0), # 55
(3.341203804347826, 6.74848068181818, 4.9925068840579705, 2.740261111111111, 1.5590432624113475, 0.0, 4.017948296684991, 6.23617304964539, 4.110391666666667, 3.328337922705314, 1.687120170454545, 0.0), # 56
(3.345644860933504, 6.752760937500001, 4.976000951086956, 2.7377459558823527, 1.5552075797872338, 0.0, 3.9761137556221886, 6.220830319148935, 4.106618933823529, 3.317333967391304, 1.6881902343750002, 0.0), # 57
(3.3500083120204605, 6.756927272727271, 4.959122463768115, 2.7351594771241827, 1.5512673758865245, 0.0, 3.9336683325004165, 6.205069503546098, 4.102739215686275, 3.3060816425120767, 1.6892318181818178, 0.0), # 58
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 59
)
passenger_allighting_rate = (
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 0
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 1
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 2
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 3
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 4
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 5
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 6
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 7
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 8
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 9
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 10
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 11
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 12
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 13
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 14
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 15
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 16
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 17
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 18
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 19
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 20
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 21
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 22
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 23
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 24
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 25
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 26
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 27
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 28
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 29
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 30
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 31
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 32
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 33
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 34
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 35
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 36
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 37
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 38
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 39
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 40
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 41
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 42
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 43
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 44
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 45
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 46
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 47
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 48
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 49
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 50
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 51
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 52
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 53
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 54
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 55
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 56
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 57
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 58
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 59
)
"""
parameters for reproducibiliy. More information: https://numpy.org/doc/stable/reference/random/parallel.html
"""
#initial entropy
entropy = 258194110137029475889902652135037600173
#index for seed sequence child
child_seed_index = (
1, # 0
67, # 1
)
| 112.528358 | 215 | 0.727724 |
4e298d0ad6de43261aab1a6d6e7529e6494b22c8 | 658 | py | Python | src/heatmap.py | JsPatenaude/INF8808_projet | 601a7505188f379365a32594b484cee3d924a52a | [
"MIT"
] | null | null | null | src/heatmap.py | JsPatenaude/INF8808_projet | 601a7505188f379365a32594b484cee3d924a52a | [
"MIT"
] | null | null | null | src/heatmap.py | JsPatenaude/INF8808_projet | 601a7505188f379365a32594b484cee3d924a52a | [
"MIT"
] | null | null | null | import plotly.express as px
from preprocess import PreprocessHeatmap | 26.32 | 63 | 0.62766 |
4e2a78cc73dc66dd46aa1290d150d2b082861993 | 13,985 | py | Python | client/forumgame.py | codingforhelp/fbserv | b09cc2ce20eaa3714e80d23e0f5741f144d2eed2 | [
"MIT"
] | 5 | 2019-01-31T08:09:53.000Z | 2020-04-13T22:48:25.000Z | client/forumgame.py | codingforhelp/fbserv | b09cc2ce20eaa3714e80d23e0f5741f144d2eed2 | [
"MIT"
] | 2 | 2021-04-30T21:04:37.000Z | 2021-06-01T23:42:18.000Z | client/forumgame.py | codingforhelp/fbserv | b09cc2ce20eaa3714e80d23e0f5741f144d2eed2 | [
"MIT"
] | 3 | 2019-08-04T07:51:58.000Z | 2022-02-25T13:39:30.000Z | from dom import e, Div, TextInput, Button, TextArea
from basicboard import BasicBoard
from connection import getconn
from utils import queryparams, random, setseed
mainseed = 80 | 36.609948 | 125 | 0.512835 |
4e2aa357eb6cd6758da7f0deccc68b00c56538d5 | 1,783 | py | Python | utest/test_detect_file_order.py | fanfank/timecat | 6488771d781489ea03d3490e55050a18522c8bd1 | [
"MIT"
] | 69 | 2016-01-08T03:23:57.000Z | 2021-05-06T03:14:10.000Z | utest/test_detect_file_order.py | fanfank/timecat | 6488771d781489ea03d3490e55050a18522c8bd1 | [
"MIT"
] | 1 | 2016-10-20T17:08:58.000Z | 2016-10-20T17:08:58.000Z | utest/test_detect_file_order.py | fanfank/timecat | 6488771d781489ea03d3490e55050a18522c8bd1 | [
"MIT"
] | 10 | 2016-01-15T14:30:29.000Z | 2020-09-24T02:42:14.000Z | #!/usr/bin/python
# -*- coding: utf-8 -*-
from include import *
from timecat import detect_file_format
from timecat import detect_datetime_format
case_num = 0
if __name__ == "__main__":
ascending_log = "testbinary.log"
with open(ascending_log) as f:
# 1. ascending
regex_format_info = detect_datetime_format("02/Oct/2016:20:13:14.666", None)
dofo(f, "02/Oct/2016:20:13:14.666", "02/Dec/2017:20:13:14.666",
regex_format_info)
descending_log = "testbinary.log.reverse"
with open(descending_log) as f:
# 2. descending
regex_format_info = detect_datetime_format("02/Oct/2016:20:13:14.666", None)
dofo(f, "02/Oct/2016:20:13:14.666", "05/Aug/2016:20:13:14.666",
regex_format_info)
ascending_log = "testbinary.log"
with open(ascending_log) as f:
regex_format_info = detect_datetime_format("2015-12-13 12:13:20", None)
# 3. ascending
dofo(f, "2015-12-13 12:13:20", None, regex_format_info)
# 4. descending
dofo(f, "2015-12-13 12:13:20", "2015-12-13 11:10:20", regex_format_info)
descending_log = "testbinary.log.reverse"
with open(descending_log) as f:
regex_format_info = detect_datetime_format("2015-12-13 11:10:20", None)
# 5. descending
dofo(f, "2015-12-13 12:13:20", None, regex_format_info)
# 6. ascending
dofo(f, "2015-12-13 12:13:20", "2016-12-13 12:13:20", regex_format_info)
| 32.418182 | 84 | 0.63152 |
4e2c40a662d4bfc0d9d63abeff78cd1610530203 | 1,642 | py | Python | Downey2012a_exes/cap02/cookie2.py | crisgc/mab719 | 0514efdd4db649f472771e6f16df9a5611ed7db9 | [
"MIT"
] | null | null | null | Downey2012a_exes/cap02/cookie2.py | crisgc/mab719 | 0514efdd4db649f472771e6f16df9a5611ed7db9 | [
"MIT"
] | null | null | null | Downey2012a_exes/cap02/cookie2.py | crisgc/mab719 | 0514efdd4db649f472771e6f16df9a5611ed7db9 | [
"MIT"
] | null | null | null | """This file contains code for use with "Think Bayes",
by Allen B. Downey, available from greenteapress.com
Copyright 2012 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from thinkbayes import Pmf
from bowl import Bowl
if __name__ == '__main__':
main()
| 23.457143 | 67 | 0.574909 |
4e2ce6d71349214a1161e5b470a89bc7da49773f | 6,513 | py | Python | tests/mathbot_tests.py | RubyMarsden/Crayfish | 33bbb1248beec2fc40eee59e462711dd8cbc33da | [
"MIT"
] | null | null | null | tests/mathbot_tests.py | RubyMarsden/Crayfish | 33bbb1248beec2fc40eee59e462711dd8cbc33da | [
"MIT"
] | 8 | 2021-03-19T06:35:48.000Z | 2021-03-31T14:23:24.000Z | tests/mathbot_tests.py | RubyMarsden/Crayfish | 33bbb1248beec2fc40eee59e462711dd8cbc33da | [
"MIT"
] | null | null | null | import unittest
from models import settings
from models.mathbot import *
from models.settings import U238_DECAY_CONSTANT, U238_DECAY_CONSTANT_ERROR, TH232_DECAY_CONSTANT, \
TH232_DECAY_CONSTANT_ERROR
if __name__ == '__main__':
unittest.main()
| 40.453416 | 111 | 0.634423 |
4e2d4927d418a10f01fca137a00d8c7a207d49a7 | 2,748 | py | Python | flask_modular_auth/manager.py | fabian-rump/flask_modular_auth | 509def7b2cb366cba5d0d18187d99932c8ca00ef | [
"MIT"
] | null | null | null | flask_modular_auth/manager.py | fabian-rump/flask_modular_auth | 509def7b2cb366cba5d0d18187d99932c8ca00ef | [
"MIT"
] | null | null | null | flask_modular_auth/manager.py | fabian-rump/flask_modular_auth | 509def7b2cb366cba5d0d18187d99932c8ca00ef | [
"MIT"
] | null | null | null | from .abstract import AbstractAuthProvider, AbstractUnauthenticatedEntity
from .utils import _context_processor
from flask import _request_ctx_stack, has_request_context
| 42.9375 | 157 | 0.71361 |
4e2febb20e4d67a6dafa8818361872984d650fb8 | 1,659 | py | Python | tests/test_decorators.py | markin/elmo-alerting | 7562f8f05acbe9632a2e6c19da72d15c571b9e75 | [
"BSD-3-Clause"
] | null | null | null | tests/test_decorators.py | markin/elmo-alerting | 7562f8f05acbe9632a2e6c19da72d15c571b9e75 | [
"BSD-3-Clause"
] | null | null | null | tests/test_decorators.py | markin/elmo-alerting | 7562f8f05acbe9632a2e6c19da72d15c571b9e75 | [
"BSD-3-Clause"
] | null | null | null | from threading import Lock
import pytest
from elmo.api.decorators import require_lock, require_session
from elmo.api.exceptions import LockNotAcquired, PermissionDenied
def test_require_session_present():
"""Should succeed if a session ID is available."""
client = TestClient()
assert client.action() == 42
def test_require_session_missing():
"""Should fail if a session ID is not available."""
client = TestClient()
with pytest.raises(PermissionDenied):
client.action()
def test_require_lock():
"""Should succeed if the lock has been acquired."""
client = TestClient()
client._lock.acquire()
assert client.action() == 42
def test_require_lock_fails():
"""Should fail if the lock has not been acquired."""
client = TestClient()
with pytest.raises(LockNotAcquired):
client.action()
| 22.418919 | 65 | 0.615431 |
4e30d02b5676aa65a9e86f44cc1848fd4a7d7bb2 | 13,400 | py | Python | models/iscnet/modules/relation_model.py | blakeyy/Relational-RfDNet | 72f4e35601e963c91515f40707174c0d79cb5403 | [
"MIT"
] | 1 | 2022-03-31T13:00:15.000Z | 2022-03-31T13:00:15.000Z | models/iscnet/modules/relation_model.py | blakeyy/Relational-RfDNet | 72f4e35601e963c91515f40707174c0d79cb5403 | [
"MIT"
] | null | null | null | models/iscnet/modules/relation_model.py | blakeyy/Relational-RfDNet | 72f4e35601e963c91515f40707174c0d79cb5403 | [
"MIT"
] | null | null | null | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from net_utils.nn_distance import nn_distance
from net_utils.relation_tool import PositionalEmbedding
from models.registers import MODULES
from models.iscnet.modules.proposal_module import decode_scores
from configs.scannet_config import ScannetConfig #param2obb
#def init_weights(m):
# if type(m) == nn.Linear or type(m) == nn.Conv1d:
# gain = nn.init.calculate_gain('relu')
# nn.init.xavier_uniform_(m.weight, gain=gain)
# m.bias.data.fill_(0.01)
#gain = nn.init.calculate_gain('relu')
#nn.init.xavier_uniform_(m.weight, gain=gain)
#m.bias.data.fill_(0.01) | 47.51773 | 172 | 0.592313 |
4e3154ae1d10762e4681a612915a4720d50696c7 | 1,760 | py | Python | ipware/descriptor.py | phi1010/django-ipware | 9d4e5f3b17e8669757ea9590e3e02580bd310634 | [
"MIT"
] | null | null | null | ipware/descriptor.py | phi1010/django-ipware | 9d4e5f3b17e8669757ea9590e3e02580bd310634 | [
"MIT"
] | null | null | null | ipware/descriptor.py | phi1010/django-ipware | 9d4e5f3b17e8669757ea9590e3e02580bd310634 | [
"MIT"
] | null | null | null | from enum import Enum, auto
from typing import List, Union, Callable
from ipaddress import IPv4Address, IPv4Network, IPv6Address, IPv6Network, ip_network, ip_address
from warnings import warn
| 38.26087 | 116 | 0.651136 |
4e31ecc86ddefaf67265db380dc7eba40617c43e | 2,333 | py | Python | locs/models/anisotropic_filter.py | mkofinas/locs | 4cb0ab9e989ebfee42d1d2850bdf3360336b5c1c | [
"MIT"
] | 16 | 2021-11-04T07:57:58.000Z | 2022-03-01T17:45:32.000Z | locs/models/anisotropic_filter.py | mkofinas/locs | 4cb0ab9e989ebfee42d1d2850bdf3360336b5c1c | [
"MIT"
] | null | null | null | locs/models/anisotropic_filter.py | mkofinas/locs | 4cb0ab9e989ebfee42d1d2850bdf3360336b5c1c | [
"MIT"
] | null | null | null | from torch import nn
import torch.nn.functional as F
from locs.models.activations import ACTIVATIONS
| 35.348485 | 77 | 0.629233 |
4e32180523c62ff4dfee0a5445151998ee1a7804 | 1,798 | py | Python | src/data_files/sample_data.py | gorried/hexgraph | b179e2fe0f8afc465ce92eac02f3cc2c4d1ac38e | [
"MIT"
] | null | null | null | src/data_files/sample_data.py | gorried/hexgraph | b179e2fe0f8afc465ce92eac02f3cc2c4d1ac38e | [
"MIT"
] | null | null | null | src/data_files/sample_data.py | gorried/hexgraph | b179e2fe0f8afc465ce92eac02f3cc2c4d1ac38e | [
"MIT"
] | null | null | null | #! /usr/bin/env python
"""
Daniel Gorrie
Large dataset sampler
"""
import random
import os
from os import listdir
from os.path import isfile, join
# Constants
INPUT_FILE = 'train.features'
INPUT_FILE_SIZE = 8352136
OUTPUT_FILE = 'train_small.features'
SAMPLE_SIZE = 110000
INPUT_LABEL_DIR = 'labels/'
OUTPUT_LABEL_DIR = 'labels_small/'
if __name__ == '__main__':
main()
| 24.630137 | 94 | 0.613459 |
4e323ee929773b5d99e66e15ebdc6631d0480bf5 | 1,581 | py | Python | utils/uniprot.py | glycosciences/covid-19-Annotations-on-Structures | 3337bc5aec0ba79287ab0fd8c4763b15a4783378 | [
"MIT"
] | 2 | 2020-04-06T18:12:47.000Z | 2021-08-01T20:17:59.000Z | utils/uniprot.py | glycosciences/covid-19-Annotations-on-Structures | 3337bc5aec0ba79287ab0fd8c4763b15a4783378 | [
"MIT"
] | 20 | 2020-04-02T18:02:14.000Z | 2020-08-10T12:29:46.000Z | utils/uniprot.py | glycosciences/covid-19-Annotations-on-Structures | 3337bc5aec0ba79287ab0fd8c4763b15a4783378 | [
"MIT"
] | 9 | 2020-04-06T12:39:02.000Z | 2021-08-01T20:18:00.000Z | import re
import urllib.request
"""
Collection of handy functions related to uniprot. Potential reimplementations
of code that would be available in various packages with the goal of keeping
dependencies at a minimum.
"""
def valid_uniprot_ac_pattern(uniprot_ac):
"""
Checks whether Uniprot AC is formally correct according to
https://www.uniprot.org/help/accession_numbers
This is no check whether it actually exists.
:param uniprot_ac: Accession code to be checked
"""
ac_pat = "[OPQ][0-9][A-Z0-9]{3}[0-9]|[A-NR-Z][0-9]([A-Z][A-Z0-9]{2}[0-9]){1,2}"
if re.match(ac_pat, uniprot_ac):
return True
else:
return False
def seq_from_ac(uniprot_ac):
"""
Fetches raw sequence string for given uniprot accession code
:param uniprot_ac: Accession code for which you want the sequence
"""
if not valid_uniprot_ac_pattern(uniprot_ac):
raise RuntimeError("Uniprot AC does not look valid")
data = None
try:
# that's the default uniprot access
url = "https://www.uniprot.org/uniprot/%s.fasta" % uniprot_ac
with urllib.request.urlopen(url) as response:
data = response.readlines()
except:
# this is only temporary, as SARS-CoV2 is not yet in uniprot
url = (
"https://www.ebi.ac.uk/uniprot/api/covid-19/uniprotkb/accession/%s.fasta"
% (uniprot_ac)
)
with urllib.request.urlopen(url) as response:
data = response.readlines()
return "".join(line.decode().strip() for line in data[1:])
| 29.830189 | 85 | 0.655281 |
4e363f620d0dd72062004bc406ce4122903589f9 | 7,414 | py | Python | socialdistribution/api/adapters.py | CMPUT404-F21T0/CMPUT404-Project-BetterSocial | 04a621915108a434d50e900165cefdb0d4cca45c | [
"Apache-2.0"
] | null | null | null | socialdistribution/api/adapters.py | CMPUT404-F21T0/CMPUT404-Project-BetterSocial | 04a621915108a434d50e900165cefdb0d4cca45c | [
"Apache-2.0"
] | 2 | 2021-10-29T20:18:57.000Z | 2021-12-04T14:57:34.000Z | socialdistribution/api/adapters.py | CMPUT404-F21T0/CMPUT404-Project-BetterSocial | 04a621915108a434d50e900165cefdb0d4cca45c | [
"Apache-2.0"
] | null | null | null | from typing import Dict, Union, Optional
from uuid import UUID
import requests
from requests.auth import HTTPBasicAuth
from yarl import URL
# A global list of adapters that are tied to nodes via the database.
registered_adapters: Dict[str, BaseAdapter] = {
'default': BaseAdapter(),
'team_1': Team1Adapter(),
'team_4': Team4Adapter(),
'team_7': Team7Adapter(),
}
| 37.256281 | 128 | 0.626652 |
4e375905fd80fe7f68027a1624911d3d06a78ce6 | 2,672 | py | Python | src/getFrustum.py | asr-ros/asr_resources_for_active_scene_recognition | dd402ea95fd877769f12e572cad85385e4ebe5b3 | [
"BSD-3-Clause"
] | null | null | null | src/getFrustum.py | asr-ros/asr_resources_for_active_scene_recognition | dd402ea95fd877769f12e572cad85385e4ebe5b3 | [
"BSD-3-Clause"
] | null | null | null | src/getFrustum.py | asr-ros/asr_resources_for_active_scene_recognition | dd402ea95fd877769f12e572cad85385e4ebe5b3 | [
"BSD-3-Clause"
] | 2 | 2017-03-03T16:59:55.000Z | 2019-12-06T12:10:33.000Z | #!/usr/bin/env python
'''
Copyright (c) 2016, Allgeyer Tobias, Aumann Florian, Borella Jocelyn, Karrenbauer Oliver, Marek Felix, Meissner Pascal, Stroh Daniel, Trautmann Jeremias
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
'''
#Manually draw frustum at current robot pose in RViz.
import roslib
import rospy
from asr_robot_model_services.msg import RobotStateMessage
from asr_robot_model_services.srv import CalculateCameraPose, GetPose
from asr_next_best_view.srv import TriggerFrustumVisualization
def get_camera_pose_cpp():
"""
Returns camera pose
"""
rospy.wait_for_service('/asr_robot_model_services/GetCameraPose', timeout=5)
pose = rospy.ServiceProxy('/asr_robot_model_services/GetCameraPose',GetPose)
return pose().pose
if __name__ == "__main__":
main() | 54.530612 | 755 | 0.791542 |
4e3a67bc274883baf27d3e4d3e4ad196d7ddbc63 | 33 | py | Python | iturmas/decorators/__init__.py | daniel-ufabc/match-classes | 2783cdf1c7363fcc14023a6cacad697b6af0f011 | [
"MIT"
] | null | null | null | iturmas/decorators/__init__.py | daniel-ufabc/match-classes | 2783cdf1c7363fcc14023a6cacad697b6af0f011 | [
"MIT"
] | null | null | null | iturmas/decorators/__init__.py | daniel-ufabc/match-classes | 2783cdf1c7363fcc14023a6cacad697b6af0f011 | [
"MIT"
] | null | null | null | from .auth import login_required
| 16.5 | 32 | 0.848485 |
4e3b40be7c29c65a9fd22f72903754a1e504955c | 5,643 | py | Python | structures/solution/bar.py | EladSharony/Mechanics | 078f97bea84114fc1db6fe9700b92b96b18a0d5e | [
"MIT"
] | 24 | 2021-02-23T13:53:14.000Z | 2022-03-29T16:40:56.000Z | structures/solution/bar.py | EladSharony/Mechanics | 078f97bea84114fc1db6fe9700b92b96b18a0d5e | [
"MIT"
] | 2 | 2021-04-23T12:30:32.000Z | 2022-03-31T10:51:12.000Z | structures/solution/bar.py | EladSharony/Mechanics | 078f97bea84114fc1db6fe9700b92b96b18a0d5e | [
"MIT"
] | 12 | 2021-04-11T20:44:03.000Z | 2022-03-30T19:23:58.000Z | from geom2d import Segment, make_vector_between
from structures.model.bar import StrBar
from .node import StrNodeSolution
def has_node(self, node: StrNodeSolution):
"""
Tests whether the given `node` is one of this bar's end
nodes.
:param node: structure node
:return: is the node connected with this bar?
"""
return node is self.start_node or node is self.end_node
def final_geometry_scaling_displacement(self, scale: float):
"""
Computes the geometry of the bar after the displacements
of its nodes have been applied with a given scale factor.
This scaled geometry can be used for drawing the solution
diagram.
:param scale: used to scale the displacements
:return: the solution bar's final geometry scaled
"""
return Segment(
self.start_node.displaced_pos_scaled(scale),
self.end_node.displaced_pos_scaled(scale)
)
| 28.356784 | 67 | 0.608187 |
4e3d4fa1300fa48573b88c6315f270637f616d76 | 1,631 | py | Python | tests/test_res_check_metaclass.py | misaki-sugiyama/unladen-chant | 28ac51ed9ef6eba8da8b5dafd13cf3abc1e63d5c | [
"Apache-2.0"
] | null | null | null | tests/test_res_check_metaclass.py | misaki-sugiyama/unladen-chant | 28ac51ed9ef6eba8da8b5dafd13cf3abc1e63d5c | [
"Apache-2.0"
] | null | null | null | tests/test_res_check_metaclass.py | misaki-sugiyama/unladen-chant | 28ac51ed9ef6eba8da8b5dafd13cf3abc1e63d5c | [
"Apache-2.0"
] | null | null | null | import pytest
pytestmark = pytest.mark.forked
from unladenchant.resourcecheck import MetaMixinResourceChecker
## Testing pass and failure
def rescheckPassed():
return True
def rescheckFailed():
return False
def test_will_pass_if_res_okay():
## Testing multiple checks
| 26.737705 | 63 | 0.698958 |
4e3df3a417c99ed4ce96f722ac39d7ce01ef8e82 | 219 | py | Python | baekjoon/1436/nth_666.py | ucyang/AlgoEx | 465c88f04b9449c06ee5c9a684ded5aba8ccf399 | [
"MIT"
] | null | null | null | baekjoon/1436/nth_666.py | ucyang/AlgoEx | 465c88f04b9449c06ee5c9a684ded5aba8ccf399 | [
"MIT"
] | null | null | null | baekjoon/1436/nth_666.py | ucyang/AlgoEx | 465c88f04b9449c06ee5c9a684ded5aba8ccf399 | [
"MIT"
] | null | null | null | import sys
input = lambda: sys.stdin.readline().rstrip()
n = int(input())
i = 666
c = 0
while True:
if str(i).find("666") != -1:
c += 1
if c == n:
print(i)
break
i += 1
| 14.6 | 45 | 0.452055 |
4e3f58928a5748c64ee63fdc647b83c5de587549 | 6,419 | py | Python | peitho/errors_and_parsers/abc_sysbio/abcsysbio_parser/ParseAndWrite.py | MichaelPHStumpf/Peitho | a4daa9a3b2d8960079573d08d5baa019b5ac857e | [
"MIT"
] | 1 | 2018-01-05T21:59:49.000Z | 2018-01-05T21:59:49.000Z | peitho/errors_and_parsers/abc_sysbio/abcsysbio_parser/ParseAndWrite.py | MichaelPHStumpf/Peitho | a4daa9a3b2d8960079573d08d5baa019b5ac857e | [
"MIT"
] | null | null | null | peitho/errors_and_parsers/abc_sysbio/abcsysbio_parser/ParseAndWrite.py | MichaelPHStumpf/Peitho | a4daa9a3b2d8960079573d08d5baa019b5ac857e | [
"MIT"
] | 3 | 2018-01-05T22:00:09.000Z | 2018-12-25T13:32:10.000Z | from peitho.errors_and_parsers.abc_sysbio.abcsysbio_parser.ODEPythonWriter import ODEPythonWriter
from peitho.errors_and_parsers.abc_sysbio.abcsysbio_parser.GillespiePythonWriter import GillespiePythonWriter
from peitho.errors_and_parsers.abc_sysbio.abcsysbio_parser.SDEPythonWriter import SDEPythonWriter
from peitho.errors_and_parsers.abc_sysbio.abcsysbio_parser.ODECUDAWriter import OdeCUDAWriter
from peitho.errors_and_parsers.abc_sysbio.abcsysbio_parser.SDECUDAWriter import SdeCUDAWriter
from peitho.errors_and_parsers.abc_sysbio.abcsysbio_parser.GillespieCUDAWriter import GillespieCUDAWriter
#from CWriter import CWriter
from peitho.errors_and_parsers.abc_sysbio.abcsysbio_parser.CandPythonParser import CandPythonParser
from peitho.errors_and_parsers.abc_sysbio.abcsysbio_parser.SDEAndGillespieCUDAParser import SdeAndGillespieCUDAParser
from peitho.errors_and_parsers.abc_sysbio.abcsysbio_parser.ODECUDAParser import OdeCUDAParser
import re
def ParseAndWrite(source, integrationType, modelName = None, inputPath = "", outputPath = "", method = None):
"""
***** args *****
source:
a list of strings.
Each tuple entry describes a SBML file to be parsed.
integrationType:
a list of strings.
The length of this tuple is determined by the number of SBML
files to be parsed. Each entry describes the simulation algorithm.
Possible algorithms are:
ODE --- for deterministic systems; solved with odeint (scipy)
SDE --- for stochastic systems; solved with sdeint (abc)
Gillespie --- for staochastic systems; solved with GillespieAlgorithm (abc)
***** kwargs *****
modelName:
a list of strings.
modelName describes the names of the parsed model files.
method:
an integer number.
Type of noise in a stochastic system.
(Only implemented for stochastic systems solved with sdeint.)
Possible options are:
1 --- default
2 --- Ornstein-Uhlenbeck
3 --- geometric Brownian motion
"""
#regular expressions for detecting integration types and integration language
c=re.compile('C', re.IGNORECASE)
py=re.compile('Python', re.I)
cuda=re.compile('CUDA', re.I)
ode=re.compile('ODE', re.I)
sde=re.compile('SDE', re.I)
heun=re.compile('Heun', re.I)
milstein=re.compile('Milstein', re.I)
gil = re.compile('Gillespie', re.I)
#check that you have appropriate lengths of integration types and sources
#(need equal lengths)
if(not(len(source)==len(integrationType))):
print "\nError: Number of sources is not the same as number of integrationTypes!\n"
#check that you have model names,
#if not the models will be named model1, model2, etc
else:
if(modelName==None):
modelName=[]
for x in range(0,len(source)):
modelName.append("model"+repr(x+1))
else:
for x in range(0,len(modelName)):
if(modelName[x]==""):
modelName[x]="model"+repr(x+1)
#if no method is specified and the integrationType is "SDE"
#the method type defaults to 1
for model in range(0,len(source)):
if cuda.search(integrationType[model]):
if(not(sde.search(integrationType[model]) or gil.search(integrationType[model]) or ode.search(integrationType[model]))):
print "\nError: an integration type is required for CUDA"
elif (sde.search(integrationType[model])):
if(heun.search(integrationType[model]) or milstein.search(integrationType[model])):
print "\nError: Only Euler is available in Cuda"
else:
if(method==None or method[model]==""):
parser = SdeAndGillespieCUDAParser(source[model], modelName[model], "CUDA SDE", 1, inputPath, outputPath)
else:
parser = SdeAndGillespieCUDAParser(source[model], modelName[model], "CUDA SDE", method[model], inputPath, outputPath)
elif(gil.search(integrationType[model])):
parser = SdeAndGillespieCUDAParser(source[model], modelName[model], integrationType[model], None, inputPath, outputPath)
else:
parser = OdeCUDAParser(source[model], modelName[model], integrationType[model], None, inputPath, outputPath)
elif c.search(integrationType[model]):
if (sde.search(integrationType[model])):
if (not (method==None or method==1)):
print "\nError: Only the method 1 of SDE resolution can be used in C"
else:
parser = CandPythonParser(source[model],modelName[model], "C", None, inputPath, outputPath)
else:
parser = CandPythonParser(source[model],modelName[model], "C", None, inputPath, outputPath)
elif py.search(integrationType[model]):
if(integrationType==None):
print "\nError: an integration type is required for Python"
elif (sde.search(integrationType[model])):
if(heun.search(integrationType[model]) or milstein.search(integrationType[model])):
print "\nError: Only Euler is available in Python"
else:
if(method==None or method[model]==""):
parser = CandPythonParser(source[model], modelName[model], "Python SDE", 1, inputPath, outputPath)
else:
parser = CandPythonParser(source[model], modelName[model], "Python SDE", method[model], inputPath, outputPath)
else:
parser = CandPythonParser(source[model], modelName[model], integrationType[model], None, inputPath, outputPath)
| 51.352 | 145 | 0.598068 |
4e3fc3968ee8f0017872bef877f1376109518f81 | 390 | py | Python | unitests/argcat_unit_test.py | dex1n/ArgCat | 3ff28426d7f497ce417ebd42c4832789e3b3b4b0 | [
"MIT"
] | 1 | 2021-03-21T06:56:43.000Z | 2021-03-21T06:56:43.000Z | unitests/argcat_unit_test.py | dex1n/ArgCat | 3ff28426d7f497ce417ebd42c4832789e3b3b4b0 | [
"MIT"
] | null | null | null | unitests/argcat_unit_test.py | dex1n/ArgCat | 3ff28426d7f497ce417ebd42c4832789e3b3b4b0 | [
"MIT"
] | null | null | null | import unittest
import os
import sys
| 32.5 | 96 | 0.725641 |
4e3fe1c8c8818994caf91d65e4c3869ac570639f | 173 | py | Python | Year calculation.py | alaminskaib/PythonPrograms | 0112715d7700a4ebfd0da64a62f8ac20a43f7c79 | [
"MIT"
] | 2 | 2019-11-11T17:19:10.000Z | 2019-11-11T17:22:46.000Z | Year calculation.py | alaminskaib/PythonPrograms | 0112715d7700a4ebfd0da64a62f8ac20a43f7c79 | [
"MIT"
] | null | null | null | Year calculation.py | alaminskaib/PythonPrograms | 0112715d7700a4ebfd0da64a62f8ac20a43f7c79 | [
"MIT"
] | null | null | null | year= int(input("Give the value of year:"))
if((year%4==0 and year%100==0) or (Year%400==0)):
print("This is a leap year")
else:
print("This is not leap year")
| 28.833333 | 50 | 0.606936 |
4e408675dcb9ee527589d07af00ac4cec8b7ef57 | 535 | py | Python | innterpret/attribution/patternattr.py | paudom/iNNterpret | 8e6a4fc43bfc497e26fea37942765a5efaf5b7c4 | [
"MIT"
] | 2 | 2019-03-08T12:23:03.000Z | 2019-07-05T14:05:19.000Z | innterpret/attribution/patternattr.py | paudom/iNNterpret | 8e6a4fc43bfc497e26fea37942765a5efaf5b7c4 | [
"MIT"
] | 7 | 2020-01-28T22:38:40.000Z | 2022-03-11T23:44:34.000Z | innterpret/attribution/patternattr.py | paudom/iNNterpret | 8e6a4fc43bfc497e26fea37942765a5efaf5b7c4 | [
"MIT"
] | null | null | null | from __future__ import absolute_import
#-- IMPORT -- #
from ..utils.interfaces import Method | 17.833333 | 55 | 0.650467 |
9d62368843928d090cd812f1e7a939bf13155d3f | 988 | py | Python | tests/mock_urllib.py | cedricduriau/PackagerBuddy | 3eda40cd1b72f030e4f02e38af452e6377b20148 | [
"MIT"
] | 1 | 2019-01-10T11:15:40.000Z | 2019-01-10T11:15:40.000Z | tests/mock_urllib.py | cedricduriau/PackagerBuddy | 3eda40cd1b72f030e4f02e38af452e6377b20148 | [
"MIT"
] | 6 | 2019-01-06T16:56:22.000Z | 2019-01-07T01:43:54.000Z | tests/mock_urllib.py | cedricduriau/PackagerBuddy | 3eda40cd1b72f030e4f02e38af452e6377b20148 | [
"MIT"
] | null | null | null | # stdlib modules
try:
from urllib.response import addinfourl
from urllib.error import HTTPError
from urllib.request import HTTPHandler
from io import StringIO
except ImportError:
from urllib2 import addinfourl, HTTPError, HTTPHandler
from StringIO import StringIO
| 29.058824 | 68 | 0.648785 |
9d6381be8993257224fb80b97034c3a236987a13 | 2,192 | py | Python | slickbird/web/hcollection.py | lpenz/slickbird | 1ad6c615be7edbc0c8c5abd97373058abea3d794 | [
"Apache-2.0"
] | null | null | null | slickbird/web/hcollection.py | lpenz/slickbird | 1ad6c615be7edbc0c8c5abd97373058abea3d794 | [
"Apache-2.0"
] | null | null | null | slickbird/web/hcollection.py | lpenz/slickbird | 1ad6c615be7edbc0c8c5abd97373058abea3d794 | [
"Apache-2.0"
] | null | null | null | '''Slickbird collection handler'''
import logging
import json
from tornado.web import URLSpec
import tornado.web
from slickbird import datparse
import slickbird.orm as orm
import slickbird
from slickbird.web import hbase
_log.logger = None
# Add handler: ###############################################################
# API: #######################################################################
# Install: ###################################################################
def install(app):
app.add_handlers('.*', [
URLSpec(r'/collection/add',
CollectionAddHandler,
name='collection_add'),
URLSpec(r'/collection/list',
hbase.genPageHandler('collection_lst'),
name='collection_lst'),
URLSpec(r'/api/collection_lst.json',
CollectionListDataHandler,
name='api_collection_lst'),
])
| 28.842105 | 78 | 0.570255 |
9d664e109ebe34ba1e2952a24047d4157da5bc86 | 715 | py | Python | connected_devices.py | savlakaran/bluetooth-profile-manager | a485560cecd6668241539d7d7fa96756a1a8dc9f | [
"MIT"
] | null | null | null | connected_devices.py | savlakaran/bluetooth-profile-manager | a485560cecd6668241539d7d7fa96756a1a8dc9f | [
"MIT"
] | null | null | null | connected_devices.py | savlakaran/bluetooth-profile-manager | a485560cecd6668241539d7d7fa96756a1a8dc9f | [
"MIT"
] | null | null | null | import pydbus
bus = pydbus.SystemBus()
adapter = bus.get('org.bluez', '/org/bluez/hci0')
mngr = bus.get('org.bluez', '/')
if __name__ == '__main__':
connected = list_connected_devices()
for item in connected:
print(item['name']) | 31.086957 | 88 | 0.625175 |
9d66606d079a0a649bc4ef6dda1629c7be67e773 | 5,079 | py | Python | etl_base/etl_base/dags/acme/operators/file_operators.py | buckylee2019/sqlg-airflow | 37610a23b99bea8d9fdc8b066a01736ff2ff0c9d | [
"Apache-2.0"
] | null | null | null | etl_base/etl_base/dags/acme/operators/file_operators.py | buckylee2019/sqlg-airflow | 37610a23b99bea8d9fdc8b066a01736ff2ff0c9d | [
"Apache-2.0"
] | null | null | null | etl_base/etl_base/dags/acme/operators/file_operators.py | buckylee2019/sqlg-airflow | 37610a23b99bea8d9fdc8b066a01736ff2ff0c9d | [
"Apache-2.0"
] | 1 | 2022-03-10T03:47:35.000Z | 2022-03-10T03:47:35.000Z | # -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os, fnmatch
import logging
from shutil import copyfile
from airflow.contrib.hooks.fs_hook import FSHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
from datetime import datetime
# You can also make this format a parameter in the Operator, for example
# if you expect that you work with different intervals than "@daily".
# Then you can introduce time components to have a finer grain for file storage.
DATE_FORMAT = '%Y%m%d'
| 40.632 | 105 | 0.669817 |
9d675985cd1e3fa2d6a896298711a9c21776ae26 | 7,052 | py | Python | pyllusion/image/utilities.py | RebeccaHirst/Pyllusion | 9944076e38bced0eabb49c607482b71809150bdb | [
"MIT"
] | null | null | null | pyllusion/image/utilities.py | RebeccaHirst/Pyllusion | 9944076e38bced0eabb49c607482b71809150bdb | [
"MIT"
] | null | null | null | pyllusion/image/utilities.py | RebeccaHirst/Pyllusion | 9944076e38bced0eabb49c607482b71809150bdb | [
"MIT"
] | null | null | null | import numpy as np
import PIL.ImageColor, PIL.ImageFont
from .rescale import rescale
def _rgb(x):
"""Convert 0-1 values to RGB 0-255 values.
"""
return rescale(x, to=[0, 255], scale=[0, 1])
def _color(color="black", alpha=1, mode="RGB"):
"""Sanitize color to RGB(A) format.
"""
if isinstance(color, str):
if color == "transparent":
return (0, 0, 0, 0)
color = PIL.ImageColor.getrgb(color)
elif isinstance(color, (int, np.integer)):
color = tuple([color] * 3)
elif isinstance(color, (list, np.ndarray)):
color = tuple(color)
# Add transparency
if mode == "RGBA":
if len(color) == 3:
color = color + tuple([np.int(_rgb(alpha))])
return color
def _coord_circle(image, diameter=0.1, x=0, y=0, unit="grid", method="pil"):
"""Get circle coordinates
Examples
--------
>>> import pyllusion as ill
>>> import PIL.Image, PIL.ImageDraw
>>>
>>> image = PIL.Image.new('RGB', (500, 400), color = "white")
>>> draw = PIL.ImageDraw.Draw(image, 'RGBA')
>>>
>>> coord = _coord_circle(image, diameter=1, x=0, y=0)
>>> draw.ellipse(coord, fill="red", width=0)
>>> draw.ellipse(_coord_circle(image, diameter=1.5, x=0, y=0), outline="blue")
>>> image #doctest: +ELLIPSIS
<PIL.Image.Image ...>
"""
if unit == "grid":
# Get coordinates in pixels
width, height = image.size
x = np.int(rescale(x, to=[0, width], scale=[-1, 1]))
if method == "pil":
y = np.int(rescale(-y, to=[0, height], scale=[-1, 1]))
elif method == "psychopy":
y = np.int(rescale(y, to=[0, height], scale=[-1, 1]))
# Convert diameter based on height
diameter = np.int(rescale(diameter, to=[0, height], scale=[0, 2]))
diameter = 2 if diameter < 2 else diameter
radius = diameter / 2
# Choose diameter and centre
coord = [(x - radius, y - radius), (x + radius, y + radius)]
if method == "pil":
return coord
elif method == "psychopy":
return radius, x, y
def _coord_text(
image, text="hello", size="auto", x=0, y=0, font="arial.ttf", unit="grid",
method="pil"
):
"""Get text coordinates
Examples
--------
>>> import pyllusion as ill
>>> import PIL.Image, PIL.ImageDraw
>>>
>>> image = PIL.Image.new('RGB', (500, 500), color = "white")
>>> draw = PIL.ImageDraw.Draw(image, 'RGB')
>>>
>>> coord, font = _coord_text(image, size="auto", x=-0.5, y=0.5) #doctest: +SKIP
>>> draw.text(coord, text="hello", fill="black", font=font) #doctest: +SKIP
>>> image #doctest: +SKIP
"""
if unit == "grid":
# Get coordinates in pixels
width, height = image.size
x = np.int(rescale(x, to=[0, width], scale=[-1, 1]))
if method == "pil":
y = np.int(rescale(-y, to=[0, height], scale=[-1, 1]))
elif method == "psychopy":
y = np.int(rescale(y, to=[0, height], scale=[-1, 1]))
if size == "auto":
# Initialize values
size, top_left_x, top_left_y, right_x, bottom_y = 0, width, height, 0, 0
# Loop until max size is reached
while (
top_left_x > 0.01 * width
and right_x < 0.99 * width
and top_left_y > 0.01 * height
and bottom_y < 0.99 * height
):
loaded_font = PIL.ImageFont.truetype(font, size)
text_width, text_height = loaded_font.getsize(text)
top_left_x = x - (text_width / 2)
top_left_y = y - (text_height / 2)
right_x = top_left_x + text_width
bottom_y = top_left_y + text_height
size += 1 # Increment text size
else:
loaded_font = PIL.ImageFont.truetype(font, size)
text_width, text_height = loaded_font.getsize(text)
top_left_x = x - (text_width / 2)
top_left_y = y - (text_height / 2)
coord = top_left_x, top_left_y
return coord, loaded_font, x, y
def _coord_line(
image=None,
x=0,
y=0,
x1=None,
y1=None,
x2=None,
y2=None,
length=None,
angle=None,
adjust_width=False,
adjust_height=False,
method="pil",
):
"""
"""
# Center to None if x1 entered
x = None if x1 is not None else x
y = None if y1 is not None else y
# Get missing parameters
if x is None and y is None:
if x2 is None and y2 is None:
x2, y2 = _coord_line_x2y2(x1, y1, length, angle)
if length is None and angle is None:
length, angle = _coord_line_lengthangle(x1, y1, x2, y2)
else:
if x2 is None and y2 is None:
x2, y2 = _coord_line_x2y2(x, y, length / 2, angle)
if length is None and angle is None:
length, angle = _coord_line_lengthangle(x, y, x2, y2)
length = length * 2
x1, y1 = _coord_line_x2y2(x2, y2, length, 180 + angle)
# Get coordinates in pixels
if image is not None:
width, height = image.size
if adjust_width is True:
x1, x2 = x1 * (height / width), x2 * (height / width)
if adjust_height is True:
y1, y2 = y1 * (width / height), y2 * (width / height)
x1 = np.int(rescale(x1, to=[0, width], scale=[-1, 1]))
x2 = np.int(rescale(x2, to=[0, width], scale=[-1, 1]))
if method == "pil":
y1 = np.int(rescale(-y1, to=[0, height], scale=[-1, 1]))
y2 = np.int(rescale(-y2, to=[0, height], scale=[-1, 1]))
elif method == "psychopy":
y1 = np.int(rescale(y1, to=[0, height], scale=[-1, 1]))
y2 = np.int(rescale(y2, to=[0, height], scale=[-1, 1]))
length = np.int(rescale(length, to=[0, height], scale=[0, 2]))
return (x1, y1, x2, y2), length, angle
def _coord_rectangle(image=None, x=0, y=0, size_width=1, size_height=1, method="pil"):
"""
"""
x1 = x - (size_width / 2)
y1 = y + (size_height / 2)
x2 = x + (size_width / 2)
y2 = y - (size_height / 2)
# Get coordinates in pixels
if image is not None:
width, height = image.size
x1 = np.int(rescale(x1, to=[0, width], scale=[-1, 1]))
x2 = np.int(rescale(x2, to=[0, width], scale=[-1, 1]))
if method == "pil":
y1 = np.int(rescale(-y1, to=[0, height], scale=[-1, 1]))
y2 = np.int(rescale(-y2, to=[0, height], scale=[-1, 1]))
elif method == "psychopy":
y1 = np.int(rescale(y1, to=[0, height], scale=[-1, 1]))
y2 = np.int(rescale(y2, to=[0, height], scale=[-1, 1]))
return (x1, y1, x2, y2)
| 32.648148 | 86 | 0.548497 |
9d67bc8055c64e00d851f4955360ca97f28db935 | 6,971 | py | Python | pyfluka/pyfluka_merge.py | morgenst/pyfluka | 6dd3aa8cc29cfce0b2f084fb6b08bdebd2233298 | [
"MIT"
] | null | null | null | pyfluka/pyfluka_merge.py | morgenst/pyfluka | 6dd3aa8cc29cfce0b2f084fb6b08bdebd2233298 | [
"MIT"
] | null | null | null | pyfluka/pyfluka_merge.py | morgenst/pyfluka | 6dd3aa8cc29cfce0b2f084fb6b08bdebd2233298 | [
"MIT"
] | null | null | null | import sys
import argparse
import fnmatch
import os
import re
import shutil
import glob
import logging
import multiprocessing
from copy_reg import pickle
from types import MethodType
_logger = logging.getLogger('default')
_logger.addHandler(logging.StreamHandler())
_logger.setLevel(logging.CRITICAL)
def main(argv):
parser = argparse.ArgumentParser(description='Script for merging fluka bin data')
parser.add_argument('path', help='input path')
parser.add_argument('--card', '-c', required=False, default=None, help='card')
parser.add_argument('--bins', '-b', required=False, default=None, type=int, nargs='+', help='bins')
parser.add_argument('--output', '-o', default=None, help='output directory')
parser.add_argument('--debug', '-d', action='store_true', default=False, help='Switch on debug messages')
args = parser.parse_args()
if args.debug:
_logger.setLevel(logging.DEBUG)
path = os.path.abspath(args.path)
if not args.card and not args.bins:
parser = InputParser(path)
scoring_cards = parser.parse()
else:
scoring_cards = {args.card : args.bins}
merger = Merger(path, args.output)
merger.merge(scoring_cards)
if __name__ == '__main__':
main(sys.argv[1:])
| 36.307292 | 125 | 0.551427 |
9d6864036da06d6197930101a35bf7b6e92aebea | 1,325 | py | Python | calculation.py | n-a-iliev/NBA-PER-Calculator | 590c617cc8c47009224a33f60fc4cba75f4b26bd | [
"MIT"
] | null | null | null | calculation.py | n-a-iliev/NBA-PER-Calculator | 590c617cc8c47009224a33f60fc4cba75f4b26bd | [
"MIT"
] | null | null | null | calculation.py | n-a-iliev/NBA-PER-Calculator | 590c617cc8c47009224a33f60fc4cba75f4b26bd | [
"MIT"
] | null | null | null | from balldontlie import balldontlie, player, stats
from matplotlib import pyplot as plt
'''This function gets more information about the player by inputting
their name and dataset to search'''
if __name__ == "__main__":
main()
| 33.974359 | 99 | 0.659623 |