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
fb097754f4efecf6545051b20dad8dee8adaa09e
1,136
py
Python
cyto/basic/_dict.py
sbtinstruments/cyto
f452562e5e9ae9d2516cd92958af6e6a2c985dcc
[ "MIT" ]
5
2021-04-03T04:09:38.000Z
2021-12-17T15:05:18.000Z
cyto/basic/_dict.py
sbtinstruments/cyto
f452562e5e9ae9d2516cd92958af6e6a2c985dcc
[ "MIT" ]
1
2021-04-21T17:00:29.000Z
2021-04-21T19:12:30.000Z
cyto/basic/_dict.py
sbtinstruments/cyto
f452562e5e9ae9d2516cd92958af6e6a2c985dcc
[ "MIT" ]
null
null
null
from typing import Any, Dict def deep_update(dest: Dict[Any, Any], other: Dict[Any, Any]) -> None: """Update `dest` with the key/value pairs from `other`. Returns `None`. Note that we modify `dest` in place. Unlike the built-in `dict.Update`, `deep_update` recurses into sub-dictionaries. This effectively "merges" `other` into `dest`. Note that we do not recurse into lists. We treat lists like any other non-`dict` type and simply override the existing entry in `dest` (if any). """ for key, other_val in other.items(): # Simple case: `key` is not in `dest`, so we simply add it. if key not in dest: dest[key] = other_val continue # Complex case: There is a conflict, so we must "merge" `dest_val` # and `other_val`. dest_val = dest[key] # Given two dicts, we can simply recurse. if isinstance(dest_val, dict) and isinstance(other_val, dict): deep_update(dest_val, other_val) # Any other type combination simply overrides the existing key in `dest` else: dest[key] = other_val
39.172414
84
0.634683
fb0b0d61a04227b98b766bf05a1daba731f1fb99
2,312
py
Python
api_logic_server_cli/create_from_model/ui_basic_web_app_run.py
valhuber/ApiLogicServer
a4acd8d886a18d4d500e0fffffcaa2f1c0765040
[ "BSD-3-Clause" ]
71
2021-01-23T17:34:33.000Z
2022-03-29T13:11:29.000Z
api_logic_server_cli/create_from_model/ui_basic_web_app_run.py
valhuber/ApiLogicServer
a4acd8d886a18d4d500e0fffffcaa2f1c0765040
[ "BSD-3-Clause" ]
38
2021-01-24T21:56:30.000Z
2022-03-08T18:49:00.000Z
api_logic_server_cli/create_from_model/ui_basic_web_app_run.py
valhuber/ApiLogicServer
a4acd8d886a18d4d500e0fffffcaa2f1c0765040
[ "BSD-3-Clause" ]
14
2021-01-23T16:20:44.000Z
2022-03-24T10:48:28.000Z
# runs ApiLogicServer basic web app: # python ui/basic_web_app/run.py # Export PYTHONPATH, to enable python ui/basic_web_app/run.py import os, sys, logging from pathlib import Path logger = logging.getLogger() current_path = Path(os.path.abspath(os.path.dirname(__file__))) current_path = current_path.parent.absolute() # ui current_path = current_path.parent.absolute() # project project_dir = str(current_path) sys.path.append(project_dir) import ui.basic_web_app.config as config handler = logging.StreamHandler(sys.stderr) handler.setLevel(logging.INFO) # DEBUG, INFO, <default> WARNING, ERROR, CRITICAL auto_log_narrow = True if auto_log_narrow and config.SQLALCHEMY_DATABASE_URI.endswith("db.sqlite"): formatter = logging.Formatter('%(message).120s') # lead tag - '%(name)s: %(message)s') else: formatter = logging.Formatter('%(message)s') handler.setFormatter(formatter) logger.addHandler(handler) logger.propagate = True fab_logger = logging.getLogger("flask_appbuilder") fab_logger.setLevel(logging.WARNING) logic_logger = logging.getLogger("logic_logger") logic_logger.setLevel(logging.INFO) logger.setLevel(logging.WARNING) # WARNING to reduce output, INFO for more logger.info(f'ui/basic_web_app/run.py - project_dir: {project_dir}') if auto_log_narrow and config.SQLALCHEMY_DATABASE_URI.endswith("db.sqlite"): logger.warning("\nLog width reduced for readability - " "see https://github.com/valhuber/ApiLogicServer/wiki/Tutorial#word-wrap-on-the-log\n") # args for help import sys if len(sys.argv) > 1 and sys.argv[1].__contains__("help"): print("") print("basic_web_app - run instructions (defaults are host 0.0.0.0, port 5002):") print(" python run.py [host [port]]") print("") sys.exit() try: logger.debug("\nui/basic_web_app/run.py - PYTHONPATH" + str(sys.path) + "\n") # e.g., /Users/val/dev/servers/api_logic_server/ui/basic_web_app from app import app # ui/basic_web_app/app/__init__.py activates logic except Exception as e: logger.error("ui/basic_web_app/run.py - Exception importing app: " + str(e)) # args to avoid port conflicts, e.g., localhost 8080 host = sys.argv[1] if sys.argv[1:] \ else "0.0.0.0" port = sys.argv[2] if sys.argv[2:] \ else "5002" app.run(host=host, port=port, debug=True)
36.125
105
0.733131
fb0b24730ac65daad4c5e515482703fc512b4066
300
py
Python
output/models/nist_data/list_pkg/non_positive_integer/schema_instance/nistschema_sv_iv_list_non_positive_integer_length_1_xsd/__init__.py
tefra/xsdata-w3c-tests
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
[ "MIT" ]
1
2021-08-14T17:59:21.000Z
2021-08-14T17:59:21.000Z
output/models/nist_data/list_pkg/non_positive_integer/schema_instance/nistschema_sv_iv_list_non_positive_integer_length_1_xsd/__init__.py
tefra/xsdata-w3c-tests
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
[ "MIT" ]
4
2020-02-12T21:30:44.000Z
2020-04-15T20:06:46.000Z
output/models/nist_data/list_pkg/non_positive_integer/schema_instance/nistschema_sv_iv_list_non_positive_integer_length_1_xsd/__init__.py
tefra/xsdata-w3c-tests
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
[ "MIT" ]
null
null
null
from output.models.nist_data.list_pkg.non_positive_integer.schema_instance.nistschema_sv_iv_list_non_positive_integer_length_1_xsd.nistschema_sv_iv_list_non_positive_integer_length_1 import NistschemaSvIvListNonPositiveIntegerLength1 __all__ = [ "NistschemaSvIvListNonPositiveIntegerLength1", ]
50
233
0.91
fb0c48302e90f96e57473fb786d4ea50f4be0f46
190
py
Python
cbot/__init__.py
wangyitao/cbot
6b2500f5118ddd5ef581f31104e70e5a57b72f7d
[ "MIT" ]
8
2018-10-18T09:15:36.000Z
2019-09-01T04:42:59.000Z
cbot/__init__.py
wangyitao/cbot
6b2500f5118ddd5ef581f31104e70e5a57b72f7d
[ "MIT" ]
1
2018-10-19T06:35:38.000Z
2018-10-19T06:35:38.000Z
cbot/__init__.py
wangyitao/cbot
6b2500f5118ddd5ef581f31104e70e5a57b72f7d
[ "MIT" ]
5
2018-10-19T05:56:26.000Z
2019-09-01T04:43:11.000Z
from .main import CBot __version__ = '0.1.0' __author__ = 'Felix Wang' __email__ = 'felix2@foxmail.com' __url__ = 'https://github.com/wangyitao/cbot' __all__ = ( 'CBot', )
15.833333
46
0.636842
fb0e6ce0d08d8c7d2254af54405bab1d2071c99d
4,219
py
Python
elastic_inference/apps/infer_service.py
qzheng527/cloud-native-demos
e2dbcfc0d90c1972bc34a35f5d85f83f2b2b6cf6
[ "Apache-2.0" ]
1
2020-04-06T10:11:27.000Z
2020-04-06T10:11:27.000Z
elastic_inference/apps/infer_service.py
qzheng527/cloud-native-demos
e2dbcfc0d90c1972bc34a35f5d85f83f2b2b6cf6
[ "Apache-2.0" ]
null
null
null
elastic_inference/apps/infer_service.py
qzheng527/cloud-native-demos
e2dbcfc0d90c1972bc34a35f5d85f83f2b2b6cf6
[ "Apache-2.0" ]
2
2021-01-19T21:42:08.000Z
2021-08-13T19:59:06.000Z
#!/usr/bin/python3 """ Infer service. It pick up single frame from frame queue and do inference. The result will be published to stream broker like below. +---------------------+ +---------------+ +-----------------------+ | Frame Queue (redis) | => | Infer Service | => | Stream broker (redis) | +---------------------+ +---------------+ +-----------------------+ || ## +--------------------------------+ | Infer Frame Speed (prometheus) | +--------------------------------+ The infer service can be scaled by kubernete HPA(Horizontal Pod Autoscale) dynamically according to the metrics like "drop frame speed", "infer frame speed" "CPU usage" etc. """ import os import sys import logging import signal import socket import redis import prometheus_client as prom # add current path into PYTHONPATH APP_PATH = os.path.dirname(__file__) sys.path.append(APP_PATH) from clcn.appbase import CLCNAppBase # pylint: disable=wrong-import-position from clcn.frame import RedisFrameQueue # pylint: disable=wrong-import-position from clcn.stream import RedisStreamBroker # pylint: disable=wrong-import-position from clcn.nn.inferengine import OpenVinoInferEngineTask # pylint: disable=wrong-import-position LOG = logging.getLogger(__name__) def start_app(): """ App entry. """ app = InferServiceApp() # setup the signal handler signames = ['SIGINT', 'SIGHUP', 'SIGQUIT', 'SIGUSR1'] for name in signames: signal.signal(getattr(signal, name), signal_handler) app.run_and_wait_task() if __name__ == "__main__": start_app()
35.158333
99
0.599194
fb0ed9b104a5cd8f1fa264f1f6318ff1bd1ed415
288
py
Python
P25010-Guangzhou-Jiachengwu/week07/ex_filecopy.py
xiaohh2016/python-25
8981ba89bfb32754c3f9c881ee8fcaf13332ce51
[ "Apache-2.0" ]
1
2019-09-11T23:24:58.000Z
2019-09-11T23:24:58.000Z
P25010-Guangzhou-Jiachengwu/week07/ex_filecopy.py
xiaohh2016/python-25
8981ba89bfb32754c3f9c881ee8fcaf13332ce51
[ "Apache-2.0" ]
null
null
null
P25010-Guangzhou-Jiachengwu/week07/ex_filecopy.py
xiaohh2016/python-25
8981ba89bfb32754c3f9c881ee8fcaf13332ce51
[ "Apache-2.0" ]
5
2019-09-11T06:33:34.000Z
2020-02-17T12:52:31.000Z
# Python copya,copyb import os from pathlib import Path import shutil src_path=Path('a/test') dst_path=Path('b/test') with open(src_path,'w') as src_file: src_file.write('abcd\n1234') shutil.copy(src_path,dst_path) print(os.stat(src_path)) print(os.stat(dst_path))
18
36
0.756944
fb0fe20410b5c56d7291f72bd22a841605532524
548
py
Python
vanirio/module/interface/textfield.py
vaniriovanhalteren/sdk-python
947b08fbe046d46275bf39bc95984fbf3edc0e6c
[ "MIT" ]
null
null
null
vanirio/module/interface/textfield.py
vaniriovanhalteren/sdk-python
947b08fbe046d46275bf39bc95984fbf3edc0e6c
[ "MIT" ]
null
null
null
vanirio/module/interface/textfield.py
vaniriovanhalteren/sdk-python
947b08fbe046d46275bf39bc95984fbf3edc0e6c
[ "MIT" ]
1
2022-02-08T08:15:07.000Z
2022-02-08T08:15:07.000Z
from vanirio.module.interface.base import Base
24.909091
70
0.600365
fb1042dc49fa8be20e43a1d8892da1c69f7bf202
2,348
py
Python
utils.py
lanyinemt2/ST-PlusPlus
7c31abfcf21e390a06c4d5da1f77a9fe5ff071ed
[ "MIT" ]
73
2021-06-10T01:12:04.000Z
2022-03-30T08:31:24.000Z
utils.py
lanyinemt2/ST-PlusPlus
7c31abfcf21e390a06c4d5da1f77a9fe5ff071ed
[ "MIT" ]
12
2021-07-01T00:27:11.000Z
2022-03-17T05:09:49.000Z
utils.py
lanyinemt2/ST-PlusPlus
7c31abfcf21e390a06c4d5da1f77a9fe5ff071ed
[ "MIT" ]
18
2021-06-10T11:24:31.000Z
2022-03-31T16:48:58.000Z
import numpy as np from PIL import Image
33.070423
106
0.520017
fb107ee4532ec8cc33a8bdd76e5d3973b9f4d818
3,671
py
Python
lib/bus/client.py
hoffmannmatheus/eaZy
d79ade0e01a23f1c6fa585ee378ed70c95976b05
[ "MIT", "Unlicense" ]
3
2015-01-11T15:29:48.000Z
2020-09-08T14:52:14.000Z
lib/bus/client.py
hoffmannmatheus/eaZy
d79ade0e01a23f1c6fa585ee378ed70c95976b05
[ "MIT", "Unlicense" ]
null
null
null
lib/bus/client.py
hoffmannmatheus/eaZy
d79ade0e01a23f1c6fa585ee378ed70c95976b05
[ "MIT", "Unlicense" ]
null
null
null
import zmq import json """ Class used by the Client entity to communicate to the Server. The communication channel should be configured using the three ports: - com_port: Used to receive broadcast messages from the Server entity. - set_port: Used to send messages/request data to the Server entity. - res_port: Used to receive a responce from a Server. """ defaults = { 'host' : '127.0.0.1', 'com_port' : 5556, 'set_port' : 5557, 'res_port' : 5558 } context = zmq.Context()
35.990196
79
0.625443
fb12ef0139d2387d5de8cd18fde96987527d5c7f
2,821
py
Python
ops.py
fivoskal/MGAN
2eb1407c907af5f472a80e8ae363bee57d5cfaa4
[ "MIT" ]
37
2018-03-07T15:32:09.000Z
2022-03-01T06:54:06.000Z
ops.py
fivoskal/MGAN
2eb1407c907af5f472a80e8ae363bee57d5cfaa4
[ "MIT" ]
2
2018-09-19T23:20:07.000Z
2019-06-15T13:45:54.000Z
ops.py
fivoskal/MGAN
2eb1407c907af5f472a80e8ae363bee57d5cfaa4
[ "MIT" ]
18
2018-05-23T11:09:34.000Z
2022-03-22T08:38:13.000Z
from __future__ import division from __future__ import print_function from __future__ import absolute_import import numpy as np import tensorflow as tf
39.732394
98
0.611485
fb176c1fa7c1a70a322d3da71abe867bb4b0b96a
2,431
py
Python
spacy/tests/regression/test_issue999.py
cmgreivel/spaCy
a31506e06060c559abfeda043503935691af2e98
[ "MIT" ]
88
2018-05-06T17:28:23.000Z
2022-03-06T20:19:16.000Z
spacy/tests/regression/test_issue999.py
cmgreivel/spaCy
a31506e06060c559abfeda043503935691af2e98
[ "MIT" ]
12
2018-07-19T15:11:57.000Z
2021-08-05T11:58:29.000Z
spacy/tests/regression/test_issue999.py
cmgreivel/spaCy
a31506e06060c559abfeda043503935691af2e98
[ "MIT" ]
10
2018-07-28T22:43:04.000Z
2020-11-22T22:58:21.000Z
from __future__ import unicode_literals import os import random import contextlib import shutil import pytest import tempfile from pathlib import Path import pathlib from ...gold import GoldParse from ...pipeline import EntityRecognizer from ...language import Language try: unicode except NameError: unicode = str # TODO: Fix when saving/loading is fixed.
29.646341
88
0.633073
fb19896662026b64b3faf3ab0b1d3c77cfab5f56
323
py
Python
mavisetc/__init__.py
jtmendel/mavisetc
4cd6800a7c4462f9a8063060c41e19719d35c5ee
[ "MIT" ]
null
null
null
mavisetc/__init__.py
jtmendel/mavisetc
4cd6800a7c4462f9a8063060c41e19719d35c5ee
[ "MIT" ]
null
null
null
mavisetc/__init__.py
jtmendel/mavisetc
4cd6800a7c4462f9a8063060c41e19719d35c5ee
[ "MIT" ]
null
null
null
try: from ._version import __version__ except(ImportError): pass from . import instruments from . import sources from . import sky from . import utils from . import telescopes from . import detectors from . import filters __all__ = ['instruments', 'sources', 'sky', 'utils', 'telescopes', 'detectors', 'filters']
21.533333
90
0.724458
fb1a14af54cb6584a01ac6a47d46cd0d5260f471
293
py
Python
tests/test_lqr_speed_steer_control.py
pruidzeko/PythonRobotics
5ff9b70d737121c2947d844ecfb1fa07abdd210c
[ "MIT" ]
38
2019-12-08T12:26:04.000Z
2022-03-06T11:29:08.000Z
tests/test_lqr_speed_steer_control.py
pruidzeko/PythonRobotics
5ff9b70d737121c2947d844ecfb1fa07abdd210c
[ "MIT" ]
61
2020-08-17T20:02:09.000Z
2022-03-14T20:01:01.000Z
tests/test_lqr_speed_steer_control.py
pruidzeko/PythonRobotics
5ff9b70d737121c2947d844ecfb1fa07abdd210c
[ "MIT" ]
15
2020-02-12T15:57:28.000Z
2021-08-28T07:39:18.000Z
from unittest import TestCase import sys sys.path.append("./PathTracking/lqr_speed_steer_control/") from PathTracking.lqr_speed_steer_control import lqr_speed_steer_control as m print(__file__)
18.3125
77
0.754266
fb1aa25d697063ac5234b37a20af2edde89cf7c2
825
py
Python
2 - python intermediario/63 - iteraveis/64 - comportamento iteradores e geradores.py
AdrianaViabL/Curso-Python-udemy
a4f230354985d0f6026a1e7b4913a8f64e205654
[ "Apache-2.0" ]
null
null
null
2 - python intermediario/63 - iteraveis/64 - comportamento iteradores e geradores.py
AdrianaViabL/Curso-Python-udemy
a4f230354985d0f6026a1e7b4913a8f64e205654
[ "Apache-2.0" ]
null
null
null
2 - python intermediario/63 - iteraveis/64 - comportamento iteradores e geradores.py
AdrianaViabL/Curso-Python-udemy
a4f230354985d0f6026a1e7b4913a8f64e205654
[ "Apache-2.0" ]
null
null
null
#lists, tuplas, strings -> sequencias -> iteraveis nome = 'nome qualquer' print('comportamento esperado de um valor iteravel') print('o valor vai sempre estar la para ser exibido novamente') for l in nome: print(l) print(nome) print(10 * '=====') iterador = iter(nome) try: # quando mostrado x valor de um iterador, o valor nao existe mais nessa variavel print(next(iterador)) # n print(next(iterador)) # o print(next(iterador)) # m print(next(iterador)) # e print(next(iterador)) except: pass print('CADE OS VALORES???') for i in iterador: print(i) print('\ntrabalhando com gerador\n') gerador = (letra for letra in nome) print(next(gerador)) print(next(gerador)) print(next(gerador)) print(next(gerador)) print(next(gerador)) print(10 * '======') for i in gerador: print(i)
21.153846
86
0.676364
fb1af2b6ba7c64773e3eb0f188fe914ea2ee6f01
1,002
py
Python
src/server/api/API_ingest/dropbox_handler.py
carlos-dominguez/paws-data-pipeline
5c224e1f259c079631df7d3514a873875c633221
[ "MIT" ]
27
2019-11-20T20:20:30.000Z
2022-01-31T17:24:55.000Z
src/server/api/API_ingest/dropbox_handler.py
mrcrnkovich/paws-data-pipeline
7c0bd4c5f23276f541611cb564f2f5abbb6b9887
[ "MIT" ]
348
2019-11-26T20:34:02.000Z
2022-02-27T20:28:20.000Z
src/server/api/API_ingest/dropbox_handler.py
mrcrnkovich/paws-data-pipeline
7c0bd4c5f23276f541611cb564f2f5abbb6b9887
[ "MIT" ]
20
2019-12-03T23:50:33.000Z
2022-02-09T18:38:25.000Z
import dropbox try: from secrets_dict import DROPBOX_APP except ImportError: # Not running locally print("Couldn't get DROPBOX_APP from file, trying environment **********") from os import environ try: DROPBOX_APP = environ['DROPBOX_APP'] except KeyError: # Not in environment # You're SOL for now print("Couldn't get DROPBOX_APP from file or environment")
27.833333
89
0.691617
fb1b088b1122df174835b7dea6617c979527dde6
32,165
py
Python
tests/card_tests/druid_tests.py
anuragpapineni/Hearthbreaker-evolved-agent
d519d42babd93e3567000c33a381e93db065301c
[ "MIT" ]
null
null
null
tests/card_tests/druid_tests.py
anuragpapineni/Hearthbreaker-evolved-agent
d519d42babd93e3567000c33a381e93db065301c
[ "MIT" ]
null
null
null
tests/card_tests/druid_tests.py
anuragpapineni/Hearthbreaker-evolved-agent
d519d42babd93e3567000c33a381e93db065301c
[ "MIT" ]
null
null
null
import random import unittest from hearthbreaker.agents.basic_agents import DoNothingBot from tests.agents.testing_agents import SelfSpellTestingAgent, EnemySpellTestingAgent, MinionPlayingAgent, \ EnemyMinionSpellTestingAgent, SpellTestingAgent from hearthbreaker.constants import CHARACTER_CLASS from hearthbreaker.game_objects import Game from hearthbreaker.replay import SavedGame from tests.testing_utils import generate_game_for, StackedDeck, mock from hearthbreaker.cards import *
40.818528
120
0.684626
fb1c201f8580630fba487344ba7ea5b8003a9260
111
py
Python
projectdjangoportfolio/jobs/admin.py
DevLuDaley/Portfolio
c7215a3b1e5337f9bbb2863bba598b3064ef69e5
[ "MIT" ]
null
null
null
projectdjangoportfolio/jobs/admin.py
DevLuDaley/Portfolio
c7215a3b1e5337f9bbb2863bba598b3064ef69e5
[ "MIT" ]
null
null
null
projectdjangoportfolio/jobs/admin.py
DevLuDaley/Portfolio
c7215a3b1e5337f9bbb2863bba598b3064ef69e5
[ "MIT" ]
null
null
null
from django.contrib import admin from.models import Job admin.site.register(Job) # Register your models here.
18.5
32
0.801802
fb1c95abaf459d4750608d1b3b3b8a20f69d8f30
504
py
Python
KNN/sklearn API.py
wu-huipeng/-
84f681f7488e45c5f357f558defbc27aaf285a16
[ "Apache-2.0" ]
7
2019-09-09T08:55:41.000Z
2020-02-08T13:24:59.000Z
KNN/sklearn API.py
wu-huipeng/machine-learning
84f681f7488e45c5f357f558defbc27aaf285a16
[ "Apache-2.0" ]
null
null
null
KNN/sklearn API.py
wu-huipeng/machine-learning
84f681f7488e45c5f357f558defbc27aaf285a16
[ "Apache-2.0" ]
null
null
null
from sklearn.neighbors import KNeighborsClassifier from sklearn.datasets import make_classification from sklearn.model_selection import train_test_split x , y = make_classification(n_samples=1000,n_features=40,random_state=42) # x_train, x_test ,y_train ,y_test = train_test_split(x,y,random_state=42) # knn = KNeighborsClassifier() # knn.fit(x_train,y_train) # pred = knn.predict(x_test) # score = knn.score(x_test,y_test) # print(score) #score = 0.76
22.909091
81
0.759921
fb1d2be116c21e769b849455662ea6590e0d2c00
484
py
Python
egg/resources/__init__.py
eanorambuena/Driver
3cb14f5d741c6bae364326305ae0ded04e10e9d4
[ "MIT" ]
null
null
null
egg/resources/__init__.py
eanorambuena/Driver
3cb14f5d741c6bae364326305ae0ded04e10e9d4
[ "MIT" ]
null
null
null
egg/resources/__init__.py
eanorambuena/Driver
3cb14f5d741c6bae364326305ae0ded04e10e9d4
[ "MIT" ]
null
null
null
from egg.resources.console import * from egg.resources.server import * from egg.resources.structures import * from egg.resources.auth import * from egg.resources.constants import * from egg.resources.extensions import * from egg.resources.help import * from egg.resources.modules import * from egg.resources.parser import * from egg.resources.strings import * from egg.resources.utils import * from egg.resources.web import * _author="eanorambuena" _author_email="eanorambuena@uc.cl"
32.266667
38
0.805785
fb1f5f0f7eda29bb259446b27b1eadc2e86cdafe
174
py
Python
eln/commands/news/templates/articles.py
lehvitus/eln
b78362af20cacffe076bf3dbfd27dcc090e43e39
[ "BSD-3-Clause" ]
2
2020-02-05T04:00:32.000Z
2020-03-18T02:12:33.000Z
eln/commands/news/templates/articles.py
oleoneto/eln
b78362af20cacffe076bf3dbfd27dcc090e43e39
[ "BSD-3-Clause" ]
1
2020-03-18T02:36:04.000Z
2020-03-18T02:36:04.000Z
eln/commands/news/templates/articles.py
oleoneto/eln
b78362af20cacffe076bf3dbfd27dcc090e43e39
[ "BSD-3-Clause" ]
null
null
null
from jinja2 import Template articles_template = Template("""{{ index }}. {{ title }} \tAuthor: {{ author }} \tPublished on: {{ publication_date }} \tSource: {{ url }} """)
19.333333
56
0.632184
fb21c669f057d7c99ae18966e97b4d0e1e081af7
255
py
Python
statistical_clear_sky/algorithm/exception.py
elsirdavid/StatisticalClearSky
bc3aa9de56a9347c10e2afe23af486d32d476273
[ "BSD-2-Clause" ]
16
2019-05-09T14:17:22.000Z
2022-02-23T18:41:13.000Z
statistical_clear_sky/algorithm/exception.py
elsirdavid/StatisticalClearSky
bc3aa9de56a9347c10e2afe23af486d32d476273
[ "BSD-2-Clause" ]
7
2019-07-09T18:32:29.000Z
2021-07-01T22:28:32.000Z
statistical_clear_sky/algorithm/exception.py
tadatoshi/StatisticalClearSky
40a7354f8e8b65c8008a56c655dddff700031558
[ "BSD-2-Clause" ]
4
2019-12-20T19:15:09.000Z
2021-04-29T17:40:40.000Z
""" Defines exceptions used in the context of this module "algorithm" """
28.333333
72
0.741176
fb223c6e71ca1dc86e9314d86210a866c21d9362
220
py
Python
cauldronBase/Base.py
Razikus/cauldron
cc6e87cb4283efe00ad7e06c98d05e8571883447
[ "MIT" ]
null
null
null
cauldronBase/Base.py
Razikus/cauldron
cc6e87cb4283efe00ad7e06c98d05e8571883447
[ "MIT" ]
null
null
null
cauldronBase/Base.py
Razikus/cauldron
cc6e87cb4283efe00ad7e06c98d05e8571883447
[ "MIT" ]
null
null
null
from sqlalchemy.ext.declarative import declarative_base from flask import Flask from flask import jsonify from flask_marshmallow import Marshmallow Base = declarative_base() app = Flask(__name__) ma = Marshmallow(app)
22
55
0.827273
fb2248e40d3ed11337557c6e7ae9b71e63c167b4
3,622
py
Python
BP.py
WolfMy/predict_stock
7af33404875d19ea93328b8f220d3bd2c0f6d2e5
[ "MIT" ]
1
2021-09-28T02:02:05.000Z
2021-09-28T02:02:05.000Z
BP.py
WolfMy/predict_stock
7af33404875d19ea93328b8f220d3bd2c0f6d2e5
[ "MIT" ]
null
null
null
BP.py
WolfMy/predict_stock
7af33404875d19ea93328b8f220d3bd2c0f6d2e5
[ "MIT" ]
1
2020-10-13T12:13:43.000Z
2020-10-13T12:13:43.000Z
import tensorflow as tf import numpy as np import pandas as pd from MACD_RSI import init_train_data start_date = '2018-11-20' end_date = '2019-03-01' stock_list = ['603000', '002230', '300492', '601688'] df = pd.DataFrame(stock_list, columns=['stock']) train_acc = [] for stock in stock_list: data, label = init_train_data(stock, start_date, end_date) train_acc.append(BP(data, label, input_size=2, num_classes=3, learning_rate=0.001, batch_size=32)) df['train_acc'] = train_acc print(df.sort_values(['train_acc'], ascending=False))
48.293333
134
0.655163
fb2280120f9263888a0811988826a4305d6b98aa
3,525
py
Python
bananas/transformers/running_stats.py
owahltinez/bananas
4d37af1713b7f166ead3459a7004748f954d336e
[ "MIT" ]
null
null
null
bananas/transformers/running_stats.py
owahltinez/bananas
4d37af1713b7f166ead3459a7004748f954d336e
[ "MIT" ]
null
null
null
bananas/transformers/running_stats.py
owahltinez/bananas
4d37af1713b7f166ead3459a7004748f954d336e
[ "MIT" ]
null
null
null
""" Threshold-based transformers """ from typing import Dict, Iterable, Union from ..changemap.changemap import ChangeMap from ..utils.arrays import flatten, shape_of_array from .base import ColumnHandlingTransformer
36.340206
102
0.588652
fb22dc5bf5bd9013f1aaf4889e65a75279b6e791
197
py
Python
1-beginner/1013.py
alenvieira/uri-online-judge-solutions
ca5ae7064d84af4dae12fc37d4d14ee441e49d06
[ "MIT" ]
null
null
null
1-beginner/1013.py
alenvieira/uri-online-judge-solutions
ca5ae7064d84af4dae12fc37d4d14ee441e49d06
[ "MIT" ]
null
null
null
1-beginner/1013.py
alenvieira/uri-online-judge-solutions
ca5ae7064d84af4dae12fc37d4d14ee441e49d06
[ "MIT" ]
null
null
null
line = input() (a, b, c) = [int(i) for i in line.split(' ')] greatest1 = (a + b + abs(a - b)) / 2 greatest2 = int((greatest1 + c + abs(greatest1 - c)) / 2) print('{} eh o maior'.format(greatest2))
32.833333
57
0.568528
fb24589362ad5872b751372ecb28f328c4ec3892
1,907
py
Python
utils.py
psergal/quiz
9420db013a4ca0662471f716ed5fc1f9cfb2502a
[ "MIT" ]
null
null
null
utils.py
psergal/quiz
9420db013a4ca0662471f716ed5fc1f9cfb2502a
[ "MIT" ]
null
null
null
utils.py
psergal/quiz
9420db013a4ca0662471f716ed5fc1f9cfb2502a
[ "MIT" ]
null
null
null
import argparse from pathlib import Path import random
44.348837
114
0.624541
fb2468353432def77628e6adb7da27b64ec4c1b6
2,684
py
Python
text-editor.py
Shubham05178/Text-Editor
82fff346880bb9e2088a16af20695bb46d68d29a
[ "MIT" ]
1
2021-09-24T16:13:14.000Z
2021-09-24T16:13:14.000Z
text-editor.py
Shubham05178/Text-Editor
82fff346880bb9e2088a16af20695bb46d68d29a
[ "MIT" ]
null
null
null
text-editor.py
Shubham05178/Text-Editor
82fff346880bb9e2088a16af20695bb46d68d29a
[ "MIT" ]
null
null
null
#Author Shubham Nagaria. ShubhamLabs. #Coder. #subhamnagaria@gmail.com import tkinter from tkinter import * from tkinter import Tk, scrolledtext, filedialog, messagebox root = Tk(className=" TextEditor-ShubhamLabs") #name your texteditor in quotes textPad = scrolledtext.ScrolledText(root, width=100, height=80) #Defining Menu bar and sub-commands #Adding menus to our text editor. menu = Menu(root) root.config(menu=menu) file_menu = Menu(menu) menu.add_cascade(label="File", menu=file_menu) file_menu.add_command(label="New", command=begin) file_menu.add_command(label="Open", command=open_file) file_menu.add_command(label="Save", command=save_file) file_menu.add_separator() file_menu.add_command(label="Exit", command=exit_file) help_menu = Menu(menu) menu.add_cascade(label="Help", menu=help_menu) help_menu.add_command(label="About", command=about) textPad.pack()#we pack everything :P root.mainloop() #we run script in loop.
32.731707
256
0.676975
fb27d1e80db32688183c68acefc2b5b91660e81e
852
py
Python
src/core/schemas/entries/event.py
nefarius/portfolio-backend
f595041354eedee71a4aa5b761501be030b81d09
[ "Apache-2.0" ]
6
2019-06-19T12:56:42.000Z
2021-12-26T07:22:47.000Z
src/core/schemas/entries/event.py
nefarius/portfolio-backend
f595041354eedee71a4aa5b761501be030b81d09
[ "Apache-2.0" ]
13
2019-12-20T10:39:44.000Z
2022-02-10T09:11:09.000Z
src/core/schemas/entries/event.py
nefarius/portfolio-backend
f595041354eedee71a4aa5b761501be030b81d09
[ "Apache-2.0" ]
1
2021-12-01T12:03:29.000Z
2021-12-01T12:03:29.000Z
from ...schemas import ICON_EVENT from ...skosmos import get_collection_members from ..base import BaseSchema from ..general import get_contributors_field, get_date_range_time_range_location_group_field, get_url_field from ..utils import years_from_date_range_time_range_location_group_field ICON = ICON_EVENT TYPES = get_collection_members('http://base.uni-ak.ac.at/portfolio/taxonomy/collection_event', use_cache=False)
42.6
112
0.805164
fb28158cf8145cabc88ee46d040cb82c54962f04
787
py
Python
fn/instaAPI.py
elsou/ETSE-Warbot
4fd5351688e3cd81d9eeed50586027830dba0c5b
[ "MIT" ]
2
2021-11-09T23:14:53.000Z
2021-11-11T01:09:28.000Z
fn/instaAPI.py
elsou/etse-warbot
4fd5351688e3cd81d9eeed50586027830dba0c5b
[ "MIT" ]
null
null
null
fn/instaAPI.py
elsou/etse-warbot
4fd5351688e3cd81d9eeed50586027830dba0c5b
[ "MIT" ]
null
null
null
from instabot import Bot import os import shutil import time # Dado un tweet (str) e imaxe (str '*.jpeg'), publica o contido en instagram # ...
23.848485
76
0.617535
fb29a12d8ace63ae0afef58e7d2a5734abf0e3c4
2,088
py
Python
memories/api/utils.py
marchelbling/memories-api
e82d6c6ae2b7873fc35ebb301fc073e3ef968a1e
[ "MIT" ]
null
null
null
memories/api/utils.py
marchelbling/memories-api
e82d6c6ae2b7873fc35ebb301fc073e3ef968a1e
[ "MIT" ]
null
null
null
memories/api/utils.py
marchelbling/memories-api
e82d6c6ae2b7873fc35ebb301fc073e3ef968a1e
[ "MIT" ]
null
null
null
import time import logging from functools import wraps logging.basicConfig(level=logging.INFO, format='[%(asctime)s] [%(levelname)s] %(message)s')
33.677419
93
0.561782
fb2abd56368d34ecbc07a95fe8f4a470ff486455
24,641
py
Python
cssedit/editor/gui_qt.py
albertvisser/cssedit
e17ed1b43a0e4d50bfab6a69da47b92cd3213724
[ "MIT" ]
null
null
null
cssedit/editor/gui_qt.py
albertvisser/cssedit
e17ed1b43a0e4d50bfab6a69da47b92cd3213724
[ "MIT" ]
null
null
null
cssedit/editor/gui_qt.py
albertvisser/cssedit
e17ed1b43a0e4d50bfab6a69da47b92cd3213724
[ "MIT" ]
null
null
null
"""cssedit: PyQt specific stuff """ import sys import os import PyQt5.QtWidgets as qtw import PyQt5.QtGui as gui import PyQt5.QtCore as core from .cssedit import parse_log_line, get_definition_from_file
35.302292
97
0.582363
fb2b12951a9311d135394c012f89a0e99ed10eee
13,425
py
Python
mtp_cashbook/apps/disbursements/tests/test_functional.py
uk-gov-mirror/ministryofjustice.money-to-prisoners-cashbook
d35a621e21631e577faacaeacb5ab9f883c9b4f4
[ "MIT" ]
4
2016-01-05T12:21:39.000Z
2016-12-22T15:56:37.000Z
mtp_cashbook/apps/disbursements/tests/test_functional.py
uk-gov-mirror/ministryofjustice.money-to-prisoners-cashbook
d35a621e21631e577faacaeacb5ab9f883c9b4f4
[ "MIT" ]
132
2015-06-10T09:53:14.000Z
2022-02-01T17:35:54.000Z
mtp_cashbook/apps/disbursements/tests/test_functional.py
uk-gov-mirror/ministryofjustice.money-to-prisoners-cashbook
d35a621e21631e577faacaeacb5ab9f883c9b4f4
[ "MIT" ]
3
2015-07-07T14:40:33.000Z
2021-04-11T06:20:14.000Z
from django.utils.crypto import get_random_string from cashbook.tests.test_functional import CashbookTestCase from disbursements.templatetags.disbursements import format_sortcode
39.60177
104
0.659367
fb2bb261a73c74317e9f4c04091925e5a2fa1f5e
2,199
py
Python
quantrocket/satellite.py
Jay-Jay-D/quantrocket-client
b70ac199382d22d56fad923ca2233ce027f3264a
[ "Apache-2.0" ]
null
null
null
quantrocket/satellite.py
Jay-Jay-D/quantrocket-client
b70ac199382d22d56fad923ca2233ce027f3264a
[ "Apache-2.0" ]
null
null
null
quantrocket/satellite.py
Jay-Jay-D/quantrocket-client
b70ac199382d22d56fad923ca2233ce027f3264a
[ "Apache-2.0" ]
1
2019-06-12T11:34:27.000Z
2019-06-12T11:34:27.000Z
# Copyright 2017 QuantRocket - All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import sys from quantrocket.houston import houston from quantrocket.cli.utils.output import json_to_cli from quantrocket.cli.utils.files import write_response_to_filepath_or_buffer def execute_command(service, cmd, return_file=None, filepath_or_buffer=None): """ Execute an abitrary command on a satellite service and optionally return a file. Parameters ---------- service : str, required the service name cmd: str, required the command to run return_file : str, optional the path of a file to be returned after the command completes filepath_or_buffer : str, optional the location to write the return_file (omit to write to stdout) Returns ------- dict or None None if return_file, otherwise status message """ params = {} if not service: raise ValueError("a service is required") if not cmd: raise ValueError("a command is required") params["cmd"] = cmd if return_file: params["return_file"] = return_file if not service.startswith("satellite"): raise ValueError("service must start with 'satellite'") response = houston.post("/{0}/commands".format(service), params=params, timeout=60*60*24) houston.raise_for_status_with_json(response) if return_file: filepath_or_buffer = filepath_or_buffer or sys.stdout write_response_to_filepath_or_buffer(filepath_or_buffer, response) else: return response.json()
32.820896
93
0.71578
fb2ea9cb95f216543b39462cef45459a422c0631
12,367
py
Python
blog_server/app/comm/GeneralOperate.py
szhu9903/flask-react-blog
b1939a5d95e0084a82c230f2a20a9b197d2eef46
[ "MIT" ]
2
2022-03-12T14:51:42.000Z
2022-03-25T13:20:16.000Z
blog_server/app/comm/GeneralOperate.py
szhu9903/flask-react-blog
b1939a5d95e0084a82c230f2a20a9b197d2eef46
[ "MIT" ]
7
2022-03-19T02:17:54.000Z
2022-03-28T10:12:52.000Z
blog_server/app/comm/GeneralOperate.py
szhu9903/flask-react-blog
b1939a5d95e0084a82c230f2a20a9b197d2eef46
[ "MIT" ]
1
2022-03-25T13:20:28.000Z
2022-03-25T13:20:28.000Z
import copy from flask import g from app.comm.TableModule import TableModule from app.comm.SqlExecute import SqlExecute from app.unit_config import default_result, default_limit_size, depth_post_map
32.890957
91
0.602248
fb2eaccf39fb8ba5a32d82bc3c5d4475f3435246
57
py
Python
tests/helpers/test_plotting.py
sebastian-lapuschkin/Quantus
c3b8a9fb2018f34bd89ba38efa2b2b8c38128b3f
[ "MIT" ]
null
null
null
tests/helpers/test_plotting.py
sebastian-lapuschkin/Quantus
c3b8a9fb2018f34bd89ba38efa2b2b8c38128b3f
[ "MIT" ]
null
null
null
tests/helpers/test_plotting.py
sebastian-lapuschkin/Quantus
c3b8a9fb2018f34bd89ba38efa2b2b8c38128b3f
[ "MIT" ]
null
null
null
"""No identified need to test plotting functionality."""
28.5
56
0.754386
fb2ec99c88e89e1bd90620cd1221b2fc2ec8cc12
4,921
py
Python
SmartDeal-Training/models/mobilenetv2_se_mask.py
VITA-Group/SmartDeal
8e1de77497eedbeea412a8c51142834c28a53709
[ "MIT" ]
2
2021-07-20T02:48:35.000Z
2021-11-29T02:55:36.000Z
SmartDeal-Training/models/mobilenetv2_se_mask.py
VITA-Group/SmartDeal
8e1de77497eedbeea412a8c51142834c28a53709
[ "MIT" ]
null
null
null
SmartDeal-Training/models/mobilenetv2_se_mask.py
VITA-Group/SmartDeal
8e1de77497eedbeea412a8c51142834c28a53709
[ "MIT" ]
null
null
null
'''MobileNetV2 in PyTorch. See the paper "Inverted Residuals and Linear Bottlenecks: Mobile Networks for Classification, Detection and Segmentation" for more details. ''' import torch import torch.nn as nn import torch.nn.functional as F from se import SEConv2d, SELinear THRESHOLD = 4e-3 __all__ = ['SEMaskMobileNetV2'] def conv3x3(in_planes, out_planes, stride=1, groups=1): """3x3 convolution with padding""" # return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, return SEConv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, groups=groups, bias=False, threshold=THRESHOLD) def conv1x1(in_planes, out_planes, stride=1): """1x1 convolution""" # return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False) return SEConv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False, threshold=THRESHOLD) def test(): net = SEMaskMobileNetV2() i = 0 for m in net.modules(): if hasattr(m, 'mask'): print(m.C.numel()) pass x = torch.randn(2,3,32,32) y = net(x) print(y.size()) # test() if __name__ == "__main__": test()
36.451852
116
0.613696
fb2f3eb592211892766f130ad1032ee5dd774617
911
py
Python
twitter_video.py
keselekpermen69/build_scripts
110392778ad0a8585efa944100aa1c13ef28469e
[ "MIT" ]
5
2020-08-19T05:44:25.000Z
2021-05-13T05:15:50.000Z
twitter_video.py
MrMissx/scripts
110392778ad0a8585efa944100aa1c13ef28469e
[ "MIT" ]
null
null
null
twitter_video.py
MrMissx/scripts
110392778ad0a8585efa944100aa1c13ef28469e
[ "MIT" ]
null
null
null
import requests if __name__ == "__main__": main()
24.621622
86
0.531284
fb2fabace401a8d0a972f811af8b0a86ed348c85
2,951
py
Python
frappe-bench/apps/erpnext/erpnext/regional/india/utils.py
Semicheche/foa_frappe_docker
a186b65d5e807dd4caf049e8aeb3620a799c1225
[ "MIT" ]
null
null
null
frappe-bench/apps/erpnext/erpnext/regional/india/utils.py
Semicheche/foa_frappe_docker
a186b65d5e807dd4caf049e8aeb3620a799c1225
[ "MIT" ]
null
null
null
frappe-bench/apps/erpnext/erpnext/regional/india/utils.py
Semicheche/foa_frappe_docker
a186b65d5e807dd4caf049e8aeb3620a799c1225
[ "MIT" ]
null
null
null
import frappe, re from frappe import _ from frappe.utils import cstr from erpnext.regional.india import states, state_numbers from erpnext.controllers.taxes_and_totals import get_itemised_tax, get_itemised_taxable_amount # don't remove this function it is used in tests def test_method(): '''test function''' return 'overridden'
36.8875
102
0.74856
fb32689f50782a5ff37cf378f6a450894a0dc23f
22,922
py
Python
tests/cupy_tests/test_cublas.py
Onkar627/cupy
8eef1ad5393c0a92c5065bc05137bf997f37044a
[ "MIT" ]
1
2022-01-12T22:57:54.000Z
2022-01-12T22:57:54.000Z
tests/cupy_tests/test_cublas.py
Onkar627/cupy
8eef1ad5393c0a92c5065bc05137bf997f37044a
[ "MIT" ]
null
null
null
tests/cupy_tests/test_cublas.py
Onkar627/cupy
8eef1ad5393c0a92c5065bc05137bf997f37044a
[ "MIT" ]
1
2022-03-21T20:19:12.000Z
2022-03-21T20:19:12.000Z
import numpy import pytest import cupy from cupy import cublas from cupy import testing from cupy.testing import _attr
35.871674
79
0.547596
fb336072c83fb710a31348edb291a0b22c416bc1
706
py
Python
ProgsByDataset/UnpaywallMAG/create_unpaywall_refs.py
ashwath92/MastersThesis
f74755dc0c32f316da3c860dd5dbfa4c9cad97b3
[ "MIT" ]
5
2020-11-05T07:11:54.000Z
2021-08-04T21:37:28.000Z
ProgsByDataset/UnpaywallMAG/create_unpaywall_refs.py
ashwath92/MastersThesis
f74755dc0c32f316da3c860dd5dbfa4c9cad97b3
[ "MIT" ]
null
null
null
ProgsByDataset/UnpaywallMAG/create_unpaywall_refs.py
ashwath92/MastersThesis
f74755dc0c32f316da3c860dd5dbfa4c9cad97b3
[ "MIT" ]
4
2020-11-05T06:04:38.000Z
2021-08-02T16:25:42.000Z
import re import csv # Unpaywall citing, cited list based on mag ids unpaywall_citing_cited_file = open('AdditionalOutputs/unpaywallmag_references.tsv', 'w') fieldnames = ['citing_mag_id', 'cited_mag_id'] writer = csv.DictWriter(unpaywall_citing_cited_file, delimiter="\t", fieldnames=fieldnames) citation_pattern = re.compile(r'(=-=)([0-9]+)(-=-)') with open('inputfiles/training_no20182019_with_contexts.txt', 'r') as file: for line in file: citing_paperid = line.split()[0] for citation_marker in citation_pattern.finditer(line): fetched_mag_id = citation_marker.group(2) writer.writerow({'citing_mag_id': citing_paperid,'cited_mag_id': fetched_mag_id})
39.222222
93
0.730878
fb336c9971fca1cc78e0225c7dbfc79890eb6bc4
721
py
Python
Configuration/Skimming/python/PA_MinBiasSkim_cff.py
nistefan/cmssw
ea13af97f7f2117a4f590a5e654e06ecd9825a5b
[ "Apache-2.0" ]
null
null
null
Configuration/Skimming/python/PA_MinBiasSkim_cff.py
nistefan/cmssw
ea13af97f7f2117a4f590a5e654e06ecd9825a5b
[ "Apache-2.0" ]
null
null
null
Configuration/Skimming/python/PA_MinBiasSkim_cff.py
nistefan/cmssw
ea13af97f7f2117a4f590a5e654e06ecd9825a5b
[ "Apache-2.0" ]
null
null
null
import FWCore.ParameterSet.Config as cms # HLT dimuon trigger import HLTrigger.HLTfilters.hltHighLevel_cfi hltMinBiasHI = HLTrigger.HLTfilters.hltHighLevel_cfi.hltHighLevel.clone() hltMinBiasHI.HLTPaths = ["HLT_PAL1MinimumBiasHF_OR_SinglePixelTrack_ForSkim_v*"] hltMinBiasHI.throw = False hltMinBiasHI.andOr = True # selection of valid vertex primaryVertexFilterForMinBias = cms.EDFilter("VertexSelector", src = cms.InputTag("offlinePrimaryVertices"), cut = cms.string("!isFake && abs(z) <= 25 && position.Rho <= 2"), filter = cms.bool(True), # otherwise it won't filter the events ) # MinBias skim sequence minBiasSkimSequence = cms.Sequence( hltMinBiasHI * primaryVertexFilterForMinBias )
32.772727
80
0.769764
fb3473188063f91e4e0dd179c38bc4a0e03e103e
4,523
py
Python
backend/tests/date_arr_test.py
byamba3/mobilemetrics-backend
2e6c53325ecff842bde8c8fe19de220e8f90cb1d
[ "Unlicense" ]
null
null
null
backend/tests/date_arr_test.py
byamba3/mobilemetrics-backend
2e6c53325ecff842bde8c8fe19de220e8f90cb1d
[ "Unlicense" ]
1
2018-08-14T21:26:02.000Z
2018-08-14T21:26:16.000Z
backend/tests/date_arr_test.py
byamba3/mobilemetrics-backend
2e6c53325ecff842bde8c8fe19de220e8f90cb1d
[ "Unlicense" ]
null
null
null
import datetime from calendar import monthrange import calendar import numpy as np ####### #For generate origin repayment schedule date and days columns ####### start_day = 1 start_month = 1 start_year = 2012 num_installment = 12 installment_time_period = 'months' change_col_idx = 1 change_row_idx = 2 change_val = 100 modify_days = change_col_idx == 1 modify_date = change_col_idx == 2 days_dict = {'days':1, 'weeks':7, 'two-weeks':14, '15 days':15, '4 weeks': 28} month_num_to_str_dict = {1:'Jan', 2: 'Feb', 3: 'Mar', 4:'Apr', 5:'May', 6:'Jun', 7:'Jul', 8:'Aug', 9:'Sep', 10:'Oct', 11:'Nov', 12:'Dec'} # represent days in datetime objects date_arr, day_num_arr = calc_origin_days(start_day, start_month, start_year, installment_time_period, num_installment) for idx in range(len(date_arr)): print ('{0} {1}'.format(date_arr[idx], day_num_arr[idx])) # TODO: save/update the origin matrix with correct version number ####### #For repayment schedule date and days on change ####### prev_changes = np.zeros(len(date_arr), dtype=object) for idx in range(len(prev_changes)): prev_changes[idx] = None # if modify_days: new_date_arr, new_day_num_arr = on_change_day(date_arr, day_num_arr, 1, 100, prev_changes) prev_changes[1] = 100 # TODO save the updated user change matrix to database print ("#"*10+"after change") for idx in range(len(new_date_arr)): print ('{0} {1}'.format(new_date_arr[idx], new_day_num_arr[idx])) # print (new_date_arr) new_date_arr, new_day_num_arr = on_change_day(new_date_arr, new_day_num_arr, 4, 100, prev_changes) prev_changes[4] = 100 print ("#"*10+"after change") for idx in range(len(new_date_arr)): print ('{0} {1}'.format(new_date_arr[idx], new_day_num_arr[idx]))
35.335938
137
0.689808
fb360bb15c3aa59399389bed8b1e64bb7c548a75
3,696
py
Python
launch_hits.py
hinthornw/Pointing
e3cbaf2c5f54d20fe959406714b38634bc4bb3fe
[ "MIT" ]
null
null
null
launch_hits.py
hinthornw/Pointing
e3cbaf2c5f54d20fe959406714b38634bc4bb3fe
[ "MIT" ]
null
null
null
launch_hits.py
hinthornw/Pointing
e3cbaf2c5f54d20fe959406714b38634bc4bb3fe
[ "MIT" ]
null
null
null
from __future__ import print_function import argparse import json from boto.mturk.price import Price from boto.mturk.question import HTMLQuestion from boto.mturk.connection import MTurkRequestError import os import simpleamt import sys import inspect DEBUG = printPlus # Motorbike 20-40 # Dog 40-70 # Person 40-70 MINHITS = 40 MAXHITS = 60 if __name__ == '__main__': parser = argparse.ArgumentParser(parents=[simpleamt.get_parent_parser()]) parser.add_argument('--hit_properties_file', type=argparse.FileType('r')) parser.add_argument('--html_template') parser.add_argument('--input_json_file', type=argparse.FileType('r')) parser.add_argument('--input_cache', type=argparse.FileType('r')) args = parser.parse_args() im_names = [] if args.input_cache is not None: #DEBUG("Cache: {}".format(args.input_cache)) for i, line in enumerate(args.input_cache): im_names.append(json.loads(line.strip())) #im_names = json.load(args.input_cache) input_json_file = [] for i, line in enumerate(args.input_json_file): input_json_file.append(line) mtc = simpleamt.get_mturk_connection_from_args(args) hit_properties = json.load(args.hit_properties_file) hit_properties['reward'] = Price(hit_properties['reward']) #hit_properties['Reward'] = str(hit_properties['Reward']).decode('utf-8') simpleamt.setup_qualifications(hit_properties, mtc) #DEBUG("After", hit_properties) frame_height = hit_properties.pop('frame_height') env = simpleamt.get_jinja_env(args.config) template = env.get_template(args.html_template) if args.hit_ids_file is None: DEBUG('Need to input a hit_ids_file') sys.exit() DEBUG(args.hit_ids_file, args.input_cache) if os.path.isfile(args.hit_ids_file): DEBUG('hit_ids_file already exists') sys.exit() with open(args.hit_ids_file, 'w') as hit_ids_file: # for i, line in enumerate(args.input_json_file): print("Launching {} HITS".format(len(input_json_file))) for i, line in enumerate(input_json_file): if i < MINHITS: continue hit_input = json.loads(line.strip()) # In a previous version I removed all single quotes from the json dump. # TODO: double check to see if this is still necessary. template_params = {'input': json.dumps(hit_input)} if len(im_names) > 0: template_params['im_names'] = json.dumps( im_names[i]) # json.dumps(im_names) html = template.render(template_params) html_question = HTMLQuestion(html, frame_height) hit_properties['question'] = html_question #DEBUG('Rendering Template {}'.format(i)) # with open('rendered_template{}.html'.format(i), 'w+') as f: # f.write(html) # This error handling is kinda hacky. # TODO: Do something better here. launched = False while not launched: try: boto_hit = mtc.create_hit(**hit_properties) launched = True except MTurkRequestError as e: DEBUG(e) hit_id = boto_hit[0].HITId hit_ids_file.write('%s\n' % hit_id) DEBUG('Launched HIT ID: %s, %d' % (hit_id, i + 1)) if i > MAXHITS: DEBUG( "Debugging mode ON. Limiting HIT number to {}".format( MAXHITS - MINHITS)) break
36.594059
83
0.628247
fb36ee81af365dbd4ec4f2c01bf63d11e510fd29
2,405
py
Python
scripts/skinning/utils/skin.py
robertjoosten/skinning-tools
1f1ec6c092fdc1e39aa82a711a13a0041f9d5730
[ "MIT" ]
31
2018-09-08T16:42:01.000Z
2022-03-31T12:31:21.000Z
scripts/skinning/utils/skin.py
robertjoosten/skinning-tools
1f1ec6c092fdc1e39aa82a711a13a0041f9d5730
[ "MIT" ]
null
null
null
scripts/skinning/utils/skin.py
robertjoosten/skinning-tools
1f1ec6c092fdc1e39aa82a711a13a0041f9d5730
[ "MIT" ]
11
2018-10-01T09:57:53.000Z
2022-03-19T06:53:02.000Z
from maya import cmds from maya.api import OpenMaya from maya.api import OpenMayaAnim from functools import partial from skinning.utils import api from skinning.vendor import apiundo def get_cluster_fn(node): """ Loop over an objects history and return the skin cluster api node that is part dependency graph. The geometry provided will be extended to its shapes. :param str node: :return: Skin cluster :rtype: OpenMayaAnim.MFnSkinCluster :raise RuntimeError: When no skin cluster can be found. """ shapes = cmds.listRelatives(node, shapes=True) or [] shapes.append(node) for shape in shapes: shape_obj = api.conversion.get_object(shape) dependency_iterator = OpenMaya.MItDependencyGraph( shape_obj, OpenMaya.MFn.kSkinClusterFilter, OpenMaya.MItDependencyGraph.kUpstream ) while not dependency_iterator.isDone(): return OpenMayaAnim.MFnSkinCluster(dependency_iterator.currentNode()) else: raise RuntimeError("Node '{}' has no skin cluster in its history.".format(node)) def get_cluster(node): """ Loop over an objects history and return the skin cluster node that is part of the history. The geometry provided will be extended to its shapes. :param str node: :return: Skin cluster :rtype: str """ skin_cluster_fn = get_cluster_fn(node) return skin_cluster_fn.name() # ---------------------------------------------------------------------------- def set_weights(skin_cluster, dag, components, influences, weights_new, weights_old=None): """ Set the skin weights via the API but add them to the undo queue using the apiundo module. If weights old are not provided they are retrieved from the skin cluster first. :param OpenMayaAnim.MFnSkinCluster skin_cluster: :param OpenMaya.MDagPath dag: :param OpenMaya.MObject components: :param OpenMaya.MIntArray influences: :param OpenMaya.MDoubleArray weights_new: :param OpenMaya.MDoubleArray weights_old: """ if weights_old is None: weights_old, _ = skin_cluster.getWeights(dag, components) undo = partial(skin_cluster.setWeights, dag, components, influences, weights_old) redo = partial(skin_cluster.setWeights, dag, components, influences, weights_new) apiundo.commit(undo=undo, redo=redo) redo()
32.066667
90
0.69106
fb3817bdbf09d70c073184d064ea74bede74d6b3
1,607
py
Python
z_exams/exam_2018_08_26/ex_03_descriptions.py
VasAtanasov/SoftUni-Python-Fundamentals
471d0537dd6e5c8b61ede92b7673c0d67e2964fd
[ "MIT" ]
1
2019-06-05T11:16:08.000Z
2019-06-05T11:16:08.000Z
z_exams/exam_2018_08_26/ex_03_descriptions.py
VasAtanasov/SoftUni-Python-Fundamentals
471d0537dd6e5c8b61ede92b7673c0d67e2964fd
[ "MIT" ]
null
null
null
z_exams/exam_2018_08_26/ex_03_descriptions.py
VasAtanasov/SoftUni-Python-Fundamentals
471d0537dd6e5c8b61ede92b7673c0d67e2964fd
[ "MIT" ]
null
null
null
import re REGEX = { "name": r"name is (?P<name>[A-Z][A-Za-z]+ [A-Z][A-Za-z]+)", "age": r" (?P<age>[0-9]{2}) years", "date": r"on (?P<date>[0-9]{2}-[0-9]{2}-[0-9]{4})." } db = [] while True: line = input() if "make migrations" == line: break if line[len(line) - 1] != '.': continue params = {} for requirement, regex in REGEX.items(): match = re.search(regex, line) if not match: params = {} break if requirement == "age": age = int(match.group(requirement)) if age <= 9 or age >= 100: break params["age"] = age elif requirement == "name": params["name"] = match.group(requirement) elif requirement == "date": params["date"] = match.group(requirement) if params: db.append(Person(full_name=params["name"], age=params["age"], birth_date=params["date"])) if not db: print("DB is empty") else: print("\n".join(map(str, db)))
23.289855
97
0.533914
fb3a72f79061cb96a4d85d2974153bcda4983c49
7,667
py
Python
GoogleSheetsJobParser.py
mattfromsydney/Scientific-Report-Generator
17ddfe42e38d83341460a6de7b0b156bf7cd820a
[ "MIT" ]
null
null
null
GoogleSheetsJobParser.py
mattfromsydney/Scientific-Report-Generator
17ddfe42e38d83341460a6de7b0b156bf7cd820a
[ "MIT" ]
null
null
null
GoogleSheetsJobParser.py
mattfromsydney/Scientific-Report-Generator
17ddfe42e38d83341460a6de7b0b156bf7cd820a
[ "MIT" ]
null
null
null
""" NOTE on google sheets format: The google sheets document must have the following: Columns A and B from cell 2 down are all the sample details Column A is the name of the detail and Column B is the value of the detail Columns B and onwards can be anything but there must be three speicifc columns Replicate, Test Name, Result Each row in these columns is counted as a test result and are grouped together by test name, replicate All rows must have a unique TestName-Replicate combination or an error is shown """ from SampleData import SampleData from SRGJob import SRGJob import time
43.811429
104
0.60493
fb3a87c53bf0b6e09c757714ba3aaf427f9aff41
1,720
py
Python
aws_lambda/lambda.py
bluthen/utilbula_list
dbe4dfd273c7fa37553d91c5bde8744794ccba70
[ "Apache-2.0" ]
null
null
null
aws_lambda/lambda.py
bluthen/utilbula_list
dbe4dfd273c7fa37553d91c5bde8744794ccba70
[ "Apache-2.0" ]
null
null
null
aws_lambda/lambda.py
bluthen/utilbula_list
dbe4dfd273c7fa37553d91c5bde8744794ccba70
[ "Apache-2.0" ]
null
null
null
import json import base64 import boto3 import uuid import traceback
27.741935
97
0.568023
fb3a92014d6912b9f49fb4d369df04c828bdc5f0
6,565
py
Python
Week3-Case-Studies-Part1/Language-Processing/Language_Processing.py
Lamanova/Harvard-PH526x-Lab
168e4c16fa067905142bb6be106277f228d591c5
[ "MIT" ]
7
2017-08-13T03:03:55.000Z
2022-02-06T17:08:12.000Z
Week3-Case-Studies-Part1/Language-Processing/Language_Processing.py
Lamanova/Harvard-PH526x-Lab
168e4c16fa067905142bb6be106277f228d591c5
[ "MIT" ]
null
null
null
Week3-Case-Studies-Part1/Language-Processing/Language_Processing.py
Lamanova/Harvard-PH526x-Lab
168e4c16fa067905142bb6be106277f228d591c5
[ "MIT" ]
10
2017-09-29T08:22:10.000Z
2021-06-17T22:51:59.000Z
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Feb 28 22:41:26 2017 @author: lamahamadeh """ ''' Case Study about Language Processing ''' #counting words #--------------- text = "This is a test text. We're keping this text short to keep things manageable." #test text #Using loops #----------- def count_words(text): """count the number of times each word occurs in text (str). Return dictionary where keys are unique words and values are word counts. skip punctuations""" text = text.lower() #lowercase for the counting letters so the function can cont the same words whether it's capatilised or not skips = [".", ",", ";", ":", "'", '"'] #skipping all the punctuations to not be counted with the words that come bfore them for ch in skips: text = text.replace(ch,"") word_counts = {} for word in text.split(" "): if word in word_counts: #known word case word_counts[word] += 1 else: word_counts[word] = 1 #unknown word case return word_counts print(count_words(text)) print(len(count_words("This comprehension check is to check for comprehension.")))#first quiz question #------------------------------------------------------------------------------ #using collections module #------------------------- from collections import Counter def count_words_fast(text): """count the number of times each word occurs in text (str). Return dictionary where keys are unique words and values are word counts. skip punctuations""" text = text.lower() #lowercase for the counting letters so the function can cont the same words whether it's capatilised or not skips = [".", ",", ";", ":", "'", '"'] #skipping all the punctuations to not be counted with the words that come bfore them for ch in skips: text = text.replace(ch,"") word_counts = Counter(text.split(" ")) return word_counts print(count_words_fast) print(count_words(text)==count_words_fast(text)) print(count_words(text) is count_words_fast(text))#second quiz question #------------------------------------------------------------------------------ #read a book #------------- def read_book(title_path): """Read a book and return it as a string""" with open(title_path, "r", encoding = "utf8") as current_file: #encoding = "utf8" causes a problem when running the code in Python 2.7. However, it runs normally when using Python 3.5. text = current_file.read() text = text.replace("\n","").replace("\r","") return text text = read_book('/Users/ADB3HAMADL/Desktop/Movies/English/Nora Ephron/You Have Got Mail.txt')#read a book from its path print(len(text))#number of charatcers in the book #if there is a famous/wanted line in the book we can use the 'find' method to find it ind = text.find("go to the mattresses") print(ind) #print the index number of the famous/wanted sentence sample_text = text[ind : ind + 953] #slice the paragraph that contains the famous line print(sample_text) #print the whole chosen paragraph #------------------------------------------------------------------------------ #Counting the number of unique words #------------------------------------ def word_stats(word_counts): """return the number of unique words and word frequencies""" num_unique = len(word_counts) #calculate the number of unique words in the text counts = word_counts.values() #calculate the frequency of each word in the text return(num_unique,counts) text = read_book('/Users/ADB3HAMADL/Desktop/Movies/English/Nora Ephron/You Have Got Mail.txt') word_counts = count_words(text) (num_unique, counts) = word_stats(word_counts) print(num_unique) #print the number of unique number of words in the text print(sum(counts)) #print the sum of the frequency of each word in the text #------------------------------------------------------------------------------ #Reading multiple files #----------------------- import os #to read directories movie_dir = "/Users/ADB3HAMADL/Desktop/movies" #tells us how many directories in the book directory import pandas as pd ''' Pandas example of how to create a dataframe: -------------------------------------------- import pandas as pd table = pd.DataFrame(coloums = ("name" , "age")) table.loc[1] = "James", 22 table.loc[2] = "Jess", 32 print(table) ''' stats = pd.DataFrame(columns = ("Language" , "Director" , "Title" , "Length" , "Unique")) #this creates an empty dataframe #with empty table elements with 5 columns #To put data in the table title_num =1 for Language in os.listdir(movie_dir): for Director in os.listdir(movie_dir + "/" + Language): for Title in os.listdir(movie_dir + "/" + Language + "/" + Director): inputfile = movie_dir + "/" + Language + "/" + Director + "/" + Title print(inputfile) text = read_book(inputfile) (num_unique, counts) = word_stats(count_words(text)) stats.loc[title_num ] = Language , Director.title(), Title.replace(".txt", " ") , sum(counts) , num_unique #.title() here capitalises the first letter from the first and last name of the director. If we want to capitalise only the first letter, we can use .capitalize(). title_num += 1 print(stats) #print the created dataframe print(stats.head()) #print the top 5 lines print(stats.tail()) #print the last 5 lines print(stats[stats.Language == "English"]) #print the number of entries for language English (a subset from the whole dataframe) #------------------------------------------------------------------------------ #Plotting Book Statistics #------------------------- import matplotlib.pyplot as plt plt.plot(stats.Length, stats.Unique, "bo") #OR we can write plt.plot(stats['length'], stats['unique']) plt.loglog(stats.Length, stats.Unique, "bo") #it is a straight line which suggest data modelling strategies that we might use plt.figure(figsize = (10,10)) subset = stats[stats.Language == "English"] #extract a subset that has only the rows with English Language plt.loglog(subset.Length, subset.Unique, "o", label = "English", color = "blue") subset = stats[stats.Language == "French"] #extract a subset that has only the rows with French Language plt.loglog(subset.Length, subset.Unique, "o", label = "French", color = "red") plt.legend() plt.xlabel("Movie Length") plt.ylabel("Number of unique words") plt.savefig("lang_plot.pdf") #------------------------------------------------------------------------------ #
36.071429
282
0.6262
fb3c3876b330f5a1310fa02ca86fedafa73ed588
273
py
Python
catalog/bindings/csw/brief_record.py
NIVANorge/s-enda-playground
56ae0a8978f0ba8a5546330786c882c31e17757a
[ "Apache-2.0" ]
null
null
null
catalog/bindings/csw/brief_record.py
NIVANorge/s-enda-playground
56ae0a8978f0ba8a5546330786c882c31e17757a
[ "Apache-2.0" ]
null
null
null
catalog/bindings/csw/brief_record.py
NIVANorge/s-enda-playground
56ae0a8978f0ba8a5546330786c882c31e17757a
[ "Apache-2.0" ]
null
null
null
from dataclasses import dataclass from bindings.csw.brief_record_type import BriefRecordType __NAMESPACE__ = "http://www.opengis.net/cat/csw/2.0.2"
24.818182
58
0.754579
fb3db8f6cafb78c9e368cf61c425d4648f50a4a0
8,109
py
Python
R2Py/pre_data_chk.py
OpenBookProjects/ipynb
72a28109e8e30aea0b9c6713e78821e4affa2e33
[ "MIT" ]
6
2015-06-08T12:50:14.000Z
2018-11-20T10:05:01.000Z
R2Py/pre_data_chk.py
OpenBookProjects/ipynb
72a28109e8e30aea0b9c6713e78821e4affa2e33
[ "MIT" ]
null
null
null
R2Py/pre_data_chk.py
OpenBookProjects/ipynb
72a28109e8e30aea0b9c6713e78821e4affa2e33
[ "MIT" ]
8
2016-01-26T14:12:50.000Z
2021-02-20T14:24:09.000Z
# -*- coding: utf-8 -*- '''check and clean and export as .csv - 150602 pike aTimeLogger2 date into .csv - 150601 make handlog export all date into *_all.csv - 150525 make handlog wxport 2types files ''' import os import sys import fnmatch def _load_atl(flines,fname): """load and pick time log from aTimeLogger2 export """ _titles = "" _exp = "" _gotit = 0 no_grp = 0 l_exp = [] for l in flines: if ("%" in l): no_grp = 1 if ("Percent" in l)or("%" in l): _gotit = 1 if _gotit: if "+" in l: pass elif "/" in l: pass else: _exp += l l_exp.append(l) if no_grp: _exp = "Class,Duration,Percent\n" _total,grp_act = _reformat_log(l_exp) for k in grp_act: _exp += "%s,"%k + ",".join(grp_act[k]) + "\n" _exp += ",%.2f"% _total f_exp = _titles+_exp _expf = fname.split("_")[1] open("./data/atl2_%s.csv"% _expf,'w').write(f_exp) return _expf,_exp def _reformat_log(log): '''reformt log - clean "" - merge no grp. logs ''' act_map = {'Chaos':['Chaos',] , 'Life':['Life','','','Air','',''] , 'Input':['Input','','',''] , 'Output':['Works','','','GDG','OBP','Pt0'] , 'Livin':['Livin','','','','Ukulele','',''] , 'Untracked':['','Untracked'] } grp_act = {} for l in log: #print ",".join([i[1:-1] for i in l[:-1].split(',')]) crt_line = [i[1:-1] for i in l[:-1].split(',')] if "%" in crt_line: pass else: #print crt_line[0].split()[0] for k in act_map.keys(): if crt_line[0].split()[0] in act_map[k]: #print k,crt_line[0],crt_line[1:] if k in grp_act: grp_act[k].append(crt_line[1:]) else: grp_act[k] = [crt_line[1:]] _total = 0 for k in grp_act: #print k,grp_act[k] k_time = 0 k_precent = 0 for i in grp_act[k]: _time = i[0].split(':') d_time = int(_time[0])+float(_time[1])/60 k_time += d_time _total += d_time k_precent += float(i[1]) #print type(d_time) #print k_time, k_precent grp_act[k] = ["%.2f"%k_time, str(k_precent)] #print grp_act return _total, grp_act if __name__ == '__main__': if 2 != len(sys.argv) : print '''Usage: $ pre_data_chk.py path/2/[] ''' else: aim_path = sys.argv[1] chk_all_log(aim_path)
30.715909
82
0.436305
3485a97e04399f112e63493e9a7df6b69342ec0c
313
py
Python
Microservices/Events/Events/producer.py
satyap54/Microservices-Architecture
be397b351a61eb21229fad021590fcb0b07b8089
[ "MIT" ]
null
null
null
Microservices/Events/Events/producer.py
satyap54/Microservices-Architecture
be397b351a61eb21229fad021590fcb0b07b8089
[ "MIT" ]
null
null
null
Microservices/Events/Events/producer.py
satyap54/Microservices-Architecture
be397b351a61eb21229fad021590fcb0b07b8089
[ "MIT" ]
null
null
null
import asyncio import aiormq
20.866667
46
0.664537
3485c332458e998d42d6f67bb82de0ba508582c0
8,473
py
Python
timezone/embeds.py
duanegtr/legendv3-cogs
ffde1452a75ad42b4f6511b612ce486e96fcd6de
[ "MIT" ]
10
2020-05-25T13:32:30.000Z
2022-02-01T12:33:07.000Z
timezone/embeds.py
darcyle/tl-cogs
6b13c4a6247115571c5a2bb6ea98ed1fe2d44d79
[ "MIT" ]
2
2020-05-23T22:53:07.000Z
2020-08-09T11:28:12.000Z
timezone/embeds.py
darcyle/tl-cogs
6b13c4a6247115571c5a2bb6ea98ed1fe2d44d79
[ "MIT" ]
7
2020-05-18T17:37:33.000Z
2022-01-13T04:08:05.000Z
"""Embeds for Timezone Legends discord bot.""" import time import discord from dateutil.parser import parse # pip install python-dateutil from pytz import timezone from datetime import datetime """ embed = discord.Embed(colour=discord.Colour(0x5c0708), description="Listing all Events that matched your request (**if any**)", timestamp=datetime.utcfromtimestamp(time.time())) embed.set_author(name="Events", url="https://discordapp.com/channels/374596069989810176/374597178989215757", icon_url="https://www.kindpng.com/picc/m/246-2465899_upcoming-events-icon-calendar-icon-png-transparent-png.png") embed.set_thumbnail(url="https://cdn.iconscout.com/icon/premium/png-256-thumb/global-time-zone-1480117-1253197.png") embed.set_footer(text="Bot by Vanhorn | Academy", icon_url="https://vignette.wikia.nocookie.net/clashroyale/images/4/42/GraveyardCard.png/revision/latest/top-crop/width/360/height/450?cb=20171212204803") for event_name, event_time, time_to_event in event_list: embed.add_field(name="Event", value=f"**{event_name}**", inline=True) embed.add_field(name="Local Time", value=f"**{event_time}**", inline=True) embed.add_field(name="Time Left", value=f"**{time_to_event}**", inline=True) #print(embed.to_dict()) await ctx.send(embed=embed) """ """ [x] create_event Creates an event in your timezone, or in a given t... [x] events Lists all registered events. [x] show_events Lists all registered events. [x] remove_event Erases an event if the given ID is found. [x] compare Compare your saved timezone with another user's timezone. [x] iso Looks up ISO3166 country codes and gives you a supported ti... [x] me Sets your timezone. [x] set Allows the mods to edit timezones. [x] tell Tells you what the time will be in the given timezone. [x] tz Gets the time in any timezone. [x] user Shows the current time for user. """
57.639456
331
0.688304
34895fa122da2aa59b08dae55bc7b95297e3503a
1,521
py
Python
utils/commonutils.py
rupakc/Storyweaver
9a6ec1c040a09f730cc6f32ce385f44a79d28663
[ "BSL-1.0" ]
null
null
null
utils/commonutils.py
rupakc/Storyweaver
9a6ec1c040a09f730cc6f32ce385f44a79d28663
[ "BSL-1.0" ]
null
null
null
utils/commonutils.py
rupakc/Storyweaver
9a6ec1c040a09f730cc6f32ce385f44a79d28663
[ "BSL-1.0" ]
null
null
null
import hashlib import shutil import requests import os from config import constants
33.065217
82
0.721893
348a2b80711dded6c85af5b308b4122d1e73013c
14,635
py
Python
flask_app.py
wacovidhackathon/TPCraze
57a9485a008536f6326e29328df6af6d29045a6d
[ "MIT" ]
null
null
null
flask_app.py
wacovidhackathon/TPCraze
57a9485a008536f6326e29328df6af6d29045a6d
[ "MIT" ]
null
null
null
flask_app.py
wacovidhackathon/TPCraze
57a9485a008536f6326e29328df6af6d29045a6d
[ "MIT" ]
null
null
null
import time, os import tomtomSearch from flask_bootstrap import Bootstrap from flask import Flask, render_template, request, redirect, flash, session, jsonify, url_for from flask_wtf import FlaskForm from wtforms import StringField, BooleanField, SubmitField, IntegerField, SelectField, RadioField from wtforms.validators import DataRequired from datetime import datetime from flaskext.mysql import MySQL from pytz import timezone ''' TODO: -add so user can input address as well - fix the full page 2 columns - add information about the store - integrate the user - authenticate the managers ''' # declaring app name app = Flask(__name__) mysql = MySQL() # MySQL configurations app.config['MYSQL_DATABASE_USER'] = os.environ["MYSQL_USER"] app.config['MYSQL_DATABASE_PASSWORD'] = os.environ["MYSQL_PW"] app.config['MYSQL_DATABASE_DB'] = os.environ["MYSQL_DB"] app.config['MYSQL_DATABASE_HOST'] = os.environ["MYSQL_URL"] mysql.init_app(app) if __name__ == '__main__': app.run(use_reloader=True, debug=True)
38.111979
374
0.610386
348c6299bee8c546cf7aa75e9c41522b146fab11
2,634
py
Python
pkg/codegen/internal/test/testdata/output-funcs/py_tests/pulumi_py_tests.py
sticha/pulumi
76ee1b8ccfee815eb315d9e0e0ddfaaf505c472b
[ "Apache-2.0" ]
null
null
null
pkg/codegen/internal/test/testdata/output-funcs/py_tests/pulumi_py_tests.py
sticha/pulumi
76ee1b8ccfee815eb315d9e0e0ddfaaf505c472b
[ "Apache-2.0" ]
null
null
null
pkg/codegen/internal/test/testdata/output-funcs/py_tests/pulumi_py_tests.py
sticha/pulumi
76ee1b8ccfee815eb315d9e0e0ddfaaf505c472b
[ "Apache-2.0" ]
null
null
null
# Copyright 2016-2021, Pulumi Corporation. # # 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. # These are copied from pulumi-azure-native or hand-written to # compensate for an incomplete codegen test setup, we could fix the # test to code-gen this from schema. from collections import namedtuple import pulumi CodegenTest = namedtuple('CodegenTest', ['outputs']) Outputs = namedtuple('Outputs', ['StorageAccountKeyResponse']) outputs = Outputs(StorageAccountKeyResponse) codegentest = CodegenTest(outputs)
30.988235
89
0.65186
348cdede6c52f1578247987d1f2b6285625e722a
1,800
py
Python
scripts/gan/conditional_dcgan/gen_data_from_img.py
hiroyasuakada/ros_start
10221ad2bcaefa4aaadc6c90424a3751126ac256
[ "MIT" ]
null
null
null
scripts/gan/conditional_dcgan/gen_data_from_img.py
hiroyasuakada/ros_start
10221ad2bcaefa4aaadc6c90424a3751126ac256
[ "MIT" ]
null
null
null
scripts/gan/conditional_dcgan/gen_data_from_img.py
hiroyasuakada/ros_start
10221ad2bcaefa4aaadc6c90424a3751126ac256
[ "MIT" ]
null
null
null
# generate data from bag images from PIL import Image from pathlib import Path import os, glob # manipulate file or directory import numpy as np if __name__ == '__main__': DA = DataArrangement() X_not_traking, Y_not_traking, X_traking, Y_traking = DA.load_data()
36.734694
97
0.566111
348d2d60fb5385e97d0dc27346784f7b73fdadac
331
py
Python
example/demo/book/views.py
iwwxiong/flask_restapi
57fca3bf07d913b31b6b7ef877328b0e07056c39
[ "MIT" ]
6
2019-04-23T02:18:55.000Z
2019-12-10T13:16:21.000Z
example/demo/book/views.py
dracarysX/flask_scaffold
57fca3bf07d913b31b6b7ef877328b0e07056c39
[ "MIT" ]
null
null
null
example/demo/book/views.py
dracarysX/flask_scaffold
57fca3bf07d913b31b6b7ef877328b0e07056c39
[ "MIT" ]
3
2019-05-22T06:00:17.000Z
2020-01-14T17:02:35.000Z
#! /usr/bin/env python # -*- coding: utf-8 -*- # flask_restapi import from flask_restapi.views import APIMethodView from .models import Book from .forms import BookForm
19.470588
45
0.716012
348dadc81585ed38d6f51d902f482767add11796
2,484
py
Python
backend/apps/cmdb/models/field.py
codelieche/erp
96861ff63a63a93918fbd5181ffb2646446d0eec
[ "MIT" ]
null
null
null
backend/apps/cmdb/models/field.py
codelieche/erp
96861ff63a63a93918fbd5181ffb2646446d0eec
[ "MIT" ]
29
2020-06-05T19:57:11.000Z
2022-02-26T13:42:36.000Z
backend/apps/cmdb/models/field.py
codelieche/erp
96861ff63a63a93918fbd5181ffb2646446d0eec
[ "MIT" ]
null
null
null
# -*- coding:utf-8 -*- from django.db import models from account.models import User # from cmdb.types import get_instance from cmdb.models import Model
38.8125
107
0.667069
3490cf6f7075a2aef1693d69a9521b0b995d567b
604
py
Python
unidad2/pc2/e1.py
upc-projects/cc76
0f1663cc439889b0c7e924923639e7c2e032b9b6
[ "MIT" ]
1
2020-09-21T16:56:24.000Z
2020-09-21T16:56:24.000Z
unidad2/pc2/e1.py
upc-projects/cc76
0f1663cc439889b0c7e924923639e7c2e032b9b6
[ "MIT" ]
null
null
null
unidad2/pc2/e1.py
upc-projects/cc76
0f1663cc439889b0c7e924923639e7c2e032b9b6
[ "MIT" ]
null
null
null
import math G = [[(2,0)], [(0,20), (3,20)], [(4,-60)], [(5,-60)], []] win = True distance, _ = Bellman_ford(G) for i in distance: if i <= -100: win=False print("winnable" if win else "hopeless")
18.875
53
0.463576
3491846c1c297a3eafd5e93b910d0c66155d9336
1,743
py
Python
Incident-Response/Tools/dfirtrack/dfirtrack_main/exporter/markdown/markdown_check_data.py
sn0b4ll/Incident-Playbook
cf519f58fcd4255674662b3620ea97c1091c1efb
[ "MIT" ]
1
2021-07-24T17:22:50.000Z
2021-07-24T17:22:50.000Z
Incident-Response/Tools/dfirtrack/dfirtrack_main/exporter/markdown/markdown_check_data.py
sn0b4ll/Incident-Playbook
cf519f58fcd4255674662b3620ea97c1091c1efb
[ "MIT" ]
2
2022-02-28T03:40:31.000Z
2022-02-28T03:40:52.000Z
Incident-Response/Tools/dfirtrack/dfirtrack_main/exporter/markdown/markdown_check_data.py
sn0b4ll/Incident-Playbook
cf519f58fcd4255674662b3620ea97c1091c1efb
[ "MIT" ]
2
2022-02-25T08:34:51.000Z
2022-03-16T17:29:44.000Z
from django.contrib import messages from dfirtrack_config.models import SystemExporterMarkdownConfigModel from dfirtrack_main.logger.default_logger import warning_logger import os def check_config(request): """ check variables in config """ # get config model model = SystemExporterMarkdownConfigModel.objects.get(system_exporter_markdown_config_name = 'SystemExporterMarkdownConfig') # reset stop condition stop_exporter_markdown = False # check MARKDOWN_PATH for empty string if not model.markdown_path: messages.error(request, "`MARKDOWN_PATH` contains an emtpy string. Check config!") # call logger warning_logger(str(request.user), " EXPORTER_MARKDOWN variable MARKDOWN_PATH empty string") stop_exporter_markdown = True # check MARKDOWN_PATH for existence in file system (check only if it actually is a non-empty string) if model.markdown_path: if not os.path.isdir(model.markdown_path): messages.error(request, "`MARKDOWN_PATH` does not exist in file system. Check config or filesystem!") # call logger warning_logger(str(request.user), " EXPORTER_MARKDOWN path MARKDOWN_PATH not existing") stop_exporter_markdown = True # check MARKDOWN_PATH for write permission (check only if it actually is a non-empty string) if model.markdown_path: if not os.access(model.markdown_path, os.W_OK): messages.error(request, "`MARKDOWN_PATH` is not writeable. Check config or filesystem!") # call logger warning_logger(str(request.user), " EXPORTER_MARKDOWN path MARKDOWN_PATH not writeable") stop_exporter_markdown = True return stop_exporter_markdown
44.692308
128
0.729776
3491ecdf0d743d67d90929ff69bd755f765fc9ba
44,309
py
Python
src/module_factions.py
faycalki/medieval-conquests
113e13e2b166b79517c14f2c13f7561307a89f75
[ "MIT" ]
7
2019-08-11T14:20:20.000Z
2021-11-21T06:48:24.000Z
src/module_factions.py
faycalki/medieval-conquests
113e13e2b166b79517c14f2c13f7561307a89f75
[ "MIT" ]
null
null
null
src/module_factions.py
faycalki/medieval-conquests
113e13e2b166b79517c14f2c13f7561307a89f75
[ "MIT" ]
null
null
null
# -*- coding: utf8 -*- from header_factions import * #################################################################################################################### # Each faction record contains the following fields: # 1) Faction id: used for referencing factions in other files. # The prefix fac_ is automatically added before each faction id. # 2) Faction name. # 3) Faction flags. See header_factions.py for a list of available flags # 4) Faction coherence. Relation between members of this faction. # 5) Relations. This is a list of relation records. # Each relation record is a tuple that contains the following fields: # 5.1) Faction. Which other faction this relation is referring to # 5.2) Value: Relation value between the two factions. # Values range between -1 and 1. # 6) Ranks # 7) Faction color (default is gray) #################################################################################################################### factions = [ ("no_faction", "No Faction", 0, 0.9, []), ("commoners", "Commoners", 0, 0.1, [("forest_bandits",-0.20),("player_faction",0.10),("mountain_bandits",-0.20),("undeads",-0.70),("outlaws",-0.60)]), ("outlaws", "Outlaws", 0, 0.5, [("kingdom_9",-0.05),("kingdom_15",-0.05),("kingdom_23",-0.05),("kingdom_3",-0.05),("kingdom_24",-0.05),("kingdom_10",-0.05),("kingdom_1",-0.05),("kingdom_20",-0.05),("kingdom_13",-0.05),("kingdom_19",-0.05),("kingdom_36",-0.05),("kingdom_11",-0.05),("player_supporters_faction",-0.05),("kingdom_34",-0.05),("kingdom_37",-0.05),("kingdom_25",-0.05),("kingdom_8",-0.05),("kingdom_5",-0.05),("kingdom_42",-0.05),("kingdom_2",-0.05),("kingdom_31",-0.05),("merchants",-0.50),("kingdom_22",-0.05),("kingdom_32",-0.05),("innocents",-0.05),("kingdom_35",-0.05),("player_faction",-0.15),("kingdom_18",-0.05),("kingdom_26",-0.05),("papacy",-0.05),("kingdom_38",-0.05),("kingdom_28",-0.05),("crusade",-0.05),("kingdom_39",-0.05),("kingdom_30",-0.05),("manhunters",-0.60),("kingdom_7",-0.05),("kingdom_16",-0.05),("kingdom_6",-0.05),("kingdom_12",-0.05),("kingdom_33",-0.05),("kingdom_40",-0.05),("kingdom_4",-0.05),("kingdom_29",-0.05),("commoners",-0.60),("kingdom_41",-0.05),("kingdom_14",-0.05),("kingdom_17",-0.05),("kingdom_27",-0.05)], [], 0x00888888), ("neutral", "Neutral", 0, 0.1, [], [], 0x00ffffff), ("innocents", "Innocents", ff_always_hide_label, 0.5, [("outlaws",-0.05),("dark_knights",-0.90)]), ("merchants", "Merchants", ff_always_hide_label, 0.5, [("forest_bandits",-0.50),("deserters",-0.50),("mountain_bandits",-0.50),("outlaws",-0.50)]), ("dark_knights", "{!}Dark Knights", 0, 0.5, [("innocents",-0.90),("player_faction",-0.40)]), ("culture_finnish", "{!}culture finnish", 0, 0.9, []), ("culture_mazovian", "{!}culture mazovian", 0, 0.9, []), ("culture_serbian", "{!}culture serbian", 0, 0.9, []), ("culture_welsh", "{!}culture welsh", 0, 0.9, []), ("culture_teutonic", "{!}culture teutonic", 0, 0.9, []), ("culture_balkan", "{!}culture balkan", 0, 0.9, []), ("culture_rus", "{!}culture rus", 0, 0.9, []), ("culture_nordic", "{!}culture nordic", 0, 0.9, []), ("culture_baltic", "{!}culture baltic", 0, 0.9, []), ("culture_marinid", "{!}culture marinid", 0, 0.9, []), ("culture_mamluke", "{!}culture mamluke", 0, 0.9, []), ("culture_byzantium", "{!}culture byzantium", 0, 0.9, []), ("culture_iberian", "{!}culture iberian", 0, 0.9, []), ("culture_italian", "{!}culture italian", 0, 0.9, []), ("culture_andalus", "{!}culture andalus", 0, 0.9, []), ("culture_gaelic", "{!}culture gaelic", 0, 0.9, []), ("culture_anatolian_christian", "{!}culture anatolian", 0, 0.9, []), ("culture_anatolian", "{!}culture anatolian", 0, 0.9, []), ("culture_scotish", "{!}culture scotish", 0, 0.9, []), ("culture_western", "{!}culture western", 0, 0.9, []), ("culture_mongol", "{!}culture mongol", 0, 0.9, []), ("player_faction", "Player Faction", 0, 0.9, [("black_khergits",-0.30),("player_supporters_faction",1.00),("peasant_rebels",-0.40),("forest_bandits",-0.15),("manhunters",0.10),("deserters",-0.10),("mountain_bandits",-0.15),("undeads",-0.50),("outlaws",-0.15),("dark_knights",-0.40),("commoners",0.10)], [], 0x00cccccc), ("player_supporters_faction", "Player's Supporters", 0, 0.9, [("peasant_rebels",-0.10),("forest_bandits",-0.05),("player_faction",1.00),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x00468493), ("kingdom_1", "Teutonic Order", 0, 0.9, [("black_khergits",-0.02),("kingdom_8",-0.20),("peasant_rebels",-0.10),("forest_bandits",-0.05),("deserters",-0.02),("kingdom_6",0.50),("mountain_bandits",-0.05),("outlaws",-0.05),("kingdom_75",-0.50),("kingdom_76",-0.50),("kingdom_77",-0.50),("kingdom_78",-0.50),("kingdom_4",0.10),("kingdom_14",0.10),("kingdom_43",-40.00)], [], 0x00e9e9e9), ("kingdom_2", "Kingdom of Lithuania", 0, 0.9, [("black_khergits",-0.02),("kingdom_3",0.10),("kingdom_36",0.50),("kingdom_34",0.50),("peasant_rebels",-0.10),("forest_bandits",-0.05),("kingdom_35",0.50),("crusade",-0.50),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05),("kingdom_33",0.50)], [], 0x00badeb2), ("kingdom_3", "Golden Horde", 0, 0.9, [("kingdom_8",0.10),("kingdom_5",-1.00),("kingdom_2",0.10),("peasant_rebels",-0.10),("forest_bandits",-0.05),("crusade",-0.50),("deserters",-0.02),("kingdom_7",-1.00),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x00a33e32), ("kingdom_4", "Kingdom of Denmark", 0, 0.9, [("kingdom_1",0.10),("peasant_rebels",-0.10),("forest_bandits",-0.05),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x009b1a1a), ("kingdom_5", "Polish Principalities", 0, 0.9, [("kingdom_3",-1.00),("peasant_rebels",-0.10),("forest_bandits",-0.05),("deserters",-0.02),("kingdom_7",0.10),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x00ff0000), ("kingdom_6", "Holy Roman Empire", 0, 0.9, [("kingdom_1",0.50),("kingdom_42",1.00),("peasant_rebels",-0.10),("forest_bandits",-0.05),("kingdom_38",0.50),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05),("kingdom_41",1.00)], [], 0x00ffcc00), ("kingdom_7", "Kingdom of Hungary", 0, 0.9, [("kingdom_3",-1.00),("kingdom_5",0.10),("peasant_rebels",-0.10),("forest_bandits",-0.05),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x00289327), ("kingdom_8", "Novgorod Republic", 0, 0.9, [("kingdom_3",0.10),("kingdom_1",-0.20),("peasant_rebels",-0.10),("forest_bandits",-0.05),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05),("kingdom_14",-0.20)], [], 0x009e0b6f), ("kingdom_9", "Kingdom of England", 0, 0.9, [("kingdom_37",-1.00),("peasant_rebels",-0.10),("forest_bandits",-0.05),("deserters",-0.02),("mountain_bandits",-0.05),("kingdom_79",-0.50),("outlaws",-0.05)], [], 0x00931124), ("kingdom_10", "Kingdom of France", 0, 0.9, [("peasant_rebels",-0.10),("forest_bandits",-0.05),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x00002395), ("kingdom_11", "Kingdom of Norway", 0, 0.9, [("kingdom_13",-0.20),("peasant_rebels",-0.10),("forest_bandits",-0.05),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05),("kingdom_12",-0.20)], [], 0x006669d6), ("kingdom_12", "Kingdom of Scotland", 0, 0.9, [("kingdom_11",-0.20),("peasant_rebels",-0.10),("forest_bandits",-0.05),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x0022d8a7), ("kingdom_13", "Gaelic Kingdoms", 0, 0.9, [("kingdom_11",-0.20),("peasant_rebels",-0.10),("forest_bandits",-0.05),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x0077b322), ("kingdom_14", "Kingdom of Sweden", 0, 0.9, [("kingdom_1",0.10),("kingdom_8",-0.20),("peasant_rebels",-0.10),("forest_bandits",-0.05),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x003254b5), ("kingdom_15", "Kingdom of Halych-Volhynia", 0, 0.9, [("peasant_rebels",-0.10),("forest_bandits",-0.05),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x00ece874), ("kingdom_16", "Kingdom of Portugal", 0, 0.9, [("kingdom_20",-40.00),("peasant_rebels",-0.10),("forest_bandits",-0.05),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x00003399), ("kingdom_17", "Crown of Aragon", 0, 0.9, [("peasant_rebels",-0.10),("forest_bandits",-0.05),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x0007b233), ("kingdom_18", "Crown of Castile", 0, 0.9, [("kingdom_20",-40.00),("peasant_rebels",-0.10),("forest_bandits",-0.05),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x00d85ac4), ("kingdom_19", "Kingdom of Navarre", 0, 0.9, [("peasant_rebels",-0.10),("forest_bandits",-0.05),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x00f7f497), ("kingdom_20", "Emirate of Granada", 0, 0.9, [("peasant_rebels",-0.10),("forest_bandits",-0.05),("kingdom_18",-40.00),("crusade",-0.50),("deserters",-0.02),("kingdom_16",-40.00),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x00abc904), ("papacy", "Papal States", 0, 0.9, [("peasant_rebels",-0.10),("forest_bandits",-0.05),("crusade",-0.50),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x00fff17a), ("kingdom_22", "Byzantine Empire", 0, 0.9, [("peasant_rebels",-0.10),("forest_bandits",-0.05),("kingdom_26",-1.00),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x00760d0d), ("kingdom_23", "Crusader States", 0, 0.9, [("kingdom_25",-1.00),("peasant_rebels",-0.10),("forest_bandits",-0.05),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05),("kingdom_27",0.10)], [], 0x00f3efb8), ("kingdom_24", "Kingdom of Sicily", 0, 0.9, [("peasant_rebels",-0.10),("forest_bandits",-0.05),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x00799cb5), ("kingdom_25", "Mamluk Sultanate", 0, 0.9, [("kingdom_23",-1.00),("peasant_rebels",-0.10),("forest_bandits",-0.05),("crusade",-0.50),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05),("kingdom_27",-1.00)], [], 0x00ebe800), ("kingdom_26", "Latin Empire", 0, 0.9, [("peasant_rebels",-0.10),("kingdom_22",-1.00),("forest_bandits",-0.05),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x00b26248), ("kingdom_27", "Ilkhanate", 0, 0.9, [("kingdom_23",0.10),("kingdom_25",-1.00),("peasant_rebels",-0.10),("forest_bandits",-0.05),("crusade",-0.50),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x00e19004), ("kingdom_28", "Hafsid Dynasty", 0, 0.9, [("peasant_rebels",-0.10),("forest_bandits",-0.05),("crusade",-0.50),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x00a48460), ("kingdom_29", "Kingdom of Serbia", 0, 0.9, [("peasant_rebels",-0.10),("forest_bandits",-0.05),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x00b38263), ("kingdom_30", "Bulgarian Empire", 0, 0.9, [("peasant_rebels",-0.10),("forest_bandits",-0.05),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x0076a296), ("kingdom_31", "Marinid Dynasty", 0, 0.9, [("peasant_rebels",-0.10),("forest_bandits",-0.05),("crusade",-0.50),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x00c1272d), ("kingdom_32", "Republic of Venice", 0, 0.9, [("peasant_rebels",-0.10),("forest_bandits",-0.05),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x00c1172d), ("kingdom_33", "Yotvingians", 0, 0.9, [("kingdom_2",0.50),("peasant_rebels",-0.10),("forest_bandits",-0.05),("crusade",-0.50),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x003e7583), ("kingdom_34", "Prussians", 0, 0.9, [("kingdom_2",0.50),("peasant_rebels",-0.10),("forest_bandits",-0.05),("crusade",-0.50),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x0065c0d7), ("kingdom_35", "Curonians", 0, 0.9, [("kingdom_2",0.50),("peasant_rebels",-0.10),("forest_bandits",-0.05),("crusade",-0.50),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x003e7583), ("kingdom_36", "Samogitians", 0, 0.9, [("kingdom_2",0.50),("peasant_rebels",-0.10),("forest_bandits",-0.05),("crusade",-0.50),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x00529cae), ("kingdom_37", "Principality of Wales", 0, 0.9, [("kingdom_9",-1.00),("peasant_rebels",-0.10),("forest_bandits",-0.05),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x0000dc00), ("kingdom_38", "Republic of Genoa", 0, 0.9, [("peasant_rebels",-0.10),("forest_bandits",-0.05),("crusade",-0.50),("kingdom_39",-0.50),("deserters",-0.02),("kingdom_6",0.50),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x00e1900a), ("kingdom_39", "Republic of Pisa", 0, 0.9, [("peasant_rebels",-0.10),("forest_bandits",-0.05),("kingdom_38",-0.50),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x0007e233), ("kingdom_40", "Guelphs", 0, 0.9, [("peasant_rebels",-0.10),("forest_bandits",-0.05),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05),("kingdom_41",-0.80)], [], 0x003254e5), ("kingdom_41", "Ghibellines", 0, 0.9, [("peasant_rebels",-0.10),("forest_bandits",-0.05),("deserters",-0.02),("kingdom_6",1.00),("mountain_bandits",-0.05),("outlaws",-0.05),("kingdom_40",-0.80)], [], 0x009e026a), ("kingdom_42", "Kingdom of Bohemia", 0, 0.9, [("peasant_rebels",-0.10),("forest_bandits",-0.05),("deserters",-0.02),("kingdom_6",1.00),("mountain_bandits",-0.05),("outlaws",-0.05)], [], 0x00e8e8e8), #####Kaos Safe Begin #MAUAL EDITS REQUIRED #####Kaos begin add factions correct major faction, also fix the colors for the factions, especially for the start as king/prince, as well as for the rebels/civ. #Module factions Search for this line ("kingdoms_end","{!}kingdoms_end", 0, 0,[], []), and place these lines above it #KAOS (POLITICAL) #Begin rebels (They are only named this until they win the war, if they win the war) must be double amount of regular factions to test for simple_trigger errors, empire too. *42-84 ("kingdom_43", "Teutonics-Prussians", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05),("kingdom_1", -40.00)], [], 0x00888888), #0x00c9c9c9 #Change colors here, as well as relations 0XCC9900 is color, ("forest_bandits", -0.05) means -5 relations against forest bandits, must apply to both factions. ("kingdom_44", "Wendish Empire", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00698064), ("kingdom_45", "Pecheng Clan", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00813229), ("kingdom_46", "Kingdom of Scandinavia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x008a372d), ("kingdom_47", "Pomeralia Principalities", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00872f2f), ("kingdom_48", "Empire of Germania", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x008c7001), ("kingdom_49", "Empire of Carpathia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00278c25), ("kingdom_50", "Kievan Rus", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x006555d6), #0x00E714A3 ("kingdom_51", "Kingdom of Brittania", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x006a1c12), ("kingdom_52", "New Francia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00243777), ("kingdom_53", "Kingdom of Norge", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x000f1d67), ("kingdom_54", "Chiefdom of Kemi", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00105a46), ("kingdom_55", "Kingdom of Ireland", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x0048720e), ("kingdom_56", "Chiefdom of Sapmi", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00314375), ("kingdom_57", "Kingdom of Galicia-Volhynia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00737013), ("kingdom_58", "Hispania", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00002b80), ("kingdom_59", "Principality of Catalonia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00035218), ("kingdom_60", "Crown of Leon", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00572850), ("kingdom_61", "Kingdom of Vasconia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x006d6b44), ("kingdom_62", "Ahlidid Dynasty", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00485500), ("kingdom_63", "Union of Papacy", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00817408), ("kingdom_64", "Eastern Roman Empire", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00440000), ("kingdom_65", "Kingdom of Armenia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00858369), ("kingdom_66", "Kingdom of Apulia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x002c4557), ("kingdom_67", "Hashimid Emirate", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x006f6d00), ("kingdom_68", "Empire of Aegean", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x008c5341), ("kingdom_69", "Kingdom of Georgia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00ed370b), #Red ("kingdom_70", "Maghrawavid Dynasty", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x006F6457), ("kingdom_71", "Kingdom of Epirius", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00338681), ("kingdom_72", "Kingdom of Karvuna-Moesia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00394f49), ("kingdom_73", "Zayanid Dynasty", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00803739), ("kingdom_74", "Kingdom of Croatia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00881184), ("kingdom_75", "Middle Rurikid Dynasty", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("kingdom_1", -0.50),("kingdom_78", 0.85),("kingdom_76", 0.85),("kingdom_77", 0.85),("forest_bandits", -0.05)], [], 0x00566f75), ("kingdom_76", "West Rurikid Dynasty", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("kingdom_1", -0.50),("kingdom_75", 0.85),("kingdom_78", 0.85),("kingdom_77", 0.85),("forest_bandits", -0.05)], [], 0x0048DAFF), ("kingdom_77", "East Rurikid Dynasty", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("kingdom_1", -0.50),("kingdom_75", 0.85),("kingdom_76", 0.85),("kingdom_78", 0.85),("forest_bandits", -0.05)], [], 0x00B1EFFF), ("kingdom_78", "North Rurikid Dynasty", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("kingdom_1", -0.50),("kingdom_75", 0.85),("kingdom_76", 0.85),("kingdom_77", 0.85),("forest_bandits", -0.05)], [], 0x0028464f), ("kingdom_79", "Kingdom of Gwynedd", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("kingdom_9", -0.80),("forest_bandits", -0.05)], [], 0x00526652), ("kingdom_80", "Most Serene House Doria", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00FFAD26), ("kingdom_81", "Most Serene House D'Appiano", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00F19E0E), ("kingdom_82", "Kingdom of Italy", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00a19c7d), ("kingdom_83", "Kingdom of Florence", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x005d1144), ("kingdom_84", "Kingdom of House Premyslid", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x0075728a), #End rebels ##Begin rebels old colors # ("kingdom_43", "Teutonics-Prussians", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05),("kingdom_1", -40.00)], [], 0x00888888), #0x00c9c9c9 #Change colors here, as well as relations 0XCC9900 is color, ("forest_bandits", -0.05) means -5 relations against forest bandits, must apply to both factions. # ("kingdom_44", "Wendish Empire", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x009DC196), # ("kingdom_45", "Pecheng Clan", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00a33e32), # ("kingdom_46", "Kingdom of Scandinavia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00EC5D4C), # ("kingdom_47", "Pomeralia Principalities", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00FF5A5A), # ("kingdom_48", "Empire of Germania", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00BD9700), # ("kingdom_49", "Empire of Carpathia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x003DD93B), # ("kingdom_50", "Kievan Rus", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00700c50), #0x00E714A3 # ("kingdom_51", "Kingdom of Brittania", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00DE3622), # ("kingdom_52", "New Francia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x003D69FA), # ("kingdom_53", "Kingdom of Norge", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00FF3737), # ("kingdom_54", "Chiefdom of Kemi", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00157B5F), # ("kingdom_55", "Kingdom of Ireland", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x0090E715), # ("kingdom_56", "Chiefdom of Sapmi", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00668EFF), # ("kingdom_57", "Kingdom of Galicia-Volhynia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00FFF826), # ("kingdom_58", "Hispania", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x000055FF), # ("kingdom_59", "Principality of Catalonia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x0004681E), # ("kingdom_60", "Crown of Leon", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x0078366E), # ("kingdom_61", "Kingdom of Vasconia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00ADAA6A), # ("kingdom_62", "Ahlidid Dynasty", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00586800), # ("kingdom_63", "Union of Papacy", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00F0D80B), # ("kingdom_64", "Eastern Roman Empire", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x004E0000), # ("kingdom_65", "Kingdom of Armenia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00FFFFFF), # ("kingdom_66", "Kingdom of Apulia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x003B5D75), # ("kingdom_67", "Hashimid Emirate", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x007A7800), # ("kingdom_68", "Empire of Aegean", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00FF8C66), # ("kingdom_69", "Kingdom of Georgia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00855400), # ("kingdom_70", "Maghrawavid Dynasty", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x006F6457), # ("kingdom_71", "Kingdom of Epirius", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00B86938), # ("kingdom_72", "Kingdom of Karvuna-Moesia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x004C6961), # ("kingdom_73", "Zayanid Dynasty", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00BB4C50), # ("kingdom_74", "Kingdom of Croatia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00B916B4), # ("kingdom_75", "Middle Rurikid Dynasty", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("kingdom_1", -0.50),("kingdom_78", 0.85),("kingdom_76", 0.85),("kingdom_77", 0.85),("forest_bandits", -0.05)], [], 0x006C8B93), # ("kingdom_76", "West Rurikid Dynasty", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("kingdom_1", -0.50),("kingdom_75", 0.85),("kingdom_78", 0.85),("kingdom_77", 0.85),("forest_bandits", -0.05)], [], 0x0048DAFF), # ("kingdom_77", "East Rurikid Dynasty", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("kingdom_1", -0.50),("kingdom_75", 0.85),("kingdom_76", 0.85),("kingdom_78", 0.85),("forest_bandits", -0.05)], [], 0x00B1EFFF), # ("kingdom_78", "North Rurikid Dynasty", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("kingdom_1", -0.50),("kingdom_75", 0.85),("kingdom_76", 0.85),("kingdom_77", 0.85),("forest_bandits", -0.05)], [], 0x00376571), # ("kingdom_79", "Kingdom of Gwynedd", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("kingdom_9", -0.80),("forest_bandits", -0.05)], [], 0x00A0D1A0), # ("kingdom_80", "Most Serene House Doria", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00FFAD26), # ("kingdom_81", "Most Serene House D'Appiano", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00F19E0E), # ("kingdom_82", "Kingdom of Italy", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00A1ADE1), # ("kingdom_83", "Kingdom of Florence", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00D8239C), # ("kingdom_84", "Kingdom of House Premyslid", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x00aca6ce), # #End old colors #Begin Civil (If rebels win the war, they change to a civil faction below). #84-126 for testing # ("kingdom_85", "Empire Of Swadia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0XCC9900), # ("kingdom_86", "Empire Of Vaegir", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0X669999), # ("kingdom_87", "Khergit Empire", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0XCC66FF), # ("kingdom_88", "Empire Of Nord", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0X3333FF), # ("kingdom_89", "Empire Of Rhodok", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0X99FF66), # ("kingdom_90", "Sarranid Empire", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0XCCFF66), # ("kingdom_91", "Empire Of Swadia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0XCC9900), # ("kingdom_92", "Empire Of Vaegir", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0X669999), # ("kingdom_93", "Khergit Empire", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0XCC66FF), # ("kingdom_94", "Empire Of Nord", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0X3333FF), # ("kingdom_95", "Empire Of Rhodok", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0X99FF66), # ("kingdom_96", "Sarranid Empire", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0XCCFF66), # ("kingdom_97", "Empire Of Swadia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0XCC9900), # ("kingdom_98", "Empire Of Vaegir", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0X669999), # ("kingdom_99", "Khergit Empire", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0XCC66FF), # ("kingdom_100", "Empire Of Nord", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0X3333FF), # ("kingdom_101", "Empire Of Rhodok", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0X99FF66), # ("kingdom_102", "Sarranid Empire", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0XCCFF66), # ("kingdom_103", "Empire Of Swadia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0XCC9900), # ("kingdom_104", "Empire Of Vaegir", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0X669999), # ("kingdom_105", "Khergit Empire", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0XCC66FF), # ("kingdom_106", "Empire Of Nord", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0X3333FF), # ("kingdom_107", "Empire Of Rhodok", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0X99FF66), # ("kingdom_108", "Sarranid Empire", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0XCCFF66), # ("kingdom_109", "Empire Of Swadia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0XCC9900), # ("kingdom_110", "Empire Of Vaegir", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0X669999), # ("kingdom_111", "Khergit Empire", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0XCC66FF), # ("kingdom_112", "Empire Of Nord", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0X3333FF), # ("kingdom_113", "Empire Of Rhodok", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0X99FF66), # ("kingdom_114", "Sarranid Empire", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0XCCFF66), # ("kingdom_115", "Empire Of Swadia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0XCC9900), # ("kingdom_116", "Empire Of Vaegir", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0X669999), # ("kingdom_117", "Khergit Empire", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0XCC66FF), # ("kingdom_118", "Empire Of Nord", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0X3333FF), # ("kingdom_119", "Empire Of Rhodok", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0X99FF66), # ("kingdom_120", "Sarranid Empire", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0XCCFF66), # ("kingdom_121", "Empire Of Swadia", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0XCC9900), # ("kingdom_122", "Empire Of Vaegir", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0X669999), # ("kingdom_123", "Khergit Empire", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0XCC66FF), # ("kingdom_124", "Empire Of Nord", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0X3333FF), # ("kingdom_125", "Empire Of Rhodok", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0X99FF66), # ("kingdom_126", "Sarranid Empire", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0XCCFF66), #End civil #KAOS (POLITICAL) #####Kaos Safe End #####Kaos end add faction ("kingdoms_end", "{!}kingdoms end", 0, 0.0, []), ("robber_knights", "{!}robber knights", 0, 0.1, []), ("khergits", "{!}Khergits", 0, 0.5, []), ("black_khergits", "{!}Black Khergits", 0, 0.5, [("kingdom_1",-0.02),("kingdom_2",-0.02),("player_faction",-0.30)]), ("manhunters", "Manhunters", 0, 0.5, [("forest_bandits",-0.60),("player_faction",0.10),("deserters",-0.60),("mountain_bandits",-0.60),("outlaws",-0.60)]), ("deserters", "Deserters", 0, 0.5, [("kingdom_9",-0.02),("kingdom_15",-0.02),("kingdom_23",-0.02),("kingdom_3",-0.02),("kingdom_24",-0.02),("kingdom_10",-0.02),("kingdom_1",-0.02),("kingdom_20",-0.02),("kingdom_13",-0.02),("kingdom_19",-0.02),("kingdom_36",-0.02),("kingdom_11",-0.02),("player_supporters_faction",-0.02),("kingdom_34",-0.02),("kingdom_37",-0.02),("kingdom_25",-0.02),("kingdom_8",-0.02),("kingdom_5",-0.02),("kingdom_42",-0.02),("kingdom_2",-0.02),("kingdom_31",-0.02),("merchants",-0.50),("kingdom_22",-0.02),("kingdom_32",-0.02),("kingdom_35",-0.02),("player_faction",-0.10),("kingdom_18",-0.02),("kingdom_26",-0.02),("papacy",-0.02),("kingdom_38",-0.02),("kingdom_28",-0.02),("crusade",-0.02),("kingdom_39",-0.02),("kingdom_30",-0.02),("manhunters",-0.60),("kingdom_7",-0.02),("kingdom_16",-0.02),("kingdom_6",-0.02),("kingdom_12",-0.02),("kingdom_33",-0.02),("kingdom_40",-0.02),("kingdom_4",-0.02),("kingdom_29",-0.02),("kingdom_41",-0.02),("kingdom_14",-0.02),("kingdom_17",-0.02),("kingdom_27",-0.02)], [], 0x00888888), ("mountain_bandits", "Mountain Bandits", 0, 0.5, [("kingdom_9",-0.05),("kingdom_15",-0.05),("kingdom_23",-0.05),("kingdom_3",-0.05),("kingdom_24",-0.05),("kingdom_10",-0.05),("kingdom_1",-0.05),("kingdom_20",-0.05),("kingdom_13",-0.05),("kingdom_19",-0.05),("kingdom_36",-0.05),("kingdom_11",-0.05),("player_supporters_faction",-0.05),("kingdom_34",-0.05),("kingdom_37",-0.05),("kingdom_25",-0.05),("kingdom_8",-0.05),("kingdom_5",-0.05),("kingdom_42",-0.05),("kingdom_2",-0.05),("kingdom_31",-0.05),("merchants",-0.50),("kingdom_22",-0.05),("kingdom_32",-0.05),("kingdom_35",-0.05),("player_faction",-0.15),("kingdom_18",-0.05),("kingdom_26",-0.05),("papacy",-0.05),("kingdom_38",-0.05),("kingdom_28",-0.05),("crusade",-0.05),("kingdom_39",-0.05),("kingdom_30",-0.05),("manhunters",-0.60),("kingdom_7",-0.05),("kingdom_16",-0.05),("kingdom_6",-0.05),("kingdom_12",-0.05),("kingdom_33",-0.05),("kingdom_40",-0.05),("kingdom_4",-0.05),("kingdom_29",-0.05),("commoners",-0.20),("kingdom_41",-0.05),("kingdom_14",-0.05),("kingdom_17",-0.05),("kingdom_27",-0.05)], [], 0x00888888), ("forest_bandits", "Forest Bandits", 0, 0.5, [("kingdom_9",-0.05),("kingdom_15",-0.05),("kingdom_23",-0.05),("kingdom_3",-0.05),("kingdom_24",-0.05),("kingdom_10",-0.05),("kingdom_1",-0.05),("kingdom_20",-0.05),("kingdom_13",-0.05),("kingdom_19",-0.05),("kingdom_36",-0.05),("kingdom_11",-0.05),("player_supporters_faction",-0.05),("kingdom_34",-0.05),("kingdom_37",-0.05),("kingdom_25",-0.05),("kingdom_8",-0.05),("kingdom_5",-0.05),("kingdom_42",-0.05),("kingdom_2",-0.05),("kingdom_31",-0.05),("merchants",-0.50),("kingdom_22",-0.05),("kingdom_32",-0.05),("kingdom_35",-0.05),("player_faction",-0.15),("kingdom_18",-0.05),("kingdom_26",-0.05),("papacy",-0.05),("kingdom_38",-0.05),("kingdom_28",-0.05),("crusade",-0.05),("kingdom_39",-0.05),("kingdom_30",-0.05),("manhunters",-0.60),("kingdom_7",-0.05),("kingdom_16",-0.05),("kingdom_6",-0.05),("kingdom_12",-0.05),("kingdom_33",-0.05),("kingdom_40",-0.05),("kingdom_4",-0.05),("kingdom_29",-0.05),("commoners",-0.20),("kingdom_41",-0.05),("kingdom_14",-0.05),("kingdom_17",-0.05),("kingdom_27",-0.05)], [], 0x00888888), ("undeads", "{!}Undeads", 0, 0.5, [("player_faction",-0.50),("commoners",-0.70)]), ("slavers", "{!}Slavers", 0, 0.1, []), ("peasant_rebels", "{!}Peasant Rebels", 0, 1.0, [("kingdom_9",-0.10),("kingdom_15",-0.10),("kingdom_23",-0.10),("kingdom_3",-0.10),("kingdom_24",-0.10),("kingdom_10",-0.10),("noble_refugees",-1.00),("kingdom_1",-0.10),("kingdom_20",-0.10),("kingdom_13",-0.10),("kingdom_19",-0.10),("kingdom_36",-0.10),("kingdom_11",-0.10),("player_supporters_faction",-0.10),("kingdom_34",-0.10),("kingdom_37",-0.10),("kingdom_25",-0.10),("kingdom_8",-0.10),("kingdom_5",-0.10),("kingdom_42",-0.10),("kingdom_2",-0.10),("kingdom_31",-0.10),("kingdom_22",-0.10),("kingdom_32",-0.10),("kingdom_35",-0.10),("player_faction",-0.40),("kingdom_18",-0.10),("kingdom_26",-0.10),("papacy",-0.10),("kingdom_38",-0.10),("kingdom_28",-0.10),("crusade",-0.10),("kingdom_39",-0.10),("kingdom_30",-0.10),("kingdom_7",-0.10),("kingdom_16",-0.10),("kingdom_6",-0.10),("kingdom_12",-0.10),("kingdom_33",-0.10),("kingdom_40",-0.10),("kingdom_4",-0.10),("kingdom_29",-0.10),("kingdom_41",-0.10),("kingdom_14",-0.10),("kingdom_17",-0.10),("kingdom_27",-0.10)]), ("noble_refugees", "{!}Noble Refugees", 0, 0.5, [("peasant_rebels",-1.00)]), ("crusade", "Crusaders", 0, 0.9, [("kingdom_3",-0.50),("kingdom_20",-0.50),("kingdom_36",-0.50),("kingdom_34",-0.50),("kingdom_25",-0.50),("kingdom_2",-0.50),("kingdom_31",-0.50),("peasant_rebels",-0.10),("forest_bandits",-0.05),("kingdom_35",-0.50),("papacy",-0.50),("kingdom_38",-0.50),("kingdom_28",-0.50),("deserters",-0.02),("mountain_bandits",-0.05),("outlaws",-0.05),("kingdom_33",-0.50),("kingdom_27",-0.50)], [], 0x00fff17a), ("end_minor_faction", "Village Idiots", 0, 0.9, [], [], 0x00fff17a), ]
131.091716
1,080
0.608296
3492885ac8a900a114a775185286f143d7123ed9
236
py
Python
data/python/pattern_12/code.py
MKAbuMattar/grammind-api
ccf6e9898f50f9e4c7671abecf65029198e2dc72
[ "MIT" ]
3
2021-12-29T13:03:27.000Z
2021-12-31T20:27:17.000Z
data/python/pattern_12/code.py
MKAbuMattar/grammind-api
ccf6e9898f50f9e4c7671abecf65029198e2dc72
[ "MIT" ]
2
2022-01-15T13:08:13.000Z
2022-01-18T19:41:07.000Z
data/python/pattern_12/code.py
MKAbuMattar/grammind-api
ccf6e9898f50f9e4c7671abecf65029198e2dc72
[ "MIT" ]
null
null
null
#MAIN PROGRAM STARTS HERE: num = int(input('Enter the number of rows and columns for the square: ')) for x in range(0, num): i = x + 1 for y in range(0, num): print ('{} '.format(i), end='') i += num print()
26.222222
73
0.555085
34940ee04b10ec17bfb59f0b5abe7be0ed5efa38
4,602
py
Python
models/bert_with_conversation_context.py
RobinRojowiec/intent-recognition-in-doctor-patient-interviews
b91c7a9f3ad70edd0f39b56e3219f48d1fcf2078
[ "Apache-2.0" ]
null
null
null
models/bert_with_conversation_context.py
RobinRojowiec/intent-recognition-in-doctor-patient-interviews
b91c7a9f3ad70edd0f39b56e3219f48d1fcf2078
[ "Apache-2.0" ]
null
null
null
models/bert_with_conversation_context.py
RobinRojowiec/intent-recognition-in-doctor-patient-interviews
b91c7a9f3ad70edd0f39b56e3219f48d1fcf2078
[ "Apache-2.0" ]
1
2021-11-24T18:48:47.000Z
2021-11-24T18:48:47.000Z
import pickle import torch import torch.nn as nn from torchtext.data import Field from common.paths import ROOT_RELATIVE_DIR, MODEL_PATH from models.bert_layer import BERTLayer from probability.tables import TransitionTable from utility.model_parameter import Configuration, ModelParameter
38.672269
140
0.69535
3495b6bc67d0421d48767015a4e9b3c968d3cfd4
3,468
py
Python
2016/qualification/sol.py
victorWeiFreelancer/Hashcode
e9cac8531f07962fedbfba6605acfa6e6067747d
[ "MIT" ]
null
null
null
2016/qualification/sol.py
victorWeiFreelancer/Hashcode
e9cac8531f07962fedbfba6605acfa6e6067747d
[ "MIT" ]
null
null
null
2016/qualification/sol.py
victorWeiFreelancer/Hashcode
e9cac8531f07962fedbfba6605acfa6e6067747d
[ "MIT" ]
null
null
null
import sys import math from time import gmtime, strftime sys.dont_write_bytecode = True def readInput(Plookup, warehouses, orders, drones): if(len(sys.argv)==1): nRow, nCol, nD, T, L = list(map(int, input().split())) P = int(input()) Plookup.extend(list(map(int, input().split()))) nW = int(input()) for i in range(nW): pos = list(map(int, input().split())) w = Warehouse(pos[0], pos[1]) w.storage.extend( list(map(int, input().split())) ) warehouses.append(w) C = int(input()) for i in range(C): pos = list(map(int, input().split())) co = CustomOrder(i, pos[0], pos[1]) co.numProd = int(input()) co.itemsList = list(map(int, input().split())) orders.append(co) else: with open(sys.argv[1], 'r') as fo: nRow, nCol, nD, T, L = list(map(int, fo.readline().split())) P = int(fo.readline()) Plookup.extend(list(map(int, fo.readline().split()))) nW = int(fo.readline()) for i in range(nW): pos = list(map(int, fo.readline().split())) w = Warehouse(pos[0], pos[1]) w.storage.extend( list(map(int, fo.readline().split())) ) warehouses.append(w) C = int(fo.readline()) for i in range(C): pos = list(map(int, fo.readline().split())) co = CustomOrder(i, pos[0], pos[1]) co.numProd = int(fo.readline()) co.itemsList = list(map(int, fo.readline().split())) orders.append(co) for i in range(nD): d = Drone(i, warehouses[0].pos.x, warehouses[0].pos.y, L) print(nRow, nCol, nD, T, L, P, nW) return nRow, nCol, nD, T, L, P, nW def utility(warehouse, order): dist = distance(warehouse.pos, order.pos) return 1.0/dist def utility_cal(L, Plookup, warehouses, orders): w = warehouses[0] orders.sort( key= lambda order:utility(w, order) ) def schedule(L, Plookup, warehouses, orders, drones): for order in orders: def main(): Plookup = [] warehouses = [] orders = [] drones = [] actionPlan = [] startT = strftime("%H:%M:%S") nRow, nCol, nD, T, L, P, nW = readInput(Plookup, warehouses, orders, drones) utility_cal(L, Plookup, warehouses, orders) # finishT = strftime("%H:%M:%S") # fw = open(" ".join([sys.argv[1].split('.')[0], startT, finishT, ".out"]),'w') # numUsedCache = sum(1 for c in caches[0:-1] if len(c.videos)>0 ) # fw.write( str(numUsedCache)+'\n') if __name__ == '__main__': main()
30.421053
83
0.531142
3496f98bc54d566d0b2f81898c8f900cd96ce375
2,313
py
Python
app/__init__.py
doshmajhan/python-idp
55be99afd02de4e8b0840c0a2236906d4b9a1827
[ "MIT" ]
1
2021-06-13T18:29:20.000Z
2021-06-13T18:29:20.000Z
app/__init__.py
doshmajhan/python-idp
55be99afd02de4e8b0840c0a2236906d4b9a1827
[ "MIT" ]
1
2022-03-30T05:37:09.000Z
2022-03-30T05:37:09.000Z
app/__init__.py
doshmajhan/python-idp
55be99afd02de4e8b0840c0a2236906d4b9a1827
[ "MIT" ]
null
null
null
from flask import Flask from flask_restful import Api from saml2 import saml, samlp from saml2.config import IdPConfig from saml2.mdstore import MetadataStore from saml2.server import Server from app.config import config from app.database import db from app.resources.idp_config import IdpConfigResource from app.resources.index import Index from app.resources.login import Login from app.resources.metadata import ( IdpMetadataResource, SpMetadataListResource, SpMetadataResource, ) from app.resources.sso import SsoResource from app.resources.users import UsersListResource, UsersResource from app.schemas import ma # TODO error handling for if config file doesn't exist
31.684932
87
0.736273
3499539f373f9ce023ee2fc68de3748959a132f3
5,190
py
Python
install.py
mrobraven/majestic-pi
8ebe001a0e2f2eca475c2a390228e7810630f62e
[ "MIT" ]
null
null
null
install.py
mrobraven/majestic-pi
8ebe001a0e2f2eca475c2a390228e7810630f62e
[ "MIT" ]
null
null
null
install.py
mrobraven/majestic-pi
8ebe001a0e2f2eca475c2a390228e7810630f62e
[ "MIT" ]
null
null
null
import os os.mkdir("3D") os.chdir("3D") print("Configuring 3D...") print("Fetching Intro...") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/intro.mp4") print("Fetching 3D Feature...") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/3D/glasses.mp4") print("Fetching Odeon Mimics...") os.mkdir("mimics") os.chdir("mimics") os.mkdir("Odeon") os.chdir("Odeon") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/mimics/Odeon/1.mp4") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/mimics/Odeon/2.mp4") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/mimics/Odeon/3.mp4") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/mimics/Odeon/4.mp4") print("Fetching Vue Mimics...") os.chdir("..") os.mkdir("Vue") os.chdir("Vue") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/mimics/Vue/1.mp4") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/mimics/Vue/2.mp4") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/mimics/Vue/3.mp4") print("Fetching Cineworld Mimics...") os.chdir("..") os.mkdir("Cineworld") os.chdir("Cineworld") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/mimics/Cineworld/1.mp4") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/mimics/Cineworld/2.mp4") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/mimics/Cineworld/3.mp4") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/mimics/Cineworld/4.mp4") print("Fetching Adverts...") os.chdir("..") os.chdir("..") os.mkdir("DCP") os.chdir("DCP") os.mkdir("adverts") os.chdir("adverts") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/DCP/adverts/Digital_Cinema_Media.mp4") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/DCP/adverts/Pearl_And_Dean.mp4") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/DCP/adverts/Pearl_And_Dean_Old.mp4") os.rename("Digital_Cinema_Media.mp4", "Digital_Cinema_Media.dca.mp4") os.rename("Pearl_And_Dean.mp4", "Pearl_And_Dean.dca.mp4") os.rename("Pearl_And_Dean_Old.mp4", "Pearl_And_Dean_Old.dca.mp4") os.chdir("..") os.chdir("..") os.chdir("..") os.mkdir("2D") os.chdir("2D") print("Configuring 2D...") print("Fetching Intro...") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/intro.mp4") print("Fetching 3D Feature...") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/3D/glasses.mp4") print("Fetching Odeon Mimics...") os.mkdir("mimics") os.chdir("mimics") os.mkdir("Odeon") os.chdir("Odeon") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/mimics/Odeon/1.mp4") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/mimics/Odeon/2.mp4") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/mimics/Odeon/3.mp4") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/mimics/Odeon/4.mp4") print("Fetching Vue Mimics...") os.chdir("..") os.mkdir("Vue") os.chdir("Vue") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/mimics/Vue/1.mp4") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/mimics/Vue/2.mp4") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/mimics/Vue/3.mp4") print("Fetching Cineworld Mimics...") os.chdir("..") os.mkdir("Cineworld") os.chdir("Cineworld") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/mimics/Cineworld/1.mp4") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/mimics/Cineworld/2.mp4") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/mimics/Cineworld/3.mp4") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/mimics/Cineworld/4.mp4") print("Fetching Adverts...") os.chdir("..") os.chdir("..") os.mkdir("DCP") os.chdir("DCP") os.mkdir("adverts") os.chdir("adverts") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/DCP/adverts/Digital_Cinema_Media.mp4") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/DCP/adverts/Pearl_And_Dean.mp4") os.system("wget https://raw.githubusercontent.com/mrobraven/majestic-pi/master/majestic-pi/DCP/adverts/Pearl_And_Dean_Old.mp4") os.rename("Digital_Cinema_Media.mp4", "Digital_Cinema_Media.dca.mp4") os.rename("Pearl_And_Dean.mp4", "Pearl_And_Dean.dca.mp4") os.rename("Pearl_And_Dean_Old.mp4", "Pearl_And_Dean_Old.dca.mp4") print("Done!")
55.212766
129
0.773796
349ac7bf295420ef2ab524ccb2bae107924bef1f
9,274
py
Python
docs/conf.py
myii/saltenv
2309e6759504f5326a444270c8e8bb3edf14b760
[ "Apache-2.0" ]
5
2022-03-25T17:15:04.000Z
2022-03-28T23:24:26.000Z
docs/conf.py
myii/saltenv
2309e6759504f5326a444270c8e8bb3edf14b760
[ "Apache-2.0" ]
null
null
null
docs/conf.py
myii/saltenv
2309e6759504f5326a444270c8e8bb3edf14b760
[ "Apache-2.0" ]
2
2022-03-26T06:33:30.000Z
2022-03-29T19:43:50.000Z
# # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup -------------------------------------------------------------- # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # # import os # import sys # sys.path.insert(0, os.path.abspath('.')) import datetime from pathlib import Path # -- Project information ----------------------------------------------------- this_year = datetime.datetime.today().year if this_year == 2022: copyright_year = 2022 else: copyright_year = f"2022 - {this_year}" project = "saltenv" copyright = f"{copyright_year}, nicholasmhughes" author = "nicholasmhughes" # Strip version info from ../../saltenv/version.py with open(Path(Path(__file__).parent.parent, "saltenv", "version.py")) as version_file: content = version_file.readlines() for file_line in content: if "version =" in file_line: version = file_line.split(" ")[2].replace('"', "") break # Variables to pass into the docs from sitevars.rst for rst substitution with open("sitevars.rst") as site_vars_file: site_vars = site_vars_file.read().splitlines() rst_prolog = """ {} """.format( "\n".join(site_vars[:]) ) # -- General configuration --------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. # needs_sphinx = "3.5.3" # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ "sphinx_copybutton", "sphinx.ext.autodoc", "sphinx.ext.autosummary", "sphinx.ext.napoleon", "sphinx.ext.intersphinx", "sphinx.ext.viewcode", "sphinx.ext.todo", "sphinx.ext.coverage", # "sphinxcontrib.spelling", ] # Render TODO directives, set to FALSE before publishing # This is incredibly helpful, when set to True, to know what is yet to be # completed in documentation. todo_include_todos = True # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # # source_suffix = ['.rst', '.md'] source_suffix = ".rst" # The master toctree document. master_doc = "index" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. exclude_patterns = [ "_build", "Thumbs.db", ".DS_Store", ".vscode", ".venv", ".git", ".gitlab-ci", ".gitignore", "sitevars.rst", ] autosummary_generate = True # ----- Napolean Config ------------------------------------------------------ # For using Google-style docstrings in Python code as a standard, which is # highly recommended. This improves tooling by expecting a standard way of # using docstrings in your project. # https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html napoleon_google_docstring = True napoleon_numpy_docstring = False napoleon_include_init_with_doc = True napoleon_include_private_with_doc = False napoleon_include_special_with_doc = True napoleon_use_admonition_for_examples = False napoleon_use_admonition_for_notes = False napoleon_use_admonition_for_references = False napoleon_use_ivar = False napoleon_use_param = True napoleon_use_rtype = True # ----- Intersphinx Config --------------------------------------------------- # This extension can generate automatic links to the documentation of objects # in other projects, such as the official Python or POP docs. # https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html intersphinx_mapping = { "python": ("https://docs.python.org/3", None), "pytest": ("https://pytest.readthedocs.io/en/stable", None), "pop": ("https://pop.readthedocs.io/en/latest/", None), } # ----- Autodoc Config ------------------------------------------------------- # This extension can import the modules you are documenting, and pull in # documentation from docstrings in a semi-automatic way. This is powerful! # https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html autodoc_default_options = {"member-order": "bysource"} # ----- Autosummary Config --------------------------------------------------- # This extension generates function/method/attribute summary lists, similar to # those output e.g. by Epydoc and other API doc generation tools. This is # especially useful when your docstrings are long and detailed, and putting # each one of them on a separate page makes them easier to read. # https://www.sphinx-doc.org/en/master/usage/extensions/autosummary.html autosummary_generate = True # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # html_theme = "furo" html_title = f"{project} Documentation" html_show_sourcelink = True # False on private repos; True on public repos # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. # # html_theme_options = {} # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". # html_static_path = ["_static"] # The name of an image file (relative to this directory) to place at the top # of the sidebar. # For example, official Salt Project docs use images from the salt-branding-guide # https://gitlab.com/saltstack/open/salt-branding-guide/ # # Example for >=4.0.0 of Sphinx (support for favicon via URL) # html_logo = "https://gitlab.com/saltstack/open/salt-branding-guide/-/raw/master/logos/SaltProject_altlogo_teal.png?inline=true" # Example for <4.0.0 of Sphinx, if added into _static/img/ and html_static_path is valid # html_logo = "_static/img/SaltProject_altlogo_teal.png" # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. Favicons can be up to at least 228x228. PNG # format is supported as well, not just .ico' # For example, official Salt Project docs use images from the salt-branding-guide # https://gitlab.com/saltstack/open/salt-branding-guide/ # # Example for >=4.0.0 of Sphinx (support for favicon via URL) # html_favicon = "https://gitlab.com/saltstack/open/salt-branding-guide/-/raw/master/logos/SaltProject_Logomark_teal.png?inline=true" # Example for <4.0.0 of Sphinx, if added into _static/img/ and html_static_path is valid # html_favicon = "_static/img/SaltProject_Logomark_teal.png" # Custom sidebar templates, must be a dictionary that maps document names # to template names. # # The default sidebars (for documents that don't match any pattern) are # defined by theme itself. Builtin themes are using these templates by # default: ``['localtoc.html', 'relations.html', 'sourcelink.html', # 'searchbox.html']``. # # html_sidebars = {} # -- Options for HTMLHelp output --------------------------------------------- # Output file base name for HTML help builder. htmlhelp_basename = "saltenvdoc" # -- Options for LaTeX output ------------------------------------------------ latex_elements = { # The paper size ('letterpaper' or 'a4paper'). # # 'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). # # 'pointsize': '10pt', # Additional stuff for the LaTeX preamble. # # 'preamble': '', # Latex figure (float) alignment # # 'figure_align': 'htbp', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ ( master_doc, "saltenv.tex", "saltenv Documentation", "nicholasmhughes", "manual", ), ] # -- Options for manual page output ------------------------------------------ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ( master_doc, "saltenv", "saltenv Documentation", [author], 1, ) ] # -- Options for Texinfo output ---------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ( master_doc, "saltenv", "saltenv Documentation", author, "saltenv", "One line description of project.", "Miscellaneous", ), ] # -- Extension configuration -------------------------------------------------
34.996226
133
0.667026
349b663f81956d7e9257fe5e42ee283abd8a9e68
2,094
py
Python
utils.py
momskidvaava/firefoxbot
1ed85e4f6594b144ceabdecb19e6e022180e639e
[ "MIT" ]
null
null
null
utils.py
momskidvaava/firefoxbot
1ed85e4f6594b144ceabdecb19e6e022180e639e
[ "MIT" ]
null
null
null
utils.py
momskidvaava/firefoxbot
1ed85e4f6594b144ceabdecb19e6e022180e639e
[ "MIT" ]
1
2021-11-25T14:05:25.000Z
2021-11-25T14:05:25.000Z
import datetime import typing import localization from configurator import Config def get_restriction_time(string: str) -> typing.Optional[int]: """ Get user restriction time in seconds :param string: string to check for multiplier. The last symbol should be one of: "m" for minutes, "h" for hours and "d" for days :return: number of seconds to restrict or None if error """ if len(string) < 2: return None letter = string[-1] try: number = int(string[:-1]) except TypeError: return None else: if letter == "m": return 60 * number elif letter == "h": return 3600 * number elif letter == "d": return 86400 * number else: return None def get_report_comment(message_date: datetime.datetime, message_id: int, report_message: typing.Optional[str]) -> str: """ Generates a report message for admins :param message_date: Datetime when reported message was sent :param message_id: ID of that message :param report_message: An optional note for admins so that they can understand what's wrong :return: A report message for admins in report chat """ msg = localization.get_string("report_message").format( date=message_date.strftime(localization.get_string("report_date_format")), chat_id=get_url_chat_id(int(Config.GROUP_MAIN)), msg_id=message_id) if report_message: msg += localization.get_string("report_note").format(note=report_message) return msg def get_url_chat_id(chat_id: int) -> int: """ Well, this value is a "magic number", so I have to explain it a bit. I don't want to use hardcoded chat username, so I just take its ID (see "group_main" variable above), add id_compensator and take a positive value. This way I can use https://t.me/c/{chat_id}/{msg_id} links, which don't rely on chat username. :param chat_id: chat_id to apply magic number to :return: chat_id for t.me links """ return abs(chat_id+1_000_000_000_000)
33.238095
118
0.668577
349bc17ddf478dd5dde43f9722c96d91cc6f8502
548
py
Python
test/torch/differential_privacy/test_pate.py
amitkarn3/PythnSyft
8eaa637e1ca54c963281e847556cb14b4a76b46b
[ "Apache-1.1" ]
null
null
null
test/torch/differential_privacy/test_pate.py
amitkarn3/PythnSyft
8eaa637e1ca54c963281e847556cb14b4a76b46b
[ "Apache-1.1" ]
null
null
null
test/torch/differential_privacy/test_pate.py
amitkarn3/PythnSyft
8eaa637e1ca54c963281e847556cb14b4a76b46b
[ "Apache-1.1" ]
null
null
null
import numpy as np from syft.frameworks.torch.differential_privacy import pate
30.444444
95
0.717153
349c048a588296bb67dea9d1d337e93b39772ac1
381
py
Python
03_Avanzado/09_CursoBasico_Python/codigo/funciones.py
LeoSan/CarreraFundamentosProgramacion_Platzi_2021
9db6ac33a755f855fbb9c41a9bd0e02712f37cb3
[ "MIT" ]
null
null
null
03_Avanzado/09_CursoBasico_Python/codigo/funciones.py
LeoSan/CarreraFundamentosProgramacion_Platzi_2021
9db6ac33a755f855fbb9c41a9bd0e02712f37cb3
[ "MIT" ]
null
null
null
03_Avanzado/09_CursoBasico_Python/codigo/funciones.py
LeoSan/CarreraFundamentosProgramacion_Platzi_2021
9db6ac33a755f855fbb9c41a9bd0e02712f37cb3
[ "MIT" ]
null
null
null
#Programa ejemplo para usar funcin #funcion sin parametros imprimir_mensaje() #funcion con parametros valorA= "Hola mundo" valorB= "Funcin con parametros" imprimir_mensaje_param(valorA, valorB)
20.052632
47
0.755906
34a032f572f524fc63d35b7eac84530ba6ee0e35
7,130
py
Python
orchestrator/cots/gdal/gdal_rasterize.py
spacebel/MAJA
3e5d20bc9c744c610e608cfcf1f4c5c738d4de9e
[ "Apache-2.0" ]
57
2020-09-30T08:51:22.000Z
2021-12-19T20:28:30.000Z
orchestrator/cots/gdal/gdal_rasterize.py
spacebel/MAJA
3e5d20bc9c744c610e608cfcf1f4c5c738d4de9e
[ "Apache-2.0" ]
34
2020-09-29T21:27:22.000Z
2022-02-03T09:56:45.000Z
orchestrator/cots/gdal/gdal_rasterize.py
spacebel/MAJA
3e5d20bc9c744c610e608cfcf1f4c5c738d4de9e
[ "Apache-2.0" ]
14
2020-10-11T13:17:59.000Z
2022-03-09T15:58:19.000Z
# -*- coding: utf-8 -*- # # Copyright (C) 2020 Centre National d'Etudes Spatiales (CNES) # # 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. # """ ################################################################################################### o o oo oo oo o oo ,-. o o o o o o o o o \_/ o o o o o o o o {|||D o o oooooo o oooooo / \ o o o o o o o o `-^ o o o o oooo o o ################################################################################################### orchestrator.cots.gdal.gdal_rasterize -- shortdesc orchestrator.cots.gdal.gdal_rasterize is a description It defines classes_and_methods ################################################################################################### """ import os import tempfile import time from ..maja_cots import MajaCots from orchestrator.common.logger.maja_logging import configure_logger from orchestrator.common.maja_utils import get_test_mode LOGGER = configure_logger(__name__) def rasterize_det_foo(input_file, working_directory, option_user={}, output_image=None): """ Rasterization for detector footprint gml mask """ options = {"-ot": "Byte", "-init": 0, "-a_nodata": 0, "-at": None, "-burn": 1 } options.update(option_user) output_image = rasterize(input_file, options, working_directory, output_image) return output_image def rasterize_no_data(input_file, working_directory, option_user={}, output_image=None): """ Rasterize for no data """ options = {"-ot": "Byte", "-init": 0, "-a_nodata": 0, "-at": None, "-burn": 1, "-sql": 'select fid, maskType, * from MaskFeature', "-where": 'maskType="QT_NODATA_PIXELS"' } options.update(option_user) output_image = rasterize(input_file, options, working_directory, output_image) return output_image def rasterize(input_file, options, working_directory, output_image=None): """ Run the cots rasterization :param input_file: :param options: :param working_directory: :param output_image: :return: """ if output_image is None: sub_working_directory = tempfile.mkdtemp(prefix="GDALRasterize_", dir=working_directory) output_image = "gdal_rasterize.tif" else: sub_working_directory = working_directory c1 = GdalRasterize(sub_working_directory, output_image) c1.pre(input_file, options) c1.run() c1.post() return c1.output_image
33.317757
119
0.55021
34a1337c8f6d2a9a081a7f61b09a68afa8480561
7,374
py
Python
theseus/test/test_tracer.py
pexip/os-python-theseus
3093edd7bc4af5556bce42c8602685010c695183
[ "0BSD" ]
1
2016-04-27T07:58:20.000Z
2016-04-27T07:58:20.000Z
theseus/test/test_tracer.py
pexip/os-python-theseus
3093edd7bc4af5556bce42c8602685010c695183
[ "0BSD" ]
null
null
null
theseus/test/test_tracer.py
pexip/os-python-theseus
3093edd7bc4af5556bce42c8602685010c695183
[ "0BSD" ]
null
null
null
from cStringIO import StringIO import inspect import textwrap import pytest from twisted.internet import defer, task from theseus._tracer import Function, Tracer def test_function_of_frame(): """ Function.of_frame examines a frame's code for its filename and code name. """ frame = FakeFrame(FakeCode('spam', 'eggs')) assert Function.of_frame(frame) == ('spam', 'eggs') def test_do_not_trace_non_deferred_returns(): """ If a function returns a non-Deferred value, nothing happens. More specifically, no function trace information is stored. """ t = Tracer() t._trace(FakeFrame(), 'return', None) assert not t._function_data def test_do_not_trace_generators(): """ If a generator function returns a Deferred, nothing happens. More specifically, no function trace information is stored. """ t = Tracer() t._trace( FakeFrame(FakeCode(flags=inspect.CO_GENERATOR)), 'return', defer.Deferred()) assert not t._function_data def test_do_not_trace_defer_module(): """ If a function in twisted.internet.defer returns a Deferred, nothing happens. More specifically, no function trace information is stored. """ t = Tracer() t._trace( FakeFrame(globals={'__name__': 'twisted.internet.defer'}), 'return', defer.Deferred()) assert not t._function_data _frame_spam = FakeFrame(FakeCode('spam.py', 'spam')) _frame_eggs = FakeFrame(FakeCode('eggs.py', 'eggs'), _frame_spam) _frame_unwindGenerator = FakeFrame( FakeCode('defer.py', 'unwindGenerator'), _frame_eggs, {'__name__': 'twisted.internet.defer'}, {'f': FakeFunction(FakeCode('sausage.py', 'sausage'))}) def test_trace_deferred_return_initial_setup(): """ If a function returns a Deferred, nothing happens until the Deferred fires. More specifically, no function trace information is stored. """ t = Tracer() d = defer.Deferred() t._trace(_frame_spam, 'return', d) assert not t._function_data def _trace_deferred_firing_after(clock, tracer, frame, seconds): """ Helper function to advance a clock and fire a Deferred. """ d = defer.Deferred() tracer._trace(frame, 'call', None) tracer._trace(frame, 'return', d) clock.advance(seconds) d.callback(None) def test_trace_deferred_return(): """ If a function returns a Deferred, after that Deferred fires, function trace information is stored regarding the amount of time it took for that Deferred to fire. """ clock = task.Clock() t = Tracer(reactor=clock) _trace_deferred_firing_after(clock, t, _frame_spam, 1.5) assert t._function_data == { ('spam.py', 'spam'): ({}, 1500000), } def test_trace_deferred_return_with_caller(): """ If the function returning the Deferred has a frame above it, that information is stored as well. """ clock = task.Clock() t = Tracer(reactor=clock) _trace_deferred_firing_after(clock, t, _frame_eggs, 1.5) assert t._function_data == { ('spam.py', 'spam'): ({ ('eggs.py', 'eggs'): (1, 1500000), }, 0), ('eggs.py', 'eggs'): ({}, 1500000), } def test_trace_deferred_return_with_multiple_calls(): """ If the function(s) returning the Deferred(s) are called multiple times, the timing data is summed. """ clock = task.Clock() t = Tracer(reactor=clock) _trace_deferred_firing_after(clock, t, _frame_spam, 0.5) _trace_deferred_firing_after(clock, t, _frame_spam, 0.25) _trace_deferred_firing_after(clock, t, _frame_eggs, 0.125) assert t._function_data == { ('spam.py', 'spam'): ({ ('eggs.py', 'eggs'): (1, 125000), }, 750000), ('eggs.py', 'eggs'): ({}, 125000), } def test_trace_inlineCallbacks_detection(): """ Tracer will detect the use of inlineCallbacks and rewrite the call stacks to look better and contain more information. """ clock = task.Clock() t = Tracer(reactor=clock) _trace_deferred_firing_after(clock, t, _frame_unwindGenerator, 0.5) assert t._function_data == { ('spam.py', 'spam'): ({ ('eggs.py', 'eggs'): (1, 500000), }, 0), ('eggs.py', 'eggs'): ({ ('sausage.py', 'sausage'): (1, 500000), }, 0), ('sausage.py', 'sausage'): ({}, 500000), } def test_tracer_calltree_output(): """ Tracer's write_data method writes out calltree-formatted information. """ clock = task.Clock() t = Tracer(reactor=clock) _trace_deferred_firing_after(clock, t, _frame_spam, 0.5) _trace_deferred_firing_after(clock, t, _frame_spam, 0.25) _trace_deferred_firing_after(clock, t, _frame_eggs, 0.125) sio = StringIO() t.write_data(sio) assert sio.getvalue() == textwrap.dedent("""\ events: Nanoseconds fn=eggs eggs.py 0 125000 fn=spam spam.py 0 750000 cfn=eggs eggs.py calls=1 0 0 125000 """) def test_tracer_install(fakesys): """ Tracer's install method will install itself globally using sys.setprofile. """ t = Tracer() t.install() assert fakesys.tracer == t._trace def test_tracer_wrapped_hook(fakesys): """ If a profile hook was set prior to calling Tracer's install method, it will continue to be called by Tracer. """ calls = [] fakesys.tracer = tracer t = Tracer() t.install() sentinel = object() t._trace(sentinel, 'call', sentinel) assert calls == [(sentinel, 'call', sentinel)] def test_tracer_uninstall(fakesys): """ Tracer's install method will uninstall itself as well. """ t = Tracer() t.install() t.uninstall() assert fakesys.tracer is None def test_tracer_uninstall_with_other_hook(fakesys): """ If another profile hook was installed after the Tracer was installed, then the profile hook will remain unchanged. """ t = Tracer() t.install() fakesys.tracer = sentinel = object() t.uninstall() assert fakesys.tracer is sentinel def test_tracer_uninstall_with_other_hook_previously_installed(fakesys): """ If another profile hook was installed before the Tracer was installed, then the profile hook will be restored to that profile hook. """ t = Tracer() fakesys.tracer = sentinel = object() t.install() t.uninstall() assert fakesys.tracer is sentinel
27.210332
79
0.649173
34a22dd4ad9ab46d6938c8ba8be9e6f6b3432bf1
497
py
Python
quickkart_api/auth.py
envaleed/quick-kart-api-deploy
2b962dce3bc5ba19d4e90cb86822c016d51f65c2
[ "MIT" ]
null
null
null
quickkart_api/auth.py
envaleed/quick-kart-api-deploy
2b962dce3bc5ba19d4e90cb86822c016d51f65c2
[ "MIT" ]
null
null
null
quickkart_api/auth.py
envaleed/quick-kart-api-deploy
2b962dce3bc5ba19d4e90cb86822c016d51f65c2
[ "MIT" ]
null
null
null
from quickkart_api import app from quickkart_api.models import Users from flask_jwt import JWT, jwt_required, current_identity from flask import abort jwt = JWT(app,authenticate,identity)
33.133333
71
0.7666
34a2c4ef21ebf75e62e5e53df18db5c3d07d0336
1,665
py
Python
testdoc/conf.py
coding-to-music/sphinx-seo-meta-twitter
23ec10e32ae272d5024d2468a87813ecabd30bfa
[ "BSD-3-Clause" ]
null
null
null
testdoc/conf.py
coding-to-music/sphinx-seo-meta-twitter
23ec10e32ae272d5024d2468a87813ecabd30bfa
[ "BSD-3-Clause" ]
null
null
null
testdoc/conf.py
coding-to-music/sphinx-seo-meta-twitter
23ec10e32ae272d5024d2468a87813ecabd30bfa
[ "BSD-3-Clause" ]
null
null
null
# -*- coding: utf-8 -*- import sys, os # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinxcontrib.seometatwitter'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'sphinx-seometatwitter' copyright = u'2021' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = '0.6.0' # The full version, including alpha/beta/rc tags. release = '0.6.0' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' html_theme = 'default' html_static_path = ['_static'] # Output file base name for HTML help builder. htmlhelp_basename = 'tweettestdoc' # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'tweettest', u'tweettest Documentation', [u'test'], 1) ]
27.295082
80
0.713514
34a3b4a7e1966e32d27cb46659df093776257437
69
py
Python
omnia_timeseries/__init__.py
equinor/omnia-timeseries-python
02cb4fe5eef3703725cb16f1a3d2c7094b3d623d
[ "MIT" ]
5
2021-06-18T10:09:09.000Z
2022-03-04T13:14:57.000Z
omnia_timeseries/__init__.py
equinor/omnia-timeseries-python
02cb4fe5eef3703725cb16f1a3d2c7094b3d623d
[ "MIT" ]
3
2021-05-27T08:49:10.000Z
2021-11-12T11:17:21.000Z
omnia_timeseries/__init__.py
equinor/omnia-timeseries-python
02cb4fe5eef3703725cb16f1a3d2c7094b3d623d
[ "MIT" ]
1
2021-10-06T09:39:08.000Z
2021-10-06T09:39:08.000Z
from omnia_timeseries.api import TimeseriesAPI, TimeseriesEnvironment
69
69
0.913043
34a3c5979c5216c22bb261f3a724f1a3a6ea121a
799
py
Python
corehq/apps/smsforms/util.py
rochakchauhan/commcare-hq
aa7ab3c2d0c51fe10f2b51b08101bb4b5a376236
[ "BSD-3-Clause" ]
null
null
null
corehq/apps/smsforms/util.py
rochakchauhan/commcare-hq
aa7ab3c2d0c51fe10f2b51b08101bb4b5a376236
[ "BSD-3-Clause" ]
1
2021-06-02T04:45:16.000Z
2021-06-02T04:45:16.000Z
corehq/apps/smsforms/util.py
rochakchauhan/commcare-hq
aa7ab3c2d0c51fe10f2b51b08101bb4b5a376236
[ "BSD-3-Clause" ]
null
null
null
from dimagi.utils.couch import CriticalSection from corehq.apps.receiverwrapper.util import submit_form_locally def form_requires_input(form): """ Returns True if the form has at least one question that requires input """ for question in form.get_questions([]): if question["tag"] not in ("trigger", "label", "hidden"): return True return False
30.730769
103
0.738423
34a40b68218e951dfdb50b23863e768a1098e44d
1,531
py
Python
wssnet/utility/tawss_utils.py
EdwardFerdian/WSSNet
b5d2916348e834a5dc5d0c06b001059b2a020080
[ "MIT" ]
2
2022-02-15T12:41:02.000Z
2022-03-15T04:46:10.000Z
wssnet/utility/tawss_utils.py
EdwardFerdian/WSSNet
b5d2916348e834a5dc5d0c06b001059b2a020080
[ "MIT" ]
null
null
null
wssnet/utility/tawss_utils.py
EdwardFerdian/WSSNet
b5d2916348e834a5dc5d0c06b001059b2a020080
[ "MIT" ]
null
null
null
import numpy as np from scipy.integrate import simps
24.301587
67
0.573481
34a414f71bdbac2f19072c327b891b149dfefa34
6,511
py
Python
dash/lib/events/servermanagement.py
wjwwood/open-robotics-platform
c417f1e4e381cdbbe88ba9ad4dea3bdf9840d3d5
[ "MIT" ]
null
null
null
dash/lib/events/servermanagement.py
wjwwood/open-robotics-platform
c417f1e4e381cdbbe88ba9ad4dea3bdf9840d3d5
[ "MIT" ]
null
null
null
dash/lib/events/servermanagement.py
wjwwood/open-robotics-platform
c417f1e4e381cdbbe88ba9ad4dea3bdf9840d3d5
[ "MIT" ]
null
null
null
#!/usr/bin/env python -OO # encoding: utf-8 ########### # ORP - Open Robotics Platform # # Copyright (c) 2010 John Harrison, William Woodall # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. ########## """ servermanagement.py - Contains components related to remote server management Created by William Woodall on 2010-11-03. """ __author__ = "William Woodall" __copyright__ = "Copyright (c) 2010 John Harrison, William Woodall" ### Imports ### # Standard Python Libraries import sys import os import logging import thread import xmlrpclib import copy import traceback # Other libraries import lib.elements as elements try: # try to catch any missing dependancies # wx for window elements PKGNAME = 'wxpython' import wx import wx.aui as aui del PKGNAME except ImportError as PKG_ERROR: # We are missing something, let them know... sys.stderr.write(str(PKG_ERROR)+"\nYou might not have the "+PKGNAME+" \ module, try 'easy_install "+PKGNAME+"', else consult google.") ### Functions ### def walk_and_send_files(root, list): """Walks a hash and sends the files to the remote server.""" if isinstance(list, dict): for file in list: if file[0] == '.': continue new_root = os.path.join(root, file) walk_and_send_files(new_root, list[file]) else: file_handler = open(list[0], 'r') elements.REMOTE_SERVER.write(root, file_handler.read(), list[1]) def connect(event): """Connects to the remote server, using the info in remote server text box""" # Connect to the remote server location = elements.TOOLBAR.server_addr.GetValue() try: elements.REMOTE_SERVER = xmlrpclib.Server('http://' + str(location) + ':7003/') elements.REMOTE_SERVER.connect() elements.TOOLBAR.connect_button.SetLabel('Disconnect') elements.TOOLBAR.connect_button.Bind(wx.EVT_BUTTON, disconnect) elements.MAIN.SetStatusText('Connected') except Exception as error: elements.MAIN.log.error(str(error)) return # Activate Buttons elements.TOOLBAR.send_button.Enable() elements.TOOLBAR.config_button.Enable() elements.TOOLBAR.run_button.Enable() elements.TOOLBAR.shutdown_button.Enable() elements.TOOLBAR.restart_button.Enable() elements.TOOLBAR.RC_button.Enable() # Synchronize Files sync_files(elements.REMOTE_SERVER.fileSync()) def disconnect(event): """Attempts to disconnect from the remote server""" elements.TOOLBAR.connect_button.SetLabel('Connect') elements.TOOLBAR.send_button.Disable() elements.TOOLBAR.run_button.Disable() elements.TOOLBAR.shutdown_button.Disable() elements.TOOLBAR.restart_button.Disable() elements.TOOLBAR.connect_button.Bind(wx.EVT_BUTTON, connect) elements.REMOTE_SERVER.disconnect() elements.REMOTE_SERVER.remote_server = None elements.MAIN.SetStatusText('Disconnected') def restart(event): """Calls the remote server to restart""" elements.REMOTE_SERVER.restart() def shutdown(event): """Shuts down the remote server""" elements.REMOTE_SERVER.shutdown() disconnect(None)
38.526627
102
0.665643
34a4b62edf263b2fe76869067f5c2acf0eed223a
1,661
py
Python
test/uma/rp/check.py
rohe/oictest
f6f0800220befd5983b8cb34a5c984f98855d089
[ "Apache-2.0" ]
32
2015-01-02T20:15:17.000Z
2020-02-15T20:46:25.000Z
test/uma/rp/check.py
rohe/oictest
f6f0800220befd5983b8cb34a5c984f98855d089
[ "Apache-2.0" ]
8
2015-02-23T19:48:53.000Z
2016-01-20T08:24:05.000Z
test/uma/rp/check.py
rohe/oictest
f6f0800220befd5983b8cb34a5c984f98855d089
[ "Apache-2.0" ]
17
2015-01-02T20:15:22.000Z
2022-03-22T22:58:28.000Z
import inspect import sys from uma import message from rrtest.check import Error, get_protocol_response from rrtest import Unknown from oictest import check __author__ = 'roland' CLASS_CACHE = {}
27.683333
73
0.556291
34a59aa4fd323b18e2045c4173ab3b0589d86fd9
10,959
py
Python
lib/utils/general.py
yingbiaoluo/ocr_pytorch
7d9163f7d6d557d83e2f50a39a3219f330f0cf84
[ "MIT" ]
null
null
null
lib/utils/general.py
yingbiaoluo/ocr_pytorch
7d9163f7d6d557d83e2f50a39a3219f330f0cf84
[ "MIT" ]
null
null
null
lib/utils/general.py
yingbiaoluo/ocr_pytorch
7d9163f7d6d557d83e2f50a39a3219f330f0cf84
[ "MIT" ]
null
null
null
import os import cv2 import glob import logging import numpy as np from pathlib import Path import torch from torch.autograd import Variable import torch.distributed as dist def generate_alphabets(alphabet_path): """ :param alphabet_path: . :return: . """ with open(alphabet_path, 'r', encoding='utf-8') as file: alphabet = sorted(list(set(repr(''.join(file.readlines()))))) if ' ' in alphabet: alphabet.remove(' ') alphabet = ''.join(alphabet) return alphabet def lev_ratio(str_a, str_b): """ ED :param str_a: :param str_b: :return: """ str_a = str_a.lower() str_b = str_b.lower() matrix_ed = np.zeros((len(str_a) + 1, len(str_b) + 1), dtype=np.int) matrix_ed[0] = np.arange(len(str_b) + 1) matrix_ed[:, 0] = np.arange(len(str_a) + 1) for i in range(1, len(str_a) + 1): for j in range(1, len(str_b) + 1): # a_i dist_1 = matrix_ed[i - 1, j] + 1 # b_i dist_2 = matrix_ed[i, j - 1] + 1 # b_i dist_3 = matrix_ed[i - 1, j - 1] + (2 if str_a[i - 1] != str_b[j - 1] else 0) # matrix_ed[i, j] = np.min([dist_1, dist_2, dist_3]) # print(matrix_ed) levenshtein_distance = matrix_ed[-1, -1] sum = len(str_a) + len(str_b) levenshtein_ratio = (sum - levenshtein_distance) / sum return levenshtein_ratio def set_logging(): logging.basicConfig( format="%(asctime)s %(message)s", # , %(message)s: level=logging.INFO) # logging.WARNING def get_latest_run(search_dir='./runs'): # Return path to most recent 'last.pt' in /runs (i.e. to --resume from) last_list = glob.glob(f'{search_dir}/**/last*.pt', recursive=True) return max(last_list, key=os.path.getctime) if last_list else '' def check_file(file): # Search for file if not found if os.path.isfile(file) or file == '': return file else: files = glob.glob('./**/' + file, recursive=True) # find file '**' assert len(files), 'File Not Found: %s' % file # assert file was found return files[0] # return first file if multiple found def increment_dir(dir, comment=''): # Increments a directory runs/exp1 --> runs/exp2_comment n = 0 # number dir = str(Path(dir)) # os-agnostic d = sorted(glob.glob(dir + '*')) # directories if len(d): n = max([int(x[len(dir):x.find('_') if '_' in x else None]) for x in d]) + 1 # increment return dir + str(n) + ('_' + comment if comment else '') def xyxy2xywh(x): # Convert nx4 boxes from [x1, y1, x2, y2] to [x, y, w, h] where xy1=top-left, xy2=bottom-right y = torch.zeros_like(x) if isinstance(x, torch.Tensor) else np.zeros_like(x) y[:, 0] = (x[:, 0] + x[:, 2]) / 2 # x center y[:, 1] = (x[:, 1] + x[:, 3]) / 2 # y center y[:, 2] = x[:, 2] - x[:, 0] # width y[:, 3] = x[:, 3] - x[:, 1] # height return y def xywh2xyxy(x): # Convert nx4 boxes from [x, y, w, h] to [x1, y1, x2, y2] where xy1=top-left, xy2=bottom-right y = torch.zeros_like(x) if isinstance(x, torch.Tensor) else np.zeros_like(x) y[:, 0] = x[:, 0] - x[:, 2] / 2 # top left x y[:, 1] = x[:, 1] - x[:, 3] / 2 # top left y y[:, 2] = x[:, 0] + x[:, 2] / 2 # bottom right x y[:, 3] = x[:, 1] + x[:, 3] / 2 # bottom right y return y def denoise(image): """ cv2.fastNlMeansDenoising """ image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) dst = cv2.fastNlMeansDenoising(image, None, h=10, templateWindowSize=7, searchWindowSize=21) ret, image = cv2.threshold(dst, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU) return image def resize_padding(image, height, width): # resize h, w, c = image.shape image = cv2.resize(image, (0, 0), fx=height / h, fy=height / h, interpolation=cv2.INTER_LINEAR) # padding h, w, c = image.shape img = 255. * np.ones((height, width, c)) if w < width: img[:, :w, :] = image else: r = height / h img = cv2.resize(image, (0, 0), fx=r, fy=r, interpolation=cv2.INTER_LINEAR) return img def padding_image_batch(image_batch, height=32, width=480): aspect_ratios = [] for image in image_batch: h, w, c = image.shape aspect_ratios.append(w/h) max_len = int(np.ceil(32 * max(aspect_ratios))) pad_len = max_len if max_len > width else width imgs = [] for image in image_batch: img = resize_padding(image, height, pad_len) img = np.transpose(img, (2, 0, 1)) imgs.append(img) img_batch = torch.from_numpy(np.array(imgs)) / 255. return img_batch.float() logger_initialized = {} def get_logger(name, log_file=None, log_level=logging.INFO): """Initialize and get a logger by name. If the logger has not been initialized, this method will initialize the logger by adding one or two handlers, otherwise the initialized logger will be directly returned. During initialization, a StreamHandler will always be added. If `log_file` is specified and the process rank is 0, a FileHandler will also be added. Args: name (str): Logger name. log_file (str | None): The log filename. If specified, a FileHandler will be added to the logger. log_level (int): The logger level. Note that only the process of rank 0 is affected, and other processes will set the level to "Error" thus be silent most of the time. Returns: logging.Logger: The expected logger. """ logger = logging.getLogger(name) if name in logger_initialized: return logger # handle hierarchical names # e.g., logger "a" is initialized, then logger "a.b" will skip the # initialization since it is a child of "a". for logger_name in logger_initialized: if name.startswith(logger_name): return logger stream_handler = logging.StreamHandler() handlers = [stream_handler] if dist.is_available() and dist.is_initialized(): # True False rank = dist.get_rank() else: rank = 0 # only rank 0 will add a FileHandler if rank == 0 and log_file is not None: file_handler = logging.FileHandler(log_file, 'w') handlers.append(file_handler) formatter = logging.Formatter( '%(asctime)s - %(name)s - %(levelname)s - %(message)s') for handler in handlers: handler.setFormatter(formatter) handler.setLevel(log_level) logger.addHandler(handler) if rank == 0: logger.setLevel(log_level) else: logger.setLevel(logging.ERROR) logger_initialized[name] = True return logger
31.582133
136
0.57195
34a5f721af5cc589bff5b78d011f713fac9b79a1
211
py
Python
smoothie/plugins/__init__.py
PiterPentester/smoothie
810709273c3d7bb975aca1f44062d39d0b33b678
[ "0BSD" ]
1
2021-02-12T00:24:45.000Z
2021-02-12T00:24:45.000Z
smoothie/plugins/__init__.py
PiterPentester/smoothie
810709273c3d7bb975aca1f44062d39d0b33b678
[ "0BSD" ]
1
2021-03-26T00:37:50.000Z
2021-03-26T00:37:50.000Z
smoothie/plugins/__init__.py
PiterPentester/smoothie
810709273c3d7bb975aca1f44062d39d0b33b678
[ "0BSD" ]
null
null
null
#!/usr/bin/env python from smoothie.plugins.interfaces import run as interfaces from smoothie.plugins.list_networks import run as list_networks from smoothie.plugins.target_network import run as target_network
35.166667
65
0.848341
34a704c37474e7d90bc81f141c9416313e5a36b0
3,912
py
Python
tests/unit_tests/webhook_server_test.py
Leanny/mmpy_bot
fd16db4f1b07130fbf95568fb242387f0c7973e2
[ "MIT" ]
196
2018-05-31T23:45:34.000Z
2022-03-20T09:06:55.000Z
tests/unit_tests/webhook_server_test.py
Leanny/mmpy_bot
fd16db4f1b07130fbf95568fb242387f0c7973e2
[ "MIT" ]
216
2018-05-31T19:18:46.000Z
2022-03-21T17:09:38.000Z
tests/unit_tests/webhook_server_test.py
tgly307/mmpy_bot
0ae52d9db86ac018f3d48dd52c11e4996f549073
[ "MIT" ]
107
2018-06-01T05:12:27.000Z
2022-02-25T12:40:10.000Z
import asyncio import threading import time import pytest from aiohttp import ClientSession from mmpy_bot import Settings from mmpy_bot.threadpool import ThreadPool from mmpy_bot.webhook_server import NoResponse, WebHookServer
37.257143
85
0.648773
34a7b81a028bf0267f44066f902a91829b99db68
1,023
py
Python
sample/Python/kabusapi_ranking.py
HolyMartianEmpire/kabusapi
c88ee958c272fb6e1dfde9a256e138c5760ea545
[ "MIT" ]
212
2020-08-20T09:10:35.000Z
2022-03-31T08:05:21.000Z
sample/Python/kabusapi_ranking.py
U2u14/kabusapi
e41d0c3fcbcf6a1164ace9eac1a4d93685012dcb
[ "MIT" ]
496
2020-08-20T14:23:59.000Z
2022-03-31T23:59:09.000Z
sample/Python/kabusapi_ranking.py
U2u14/kabusapi
e41d0c3fcbcf6a1164ace9eac1a4d93685012dcb
[ "MIT" ]
57
2020-08-20T10:40:07.000Z
2022-03-07T06:28:01.000Z
import urllib.request import json import pprint url = 'http://localhost:18080/kabusapi/ranking' #?type=1&ExchangeDivision=ALL params = { 'type': 15 } #type - 1:2: 3: 4: 5:TICK 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: params['ExchangeDivision'] = 'S' #ExchangeDivision - ALL:T: T1: T2: TM: JQ:JASDAQ M: FK: S: req = urllib.request.Request('{}?{}'.format(url, urllib.parse.urlencode(params)), method='GET') req.add_header('Content-Type', 'application/json') req.add_header('X-API-KEY', 'f2a3579e776f4b6b8015a96c8bdafdce') try: with urllib.request.urlopen(req) as res: print(res.status, res.reason) for header in res.getheaders(): print(header) print() content = json.loads(res.read()) pprint.pprint(content) except urllib.error.HTTPError as e: print(e) content = json.loads(e.read()) pprint.pprint(content) except Exception as e: print(e)
39.346154
170
0.69697
34a95de29250fa6c98650b9aff0293a9f1a7b915
3,905
py
Python
sfa_api/zones.py
lboeman/solarforecastarbiter-api
9df598b5c638c3e36d0649e08e955b3ddc1b542d
[ "MIT" ]
7
2018-12-07T22:05:36.000Z
2020-05-03T03:20:50.000Z
sfa_api/zones.py
lboeman/solarforecastarbiter-api
9df598b5c638c3e36d0649e08e955b3ddc1b542d
[ "MIT" ]
220
2018-11-01T23:33:19.000Z
2021-12-02T21:06:38.000Z
sfa_api/zones.py
lboeman/solarforecastarbiter-api
9df598b5c638c3e36d0649e08e955b3ddc1b542d
[ "MIT" ]
3
2018-10-31T20:55:07.000Z
2021-11-10T22:51:43.000Z
from flask import Blueprint, jsonify, make_response from flask.views import MethodView from sfa_api import spec, json from sfa_api.schema import ZoneListSchema from sfa_api.utils.storage import get_storage from sfa_api.utils.request_handling import validate_latitude_longitude spec.components.parameter( 'zone', 'path', { 'schema': { 'type': 'string', }, 'description': "Climate zone name. Spaces may be replaced with +.", 'required': 'true', 'name': 'zone' }) spec.components.parameter( 'latitude', 'query', { 'name': 'latitude', 'required': True, 'description': 'The latitude (in degrees North) of the location.', 'schema': { 'type': 'float', } }) spec.components.parameter( 'longitude', 'query', { 'name': 'longitude', 'required': True, 'description': 'The longitude (in degrees East of the Prime Meridian)' ' of the location.', 'schema': { 'type': 'float', } }) zone_blp = Blueprint( 'climatezones', 'climatezones', url_prefix='/climatezones', ) zone_blp.add_url_rule('/', view_func=AllZonesView.as_view('all')) zone_blp.add_url_rule('/<zone_str:zone>', view_func=ZoneView.as_view('single')) zone_blp.add_url_rule('/search', view_func=SearchZones.as_view('search'))
29.141791
79
0.557746
34aad533350d28ac32ca85f8601235b5751af580
283
py
Python
Mundo 3/Aula 16 - Tuplas/Ex074 - Maior e menor valor com tupla.py
Ruben-974/Exercicios-Python
11fc5c7c64c1b5e5f54f59821847987d4878764c
[ "MIT" ]
null
null
null
Mundo 3/Aula 16 - Tuplas/Ex074 - Maior e menor valor com tupla.py
Ruben-974/Exercicios-Python
11fc5c7c64c1b5e5f54f59821847987d4878764c
[ "MIT" ]
null
null
null
Mundo 3/Aula 16 - Tuplas/Ex074 - Maior e menor valor com tupla.py
Ruben-974/Exercicios-Python
11fc5c7c64c1b5e5f54f59821847987d4878764c
[ "MIT" ]
null
null
null
from random import randint n = (randint(1, 9), randint(1, 9), randint(1, 9), randint(1, 9), randint(1, 9)) print('Os nmeros sorteados foram: ', end='') for c in n: print(c, end=' ') print(f'\nO maior valor sorteado foi: {max(n)}') print(f'O menor valor sorteado foi: {min(n)}')
35.375
79
0.639576
34abfc5ba2b2f363e90afe9dd53efcac19d00daf
1,228
py
Python
tests/unit/http_/test_adapters.py
matt-mercer/localstack
b69ba25e495c6ef889d33a050b216d0cd1035041
[ "Apache-2.0" ]
1
2022-03-17T07:22:23.000Z
2022-03-17T07:22:23.000Z
tests/unit/http_/test_adapters.py
matt-mercer/localstack
b69ba25e495c6ef889d33a050b216d0cd1035041
[ "Apache-2.0" ]
null
null
null
tests/unit/http_/test_adapters.py
matt-mercer/localstack
b69ba25e495c6ef889d33a050b216d0cd1035041
[ "Apache-2.0" ]
null
null
null
import requests from localstack.http import Response, Router from localstack.http.adapters import RouterListener from localstack.utils.testutil import proxy_server
33.189189
77
0.592834
34ac4b2375450822de672fe9deedac50930b777e
647
py
Python
setup.py
ZaneColeRiley/ArcherProject
7d9ecf4953e3ea8ce3577321449549743eada34e
[ "MIT" ]
null
null
null
setup.py
ZaneColeRiley/ArcherProject
7d9ecf4953e3ea8ce3577321449549743eada34e
[ "MIT" ]
null
null
null
setup.py
ZaneColeRiley/ArcherProject
7d9ecf4953e3ea8ce3577321449549743eada34e
[ "MIT" ]
null
null
null
from cx_Freeze import setup, Executable import sys base = None if sys.platform == "win32": base = "Win32GUI" executables = [Executable("Archer.py", base=base, icon="favicon.ico")] setup(name="Archer", version="1.0.0", options={"build_exe": {"packages": ["tkinter", "mysql", "PIL", "time", "requests", "os", "smtplib", "datetime", "pyAesCrypt"], "include_files": ["Screen_image.jpg", "favicon.ico", "Admin_screen.jpg", "Screen_image_small.jpg", "Journal.jpg", "db.sqlite3"]}}, description="", executables=executables, requires=['requests', 'PIL', 'mysql', "smtplib", "tkinter", "time", "pyAesCrypt"])
40.4375
264
0.638331
34ac94f8711db1745f63a3c064eaa86f3dde0de5
2,772
py
Python
WiSe-2122/Uebung-11/Gruppe-C/U11-A1.py
jonasrdt/Wirtschaftsinformatik2
30d5d896808b98664c55cb6fbb3b30a7f1904d9f
[ "MIT" ]
1
2022-03-23T09:40:39.000Z
2022-03-23T09:40:39.000Z
WiSe-2122/Uebung-11/Gruppe-C/U11-A1.py
jonasrdt/Wirtschaftsinformatik2
30d5d896808b98664c55cb6fbb3b30a7f1904d9f
[ "MIT" ]
null
null
null
WiSe-2122/Uebung-11/Gruppe-C/U11-A1.py
jonasrdt/Wirtschaftsinformatik2
30d5d896808b98664c55cb6fbb3b30a7f1904d9f
[ "MIT" ]
null
null
null
# bung 11 - Aufgabe 1 # Mitarbeiter-Kartei # Bereitgestellt von M. Drews im Wintersemester 2021/22 # Funktionen # Programmablauf print("\n") trenner(120) print("Mitarbeiter-Kartei") trenner(120) trenner(120) ma_kartei = [] programm = True while programm: print("Was mchten Sie tun?") gueltige_eingabe = False while not gueltige_eingabe: try: auswahl = int(input("\n(1) Eintrag hinzufgen\n(2) Eintrag bearbeiten\n(3) Eintrag lschen\n(4) Kartei anzeigen\n")) if auswahl == 1: gueltige_eingabe = True eintrag_neu() elif auswahl == 2: gueltige_eingabe = True eintrag_bearbeiten() elif auswahl == 3: gueltige_eingabe = True eintrag_loeschen() elif auswahl == 4: gueltige_eingabe = True print(ma_kartei) trenner(80) except: fehler()
28.875
128
0.599206
34af79c82e2f03fa8bacfe2aa4a2b6da7ce9ee22
20,230
py
Python
asciinode.py
bhsingleton/mason
9a14cdc758b7ef76e53d4ef9d30045834d6c17ef
[ "MIT" ]
1
2021-09-08T00:51:52.000Z
2021-09-08T00:51:52.000Z
asciinode.py
bhsingleton/mason
9a14cdc758b7ef76e53d4ef9d30045834d6c17ef
[ "MIT" ]
null
null
null
asciinode.py
bhsingleton/mason
9a14cdc758b7ef76e53d4ef9d30045834d6c17ef
[ "MIT" ]
null
null
null
import maya.api.OpenMaya as om from . import asciitreemixin, asciiattribute, asciiplug from .collections import hashtable, weakreflist, notifylist import logging logging.basicConfig() log = logging.getLogger(__name__) log.setLevel(logging.INFO) def namespaceChanged(self, oldNamespace, newNamespace): """ Callback method for any namespace changes made to this node. :type oldNamespace: str :type newNamespace: str :rtype: None """ # Remove previous name from registry # absoluteName = f'{oldNamespace}:{self.name}' hashCode = self.scene.registry.names.get(absoluteName, None) if hashCode == self.hashCode(): del self.scene.registry.names[absoluteName] # Append new name to registry # absoluteName = f'{newNamespace}:{self.name}' self.scene.registry.names[absoluteName] = self.hashCode() def absoluteName(self): """ Returns the bare minimum required to be a unique name. :rtype: str """ if len(self.namespace) > 0: return f'{self.namespace}:{self.name}' else: return self.name def parentChanged(self, oldParent, newParent): """ Callback method that cleans up any parent/child references. :type oldParent: AsciiNode :type newParent: AsciiNode :rtype: None """ # Remove self from former parent # if oldParent is not None: oldParent.children.remove(self) # Append self to new parent # if newParent is not None: newParent.children.appendIfUnique(self) def childAdded(self, index, child): """ Adds a reference to this object to the supplied child. :type index: int :type child: AsciiNode :rtype: None """ if child.parent is not self: child.parent = self def childRemoved(self, child): """ Removes the reference of this object from the supplied child. :type child: AsciiNode :rtype: None """ child.parent = None def uuidChanged(self, oldUUID, newUUID): """ Callback method for any namespace changes made to this node. :type oldUUID: str :type newUUID: str :rtype: None """ # Remove previous uuid from registry # hashCode = self.scene.registry.uuids.get(oldUUID, None) if hashCode == self.hashCode(): del self.scene.registry.uuids[oldUUID] # Append new uuid to registry # self.scene.registry.uuids[newUUID] = self.hashCode() def initialize(self): """ Initializes the attributes and plugs for this node. :rtype: None """ # Check if static attributes exist # If not then go ahead and initialize them # attributes = self.__attributes__.get(self.type) if attributes is None: attributes = asciiattribute.listPlugin(self.type) self.__attributes__[self.type] = attributes def iterTopLevelPlugs(self): """ Iterates through all of the top-level plugs. Please note that plugs are created on demand so don't expect a complete list from this generator! :rtype: iter """ # Iterate through attributes # for attribute in self.listAttr(fromPlugin=True, userDefined=True).values(): # Check if this is a top level parent # if attribute.parent is not None: continue # Yield associated plug # plug = self._plugs.get(attribute.shortName, None) if plug is not None: yield plug else: continue def dagPath(self): """ Returns a dag path for this node. :rtype: str """ if self.parent is not None: return '|'.join([x.absoluteName() for x in self.trace()]) else: return self.name def attribute(self, name): """ Returns an ascii attribute with the given name. :type name: str :rtype: asciiattribute.AsciiAttribute """ return self.listAttr(fromPlugin=True, userDefined=True).get(name, None) def listAttr(self, fromPlugin=False, userDefined=False): """ Returns a list of attributes derived from this node. :type fromPlugin: bool :type userDefined: bool :rtype: hashtable.HashTable """ # Check if plugin defined attributes should be returned # attributes = hashtable.HashTable() if fromPlugin: attributes.update(self.__class__.__attributes__[self.type]) # Check if user defined attributes should be returned # if userDefined: attributes.update(self._attributes) return attributes def addAttr(self, *args, **kwargs): """ Adds a dynamic attribute to this node. This function accepts two different sets of arguments. You can either supply a fully formed AsciiAttribute. Or you can pass all of the keywords required to create one. :rtype: None """ # Check number of arguments # numArgs = len(args) numKwargs = len(kwargs) if numArgs == 1: # Store reference to attribute # attribute = args[0] self._attributes[attribute.shortName] = attribute self._attributes[attribute.longName] = attribute elif numKwargs > 0: # Create new attribute from kwargs # attribute = asciiattribute.AsciiAttribute(**kwargs) self.addAttr(attribute) else: raise TypeError(f'addAttr() expects 1 argument ({numArgs} given)!') def setAttr(self, plug, value): """ Assigns the supplied value to the given plug. :type plug: Union[str, asciiplug.AsciiPlug] :type value: Any :rtype: None """ # Check plug type # if isinstance(plug, str): plug = self.findPlug(plug) # Assign value to plug # plug.setValue(value) def connectAttr(self, source, destination): """ Connects the two supplied plugs together. :type source: Union[str, asciiplug.AsciiPlug] :type destination: Union[str, asciiplug.AsciiPlug] :rtype: None """ # Check source type # if isinstance(source, str): source = self.findPlug(source) # Check destination type # if isinstance(destination, str): destination = self.findPlug(destination) # Connect plugs # source.connect(destination) def findPlugs(self, path): """ Returns a list of plugs from the supplied string path. :type path: str :rtype: list[asciiplug.AsciiPlug] """ return asciiplug.AsciiPlugPath(f'{self.absoluteName()}.{path}', scene=self.scene).evaluate() def findPlug(self, path): """ Returns the plug associated with the given name. If more than one plug is found then a type error is raised. :type path: str :rtype: asciiplug.AsciiPlug """ plugs = self.findPlugs(path) numPlugs = len(plugs) if numPlugs == 0: return None elif numPlugs == 1: return plugs[0] else: raise TypeError('findPlug() multiple plugs found!') def legalConnection(self, plug, otherPlug): """ Evaluates whether or not the connection between these two plugs is valid. TODO: Implement this behaviour! :type plug: asciiplug.AsciiPlug :type otherPlug: asciiplug.AsciiPlug :rtype: bool """ return True def connectionMade(self, plug, otherPlug): """ Callback method for any connection changes made to this node. :type plug: asciiplug.AsciiPlug :type otherPlug: asciiplug.AsciiPlug :rtype: None """ self._connections.append(otherPlug.weakReference()) def legalDisconnection(self, plug, otherPlug): """ Evaluates whether or not the disconnection between these two plugs is valid. TODO: Implement this behaviour! :type plug: asciiplug.AsciiPlug :type otherPlug: asciiplug.AsciiPlug :rtype: bool """ return True def connectionBroken(self, plug, otherPlug): """ Callback method for any disconnection changes made to this node. :type plug: asciiplug.AsciiPlug :type otherPlug: asciiplug.AsciiPlug :rtype: None """ self._connections.remove(otherPlug.weakReference()) def getCreateNodeCmd(self): """ Returns a command string that can create this node. :rtype: str """ # Check if node has parent # if self.parent is not None: return f'createNode {self.type} -s -n "{self.absoluteName()}" -p "{self.parent.absoluteName()}";' else: return f'createNode {self.type} -s -n "{self.absoluteName()}";' def getSelectCmd(self): """ Returns a command string that can select this node. :rtype: str """ return f'select -ne "{self.absoluteName()}";' def getRenameCmd(self): """ Returns a command string that can rename this node's UUID. :rtype: str """ return f'\trename -uid "{self.uuid}";' def getLockNodeCmd(self): """ Returns a command string that can lock this node. :rtype: str """ return f'\tlockNode -l {int(self.isLocked)};' def getAddAttrCmds(self): """ Returns a list of commands for user-defined attributes. :rtype: list[str] """ return [x.getAddAttrCmd() for x in self.listAttr(userDefined=True).values()] def getSetAttrCmds(self): """ Returns a list of commands for non-default plugs. :rtype: list[str] """ # Iterate through top-level plugs # commands = [] for plug in self.iterTopLevelPlugs(): commands.extend(plug.getSetAttrCmds()) return commands def getConnectAttrCmds(self): """ Returns a list of command strings that can recreate the outgoing connections from this node. :rtype: list[str] """ # Iterate through known connections # numCommands = len(self._connections) commands = [None] * numCommands for (i, ref) in enumerate(self._connections): # Check if ref is still alive # otherPlug = ref() if otherPlug is None: continue # Concatenate source name # plug = otherPlug.source() source = plug.partialName(includeNodeName=True, useFullAttributePath=True, includeIndices=True) # Check if destination index matters # if otherPlug.isElement and not otherPlug.attribute.indexMatters: destination = otherPlug.parent.partialName(includeNodeName=True, useFullAttributePath=True, includeIndices=True) commands[i] = f'connectAttr "{source}" "{destination}" -na;' else: destination = otherPlug.partialName(includeNodeName=True, useFullAttributePath=True, includeIndices=True) commands[i] = f'connectAttr "{source}" "{destination}";' return commands
23.997628
128
0.571824
34af9cb845a017d27fd9e7390bfebe5569ce5eaf
1,325
py
Python
freezer_api/policy.py
ctpegasus/freezer-api
b784327252ac6132a4d3b87c50e9a99c70d6c938
[ "Apache-2.0" ]
null
null
null
freezer_api/policy.py
ctpegasus/freezer-api
b784327252ac6132a4d3b87c50e9a99c70d6c938
[ "Apache-2.0" ]
5
2019-08-14T06:46:03.000Z
2021-12-13T20:01:25.000Z
freezer_api/policy.py
ctpegasus/freezer-api
b784327252ac6132a4d3b87c50e9a99c70d6c938
[ "Apache-2.0" ]
2
2020-03-15T01:24:15.000Z
2020-07-22T20:34:26.000Z
""" (c) Copyright 2015-2016 Hewlett-Packard Enterprise Company L.P. 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 functools from oslo_policy import policy from freezer_api.common import exceptions from freezer_api.common import policies ENFORCER = None
27.604167
72
0.706415
34b0627ddf54dc4030ea1fef447d1fe5ea946c8c
297
py
Python
moviepy/video/fx/all/__init__.py
odidev/moviepy
b19a690fe81b17fa582622d1c0ebe73e4e6380e7
[ "MIT" ]
8,558
2015-01-03T05:14:12.000Z
2022-03-31T21:45:38.000Z
moviepy/video/fx/all/__init__.py
odidev/moviepy
b19a690fe81b17fa582622d1c0ebe73e4e6380e7
[ "MIT" ]
1,592
2015-01-02T22:12:54.000Z
2022-03-30T13:10:40.000Z
moviepy/video/fx/all/__init__.py
odidev/moviepy
b19a690fe81b17fa582622d1c0ebe73e4e6380e7
[ "MIT" ]
1,332
2015-01-02T18:01:53.000Z
2022-03-31T22:47:28.000Z
""" moviepy.video.fx.all is deprecated. Use the fx method directly from the clip instance (e.g. ``clip.resize(...)``) or import the function from moviepy.video.fx instead. """ import warnings from moviepy.video.fx import * # noqa F401,F403 warnings.warn(f"\nMoviePy: {__doc__}", UserWarning)
22.846154
77
0.723906
34b1459af9f8293d45f8ba2c83ea76abe97d3d5b
102
py
Python
core/src/autogluon/core/scheduler/resource/__init__.py
zhiqiangdon/autogluon
71ee7ef0f05d8f0aad112d8c1719174aa33194d9
[ "Apache-2.0" ]
4,462
2019-12-09T17:41:07.000Z
2022-03-31T22:00:41.000Z
core/src/autogluon/core/scheduler/resource/__init__.py
zhiqiangdon/autogluon
71ee7ef0f05d8f0aad112d8c1719174aa33194d9
[ "Apache-2.0" ]
1,408
2019-12-09T17:48:59.000Z
2022-03-31T20:24:12.000Z
core/src/autogluon/core/scheduler/resource/__init__.py
zhiqiangdon/autogluon
71ee7ef0f05d8f0aad112d8c1719174aa33194d9
[ "Apache-2.0" ]
623
2019-12-10T02:04:18.000Z
2022-03-20T17:11:01.000Z
from .resource import * from .dist_manager import * from ...utils import get_cpu_count, get_gpu_count
25.5
49
0.794118
34b2720c17b7d23f1bc3687785eec5b224b79560
109
py
Python
hello_world.py
TruthLacksLyricism/learning-python
7a279ad0698860b612fc6b76ff99c81acd29d31b
[ "MIT" ]
null
null
null
hello_world.py
TruthLacksLyricism/learning-python
7a279ad0698860b612fc6b76ff99c81acd29d31b
[ "MIT" ]
null
null
null
hello_world.py
TruthLacksLyricism/learning-python
7a279ad0698860b612fc6b76ff99c81acd29d31b
[ "MIT" ]
null
null
null
print "This line will be printed." x = "rachel" if x == "rachel": print "Rachel" print "Hello, World!"
13.625
34
0.623853
34b3e94aca6273776ec69ea9dd2046fec59f31b5
434
py
Python
src/pyonms.py
mmahacek/PyONMS
72ef0c2717044db66e4b99fe9820a69f435f44fd
[ "MIT" ]
null
null
null
src/pyonms.py
mmahacek/PyONMS
72ef0c2717044db66e4b99fe9820a69f435f44fd
[ "MIT" ]
null
null
null
src/pyonms.py
mmahacek/PyONMS
72ef0c2717044db66e4b99fe9820a69f435f44fd
[ "MIT" ]
null
null
null
# pyonms.py from dao import api, alarms, events, nodes
27.125
83
0.665899
34b47fa6cab25d27a526a824846c9378728893e8
5,195
py
Python
predicting_molecular_properties/nn_utils.py
ashesh-0/kaggle_competitions
58e927971b6ee67583a76a5ac821430a8d0bc31a
[ "MIT" ]
1
2019-11-20T11:33:51.000Z
2019-11-20T11:33:51.000Z
predicting_molecular_properties/nn_utils.py
ashesh-0/kaggle_competitions
58e927971b6ee67583a76a5ac821430a8d0bc31a
[ "MIT" ]
null
null
null
predicting_molecular_properties/nn_utils.py
ashesh-0/kaggle_competitions
58e927971b6ee67583a76a5ac821430a8d0bc31a
[ "MIT" ]
null
null
null
""" Utility functions for Neural network """ import pandas as pd from keras.callbacks import EarlyStopping, ReduceLROnPlateau, ModelCheckpoint from sklearn.preprocessing import StandardScaler from keras.layers import Dense, BatchNormalization, Input, LeakyReLU, Dropout from keras.models import Model, load_model from keras.optimizers import Adam
35.101351
112
0.638499
34b6d3e8c3f61f05d6fffeaf8b3486a12424b3e5
2,809
py
Python
fn_portal/tests/api/test_fn026.py
AdamCottrill/FishNetPortal
4e58e05f52346ac1ab46698a03d4229c74828406
[ "MIT" ]
null
null
null
fn_portal/tests/api/test_fn026.py
AdamCottrill/FishNetPortal
4e58e05f52346ac1ab46698a03d4229c74828406
[ "MIT" ]
null
null
null
fn_portal/tests/api/test_fn026.py
AdamCottrill/FishNetPortal
4e58e05f52346ac1ab46698a03d4229c74828406
[ "MIT" ]
null
null
null
"""============================================================= ~/fn_portal/fn_portal/tests/api/test_FN026.py Created: 26 May 2021 18:01:30 DESCRIPTION: This file contains a number of unit tests that verify that the api endpoint for FN026 objects works as expected: + the fn026 list returns all of the spaces associated with a specific project + the space detail endpoint will return the space code, space description, dd_lat, dd_lon. ============================================================= """ import json import pytest from django.urls import reverse from fn_portal.models import FN026 from fn_portal.tests.fixtures import api_client, project from rest_framework import status from ..factories import FN026Factory args = [ ("LHA_IA19_FOO", "S1"), # bad project code, good space ("LHA_IA19_000", "99"), # good project code, bad space ]
24.215517
79
0.603062
34b7a38557b1f2eeaa8850899a55b7d31360dad9
13,534
py
Python
test/unit_tests/braket/jobs/local/test_local_job_container.py
orclassiq/amazon-braket-sdk-python
69acaf54237ecbee14b5b5f0549fa28e32eba83b
[ "Apache-2.0" ]
null
null
null
test/unit_tests/braket/jobs/local/test_local_job_container.py
orclassiq/amazon-braket-sdk-python
69acaf54237ecbee14b5b5f0549fa28e32eba83b
[ "Apache-2.0" ]
null
null
null
test/unit_tests/braket/jobs/local/test_local_job_container.py
orclassiq/amazon-braket-sdk-python
69acaf54237ecbee14b5b5f0549fa28e32eba83b
[ "Apache-2.0" ]
null
null
null
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompanying this file. This file 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 base64 import subprocess from pathlib import Path from unittest.mock import Mock, patch import pytest from braket.jobs.local.local_job_container import _LocalJobContainer
37.079452
98
0.69935
34b84d492bd695fe750bb5aa931064fc3ca9b938
31,261
py
Python
scripts/regression_test.py
seonmokim/cryptominisat2
706738236fa5553a6e3623f06806d5fded377220
[ "MIT" ]
null
null
null
scripts/regression_test.py
seonmokim/cryptominisat2
706738236fa5553a6e3623f06806d5fded377220
[ "MIT" ]
null
null
null
scripts/regression_test.py
seonmokim/cryptominisat2
706738236fa5553a6e3623f06806d5fded377220
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import with_statement # Required in 2.5 import subprocess import os import fnmatch import gzip import re import commands import getopt import sys import signal import resource import time import struct import random from random import choice from subprocess import Popen, PIPE, STDOUT #from optparse import OptionParser import optparse sys.path.append('../../cnf-utils/') from xor_to_cnf_class import * maxTime = 40 maxTimeDiff = 20 usage = "usage: %prog [options] --fuzz/--regtest/--checkdir/filetocheck" desc = """Example usages: * check already computed SAT solutions (UNSAT cannot be checked): ./regression_test.py --checkdir ../../clusters/cluster93/ --cnfdir ../../satcomp09/ * check already computed SAT solutions (UNSAT cannot be checked): ./regression_test.py -c myfile.cnf -s sol.txt * fuzz the solver with fuzz-generator ./regression_test.py -f * go through regression listdir ./regression_test.py --regtest --checkdir ../tests/ """ parser = optparse.OptionParser(usage=usage, description=desc, formatter=PlainHelpFormatter()) parser.add_option("--exec", metavar= "SOLVER", dest="solver" , default="../build/cryptominisat" , help="SAT solver executable. Default: %default" ) parser.add_option("--extraopts", "-e", metavar= "OPTS", dest="extra_options" , default="" , help="Extra options to give to SAT solver" ) parser.add_option("--verbose", "-v", action="store_true" , default=False, dest="verbose" , help="Print more output" ) parser.add_option("-t", "--threads", dest="num_threads", metavar="NUM" , default=1, type="int" , help="Number of threads" ) #for fuzz-testing parser.add_option("-f", "--fuzz", dest="fuzz_test" , default=False, action="store_true" , help="Fuzz-test" ) #for regression testing parser.add_option("--regtest", dest="regressionTest" , default=False, action="store_true" , help="Regression test" ) parser.add_option("--testdir", dest="testDir" , default= "../tests/" , help="Directory where the tests are" ) parser.add_option("--testdirNewVar", dest="testDirNewVar" , default= "../tests/newVar/" , help="Directory where the tests are" ) parser.add_option("--drup", dest="drup" , default= False, action="store_true" , help="Directory where the tests are" ) #check dir stuff parser.add_option("--checksol", dest="checkSol" , default=False, action="store_true" , help="Check solution at specified dir against problems at specified dir" ) parser.add_option("--soldir", dest="checkDirSol" , help="Check solutions found here" ) parser.add_option("--probdir", dest="checkDirProb" , default="/home/soos/media/sat/examples/satcomp09/" , help="Directory of CNF files checked against" ) parser.add_option("-c", "--check", dest="checkFile" , default=None , help="Check this file" ) parser.add_option("-s", "--sol", dest="solutionFile" , default=None , help="Against this solution" ) (options, args) = parser.parse_args() tester = Tester() if options.checkFile : tester.check_unsat = True tester.check(options.checkFile, options.solutionFile, needSolve=False) if options.fuzz_test: tester.needDebugLib = False tester.check_unsat = True tester.fuzz_test() if options.checkSol: tester.checkDir() if options.regressionTest: tester.regressionTest()
34.504415
122
0.530949
34b86bc1dbc7088b4836cb91a3edc65c0a97f48c
5,182
py
Python
mindsdb/proxies/mysql/data_types/mysql_packet.py
aykuttasil/mindsdb
2c36b6f75f13d7104fe4d3dbb7ca307fa84f45ad
[ "MIT" ]
1
2022-03-14T00:32:53.000Z
2022-03-14T00:32:53.000Z
mindsdb/proxies/mysql/data_types/mysql_packet.py
aykuttasil/mindsdb
2c36b6f75f13d7104fe4d3dbb7ca307fa84f45ad
[ "MIT" ]
null
null
null
mindsdb/proxies/mysql/data_types/mysql_packet.py
aykuttasil/mindsdb
2c36b6f75f13d7104fe4d3dbb7ca307fa84f45ad
[ "MIT" ]
null
null
null
""" ******************************************************* * Copyright (C) 2017 MindsDB Inc. <copyright@mindsdb.com> * * This file is part of MindsDB Server. * * MindsDB Server can not be copied and/or distributed without the express * permission of MindsDB Inc ******************************************************* """ import struct import pprint # import logging from libs.helpers.logging import logging from libs.constants.mysql import MAX_PACKET_SIZE # only run the test if this file is called from debugger if __name__ == "__main__": test()
28.31694
147
0.588383
34b987e6c437ee88219466fd33845cf6a6a27b4b
2,538
py
Python
py/example/gol.py
zefaxet/libant
1be1865404eea729f8512e9ccd73899fbd5b7cb2
[ "MIT" ]
4
2019-10-18T06:14:36.000Z
2020-06-01T14:28:57.000Z
py/example/gol.py
zefaxet/libant
1be1865404eea729f8512e9ccd73899fbd5b7cb2
[ "MIT" ]
null
null
null
py/example/gol.py
zefaxet/libant
1be1865404eea729f8512e9ccd73899fbd5b7cb2
[ "MIT" ]
null
null
null
import pygame from random import randint from time import sleep import data SCREEN_SIZE = 700 STAGE_SIZE = 175 # 175 is largest size without bezels for 700 x 700 window sizeof_rect = int(SCREEN_SIZE / STAGE_SIZE) bezel = int((SCREEN_SIZE - (STAGE_SIZE * sizeof_rect)) / 2) directions = [] for x in [-1, 0, 1]: for y in [-1, 0, 1]: directions.append((x, y)) directions.remove((0,0)) pygame.display.set_mode((SCREEN_SIZE, SCREEN_SIZE)) pygame.display.set_caption("Game of Life Classic Demo") pygame.init() screen = pygame.display.get_surface() cells = data.grid pause = True round = 0 while True: for event in pygame.event.get(): if event.type == pygame.KEYDOWN and event.key == pygame.K_SPACE: pause = not pause if event.type == pygame.MOUSEBUTTONDOWN: x, y = pygame.mouse.get_pos() x = int(x / int(SCREEN_SIZE / STAGE_SIZE)) y = int(y / int(SCREEN_SIZE / STAGE_SIZE)) flip_cell(x, y) print(x, y) if event.type == pygame.QUIT: exit(0) if not pause and round < 50: new_cells = [] for x in range(STAGE_SIZE): new_row = [] for y in range(STAGE_SIZE): neighbours = get_neighbours(x, y) cell = cells[x][y] if cell: if neighbours < 2 or neighbours > 3: cell = 0 elif neighbours == 3: cell = 1 new_row.append(cell) new_cells.append(new_row) cells = new_cells draw_cells() round += 1 pygame.display.flip()
25.897959
80
0.636722