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
sequencelengths
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
sequencelengths
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
sequencelengths
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
29d3aa7dc92ae861ca049b62d573cabdb669506d
1,579
py
Python
tests/integration/test_dug_utils.py
helxplatform/roger
60c1c1198c41949804692217c74848e2aa8b9ea2
[ "MIT" ]
null
null
null
tests/integration/test_dug_utils.py
helxplatform/roger
60c1c1198c41949804692217c74848e2aa8b9ea2
[ "MIT" ]
7
2021-04-08T12:17:27.000Z
2022-02-08T23:12:32.000Z
tests/integration/test_dug_utils.py
helxplatform/roger
60c1c1198c41949804692217c74848e2aa8b9ea2
[ "MIT" ]
3
2020-12-07T20:49:43.000Z
2021-06-12T19:49:43.000Z
import tempfile from pathlib import Path import pytest from dug_helpers.dug_utils import FileFetcher, get_topmed_files, get_dbgap_files from roger.Config import config
26.316667
80
0.640912
29d584e58250f68d3fe99344f92ca1d026fcfaa6
6,915
py
Python
tests/bean_test.py
samuelchen/truepy
f1fd86ffccf7c3b2eee4cd4ced9436ff832d257e
[ "OpenSSL" ]
40
2015-08-04T11:01:33.000Z
2022-01-17T10:45:18.000Z
tests/bean_test.py
samuelchen/truepy
f1fd86ffccf7c3b2eee4cd4ced9436ff832d257e
[ "OpenSSL" ]
9
2016-09-14T04:40:58.000Z
2021-07-22T09:07:51.000Z
tests/bean_test.py
samuelchen/truepy
f1fd86ffccf7c3b2eee4cd4ced9436ff832d257e
[ "OpenSSL" ]
13
2015-02-24T05:39:10.000Z
2022-02-03T00:41:53.000Z
# coding: utf-8 # truepy # Copyright (C) 2014-2015 Moses Palmr # # This program is free software: you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free Software # Foundation, either version 3 of the License, or (at your option) any later # version. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program. If not, see <http://www.gnu.org/licenses/>. import unittest from datetime import datetime from truepy import fromstring, tostring from truepy._bean import snake_to_camel, camel_to_snake from truepy._bean import value_to_xml from truepy._bean import deserialize, serialize, to_document from truepy._bean_serializers import _DESERIALIZER_CLASSES, bean_class
32.013889
79
0.572523
29d6295eb61db2d065b900e834740080a6c5d3ff
3,679
py
Python
normal_version/export_es_data.py
Logistic98/es-data-transfer
6ed916201e8ab701e258e156e2c71468a3c509e5
[ "Apache-2.0" ]
1
2022-03-23T05:22:41.000Z
2022-03-23T05:22:41.000Z
normal_version/export_es_data.py
Logistic98/es-data-transfer
6ed916201e8ab701e258e156e2c71468a3c509e5
[ "Apache-2.0" ]
null
null
null
normal_version/export_es_data.py
Logistic98/es-data-transfer
6ed916201e8ab701e258e156e2c71468a3c509e5
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- from elasticsearch import Elasticsearch from datetime import timedelta import datetime import os import json import logging from configparser import ConfigParser # logging.basicConfig(filename='logging_es.log', level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') logger = logging.getLogger(__name__) def write_list_to_json(list, json_file_name, json_file_save_path): """ listjson :param list: :param json_file_name: json :param json_file_save_path: json :return: """ if not os.path.exists(json_file_save_path): os.makedirs(json_file_save_path) os.chdir(json_file_save_path) with open(json_file_name, 'w', encoding='utf-8') as f: json.dump(list, f, ensure_ascii=False) if __name__ == '__main__': start_date_time = datetime.datetime.now() + timedelta(days=-1) end_date_time = datetime.datetime.now() start_time = start_date_time.strftime("%Y-%m-%dT%H:00:00.000Z") end_time = end_date_time.strftime("%Y-%m-%dT%H:00:00.000Z") # es_dict = read_config() # BASE_DIR = os.getcwd() # esjson es_json(es_dict, start_time, end_time)
32.27193
84
0.57271
29d8926e28c855d35087d877a48866f5e57129f6
25
py
Python
env/lib/python2.7/site-packages/grpc/_grpcio_metadata.py
husky-parul/SheHacks
19383029947f50ebaf07232c9b2ee76c75d8ada6
[ "Apache-2.0" ]
2
2018-02-01T06:30:24.000Z
2018-04-12T15:39:56.000Z
env/lib/python2.7/site-packages/grpc/_grpcio_metadata.py
husky-parul/SheHacks
19383029947f50ebaf07232c9b2ee76c75d8ada6
[ "Apache-2.0" ]
null
null
null
env/lib/python2.7/site-packages/grpc/_grpcio_metadata.py
husky-parul/SheHacks
19383029947f50ebaf07232c9b2ee76c75d8ada6
[ "Apache-2.0" ]
null
null
null
__version__ = """1.8.4"""
25
25
0.56
29d92f0ff0b006c6d957ac126ab63d45f2f46f8c
146
py
Python
danesfield/core/admin/__init__.py
girder/Danesfield
04b0e991cae52bda758de4ee3f7e04dab45f3ff9
[ "Apache-2.0" ]
null
null
null
danesfield/core/admin/__init__.py
girder/Danesfield
04b0e991cae52bda758de4ee3f7e04dab45f3ff9
[ "Apache-2.0" ]
24
2021-10-29T21:03:34.000Z
2022-03-18T02:07:57.000Z
danesfield/core/admin/__init__.py
girder/Danesfield
04b0e991cae52bda758de4ee3f7e04dab45f3ff9
[ "Apache-2.0" ]
1
2022-01-26T09:31:48.000Z
2022-01-26T09:31:48.000Z
from django.contrib import admin # general admin settings admin.site.site_header = 'Danesfield Admin' admin.site.site_title = 'Danesfield Admin'
24.333333
43
0.80137
29dae29f89683a7db968db7356c874c048160ba7
2,645
py
Python
cnmodel/util/expfitting.py
pbmanis/cnmodel
eee593c673752c19137658d5b9a381ea9ad4580f
[ "BSD-3-Clause" ]
5
2017-07-26T21:46:14.000Z
2020-11-27T07:53:14.000Z
cnmodel/util/expfitting.py
pbmanis/cnmodel
eee593c673752c19137658d5b9a381ea9ad4580f
[ "BSD-3-Clause" ]
12
2017-07-26T07:16:16.000Z
2021-07-14T13:41:37.000Z
cnmodel/util/expfitting.py
pbmanis/cnmodel
eee593c673752c19137658d5b9a381ea9ad4580f
[ "BSD-3-Clause" ]
10
2017-07-26T07:03:29.000Z
2021-06-23T15:52:37.000Z
#!/usr/bin/env python # encoding: utf-8 """ expfitting.py Provide single or double exponential fits to data. """ import lmfit import numpy as np import scipy.optimize
33.910256
92
0.485444
29db5cdc597125eaa323b36fcd83763a78a5f8f9
4,338
py
Python
django_cloud_tasks/models.py
joaodaher/django-cloud-tasks
bc8ff94a281bda8b49ee73229d5ed5cacdd7a388
[ "Apache-2.0" ]
null
null
null
django_cloud_tasks/models.py
joaodaher/django-cloud-tasks
bc8ff94a281bda8b49ee73229d5ed5cacdd7a388
[ "Apache-2.0" ]
1
2020-07-09T17:48:19.000Z
2020-07-09T17:53:33.000Z
django_cloud_tasks/models.py
joaodaher/django-cloud-tasks
bc8ff94a281bda8b49ee73229d5ed5cacdd7a388
[ "Apache-2.0" ]
null
null
null
# pylint: disable=no-member from datetime import datetime from typing import Optional, Dict from django.db import transaction, models from django.apps import apps from django_cloud_tasks import tasks, serializers __all__ = ( "Routine", "RoutineVertex", "Pipeline", )
31.434783
109
0.642692
29db5eb5db45a035903363004257142de128c253
2,913
py
Python
src/ifood/model/order/event.py
micael95/sdk-ifood-python
27462d8127b62a29b5c89624e79accbea9563a80
[ "MIT" ]
2
2021-05-06T18:50:43.000Z
2021-06-05T21:54:04.000Z
src/ifood/model/order/event.py
micael95/sdk-ifood-python
27462d8127b62a29b5c89624e79accbea9563a80
[ "MIT" ]
null
null
null
src/ifood/model/order/event.py
micael95/sdk-ifood-python
27462d8127b62a29b5c89624e79accbea9563a80
[ "MIT" ]
1
2021-05-06T18:50:54.000Z
2021-05-06T18:50:54.000Z
from datetime import datetime from uuid import UUID from ...serializer import IfoodSerializable from ...utils import auto_str from uuid import UUID
26.243243
119
0.610711
29dc92373ea8f436e4e33eb083ad67d7e28abdae
2,599
py
Python
scripts/pm/set_sla_kpis.py
supsi-dacd-isaac/parity-sidechain-interface
b64a5fb724955332afb4998344081d1b93ac216a
[ "MIT" ]
null
null
null
scripts/pm/set_sla_kpis.py
supsi-dacd-isaac/parity-sidechain-interface
b64a5fb724955332afb4998344081d1b93ac216a
[ "MIT" ]
null
null
null
scripts/pm/set_sla_kpis.py
supsi-dacd-isaac/parity-sidechain-interface
b64a5fb724955332afb4998344081d1b93ac216a
[ "MIT" ]
null
null
null
# Importing section import json import requests import argparse import logging import time import datetime from classes.time_utils import TimeUtils import utilities as u # Main if __name__ == "__main__": arg_parser = argparse.ArgumentParser() arg_parser.add_argument('-c', help='config file') arg_parser.add_argument('-l', help='log file') args = arg_parser.parse_args() cfg = json.loads(open(args.c).read()) # Get configuration about connections to InfluxDB and remote service related to data retrieving tmp_config = json.loads(open(cfg['connectionsFile']).read()) cfg.update(tmp_config) # set logging object logger = logging.getLogger() logger.setLevel(logging.INFO) if not args.l: log_file = None else: log_file = args.l logger = logging.getLogger() logging.basicConfig(format='%(asctime)-15s::%(threadName)s::%(levelname)s::%(funcName)s::%(message)s', level=logging.INFO, filename=log_file) url_prefix = cfg['sidechainRestApi'] logger.info('Starting program') # Get the aggregator res = requests.get('%s/aggregator' % cfg['sidechainRestApi']) aggregator_id = json.loads(res.text)['Aggregator']['idx'] # Cycle over the configured SLAs for sla in cfg['slas']: dt_start, dt_end, _ = TimeUtils.get_start_end(sla['duration'], cfg['utils']['timeZone']) dt_start = dt_start - datetime.timedelta(minutes=cfg['shiftBackMinutes']['kpiSetting']) dt_end = dt_end - datetime.timedelta(minutes=cfg['shiftBackMinutes']['kpiSetting']) sla_idx = '%s_%i-%i' % (sla['idPrefix'], int(dt_start.timestamp()), int(dt_end.timestamp())) params = { 'idx': sla_idx, 'start': int(dt_start.timestamp()), 'end': int(dt_end.timestamp()), } u.send_post('%s/createSla' % url_prefix, params, logger) time.sleep(cfg['utils']['sleepBetweenTransactions']) # Cycle over the configured KPIs for kpi in sla['kpis']: params = { 'idx': '%s_%i-%i' % (kpi['idPrefix'], int(dt_start.timestamp()), int(dt_end.timestamp())), 'idxSla': sla_idx, 'rule': kpi['rule'], 'limit': kpi['limit'], 'measureUnit': kpi['mu'], 'penalty': kpi['penalty'], 'players': kpi['players'], } u.send_post('%s/createKpiFeatures' % url_prefix, params, logger) time.sleep(cfg['utils']['sleepBetweenTransactions']) logger.info('Ending program')
33.320513
106
0.614082
29dd6423703e7bd3d65394220ac73d337651b108
1,603
py
Python
src/spinnaker_ros_lsm/venv/lib/python2.7/site-packages/spinnman/messages/scp/impl/scp_version_request.py
Roboy/LSM_SpiNNaker_MyoArm
04fa1eaf78778edea3ba3afa4c527d20c491718e
[ "BSD-3-Clause" ]
2
2020-11-01T13:22:11.000Z
2020-11-01T13:22:20.000Z
src/spinnaker_ros_lsm/venv/lib/python2.7/site-packages/spinnman/messages/scp/impl/scp_version_request.py
Roboy/LSM_SpiNNaker_MyoArm
04fa1eaf78778edea3ba3afa4c527d20c491718e
[ "BSD-3-Clause" ]
null
null
null
src/spinnaker_ros_lsm/venv/lib/python2.7/site-packages/spinnman/messages/scp/impl/scp_version_request.py
Roboy/LSM_SpiNNaker_MyoArm
04fa1eaf78778edea3ba3afa4c527d20c491718e
[ "BSD-3-Clause" ]
null
null
null
from spinnman.messages.scp.abstract_messages.abstract_scp_request\ import AbstractSCPRequest from spinnman.messages.sdp.sdp_flag import SDPFlag from spinnman.messages.sdp.sdp_header import SDPHeader from spinnman.messages.scp.scp_request_header import SCPRequestHeader from spinnman.messages.scp.scp_command import SCPCommand from spinnman.messages.scp.impl.scp_version_response import SCPVersionResponse
40.075
101
0.674984
29dd6adf13db2f5c89c5474bb138c114f67d7138
4,506
py
Python
mac/pyobjc-framework-Quartz/Examples/Core Image/CIBevelSample/CIBevelView.py
albertz/music-player
d23586f5bf657cbaea8147223be7814d117ae73d
[ "BSD-2-Clause" ]
132
2015-01-01T10:02:42.000Z
2022-03-09T12:51:01.000Z
mac/pyobjc-framework-Quartz/Examples/Core Image/CIBevelSample/CIBevelView.py
mba811/music-player
7998986b34cfda2244ef622adefb839331b81a81
[ "BSD-2-Clause" ]
6
2015-01-06T08:23:19.000Z
2019-03-14T12:22:06.000Z
mac/pyobjc-framework-Quartz/Examples/Core Image/CIBevelSample/CIBevelView.py
mba811/music-player
7998986b34cfda2244ef622adefb839331b81a81
[ "BSD-2-Clause" ]
27
2015-02-23T11:51:43.000Z
2022-03-07T02:34:18.000Z
from Cocoa import * from Quartz import * from SampleCIView import SampleCIView from math import sin import objc NUM_POINTS=4
36.634146
126
0.630715
29e24314b4b43a27db5d5e7fb35c4c927a75f669
4,226
py
Python
oops_fhir/r4/code_system/request_intent.py
Mikuana/oops_fhir
77963315d123756b7d21ae881f433778096a1d25
[ "MIT" ]
null
null
null
oops_fhir/r4/code_system/request_intent.py
Mikuana/oops_fhir
77963315d123756b7d21ae881f433778096a1d25
[ "MIT" ]
null
null
null
oops_fhir/r4/code_system/request_intent.py
Mikuana/oops_fhir
77963315d123756b7d21ae881f433778096a1d25
[ "MIT" ]
null
null
null
from pathlib import Path from fhir.resources.codesystem import CodeSystem from oops_fhir.utils import CodeSystemConcept __all__ = ["RequestIntent"] _resource = CodeSystem.parse_file(Path(__file__).with_suffix(".json"))
35.813559
266
0.600331
29e35c162bb13bbac4bbfa70c3c033b9eb162d1c
266
py
Python
ABC/202/b.py
fumiyanll23/AtCoder
362ca9fcacb5415c1458bc8dee5326ba2cc70b65
[ "MIT" ]
null
null
null
ABC/202/b.py
fumiyanll23/AtCoder
362ca9fcacb5415c1458bc8dee5326ba2cc70b65
[ "MIT" ]
null
null
null
ABC/202/b.py
fumiyanll23/AtCoder
362ca9fcacb5415c1458bc8dee5326ba2cc70b65
[ "MIT" ]
null
null
null
if __name__ == '__main__': main()
14.777778
31
0.406015
29e4187ad7c1dcf2ceaec9e4c64c93ba30148a08
88
py
Python
twitoff/__init__.py
boscolio/twitoff-ds19
46449f9a55619a74dafa32ebee733daca8d1602f
[ "MIT" ]
null
null
null
twitoff/__init__.py
boscolio/twitoff-ds19
46449f9a55619a74dafa32ebee733daca8d1602f
[ "MIT" ]
null
null
null
twitoff/__init__.py
boscolio/twitoff-ds19
46449f9a55619a74dafa32ebee733daca8d1602f
[ "MIT" ]
null
null
null
from .app import create_app # creates the app by calling the package APP = create_app()
22
40
0.772727
29e53d00d3dfdf9edbf744f3dfa7a95332d492b5
170
py
Python
books/init_api.py
nabekabebe/BookFInder
aaa7eb3028cb2ef5552f865107ddb13a5dc3fde7
[ "MIT" ]
null
null
null
books/init_api.py
nabekabebe/BookFInder
aaa7eb3028cb2ef5552f865107ddb13a5dc3fde7
[ "MIT" ]
null
null
null
books/init_api.py
nabekabebe/BookFInder
aaa7eb3028cb2ef5552f865107ddb13a5dc3fde7
[ "MIT" ]
null
null
null
from flask_restplus import Api API = Api( title="Book API", version='1.0', description="This Api provides endpoint for accessing books and their reviews." )
21.25
83
0.705882
29e60f021e4805e18f02c579cb9365d85a32c49b
371
py
Python
test_game.py
thom1555/euchre
f2fa54fcecb5deeaad2e750e8cda04c94eb1e1e9
[ "Apache-2.0" ]
null
null
null
test_game.py
thom1555/euchre
f2fa54fcecb5deeaad2e750e8cda04c94eb1e1e9
[ "Apache-2.0" ]
null
null
null
test_game.py
thom1555/euchre
f2fa54fcecb5deeaad2e750e8cda04c94eb1e1e9
[ "Apache-2.0" ]
null
null
null
import unittest from game import Game from suit import Suit if __name__ == '__main__': unittest.main()
21.823529
68
0.6469
29e805265bd23dadb56a588aaeba28a86de79226
4,250
py
Python
src/test/resources/scripts/Authentication.py
tomjbarry/Penstro
d9179852158bebf48aaba7a198de5246acb1b064
[ "MIT" ]
1
2019-02-25T05:55:34.000Z
2019-02-25T05:55:34.000Z
src/test/resources/scripts/Authentication.py
tomjbarry/penstro
d9179852158bebf48aaba7a198de5246acb1b064
[ "MIT" ]
null
null
null
src/test/resources/scripts/Authentication.py
tomjbarry/penstro
d9179852158bebf48aaba7a198de5246acb1b064
[ "MIT" ]
null
null
null
from PyConstants import Paths from PyConstants import Codes from PyConstants import CacheTimes from PyBaseTest import BaseTest from PyRequest import PyRequest import time
57.432432
183
0.704941
29e8e499563826ecb59fe97bb20177891dc4f78e
235
py
Python
my_env/lib/python3.8/site-packages/tests/strategies.py
David5627/AWWARD
a22a2b2f7d7d6377435bfd475e82268e4e907141
[ "MIT" ]
296
2015-09-07T16:04:01.000Z
2022-03-27T06:31:43.000Z
my_env/lib/python3.8/site-packages/tests/strategies.py
David5627/AWWARD
a22a2b2f7d7d6377435bfd475e82268e4e907141
[ "MIT" ]
189
2015-09-07T14:56:32.000Z
2022-01-31T09:17:22.000Z
my_env/lib/python3.8/site-packages/tests/strategies.py
David5627/AWWARD
a22a2b2f7d7d6377435bfd475e82268e4e907141
[ "MIT" ]
115
2015-09-17T08:36:36.000Z
2022-03-09T12:36:14.000Z
from __future__ import unicode_literals from hypothesis.strategies import integers from star_ratings import app_settings
26.111111
55
0.851064
29e96f72799e651c5585b837791c85848195cb09
55
py
Python
Game6/modules/sprites/__init__.py
ttkaixin1998/pikachupythongames
609a3a5a2be3f5a187c332c7980bb5bb14548f02
[ "MIT" ]
4,013
2018-06-16T08:00:02.000Z
2022-03-30T11:48:14.000Z
Game6/modules/sprites/__init__.py
pigbearcat/Games
b8c47ef1bcce9a9db3f3730c162e6e8e08b508a2
[ "MIT" ]
22
2018-10-18T00:15:50.000Z
2022-01-13T08:16:15.000Z
Game6/modules/sprites/__init__.py
pigbearcat/Games
b8c47ef1bcce9a9db3f3730c162e6e8e08b508a2
[ "MIT" ]
2,172
2018-07-20T04:03:14.000Z
2022-03-31T14:18:29.000Z
'''''' from .Bird import Bird from .Pipe import Pipe
18.333333
22
0.709091
29ea1aef1c82bd772907c42e68df319791525947
6,824
py
Python
Render2018/lib/create_config_bodyflow.py
BigOto2/BlenderRenderDNS
a8ff239ecffef5217f0db35d579227a0a444c32d
[ "MIT" ]
1
2021-07-28T00:42:39.000Z
2021-07-28T00:42:39.000Z
Render2018/lib/create_config_bodyflow.py
BigOto2/BlenderRenderDNS
a8ff239ecffef5217f0db35d579227a0a444c32d
[ "MIT" ]
null
null
null
Render2018/lib/create_config_bodyflow.py
BigOto2/BlenderRenderDNS
a8ff239ecffef5217f0db35d579227a0a444c32d
[ "MIT" ]
1
2019-05-13T17:38:05.000Z
2019-05-13T17:38:05.000Z
import os.path import configparser from dircheck import get_yesno_input import create_jobscripts from create_dirname_config import config_dirname_cfg from create_all_dirs import create_all import socket import cgns_load_data # Script that creates the two configuration files (case and render files) necessary to run the scripts, with a data file from Abhiram's body flow simulation as input. # Check whether scripts being run on Mox if socket.gethostname()[0:3] == "mox": mox = True blender_dir = "/gscratch/ferrante/blender/blender-2.78c-linux-glibc219-x86_64/./" else: mox = False blender_dir = "" # Check if dirname.cfg, which contains directory paths used throughout the scripts, exists - otherwise, create it if not os.path.exists("dirname.cfg"): config_dirname_cfg() # Load important directories dirname_config = configparser.ConfigParser() dirname_config.read("dirname.cfg") # Get case name. This corresponds to a specific .h5dns file and is specified by the user. A case config file will be created with its name. case_name = input("Enter case name. This can be any string that refers to a particular VIZ.cgns file. ") create_all(case_name) case_config_path = dirname_config["DIRECTORIES"]["RenderConfig"] + case_name + "-case.cfg" # If existing case config file exists, the user is specifying a particular .h5dns file that is already associated with # this case name, so move on to render settings config. Otherwise, create case config file from user input. if os.path.exists(case_config_path): print("Found existing case configuration: " + case_config_path) existing_case_config = configparser.ConfigParser() existing_case_config.read(case_config_path) print("data file: " + existing_case_config["STRING"]["h5dns_path"]) else: # Create new case config file new_case_config = configparser.ConfigParser() # There are different sections for each datatype (this is how the scripts know what data types to load, when they are all saved as strings) new_case_config["STRING"] = {} new_case_config["FLOAT"] = {} new_case_config["INT"] = {} # Save important strings new_case_config["STRING"]["case_name"] = case_name new_case_config["STRING"]["data_file_type"] = "bodyflow" h5dns_path = input("Enter absolute path to data file: ") new_case_config["STRING"]["h5dns_path"] = h5dns_path # Load data file and save important params params = cgns_load_data.get_important_data(h5dns_path) new_case_config["INT"]["tres"] = str(params["tres"]) new_case_config["INT"]["ires"] = str(params["ires"]) new_case_config["INT"]["jres"] = str(params["jres"]) new_case_config["INT"]["kres"] = str(params["kres"]) # Write case config file with open(case_config_path, "w") as case_config_file: new_case_config.write(case_config_file) # Get render-specific config settings from user. This specifies what type of render to perform (photorealistic, surface # temperature, ...), and other render settings (scale of droplet to render, etc.) render_type = int(input("Select type of render to perform (enter number).\n 1 Streamline render\n 2 Vortex line render\n")) render_name = input("Enter render profile name. This can be any string that refers to specific rendering settings for a data case. ") # Initialize categories based on data types new_render_config = configparser.ConfigParser() new_render_config["STRING"] = {} new_render_config["INT"] = {} new_render_config["FLOAT"] = {} new_render_config["BOOL"] = {} new_render_config["STRING"]["render_name"] = render_name # Determine settings from user that are specific to each type. if (render_type == 1): # Streamline # Name render config file based on the type of render being performed render_config_path = dirname_config["DIRECTORIES"]["RenderConfig"] + render_name + "-render-streamline.cfg" # Get some other settings elif (render_type == 2): # Vortex line render_config_path = dirname_config["DIRECTORIES"]["RenderConfig"] + render_name + "-render-vortexline.cfg" # General inputs new_render_config["INT"]["num_streamlines"] = input("Specify number of streamlines: ") new_render_config["INT"]["streamline_seed"] = "777" #input("Specify random seed number to determine streamline start positions from: ") new_render_config["FLOAT"]["view_fraction"] = input("Specify desired render frame width as multiple of domain length: ") new_render_config["FLOAT"]["camera_azimuth_angle"] = input("Specify camera azimuth angle from the x-axis (deg): ") new_render_config["FLOAT"]["camera_elevation_angle"] = input("Specify camera elevation angle from the horizontal (deg): ") bg_image_enabled = get_yesno_input("Use custom background image? ") if bg_image_enabled: new_render_config["STRING"]["bg_image_filepath"] = dirname_config["DIRECTORIES"]["background_images"] + input("Specify background image name (in \"Render2018/BackgroundImages\"): ") new_render_config["STRING"]["bg_color_1"] = "" new_render_config["STRING"]["bg_color_2"] = "" else: new_render_config["STRING"]["bg_image_filepath"] = "" new_render_config["STRING"]["bg_color_1"] = input("Specify R,G,B value of lower background color (separate floats by commas, values range from 0 to 1): ") new_render_config["STRING"]["bg_color_2"] = input("Specify R,G,B value of upper background color (separate floats by commas, values range from 0 to 1): ") new_render_config["FLOAT"]["resolution_percentage"] = input("Specify resolution percentage out of 100, as a percentage of 4K: ") # Write render config file with open(render_config_path, "w") as render_config_file: new_render_config.write(render_config_file) # Create slurm jobscript to run on Mox slurm_name = case_name + "_" + render_name + ".slurm" create_jobscripts.create_mox_slurm(slurm_dir=dirname_config["DIRECTORIES"]["RenderJobscripts"], slurm_name=slurm_name, job_name=case_name+"_"+render_name, lib_dir=os.getcwd(), python_file_to_run="render_init.py", case_config_path=case_config_path, render_config_path=render_config_path) local_py_name = case_name + "_" + render_name + ".py" create_jobscripts.create_local_py(python_dir=dirname_config["DIRECTORIES"]["RenderJobscripts"], python_filename=local_py_name, lib_dir=dirname_config["DIRECTORIES"]["lib"], python_file_to_run="render_init.py", case_config_path=case_config_path, render_config_path=render_config_path) # Run jobscript if user desires if mox: if get_yesno_input("Run " + slurm_name + " to launch this rendering job?"): os.system("sbatch -p ferrante -A ferrante " + dirname_config["DIRECTORIES"]["RenderJobscripts"] + "/" + slurm_name) else: if get_yesno_input("Run " + local_py_name + " to launch this rendering job?"): os.system("python3 " + dirname_config["DIRECTORIES"]["RenderJobscripts"] + local_py_name)
56.396694
286
0.75381
29eb3307185eaf4daecd050d3551f86ee4f012bf
1,004
py
Python
util/replicate.py
ZvonimirSun/janusgraph-utils
c10e7b3ccb7c56c7662053d9d8b1d0bcb0a20bb8
[ "Apache-2.0" ]
204
2017-08-10T02:36:53.000Z
2022-03-11T12:21:18.000Z
util/replicate.py
HsbcJone/Jaunsgraph-LoadBulkData-Utils-
9c4e3b0c0b9f9966ab43422929ae5ea4993b3bb8
[ "Apache-2.0" ]
37
2017-08-16T01:06:02.000Z
2020-08-05T02:30:18.000Z
util/replicate.py
HsbcJone/Jaunsgraph-LoadBulkData-Utils-
9c4e3b0c0b9f9966ab43422929ae5ea4993b3bb8
[ "Apache-2.0" ]
103
2017-08-29T14:17:32.000Z
2022-03-07T14:30:48.000Z
#!/usr/bin/python import sys import simplejson as json if __name__ == "__main__": main()
32.387097
77
0.62749
29eb4a3f8932c013c8f2635314e11c22d12e4148
1,602
py
Python
commands/fight.py
AlexMog/IRCPokemonBot
0a735f262ce06ecd4c3b702094cf4b78e3cd7c45
[ "MIT" ]
2
2015-06-10T12:16:53.000Z
2016-03-09T22:43:43.000Z
commands/fight.py
AlexMog/IRCPokemonBot
0a735f262ce06ecd4c3b702094cf4b78e3cd7c45
[ "MIT" ]
null
null
null
commands/fight.py
AlexMog/IRCPokemonBot
0a735f262ce06ecd4c3b702094cf4b78e3cd7c45
[ "MIT" ]
null
null
null
#!/usr/bin/env python2 import copy import random from classes.Pokemons import * from classes.Battle import *
40.05
173
0.585518
29ebeb3c0f6aa2c670636976b54b4c234e9cc858
3,356
py
Python
horizon_hpe_storage/storage_panel/config/software_tests/forms.py
hp-storage/horizon-ssmc-link
f419ecf2a545a79f1ff6628dc26f31dfb7c84996
[ "Apache-2.0" ]
1
2017-01-07T13:45:57.000Z
2017-01-07T13:45:57.000Z
horizon_hpe_storage/storage_panel/config/software_tests/forms.py
hp-storage/horizon-ssmc-link
f419ecf2a545a79f1ff6628dc26f31dfb7c84996
[ "Apache-2.0" ]
null
null
null
horizon_hpe_storage/storage_panel/config/software_tests/forms.py
hp-storage/horizon-ssmc-link
f419ecf2a545a79f1ff6628dc26f31dfb7c84996
[ "Apache-2.0" ]
null
null
null
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from django.core.urlresolvers import reverse from django.utils.translation import ugettext_lazy as _ import horizon_hpe_storage.api.keystone_api as keystone import horizon_hpe_storage.api.barbican_api as barbican from horizon import exceptions from horizon import forms from horizon import messages
44.157895
78
0.616508
29ecd056c8357be81181e47ac71a968400c85cc9
1,396
py
Python
tests/test_liquidity_provider_factory.py
diem/liquidity-emulator
255cccd06c0949750e42e93906b083e915ddf505
[ "Apache-2.0" ]
2
2021-11-29T06:00:59.000Z
2022-01-27T18:42:29.000Z
tests/test_liquidity_provider_factory.py
hengkyherdianto/liquidity-emulator
255cccd06c0949750e42e93906b083e915ddf505
[ "Apache-2.0" ]
1
2021-01-31T09:14:05.000Z
2021-02-01T07:43:41.000Z
tests/test_liquidity_provider_factory.py
hengkyherdianto/liquidity-emulator
255cccd06c0949750e42e93906b083e915ddf505
[ "Apache-2.0" ]
4
2021-02-15T14:45:04.000Z
2022-03-03T02:32:45.000Z
from diem import chain_ids from liquidity import create_liquidity_provider, init_liquidity_provider from liquidity.liquidity import FaucetLiquidityProvider, DDLiquidityProvider CUSTODY_PRIVATE_KEYS = ( '{"liquidity":"c6537e56d844fa4a15f3bf5eacd41c9123a19ef19a1026f2325a6b2dd33a13f1"}' )
33.238095
86
0.809456
29ecd75f594b19acd9901238ad242a2ae33df3f6
112
py
Python
layers/modules/__init__.py
Eralaf/ssd.pytorch
acad53fd801f32120ecb3ff57950556e35db3d1c
[ "MIT" ]
null
null
null
layers/modules/__init__.py
Eralaf/ssd.pytorch
acad53fd801f32120ecb3ff57950556e35db3d1c
[ "MIT" ]
null
null
null
layers/modules/__init__.py
Eralaf/ssd.pytorch
acad53fd801f32120ecb3ff57950556e35db3d1c
[ "MIT" ]
null
null
null
from .l2norm import L2Norm from .multibox_loss import MultiBoxLoss __all__ = ['L2Norm', 'MultiBoxLoss']
22.4
39
0.732143
29edb04d6019c45efcdb61aac97edab310263a90
59
py
Python
test/octagon.py
Jahongir2007/pymetry
02c8e82a188700b4213fd4a70aa66a3b5e9843b8
[ "MIT" ]
1
2021-04-04T11:38:42.000Z
2021-04-04T11:38:42.000Z
test/octagon.py
Jahongir2007/pymetry
02c8e82a188700b4213fd4a70aa66a3b5e9843b8
[ "MIT" ]
null
null
null
test/octagon.py
Jahongir2007/pymetry
02c8e82a188700b4213fd4a70aa66a3b5e9843b8
[ "MIT" ]
null
null
null
import pymetry pym = pymetry pym.octagon(150, "yellow", 8)
14.75
29
0.728814
29f10336d5ea889a3a24c9c3648237cbdaee7b65
5,586
py
Python
tools/remote_debugger.py
budelius/openstreetmap-heatmap
f7376671eecda68955b8edc016c63218c5ebc6a2
[ "Apache-2.0" ]
null
null
null
tools/remote_debugger.py
budelius/openstreetmap-heatmap
f7376671eecda68955b8edc016c63218c5ebc6a2
[ "Apache-2.0" ]
null
null
null
tools/remote_debugger.py
budelius/openstreetmap-heatmap
f7376671eecda68955b8edc016c63218c5ebc6a2
[ "Apache-2.0" ]
null
null
null
""" Remote debugging support. This addon allows you to use a remote Python debugger with PyCharm, PyDev and possibly other IDEs. As it is, without modification, it only supports PyCharm, but it may work by pointing it at a similar egg file shipped with PyDev. Before using, point the addon to your pycharm-debug-py3k.egg file in the addon preferences screen. For more information on how to use this addon, please read my article at http://code.blender.org/2015/10/debugging-python-code-with-pycharm/ """ bl_info = { 'name': 'Remote debugger', 'author': 'Sybren A. Stvel', 'version': (0, 4), 'blender': (2, 80, 0), 'location': 'Press [Space], search for "debugger"', 'category': 'Development', } import bpy import os.path from bpy.types import AddonPreferences from bpy.props import StringProperty # Get references to all property definition functions in bpy.props, # so that they can be used to replace 'x = IntProperty()' to 'x: IntProperty()' # dynamically when working on Blender 2.80+ __all_prop_funcs = { getattr(bpy.props, propname) for propname in dir(bpy.props) if propname.endswith('Property') } def convert_properties(class_): """Class decorator to avoid warnings in Blender 2.80+ This decorator replaces property definitions like this: someprop = bpy.props.IntProperty() to annotations, as introduced in Blender 2.80: someprop: bpy.props.IntProperty() No-op if running on Blender 2.79 or older. """ if bpy.app.version < (2, 80): return class_ if not hasattr(class_, '__annotations__'): class_.__annotations__ = {} attrs_to_delete = [] for name, value in class_.__dict__.items(): if not isinstance(value, tuple) or len(value) != 2: continue prop_func, kwargs = value if prop_func not in __all_prop_funcs: continue # This is a property definition, replace it with annotation. attrs_to_delete.append(name) class_.__annotations__[name] = value for attr_name in attrs_to_delete: delattr(class_, attr_name) return class_ def register(): bpy.utils.register_class(DEBUG_OT_connect_debugger_pycharm) bpy.utils.register_class(DEBUG_OT_connect_debugger_pydev) bpy.utils.register_class(DebuggerAddonPreferences) def unregister(): bpy.utils.unregister_class(DEBUG_OT_connect_debugger_pycharm) bpy.utils.unregister_class(DEBUG_OT_connect_debugger_pydev) bpy.utils.unregister_class(DebuggerAddonPreferences) if __name__ == '__main__': register()
30.692308
100
0.674544
29f1f4d867171d615c82f43e02801e5ac479dcd4
2,247
py
Python
todo/views/accepted_petitions.py
josalhor/WebModels
6b9cde3141c53562f40b129e6e1c87448ce9853a
[ "BSD-3-Clause" ]
null
null
null
todo/views/accepted_petitions.py
josalhor/WebModels
6b9cde3141c53562f40b129e6e1c87448ce9853a
[ "BSD-3-Clause" ]
41
2021-03-23T12:58:25.000Z
2021-05-25T11:38:42.000Z
todo/views/accepted_petitions.py
josalhor/WebModels
6b9cde3141c53562f40b129e6e1c87448ce9853a
[ "BSD-3-Clause" ]
null
null
null
import datetime from django.contrib import messages from django.contrib.auth.decorators import login_required, user_passes_test from django.http import HttpResponse from django.shortcuts import render from .book_assign import send_email_reject_book from todo.forms import SearchForm from todo.models import Task, Book, Editor, Writer
31.208333
151
0.668002
29f31b2343f07216325a81bd944dfce29b98de66
610
py
Python
2_sheet/2-sheet-hundt-robin/plot-data.py
robinhundt/practical-course-parallel-computing
08f1fc76324d5c6338b32b2f14c2a11fef3ad619
[ "MIT" ]
null
null
null
2_sheet/2-sheet-hundt-robin/plot-data.py
robinhundt/practical-course-parallel-computing
08f1fc76324d5c6338b32b2f14c2a11fef3ad619
[ "MIT" ]
null
null
null
2_sheet/2-sheet-hundt-robin/plot-data.py
robinhundt/practical-course-parallel-computing
08f1fc76324d5c6338b32b2f14c2a11fef3ad619
[ "MIT" ]
null
null
null
import matplotlib.pyplot as plt # number of threads used to compute product of 2 matrices of dim. 1024 data_x = [1, 2, 3, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096] # execution time in seconds data_y = [3.300059, 1.664494, 2.294884, 3.200235, 2.915945, 3.082389, 3.023162, 3.012096, 2.958028, 2.939918, 2.847527, 2.898556, 2.876036, 2.963720] plt.figure() plt.plot(data_x, data_y) plt.xlabel('# of threads') plt.xscale('log') plt.ylabel('execution time in seconds') plt.title('Exection times of 1024x1024 matrix multi with different thread counts') plt.show()
33.888889
82
0.672131
29f348ce2221e92c79d25e0d2151332aec4f637c
1,100
py
Python
memoro/wsgi.py
bbengfort/memorandi
4591d26c097513d67e11916583ed043e78e87816
[ "MIT" ]
null
null
null
memoro/wsgi.py
bbengfort/memorandi
4591d26c097513d67e11916583ed043e78e87816
[ "MIT" ]
18
2020-12-02T16:37:21.000Z
2021-09-22T19:40:37.000Z
memoro/wsgi.py
bbengfort/memorandi
4591d26c097513d67e11916583ed043e78e87816
[ "MIT" ]
null
null
null
# memoro.wsgi # WSGI config for memoro project. # # Author: Benjamin Bengfort <benjamin@bengfort.com> # Created: Sat Nov 28 13:44:01 2020 -0500 # # Copyright (C) 2020 Bengfort.com # For license information, see LICENSE # # ID: wsgi.py [] benjamin@bengfort.com $ """ WSGI config for memoro project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/ """ ########################################################################## ## Imports ########################################################################## import os from django.core.wsgi import get_wsgi_application from dotenv import find_dotenv, load_dotenv ########################################################################## ## Load environment and create WSGI application ########################################################################## load_dotenv(find_dotenv()) os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'memoro.settings.development') application = get_wsgi_application()
28.205128
78
0.555455
29f40d1447bb8284816ad9a4024cc926058b38fe
29,679
py
Python
serialized_data_converter.py
facelessuser/SerializedDataConverter
6cd0d59ae6cda98208e60e9c729d0eb047fe93db
[ "MIT" ]
19
2015-02-13T08:16:32.000Z
2021-07-31T02:55:39.000Z
serialized_data_converter.py
facelessuser/SerializedDataConverter
6cd0d59ae6cda98208e60e9c729d0eb047fe93db
[ "MIT" ]
9
2015-03-10T15:34:08.000Z
2019-11-18T01:57:20.000Z
serialized_data_converter.py
facelessuser/SerializedDataConverter
6cd0d59ae6cda98208e60e9c729d0eb047fe93db
[ "MIT" ]
4
2015-10-01T16:04:52.000Z
2019-10-27T00:53:36.000Z
""" Serialized Data Converter. Licensed under MIT Copyright (c) 2012 - 2015 Isaac Muse <isaacmuse@gmail.com> """ import sublime import sublime_plugin import codecs import re import traceback import os from SerializedDataConverter.lib.log import error_msg from SerializedDataConverter.lib import plist_includes as plist from SerializedDataConverter.lib import yaml_includes as yaml from SerializedDataConverter.lib import json_includes as json PACKAGE_SETTINGS = "serialized_data_converter.sublime-settings" def to_hex(value): """Convert int value to hex string.""" return "%02x" % value ########################## # Plist <-> YAML ########################## ########################## # Plist <-> JSON ########################## ########################## # YAML <-> JSON ########################## ########################## # BPLIST <-> PLIST ##########################
36.371324
117
0.553253
29f5d029a675792751ff0f3ac8e9946cca353e7b
1,592
py
Python
test.py
SirNate0/PYrho3D
b0daa3badccd12adfcb9e7cf50d554c805cc6279
[ "MIT" ]
6
2020-02-20T07:42:07.000Z
2021-03-27T13:26:47.000Z
test.py
SirNate0/PYrho3D
b0daa3badccd12adfcb9e7cf50d554c805cc6279
[ "MIT" ]
null
null
null
test.py
SirNate0/PYrho3D
b0daa3badccd12adfcb9e7cf50d554c805cc6279
[ "MIT" ]
null
null
null
#!/usr/bin/env python2.7 import urho v = urho.Vector3() c = urho.Context() fs = urho.FileSystem(c) from urho import StringHash as sh import os print (os.getcwd()) a = App(c) #help(a) var = urho.Variant(u'/home/nathan/Desktop/testClang') print(var) print(fs.GetCurrentDir()) #a.engineParameters[urho.StringHash('ResourcePrefixPaths')] = var #a.engineParameters["FullScreen"] = False #a.engineParameters[urho.StringHash('FullScreen')] = False a.engineParameters["WindowWidth"] = 500 c.GetSubsystem(sh('Input')).SetMouseVisible(True) del fs c.GetSubsystem(sh('Input')).SetMouseVisible(True) a.Run() #ep = a.engineParameters
24.875
107
0.66206
29f6bfc61051a4c8d3929a3bb610dca313e55859
7,696
py
Python
ajustes_UM/tesis/tesis/settings.py
abelgonzalez/ajustes
f6f99aea18cfb82750805321abfc822d8a6ec5ed
[ "MIT" ]
1
2015-03-04T13:04:33.000Z
2015-03-04T13:04:33.000Z
ajustes_UM/tesis/tesis/settings.py
abelgonzalez/ajustes
f6f99aea18cfb82750805321abfc822d8a6ec5ed
[ "MIT" ]
null
null
null
ajustes_UM/tesis/tesis/settings.py
abelgonzalez/ajustes
f6f99aea18cfb82750805321abfc822d8a6ec5ed
[ "MIT" ]
null
null
null
""" Django settings for tesis project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # -*- coding: utf-8 -*- # A tuple that lists people who get code error notifications. ADMINS = ( ('Abel Gonzlez Mondjar', 'abelglez89@gmail.com'), ) # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os from django.conf import global_settings BASE_DIR = os.path.dirname(os.path.dirname(__file__)) # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'a6c$xd0y%_#%&ucf!uzu0cuc)6-+b+t5(63u#a__!^3cnhk)#l' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True # A boolean that turns on/off template debug mode. TEMPLATE_DEBUG = True # A list of strings representing the host/domain names that this Django site can serve. ALLOWED_HOSTS = [] # Application definition # A tuple of strings designating all applications that are enabled in this Django installation INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', # otras apps 'pure_pagination', 'watson', # Mis Apps 'ajustes', 'persona', 'planEstudio', # importada y modificada 'main', ) PAGINATION_SETTINGS = { 'PAGE_RANGE_DISPLAYED': 10, 'MARGIN_PAGES_DISPLAYED': 1, } # Middleware is a framework of hooks into Djangos request/response processing. MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ) # A string representing the full Python import path to your root URLconf. ROOT_URLCONF = 'tesis.urls' # The full Python path of the WSGI application object that Djangos built-in servers (e.g. runserver) will use. WSGI_APPLICATION = 'tesis.wsgi.application' # Database # https://docs.djangoproject.com/en/1.7/ref/settings/#databases # A dictionary containing the settings for all databases to be used with Django. DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'OPTIONS': { 'read_default_file': os.path.join(BASE_DIR, 'my.cnf'), 'init_command': 'SET storage_engine=INNODB', }, } } # Internationalization # https://docs.djangoproject.com/en/1.7/topics/i18n/ # Language code for this installation. LANGUAGE_CODE = 'es-CU' # A boolean that specifies whether Djangos translation system should be enabled. # This provides an easy way to turn it off, for performance. If this is set to False, # Django will make some optimizations so as not to load the translation machinery. USE_I18N = True # A boolean that specifies if localized formatting of data will be enabled by default or not. # If this is set to True, e.g. Django will display numbers and dates using the format of the current locale. USE_L10N = True # A boolean that specifies if datetimes will be timezone-aware by default or not. # If this is set to True, Django will use timezone-aware datetimes internally. # Otherwise, Django will use naive datetimes in local time. USE_TZ = True # Number representing the first day of the week. FIRST_DAY_OF_WEEK = 1 from django.utils.translation import ugettext_lazy as _ # A tuple of all available languages. LANGUAGES = ( ('es', _('Espaol')), ('en', _('English')), ) # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.7/howto/static-files/ # URL to use when referring to static files located in STATIC_ROOT. # Example: "http://media.lawrence.com/static/" # Esto debe configurarse de manera similar que el media para poder servir archivos estticos # Puede ser algo como esta linea comentada # STATIC_URL = 'http://localhost:90/static/' STATIC_URL = '/static/' # Local time zone for this installation. # On Unix systems, a value of None will cause Django to use the same # timezone as the operating system. # If running in a Windows environment this must be set to the same as your # system time zone. TIME_ZONE = 'America/Havana' # List of locations of the template source files searched by django.template.loaders.filesystem.Loader, in search order. # Note that these paths should use Unix-style forward slashes, even on Windows. TEMPLATE_DIRS = ( os.path.join(os.path.dirname(__file__), '..', 'templates').replace('\\', '/'),) # This setting defines the additional locations the staticfiles app will traverse if the FileSystemFinder finder is # enabled, e.g. if you use the collectstatic or findstatic management command or use the static file serving view. STATICFILES_DIRS = ((os.path.join(BASE_DIR, 'assets')), (os.path.join(BASE_DIR, 'media'))) # Absolute path to the directory static files should be collected to. # Don't put anything in this directory yourself; store your static files # in apps' "static/" subdirectories and in STATICFILES_DIRS. # Example: "/home/media/media.lawrence.com/static/" STATIC_ROOT = (os.path.join(BASE_DIR, 'static')) # URL prefix for static files. # Absolute filesystem path to the directory that will hold user-uploaded files. # Example: "/home/media/media.lawrence.com/media/" # MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'assets/upload') # COMENTADO PROJECT_PATH = os.path.dirname(os.path.dirname(__file__)) PROJECT_ROOT = os.path.join("../", PROJECT_PATH) MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media/') # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash. # Examples: "http://media.lawrence.com/media/", "http://example.com/media/" # Configurar esta lnea es importante puede quedar algo as: # MEDIA_URL = 'http://localhost:90/media/' # MEDIA_URL = 'http://127.0.0.1:8000/media/' # COMENTADO # estas las import tambin # A sample logging configuration. The only tangible logging # performed by this configuration is to send an email to # the site admins on every HTTP 500 error when DEBUG=False. # See http://docs.djangoproject.com/en/dev/topics/logging for # more details on how to customize your logging configuration. LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'filters': { 'require_debug_false': { '()': 'django.utils.log.RequireDebugFalse' } }, 'handlers': { 'mail_admins': { 'level': 'ERROR', 'filters': ['require_debug_false'], 'class': 'django.utils.log.AdminEmailHandler' } }, 'loggers': { 'django.request': { 'handlers': ['mail_admins'], 'level': 'ERROR', 'propagate': True, }, } } # The URL where requests are redirected after login when the contrib.auth.login view gets no next parameter. LOGIN_REDIRECT_URL = '/' # The URL where requests are redirected for login, especially when using the login_required() decorator. LOGIN_URL = '/' # LOGIN_URL counterpart. LOGOUT_URL = '/logoutUser' # TEMPLATE_CONTEXT_PROCESSORS = ( # 'django.contrib.auth.context_processors.auth', # 'django.core.context_processors.request', # ) TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + ( "django.core.context_processors.request", )
34.204444
120
0.721674
29f700b90ab2377c8ba15763c3022ce5834a7f4f
4,445
py
Python
python/fe3lmaker/s3-driver.py
flarebyte/wonderful-bazar
810514cd7d73505b11d738f8b84d91842d18d074
[ "MIT" ]
null
null
null
python/fe3lmaker/s3-driver.py
flarebyte/wonderful-bazar
810514cd7d73505b11d738f8b84d91842d18d074
[ "MIT" ]
null
null
null
python/fe3lmaker/s3-driver.py
flarebyte/wonderful-bazar
810514cd7d73505b11d738f8b84d91842d18d074
[ "MIT" ]
null
null
null
#!/usr/bin/env python # This software code is made available "AS IS" without warranties of any # kind. You may copy, display, modify and redistribute the software # code either by itself or as incorporated into your code; provided that # you do not remove any proprietary notices. Your use of this software # code is at your own risk and you waive any claim against Amazon # Digital Services, Inc. or its affiliates with respect to your use of # this software code. (c) 2006-2007 Amazon Digital Services, Inc. or its # affiliates. import S3 import time import sys AWS_ACCESS_KEY_ID = '<INSERT YOUR AWS ACCESS KEY ID HERE>' AWS_SECRET_ACCESS_KEY = '<INSERT YOUR AWS SECRET ACCESS KEY HERE>' # remove these next two lines when you've updated your credentials. print "update s3-driver.py with your AWS credentials" sys.exit(); # convert the bucket to lowercase for vanity domains # the bucket name must be lowercase since DNS is case-insensitive BUCKET_NAME = AWS_ACCESS_KEY_ID.lower() + '-test-bucket' KEY_NAME = 'test-key' conn = S3.AWSAuthConnection(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) generator = S3.QueryStringAuthGenerator(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) # Check if the bucket exists. The high availability engineering of # Amazon S3 is focused on get, put, list, and delete operations. # Because bucket operations work against a centralized, global # resource space, it is not appropriate to make bucket create or # delete calls on the high availability code path of your application. # It is better to create or delete buckets in a separate initialization # or setup routine that you run less often. if (conn.check_bucket_exists(BUCKET_NAME).status == 200): print '----- bucket already exists! -----' else: print '----- creating bucket -----' print conn.create_located_bucket(BUCKET_NAME, S3.Location.DEFAULT).message # to create an EU bucket #print conn.create_located_bucket(BUCKET_NAME, S3.Location.EU).message print '----- bucket location -----' print conn.get_bucket_location(BUCKET_NAME).location print '----- listing bucket -----' print map(lambda x: x.key, conn.list_bucket(BUCKET_NAME).entries) print '----- putting object (with content type) -----' print conn.put( BUCKET_NAME, KEY_NAME, S3.S3Object('this is a test'), { 'Content-Type': 'text/plain' }).message print '----- listing bucket -----' print map(lambda x: x.key, conn.list_bucket(BUCKET_NAME).entries) print '----- getting object -----' print conn.get(BUCKET_NAME, KEY_NAME).object.data print '----- query string auth example -----' print "\nTry this url out in your browser (it will only be valid for 60 seconds).\n" generator.set_expires_in(60); url = generator.get(BUCKET_NAME, KEY_NAME) print url print '\npress enter> ', sys.stdin.readline() print "\nNow try just the url without the query string arguments. it should fail.\n" print generator.make_bare_url(BUCKET_NAME, KEY_NAME) print '\npress enter> ', sys.stdin.readline() print '----- putting object with metadata and public read acl -----' print conn.put( BUCKET_NAME, KEY_NAME + '-public', S3.S3Object('this is a publicly readable test'), { 'x-amz-acl': 'public-read' , 'Content-Type': 'text/plain' } ).message print '----- anonymous read test ----' print "\nYou should be able to try this in your browser\n" public_key = KEY_NAME + '-public' print generator.make_bare_url(BUCKET_NAME, public_key) print "\npress enter> ", sys.stdin.readline() print "----- getting object's acl -----" print conn.get_acl(BUCKET_NAME, KEY_NAME).object.data print "\n----- path style url example -----"; print "Non-location-constrained buckets can also be specified as part of the url path. (This was the original url style supported by S3.)\n"; print "Try this url out in your browser (it will only be valid for 60 seconds).\n" generator.calling_format = S3.CallingFormat.PATH url = generator.get(BUCKET_NAME, KEY_NAME) print url print "\npress enter> ", sys.stdin.readline() print '----- deleting objects -----' print conn.delete(BUCKET_NAME, KEY_NAME).message print conn.delete(BUCKET_NAME, KEY_NAME + '-public').message print '----- listing bucket -----' print map(lambda x: x.key, conn.list_bucket(BUCKET_NAME).entries) print '----- listing all my buckets -----' print map(lambda x: x.name, conn.list_all_my_buckets().entries) print '----- deleting bucket ------' print conn.delete_bucket(BUCKET_NAME).message
37.352941
142
0.730259
29f709dd701c60c4489620b7e5b46e5aca1a0daf
7,468
py
Python
code/lib/models/FCRN_depth.py
santomon/taskonomy
4b22087a2686172b21b61589831061e7a386fe36
[ "MIT" ]
789
2018-03-21T05:28:38.000Z
2022-03-29T19:32:47.000Z
code/lib/models/FCRN_depth.py
santomon/taskonomy
4b22087a2686172b21b61589831061e7a386fe36
[ "MIT" ]
46
2018-05-03T07:11:10.000Z
2022-03-11T23:26:03.000Z
code/lib/models/FCRN_depth.py
santomon/taskonomy
4b22087a2686172b21b61589831061e7a386fe36
[ "MIT" ]
152
2018-03-24T10:20:44.000Z
2022-02-09T02:38:10.000Z
from __future__ import absolute_import, division, print_function from models.base_net import BaseNet import losses.all as losses_lib import tensorflow as tf import tensorflow.contrib.slim as slim import numpy as np import pdb import optimizers.train_steps as train_steps import optimizers.ops as optimize from functools import partial import models.fcrn from models.fcrn import ResNet50UpProj
38.494845
152
0.622657
29f82c973044d39870f0f41f75666b3782377f54
13,459
py
Python
tests/test_handler.py
Tas-Kit/platform
34e1abb3f85b9649cbf18496333bf35f74aa6e3d
[ "Apache-2.0" ]
null
null
null
tests/test_handler.py
Tas-Kit/platform
34e1abb3f85b9649cbf18496333bf35f74aa6e3d
[ "Apache-2.0" ]
null
null
null
tests/test_handler.py
Tas-Kit/platform
34e1abb3f85b9649cbf18496333bf35f74aa6e3d
[ "Apache-2.0" ]
null
null
null
# trigger build import json import uuid import pytest from mock import MagicMock, patch from src import handler, db from src.models import User, MiniApp, TObject from src.constants import ROLE from werkzeug.exceptions import BadRequest def test_execute_obj_post_no_permission(): with pytest.raises(BadRequest): handler.execute_obj_post(MagicMock(), MagicMock(), ROLE.STANDARD, MagicMock()) def test_execute_obj_delete_no_permission(): obj = MagicMock() oid_list = [] with pytest.raises(BadRequest): handler.execute_obj_delete(obj, ROLE.STANDARD, oid_list) def test_serialize_objs(): obj1 = MagicMock(oid='oid1') obj2 = MagicMock(oid='oid2') obj1.serialize.return_value = 'obj1' obj2.serialize.return_value = 'obj2' objs = [obj1, obj2] user = MagicMock() assert {'oid1': 'obj1', 'oid2': 'obj2'} == handler.serialize_objs(user, objs, ROLE.ADMIN) obj1.serialize.assert_called_once_with(user, ROLE.ADMIN) obj2.serialize.assert_called_once_with(user, ROLE.ADMIN) def test_get_graph_obj_not_exist(): with pytest.raises(BadRequest): handler.get_graph_obj('none existing aid', MiniApp) def test_get_graph_obj_user_not_exist(): uid = str(uuid.uuid4()) u = handler.get_graph_obj(uid, User) assert u.uid == uid db.delete(u) def test_get_graph_obj_exist(): app = MiniApp() aid = str(uuid.uuid4()) app.aid = aid db.push(app) db.pull(app) assert app == handler.get_graph_obj(aid, MiniApp) db.delete(app) def test_handle_obj_patch_root(): with pytest.raises(BadRequest): handler.handle_obj_patch('root', '')
31.155093
141
0.666691
29f8d1a4f8b0cea46b5286a6c9367ca7d6ae25dc
579
py
Python
ersilia/utils/identifiers/long.py
ersilia-os/ersilia
eded117d6c7029ce4a497effdb514c21edfe3673
[ "MIT" ]
32
2020-07-30T20:31:05.000Z
2022-03-31T17:27:14.000Z
ersilia/utils/identifiers/long.py
ersilia-os/ersilia
eded117d6c7029ce4a497effdb514c21edfe3673
[ "MIT" ]
59
2022-03-21T10:00:04.000Z
2022-03-31T23:03:14.000Z
ersilia/utils/identifiers/long.py
ersilia-os/ersilia
eded117d6c7029ce4a497effdb514c21edfe3673
[ "MIT" ]
44
2022-03-17T13:11:07.000Z
2022-03-31T19:44:16.000Z
try: import uuid except ModuleNotFoundError as err: uuid = None ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" PATTERN = [8, 4, 4, 4, 12] SEP = "-"
23.16
75
0.56304
29f8e7164c007819cd3fd8ace5f9b2b1776fa29b
19,622
py
Python
client/buck_project_builder/tests/builder_test.py
aspin/pyre-check
fe78b41789ba3ef091b0b021d9a1c6267905a7f8
[ "MIT" ]
null
null
null
client/buck_project_builder/tests/builder_test.py
aspin/pyre-check
fe78b41789ba3ef091b0b021d9a1c6267905a7f8
[ "MIT" ]
null
null
null
client/buck_project_builder/tests/builder_test.py
aspin/pyre-check
fe78b41789ba3ef091b0b021d9a1c6267905a7f8
[ "MIT" ]
null
null
null
# Copyright (c) 2019-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import glob import unittest from typing import List, Optional from unittest.mock import MagicMock, patch from .. import BuilderException, FastBuckBuilder, Target, parser from ..build_target import ( BuildTarget, PythonBinary, PythonLibrary, PythonWheel, ThriftLibrary, ) from ..filesystem import Sources from .test_common import base
37.590038
88
0.505045
29f94d2b334b89e0c508fee4d9e22209246bc128
5,970
py
Python
api/user.py
gfoo/fastapi-demo
44ceb9e94fa833841756136c3b446f192a311dde
[ "Unlicense" ]
null
null
null
api/user.py
gfoo/fastapi-demo
44ceb9e94fa833841756136c3b446f192a311dde
[ "Unlicense" ]
null
null
null
api/user.py
gfoo/fastapi-demo
44ceb9e94fa833841756136c3b446f192a311dde
[ "Unlicense" ]
null
null
null
from time import time from typing import List from core.security import verify_password from db import users as DBUsers from fastapi import APIRouter, Depends, HTTPException, status from fastapi.responses import JSONResponse from models.user import DBUser from schemas.user import (UserCreate, UserUpdateActivate, UserUpdatePassword, UserUpdateSuperuser, UserView) from sqlalchemy.orm import Session from .deps import get_current_active_superuser, get_current_active_user, get_db router = APIRouter( prefix='/users', tags=['users'] )
36.402439
109
0.701675
29f9eab4a69842a784121a1073e07bcadc752ced
3,265
py
Python
Realsense2CV.py
felix2072/pytorch-CycleGAN-and-pix2pix
4980106ceab5e1eb7bb20c2b492d007b6310d9e1
[ "BSD-3-Clause" ]
null
null
null
Realsense2CV.py
felix2072/pytorch-CycleGAN-and-pix2pix
4980106ceab5e1eb7bb20c2b492d007b6310d9e1
[ "BSD-3-Clause" ]
null
null
null
Realsense2CV.py
felix2072/pytorch-CycleGAN-and-pix2pix
4980106ceab5e1eb7bb20c2b492d007b6310d9e1
[ "BSD-3-Clause" ]
null
null
null
## License: Apache 2.0. See LICENSE file in root directory. ## Copyright(c) 2015-2017 Intel Corporation. All Rights Reserved. ############################################### ## Open CV and Numpy integration ## ############################################### import pyrealsense2 as rs import numpy as np import cv2 # Configure depth and color streams pipeline = rs.pipeline() config = rs.config() # Get device product line for setting a supporting resolution pipeline_wrapper = rs.pipeline_wrapper(pipeline) pipeline_profile = config.resolve(pipeline_wrapper) device = pipeline_profile.get_device() device_product_line = str(device.get_info(rs.camera_info.product_line)) config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30) width = 640 height = 480 if device_product_line == 'L500': config.enable_stream(rs.stream.color, 960, 540, rs.format.bgr8, 30) else: config.enable_stream(rs.stream.color, 640, 480, rs.format.bgr8, 30) # Start streaming pipeline.start(config) max_lowThreshold = 100 window_name = 'Edge Map' title_trackbar = 'Min Threshold:' ratio = 3 kernel_size = 3 try: while True: # Wait for a coherent pair of frames: depth and color frames = pipeline.wait_for_frames() depth_frame = frames.get_depth_frame() color_frame = frames.get_color_frame() if not depth_frame or not color_frame: continue # Convert images to numpy arrays object_color = np.zeros((height, width, 3), np.uint8) depth_image = np.asanyarray(depth_frame.get_data()) color_image = np.asanyarray(color_frame.get_data()) # depth_image_rgb = cv2.merge((depth_image,depth_image,depth_image)) # Apply colormap on depth image (image must be converted to 8-bit per pixel first) # depth_colormap = cv2.applyColorMap(cv2.convertScaleAbs(depth_image, alpha=0.03), cv2.COLORMAP_JET) # depth_colormap_dim = depth_colormap.shape color_colormap_dim = color_image.shape depth_image = cv2.resize(depth_image, (width, height), interpolation=cv2.INTER_AREA) edges = auto_canny(color_image) #edges = cv2.bitwise_not(edges) edges_rgb = object_color.shape edges_rgb = cv2.merge((edges,edges,edges)) #blank_image[5:10 , 5:10] = (255, 0, 0) # [x.1,x.2 , y.1,y.2] (B, G, R) object_color[0:width, 0:height] = (76, 76, 76) image = cv2.add(edges_rgb,object_color) edges_rgb = cv2.bitwise_not(edges_rgb) image = cv2.multiply(edges_rgb,image,scale = 0.003922) image = image[0:256, 0:256] # Show images cv2.namedWindow('RealSense', cv2.WINDOW_AUTOSIZE) cv2.imshow('RealSense', image) cv2.waitKey(1) finally: # Stop streaming pipeline.stop()
34.368421
109
0.644717
29faa4ea69ec98280ad24b2003914856eee015a8
12,800
py
Python
governor/postgresql.py
billcap/governor
0056ec15d973d24f36688783b415fe894ca94db7
[ "MIT" ]
null
null
null
governor/postgresql.py
billcap/governor
0056ec15d973d24f36688783b415fe894ca94db7
[ "MIT" ]
null
null
null
governor/postgresql.py
billcap/governor
0056ec15d973d24f36688783b415fe894ca94db7
[ "MIT" ]
null
null
null
import logging import os import psycopg2 import time import shlex import subprocess import shutil import threading from urllib.parse import urlparse logger = logging.getLogger(__name__)
33.952255
114
0.563984
29fbb43e9c43f01cd5a84414b7fa4416473edd33
566
py
Python
main.py
Benrflanders/Genetic-Algorithm-Function-Solver
7234aed5478d0701f0f8ce342116ac154aa40ba1
[ "MIT" ]
null
null
null
main.py
Benrflanders/Genetic-Algorithm-Function-Solver
7234aed5478d0701f0f8ce342116ac154aa40ba1
[ "MIT" ]
null
null
null
main.py
Benrflanders/Genetic-Algorithm-Function-Solver
7234aed5478d0701f0f8ce342116ac154aa40ba1
[ "MIT" ]
null
null
null
import genetic_algorithm #where the population will be processed and the main loop is contained #initialise population with random candidate solutions print("Enter a function to be solved: \n") fitness_function = [1780, 17, -2] #n = ax + by #function: [n, a, b] ga = genetic_algorithm.genetic_algorithm(fitness_function) #evaluate each candidate #repeat until (termination condition is satifsfied ) DO #select parents; #recombine pairs of parents #mutate the resulting offspring #evaluate new candidates #select individuals for the next generation #OD #END
21.769231
70
0.780919
29fda9d9b2256b8b4efc118aa8ea61e7cbc1a09c
264
py
Python
thirdparty/flask/template/macro_demo.py
gwaysoft/python
a74a0b553dfca9606083a41ab6d03801e67d2467
[ "Apache-2.0" ]
null
null
null
thirdparty/flask/template/macro_demo.py
gwaysoft/python
a74a0b553dfca9606083a41ab6d03801e67d2467
[ "Apache-2.0" ]
null
null
null
thirdparty/flask/template/macro_demo.py
gwaysoft/python
a74a0b553dfca9606083a41ab6d03801e67d2467
[ "Apache-2.0" ]
null
null
null
from flask import Flask, render_template app = Flask(__name__) if __name__ == '__main__': print(app.url_map) app.run(debug=True, host="0.0.0.0")
18.857143
76
0.674242
29fdda258cbe5d54b3217108b57775e883bf274f
549
py
Python
fishpass/migrations/0004_auto_20180925_1825.py
Ecotrust/FishPass
a69a4f9de46f28653ae92ef33c1e5cf7036cfb37
[ "MIT" ]
3
2019-03-01T04:00:21.000Z
2022-02-10T22:17:20.000Z
fishpass/migrations/0004_auto_20180925_1825.py
Ecotrust/FishPass
a69a4f9de46f28653ae92ef33c1e5cf7036cfb37
[ "MIT" ]
165
2018-04-13T18:24:39.000Z
2022-03-02T03:27:33.000Z
fishpass/migrations/0004_auto_20180925_1825.py
Ecotrust/FishPass
a69a4f9de46f28653ae92ef33c1e5cf7036cfb37
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- # Generated by Django 1.11.15 on 2018-09-26 01:25 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion
24.954545
106
0.657559
29fded4c87d470f4257846244ccbee2b48588393
8,956
py
Python
backend/account/migrations/0001_initial.py
CS178A-B/final-project-bjls
aebb8042f2d958caac00e31b27b445b9079901d0
[ "MIT" ]
null
null
null
backend/account/migrations/0001_initial.py
CS178A-B/final-project-bjls
aebb8042f2d958caac00e31b27b445b9079901d0
[ "MIT" ]
20
2020-10-21T19:16:15.000Z
2021-09-03T05:48:20.000Z
backend/account/migrations/0001_initial.py
CS178A-B/R-Finder
aebb8042f2d958caac00e31b27b445b9079901d0
[ "MIT" ]
1
2020-10-22T04:49:45.000Z
2020-10-22T04:49:45.000Z
# Generated by Django 2.2.13 on 2021-03-10 21:33 import account.models import datetime from django.conf import settings import django.contrib.auth.models import django.contrib.auth.validators from django.db import migrations, models import django.db.models.deletion import django.utils.timezone
50.03352
329
0.61054
29ffd5d34e2555908d5acb7cecdc5aad3a6e87bc
1,983
py
Python
src/predictionAlgorithms/machineLearning/training/convolutionalLstm.py
aivaras-ciurlionis/meteo
434759d16f7cca505d280475611d1fef5176827b
[ "MIT" ]
null
null
null
src/predictionAlgorithms/machineLearning/training/convolutionalLstm.py
aivaras-ciurlionis/meteo
434759d16f7cca505d280475611d1fef5176827b
[ "MIT" ]
6
2020-05-23T11:30:48.000Z
2022-03-11T23:45:06.000Z
src/predictionAlgorithms/machineLearning/training/convolutionalLstm.py
aivaras-ciurlionis/meteo
434759d16f7cca505d280475611d1fef5176827b
[ "MIT" ]
null
null
null
import tensorflow from PIL import Image from keras.models import Sequential from keras.layers import Conv2D, Conv2DTranspose, ConvLSTM2D from keras.optimizers import SGD import numpy as np import os from keras import backend as K from src.predictionAlgorithms.machineLearning.algorithms.ConvLSTM import ConvLstm from src.predictionAlgorithms.machineLearning.algorithms.ConvolutionalChannelsMovementAlgorithm import \ ConvolutionalChannelsMovementAlgorithm from src.predictionAlgorithms.machineLearning.helpers.callbacks import Callbacks from src.utilities.imageAnalysis.pixelsRainStrengthConverter import PixelsRainStrengthConverter # K: 12x12 -> lr: 0.01 -> E = 50; SpE = 10
34.189655
104
0.611699
4b00cec2aa25b2e4c87f0a86c86662d5e0d2edb1
1,927
py
Python
batchtest.py
nachewigkeit/CropDefender
e78fc48f720367ca94033f6263eb1e4a9c6b7858
[ "MIT" ]
2
2021-10-14T08:14:15.000Z
2021-12-01T05:57:49.000Z
batchtest.py
nachewigkeit/CropDefender
e78fc48f720367ca94033f6263eb1e4a9c6b7858
[ "MIT" ]
null
null
null
batchtest.py
nachewigkeit/CropDefender
e78fc48f720367ca94033f6263eb1e4a9c6b7858
[ "MIT" ]
1
2021-12-01T05:57:53.000Z
2021-12-01T05:57:53.000Z
import bchlib from PIL import Image, ImageOps import numpy as np import glob from tqdm import tqdm import torch import matplotlib.pyplot as plt from model import StegaStampDecoder BCH_POLYNOMIAL = 137 BCH_BITS = 5 if __name__ == "__main__": dirPath = r"E:/dataset/stegastamp_crop" modelPath = r'saved_models/decoder.pth' file_list = glob.glob(dirPath + '/*.png') model = StegaStampDecoder().cuda() model.load_state_dict(torch.load(modelPath)) model.eval() bitstring = get_bits() store = [] with torch.no_grad(): for file in tqdm(file_list): image = Image.open(file).convert("RGB") image = image.crop((50, 50, 350, 350)) image = np.array(ImageOps.fit(image, (400, 400)), dtype=np.float32) image /= 255. result = decode(image, model) store.append(get_acc(bitstring, result)) plt.hist(store) plt.show() print(np.mean(store))
24.705128
79
0.63259
4b065798f8f3175be2995f3dc86fae9e7dc987b7
1,249
py
Python
tests/ozpcenter_model_access/test_contact_type.py
emosher/ozp-backend
d31d00bb8a28a8d0c999813f616b398f41516244
[ "Apache-2.0" ]
1
2018-10-05T17:03:01.000Z
2018-10-05T17:03:01.000Z
tests/ozpcenter_model_access/test_contact_type.py
emosher/ozp-backend
d31d00bb8a28a8d0c999813f616b398f41516244
[ "Apache-2.0" ]
1
2017-01-06T19:20:32.000Z
2017-01-06T19:20:32.000Z
tests/ozpcenter_model_access/test_contact_type.py
emosher/ozp-backend
d31d00bb8a28a8d0c999813f616b398f41516244
[ "Apache-2.0" ]
7
2016-12-16T15:42:05.000Z
2020-09-05T01:11:27.000Z
import pytest from django.test import TestCase from django.test import override_settings import ozpcenter.api.contact_type.model_access as model_access from ozpcenter.models import ContactType from tests.cases.factories import ContactTypeFactory
30.463415
83
0.767814
4b070ef3534dcec1b94204596a275dcc71c8d799
428
py
Python
examples/echobot.py
samedamci/telegrask
8cd0d7663e3a7386784396462f66c176bc6543c5
[ "0BSD" ]
4
2021-08-19T19:17:17.000Z
2021-10-12T19:25:59.000Z
examples/echobot.py
samedamci/telegrask
8cd0d7663e3a7386784396462f66c176bc6543c5
[ "0BSD" ]
null
null
null
examples/echobot.py
samedamci/telegrask
8cd0d7663e3a7386784396462f66c176bc6543c5
[ "0BSD" ]
1
2021-08-31T10:49:34.000Z
2021-08-31T10:49:34.000Z
#!/usr/bin/python3 """Simple bot to reply exactly the same what user sent to chat.""" # This program is dedicated to the public domain under the CC0 license. from telegrask import Telegrask bot = Telegrask("BOT_TOKEN") if __name__ == "__main__": bot.run(debug=True)
25.176471
73
0.740654
4b07a5e3542e7f446d97c19101d6130c567a06f9
2,238
py
Python
lib/emailsmtp/models.py
hdknr/emailqueue
05e108562f4fb612440f769973b9a3d02c11afcd
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
lib/emailsmtp/models.py
hdknr/emailqueue
05e108562f4fb612440f769973b9a3d02c11afcd
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
lib/emailsmtp/models.py
hdknr/emailqueue
05e108562f4fb612440f769973b9a3d02c11afcd
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
from django.db import models from django.utils.translation import ugettext_lazy as _ from emailqueue.models import BaseModel
29.84
76
0.636282
4b096109d1a756991d2981702ec6615bda617d75
3,314
py
Python
emoji-list.unicode.crawler.py
SHITianhao/emoji-dataset
41812649f518f69472722c56d4aa77faeb9bbe8a
[ "MIT" ]
2
2017-12-19T06:44:59.000Z
2020-01-17T20:06:53.000Z
emoji-list.unicode.crawler.py
SHITianhao/emoji-dataset
41812649f518f69472722c56d4aa77faeb9bbe8a
[ "MIT" ]
null
null
null
emoji-list.unicode.crawler.py
SHITianhao/emoji-dataset
41812649f518f69472722c56d4aa77faeb9bbe8a
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- """This module is used to crawler emoji unicode from http://www.unicode.org/ """ import urllib import json import base64 import os from bs4 import BeautifulSoup __EMOJI_V4_URL = "http://www.unicode.org/emoji/charts/emoji-list.html" __EMOJI_V5_URL = "http://www.unicode.org/emoji/charts-beta/emoji-list.html" __IMG_FOLDER_NAME = "emoji_imgs" emoji_file = file("emoji_inverse.json", "r") emojis = json.loads(emoji_file.read().decode("utf-8-sig")) print "emoji_inverse.json loaded" def decode_base64(data): """Decode base64, padding being optional. :param data: Base64 data as an ASCII byte string :returns: The decoded byte string. """ missing_padding = 4 - len(data) % 4 if missing_padding: data += b'=' * missing_padding return base64.decodestring(data) crawler_emojis('V4') crawler_emojis('V5')
28.568966
84
0.60169
4b0bae7ae91cfcfff2eabb361271fc8c258445e7
1,628
py
Python
venv/Lib/site-packages/traits/tests/test_constant.py
richung99/digitizePlots
6b408c820660a415a289726e3223e8f558d3e18b
[ "MIT" ]
1
2022-01-18T17:56:51.000Z
2022-01-18T17:56:51.000Z
venv/Lib/site-packages/traits/tests/test_constant.py
richung99/digitizePlots
6b408c820660a415a289726e3223e8f558d3e18b
[ "MIT" ]
null
null
null
venv/Lib/site-packages/traits/tests/test_constant.py
richung99/digitizePlots
6b408c820660a415a289726e3223e8f558d3e18b
[ "MIT" ]
null
null
null
# (C) Copyright 2005-2021 Enthought, Inc., Austin, TX # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in LICENSE.txt and may be redistributed only under # the conditions described in the aforementioned license. The license # is also available online at http://www.enthought.com/licenses/BSD.txt # # Thanks for using Enthought open source! import unittest from traits.api import Constant, HasTraits, TraitError
29.6
71
0.625307
4b0c74252519e1d0763eeba5100d8c404e0ec79d
5,072
py
Python
midap_simulator/packet_manager.py
cap-lab/MidapSim
4f92a9f9413c29d7e1f37e863cce90ebdde8b420
[ "MIT" ]
2
2021-03-28T16:19:06.000Z
2022-02-26T08:58:33.000Z
midap_simulator/packet_manager.py
cap-lab/MidapSim
4f92a9f9413c29d7e1f37e863cce90ebdde8b420
[ "MIT" ]
null
null
null
midap_simulator/packet_manager.py
cap-lab/MidapSim
4f92a9f9413c29d7e1f37e863cce90ebdde8b420
[ "MIT" ]
1
2021-02-22T08:44:20.000Z
2021-02-22T08:44:20.000Z
import mmap import numpy as np from time import sleep import os
33.813333
134
0.589708
4b0d7a34a5dad916ea34157afa0ac2b56a26899d
119
py
Python
optimizers/__init__.py
Leo-xxx/NeuronBlocks
4ddbdc625ccec15337df3cbf85e73ed25a117989
[ "MIT" ]
1,257
2019-05-06T21:25:16.000Z
2022-03-19T11:06:49.000Z
optimizers/__init__.py
heavenAsk/NeuronBlocks
9b08bb8ac7ceca874c8f2541d610bc8d3278fb22
[ "MIT" ]
37
2019-05-07T00:16:13.000Z
2021-12-31T11:55:44.000Z
optimizers/__init__.py
heavenAsk/NeuronBlocks
9b08bb8ac7ceca874c8f2541d610bc8d3278fb22
[ "MIT" ]
186
2019-05-07T00:36:40.000Z
2022-02-28T20:47:19.000Z
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT license. from torch.optim import *
39.666667
59
0.781513
4b0eec937bcf7b4132e9bab483c930a0a86d89bc
3,824
py
Python
amurlevel_model/model/train_test_split.py
RaevskyDN/aij2020-amur-noflood-public
d11349b1f8cc79c18bb078392731eac32b3c56ff
[ "Apache-2.0" ]
7
2021-02-17T18:55:13.000Z
2021-07-30T13:56:19.000Z
amurlevel_model/model/train_test_split.py
RaevskyDN/aij2020-amur-noflood-public
d11349b1f8cc79c18bb078392731eac32b3c56ff
[ "Apache-2.0" ]
null
null
null
amurlevel_model/model/train_test_split.py
RaevskyDN/aij2020-amur-noflood-public
d11349b1f8cc79c18bb078392731eac32b3c56ff
[ "Apache-2.0" ]
1
2022-01-23T15:11:43.000Z
2022-01-23T15:11:43.000Z
# -*- coding: utf-8 -*- import pandas as pd import numpy as np from datetime import date from typing import Union,Tuple,Optional,List from ..config_features import CATEGORICAL_FEATURES,NUMERICAL_FEATURES from ..config import DAYS_FORECAST,ALL_STATIONS from ..utils.normalizer import get_normalizer_stats def train_test_split(amur_df: pd.DataFrame, start_test_date: Union[date,str], end_test_date: Union[date,str], fname: Optional[str]=None, numerical_features: Optional[List[str]]=None, categorical_features: Optional[List[str]]=None) -> Tuple[np.array,np.array,np.array,np.array]: ''' , . - 1 , - 10 [n,DAYS_FORECAST,n_features] - n - , DAYS_FORECAST - (10), n_features - :param amur_df: pd.DataFrame :param start_test_date: date,str - :param end_test_date: date,str - :param fname: str, json c mean,std :param numerical_features: List[str] - :param categorical_features: List[str] - :return: tuple: X_train - y_train - X_test - y_test - ''' if numerical_features is None: numerical_features = NUMERICAL_FEATURES if categorical_features is None: categorical_features = CATEGORICAL_FEATURES targets = ['sealevel_max_' + identifier for identifier in ALL_STATIONS] train = amur_df[amur_df['date'] < start_test_date].copy() test = amur_df[(amur_df['date'] >= start_test_date) & (amur_df['date'] < end_test_date)].copy() stats = get_normalizer_stats(fname) for col in numerical_features: _mean = stats[col]['mean'] _std = stats[col]['std'] train[col] = (train[col] - _mean) / _std test[col] = (test[col] - _mean) / _std train.sort_values('date', inplace=True) train_x_array = [] train_y_array = [] step = 0 while True: if step + DAYS_FORECAST + 1 >= len(train): break if train.iloc[step:step + DAYS_FORECAST][targets].count().min() < DAYS_FORECAST: step += 1 continue train_x_array.append(train.iloc[step:step + DAYS_FORECAST][numerical_features + categorical_features].values) train_y_array.append(train.iloc[step:step + DAYS_FORECAST][targets].values) step += 1 X_train = np.transpose(np.dstack(train_x_array), (2, 0, 1)) y_train = np.transpose(np.dstack(train_y_array), (2, 0, 1)) step = 0 test.sort_values('date', inplace=True) test_x_array = [] test_y_array = [] while True: if step >= len(test): break if test.iloc[step:step + DAYS_FORECAST][targets].count().min() < DAYS_FORECAST: step += DAYS_FORECAST continue test_x_array.append(test.iloc[step:step + DAYS_FORECAST][numerical_features + categorical_features].values) test_y_array.append(test.iloc[step:step + DAYS_FORECAST][targets].values) if step + DAYS_FORECAST*2+1 >= len(test): break step += DAYS_FORECAST X_test = np.transpose(np.dstack(test_x_array), (2, 0, 1)) y_test = np.transpose(np.dstack(test_y_array), (2, 0, 1)) return X_train, y_train, X_test, y_test
41.565217
117
0.636245
4b11b0281ea28ca55d21c7ab676dce9fefb150be
35
py
Python
bin/preprocessor/__init__.py
ian0549/AI-Audio-Task
6918fc4e7fd337c5649c47925ad5b8d999fda0e1
[ "MIT" ]
null
null
null
bin/preprocessor/__init__.py
ian0549/AI-Audio-Task
6918fc4e7fd337c5649c47925ad5b8d999fda0e1
[ "MIT" ]
null
null
null
bin/preprocessor/__init__.py
ian0549/AI-Audio-Task
6918fc4e7fd337c5649c47925ad5b8d999fda0e1
[ "MIT" ]
null
null
null
from .Preprocessor import Pipeline
17.5
34
0.857143
4b136b651e1325beb870ea9f5a79512ec242273e
80,229
py
Python
common/ui.py
Regnareb/StreamManager
8b95e785d41c78f03725077f5dce2a5c15e0354f
[ "MIT" ]
null
null
null
common/ui.py
Regnareb/StreamManager
8b95e785d41c78f03725077f5dce2a5c15e0354f
[ "MIT" ]
null
null
null
common/ui.py
Regnareb/StreamManager
8b95e785d41c78f03725077f5dce2a5c15e0354f
[ "MIT" ]
null
null
null
import os import sys import copy import ctypes import socket import logging import threading import functools import webbrowser logger = logging.getLogger(__name__) import keyboard from PySide2 import QtCore, QtWidgets, QtGui, QtWebEngineWidgets # TODO # Be able to import a text file in the description/title as variables (to have counters and currentsong for example) # Rajouter dans le menu contextuel les variables %CATEGORY% et autres fichiers monitors # Pouvoir ajouter un commandbot avec des commandes customs (!game !currentsong) # Add About and Help menu entries # Automatically switch scenes in OBS depending of the game played # Add an XML/EDL file and add each marker created for import into premiere/resolve/FCP # Change color tray icon to green if update channel with new process or red + toast message if error # Add trayicons for dropped frames and stream/record states # Do a notification if the user has not used a streaming process for X minutes if any service is online (to prevent streaming unnoticed) # Faire un streamdeck customisable qui change automatiquement les touches selon le programme utilis https://interactjs.io/ # Being able to put it in portrait without changing icons layout # Add Multi Actions with pause timers # Create an independant server that scan the foreground process and send it to the receiver, this way multi computer streaming is possible # websocket plugin ( https://github.com/Elektordi/obs-websocket-py ) Show Scene selector, MIC and DEFAULT volume, RECORD and STREAMING status and STATS import common.manager import common.remote import common.tools import common.systray def block_signals(iterable, block): for i in iterable: i.blockSignals(block) def updateStyle(obj, name, value): obj.setProperty(name, value) obj.setStyle(obj.style())
50.874445
398
0.672114
4b13fbf54481cade8e8734d48b08412beb1ed9cd
4,009
py
Python
tests/io/export/voc/test_create_annotation.py
wbknez/breakdb
f783820425c8cb70d8caedc6f5839a72de7c945e
[ "Apache-2.0" ]
1
2020-02-03T18:31:20.000Z
2020-02-03T18:31:20.000Z
tests/io/export/voc/test_create_annotation.py
wbknez/breakdb
f783820425c8cb70d8caedc6f5839a72de7c945e
[ "Apache-2.0" ]
null
null
null
tests/io/export/voc/test_create_annotation.py
wbknez/breakdb
f783820425c8cb70d8caedc6f5839a72de7c945e
[ "Apache-2.0" ]
null
null
null
""" Contains unit tests to ensure single database items are created correctly in a Pascal VOC compatible format. """ import os from xml.etree.ElementTree import Element, SubElement import numpy as np from breakdb.io.export.voc import create_annotation from tests.helpers.dataset import create_random_string from tests.helpers.xml import match
32.860656
78
0.626091
4b1766db2c0ad0a27e5899ec9658c4cad1b1b54e
8,242
py
Python
map.py
BenoitCorsini/world-flights
5e5ce6575a912cb6a71bf1caf6ef7c2d388044ce
[ "MIT" ]
null
null
null
map.py
BenoitCorsini/world-flights
5e5ce6575a912cb6a71bf1caf6ef7c2d388044ce
[ "MIT" ]
null
null
null
map.py
BenoitCorsini/world-flights
5e5ce6575a912cb6a71bf1caf6ef7c2d388044ce
[ "MIT" ]
null
null
null
import os import os.path as osp import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Circle, Polygon, Rectangle from config import PARAMS def plot_globe(self, angle=0): ''' Plots the globe and its shade as viewed from 'angle'. ''' angle = self.normalize_angle(angle) self.globe = Circle( xy=(0, 0), radius=1, color=self.params['globe']['water_colour'], zorder=self.params['zorder']['water'], lw=0, ) self.ax.add_patch(self.globe) for shape in self.shapes: for turn in [-1, 0, 1]: # to cover for the boundary problems points, unseen = zip(*[self.project(point, angle, turn) for point in shape]) if not all(unseen): # the border of the land self.ax.add_patch(Polygon( xy=points, color=self.params['globe']['border_colour'], zorder=self.params['zorder']['land_border'], lw=self.params['globe']['border'], clip_path=self.globe, joinstyle='round', )) # the main land self.ax.add_patch(Polygon( xy=points, color=self.params['globe']['land_colour'], zorder=self.params['zorder']['land'], lw=0, clip_path=self.globe, )) # plotting the shade self.plot_shade(angle) def plot_shade(self, angle=0): ''' Plots the shaded version of the globe. ''' angle = self.normalize_angle(angle + self.params['shade']['angle']) # general transformation applied on the shade transform = self.ax.transData.get_affine() x_shift = transform.get_matrix()[0,2] y_shift = transform.get_matrix()[1,2] x_scale = transform.get_matrix()[0,0] y_scale = transform.get_matrix()[1,1] transform.set_matrix(np.diag(np.diag(transform.get_matrix()))) # only keep the diagonal transform.scale( self.params['shade']['ratio']*self.params['shade']['scale'], self.params['shade']['scale'] ) transform.rotate_deg(self.params['shade']['rotation']) transform.translate( x_shift + x_scale*self.params['shade']['x_pos'], y_shift - y_scale + y_scale*self.params['shade']['y_pos'] ) # plotting the shaded world sphere self.ax.add_patch(Circle( xy=(0, 0), radius=1, color=self.params['shade']['water_colour'], zorder=self.params['zorder']['shade_water'], alpha=self.params['shade']['alpha'], transform=transform, lw=0, )) for shape in self.shapes: for turn in [-1, 0, 1]: # to cover for the boundary problems points, unseen = zip(*[self.project(point, angle, turn, flip=True, away=1) for point in shape]) if not all(unseen): self.ax.add_patch(Polygon( xy=points, color=self.params['shade']['land_colour'], zorder=self.params['zorder']['shade_land'], alpha=self.params['shade']['alpha'], transform=transform, lw=0, )) def savefig(self, name='map', folder='.', title=''): ''' Saves the current state of the figure. ''' assert hasattr(self, 'fig') if not osp.exists(folder): os.makedirs(folder) # adds a title when available if title: bbox = { 'boxstyle' : 'round', 'edgecolor' : self.params['text']['colour'], 'facecolor' : self.params['text']['background'], 'linewidth' : self.params['text']['border'], } self.ax.text( - 1 - self.params['figure']['extra_space'] + self.params['text']['x'], - 1 - self.params['figure']['extra_space'] + self.params['text']['y'], title, fontsize=self.params['text']['fontsize'], color=self.params['text']['colour'], #fontweight='demibold', bbox=bbox, ) self.fig.savefig(osp.join(folder, name + '.png'), transparent=True) def plot(self, name='map', folder='.', title='', angle=0): ''' Plots the world globe. ''' self.set_figure() self.plot_globe(angle) self.savefig(name, folder, title)
36.631111
111
0.473065
4b17b051f3187df2daa4e97e42b6ba22e41b2320
322
py
Python
base/models/provider.py
musicmash/notify
0f1c72207979e812c6485238da32ca7f5b463859
[ "MIT" ]
null
null
null
base/models/provider.py
musicmash/notify
0f1c72207979e812c6485238da32ca7f5b463859
[ "MIT" ]
86
2020-07-13T11:14:24.000Z
2022-03-25T01:10:30.000Z
base/models/provider.py
musicmash/notify
0f1c72207979e812c6485238da32ca7f5b463859
[ "MIT" ]
null
null
null
from django.db import models from .base import BaseModel
18.941176
60
0.673913
4b188ae0e512d9c128c010ae409e8f80e9a5b8ee
6,753
py
Python
preprocess/weixin_prepare.py
xuyuandong/sequence_behavior_ctr_model
e1bb71b4579456b1c6fbf3b432a84a3cb52611b7
[ "MIT" ]
4
2020-01-08T13:39:59.000Z
2021-09-21T08:13:44.000Z
preprocess/weixin_prepare.py
xuyuandong/sequence_behavior_ctr_model
e1bb71b4579456b1c6fbf3b432a84a3cb52611b7
[ "MIT" ]
null
null
null
preprocess/weixin_prepare.py
xuyuandong/sequence_behavior_ctr_model
e1bb71b4579456b1c6fbf3b432a84a3cb52611b7
[ "MIT" ]
3
2020-01-09T02:45:14.000Z
2021-09-21T08:13:59.000Z
import random import numpy as np import cPickle as pkl Train_handle = open("./data/weixin_data/weixin_train.txt",'w') Test_handle = open("./data/weixin_data/weixin_test.txt",'w') Feature_handle = open("./data/weixin_data/weixin_feature.pkl",'w') max_len = 50 if __name__ == "__main__": train_sample_list, test_sample_list = generate_sample_list() produce_neg_item_hist_with_cate(train_sample_list, test_sample_list)
37.726257
147
0.568192
4b1897d255b0413c9d4325f9c12538b29485ce83
2,197
py
Python
chapter15/cache_aside/populate_db.py
JoeanAmiee/Mastering-Python-Design-Patterns-Second-Edition
89c55dcf5e1e0e730dde593b487050f360371932
[ "MIT" ]
278
2018-08-16T12:59:24.000Z
2022-03-21T08:21:11.000Z
chapter15/cache_aside/populate_db.py
50611/Mastering-Python-Design-Patterns-Second-Edition
6efc4a935f15d2aa6c840131f72fb8c53a493a93
[ "MIT" ]
4
2019-05-16T11:44:45.000Z
2022-02-04T07:24:47.000Z
chapter15/cache_aside/populate_db.py
50611/Mastering-Python-Design-Patterns-Second-Edition
6efc4a935f15d2aa6c840131f72fb8c53a493a93
[ "MIT" ]
166
2018-08-13T21:47:16.000Z
2022-03-18T12:20:31.000Z
import sys import sqlite3 import csv from random import randint from faker import Faker fake = Faker() if __name__ == "__main__": main()
25.252874
86
0.522531
4b1a17df754eb85c581497a16047422be041c22f
523
py
Python
amulet/world_interface/chunk/interfaces/leveldb/leveldb_13/leveldb_13_interface.py
Podshot/Amulet-Core
678a722daa5e4487d193a7e947ccceacac325fd2
[ "MIT" ]
null
null
null
amulet/world_interface/chunk/interfaces/leveldb/leveldb_13/leveldb_13_interface.py
Podshot/Amulet-Core
678a722daa5e4487d193a7e947ccceacac325fd2
[ "MIT" ]
null
null
null
amulet/world_interface/chunk/interfaces/leveldb/leveldb_13/leveldb_13_interface.py
Podshot/Amulet-Core
678a722daa5e4487d193a7e947ccceacac325fd2
[ "MIT" ]
null
null
null
from __future__ import annotations from amulet.world_interface.chunk.interfaces.leveldb.leveldb_12.leveldb_12_interface import ( LevelDB12Interface, ) INTERFACE_CLASS = LevelDB13Interface
21.791667
93
0.6826
4b1b507d5e7bd884f752c61b8ba7c52263c2268a
921
py
Python
oarepo_model_builder/builders/jsonschema_builder.py
mesemus/oarepo-model-builder
3dd9cc3db887c67f7b58281faae65c8162b0651e
[ "MIT" ]
null
null
null
oarepo_model_builder/builders/jsonschema_builder.py
mesemus/oarepo-model-builder
3dd9cc3db887c67f7b58281faae65c8162b0651e
[ "MIT" ]
null
null
null
oarepo_model_builder/builders/jsonschema_builder.py
mesemus/oarepo-model-builder
3dd9cc3db887c67f7b58281faae65c8162b0651e
[ "MIT" ]
null
null
null
from oarepo_model_builder.builders.json import JSONBuilder from oarepo_model_builder.output import JsonSchemaOutput
32.892857
73
0.587405
4b1d49f6efb27ace41851af3af43454783b205c7
399
py
Python
solutions/level0_tasks.py
sksuzuki/How-to-Learn-to-Code
347943dbd2a3d176f3459c2e9f18cba1bdf78597
[ "MIT" ]
null
null
null
solutions/level0_tasks.py
sksuzuki/How-to-Learn-to-Code
347943dbd2a3d176f3459c2e9f18cba1bdf78597
[ "MIT" ]
3
2019-06-06T21:11:41.000Z
2019-06-06T21:12:37.000Z
solutions/level0_tasks.py
sksuzuki/How-to-Learn-to-Code
347943dbd2a3d176f3459c2e9f18cba1bdf78597
[ "MIT" ]
null
null
null
import numpy as np def square(x): """Square a number""" return x ** 2 def volume_converter(volume, unit): """Convert certain SI volumes to mLs""" conversions = {'mL': 1E-3, 'uL': 1E-6, 'nL': 1E-9, 'kL': 1E3} return round(volume * conversions[unit], 10) def squared_sum(in_list): """Finds the sum of squares of a list of numbers.""" return np.sum(np.array(in_list)**2)
26.6
65
0.629073
4b1e6350105907d7f3eb0e342a99233ff398a655
10,305
py
Python
benchmark/automated_agents_selenium/exatag_labels_agent.py
MedTAG/medtag-core
f2dae7b38230179d71babede7e4910631d91053f
[ "MIT" ]
6
2021-12-20T12:15:17.000Z
2022-02-02T15:28:42.000Z
benchmark/automated_agents_selenium/exatag_labels_agent.py
MedTAG/medtag-core
f2dae7b38230179d71babede7e4910631d91053f
[ "MIT" ]
1
2022-03-07T14:57:44.000Z
2022-03-11T18:11:55.000Z
benchmark/automated_agents_selenium/exatag_labels_agent.py
MedTAG/medtag-core
f2dae7b38230179d71babede7e4910631d91053f
[ "MIT" ]
2
2021-05-29T09:44:38.000Z
2021-12-28T03:53:40.000Z
from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import psycopg2 import time import statistics from selenium.webdriver.support.select import Select import json # except (Exception, psycopg2.Error) as e: # print(e) # # # finally: # # closing database connection. # if (connection): # cursor.close() # connection.close() if __name__ == '__main__': exec_path = "" # INSERT HERE THE PATH TO THE DRIVER driver = webdriver.Chrome(executable_path=exec_path) data = [] timer = 0 try: c = 0 log_in = login(driver) if log_in: while c < 40: time.sleep(2) print(str(c)) # connection = psycopg2.connect(dbname="groundtruthdb", user="ims", password="grace.period", host="localhost", # port="5444") # # cursor = connection.cursor() # cursor.execute('SELECT COUNT(*) FROM associate where username = %s;',['selenium_test']) # ans = cursor.fetchone()[0] # if(ans == 100): # cursor.execute('DELETE FROM associate where username = %s;',['selenium_test']) # connection.commit() # # cursor.execute('SELECT COUNT(*) FROM ground_truth_log_file where username = %s AND gt_type = %s;',['selenium_test','labels']) # ans = cursor.fetchone()[0] # if(ans == 100): # cursor.execute('DELETE FROM ground_truth_log_file where username = %s and gt_type = %s;',['selenium_test','labels']) # connection.commit() if c > 0: driver.refresh() ele1 = WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.XPATH, '//button[text()="Labels"]')) ) ele1.click() timer_1 = exatag_lab_test(driver) data.append(timer_1) print(str(timer_1)) if(type(timer_1) == 'str'): break else: timer = timer + timer_1 c = c+1 except (Exception, psycopg2.Error) as e: print(e) finally: # closing database connection. # if (connection): # cursor.close() # connection.close() print(timer) std = statistics.stdev(data) print(str(std))
35.78125
147
0.450849
4b1ec72cd59cc0bdeabf8053a9474d679e3c099c
963
py
Python
src/main/tools/dbpy/FotechUtils/dbUtils.py
inqwell/inq
31ce4cd6b9b123b1ec4462905ccbcf7c00d6efc3
[ "BSD-3-Clause" ]
1
2016-09-25T16:41:57.000Z
2016-09-25T16:41:57.000Z
src/main/tools/dbpy/FotechUtils/dbUtils.py
inqwell/inq
31ce4cd6b9b123b1ec4462905ccbcf7c00d6efc3
[ "BSD-3-Clause" ]
null
null
null
src/main/tools/dbpy/FotechUtils/dbUtils.py
inqwell/inq
31ce4cd6b9b123b1ec4462905ccbcf7c00d6efc3
[ "BSD-3-Clause" ]
2
2016-09-25T16:48:49.000Z
2020-05-26T20:00:33.000Z
# # $Header: /home/inqwell/cvsroot/dev/scripts/python/FotechUtils/dbUtils.py,v 1.1 2009/05/22 22:16:32 sanderst Exp $ # import KBC.fotech from Util import db from dbConfig import configurationProvider def getConnection( confile, system, level, access = "read", site = None, user = None, pwdfile = None ): """ Partial replacement for the db.py mess in cbtech/python2.5. You should use /prod/fotech/bin/generateDatabaseXml.py to generate an xml file containing your system/level config from the old db.py. Then replace any call to db.getConnection with dbUtils.getConnection and you should get back the same object that you would have got in the old strategy. """ config = configurationProvider( confile, pwdfile ) vendor, server, user, password, schema, host, port = config.getConnectionDetails( system, level, access, site, user ) return db._getConnection( vendor.upper(), server, schema, user, password )
45.857143
129
0.726895
4b1ec74bf2a93ae529c6f9b679c345029b8413cf
1,517
py
Python
randgenuntil.py
i-can-not-program/randgenuntil
cec853bc0c0a6589d60e1c6e3064e273e6278e0f
[ "Unlicense" ]
1
2021-09-09T12:03:57.000Z
2021-09-09T12:03:57.000Z
randgenuntil.py
i-can-not-program/randgenuntil
cec853bc0c0a6589d60e1c6e3064e273e6278e0f
[ "Unlicense" ]
null
null
null
randgenuntil.py
i-can-not-program/randgenuntil
cec853bc0c0a6589d60e1c6e3064e273e6278e0f
[ "Unlicense" ]
null
null
null
#!/usr/bin/env python3 import random import argparse import sys parser = argparse.ArgumentParser() parser.add_argument("number", help="Generate a random numbers until they are equal to this.", type=int) parser.add_argument("-s", "--start", type=int, default=0, help="The range in which the random numbers are in starts with this number. (default 0)") parser.add_argument("-e", "--end", type=int, default=32767, help="The range in which the random numbers are in ends with this number. (default 32767)") parser.add_argument("-c", "--count", help="Counts the amount of tries it takes to get to the number.", action="store_true") parser.add_argument("-n", "--newline", help="Adds a newline between random numbers.", action="store_true") args = parser.parse_args() if args.start > args.end: error("error: start is greater than end") if args.number > args.end or args.number < args.start: error("error: number is either greater than end or less than start") end = "\n" if args.newline else "\r" rand_num = '' tries = 0 args.end += 1 while rand_num != args.number: width = len(str(rand_num)) rand_num = random.randrange(args.start, args.end) print("{rand_num: <{width}}".format(rand_num=rand_num, width=width), end=end) tries += 1 if args.count: print("{} tries to get to {}".format(tries, args.number)) elif end == "\r": print()
35.27907
111
0.652604
4b1fa47c925f46978fe64a19c7b80b111b447a75
2,798
py
Python
gopredict/modelo.py
ajalba/gopredict
bfcb1c4c10b6787da10c7515ae2adf65252bb8c6
[ "MIT" ]
null
null
null
gopredict/modelo.py
ajalba/gopredict
bfcb1c4c10b6787da10c7515ae2adf65252bb8c6
[ "MIT" ]
39
2021-10-31T16:51:39.000Z
2021-11-22T09:56:04.000Z
gopredict/modelo.py
ajalba/gopredict
bfcb1c4c10b6787da10c7515ae2adf65252bb8c6
[ "MIT" ]
null
null
null
""" Clase para representar a los diferentes modelos y su comportamiento atributos(de momento) df=dataframe de entrenamiento proviniente del conjunto de datos de entrenamiento del usuario x_train,x_test,y_train,y_test, particiones de df para entrenar el modelo El resto de mtodos son autoexplicativos """ from numpy import array from pandas.core.frame import DataFrame import pandas as pd from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression from sklearn import metrics
36.337662
92
0.686919
4b21181e3a74fe5a1a2c9a5d58470698abe2c63a
10,698
py
Python
python/cvi_toolkit/numpy_helper/tensor_compare.py
sophgo/tpu_compiler
6299ea0a3adae1e5c206bcb9bedf225d16e636db
[ "Apache-2.0" ]
3
2022-03-14T11:47:20.000Z
2022-03-16T01:45:37.000Z
python/cvi_toolkit/numpy_helper/tensor_compare.py
sophgo/tpu_compiler
6299ea0a3adae1e5c206bcb9bedf225d16e636db
[ "Apache-2.0" ]
null
null
null
python/cvi_toolkit/numpy_helper/tensor_compare.py
sophgo/tpu_compiler
6299ea0a3adae1e5c206bcb9bedf225d16e636db
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python3 import numpy as np import sys import struct # from math import fabs from enum import IntEnum from scipy import spatial from math import * from collections import OrderedDict
37.405594
102
0.623294
4b239e38be546f3cf138ae920d55ac95f83dd8aa
4,508
py
Python
src/cleaners.py
RellikDog/dota2-win-predictor-v2
2751093d988830296ab0408a820e52bd7fd963b0
[ "MIT" ]
1
2020-06-12T00:27:45.000Z
2020-06-12T00:27:45.000Z
src/cleaners.py
RellikDog/dota2-win-predictor-v2
2751093d988830296ab0408a820e52bd7fd963b0
[ "MIT" ]
null
null
null
src/cleaners.py
RellikDog/dota2-win-predictor-v2
2751093d988830296ab0408a820e52bd7fd963b0
[ "MIT" ]
null
null
null
from src.eda import make_counter import pandas as pd import numpy as np from src.heroes import heroes, name_id, id_name def id_list_from_history(data): ''' Takes raw data returnd by api_calls.get_match_history() and returns a list of just the match ID's Input: data(list): list of match objects Output: List of integers each representing a unique match id ''' return [int(i['match_id']) for i in data] def clean_match_details(match): ''' Takes raw data from api_calls.get_match_details() and returns a dictionary with the pertinent details Input: match(dict): Return of the api.steampowers api Dict with one key-Val pair result is a dictionary with the match information Output: out(dict): Dictionary of pertinent data: radiant_win(bool): Team that won match_date(timestamp): When the match was played radiant_hero_ids(list of ints): List of hero Ids for the radiant team dire_hero_ids(list of ints): List of hero Ids for the dire team ''' data = match['result'] out = {} out['_id'] = data['match_id'] out['radiant_win'] = int(data['radiant_win']) out['match_date'] = data['start_time'] out['radiant_hero_ids'] = [] out['dire_hero_ids'] = [] for player in data['players']: if player['player_slot'] < 128: out['radiant_hero_ids'] += [player['hero_id']] else: out['dire_hero_ids'] += [player['hero_id']] return out def make_csv(counter, counter_data): ''' Takes in a premade coutner using make_counter from eda.py and the data used to amke the counter and produces a CSV. Input: counter(Counter): Counter from all the DB data - used to generate unique columns counter_data(mongo cursor list): return of .find() on the raw collection Output: None: Creates a csv file in the same directory as run ''' #remove count column so keys includes only hero ids del counter['count'] uids = sorted(counter.keys()) uid_cols = [] #add a column for each hero fro each team for i in uids: uid_cols += [(str(i)+'R')] uid_cols += [(str(i)+'D')] #add the initial 3 columns and combine with hero id columns columns = ['match_id', 'match_date', 'radiant_win'] columns += uid_cols #create a template for each row row_template = {col: 0 for col in columns} rows_list = [] #for each match format a row and add to list for match in counter_data: temp_row = row_template.copy() temp_row['match_id'] = match['_id'] temp_row['match_date'] = match['match_date'] temp_row['radiant_win'] = match['radiant_win'] for indx, hid in enumerate(match['radiant_hero_ids']): temp_row[(str(hid)+'R')] = 1 temp_row[(str(match['dire_hero_ids'][indx])+'D')] = 1 rows_list += [temp_row] #use rows to create dataframe and print to csv df = pd.DataFrame(rows_list) df.to_csv('test.csv') def make_pred_row(df, rad, dire): ''' Makes a row for predicitons to be made on Input: df(dataframe): Read this is from test.csv - used to generate columns rad(list): List of hero names recived from the front end for readiant team dire(list): List of hero names recived from the front end for dire team Output: pred_row(pandas dataframe): Converts heros names to IDs then adds ones to the DF in the appropriate slotfor their team ''' #drop unnessacary columns drop_cols = ['Unnamed: 0', 'match_id', 'match_date', 'Unnamed: 1', 'radiant_win'] for i in drop_cols: try: df.pop(i) except: continue #make blank row pred_row = pd.DataFrame([np.zeros(len(df.columns))], columns=df.columns) #fill in row for indx, hero in enumerate(rad): #get radiant hero id - insert to pred row with R rhid = name_id(hero) pred_row[str(rhid)+'R'] = 1.0 #get radiant hero id - insert to pred row with D dhid = name_id(dire[indx]) pred_row[str(dhid)+'D'] = 1.0 return pred_row
32.905109
119
0.590949
4b26f2f9d05f6e347a28ccd82f8bc4ee81785946
808
py
Python
essEcommerce/views.py
AymanTareq/cit_ecommerce
7a000f9f9ed76af99ec3c5a5faa1dbde8b988370
[ "CC0-1.0" ]
null
null
null
essEcommerce/views.py
AymanTareq/cit_ecommerce
7a000f9f9ed76af99ec3c5a5faa1dbde8b988370
[ "CC0-1.0" ]
null
null
null
essEcommerce/views.py
AymanTareq/cit_ecommerce
7a000f9f9ed76af99ec3c5a5faa1dbde8b988370
[ "CC0-1.0" ]
null
null
null
from django.shortcuts import render from .models import *
26.064516
85
0.634901
4b27ad25bbde1311e3d80132c3a579efdb94319b
431
py
Python
HowloserUare/api/serializers.py
HowloserUare/HowloserUare-api
c5f8a111f1c4bacba8d0932d8da7ad72dd3ce5c0
[ "MIT" ]
null
null
null
HowloserUare/api/serializers.py
HowloserUare/HowloserUare-api
c5f8a111f1c4bacba8d0932d8da7ad72dd3ce5c0
[ "MIT" ]
null
null
null
HowloserUare/api/serializers.py
HowloserUare/HowloserUare-api
c5f8a111f1c4bacba8d0932d8da7ad72dd3ce5c0
[ "MIT" ]
null
null
null
from rest_framework import serializers from rest_framework.validators import UniqueValidator from core.models import User
26.9375
59
0.712297
4b2885e057467c9b44c65e10af712efbc6a9cb24
74
py
Python
mogpe/__init__.py
aidanscannell/mogpe
25a9af473d73d6fa35bd060bee0eb2c372b995e5
[ "Apache-2.0" ]
11
2021-04-01T02:40:21.000Z
2022-01-31T16:14:44.000Z
mogpe/__init__.py
aidanscannell/mogpe
25a9af473d73d6fa35bd060bee0eb2c372b995e5
[ "Apache-2.0" ]
null
null
null
mogpe/__init__.py
aidanscannell/mogpe
25a9af473d73d6fa35bd060bee0eb2c372b995e5
[ "Apache-2.0" ]
3
2021-04-04T02:45:34.000Z
2021-11-22T23:48:28.000Z
from . import experts, gating_networks, gps, mixture_of_experts, training
37
73
0.824324
4b29c7bf6ebe9ba8c28605961385ea51d3e8eaf4
49
py
Python
pynfldata/coaches_data/__init__.py
trevorbalint/pynfldata
d27c550a5249c30cd2f32a8ad455c9c4ff623f5b
[ "MIT" ]
3
2020-09-24T17:17:28.000Z
2021-09-23T18:39:09.000Z
pynfldata/coaches_data/__init__.py
trevorbalint/pynfldata
d27c550a5249c30cd2f32a8ad455c9c4ff623f5b
[ "MIT" ]
5
2019-10-29T00:31:22.000Z
2020-01-12T12:35:52.000Z
pynfldata/coaches_data/__init__.py
tabalint/pynfldata
d27c550a5249c30cd2f32a8ad455c9c4ff623f5b
[ "MIT" ]
null
null
null
from pynfldata.coaches_data import coaches_parser
49
49
0.918367
4b2a94692c84f7c38268202ef3957322166618de
991
py
Python
tensorflow_v2/dragen1860/ch10/bn_main.py
gottaegbert/penter
8cbb6be3c4bf67c7c69fa70e597bfbc3be4f0a2d
[ "MIT" ]
13
2020-01-04T07:37:38.000Z
2021-08-31T05:19:58.000Z
tensorflow_v2/dragen1860/ch10/bn_main.py
gottaegbert/penter
8cbb6be3c4bf67c7c69fa70e597bfbc3be4f0a2d
[ "MIT" ]
3
2020-06-05T22:42:53.000Z
2020-08-24T07:18:54.000Z
tensorflow_v2/dragen1860/ch10/bn_main.py
gottaegbert/penter
8cbb6be3c4bf67c7c69fa70e597bfbc3be4f0a2d
[ "MIT" ]
9
2020-10-19T04:53:06.000Z
2021-08-31T05:20:01.000Z
import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers, optimizers # BatchNorm # 2 images with 4x4 size, 3 channels # we explicitly enforce the mean and stddev to N(1, 0.5) x = tf.random.normal([2, 4, 4, 3], mean=1.0, stddev=0.5) net = layers.BatchNormalization(axis=-1, center=True, scale=True, trainable=True) # layers.LayerNormalization out = net(x) print("forward in test mode:", net.variables) out = net(x, training=True) print("forward in train mode(1 step):", net.variables) for i in range(100): out = net(x, training=True) print("forward in train mode(100 steps):", net.variables) optimizer = optimizers.SGD(lr=1e-2) for i in range(10): with tf.GradientTape() as tape: out = net(x, training=True) loss = tf.reduce_mean(tf.pow(out, 2)) - 1 grads = tape.gradient(loss, net.trainable_variables) optimizer.apply_gradients(zip(grads, net.trainable_variables)) print("backward(10 steps):", net.variables)
30.030303
81
0.71443
4b2b18a133cf43bd4b7425912dff7947dc039608
1,001
py
Python
pytocl/main.py
moltob/pytocl
905c09e649feca8feeaef6fdecd6767d82cdb28e
[ "MIT" ]
12
2016-11-02T08:43:04.000Z
2020-05-17T11:23:32.000Z
pytocl/main.py
moltob/pytocl
905c09e649feca8feeaef6fdecd6767d82cdb28e
[ "MIT" ]
1
2020-06-08T09:48:20.000Z
2020-06-08T09:48:20.000Z
pytocl/main.py
moltob/pytocl
905c09e649feca8feeaef6fdecd6767d82cdb28e
[ "MIT" ]
3
2017-08-01T18:30:32.000Z
2018-08-04T13:10:15.000Z
"""Application entry point.""" import argparse import logging from pytocl.protocol import Client def main(): """Main entry point of application.""" parser = argparse.ArgumentParser(description='Client for TORCS racing car simulation with SCRC ' 'network server.') parser.add_argument('--hostname', help='Racing server host name.', default='localhost') parser.add_argument('--port', help='Port to connect, 3001 - 3010 for clients 1 - 10.', type=int, default=3001) parser.add_argument('-v', help='Debug log level.', action='store_true') args = parser.parse_args() # switch log level: if args.v: level = logging.DEBUG else: level = logging.INFO del args.v logging.basicConfig(level=level, format="%(asctime)s %(levelname)7s %(name)s %(message)s") # start client loop: client = Client(**args.__dict__) client.run() if __name__ == '__main__': main()
30.333333
100
0.622378
4b2b25ace759328c89bdd5c3d6fc4d697b6531e4
2,381
py
Python
JSMultiline.py
axilleasiv/JSMultiline
59779d4b6c444461597b105e31aa0efb0e86805c
[ "MIT" ]
6
2015-05-04T00:05:00.000Z
2016-12-09T14:40:47.000Z
JSMultiline.py
axilleasiv/JSMultiline
59779d4b6c444461597b105e31aa0efb0e86805c
[ "MIT" ]
1
2018-06-25T17:13:37.000Z
2018-06-25T17:13:37.000Z
JSMultiline.py
axilleasiv/JSMultiline
59779d4b6c444461597b105e31aa0efb0e86805c
[ "MIT" ]
null
null
null
import sublime import sublime_plugin import re import os rexLastTabs = re.compile(r'(\t+|\s+)$', re.MULTILINE) rexEmptyLines = re.compile('^[ \t]*$\r?\n', re.MULTILINE) rexCont = re.compile(r'[^\t\s].*[^\t\s]') rexFormatted = re.compile(r"((?<=\s)'|(?<=\t)')|('*\s[\+|\\|])") #https://github.com/jdc0589/JsFormat line 47 def is_js_buffer(view): fName = view.file_name() vSettings = view.settings() syntaxPath = vSettings.get('syntax') syntax = "" ext = "" if (fName != None): # file exists, pull syntax type from extension ext = os.path.splitext(fName)[1][1:] if(syntaxPath != None): syntax = os.path.splitext(syntaxPath)[0].split('/')[-1].lower() return ext in ['js', 'json'] or "javascript" in syntax or "json" in syntax
28.345238
116
0.639227