hexsha
stringlengths
40
40
size
int64
5
2.06M
ext
stringclasses
11 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
3
251
max_stars_repo_name
stringlengths
4
130
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
listlengths
1
10
max_stars_count
int64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
3
251
max_issues_repo_name
stringlengths
4
130
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
listlengths
1
10
max_issues_count
int64
1
116k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
251
max_forks_repo_name
stringlengths
4
130
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
listlengths
1
10
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
1
1.05M
avg_line_length
float64
1
1.02M
max_line_length
int64
3
1.04M
alphanum_fraction
float64
0
1
bb835887638d97fd49e95038db89b9f00019f7b3
1,343
py
Python
setup.py
wo0dyn/django-basic-models-behaviors
19bbd09630c38451c89f32d38023053b23995db9
[ "BSD-3-Clause" ]
2
2016-07-14T00:29:59.000Z
2016-07-18T02:55:35.000Z
setup.py
wo0dyn/django-basic-models-behaviors
19bbd09630c38451c89f32d38023053b23995db9
[ "BSD-3-Clause" ]
5
2015-07-02T07:42:10.000Z
2020-06-05T16:54:04.000Z
setup.py
wo0dyn/django-basic-models-behaviors
19bbd09630c38451c89f32d38023053b23995db9
[ "BSD-3-Clause" ]
1
2015-10-20T10:11:35.000Z
2015-10-20T10:11:35.000Z
# -*- coding: utf-8 -*- import codecs import os from setuptools import setup setup( name='django-basic-models-behaviors', version=__import__('basic_models_behaviors').__version__, description='Tiny app to provide basic behaviors for django models.', long_description=read('README.rst'), author='Nicolas Dubois', author_email='nicolas.c.dubois@gmail.com', url='https://github.com/wo0dyn/django-basic-models-behaviors', keywords="django", packages=['basic_models_behaviors'], include_package_data=True, zip_safe=False, license='MIT License', platforms=['any'], classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Web Environment', 'Framework :: Django', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', ] )
31.97619
96
0.638124
bb84b60c8bd64fa0c7fda5ba539335cf5ce1fc5a
10,746
py
Python
plistutils/nskeyedarchiver.py
sathwikv143/plistutils
fc7783449da1ed222547ceb5c416402216fa9b34
[ "BSD-3-Clause" ]
35
2017-10-17T17:24:16.000Z
2022-03-18T22:10:47.000Z
plistutils/nskeyedarchiver.py
sathwikv143/plistutils
fc7783449da1ed222547ceb5c416402216fa9b34
[ "BSD-3-Clause" ]
1
2021-07-09T01:06:30.000Z
2021-07-09T01:06:30.000Z
plistutils/nskeyedarchiver.py
sathwikv143/plistutils
fc7783449da1ed222547ceb5c416402216fa9b34
[ "BSD-3-Clause" ]
4
2018-11-17T15:52:36.000Z
2022-02-28T08:01:14.000Z
import logging from uuid import UUID from biplist import Data, Uid from plistutils.utils import parse_mac_absolute_time logger = logging.getLogger(__name__)
45.72766
170
0.622557
bb85cd6b9000d3cdaff7738f7a55a4fc05c3ab98
89
py
Python
guillotina_volto/blocks/__init__.py
enfold/guillotina-volto
d38ee300470c813c99341eaeb2ba8a2b5fb7d778
[ "BSD-2-Clause" ]
5
2018-11-11T07:19:06.000Z
2020-01-18T11:04:15.000Z
guillotina_volto/blocks/__init__.py
enfold/guillotina-volto
d38ee300470c813c99341eaeb2ba8a2b5fb7d778
[ "BSD-2-Clause" ]
4
2021-05-14T20:21:03.000Z
2021-11-18T01:27:04.000Z
guillotina_volto/blocks/__init__.py
enfold/guillotina-volto
d38ee300470c813c99341eaeb2ba8a2b5fb7d778
[ "BSD-2-Clause" ]
2
2019-06-14T10:42:22.000Z
2020-05-09T13:09:09.000Z
from . import default # noqa from . import types # noqa from . import standard # noqa
22.25
30
0.696629
bb86c442b96d2055b1909d4bb39b8d492cac5efe
1,131
py
Python
plotdotroot/plotdot/svgDraw/transform.py
hodeld/axidraw
b5009779d01f209b7fe712a92aa9c117ce32f70a
[ "MIT" ]
1
2020-07-28T15:09:57.000Z
2020-07-28T15:09:57.000Z
plotdotroot/plotdot/svgDraw/transform.py
hodeld/axidraw
b5009779d01f209b7fe712a92aa9c117ce32f70a
[ "MIT" ]
4
2021-04-08T21:33:10.000Z
2021-09-22T19:29:10.000Z
plotdotroot/plotdot/svgDraw/transform.py
hodeld/axidraw
b5009779d01f209b7fe712a92aa9c117ce32f70a
[ "MIT" ]
1
2022-03-18T18:07:27.000Z
2022-03-18T18:07:27.000Z
import random _TRANSF_FN = {1: scale, 2: translate, 3: skew_x, 4: skew_y, 5: rotate, } _SCALE_TRANS = {1: (1, 1)}
17.952381
57
0.568523
bb87fa54ef182344fda1ae0ba9713c3ff055e11e
9,337
py
Python
Tools/Builder/build.py
hung0913208/Base
420b4ce8e08f9624b4e884039218ffd233b88335
[ "BSD-3-Clause" ]
null
null
null
Tools/Builder/build.py
hung0913208/Base
420b4ce8e08f9624b4e884039218ffd233b88335
[ "BSD-3-Clause" ]
null
null
null
Tools/Builder/build.py
hung0913208/Base
420b4ce8e08f9624b4e884039218ffd233b88335
[ "BSD-3-Clause" ]
2
2020-11-04T08:00:37.000Z
2020-11-06T08:33:33.000Z
#!/usr/bin/python3 # # Project: build # Description: this is a very simple build tool which imitates from Bazel # import subprocess import argparse import shutil import glob import sys import os from core import * from languages import * from plugins import * def parse(): parser = argparse.ArgumentParser() parser.add_argument('--rebuild', type=int, default=1, help='build everything from scratch') parser.add_argument('--silence', type=int, default=0, help='make Builder more quieted') parser.add_argument('--root', type=str, default=os.getcwd(), help='where project is defined') parser.add_argument('--debug', type=int, default=0, help='enable debug info') parser.add_argument('--stacktrace', type=str, default=None, help='enable stacktrace info') parser.add_argument('--use_package_management', type=int, default=1, help='enable using package management') parser.add_argument('--auto_update_packages', type=int, default=0, help='enable auto update packages') parser.add_argument('--on_serving', type=int, default=0, help='use Builder on serving mode when they receive ' 'tasks from afar') parser.add_argument('--mode', type=int, default=0, help='select mode of this process if on_serving is on') return parser.parse_args() if __name__ == '__main__': flags = parse() if flags.debug != 0 and flags.silence == 0: # @NOTE: by default we only use showing stacktrace if flag debug is on Logger.set_level(DEBUG) if not flags.stacktrace is None: if flags.stacktrace.lower() == 'debug': Logger.set_stacktrace(DEBUG) elif flags.stacktrace.lower() == 'warning': Logger.set_stacktrace(WARN) elif flags.stacktrace.lower() == 'error': Logger.set_stacktrace(FATAL) Logger.silence(flags.silence == 1) if flags.on_serving == 0: builder = Build(flags.root, auto_update_packages=flags.auto_update_packages==1, use_package_management=flags.use_package_management==1, silence=(flags.silence == 1), rebuild=(flags.rebuild == 1)) code = 255 if builder.prepare() is False: Logger.debug('prepare fail -> exit with code 255') elif builder.analyze() is False: Logger.debug('build fail -> exit with code 255') elif builder.build() is False: Logger.debug('build fail -> exit with code 255') else: code = 0 builder.release() sys.exit(code) else: recepter = Serving(root=flags.root, auto_update_packages=flags.auto_update_packages==1, use_package_management=flags.use_package_management==1, silence=(flags.silence == 1)) sys.exit(255 if recepter.error is True else 0)
34.076642
100
0.543108
bb8aaea1d863f144dd7a710dd878ed727beb22e5
414
py
Python
label.py
dotrungkien/face_recognition
52c552c4f73850e62db88d0dc7271d73e4150180
[ "MIT" ]
null
null
null
label.py
dotrungkien/face_recognition
52c552c4f73850e62db88d0dc7271d73e4150180
[ "MIT" ]
null
null
null
label.py
dotrungkien/face_recognition
52c552c4f73850e62db88d0dc7271d73e4150180
[ "MIT" ]
null
null
null
import cv2 import sys import numpy as np from scipy.io import loadmat if __name__ == '__main__': convert()
21.789474
61
0.673913
bb8abe691f8096772a0b83004f7d364cbc981a7d
154
py
Python
app/helper_functions.py
shane-kercheval/dash-ml-explorer
c1664d733e037b7e00b918b5bbdbd0b7cbdc3c2d
[ "Apache-2.0" ]
null
null
null
app/helper_functions.py
shane-kercheval/dash-ml-explorer
c1664d733e037b7e00b918b5bbdbd0b7cbdc3c2d
[ "Apache-2.0" ]
null
null
null
app/helper_functions.py
shane-kercheval/dash-ml-explorer
c1664d733e037b7e00b918b5bbdbd0b7cbdc3c2d
[ "Apache-2.0" ]
null
null
null
import yaml
17.111111
42
0.675325
bb8d90bc55457ae6e3a765f4679f3b20738e394c
581
py
Python
leetcode/medium/single-number-ii.py
rainzhop/cumulus-tank
09ebc7858ea53630e30606945adfea856a80faa3
[ "MIT" ]
null
null
null
leetcode/medium/single-number-ii.py
rainzhop/cumulus-tank
09ebc7858ea53630e30606945adfea856a80faa3
[ "MIT" ]
null
null
null
leetcode/medium/single-number-ii.py
rainzhop/cumulus-tank
09ebc7858ea53630e30606945adfea856a80faa3
[ "MIT" ]
null
null
null
# https://leetcode.com/problems/single-number-ii/ # # Given an array of integers, every element appears three times except for one. Find that single one. # # Note: # Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
27.666667
108
0.562823
bb8db06160aa8c394dde6ee5900fec9ece4ddde7
5,347
py
Python
wiki/test/test_wikisection.py
IgalMilman/DnDHelper
334822a489e7dc2b5ae17230e5c068b89c6c5d10
[ "MIT" ]
null
null
null
wiki/test/test_wikisection.py
IgalMilman/DnDHelper
334822a489e7dc2b5ae17230e5c068b89c6c5d10
[ "MIT" ]
null
null
null
wiki/test/test_wikisection.py
IgalMilman/DnDHelper
334822a489e7dc2b5ae17230e5c068b89c6c5d10
[ "MIT" ]
null
null
null
import os import uuid from datetime import datetime import mock import pytz from django.conf import settings from django.contrib.auth.models import User from django.test import TestCase from django.urls import reverse from utils.widget import quill from wiki.models import wikipage, wikisection from wiki.models.wikipage import Keywords, WikiPage from wiki.models.wikisection import WikiSection
53.47
248
0.747522
bb8dd51539cdab9536825a57382500f121007993
524
py
Python
api/applications/migrations/0046_partyonapplication_flags.py
uktrade/lite-ap
4e1a57956bd921992b4a6e2b8fbacbba5720960d
[ "MIT" ]
3
2019-05-15T09:30:39.000Z
2020-04-22T16:14:23.000Z
api/applications/migrations/0046_partyonapplication_flags.py
uktrade/lite-ap
4e1a57956bd921992b4a6e2b8fbacbba5720960d
[ "MIT" ]
85
2019-04-24T10:39:35.000Z
2022-03-21T14:52:12.000Z
api/applications/migrations/0046_partyonapplication_flags.py
uktrade/lite-ap
4e1a57956bd921992b4a6e2b8fbacbba5720960d
[ "MIT" ]
1
2021-01-17T11:12:19.000Z
2021-01-17T11:12:19.000Z
# Generated by Django 2.2.17 on 2021-01-27 14:27 from django.db import migrations, models
26.2
97
0.65458
bb8e03933f18743e4789f0bc3df9d4b4ca88a87c
2,205
py
Python
Shivarth_Project(2).py
rodincode/python
5bcc53b6103e53b37a3e40635502cbca53fec43e
[ "MIT" ]
1
2021-02-11T04:42:28.000Z
2021-02-11T04:42:28.000Z
Shivarth_Project(2).py
rodincode/python
5bcc53b6103e53b37a3e40635502cbca53fec43e
[ "MIT" ]
null
null
null
Shivarth_Project(2).py
rodincode/python
5bcc53b6103e53b37a3e40635502cbca53fec43e
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ Created on Thu Jun 20 13:26:46 2019 @author: LENOVO """ import pandas as pd filename = r"C:\Users\LENOVO\Downloads\Tweets.csv" df = pd.read_csv(filename,encoding="unicode_escape") all_data = df.drop_duplicates(keep='first', inplace=False) cleaned_data = all_data.dropna() sentences = cleaned_data['text'] y = cleaned_data['airline_sentiment'] numerical_outcomes=y.replace(["positive","negative","neutral"],[1,0,2]) import nltk nltk.download('stopwords') from nltk.corpus import stopwords eng_stops = set(stopwords.words('english')) # Create word tokens new_sentences=removing_stop_words(sentences) from sklearn.model_selection import train_test_split # imports module from package x_train, x_test, y_train, y_test = train_test_split(new_sentences, y, test_size=0.25, random_state=1000) from sklearn.feature_extraction.text import CountVectorizer #from io import StringIO vectorizer = CountVectorizer() vectorizer.fit(x_train) #docs_new_train = [ StringIO.StringIO(x) for x in x_train] #docs_new_test = [ StringIO.StringIO(x) for x in x_test] X_train = vectorizer.transform(x_train) X_test = vectorizer.transform(x_test) from sklearn.linear_model import LogisticRegression classifier = LogisticRegression() classifier.fit(X_train, y_train) score = classifier.score(X_test, y_test) print("\n Accuracy:", score) #model accuracy # ######################################################### ###Predicting the sentiment of user input ######################################################### txt = input("Enter expression: ") test_sentences = [txt] test_bag = vectorizer.transform(test_sentences) result_label = classifier.predict(test_bag) #predicting the class result_score = classifier.predict_proba(test_bag) #Probobilities of belonging to both classes # if result_label==1: print("Positive", result_score) else: print("Negative", result_score)
22.05
105
0.676644
bb8fa677b509d4b926b1c8e7fd1bc0528332c98d
909
py
Python
pinax/lms/activities/migrations/0007_migrate.py
pinax/pinax-lms-activities
e73109038e1e0a8c71cc52f278e03bf645f3a16a
[ "MIT" ]
10
2015-03-04T01:37:02.000Z
2019-06-04T04:59:44.000Z
pinax/lms/activities/migrations/0007_migrate.py
pinax/pinax-lms-activities
e73109038e1e0a8c71cc52f278e03bf645f3a16a
[ "MIT" ]
8
2016-01-16T14:58:16.000Z
2020-06-22T20:30:14.000Z
pinax/lms/activities/migrations/0007_migrate.py
pinax/pinax-lms-activities
e73109038e1e0a8c71cc52f278e03bf645f3a16a
[ "MIT" ]
4
2015-09-18T02:04:39.000Z
2020-10-14T20:10:57.000Z
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations
30.3
89
0.716172
bb929e575f401e612607d5e41db450d40dd8a099
2,430
py
Python
django-ingredient-field/dj_ingredient_field/widgets.py
makspll/django-ingredient-field
8f2067d1546a45d0c8b9c5dc551571b1f5ccf7b2
[ "MIT" ]
null
null
null
django-ingredient-field/dj_ingredient_field/widgets.py
makspll/django-ingredient-field
8f2067d1546a45d0c8b9c5dc551571b1f5ccf7b2
[ "MIT" ]
10
2021-08-29T11:21:29.000Z
2021-09-14T17:09:45.000Z
django-ingredient-field/dj_ingredient_field/widgets.py
makspll/django-ingredient-field
8f2067d1546a45d0c8b9c5dc551571b1f5ccf7b2
[ "MIT" ]
null
null
null
""" The list of ingredient choices is quite large, so this module provides lazy loaded widgets which help reducing loading times. """ from django import forms
33.287671
216
0.635802
bb93be6fbacaf91fef33d78741e67ae984dd8a0a
6,830
py
Python
pycap/ethernet.py
Blueswing/pycap
19e579ec0c362939f1c7ebe87773e24e36ccdec2
[ "MIT" ]
null
null
null
pycap/ethernet.py
Blueswing/pycap
19e579ec0c362939f1c7ebe87773e24e36ccdec2
[ "MIT" ]
null
null
null
pycap/ethernet.py
Blueswing/pycap
19e579ec0c362939f1c7ebe87773e24e36ccdec2
[ "MIT" ]
null
null
null
import struct import subprocess from abc import ABCMeta from functools import lru_cache from typing import Union, Tuple, Optional from .base import Header, Protocol from .constants import * ETH_TYPE_IP = 0x0800 ETH_TYPE_ARP = 0x0806 ETH_TYPE_RARP = 0x8035 ETH_TYPE_SNMP = 0x814c ETH_TYPE_IPV6 = 0x086dd ETH_TYPE_MPLS_UNICAST = 0x8847 ETH_TYPE_MPLS_MULTICAST = 0x8848 ETH_TYPE_PPPOE_DISCOVERY = 0x8864 ETH_TYPE_PPPOE_SESSION = 0x8864 _ETH_TYPE_MAP = { ETH_TYPE_IP: PROTOCOL_IP, ETH_TYPE_ARP: PROTOCOL_ARP, ETH_TYPE_RARP: PROTOCOL_RARP, ETH_TYPE_SNMP: PROTOCOL_SNMP, ETH_TYPE_IPV6: PROTOCOL_IPV6, ETH_TYPE_MPLS_UNICAST: PROTOCOL_MPLS, ETH_TYPE_MPLS_MULTICAST: PROTOCOL_MPLS, ETH_TYPE_PPPOE_DISCOVERY: PROTOCOL_PPPOE, ETH_TYPE_PPPOE_SESSION: PROTOCOL_PPPOE } ETH_P_ALL = 0x3 # capture all ethernet types ETH_P_NOT_SET = 0x0 # only receive _ETH_II_FMT = '>BBBBBBBBBBBBH' _ETH_802_3_FMT = '>BBBBBBBBBBBBHL' """ This packet structure describes the pseudo-header added by Linux system. +---------------------------+ | Packet type | | (2 Octets) | +---------------------------+ | ARPHRD_ type | | (2 Octets) | +---------------------------+ | Link-layer address length | | (2 Octets) | +---------------------------+ | Link-layer address | | (8 Octets) | +---------------------------+ | Protocol type | | (2 Octets) | +---------------------------+ The packet type field is in network byte order (big-endian); it contains a value that is one of: 0, if the packet was specifically sent to us by somebody else; 1, if the packet was broadcast by somebody else; 2, if the packet was multicast, but not broadcast, by somebody else; 3, if the packet was sent to somebody else by somebody else; 4, if the packet was sent by us. reference: https://www.tcpdump.org/linktypes/LINKTYPE_LINUX_SLL.html """ _LINK_LAYER_PACKET_TYPE_MAP = { 0x0: 'unicast to us', 0x1: 'boardcast to us', 0x2: 'multicast to us', 0x3: 'not sent to us', 0x4: 'sent by us' } _interfaces = None def describe_eth_type(eth_type: int): if eth_type in _ETH_TYPE_MAP: return _ETH_TYPE_MAP[eth_type] return f'Unknown {eth_type}' def describe_packet_type(packet_type: int): if packet_type in _LINK_LAYER_PACKET_TYPE_MAP: return _LINK_LAYER_PACKET_TYPE_MAP[packet_type] return f'Unknown {packet_type}'
28.22314
101
0.615959
bb949682762af25e0d9e85b1dcc96637afca8f13
60
py
Python
doc/example.py
jtpio/jupyterlab-python-bytecode
23c3d4e228829743b65685d8796cf1bc95fd88ba
[ "BSD-3-Clause" ]
58
2018-09-30T00:08:57.000Z
2022-01-15T20:54:02.000Z
doc/example.py
jtpio/jupyterlab-python-bytecode
23c3d4e228829743b65685d8796cf1bc95fd88ba
[ "BSD-3-Clause" ]
7
2018-09-30T09:55:32.000Z
2021-04-20T09:50:36.000Z
doc/example.py
jtpio/jupyterlab-python-bytecode
23c3d4e228829743b65685d8796cf1bc95fd88ba
[ "BSD-3-Clause" ]
4
2019-03-03T07:18:50.000Z
2022-02-27T01:19:12.000Z
for i in range(10): pass j = 0 while j < 10: j += 1
10
19
0.483333
bb94c39fa96235061eee688defe888eb7cca4d44
238
py
Python
utils/schedulers.py
Shawn-Guo-CN/EmergentNumerals
ef9786e5bd6c8c456143ad305742340e510f5edb
[ "MIT" ]
2
2019-08-16T21:37:55.000Z
2019-08-18T18:11:28.000Z
utils/schedulers.py
Shawn-Guo-CN/EmergentNumerals
ef9786e5bd6c8c456143ad305742340e510f5edb
[ "MIT" ]
null
null
null
utils/schedulers.py
Shawn-Guo-CN/EmergentNumerals
ef9786e5bd6c8c456143ad305742340e510f5edb
[ "MIT" ]
null
null
null
from utils.conf import args
19.833333
27
0.512605
bb94df94114e25069a2e0c94c2a3c7a8d9c17d5d
408
py
Python
pymongo_cursor_json_encoder/__init__.py
rogervila/python-mongo-json-encoder
63dfc9bbe6702c6bacca8b6aa04b17a6f6fbd918
[ "MIT" ]
1
2021-01-14T16:08:45.000Z
2021-01-14T16:08:45.000Z
pymongo_cursor_json_encoder/__init__.py
rogervila/python-mongo-json-encoder
63dfc9bbe6702c6bacca8b6aa04b17a6f6fbd918
[ "MIT" ]
null
null
null
pymongo_cursor_json_encoder/__init__.py
rogervila/python-mongo-json-encoder
63dfc9bbe6702c6bacca8b6aa04b17a6f6fbd918
[ "MIT" ]
null
null
null
from datetime import datetime, date from isodate import datetime_isoformat from bson import ObjectId from json import JSONEncoder
25.5
48
0.708333
bb965bb20b20b11f20bb0fdf749f18c3050f9707
893
py
Python
Intermediate+/57/notes/server.py
Matthew1906/100DaysOfPython
94ffff8f5535ce5d574f49c0d7971d64a4575aad
[ "MIT" ]
1
2021-12-25T02:19:18.000Z
2021-12-25T02:19:18.000Z
Intermediate+/57/notes/server.py
Matthew1906/100DaysOfPython
94ffff8f5535ce5d574f49c0d7971d64a4575aad
[ "MIT" ]
null
null
null
Intermediate+/57/notes/server.py
Matthew1906/100DaysOfPython
94ffff8f5535ce5d574f49c0d7971d64a4575aad
[ "MIT" ]
1
2021-11-25T10:31:47.000Z
2021-11-25T10:31:47.000Z
from flask import Flask, render_template import random, datetime as dt, requests app = Flask(__name__) # Jinja = templating language if __name__ == '__main__': app.run(debug=True)
37.208333
103
0.693169
bb9676589fb7e0a374aed04eb4cfbe0922559c82
3,041
py
Python
game.py
MrEliptik/game_of_life
e0ff937ac1cf1a879e20c109a69700c77db71fcc
[ "MIT" ]
null
null
null
game.py
MrEliptik/game_of_life
e0ff937ac1cf1a879e20c109a69700c77db71fcc
[ "MIT" ]
null
null
null
game.py
MrEliptik/game_of_life
e0ff937ac1cf1a879e20c109a69700c77db71fcc
[ "MIT" ]
null
null
null
import pygame import random import time import numpy as np WHITE = 255, 255, 255 BLACK = 0, 0, 0 size = width, height = 480, 320 row = 32 col = 48 cell_width = (width//col) cell_height = (height//row) font_size = 60 FPS = 30 LIVE_P_MAX = 0.5; LIVE_P_MIN = 0.01; _grid = np.full((row, col), None) screen = None refresh_start_time = 0 if __name__ == "__main__": refresh_start_time = time.time() running = True inpt = "y" screen = init_screen() random_init_grid(_grid) display(_grid) while(running): start = time.time() if ((time.time() - refresh_start_time) > 60): random_init_grid(_grid) display(_grid) refresh_start_time = time.time() for event in pygame.event.get(): if event.type == pygame.QUIT: running = False elif event.type == pygame.MOUSEBUTTONUP: random_init_grid(_grid) display(_grid) # Copy new grid _grid[:] = update_grid(_grid) display(_grid) while(time.time() - start < (1/FPS)): pass
25.771186
110
0.577442
bb9746ac2f24608c4e049924c7fcb26f2cfddb65
794
py
Python
azext_iot/monitor/models/target.py
lucadruda/azure-iot-cli-extension
9d2f677d19580f8fbac860e079550167e743a237
[ "MIT" ]
79
2017-09-25T19:29:17.000Z
2022-03-30T20:55:57.000Z
azext_iot/monitor/models/target.py
lucadruda/azure-iot-cli-extension
9d2f677d19580f8fbac860e079550167e743a237
[ "MIT" ]
305
2018-01-17T01:12:10.000Z
2022-03-23T22:38:11.000Z
azext_iot/monitor/models/target.py
lucadruda/azure-iot-cli-extension
9d2f677d19580f8fbac860e079550167e743a237
[ "MIT" ]
69
2017-11-14T00:30:46.000Z
2022-03-01T17:11:45.000Z
# coding=utf-8 # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------------------------------
33.083333
94
0.492443
bb9985f1334655b6b9bebcdea894cb35e74ef811
8,551
py
Python
py2dm/_parser/_pyparser.py
leonhard-s/Py2DM
a2c4c193dfa4494f2c9117f580f99f0dbdc579fc
[ "MIT" ]
6
2021-01-28T10:59:21.000Z
2022-03-30T08:00:06.000Z
py2dm/_parser/_pyparser.py
leonhard-s/Py2DM
a2c4c193dfa4494f2c9117f580f99f0dbdc579fc
[ "MIT" ]
7
2020-10-28T13:01:13.000Z
2022-03-08T19:21:05.000Z
py2dm/_parser/_pyparser.py
leonhard-s/Py2DM
a2c4c193dfa4494f2c9117f580f99f0dbdc579fc
[ "MIT" ]
null
null
null
"""Python implementation of the 2DM card parser.""" from typing import IO, List, Optional, Tuple, Union from ..errors import CardError, FormatError, ReadError _MetadataArgs = Tuple[ int, # num_nodes int, # num_elements int, # num_node_strings Optional[str], # name Optional[int], # num_materials_per_elem int, # nodes start int, # elements start int] # node strings start _ELEMENT_CARDS = [ 'E2L', 'E3L', 'E3T', 'E4Q', 'E6T', 'E8Q', 'E9Q' ] def parse_element(line: str, allow_float_matid: bool = True, allow_zero_index: bool = False ) -> Tuple[int, Tuple[int, ...], Tuple[Union[int, float], ...]]: """Parse a string into an element. This converts a valid element definition string into a tuple that can be used to instantiate the corresponding :class:`py2dm.Element` subclass. """ # Parse line chunks = line.split('#', maxsplit=1)[0].split() # Length (generic) if len(chunks) < 4: raise CardError('Element definitions require at least 3 fields ' f'(id, node_1, node_2), got {len(chunks)-1}') # 2DM card card = chunks[0] if not _card_is_element(card): raise CardError(f'Invalid element card "{card}"') # Length (card known) num_nodes = _nodes_per_element(card) assert num_nodes > 0 if len(chunks) < num_nodes + 2: raise CardError( f'{card} element definition requires at least {num_nodes-1} ' f'fields (id, node_1, ..., node_{num_nodes-1}), got {len(chunks)-1}') # Element ID id_ = int(chunks[1]) if id_ <= 0 and not (id_ == 0 and allow_zero_index): raise FormatError(f'Invalid element ID: {id_}') # Node IDs nodes: List[int] = [] for node_str in chunks[2:num_nodes+2]: node_id = int(node_str) if node_id < 0 and not (node_id == 0 and allow_zero_index): raise FormatError(f'Invalid node ID: {node_id}') nodes.append(node_id) # Material IDs materials: List[Union[int, float]] = [] for mat_str in chunks[num_nodes+2:]: mat_id: Union[int, float] try: mat_id = int(mat_str) except ValueError as err: if not allow_float_matid: raise err from err mat_id = float(mat_str) materials.append(mat_id) return id_, tuple(nodes), tuple(materials) def parse_node(line: str, allow_zero_index: bool = False ) -> Tuple[int, float, float, float]: """Parse a string into a node. This converts a valid node definition string into a tuple that can be used to isntantiate the corresponding :class:`py2dm.Node` object. """ # Parse line chunks = line.split('#', maxsplit=1)[0].split() # Length if len(chunks) < 5: raise CardError(f'Node definitions require at least 4 fields ' f'(id, x, y, z), got {len(chunks)-1}') # 2DM card card = chunks[0] if card != "ND": raise CardError(f'Invalid node card "{card}"') # Node ID id_ = int(chunks[1]) if id_ <= 0 and not (id_ == 0 and allow_zero_index): raise FormatError(f'Invalid node ID: {id_}') # Coordinates pos_x, pos_y, pos_z = tuple((float(s) for s in chunks[2:5])) # TODO: Warn about unused fields return id_, pos_x, pos_y, pos_z def parse_node_string(line: str, allow_zero_index: bool = False, nodes: Optional[List[int]] = None ) -> Tuple[List[int], bool, str]: """Parse a string into a node string. This converts a valid node string definition string into a tuple that can be used to instantiate the corresponding :class:`py2dm.NodeString`. As nodestring can span multiple lines, the node string should only be created once the `done` flag (second entry in the returned tuple) is set to True. """ # Set default value if nodes is None: nodes = [] # Parse line chunks = line.split('#', maxsplit=1)[0].split() # Length if len(chunks) < 2: raise CardError('Node string definitions require at least 1 field ' f'(node_id), got {len(chunks)-1}') # 2DM card card = chunks[0] if card != 'NS': raise CardError(f'Invalid node string card "{card}"') # Node IDs is_done: bool = False name = '' for index, node_str in enumerate(chunks[1:]): node_id = int(node_str) if node_id == 0 and not allow_zero_index: raise FormatError(f'Invalid node ID: {node_id}') if node_id < 0: # End of node string is_done = True nodes.append(abs(node_id)) # Check final identifier if index+2 < len(chunks): name = chunks[index+2] break nodes.append(node_id) return nodes, is_done, name
34.479839
82
0.571161
bb9b59ff879eaecfcc8190f0acec7f2068109681
1,024
py
Python
src/commands/refactor/refactor_preview.py
PranjalPansuriya/JavaScriptEnhancements
14af4162e86585153cbd4614ad96dff64a0d3192
[ "MIT" ]
690
2017-04-11T06:45:01.000Z
2022-03-21T23:20:29.000Z
src/commands/refactor/refactor_preview.py
PranjalPansuriya/JavaScriptEnhancements
14af4162e86585153cbd4614ad96dff64a0d3192
[ "MIT" ]
74
2017-11-22T18:05:26.000Z
2021-05-05T16:25:31.000Z
src/commands/refactor/refactor_preview.py
PranjalPansuriya/JavaScriptEnhancements
14af4162e86585153cbd4614ad96dff64a0d3192
[ "MIT" ]
42
2017-04-13T10:22:40.000Z
2021-05-27T19:19:04.000Z
import sublime, sublime_plugin from ...libs import util
27.675676
92
0.657227
bb9bcfeb2dd370b17ad9dca9fef16bbcfa8e0721
583
py
Python
2020/08-1.py
matteodelabre/advent-of-code
a6f51222b52f948cec6aa94cb7c50bcfd4f53dc1
[ "CC0-1.0" ]
1
2021-12-02T05:16:11.000Z
2021-12-02T05:16:11.000Z
2020/08-1.py
matteodelabre/advent-of-code
a6f51222b52f948cec6aa94cb7c50bcfd4f53dc1
[ "CC0-1.0" ]
null
null
null
2020/08-1.py
matteodelabre/advent-of-code
a6f51222b52f948cec6aa94cb7c50bcfd4f53dc1
[ "CC0-1.0" ]
null
null
null
import re instruction_regex = re.compile(r'(nop|acc|jmp) ([+-][0-9]+)') program = [] try: while True: name, arg = instruction_regex.match(input()).groups() program.append([name, arg, 0]) except EOFError: pass pc = 0 accu = 0 while program[pc][2] == 0: program[pc][2] = 1 if program[pc][0] == 'nop': pc += 1 elif program[pc][0] == 'acc': accu += int(program[pc][1]) pc += 1 elif program[pc][0] == 'jmp': pc += int(program[pc][1]) else: print('invalid instruction:', program[pc][0]) print(accu)
19.433333
61
0.535163
bb9be141e5411cc766db75440f10f9dcc54c52eb
736
py
Python
Apps/aulas/migrations/0017_alter_planejamento_data_envio_alter_resposta_data.py
arthur-asilva/rc_plataforma
7e6f7eb7f9a3b9089c02db98518b60d8e481ce4c
[ "BSD-2-Clause" ]
null
null
null
Apps/aulas/migrations/0017_alter_planejamento_data_envio_alter_resposta_data.py
arthur-asilva/rc_plataforma
7e6f7eb7f9a3b9089c02db98518b60d8e481ce4c
[ "BSD-2-Clause" ]
null
null
null
Apps/aulas/migrations/0017_alter_planejamento_data_envio_alter_resposta_data.py
arthur-asilva/rc_plataforma
7e6f7eb7f9a3b9089c02db98518b60d8e481ce4c
[ "BSD-2-Clause" ]
null
null
null
# Generated by Django 4.0 on 2022-01-14 13:45 import datetime from django.db import migrations, models
29.44
122
0.629076
bba2237b5b7c85261e503e0da56569ea8a05972a
5,018
py
Python
models/lenet.py
calinbiberea/imperial-individual-project
86f224f183b8348d21b4c7a4aed408cd1ca41df1
[ "MIT" ]
null
null
null
models/lenet.py
calinbiberea/imperial-individual-project
86f224f183b8348d21b4c7a4aed408cd1ca41df1
[ "MIT" ]
null
null
null
models/lenet.py
calinbiberea/imperial-individual-project
86f224f183b8348d21b4c7a4aed408cd1ca41df1
[ "MIT" ]
null
null
null
''' A LeNet-5 in PyTorch. Reference: Yann LeCun et al, 1998. Gradient-Based Learning Applied to Document Recognition. [Paper] Available at: <http://yann.lecun.com/exdb/publis/pdf/lecun-01a.pdf> [Accessed 26 December 2021]. ''' import torch.nn as nn import torch.nn.functional as F # Defining the Network (LeNet-5)
28.191011
86
0.559785
bba24784bd9ee9a55803728f5cef4460717a8929
7,228
py
Python
tests/env/experiments_tools_2.py
weifanjiang/CSSPy
361d18d7b9c08bcff11a18524a718b3522c48786
[ "MIT" ]
3
2018-10-04T14:00:50.000Z
2021-12-11T08:57:26.000Z
tests/env/experiments_tools_2.py
weifanjiang/CSSPy
361d18d7b9c08bcff11a18524a718b3522c48786
[ "MIT" ]
null
null
null
tests/env/experiments_tools_2.py
weifanjiang/CSSPy
361d18d7b9c08bcff11a18524a718b3522c48786
[ "MIT" ]
null
null
null
import sys sys.path.insert(0, '..') import numpy as np import pandas as pd from itertools import combinations from scipy.stats import binom import scipy.special import matplotlib.pyplot as plt import matplotlib.patches as mpatches from IPython.display import display, HTML #sys.path.append("../") from FrameBuilder.eigenstepsbuilder import * from decimal import * from copy import deepcopy import matplotlib.lines as mlines import matplotlib.transforms as mtransforms from env.numerical_analysis_dpp import *
45.175
152
0.731046
bba40b13a90f7230a2307e2b965c7e2e96ab0207
1,562
py
Python
utils/relationship_tree/population.py
rohern/attila
e876af57ee3b77144343ac3c22e798733753a23f
[ "MIT" ]
null
null
null
utils/relationship_tree/population.py
rohern/attila
e876af57ee3b77144343ac3c22e798733753a23f
[ "MIT" ]
null
null
null
utils/relationship_tree/population.py
rohern/attila
e876af57ee3b77144343ac3c22e798733753a23f
[ "MIT" ]
1
2020-02-21T20:08:43.000Z
2020-02-21T20:08:43.000Z
from person import Person
38.097561
123
0.640845
bba4b6f4a62fce3404ab57f827ef1473938bae93
348
py
Python
cmdline.py
30emeciel/freshdesk-token-exchange
3e449735c20d53061941c77443da6dc7b8ea9e24
[ "MIT" ]
null
null
null
cmdline.py
30emeciel/freshdesk-token-exchange
3e449735c20d53061941c77443da6dc7b8ea9e24
[ "MIT" ]
null
null
null
cmdline.py
30emeciel/freshdesk-token-exchange
3e449735c20d53061941c77443da6dc7b8ea9e24
[ "MIT" ]
null
null
null
if __name__ == "__main__": # export GOOGLE_APPLICATION_CREDENTIALS="trentiemeciel.json" # get the token using postman from dotenv import load_dotenv load_dotenv() import main freshdesk_token = main.convert_auth0_token_to_freshdesk_token("gtxiNvJMjuDGec7GUziM2qSupsnCu74I") print(f"freshdesk_token: {freshdesk_token}")
31.636364
101
0.767241
bba5ec5ee218ef30daab10fe172b51c78e3cf3a4
4,040
py
Python
auto_encoder.py
kredy/Keras-Projects
44c9a7b27f31a8d3eaa7b3bc7a0396d2eb0bf430
[ "MIT" ]
1
2021-06-30T13:25:35.000Z
2021-06-30T13:25:35.000Z
auto_encoder.py
kredy/Keras-Projects
44c9a7b27f31a8d3eaa7b3bc7a0396d2eb0bf430
[ "MIT" ]
null
null
null
auto_encoder.py
kredy/Keras-Projects
44c9a7b27f31a8d3eaa7b3bc7a0396d2eb0bf430
[ "MIT" ]
2
2020-08-04T01:52:55.000Z
2021-03-16T19:12:20.000Z
''' Convolutional autoencoder on MNIST dataset using Keras functional API ''' from keras.datasets import mnist from keras.models import Model from keras.layers import Activation, Input, BatchNormalization from keras.layers import Conv2D, Conv2DTranspose from keras.callbacks import TensorBoard from keras.optimizers import Adam from keras.utils import to_categorical import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np # Parameters batch_size = 128 epochs = 3 Tboard = TensorBoard(log_dir='./autoencoder_graph') # Load the MNIST data # Autoencoder if __name__ == '__main__': main()
35.438596
118
0.693069
bba73b50d8937afbf151ac7cc18f80271ca8fda7
499
py
Python
test/unit/tools/msvc/common.py
jimporter/bfg9000
c206646ecfed0d1a510e993b93e6a15677f45a14
[ "BSD-3-Clause" ]
72
2015-06-23T02:35:13.000Z
2021-12-08T01:47:40.000Z
test/unit/tools/msvc/common.py
jimporter/bfg9000
c206646ecfed0d1a510e993b93e6a15677f45a14
[ "BSD-3-Clause" ]
139
2015-03-01T18:48:17.000Z
2021-06-18T15:45:14.000Z
test/unit/tools/msvc/common.py
jimporter/bfg9000
c206646ecfed0d1a510e993b93e6a15677f45a14
[ "BSD-3-Clause" ]
19
2015-12-23T21:24:33.000Z
2022-01-06T04:04:41.000Z
from bfg9000.languages import Languages known_langs = Languages() with known_langs.make('c') as x: x.vars(compiler='CC', flags='CFLAGS') with known_langs.make('c++') as x: x.vars(compiler='CXX', flags='CXXFLAGS')
26.263158
68
0.639279
bba7b25014664dee8876feca1599b36413d6ce96
93
py
Python
Gate_bases.py
jlfly12/qrsim
1f5340cdc4f6cc0ca7ecbebd49ba8c6f78afdb8c
[ "Apache-2.0" ]
null
null
null
Gate_bases.py
jlfly12/qrsim
1f5340cdc4f6cc0ca7ecbebd49ba8c6f78afdb8c
[ "Apache-2.0" ]
null
null
null
Gate_bases.py
jlfly12/qrsim
1f5340cdc4f6cc0ca7ecbebd49ba8c6f78afdb8c
[ "Apache-2.0" ]
1
2019-06-21T17:55:00.000Z
2019-06-21T17:55:00.000Z
x = "X" y = "Y" z = "Z" xx = "XX" h = "H" cnot = "CNOT" s_phi = "S_phi" identity = "Identity"
11.625
21
0.494624
bbabb955113863d40c2a80d48e3d2cd18a7d9577
164
py
Python
flake8diff/test_flake8.py
miki725/flake8-diff
bec04390ce9263fc7957ccb7fcf39d582fa8d4ad
[ "MIT" ]
18
2015-03-10T20:05:57.000Z
2020-08-12T20:46:00.000Z
flake8diff/test_flake8.py
miki725/flake8-diff
bec04390ce9263fc7957ccb7fcf39d582fa8d4ad
[ "MIT" ]
20
2015-03-21T19:39:12.000Z
2020-05-26T15:25:33.000Z
flake8diff/test_flake8.py
miki725/flake8-diff
bec04390ce9263fc7957ccb7fcf39d582fa8d4ad
[ "MIT" ]
7
2015-03-21T19:12:31.000Z
2018-09-28T20:56:45.000Z
from unittest import TestCase from flake8diff import flake8
18.222222
35
0.737805
bbabba632a1d8ac671dc7f863d9ffae0e405f07a
1,266
py
Python
algorithm/linear-regression/gradientDescentLR.py
mk43/machine-learning
1ca1baf797fe6f593a88ad4e0d7ac7e5c24ce139
[ "Apache-2.0" ]
6
2018-02-22T00:27:44.000Z
2019-11-21T18:12:48.000Z
algorithm/linear-regression/gradientDescentLR.py
mk43/machine-learning
1ca1baf797fe6f593a88ad4e0d7ac7e5c24ce139
[ "Apache-2.0" ]
null
null
null
algorithm/linear-regression/gradientDescentLR.py
mk43/machine-learning
1ca1baf797fe6f593a88ad4e0d7ac7e5c24ce139
[ "Apache-2.0" ]
4
2018-02-19T05:59:23.000Z
2020-04-08T08:53:02.000Z
# coding: utf-8 import matplotlib.pyplot as plt import numpy as np N = 200 X = np.linspace(0, 10, N * 2) noise = np.random.normal(0, 0.5, X.shape) Y = X * 0.5 + 3 + noise Training_Times = 100 Learning_Rate = 0.002 loss = [] W_trace = [-1] b_trace = [1] gradientDescent(X, Y, W_trace[0], b_trace[0], learningrate=Learning_Rate, trainingtimes=Training_Times) print(W_trace[-1], b_trace[-1]) fig = plt.figure() plt.title(r'$loss\ function\ change\ tendency$') plt.xlabel(r'$learning\ times$') plt.ylabel(r'$loss\ value$') plt.plot(np.linspace(1, Training_Times, Training_Times), loss) plt.savefig("gradientDescentLR.png") plt.show()
26.375
103
0.661137
bbac3dea77b9a3981684ddd7952fdf41e36843fc
6,343
py
Python
lambda-email-parser/lambda_function.py
aws-samples/serverless-mail
a002dd90817c9eb2090ca0ad36114c51a0490d61
[ "MIT-0" ]
null
null
null
lambda-email-parser/lambda_function.py
aws-samples/serverless-mail
a002dd90817c9eb2090ca0ad36114c51a0490d61
[ "MIT-0" ]
null
null
null
lambda-email-parser/lambda_function.py
aws-samples/serverless-mail
a002dd90817c9eb2090ca0ad36114c51a0490d61
[ "MIT-0" ]
null
null
null
import os import boto3 import email import logging import json import re import uuid s3 = boto3.client("s3") workmail_message_flow = boto3.client('workmailmessageflow') logger = logging.getLogger()
40.922581
164
0.653003
bbadddc2fe8f7e7eaa30c11c13f2a1d11f2721db
1,757
py
Python
scripts/latency/filebench.py
huangvincent170/cyclone
737af617ab1472dfb16e6c20a079e88dccf85850
[ "Apache-2.0" ]
2
2019-04-16T01:33:36.000Z
2021-02-23T08:34:38.000Z
scripts/latency/filebench.py
huangvincent170/cyclone
737af617ab1472dfb16e6c20a079e88dccf85850
[ "Apache-2.0" ]
null
null
null
scripts/latency/filebench.py
huangvincent170/cyclone
737af617ab1472dfb16e6c20a079e88dccf85850
[ "Apache-2.0" ]
4
2020-03-27T18:06:33.000Z
2021-03-24T09:56:17.000Z
#!/usr/bin/env python import argparse import sys import os import shutil DBG = 1 __home = os.getcwd() __fbench_home = '/home/pfernando/filebench' #binary __empty = '' __micro_rread = 'micro_rread' __workload_l = [] __workload_l.append(__micro_rread) parser = argparse.ArgumentParser(prog="runscript", description="script to run filebench") parser.add_argument('-w', dest='workload', default=__empty, help='', choices=__workload_l) parser.add_argument('-io', dest='iosize', default=__empty, help='') try: args = parser.parse_args() except: sys.exit(0) if __name__ == '__main__': w = args.workload io = args.iosize if w == __micro_rread: __iosize = io msg("io size : " + io) dataobj = {"iosize": io} fb(__micro_rread,dataobj) else: sys.exit(0)
17.928571
90
0.575413
bbaeca43c2d4bafe283a3a22b25235f71d730c45
12,685
py
Python
python_modules/dagster-airflow/dagster_airflow/operators.py
jake-billings/dagster
7a1548a1f246c48189f3d8109e831b744bceb7d4
[ "Apache-2.0" ]
null
null
null
python_modules/dagster-airflow/dagster_airflow/operators.py
jake-billings/dagster
7a1548a1f246c48189f3d8109e831b744bceb7d4
[ "Apache-2.0" ]
null
null
null
python_modules/dagster-airflow/dagster_airflow/operators.py
jake-billings/dagster
7a1548a1f246c48189f3d8109e831b744bceb7d4
[ "Apache-2.0" ]
null
null
null
'''The dagster-airflow operators.''' import ast import datetime import json import logging import os from contextlib import contextmanager from airflow.exceptions import AirflowException from airflow.models import BaseOperator, SkipMixin from airflow.operators.docker_operator import DockerOperator from airflow.operators.python_operator import PythonOperator from airflow.utils.file import TemporaryDirectory from docker import APIClient, from_env from dagster import check, seven, DagsterEventType from dagster.core.events import DagsterEvent from dagster_graphql.client.mutations import execute_start_pipeline_execution_query from dagster_graphql.client.query import START_PIPELINE_EXECUTION_QUERY from .util import airflow_storage_exception, construct_variables, parse_raw_res DOCKER_TEMPDIR = '/tmp' DEFAULT_ENVIRONMENT = { 'AWS_ACCESS_KEY_ID': os.getenv('AWS_ACCESS_KEY_ID'), 'AWS_SECRET_ACCESS_KEY': os.getenv('AWS_SECRET_ACCESS_KEY'), } LINE_LENGTH = 100 def get_hook(self): if self.docker_conn_id_set: return super(DagsterDockerOperator, self).get_hook() return _DummyHook() def execute(self, context): try: from dagster_graphql.client.mutations import ( handle_start_pipeline_execution_errors, handle_start_pipeline_execution_result, ) except ImportError: raise AirflowException( 'To use the DagsterPythonOperator, dagster and dagster_graphql must be installed ' 'in your Airflow environment.' ) if 'run_id' in self.params: self._run_id = self.params['run_id'] elif 'dag_run' in context and context['dag_run'] is not None: self._run_id = context['dag_run'].run_id try: raw_res = super(DagsterDockerOperator, self).execute(context) self.log.info('Finished executing container.') res = parse_raw_res(raw_res) handle_start_pipeline_execution_errors(res) events = handle_start_pipeline_execution_result(res) self.skip_self_if_necessary(events, context['execution_date'], context['task']) return events finally: self._run_id = None # This is a class-private name on DockerOperator for no good reason -- # all that the status quo does is inhibit extension of the class. # See https://issues.apache.org/jira/browse/AIRFLOW-3880
36.346705
100
0.633662
bbaf14d78f29821d3e6ffec013b3447b60e7a43a
293
py
Python
app-receiver/receiver/service/settings.py
makaay/devops_assignment
937a0877e869c3e6ca09bad35ab869901527e492
[ "BSD-2-Clause" ]
null
null
null
app-receiver/receiver/service/settings.py
makaay/devops_assignment
937a0877e869c3e6ca09bad35ab869901527e492
[ "BSD-2-Clause" ]
null
null
null
app-receiver/receiver/service/settings.py
makaay/devops_assignment
937a0877e869c3e6ca09bad35ab869901527e492
[ "BSD-2-Clause" ]
1
2022-03-05T13:11:30.000Z
2022-03-05T13:11:30.000Z
import os """ This file contains configurations for receiver service. The configurations can be over-ridden with Environment Variables during run time. """ OUTPUT_DIR = os.getenv("OUTPUT_DIR", "/usr/src/app-receiver/output") DECRYPTION_KEY = os.getenv("DECRYPTION_KEY", "/tmp/decryption_key")
36.625
81
0.78157
bbaf9c88715d3ed6658c5b7cac9f3b5786ab4dad
908
py
Python
setup.py
patel-zeel/CGLB-1
6afab3631704ae4233e93c2de289b4e351f61838
[ "Apache-2.0" ]
5
2021-07-19T09:08:15.000Z
2022-03-21T10:19:08.000Z
setup.py
patel-zeel/CGLB-1
6afab3631704ae4233e93c2de289b4e351f61838
[ "Apache-2.0" ]
5
2021-08-30T20:24:52.000Z
2021-11-29T07:24:51.000Z
setup.py
patel-zeel/CGLB-1
6afab3631704ae4233e93c2de289b4e351f61838
[ "Apache-2.0" ]
1
2021-11-25T22:15:27.000Z
2021-11-25T22:15:27.000Z
# Copyright 2021 The CGLB Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from setuptools import setup, find_packages pkgs = find_packages() setup( name="cglb", author="Artem Artemev, David Burt", author_email="a.artemev20@imperial.ac.uk, drb62@cam.ac.uk", version="0.0.1", packages=pkgs, install_requires=["numpy", "scipy"], dependency_links=[], )
32.428571
74
0.732379
bbb379a767a5b56faec727f2a03bfb35f2d9f7df
5,361
py
Python
automation/aux_funcs.py
jaimiles23/hacker_rank
0580eac82e5d0989afabb5c2e66faf09713f891b
[ "Apache-2.0" ]
null
null
null
automation/aux_funcs.py
jaimiles23/hacker_rank
0580eac82e5d0989afabb5c2e66faf09713f891b
[ "Apache-2.0" ]
null
null
null
automation/aux_funcs.py
jaimiles23/hacker_rank
0580eac82e5d0989afabb5c2e66faf09713f891b
[ "Apache-2.0" ]
3
2021-09-22T11:06:58.000Z
2022-01-25T09:29:24.000Z
"""Collection of functions related to navigating directories """ ########## # Imports ########## import os from typing import Union from pathlib import Path from logger.select_chall import logging import constants from domains import problem_domains from git import Repo ########## # Subdomain dir_name ########## def get_subdomain_dirname(subdomain_num: int, total_subdomains: int, subdomain: str) -> str: """Returns directory name for subdirectory. Args: subdomain_num (int): Subdomain number total_subdomains (int): Total number of subdomains subdomain (str): Subdomain name. Returns: str: directory name """ logging.debug(f"Subdir info: {subdomain_num}, {total_subdomains}, {subdomain}") subdomain_num, total_subdomains = str(subdomain_num), str(total_subdomains) if total_subdomains == '1': # specific challenges, e.g., 10 days of stats subdomain_num = '' else: while len(subdomain_num) < len(total_subdomains): subdomain_num = '0' + subdomain_num subdomain_num += '_' subdir_name = subdomain_num + subdomain.strip().lower().replace(' ', '_') logging.debug(f"subdir - {subdir_name}") return subdir_name ########## # Change dir ########## def change_dir(domain_dir: str): """Changes the current working directory. Creates directory if it doesn't exist. Also creates a pre-READMEME.md file. Args: domain_dir: directory to change to. """ if not os.path.exists( domain_dir): logging.info(f"DIR - creating {domain_dir}") os.mkdir(domain_dir) logging.info(f"DIR - changing to {domain_dir}") os.chdir(domain_dir) return ########## # get dirname ########## def get_dirname(dir_path: Path) -> str: """returns directory name from windows filepath Args: dir_path (Path): path oject Returns: str: directory name """ dirname = str(dir_path.resolve()) dirname = dirname[dirname.rfind('\\') + 1:] logging.debug(f"Dirname {dirname} from {dir_path}") return dirname ########## # get_domain_dirs ########## def get_domain_dirs(home_dir: object) -> list: """Returns list of domain directories. Args: home_dir (object): Home directory Returns: list: List of domain directories """ domain_dirs = [] for d in problem_domains: domain_dir = home_dir / d.name domain_dirs.append(domain_dir) logging.debug("DIR - Domain dirs:" + '\n-'.join( [str(d) for d in domain_dirs])) return domain_dirs ########## # get_subdomain_dirs ########## def get_subdomain_dirs(domain_dir) -> list: """Returns list of subdomain dirs. Args: domain_dir ([type]): Domain directory. Returns: list: Returns list of subdomain directories. """ not_subdirs = ( '.ipynb_checkpoints' ) p = Path(domain_dir) subdirs = [] for f in p.glob('**/*'): if f.is_dir(): dir_name = get_dirname(f) logging.debug(f"Check dir - {dir_name}") if dir_name not in not_subdirs: subdirs.append(f) logging.debug("DIR - Subdomain dirs:" + '\n-'.join( [str(d) for d in subdirs])) return subdirs ########## # Challenge csv name ########## def get_chall_csv_filename(sub_dir) -> str: """Returns csv name containing challenge informatin. Args: sub_dir ([type]): sub directory name Returns: str: csv filename """ p = Path(sub_dir) for f in p.glob('**/*'): filename = str(f) if filename.endswith(".csv"): return filename raise Exception(f"No csv located in {sub_dir}") ########## # pre readme ########## def make_readme_setup(name: str, url: str): """Creates pre-readme in file.""" filename = constants.PRE_README_FILENAME if not os.path.exists( filename): with open(filename, 'w') as outfile: outfile.write(f"# {name}") outfile.write(f"\nContains solutions to [{name}]({url}).") return ########## # Make file ########## def make_file(filename: str, name: str, url: str) -> None: """Checks if file exists. If it doesn't exist, creates file.""" exists = os.path.exists(filename) logging.debug(f"{filename} - {exists}") if os.path.exists(filename): return logging.debug(f"FILE - Creating {filename}") with open(filename, 'w') as outfile: outfile.write(f"Solution to [{name}]({url})") return ########## # Update github ########## def update_github(home_dir: object, commit_msg: str) -> None: """Updates github directory. Args: home_dir (object): home dir pathlib commit_msg (str): Commit message """ repo = Repo(home_dir) repo.git.add(update = True) repo.index.commit(commit_msg) logging.debug(f"Committing: {commit_msg}") origin = repo.remote(name = 'origin') origin.push() logging.debug("Pushed to repo.") def get_solution_commit_msg(domain: Path, subdomain: Path, chall_name: str) -> str: """Returns commit message for adding solution.""" domain_name = get_dirname(domain) subdomain_name = get_dirname(subdomain) return f"Solution to {domain_name} {subdomain_name} - {chall_name}"
23.933036
92
0.610707
bbb3c58e4009e852c11d677005377bc7618636b3
2,581
py
Python
tests/examples/minlplib/ex6_2_8.py
ouyang-w-19/decogo
52546480e49776251d4d27856e18a46f40c824a1
[ "MIT" ]
2
2021-07-03T13:19:10.000Z
2022-02-06T10:48:13.000Z
tests/examples/minlplib/ex6_2_8.py
ouyang-w-19/decogo
52546480e49776251d4d27856e18a46f40c824a1
[ "MIT" ]
1
2021-07-04T14:52:14.000Z
2021-07-15T10:17:11.000Z
tests/examples/minlplib/ex6_2_8.py
ouyang-w-19/decogo
52546480e49776251d4d27856e18a46f40c824a1
[ "MIT" ]
null
null
null
# NLP written by GAMS Convert at 04/21/18 13:51:45 # # Equation counts # Total E G L N X C B # 2 2 0 0 0 0 0 0 # # Variable counts # x b i s1s s2s sc si # Total cont binary integer sos1 sos2 scont sint # 4 4 0 0 0 0 0 0 # FX 0 0 0 0 0 0 0 0 # # Nonzero counts # Total const NL DLL # 7 4 3 0 # # Reformulation has removed 1 variable and 1 equation from pyomo.environ import * model = m = ConcreteModel() m.x2 = Var(within=Reals,bounds=(1E-6,1),initialize=0.7154) m.x3 = Var(within=Reals,bounds=(1E-6,1),initialize=0.00336) m.x4 = Var(within=Reals,bounds=(1E-6,1),initialize=0.28124) m.obj = Objective(expr=log(2.4088*m.x2 + 8.8495*m.x3 + 2.0086*m.x4)*(10.4807341082197*m.x2 + 38.5043409542885*m.x3 + 8.73945638067505*m.x4) + 0.303602206615077*m.x2 - 3.98949602721008*m.x3 + 0.0423576909050935*m.x4 + 0.240734108219679*log(m.x2)*m.x2 + 2.64434095428848*log(m.x3)*m.x3 + 0.399456380675047*log( m.x4)*m.x4 - 0.240734108219679*log(2.4088*m.x2 + 8.8495*m.x3 + 2.0086*m.x4)*m.x2 - 2.64434095428848*log(2.4088*m.x2 + 8.8495*m.x3 + 2.0086*m.x4)*m.x3 - 0.399456380675047*log(2.4088 *m.x2 + 8.8495*m.x3 + 2.0086*m.x4)*m.x4 + 11.24*log(m.x2)*m.x2 + 36.86*log(m.x3)*m.x3 + 9.34*log( m.x4)*m.x4 - 11.24*log(2.248*m.x2 + 7.372*m.x3 + 1.868*m.x4)*m.x2 - 36.86*log(2.248*m.x2 + 7.372* m.x3 + 1.868*m.x4)*m.x3 - 9.34*log(2.248*m.x2 + 7.372*m.x3 + 1.868*m.x4)*m.x4 + log(2.248*m.x2 + 7.372*m.x3 + 1.868*m.x4)*(2.248*m.x2 + 7.372*m.x3 + 1.868*m.x4) + 2.248*log(m.x2)*m.x2 + 7.372* log(m.x3)*m.x3 + 1.868*log(m.x4)*m.x4 - 2.248*log(2.248*m.x2 + 5.82088173817021*m.x3 + 0.382446861901943*m.x4)*m.x2 - 7.372*log(0.972461133672523*m.x2 + 7.372*m.x3 + 1.1893141713454* m.x4)*m.x3 - 1.868*log(1.86752460515164*m.x2 + 2.61699842799583*m.x3 + 1.868*m.x4)*m.x4 - 12.7287341082197*log(m.x2)*m.x2 - 45.8763409542885*log(m.x3)*m.x3 - 10.607456380675*log(m.x4)* m.x4, sense=minimize) m.c2 = Constraint(expr= m.x2 + m.x3 + m.x4 == 1)
57.355556
120
0.484696
bbb5023852d401d52fa04fa5275d3dce5dbc5d18
3,790
py
Python
Cartwheel/lib/Python26/Lib/site-packages/OpenGL/raw/GL/NV/geometry_program4.py
MontyThibault/centre-of-mass-awareness
58778f148e65749e1dfc443043e9fc054ca3ff4d
[ "MIT" ]
null
null
null
Cartwheel/lib/Python26/Lib/site-packages/OpenGL/raw/GL/NV/geometry_program4.py
MontyThibault/centre-of-mass-awareness
58778f148e65749e1dfc443043e9fc054ca3ff4d
[ "MIT" ]
null
null
null
Cartwheel/lib/Python26/Lib/site-packages/OpenGL/raw/GL/NV/geometry_program4.py
MontyThibault/centre-of-mass-awareness
58778f148e65749e1dfc443043e9fc054ca3ff4d
[ "MIT" ]
null
null
null
'''OpenGL extension NV.geometry_program4 The official definition of this extension is available here: http://oss.sgi.com/projects/ogl-sample/registry/NV/geometry_program4.txt Automatically generated by the get_gl_extensions script, do not edit! ''' from OpenGL import platform, constants, constant, arrays from OpenGL import extensions from OpenGL.GL import glget import ctypes EXTENSION_NAME = 'GL_NV_geometry_program4' GL_LINES_ADJACENCY_EXT = constant.Constant( 'GL_LINES_ADJACENCY_EXT', 0xA ) GL_LINE_STRIP_ADJACENCY_EXT = constant.Constant( 'GL_LINE_STRIP_ADJACENCY_EXT', 0xB ) GL_TRIANGLES_ADJACENCY_EXT = constant.Constant( 'GL_TRIANGLES_ADJACENCY_EXT', 0xC ) GL_TRIANGLE_STRIP_ADJACENCY_EXT = constant.Constant( 'GL_TRIANGLE_STRIP_ADJACENCY_EXT', 0xD ) GL_GEOMETRY_PROGRAM_NV = constant.Constant( 'GL_GEOMETRY_PROGRAM_NV', 0x8C26 ) GL_MAX_PROGRAM_OUTPUT_VERTICES_NV = constant.Constant( 'GL_MAX_PROGRAM_OUTPUT_VERTICES_NV', 0x8C27 ) GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV = constant.Constant( 'GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV', 0x8C28 ) GL_GEOMETRY_VERTICES_OUT_EXT = constant.Constant( 'GL_GEOMETRY_VERTICES_OUT_EXT', 0x8DDA ) GL_GEOMETRY_INPUT_TYPE_EXT = constant.Constant( 'GL_GEOMETRY_INPUT_TYPE_EXT', 0x8DDB ) GL_GEOMETRY_OUTPUT_TYPE_EXT = constant.Constant( 'GL_GEOMETRY_OUTPUT_TYPE_EXT', 0x8DDC ) GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT = constant.Constant( 'GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT', 0x8C29 ) GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT = constant.Constant( 'GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT', 0x8DA7 ) GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT = constant.Constant( 'GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT', 0x8DA8 ) GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT = constant.Constant( 'GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT', 0x8DA9 ) GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT = constant.Constant( 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT', 0x8CD4 ) GL_PROGRAM_POINT_SIZE_EXT = constant.Constant( 'GL_PROGRAM_POINT_SIZE_EXT', 0x8642 ) glProgramVertexLimitNV = platform.createExtensionFunction( 'glProgramVertexLimitNV', dll=platform.GL, extension=EXTENSION_NAME, resultType=None, argTypes=(constants.GLenum, constants.GLint,), doc = 'glProgramVertexLimitNV( GLenum(target), GLint(limit) ) -> None', argNames = ('target', 'limit',), ) glFramebufferTextureEXT = platform.createExtensionFunction( 'glFramebufferTextureEXT', dll=platform.GL, extension=EXTENSION_NAME, resultType=None, argTypes=(constants.GLenum, constants.GLenum, constants.GLuint, constants.GLint,), doc = 'glFramebufferTextureEXT( GLenum(target), GLenum(attachment), GLuint(texture), GLint(level) ) -> None', argNames = ('target', 'attachment', 'texture', 'level',), ) glFramebufferTextureLayerEXT = platform.createExtensionFunction( 'glFramebufferTextureLayerEXT', dll=platform.GL, extension=EXTENSION_NAME, resultType=None, argTypes=(constants.GLenum, constants.GLenum, constants.GLuint, constants.GLint, constants.GLint,), doc = 'glFramebufferTextureLayerEXT( GLenum(target), GLenum(attachment), GLuint(texture), GLint(level), GLint(layer) ) -> None', argNames = ('target', 'attachment', 'texture', 'level', 'layer',), ) glFramebufferTextureFaceEXT = platform.createExtensionFunction( 'glFramebufferTextureFaceEXT', dll=platform.GL, extension=EXTENSION_NAME, resultType=None, argTypes=(constants.GLenum, constants.GLenum, constants.GLuint, constants.GLint, constants.GLenum,), doc = 'glFramebufferTextureFaceEXT( GLenum(target), GLenum(attachment), GLuint(texture), GLint(level), GLenum(face) ) -> None', argNames = ('target', 'attachment', 'texture', 'level', 'face',), ) def glInitGeometryProgram4NV(): '''Return boolean indicating whether this extension is available''' return extensions.hasGLExtension( EXTENSION_NAME )
54.927536
129
0.814248
bbb6e0ba861fbcb599f8a5421f34367fccb32fdd
1,158
py
Python
src/redcli/application/services/logger.py
Zhouhao12345/redcli
8a8260b0799e8524d0c339df8dfe6bcfb22f1841
[ "MIT" ]
6
2019-12-02T02:38:40.000Z
2021-02-05T06:40:56.000Z
src/redcli/application/services/logger.py
Zhouhao12345/redcli
8a8260b0799e8524d0c339df8dfe6bcfb22f1841
[ "MIT" ]
null
null
null
src/redcli/application/services/logger.py
Zhouhao12345/redcli
8a8260b0799e8524d0c339df8dfe6bcfb22f1841
[ "MIT" ]
1
2019-12-02T04:19:08.000Z
2019-12-02T04:19:08.000Z
from ..constant import Service as Service_Key from .base import Service import logging
27.571429
71
0.607945
bbb715e2f390dc18e086c2e84959bf7e23c5b5d0
324
py
Python
Exec/GravityTests/zeldovich_dm/analysis/zeldovich.py
Gosenca/axionyx_1.0
7e2a723e00e6287717d6d81b23db32bcf6c3521a
[ "BSD-3-Clause-LBNL" ]
72
2017-06-16T17:20:25.000Z
2021-12-18T12:45:58.000Z
Exec/GravityTests/zeldovich_dm/analysis/zeldovich.py
Gosenca/axionyx_1.0
7e2a723e00e6287717d6d81b23db32bcf6c3521a
[ "BSD-3-Clause-LBNL" ]
37
2017-05-07T04:20:04.000Z
2022-02-03T19:16:59.000Z
Exec/GravityTests/zeldovich_dm/analysis/zeldovich.py
Gosenca/axionyx_1.0
7e2a723e00e6287717d6d81b23db32bcf6c3521a
[ "BSD-3-Clause-LBNL" ]
30
2017-05-18T21:14:45.000Z
2022-03-23T20:50:24.000Z
import numpy as np
23.142857
72
0.530864
bbb782cb3b44f4866569b38680bb03a8e7730b26
10,441
py
Python
pgtrigger/tests/test_multi_db.py
tiholic/django-pgtrigger
ef8878115bef1a933405ab86d7f7c117252d970c
[ "BSD-3-Clause" ]
135
2020-06-27T14:02:46.000Z
2021-05-27T01:07:41.000Z
pgtrigger/tests/test_multi_db.py
tiholic/django-pgtrigger
ef8878115bef1a933405ab86d7f7c117252d970c
[ "BSD-3-Clause" ]
25
2021-06-19T20:28:52.000Z
2022-03-22T23:14:59.000Z
pgtrigger/tests/test_multi_db.py
tiholic/django-pgtrigger
ef8878115bef1a933405ab86d7f7c117252d970c
[ "BSD-3-Clause" ]
7
2020-06-29T02:26:05.000Z
2021-04-25T14:42:33.000Z
"""Tests multi-database support""" import contextlib import io import sys from django.core.management import call_command import django.test import pgtrigger import pgtrigger.tests.models as test_models
37.422939
79
0.514702
bbb7c8daf68cfc0db3531104ebe1585494d2cd41
192
py
Python
jude_customization/jude_customization/doctype/atlantic_fluid_configuration/test_atlantic_fluid_configuration.py
mymi14s/jude_customization
6de7173a03cedf8c712c2d05453c821dff7eec58
[ "MIT" ]
null
null
null
jude_customization/jude_customization/doctype/atlantic_fluid_configuration/test_atlantic_fluid_configuration.py
mymi14s/jude_customization
6de7173a03cedf8c712c2d05453c821dff7eec58
[ "MIT" ]
null
null
null
jude_customization/jude_customization/doctype/atlantic_fluid_configuration/test_atlantic_fluid_configuration.py
mymi14s/jude_customization
6de7173a03cedf8c712c2d05453c821dff7eec58
[ "MIT" ]
2
2020-11-09T16:22:52.000Z
2020-12-19T20:52:10.000Z
# Copyright (c) 2021, Anthony Emmanuel, github.com/mymi14ss and Contributors # See license.txt # import frappe import unittest
21.333333
76
0.807292
bbb7c9d675be21d26531a6e1f3de3d231a427a1e
1,224
py
Python
scale/scale/local_settings_TRAVIS-CI.py
stevevarner/scale
9623b261db4ddcf770f00df16afc91176142bb7c
[ "Apache-2.0" ]
null
null
null
scale/scale/local_settings_TRAVIS-CI.py
stevevarner/scale
9623b261db4ddcf770f00df16afc91176142bb7c
[ "Apache-2.0" ]
null
null
null
scale/scale/local_settings_TRAVIS-CI.py
stevevarner/scale
9623b261db4ddcf770f00df16afc91176142bb7c
[ "Apache-2.0" ]
null
null
null
# Settings file for use with travis-ci # Include all the default settings. from settings import * # Use the following lines to enable developer/debug mode. DEBUG = False TEMPLATES[0]['OPTIONS']['debug'] = DEBUG # Set the external URL context here FORCE_SCRIPT_NAME = '/' USE_X_FORWARDED_HOST = True ALLOWED_HOSTS = ["*"] STATIC_ROOT = 'static' STATIC_URL = '/static/' # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # Not all choices may be available on all operating systems. # In a Windows environment this must be set to your system time zone. TIME_ZONE = 'UTC' SECRET_KEY = "0fnk28edjh" # The template database to use when creating your new database. # By using your own template that already includes the postgis extension, # you can avoid needing to run the unit tests as a PostgreSQL superuser. #POSTGIS_TEMPLATE = 'scale' DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', 'NAME': 'scale', 'USER': 'postgres', 'PASSWORD': '', 'HOST': 'localhost', }, } # Master settings MESOS_MASTER = 'zk://localhost:2181/mesos' # Metrics collection directory METRICS_DIR = '/tmp'
26.042553
73
0.718137
bbbaccac8596eecef7a731177661a6286ed440a5
1,316
py
Python
scoring/dictionary/YAQ93.py
majazeh/risloo-samples
aadf27912a5044663698fa14fa781c644ea3f548
[ "Unlicense" ]
null
null
null
scoring/dictionary/YAQ93.py
majazeh/risloo-samples
aadf27912a5044663698fa14fa781c644ea3f548
[ "Unlicense" ]
null
null
null
scoring/dictionary/YAQ93.py
majazeh/risloo-samples
aadf27912a5044663698fa14fa781c644ea3f548
[ "Unlicense" ]
1
2021-03-07T09:15:55.000Z
2021-03-07T09:15:55.000Z
f1 = 'intentionally_not_thinking_about_upsetting_things' f2 = 'substance_abuse' f3 = 'denial_of_unhappiness' f4 = 'excessive_rationality_and_control' f5 = 'suppression_of_anger' f6 = 'psychosomatic_symptoms' f7 = 'denial_of_memories' f8 = 'withdrawal_from_people' f9 = 'avoidance_through_sleep_and_lack of energy' f10 = 'distraction_through_activity' f11 = 'self_soothing_like_eating_shopping_etc' f12 = 'passive_blocking_of_upsetting_emotions' f13 = 'passive_distraction_fantasy_daydreaming_television' f14 = 'avoidance_of_upsetting_situations' factors_names = (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15) factors = { 1 :(f1,) , 2 :(f2,) , 3 :(f3,) , 4 :(f3,) , 5 :(f4,) , 6 :(f5,) , 7:(f2,) , 8 :(f7 ,) , 9 :(f2,f11,) , 10 :(f6 ,) , 11 :(f12 ,) , 12 :(f6 ,) , 13 :(f5 , f8,) , 14 :(f9 ,) , 15 :(f6 ,) , 16 :(f13 ,) , 17 :(f4,) , 18 :(f5 ,) , 19 :(f4,) , 20 :(f8 ,) , 21 :(f7,) , 22 :(f9 ,) , 23 :(f10 ,) , 24 :(f10 ,) , 25 :(f13 ,) , 26 :(f11 ,) , 27 :(f7 ,) , 28:(f10 ,) , 29 :(f3,) , 30 :(f8 ,) , 31 :(f1 ,) , 32 :(f1 ,) , 33 :(f12 ,) , 34 :(f3,) , 35 :(f4,) , 36 :(f11 ,) , 37 :(f14 ,) , 38 :(f6,) , 39 :(f12 ,) , 40 :(f4 , f12,) # }
21.225806
68
0.521277
bbbae9f34a49725dac76a6810057af802194d6d9
327
py
Python
labgraph/websockets/ws_server/ws_server_stream_message.py
Yunusbcr/labgraph
a00ae7098b7b0e0eda8ce2e7e62dae86854616fb
[ "MIT" ]
124
2021-07-14T21:25:59.000Z
2022-03-08T20:40:16.000Z
labgraph/websockets/ws_server/ws_server_stream_message.py
Yunusbcr/labgraph
a00ae7098b7b0e0eda8ce2e7e62dae86854616fb
[ "MIT" ]
46
2021-07-16T18:41:11.000Z
2022-03-31T20:53:00.000Z
labgraph/websockets/ws_server/ws_server_stream_message.py
Yunusbcr/labgraph
a00ae7098b7b0e0eda8ce2e7e62dae86854616fb
[ "MIT" ]
22
2021-07-16T18:34:56.000Z
2022-03-31T15:12:06.000Z
#!/usr/bin/env python3 # Copyright 2004-present Facebook. All Rights Reserved. import numpy as np from ...messages import Message
18.166667
61
0.703364
bbbb396fd5ddce2bf132ab9fc786735f3c60216f
11,400
py
Python
scripts/lib/smart.py
lpenuelac/ImageAnalysis
a01b1278cca92e45fef6f5e41d1310cfbb041308
[ "MIT" ]
93
2015-11-26T14:15:51.000Z
2022-03-10T13:54:21.000Z
scripts/lib/smart.py
lpenuelac/ImageAnalysis
a01b1278cca92e45fef6f5e41d1310cfbb041308
[ "MIT" ]
19
2017-04-06T11:09:21.000Z
2022-03-05T20:12:39.000Z
scripts/lib/smart.py
lpenuelac/ImageAnalysis
a01b1278cca92e45fef6f5e41d1310cfbb041308
[ "MIT" ]
30
2017-06-12T16:08:51.000Z
2022-01-28T17:34:04.000Z
# code to estimate world surface elevation and EKF yaw error from # image direct pose informaation. # - trianglulate image features (in 3d) based on camera poses # - use essential/fundamental matrix + camera pose to estimate yaw error # - use affine transformation + camera pose to estimate yaw error import cv2 import math import numpy as np import os from props import getNode import props_json from . import camera from . import image from .logger import log, qlog from . import project from . import srtm r2d = 180 / math.pi d2r = math.pi / 180 smart_node = getNode("/smart", True) # compute the 3d triangulation of the matches between a pair of images # find (forward) affine transformation between feature pairs # return individual components of affine transform: rot, tx, ty, sx, # sy (units are degrees and pixels) # average of the triangulated points (converted to positive elevation) # Estimate image pose yaw error (based on found pairs affine # transform, original image pose, and gps positions; assumes a mostly # nadir camara pose.) After computering affine transform, project # image 2 center uv into image1 uv space and compute approximate # course in local uv space, then add this to direct pose yaw estimate # and compare to gps course. # compute the pairwise surface estimate and then update the property # tree records # compute the pairwise surface estimate and then update the property # tree records # return the average of estimated surfaces below the image pair # find srtm surface altitude under each camera pose
33.236152
78
0.635351
bbbbbd636a90f7a83f3583eed93d7178ff373d2b
162
py
Python
notification/urls.py
zaska-afk/twitterclone-zaska-afk
9a2c0d86f4c359fc6f943e2f0cb56c1681bc2bb2
[ "MIT" ]
null
null
null
notification/urls.py
zaska-afk/twitterclone-zaska-afk
9a2c0d86f4c359fc6f943e2f0cb56c1681bc2bb2
[ "MIT" ]
null
null
null
notification/urls.py
zaska-afk/twitterclone-zaska-afk
9a2c0d86f4c359fc6f943e2f0cb56c1681bc2bb2
[ "MIT" ]
null
null
null
from django.urls import path from notification import views urlpatterns = [ path('notifications/<int:id>/', views.notification_view, name='notifications'), ]
27
83
0.759259
bbbdb4df5c383e2a41743d8bacdff942a6c94c7d
3,229
py
Python
portal/migrations/versions/4b1e5b7b69eb_.py
ivan-c/truenth-portal
0b9d39ae43f42ea3413ed9634f295f5d856cbc77
[ "BSD-3-Clause" ]
3
2017-01-15T10:11:57.000Z
2018-10-02T23:46:44.000Z
portal/migrations/versions/4b1e5b7b69eb_.py
pep8speaks/true_nth_usa_portal
31ff755b0cfe61ab908e2a399e3c41ef17ca8c16
[ "BSD-3-Clause" ]
876
2016-04-04T20:45:11.000Z
2019-02-28T00:10:36.000Z
portal/migrations/versions/4b1e5b7b69eb_.py
pep8speaks/true_nth_usa_portal
31ff755b0cfe61ab908e2a399e3c41ef17ca8c16
[ "BSD-3-Clause" ]
9
2016-04-13T01:18:55.000Z
2018-09-19T20:44:23.000Z
"""empty message Revision ID: 4b1e5b7b69eb Revises: 13d1c714823a Create Date: 2017-01-19 12:36:55.339537 """ # revision identifiers, used by Alembic. revision = '4b1e5b7b69eb' down_revision = '13d1c714823a' import re from alembic import op import sqlalchemy as sa from sqlalchemy.orm import sessionmaker from portal.models.audit import Audit from portal.models.user import User Session = sessionmaker()
33.28866
91
0.59585
bbbf9065c2092f796276d52d4458d16e60c9b5cb
97
py
Python
tadataka/__init__.py
IshitaTakeshi/DVO
2c5a3db1db7e651bfaa7808bbf79a6c1c6a42fc5
[ "Apache-2.0" ]
7
2019-12-20T07:19:11.000Z
2021-07-22T03:25:12.000Z
tadataka/__init__.py
IshitaTakeshi/DVO
2c5a3db1db7e651bfaa7808bbf79a6c1c6a42fc5
[ "Apache-2.0" ]
null
null
null
tadataka/__init__.py
IshitaTakeshi/DVO
2c5a3db1db7e651bfaa7808bbf79a6c1c6a42fc5
[ "Apache-2.0" ]
null
null
null
from tadataka.visual_odometry import VisualOdometry from tadataka.camera import CameraParameters
32.333333
51
0.896907
bbc06ee508b4f1069613557ce6ed45315a87cb10
639
py
Python
bisect/36003.py
simonjayhawkins/pandas
9f571c58d7796dac8fd1aa2301cf4aa30ad7143a
[ "PSF-2.0", "Apache-2.0", "BSD-3-Clause-No-Nuclear-License-2014", "MIT", "MIT-0", "ECL-2.0", "BSD-3-Clause" ]
1
2022-02-22T17:13:16.000Z
2022-02-22T17:13:16.000Z
bisect/36003.py
simonjayhawkins/pandas
9f571c58d7796dac8fd1aa2301cf4aa30ad7143a
[ "PSF-2.0", "Apache-2.0", "BSD-3-Clause-No-Nuclear-License-2014", "MIT", "MIT-0", "ECL-2.0", "BSD-3-Clause" ]
null
null
null
bisect/36003.py
simonjayhawkins/pandas
9f571c58d7796dac8fd1aa2301cf4aa30ad7143a
[ "PSF-2.0", "Apache-2.0", "BSD-3-Clause-No-Nuclear-License-2014", "MIT", "MIT-0", "ECL-2.0", "BSD-3-Clause" ]
null
null
null
import datetime import pandas as pd import pandas.testing as tm print(pd.__version__) df = pd.DataFrame( { "A": ["X", "Y"], "B": [ datetime.datetime(2005, 1, 1, 10, 30, 23, 540000), datetime.datetime(3005, 1, 1, 10, 30, 23, 540000), ], } ) print(df) print(df.dtypes) result = df.groupby("A").B.max() print(result) expected = pd.Series( [ pd.Timestamp("2005-01-01 10:30:23.540000"), datetime.datetime(3005, 1, 1, 10, 30, 23, 540000), ], index=pd.Index(["X", "Y"], dtype="object", name="A"), name="B", ) tm.assert_series_equal(result, expected)
18.257143
62
0.56025
bbc4c27f8757a25bed0fa10e2091d91ec6470472
1,090
py
Python
investment_report/urls.py
uktrade/pir-api
79747ceab042c42c287e2b7471f6dade70f68693
[ "MIT" ]
1
2021-02-02T19:08:55.000Z
2021-02-02T19:08:55.000Z
investment_report/urls.py
uktrade/invest-pir-api
be56efddf9dfdf81c8557441a9a54d9a4dd4bab1
[ "MIT" ]
21
2018-07-10T10:20:47.000Z
2022-03-24T09:36:29.000Z
investment_report/urls.py
uktrade/pir-api
79747ceab042c42c287e2b7471f6dade70f68693
[ "MIT" ]
1
2021-02-04T11:28:37.000Z
2021-02-04T11:28:37.000Z
from django.conf.urls import url from investment_report.views import utils urlpatterns = [ url('preview/(?P<lang>[\w-]+)/(?P<market>[\w-]+)/(?P<sector>[\w-]+)/pdf', utils.investment_report_pdf, {'moderated': False}, name='preview_investment_report_pdf'), url('current/(?P<lang>[\w-]+)/(?P<market>[\w-]+)/(?P<sector>[\w-]+)/pdf', utils.investment_report_pdf, name='investment_report_pdf' ), url('preview/(?P<lang>[\w-]+)/(?P<market>[\w-]+)/(?P<sector>[\w-]+)/html', utils.investment_report_html, {'moderated': False}, name='investment_report_html' ), url('current/(?P<lang>[\w-]+)/(?P<market>[\w-]+)/(?P<sector>[\w-]+)/html', utils.investment_report_html, {'moderated': True}, name='investment_report_html' ), url('pir_csv', utils.pir_csv, name='pir_csv'), url('devcss.css', utils.dev_css, name='dev_css'), url('devcsslast.css', utils.dev_css_last, name='last_dev_css'), url('devcssplain.css', utils.dev_css_plain, name='plain_dev_css'), ]
32.058824
78
0.589908
bbc5bdb8d114fadf0d6064c5f98954f19d27c09e
2,823
py
Python
docc/image.py
pirate42/docc
de8e27ce5ec2e1288bff8c17a1566bbc7a26ade1
[ "MIT" ]
1
2017-08-18T08:03:55.000Z
2017-08-18T08:03:55.000Z
docc/image.py
pirate42/docc
de8e27ce5ec2e1288bff8c17a1566bbc7a26ade1
[ "MIT" ]
null
null
null
docc/image.py
pirate42/docc
de8e27ce5ec2e1288bff8c17a1566bbc7a26ade1
[ "MIT" ]
null
null
null
# coding=utf-8 from docc.exceptions import APIError
29.715789
77
0.597237
bbc710f8e283a69d3d2753dd21f132cb54a0681b
1,607
py
Python
ml_app_profile_analysis/ml_usage_analysis/fw_purpose_stat.py
RiS3-Lab/ModelXRay
60a98718eaa91eeb15d0737a9728cee4d714edd2
[ "Apache-2.0" ]
13
2021-04-05T08:37:37.000Z
2021-12-27T13:14:02.000Z
ml_app_profile_analysis/ml_usage_analysis/fw_purpose_stat.py
RiS3-Lab/ModelXRay
60a98718eaa91eeb15d0737a9728cee4d714edd2
[ "Apache-2.0" ]
1
2021-05-21T01:54:51.000Z
2021-11-19T07:36:47.000Z
ml_app_profile_analysis/ml_usage_analysis/fw_purpose_stat.py
RiS3-Lab/ModelXRay
60a98718eaa91eeb15d0737a9728cee4d714edd2
[ "Apache-2.0" ]
2
2022-01-18T07:37:31.000Z
2022-03-10T19:42:35.000Z
#!/usr/bin/env python import argparse fwmap = {'tensorflow':1,'caffe':2,'sensetime':3,'ncnn':4,'other':5,'mxnet':6,'uls':7,'mace':8,'tflite':9} if __name__ == "__main__": parser = argparse.ArgumentParser(prog='modelxray') parser.add_argument('filelist', help = 'list of files to be processed, like a,b,c') args = parser.parse_args() filelist = args.filelist.split(',') (th,res) = process_filelist(filelist) printres(th, res)
29.218182
141
0.514001
bbc76fa30b8fa88196b49d21f794c0cf68d9f17b
595
py
Python
email-service/rest_utils.py
Rudrarka/Alert-System
ed6d0c0566e70a13d13e6c65fa790f25d07fa99e
[ "MIT" ]
null
null
null
email-service/rest_utils.py
Rudrarka/Alert-System
ed6d0c0566e70a13d13e6c65fa790f25d07fa99e
[ "MIT" ]
null
null
null
email-service/rest_utils.py
Rudrarka/Alert-System
ed6d0c0566e70a13d13e6c65fa790f25d07fa99e
[ "MIT" ]
null
null
null
import os import requests
28.333333
79
0.638655
bbc82f2eff9c39c28075f8ddd776994572815053
1,660
py
Python
model/documentmanifest.py
beda-software/fhir-py-experements
363cfb894fa6f971b9be19340cae1b0a3a4377d8
[ "MIT" ]
null
null
null
model/documentmanifest.py
beda-software/fhir-py-experements
363cfb894fa6f971b9be19340cae1b0a3a4377d8
[ "MIT" ]
null
null
null
model/documentmanifest.py
beda-software/fhir-py-experements
363cfb894fa6f971b9be19340cae1b0a3a4377d8
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Generated from FHIR 4.0.1-9346c8cc45 (http://hl7.org/fhir/StructureDefinition/DocumentManifest) on 2020-02-03. # 2020, SMART Health IT. import sys from dataclasses import dataclass, field from typing import ClassVar, Optional, List from .backboneelement import BackboneElement from .codeableconcept import CodeableConcept from .domainresource import DomainResource from .fhirdate import FHIRDate from .fhirreference import FHIRReference from .identifier import Identifier
33.2
113
0.751807
bbc90b64134d3ab6cf219527bed05e8373ac58a3
717
py
Python
tests/core/test_lc.py
atsuki-kuwata/jaxsot
7de5dd964c951661892c79e4447e9f314885a0a9
[ "MIT" ]
2
2022-03-01T23:50:08.000Z
2022-03-22T15:25:34.000Z
tests/core/test_lc.py
atsuki-kuwata/jaxsot
7de5dd964c951661892c79e4447e9f314885a0a9
[ "MIT" ]
8
2022-02-19T00:06:34.000Z
2022-03-31T00:09:54.000Z
tests/core/test_lc.py
atsuki-kuwata/jaxsot
7de5dd964c951661892c79e4447e9f314885a0a9
[ "MIT" ]
1
2022-03-01T22:39:00.000Z
2022-03-01T22:39:00.000Z
""" test for lc """ import pytest import numpy as np from jaxsot.core.weight import comp_weight, comp_omega from jaxsot.core.lc import gen_lightcurve from jaxsot.io.earth import binarymap if __name__=="__main__": test_lc()
21.727273
63
0.679219
bbca0d47c796ae1504de61caad61827265203834
4,057
py
Python
src/squad/kinematics/base.py
douglasdaly/spot-robot
7a4fdd7eb5fe5fc2d31180ed6b9f7ea21647bea2
[ "MIT" ]
null
null
null
src/squad/kinematics/base.py
douglasdaly/spot-robot
7a4fdd7eb5fe5fc2d31180ed6b9f7ea21647bea2
[ "MIT" ]
null
null
null
src/squad/kinematics/base.py
douglasdaly/spot-robot
7a4fdd7eb5fe5fc2d31180ed6b9f7ea21647bea2
[ "MIT" ]
null
null
null
from typing import Any, Dict from squad.config import config from squad.exceptions import FrozenError
32.198413
78
0.590338
bbcac82869e4955029c31c4d5ba367911fd7fe18
2,833
py
Python
deep_image_compression/single_psnr.py
LichengXiao2017/deep-image-compression
cf6e5699bad4d7b4a0dd8db6da72aa0c56e3d1e4
[ "MIT" ]
9
2020-01-09T21:15:17.000Z
2022-02-08T12:41:54.000Z
deep_image_compression/single_psnr.py
LichengXiao2017/deep-image-compression
cf6e5699bad4d7b4a0dd8db6da72aa0c56e3d1e4
[ "MIT" ]
8
2019-10-15T23:50:03.000Z
2021-11-10T19:40:15.000Z
deep_image_compression/single_psnr.py
LichengXiao2017/enas-image-compression
cf6e5699bad4d7b4a0dd8db6da72aa0c56e3d1e4
[ "MIT" ]
3
2019-10-16T06:06:49.000Z
2020-07-06T15:02:09.000Z
# -*- coding: utf-8 -*- # Copyright 2019 Licheng Xiao. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== import tensorflow as tf import numpy import math import cv2 import os import logging from os import listdir from os.path import isfile, join from absl import flags flags.DEFINE_string("original_img", default=None, help="Path for original image file.") flags.DEFINE_string("compressed_img", default=None, help="Path for compressed image file.") flags.DEFINE_string("reconstructed_img", default=None, help="Path for reconstructed image file.") FLAGS = flags.FLAGS if __name__ == "__main__": tf.app.run()
37.276316
83
0.614896
bbcbbaa39a696df212fa670accc00b3ebb116dbd
984
py
Python
message/tests/utils/creators.py
ThePokerFaCcCe/messenger
2db3d5c2ccd05ac40d2442a13d664ca9ad3cb14c
[ "MIT" ]
null
null
null
message/tests/utils/creators.py
ThePokerFaCcCe/messenger
2db3d5c2ccd05ac40d2442a13d664ca9ad3cb14c
[ "MIT" ]
null
null
null
message/tests/utils/creators.py
ThePokerFaCcCe/messenger
2db3d5c2ccd05ac40d2442a13d664ca9ad3cb14c
[ "MIT" ]
null
null
null
from message.models import Message, DeletedMessage, TextContent from user.tests.utils import create_active_user from conversation.tests.utils import create_private_chat
31.741935
65
0.707317
bbcbbc848a277e8f627eea2957cd5be0baa2e598
350
py
Python
excercises/6-0001/finger_excercises/iteration-1.py
obsessedyouth/simulacra
530155664daf1aff06cb575c4c4073acbacdb32d
[ "MIT" ]
null
null
null
excercises/6-0001/finger_excercises/iteration-1.py
obsessedyouth/simulacra
530155664daf1aff06cb575c4c4073acbacdb32d
[ "MIT" ]
null
null
null
excercises/6-0001/finger_excercises/iteration-1.py
obsessedyouth/simulacra
530155664daf1aff06cb575c4c4073acbacdb32d
[ "MIT" ]
null
null
null
""" Replace the comment in the following code with a while loop. numXs = int(input('How many times should I print the letter X? ')) toPrint = " #concatenate X to toPrint numXs times print(toPrint) """ numXs = int(input('How many times should I print the letter X? ')) toPrint = "" while numXs > 0: toPrint += "X" numXs -= 1 print(toPrint)
20.588235
66
0.677143
bbcbf2b2a1cb0a8d47a18b0768f2227527626ab0
7,784
py
Python
services/temperature_bands/temperature_bands_pb2.py
phgupta/XBOS
acc59f33600943569d62c145dae11a1775296b44
[ "BSD-2-Clause" ]
27
2016-04-26T17:26:56.000Z
2021-08-22T15:11:55.000Z
services/temperature_bands/temperature_bands_pb2.py
phgupta/XBOS
acc59f33600943569d62c145dae11a1775296b44
[ "BSD-2-Clause" ]
75
2017-02-17T18:00:37.000Z
2019-06-20T04:12:08.000Z
services/temperature_bands/temperature_bands_pb2.py
vishalbelsare/XBOS
1fea0b024d97ae142d97b3a94510403928ed44b7
[ "BSD-2-Clause" ]
20
2017-07-28T14:50:04.000Z
2020-01-16T05:04:54.000Z
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: temperature_bands.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() DESCRIPTOR = _descriptor.FileDescriptor( name='temperature_bands.proto', package='temperature_bands', syntax='proto3', serialized_options=_b('P\001'), serialized_pb=_b('\n\x17temperature_bands.proto\x12\x11temperature_bands\"k\n\x0fScheduleRequest\x12\x10\n\x08\x62uilding\x18\x01 \x01(\t\x12\x0c\n\x04zone\x18\x02 \x01(\t\x12\r\n\x05start\x18\x03 \x01(\x03\x12\x0b\n\x03\x65nd\x18\x04 \x01(\x03\x12\x0e\n\x06window\x18\x05 \x01(\t\x12\x0c\n\x04unit\x18\x06 \x01(\t\"^\n\rSchedulePoint\x12\x0c\n\x04time\x18\x01 \x01(\x03\x12\x17\n\x0ftemperature_low\x18\x02 \x01(\x01\x12\x18\n\x10temperature_high\x18\x03 \x01(\x01\x12\x0c\n\x04unit\x18\x04 \x01(\t2\xc3\x01\n\tSchedules\x12Z\n\x0eGetComfortband\x12\".temperature_bands.ScheduleRequest\x1a .temperature_bands.SchedulePoint\"\x00\x30\x01\x12Z\n\x0eGetDoNotExceed\x12\".temperature_bands.ScheduleRequest\x1a .temperature_bands.SchedulePoint\"\x00\x30\x01\x42\x02P\x01\x62\x06proto3') ) _SCHEDULEREQUEST = _descriptor.Descriptor( name='ScheduleRequest', full_name='temperature_bands.ScheduleRequest', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='building', full_name='temperature_bands.ScheduleRequest.building', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='zone', full_name='temperature_bands.ScheduleRequest.zone', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='start', full_name='temperature_bands.ScheduleRequest.start', index=2, number=3, type=3, cpp_type=2, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='end', full_name='temperature_bands.ScheduleRequest.end', index=3, number=4, type=3, cpp_type=2, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='window', full_name='temperature_bands.ScheduleRequest.window', index=4, number=5, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='unit', full_name='temperature_bands.ScheduleRequest.unit', index=5, number=6, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=46, serialized_end=153, ) _SCHEDULEPOINT = _descriptor.Descriptor( name='SchedulePoint', full_name='temperature_bands.SchedulePoint', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='time', full_name='temperature_bands.SchedulePoint.time', index=0, number=1, type=3, cpp_type=2, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='temperature_low', full_name='temperature_bands.SchedulePoint.temperature_low', index=1, number=2, type=1, cpp_type=5, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='temperature_high', full_name='temperature_bands.SchedulePoint.temperature_high', index=2, number=3, type=1, cpp_type=5, label=1, has_default_value=False, default_value=float(0), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='unit', full_name='temperature_bands.SchedulePoint.unit', index=3, number=4, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=155, serialized_end=249, ) DESCRIPTOR.message_types_by_name['ScheduleRequest'] = _SCHEDULEREQUEST DESCRIPTOR.message_types_by_name['SchedulePoint'] = _SCHEDULEPOINT _sym_db.RegisterFileDescriptor(DESCRIPTOR) ScheduleRequest = _reflection.GeneratedProtocolMessageType('ScheduleRequest', (_message.Message,), dict( DESCRIPTOR = _SCHEDULEREQUEST, __module__ = 'temperature_bands_pb2' # @@protoc_insertion_point(class_scope:temperature_bands.ScheduleRequest) )) _sym_db.RegisterMessage(ScheduleRequest) SchedulePoint = _reflection.GeneratedProtocolMessageType('SchedulePoint', (_message.Message,), dict( DESCRIPTOR = _SCHEDULEPOINT, __module__ = 'temperature_bands_pb2' # @@protoc_insertion_point(class_scope:temperature_bands.SchedulePoint) )) _sym_db.RegisterMessage(SchedulePoint) DESCRIPTOR._options = None _SCHEDULES = _descriptor.ServiceDescriptor( name='Schedules', full_name='temperature_bands.Schedules', file=DESCRIPTOR, index=0, serialized_options=None, serialized_start=252, serialized_end=447, methods=[ _descriptor.MethodDescriptor( name='GetComfortband', full_name='temperature_bands.Schedules.GetComfortband', index=0, containing_service=None, input_type=_SCHEDULEREQUEST, output_type=_SCHEDULEPOINT, serialized_options=None, ), _descriptor.MethodDescriptor( name='GetDoNotExceed', full_name='temperature_bands.Schedules.GetDoNotExceed', index=1, containing_service=None, input_type=_SCHEDULEREQUEST, output_type=_SCHEDULEPOINT, serialized_options=None, ), ]) _sym_db.RegisterServiceDescriptor(_SCHEDULES) DESCRIPTOR.services_by_name['Schedules'] = _SCHEDULES # @@protoc_insertion_point(module_scope)
38.92
784
0.751413
bbd055bb557e945cf33d02d1ba1783662b82c31f
63
py
Python
bot/exchange/__init__.py
colticol/bold-arbitrager
aef6683a3f41d47a51d24367819d183ecacea3a0
[ "Apache-2.0" ]
null
null
null
bot/exchange/__init__.py
colticol/bold-arbitrager
aef6683a3f41d47a51d24367819d183ecacea3a0
[ "Apache-2.0" ]
null
null
null
bot/exchange/__init__.py
colticol/bold-arbitrager
aef6683a3f41d47a51d24367819d183ecacea3a0
[ "Apache-2.0" ]
null
null
null
from . import exchange_controller from . import exchange_client
31.5
33
0.857143
bbd06fd058120fffbc5ec8c48b2f8310d80c11b4
2,265
py
Python
test_proj/tests/test_runner.py
andrewbird2/django-data-validation
8c3a8e14440f0299a5f4b188dfaa7864b53b5123
[ "MIT" ]
1
2020-08-05T16:42:48.000Z
2020-08-05T16:42:48.000Z
test_proj/tests/test_runner.py
andrewbird2/django-data-validation
8c3a8e14440f0299a5f4b188dfaa7864b53b5123
[ "MIT" ]
1
2020-11-04T07:06:37.000Z
2020-11-04T07:06:37.000Z
test_proj/tests/test_runner.py
andrewbird2/django-data-validation
8c3a8e14440f0299a5f4b188dfaa7864b53b5123
[ "MIT" ]
1
2020-11-04T02:16:05.000Z
2020-11-04T02:16:05.000Z
from unittest import mock from django.core.management import call_command import pytest from app1.models import TestModel from datavalidation.models import Validator from datavalidation.results import Status from datavalidation.runners import ModelValidationRunner, ObjectValidationRunner def test_model_runner_with_bad_model(): """ check that ModelValidationRunner handles bad input """ try: ModelValidationRunner(Validator).run() assert False, "expected an exception" except ValueError as e: assert e.args == ("no data validation methods on model Validator",) def test_model_runner_with_bad_method(): """ check that ModelValidationRunner handles bad input """ try: ModelValidationRunner(TestModel, method_names=["not_a_method"]).run() assert False, "expected as exception" except ValueError as e: assert e.args == ("not_a_method is not a data validator on TestModel",)
31.458333
80
0.72362
bbd1b55c9769411d9a683ac06b192b84c0c94cde
2,479
py
Python
FlaskApp/flask_server.py
pjneelam/pjneelam.eportfolio2022
3f55c1da6214e3eabab949ff83b34c0553c52866
[ "CC-BY-3.0" ]
null
null
null
FlaskApp/flask_server.py
pjneelam/pjneelam.eportfolio2022
3f55c1da6214e3eabab949ff83b34c0553c52866
[ "CC-BY-3.0" ]
null
null
null
FlaskApp/flask_server.py
pjneelam/pjneelam.eportfolio2022
3f55c1da6214e3eabab949ff83b34c0553c52866
[ "CC-BY-3.0" ]
null
null
null
#to create the flask page #import flask #flask library was installed in the command line/computer terminal first #Source: PythonHow https://pythonhow.com/python-tutorial/flask/How-making-a-website-with-Python-works/ #Python assigns the name "__main__" to the script when the script is executed. #The debug parameter is set to true, to trace Python errors. # To note: in a production environment, it must be set to False to avoid any security issues. #returning HTML in Flask, create a homepage.html in another folder #add render_template method from flask import Flask, render_template #pip install flask-mysqldb in cmd #from flask_mysqldb import MySQL #from mysql.connector.connection import MySQLConnection #from sql_connection import get_sql_connection #connection with mysql not established app = Flask(__name__) #add another page: market page if __name__ == '__main__': app.run(debug=True) #to style your web page, can use styling framework "Bootstrap" - https://getbootstrap.com/docs/4.5/getting-started/introduction/#starter-template #copy and page in html page created #IP/page set up: http://127.0.0.1:5000/ #page created: http://127.0.0.1:5000/market #to synchonise your updates in the codes and the web page, RUN the program and check if Debug mode is on in the Terminal below #to turn it on, run code: set FLASK_DEBUG=1
42.741379
146
0.709964
bbd25b797957a5f28a70032817bbe3816cae3981
3,152
py
Python
mozdns/mixins.py
jlin/inventory
c098c98e570c3bf9fadfd811eb75e1213f6ea428
[ "BSD-3-Clause" ]
22
2015-01-16T01:36:32.000Z
2020-06-08T00:46:18.000Z
mozdns/mixins.py
jlin/inventory
c098c98e570c3bf9fadfd811eb75e1213f6ea428
[ "BSD-3-Clause" ]
8
2015-12-28T18:56:19.000Z
2019-04-01T17:33:48.000Z
mozdns/mixins.py
jlin/inventory
c098c98e570c3bf9fadfd811eb75e1213f6ea428
[ "BSD-3-Clause" ]
13
2015-01-13T20:56:22.000Z
2022-02-23T06:01:17.000Z
from settings import MOZDNS_BASE_URL from gettext import gettext as _ from string import Template
28.396396
75
0.583756
bbd2f4baf55ab29dd9d52744e70bd79da375026a
2,361
py
Python
db_cloudant2.py
trishasarkar/IBM-PLS-deployed
959fef4c43a6a33bcb6e96b14046dcbd220e0b2a
[ "MIT" ]
null
null
null
db_cloudant2.py
trishasarkar/IBM-PLS-deployed
959fef4c43a6a33bcb6e96b14046dcbd220e0b2a
[ "MIT" ]
null
null
null
db_cloudant2.py
trishasarkar/IBM-PLS-deployed
959fef4c43a6a33bcb6e96b14046dcbd220e0b2a
[ "MIT" ]
null
null
null
from ibmcloudant.cloudant_v1 import CloudantV1, Document from ibm_cloud_sdk_core.authenticators import IAMAuthenticator CLOUDANT_URL="https://apikey-v2-1mfs4kqo2nmnc2sdtgp9ji8myznbgm6mivk0o93pfopt:f70c9a73c52d287d3271ddc3dba6a30a@dc1a5ff5-996b-475c-8b7e-da87f4bf33a3-bluemix.cloudantnosqldb.appdomain.cloud" CLOUDANT_APIKEY="C8J8TcTL_T9YlMtyA6itWueAqAdkgGXbwOc8RA2omfCd" CLOUDANT_USERNAME="apikey-v2-1mfs4kqo2nmnc2sdtgp9ji8myznbgm6mivk0o93pfopt" CLOUDANT_PASSWORD="f70c9a73c52d287d3271ddc3dba6a30a" authenticator = IAMAuthenticator(CLOUDANT_APIKEY) service = CloudantV1(authenticator=authenticator) service.set_service_url(CLOUDANT_URL) response = service.get_server_information().get_result() ##### Create a DB # response = service.put_database(db='usessions') # print(response) ##### ##### Create a document # products_doc = Document( # id="001", # data = get_data() # ) # # response = service.post_document(db='qdata', document=products_doc).get_result() # print(response) ##### #### Get data response = service.get_document( db='usessions', doc_id='mCWSwjuLuH' ).get_result() print(response) _rev = response['_rev'] #### ##### Update data # new_doc = Document( # rev=_rev, # data=get_data() # ) # response = service.put_document( # db='qdata', # doc_id = '001', # document=new_doc # ).get_result() ##### # def create_question(request_dict): # question=Document( # id=request_dict['id'], # type="question", # question_text=request_dict['text'], # options=request_dict['options'] # ) # response = service.post_document(db='questions_db', document=question).get_result() # print(response) # # req={"id":"q003", # "text":"This is the first question", # "options":['option 1', 'option 2','option 3'] # } # # create_question(req) # # def update_question(doc_id, request_dict): # question=Document( # rev=request_dict['rev'], # type="question", # question_text=request_dict['text'], # options=request_dict['options'] # ) # response = service.put_document(db='questions_db', doc_id=doc_id,document=question).get_result() # print(response) # # req={ # "rev":"2-7b23212b63dd888e94c7379a109a30cf", # "text":"This is not the first question", # "options":['Noption 1', 'Noption 2','Noption 3']} # # doc_id="q003" # update_question(doc_id, req)
26.829545
187
0.710292
bbd37b557f545c19f1a83004ba18612d1700a121
1,782
py
Python
core/migrations/0012_auto_20170423_1836.py
koatse/ilikethem
962374ff8179a533dba3b00422d11bb819d8acde
[ "MIT" ]
null
null
null
core/migrations/0012_auto_20170423_1836.py
koatse/ilikethem
962374ff8179a533dba3b00422d11bb819d8acde
[ "MIT" ]
null
null
null
core/migrations/0012_auto_20170423_1836.py
koatse/ilikethem
962374ff8179a533dba3b00422d11bb819d8acde
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- # Generated by Django 1.10.4 on 2017-04-23 18:36 from __future__ import unicode_literals from django.db import migrations, models
33
102
0.597643
bbd438523d7877e78c030d4778fb9485bdd7f4ad
478
py
Python
cymon_v2/komand_cymon_v2/actions/__init__.py
killstrelok/insightconnect-plugins
911358925f4233ab273dbd8172e8b7b9188ebc01
[ "MIT" ]
1
2020-03-18T09:14:55.000Z
2020-03-18T09:14:55.000Z
cymon_v2/komand_cymon_v2/actions/__init__.py
killstrelok/insightconnect-plugins
911358925f4233ab273dbd8172e8b7b9188ebc01
[ "MIT" ]
1
2021-02-23T23:57:37.000Z
2021-02-23T23:57:37.000Z
cymon_v2/komand_cymon_v2/actions/__init__.py
killstrelok/insightconnect-plugins
911358925f4233ab273dbd8172e8b7b9188ebc01
[ "MIT" ]
null
null
null
# GENERATED BY KOMAND SDK - DO NOT EDIT from .create_feed.action import CreateFeed from .get_feed_details.action import GetFeedDetails from .get_report_document.action import GetReportDocument from .list_all_feeds.action import ListAllFeeds from .list_user_feeds.action import ListUserFeeds from .search.action import Search from .submit_report.action import SubmitReport from .submit_reports_in_bulk.action import SubmitReportsInBulk from .update_feed.action import UpdateFeed
43.454545
62
0.864017
bbd4c608ff119a6e8725d951c6333bfee210d76b
9,913
py
Python
appsite/resolver/models.py
inchiresolver/inchiresolver
6b3f080a4364ebe7499298e5a1b3cd4ed165322d
[ "BSD-3-Clause" ]
3
2020-10-22T06:18:17.000Z
2021-03-19T16:49:00.000Z
appsite/resolver/models.py
inchiresolver/inchiresolver
6b3f080a4364ebe7499298e5a1b3cd4ed165322d
[ "BSD-3-Clause" ]
11
2019-11-01T23:04:31.000Z
2022-02-10T12:32:11.000Z
appsite/resolver/models.py
inchiresolver/inchiresolver
6b3f080a4364ebe7499298e5a1b3cd4ed165322d
[ "BSD-3-Clause" ]
null
null
null
import uuid from urllib.parse import urljoin from django.core.exceptions import FieldError from multiselectfield import MultiSelectField from rdkit import Chem from django.db import models from resolver import defaults from inchi.identifier import InChIKey, InChI
36.988806
117
0.635226
bbd5dfeac5416aaa4e83e0b9d53270b2988a24ca
2,995
py
Python
kit_django/content/apps.py
safakoner/kit
aec36a70137febfb5f3e3a9205ea58879736eea4
[ "MIT" ]
6
2020-06-29T20:36:15.000Z
2021-09-08T23:34:01.000Z
kit_django/content/apps.py
safakoner/kit
aec36a70137febfb5f3e3a9205ea58879736eea4
[ "MIT" ]
9
2021-03-30T13:46:29.000Z
2022-03-12T00:38:27.000Z
kit_django/content/apps.py
safakoner/kit
aec36a70137febfb5f3e3a9205ea58879736eea4
[ "MIT" ]
1
2020-07-20T18:40:24.000Z
2020-07-20T18:40:24.000Z
# # ---------------------------------------------------------------------------------------------------- # DESCRIPTION # ---------------------------------------------------------------------------------------------------- ## @package content @brief [ PACKAGE ] - Content. ## @dir content @brief [ DIRECTORY ] - Package root directory. ## @package content.admin @brief [ MODULE ] - Admin module. ## @file content/admin.py @brief [ FILE ] - Admin module file. ## @package content.apps @brief [ MODULE ] - App module. ## @file content/apps.py @brief [ FILE ] - App module file. ## @package content.handlers @brief [ MODULE ] - Signal handlers module. ## @file content/handlers.py @brief [ FILE ] - Signal handlers module file. ## @package content.models @brief [ MODULE ] - Models module. ## @file content/models.py @brief [ FILE ] - Models module file. ## @package content.serializers @brief [ MODULE ] - Serializers module. ## @file content/serializers.py @brief [ FILE ] - Serializers module file. ## @package content.tests @brief [ MODULE ] - Tests module. ## @file content/tests.py @brief [ FILE ] - Tests module file. ## @package content.urls @brief [ MODULE ] - URLs module. ## @file content/urls.py @brief [ FILE ] - URLs module file. ## @package content.views @brief [ MODULE ] - Views module. ## @file content/views.py @brief [ FILE ] - Views module file. # # ---------------------------------------------------------------------------------------------------- # IMPORTS # ---------------------------------------------------------------------------------------------------- from django.apps import AppConfig from django.db.models.signals import pre_save, post_save, pre_delete # # ---------------------------------------------------------------------------------------------------- # CODE # ---------------------------------------------------------------------------------------------------- # ## @brief [ APP CONFIG CLASS ] - App config class.
42.785714
102
0.444741
bbd748e6a83de8ca6fc199a6dc4a8e503c1bdd1b
681
py
Python
Robot.py
rnandon/RobotsAndDinosaurs
ad83d61a800bcf307dfbbf925abe91bcad2763b4
[ "MIT" ]
null
null
null
Robot.py
rnandon/RobotsAndDinosaurs
ad83d61a800bcf307dfbbf925abe91bcad2763b4
[ "MIT" ]
null
null
null
Robot.py
rnandon/RobotsAndDinosaurs
ad83d61a800bcf307dfbbf925abe91bcad2763b4
[ "MIT" ]
null
null
null
### IMPORTS ### ================================ from Combatant import Combatant # Robot. Implementation of the Combatant class
35.842105
108
0.577093
bbd76e1f33835fcc21edddd8477a6604c70dcdb3
5,143
py
Python
src/core.py
z62060037/ArtStationDownloader
f6e8a657dfd3584cbf870470f1b19dc4edf54e92
[ "MIT" ]
1
2019-04-19T10:14:49.000Z
2019-04-19T10:14:49.000Z
src/core.py
z62060037/ArtStationDownloader
f6e8a657dfd3584cbf870470f1b19dc4edf54e92
[ "MIT" ]
null
null
null
src/core.py
z62060037/ArtStationDownloader
f6e8a657dfd3584cbf870470f1b19dc4edf54e92
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ Copyright 2018-2019 Sean Feng(sean@FantaBlade.com) """ import os import re from concurrent import futures from multiprocessing import cpu_count from urllib.parse import urlparse import pafy import requests
37.816176
92
0.517986
bbd7d9dde1e4ce541f94c7b201986c3d8dd7319a
727
py
Python
home/migrations/0022_auto_20210409_1256.py
witty-technologies-empowerment/codeupblood
a0aa1725e5776d80e083b6d4e9e67476bb97e983
[ "MIT" ]
null
null
null
home/migrations/0022_auto_20210409_1256.py
witty-technologies-empowerment/codeupblood
a0aa1725e5776d80e083b6d4e9e67476bb97e983
[ "MIT" ]
null
null
null
home/migrations/0022_auto_20210409_1256.py
witty-technologies-empowerment/codeupblood
a0aa1725e5776d80e083b6d4e9e67476bb97e983
[ "MIT" ]
1
2022-01-19T11:09:13.000Z
2022-01-19T11:09:13.000Z
# Generated by Django 3.1.6 on 2021-04-09 19:56 from django.db import migrations, models
25.068966
68
0.566713
bbdb2c2c522ffff022d41a4d62480d42fe180e58
2,586
py
Python
Gui/CustomWidgets/PlottingWidgets/mayaViWidget.py
jpesperidiao/MOPA
6fbf097a22d42d82eeb36c6f247eb0d8fb6ac586
[ "MIT" ]
null
null
null
Gui/CustomWidgets/PlottingWidgets/mayaViWidget.py
jpesperidiao/MOPA
6fbf097a22d42d82eeb36c6f247eb0d8fb6ac586
[ "MIT" ]
1
2020-06-07T00:19:54.000Z
2020-06-07T00:19:54.000Z
Gui/CustomWidgets/PlottingWidgets/mayaViWidget.py
jpesperidiao/MOPA
6fbf097a22d42d82eeb36c6f247eb0d8fb6ac586
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ /*************************************************************************** MOPA An independet project Mtodo de Obteno da Posio de Atirador ------------------- begin : 2018-12-21 git sha : $Format:%H$ copyright : (C) 2018 by Joo P. Esperidio email : joao.p2709@gmail.com ***************************************************************************/ /*************************************************************************** * * * 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 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ """ from traits.api import HasTraits, Instance, on_trait_change from traitsui.api import View, Item from mayavi.core.ui.api import MayaviScene, MlabSceneModel, \ SceneEditorx from PyQt5.QtWidgets import QWidget
39.784615
95
0.496906
bbdb59840ecfefbcddcb7e8ef4a69bf99648feb6
1,953
py
Python
notebooks/debug_monuseg.py
voreille/2d_bispectrum_cnn
ba8f26f6a557602bc3343c4562c83a3de914c67e
[ "MIT" ]
null
null
null
notebooks/debug_monuseg.py
voreille/2d_bispectrum_cnn
ba8f26f6a557602bc3343c4562c83a3de914c67e
[ "MIT" ]
null
null
null
notebooks/debug_monuseg.py
voreille/2d_bispectrum_cnn
ba8f26f6a557602bc3343c4562c83a3de914c67e
[ "MIT" ]
null
null
null
from pathlib import Path import numpy as np from PIL import Image, ImageSequence import matplotlib.pyplot as plt import tensorflow as tf import tensorflow_io as tfio from scipy.ndimage import rotate from src.data.monuseg import get_dataset, tf_random_rotate, tf_random_crop ds = get_dataset() image, mask = next(ds.as_numpy_iterator()) image, mask = random_crop(image, mask, rotation=True) print(f"yo la shape de liamg cest {image.shape}")
39.06
78
0.612391
bbdd2e1f7b9f04c68b368c1e67ead84b604e9837
526
py
Python
amqp_2phase/migrations/0002_create_event_index.py
cloud-taxi/django-amqp-2phase
d4825fa68bfba6a21c310b45f39a740840e7cae1
[ "BSD-3-Clause" ]
null
null
null
amqp_2phase/migrations/0002_create_event_index.py
cloud-taxi/django-amqp-2phase
d4825fa68bfba6a21c310b45f39a740840e7cae1
[ "BSD-3-Clause" ]
null
null
null
amqp_2phase/migrations/0002_create_event_index.py
cloud-taxi/django-amqp-2phase
d4825fa68bfba6a21c310b45f39a740840e7cae1
[ "BSD-3-Clause" ]
null
null
null
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-05-08 05:45 from __future__ import unicode_literals from django.db import migrations
29.222222
119
0.671103
bbddc18cfd9ad9a4f3ecf0a646125463caad5351
870
py
Python
investmap/migrations/0004_investmapdescriptiontabs.py
30Meridian/RozumneMistoSnapshot
67a83b3908674d01992561dfb37596e395b4d482
[ "BSD-3-Clause" ]
null
null
null
investmap/migrations/0004_investmapdescriptiontabs.py
30Meridian/RozumneMistoSnapshot
67a83b3908674d01992561dfb37596e395b4d482
[ "BSD-3-Clause" ]
null
null
null
investmap/migrations/0004_investmapdescriptiontabs.py
30Meridian/RozumneMistoSnapshot
67a83b3908674d01992561dfb37596e395b4d482
[ "BSD-3-Clause" ]
null
null
null
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import ckeditor_uploader.fields
30
114
0.589655
bbdf983b5082ed39dd9de59fc5860b7d988b933b
290
py
Python
align/cli.py
kba/cis-ocrd-py
4b6d2a29ac82cf1ec734a87314a6c774271d09bc
[ "MIT" ]
null
null
null
align/cli.py
kba/cis-ocrd-py
4b6d2a29ac82cf1ec734a87314a6c774271d09bc
[ "MIT" ]
null
null
null
align/cli.py
kba/cis-ocrd-py
4b6d2a29ac82cf1ec734a87314a6c774271d09bc
[ "MIT" ]
null
null
null
import click from ocrd.decorators import ocrd_cli_options, ocrd_cli_wrap_processor from align.aligner import Aligner
26.363636
69
0.786207
bbdfbb10eaebeeb5ca5805687d46a1d1d278b849
1,567
py
Python
test/SI_to_Conc/test_SI2Conc_OG_MO_AUMC_ICR_RMH.py
notZaki/DCE-DSC-MRI_CodeCollection
9e258e10559894951c7e6c5c00876e74ce103258
[ "Apache-2.0" ]
null
null
null
test/SI_to_Conc/test_SI2Conc_OG_MO_AUMC_ICR_RMH.py
notZaki/DCE-DSC-MRI_CodeCollection
9e258e10559894951c7e6c5c00876e74ce103258
[ "Apache-2.0" ]
1
2020-11-19T04:49:28.000Z
2020-11-19T04:49:28.000Z
test/SI_to_Conc/test_SI2Conc_OG_MO_AUMC_ICR_RMH.py
notZaki/DCE-DSC-MRI_CodeCollection
9e258e10559894951c7e6c5c00876e74ce103258
[ "Apache-2.0" ]
null
null
null
import pytest import numpy as np from ..helpers import osipi_parametrize from . import SI2Conc_data from src.original.OG_MO_AUMC_ICR_RMH.ExtendedTofts.DCE import dce_to_r1eff from src.original.OG_MO_AUMC_ICR_RMH.ExtendedTofts.DCE import r1eff_to_conc # All tests will use the same arguments and same data... arg_names = 'label', 'fa', 'tr', 'T1base', 'BLpts', 'r1', 's_array', 'conc_array', 'a_tol', 'r_tol' test_data = SI2Conc_data.SI2Conc_data() # Use the test data to generate a parametrize decorator. This causes the following # test to be run for every test case listed in test_data...
40.179487
157
0.734525
bbdfc65e3dc96518486004ed92ed7315cea723ab
3,559
py
Python
src/docker_composer/runner/cmd/up.py
michascholl/docker-composer
d190f1db766e216654a4259785b9aaf802a9c64d
[ "Apache-2.0" ]
4
2021-01-18T11:35:24.000Z
2021-08-30T16:19:39.000Z
src/docker_composer/runner/cmd/up.py
michascholl/docker-composer
d190f1db766e216654a4259785b9aaf802a9c64d
[ "Apache-2.0" ]
null
null
null
src/docker_composer/runner/cmd/up.py
michascholl/docker-composer
d190f1db766e216654a4259785b9aaf802a9c64d
[ "Apache-2.0" ]
1
2022-02-19T10:38:59.000Z
2022-02-19T10:38:59.000Z
# DO NOT EDIT: Autogenerated by src/docker_composer/_utils/generate_class.py # for docker-compose version 1.25.0, build unknown from typing import List, Optional import attr from docker_composer.base import DockerBaseRunner
37.463158
83
0.680528
bbe0157ae7f26883dcb131a2958451cdb126b2d0
1,415
py
Python
app.py
hendrapaiton/mandalika
6ecbde9e3582d6532006e58531d5fc52feaa8854
[ "MIT" ]
1
2020-02-19T07:45:53.000Z
2020-02-19T07:45:53.000Z
app.py
hendrapaiton/mandalika
6ecbde9e3582d6532006e58531d5fc52feaa8854
[ "MIT" ]
1
2020-02-20T05:35:49.000Z
2020-02-26T08:14:41.000Z
app.py
hendrapaiton/mandalika
6ecbde9e3582d6532006e58531d5fc52feaa8854
[ "MIT" ]
2
2020-02-25T16:46:39.000Z
2020-02-26T09:02:06.000Z
# Import from system libraries from flask import Flask from flask_bcrypt import Bcrypt from flask_cors import CORS from flask_jwt_extended import JWTManager from flask_restful import Api # Import from application modules from errors import errors from models.User import User from models.db import initialize_db from routes.api import initialize_routes # Flask app instance with static (html, css and js) folder configuration app = Flask(__name__) # Flask Restful configuration with errors included api = Api(app, errors=errors) # Files for Configuration System in environment app.config.from_envvar('ENV_FILE_LOCATION') # BCrypt instances bcrypt = Bcrypt(app) # JWT instances jwt = JWTManager(app) # CORS enabled CORS(app) # Get roles for authenticated user # Load user identity # Database Configuration Initialization initialize_db(app) # API (Routing) Configuration Initialization initialize_routes(api) # Admin account initialization for first uses user = User.objects(username='admin@nj.net') if not user: login = User(username='admin@nj.net', password='enje123', roles=['admin']) login.hash_password() login.save() # Running Flask Application when main class executed if __name__ == '__main__': app.run()
25.727273
78
0.786572
bbe0811cc9331cc6588c71ea015afd88bed83389
509
py
Python
openapi_core/validation/util.py
erpheus/openapi-core
b37510b0e306f6819971f64106617fb116974243
[ "BSD-3-Clause" ]
null
null
null
openapi_core/validation/util.py
erpheus/openapi-core
b37510b0e306f6819971f64106617fb116974243
[ "BSD-3-Clause" ]
null
null
null
openapi_core/validation/util.py
erpheus/openapi-core
b37510b0e306f6819971f64106617fb116974243
[ "BSD-3-Clause" ]
null
null
null
"""OpenAPI core validation util module""" from yarl import URL def get_operation_pattern(server_url, request_url_pattern): """Return an updated request URL pattern with the server URL removed.""" if server_url[-1] == "/": # operations have to start with a slash, so do not remove it server_url = server_url[:-1] if URL(server_url).is_absolute(): return request_url_pattern.replace(server_url, "", 1) return URL(request_url_pattern).path_qs.replace(server_url, "", 1)
39.153846
76
0.70334
bbe19a963ebbfb67a87214650a7ef4c055ac8952
2,071
py
Python
render/model.py
kennyngod/portfoliov2
3b931c35c342bfeea18fd2d97eadc65ed57c56a7
[ "CC-BY-3.0" ]
1
2022-02-22T07:19:16.000Z
2022-02-22T07:19:16.000Z
render/model.py
kennyngod/portfoliov2
3b931c35c342bfeea18fd2d97eadc65ed57c56a7
[ "CC-BY-3.0" ]
null
null
null
render/model.py
kennyngod/portfoliov2
3b931c35c342bfeea18fd2d97eadc65ed57c56a7
[ "CC-BY-3.0" ]
null
null
null
"""Mostly helper functions to help with the driver.""" import json import os import pathlib import sqlite3 import arrow # type: ignore def sql_db(): """Open a SQL connection and perform a query.""" db_path = pathlib.Path(os.getcwd()) db_path = pathlib.Path(db_path/'sql'/'portfolio.sqlite3') con = sqlite3.connect(str(db_path)) cur = con.cursor() skills = cur.execute( "SELECT * " "FROM skills " "ORDER BY meter DESC" ) skills = cur.fetchall() con.close() return skills def create_json(): """Create a context JSON file to render to jinja.""" skills_db = sql_db() skills = [] for skill_db in skills_db: skill = {} skill['language'] = skill_db[0] skill['time'] = get_time(skill_db[1]) skill['proficiency'] = skill_db[2] skill['meter'] = skill_db[3] skill['description'] = skill_db[4] skill['filelink'] = skill_db[5] if skill_db[6]: skill['framework'] = skill_db[6] skills.append(skill) context = {"skills": skills} data = {"template": "index.html", "context": context} data = json.dumps(data) # write to json file path = pathlib.Path(os.getcwd()) path = str(path/'render/context.json') with open(path, 'w+', encoding='utf-8') as outfile: outfile.write(data) def get_time(db_time): """Calculate the time difference from now to start time in database.""" now = arrow.now().format("YYYY-MM-DD") arr_now = now.split('-') arr_time = db_time.split('-') time_diff = [] for time_now, time_time in zip(arr_now, arr_time): time_now = int(time_now) time_time = int(time_time) diff = abs(time_now - time_time) time_diff.append(round(diff)) # dont care about day # check year if time_diff[0] != 0: if time_diff[0] == 1: return f'{time_diff[0]} year' return f'{time_diff[0]} years' if time_diff[1] == 1: return f'{time_diff[1]} month' return f'{time_diff[1]} months'
29.169014
75
0.598262
bbe3022d59c8c55da8fc827a792032bc2f9f1ed9
1,053
py
Python
codes/exact/matStuff/lambdaFlucSparseSysRep.py
joshuahellier/PhDStuff
6fbe9e507c40e9017cde9312b0cfcc6ceefa284e
[ "MIT" ]
null
null
null
codes/exact/matStuff/lambdaFlucSparseSysRep.py
joshuahellier/PhDStuff
6fbe9e507c40e9017cde9312b0cfcc6ceefa284e
[ "MIT" ]
null
null
null
codes/exact/matStuff/lambdaFlucSparseSysRep.py
joshuahellier/PhDStuff
6fbe9e507c40e9017cde9312b0cfcc6ceefa284e
[ "MIT" ]
null
null
null
import subprocess import sys import os import math # This code is meant to manage running multiple instances of my KMCLib codes at the same time, # in the name of time efficiency numLambda = 256 sysSize = 5 numVecs = 1 dataLocation = "exactSolns/thesisCorrections/low" lambdaMin = 10.0**(-4) lambdaMax = 10.0**(4) rateStepSize = (lambdaMax-lambdaMin)/float(numLambda-1) jobIndex = 513 botConc = 0.3 topConc = 0.1 boundMult = 1000.0 tolerance = 10.0**(-18) runningJobs = [] for rateIndex in range(0, numLambda): tempRate = lambdaMin + rateStepSize*rateIndex # currentRate = tempRate currentRate = math.exp(((tempRate-lambdaMin)*math.log(lambdaMax)+(lambdaMax-tempRate)*math.log(lambdaMin))/(lambdaMax-lambdaMin)) jobInput = "simpleGroundStateFinder.py "+str(botConc)+" "+str(topConc)+" "+str(currentRate)+" "+str(sysSize)+" "+str(numVecs)+" "+str(boundMult)+" "+str(tolerance)+" "+str(1)+" "+dataLocation+str(rateIndex)+"\n" with open("jobInputs/testInput."+str(jobIndex), 'w') as f: f.write(jobInput) jobIndex += 1
33.967742
215
0.706553
bbe30cef5cf3479058d3d846d89799afd1e7069c
3,997
py
Python
lib/galaxy/webapps/tool_shed/util/shed_statistics.py
bopopescu/phyG
023f505b705ab953f502cbc55e90612047867583
[ "CC-BY-3.0" ]
2
2016-02-23T00:09:14.000Z
2019-02-11T07:48:44.000Z
lib/galaxy/webapps/tool_shed/util/shed_statistics.py
bopopescu/phyG
023f505b705ab953f502cbc55e90612047867583
[ "CC-BY-3.0" ]
null
null
null
lib/galaxy/webapps/tool_shed/util/shed_statistics.py
bopopescu/phyG
023f505b705ab953f502cbc55e90612047867583
[ "CC-BY-3.0" ]
6
2015-05-27T13:09:50.000Z
2019-02-11T07:48:46.000Z
from time import strftime, gmtime
49.345679
131
0.536652
bbe3888f6e45c812298b82e8ac836a9bd58f2e7b
2,461
py
Python
lib/helpertools/helpertools/geometry.py
aws-samples/amazon-textract-large-scale-selectable-pdf
e62b1c5ed79c02008783bc1361d70f0b5b69e0b7
[ "MIT-0" ]
4
2022-01-12T15:30:54.000Z
2022-02-28T22:12:17.000Z
lib/helpertools/helpertools/geometry.py
aws-samples/amazon-textract-large-scale-selectable-pdf
e62b1c5ed79c02008783bc1361d70f0b5b69e0b7
[ "MIT-0" ]
null
null
null
lib/helpertools/helpertools/geometry.py
aws-samples/amazon-textract-large-scale-selectable-pdf
e62b1c5ed79c02008783bc1361d70f0b5b69e0b7
[ "MIT-0" ]
2
2021-10-24T01:43:12.000Z
2022-01-21T20:14:33.000Z
''' ''' from typing import Dict, Optional # classes # ------- # overload methods def __getitem__(self, key): return self.bounds[key] def __setitem__(self, key, value): self.bounds[key] = value # getters
30.7625
90
0.604632
bbe58ee718d54a29743fdde56951e945cc81bce6
378
py
Python
examples/chart-types/pie_chart.py
tcbegley/dash-google-charts
b8b22e5b6bac533167f218e3610697dec0c3e4ca
[ "Apache-2.0" ]
6
2019-01-23T17:37:09.000Z
2020-11-17T16:12:27.000Z
examples/chart-types/pie_chart.py
tcbegley/dash-google-charts
b8b22e5b6bac533167f218e3610697dec0c3e4ca
[ "Apache-2.0" ]
9
2019-01-25T11:09:17.000Z
2022-02-26T09:10:04.000Z
examples/chart-types/pie_chart.py
tcbegley/dash-google-charts
b8b22e5b6bac533167f218e3610697dec0c3e4ca
[ "Apache-2.0" ]
1
2019-01-23T17:37:12.000Z
2019-01-23T17:37:12.000Z
import dash from dash_google_charts import PieChart app = dash.Dash() app.layout = PieChart( height="500px", data=[ ["Task", "Hours per Day"], ["Work", 11], ["Eat", 2], ["Commute", 2], ["Watch TV", 2], ["Sleep", 7], ], options={"title": "My Daily Activities"}, ) if __name__ == "__main__": app.run_server()
18
45
0.518519
bbe8dbb33350754634ad5a39bc45f35bec1cec43
4,183
py
Python
threats-monitoring/modules/thehive.py
filippostz/McAfee-MVISION-EDR-Integrations
0fbe1af15f844b796337ccd2ff219a0c4e625846
[ "Apache-2.0" ]
null
null
null
threats-monitoring/modules/thehive.py
filippostz/McAfee-MVISION-EDR-Integrations
0fbe1af15f844b796337ccd2ff219a0c4e625846
[ "Apache-2.0" ]
null
null
null
threats-monitoring/modules/thehive.py
filippostz/McAfee-MVISION-EDR-Integrations
0fbe1af15f844b796337ccd2ff219a0c4e625846
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python3 # Written by mohlcyber v.0.1 (15.04.2020) # Edited by filippostz v.0.2 (24.09.2021) import random import sys import socket import requests import json import re import smtplib from datetime import datetime from urllib.parse import urljoin from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart #Used for comments in Cases and Email EDR_URL = 'https://ui.soc.eu-central-1.mcafee.com/monitoring/'
41.83
127
0.531198
bbe9079acec9fc7d47c390d5c89d9f262c9f1f50
518
py
Python
src/config.py
psu-os-rss/Rock-Paper-and-Scissors
05e9f51978cae1f05c9f06a71d9822ccfedbc5e1
[ "MIT" ]
null
null
null
src/config.py
psu-os-rss/Rock-Paper-and-Scissors
05e9f51978cae1f05c9f06a71d9822ccfedbc5e1
[ "MIT" ]
6
2020-08-03T20:55:44.000Z
2020-08-13T22:03:13.000Z
src/config.py
psu-os-rss/Rock-Paper-and-Scissors
05e9f51978cae1f05c9f06a71d9822ccfedbc5e1
[ "MIT" ]
null
null
null
#parameters accumulated_weight = 0.5 detector_u = 50 detector_b = 350 detector_r = 300 detector_l = 600 message_x = 10 message_y = 400 date_x = 0 date_y = 450 threshold_min=22 rate = 0.8 RGB_INT_MAX = 255 RGB_INT_MIN = 0 RGB_FLT_MAX = 255.0 RGB_FLT_MIN = 0.0 Blur_value = 7 text_color = (200,50,150) rectangle_color = (0,0,255) rectangle_thickness = 5 processing_frame = 35 font_scale = 0.7 thickness = 2 cv2adaptive_block = 11 cv2adaptive_param = 2 erodtime = 1 dilatetime = 2 circle_thickness = 10 circle_rate = 0.25
17.862069
27
0.758687
bbe94404de84755169d02669d387f24583e7d3f0
1,309
py
Python
ejercicios/arreglos/perimetro.py
leugimkm/Soluciones
d71601c8d9b5e86e926f48d9e49462af8a956b6d
[ "MIT" ]
1
2022-02-02T04:44:56.000Z
2022-02-02T04:44:56.000Z
ejercicios/arreglos/perimetro.py
leugimkm/Soluciones
d71601c8d9b5e86e926f48d9e49462af8a956b6d
[ "MIT" ]
null
null
null
ejercicios/arreglos/perimetro.py
leugimkm/Soluciones
d71601c8d9b5e86e926f48d9e49462af8a956b6d
[ "MIT" ]
null
null
null
"""AyudaEnPython: https://www.facebook.com/groups/ayudapython Genere una matriz de 25 x 40 con nmeros decimales al azar entre 0 y 1. Mostrar los numeros del perimetro y calcularlo. """ from random import random from prototools import show_matrix def solver_a(): """ >>> solver_a() [1, 2, 3, 4, 5, 16, 17, 18, 19, 20, 6, 11, 10, 15] 147 """ #arr = [[random() for _ in range(40)] for _ in range(25)] arr = [ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], ] r_arr = list(map(list, zip(*arr))) perimetro = [*arr[0], *arr[-1], *r_arr[0][1:-1], *r_arr[-1][1:-1]] print(perimetro) print(sum(perimetro)) if __name__ == "__main__": import doctest doctest.testmod() # solver_a() # solver_b()
23.375
71
0.50573
bbec33adffc946520b52f5157928147efe6188be
5,941
py
Python
HIS_void/rbac/admin.py
YuanchenZhu2020/HIS_void
7289bf537e9fc4b09750bbca76a4cc8354dc770f
[ "MIT" ]
null
null
null
HIS_void/rbac/admin.py
YuanchenZhu2020/HIS_void
7289bf537e9fc4b09750bbca76a4cc8354dc770f
[ "MIT" ]
null
null
null
HIS_void/rbac/admin.py
YuanchenZhu2020/HIS_void
7289bf537e9fc4b09750bbca76a4cc8354dc770f
[ "MIT" ]
null
null
null
from django import forms from django.contrib import admin from django.contrib.auth.models import Group from django.contrib.auth.admin import UserAdmin as BaseUserAdmin from django.contrib.auth.forms import ReadOnlyPasswordHashField from django.utils.translation import gettext_lazy as _ from .models import ( ObjectPermission, URLPermission, UserGroup, UserInfo, Role, LoginLog ) admin.site.register(UserInfo, UserAdmin) admin.site.unregister(Group) admin.site.register(UserGroup, UserGroupAdmin) admin.site.register(URLPermission, URLPermissionAdmin) admin.site.register(ObjectPermission, ObjectPermissionAdmin) admin.site.register(Role, RoleAdmin) admin.site.register(LoginLog, LoginLogAdmin)
32.113514
96
0.56068
bbec39b874803a9ced574ab89af24276b12b55c2
4,698
py
Python
process.py
bisi-dev/wa-analytics
a657fd793a59fa551d5755877c4e6c814bc3d17c
[ "Apache-2.0" ]
1
2022-01-09T21:57:56.000Z
2022-01-09T21:57:56.000Z
process.py
bisi-dev/wa-analytics
a657fd793a59fa551d5755877c4e6c814bc3d17c
[ "Apache-2.0" ]
null
null
null
process.py
bisi-dev/wa-analytics
a657fd793a59fa551d5755877c4e6c814bc3d17c
[ "Apache-2.0" ]
null
null
null
# import modules import os import re import glob import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from wordcloud import WordCloud
29.923567
79
0.561303
bbece8b4d9743d75c14096162d201bda457080e8
2,857
py
Python
server/rdp.py
husmen/Trajectory-Mapping
215d5a2c58482b7ddb168a50dd02c59ba285c8bd
[ "MIT" ]
2
2019-08-06T07:28:45.000Z
2020-05-31T14:41:40.000Z
server/rdp.py
husmen/Trajectory-Mapping
215d5a2c58482b7ddb168a50dd02c59ba285c8bd
[ "MIT" ]
null
null
null
server/rdp.py
husmen/Trajectory-Mapping
215d5a2c58482b7ddb168a50dd02c59ba285c8bd
[ "MIT" ]
1
2019-01-07T10:14:50.000Z
2019-01-07T10:14:50.000Z
#!/usr/bin/python3 """ rdp Python implementation of the Ramer-Douglas-Peucker algorithm. """ import sys import numpy as np #from math import sqrt #from functools import partial from math import radians, cos, sin, asin, sqrt if sys.version_info[0] >= 3: xrange = range def pl_dist(point, start, end): """ Calculates the distance from ``point`` to the line given by the points ``start`` and ``end``. :param point: a point :type point: numpy array :param start: a point of the line :type start: numpy array :param end: another point of the line :type end: numpy array """ if np.all(np.equal(start, end)): return np.linalg.norm(point - start) return np.divide( np.abs(np.linalg.norm(np.cross(end - start, start - point))), np.linalg.norm(end - start)) def rdp_rec(M, epsilon, dist=pl_dist): """ Simplifies a given array of points. Recursive version. :param M: an array :type M: numpy array :param epsilon: epsilon in the rdp algorithm :type epsilon: float :param dist: distance function :type dist: function with signature ``f(point, start, end)`` -- see :func:`rdp.pl_dist` """ dmax = 0.0 index = -1 for i in xrange(1, M.shape[0]): d = dist(M[i], M[0], M[-1]) if d > dmax: index = i dmax = d if dmax > epsilon: r_1 = rdp_rec(M[:index + 1], epsilon, dist) r_2 = rdp_rec(M[index:], epsilon, dist) return np.vstack((r_1[:-1], r_2)) else: return np.vstack((M[0], M[-1])) def rdp(M, epsilon=0, dist=pl_dist): """ Simplifies a given array of points using the Ramer-Douglas-Peucker algorithm. Example: >>> from rdp import rdp >>> rdp([[1, 1], [2, 2], [3, 3], [4, 4]]) [[1, 1], [4, 4]] This is a convenience wrapper around :func:`rdp.rdp_rec` that detects if the input is a numpy array in order to adapt the output accordingly. This means that when it is called using a Python list as argument, a Python list is returned, and in case of an invocation using a numpy array, a NumPy array is returned. Example: >>> from rdp import rdp >>> import numpy as np >>> arr = np.array([1, 1, 2, 2, 3, 3, 4, 4]).reshape(4, 2) >>> arr array([[1, 1], [2, 2], [3, 3], [4, 4]]) :param M: a series of points :type M: numpy array with shape (n,d) where n is the number of points and d their dimension :param epsilon: epsilon in the rdp algorithm :type epsilon: float :param dist: distance function :type dist: function with signature ``f(point, start, end)`` -- see :func:`rdp.pl_dist` """ if "numpy" in str(type(M)): return rdp_rec(M, epsilon, dist) return rdp_rec(np.array(M), epsilon, dist).tolist()
26.453704
95
0.60098
bbed6bb7a92a7f22be0a1cdd4bf174a34f7f4719
7,655
py
Python
tests/Monkeypatching/test_Api_monkeypatching_api_get_by_id.py
LudwikaMalinowska/Automated-Testing-Project2
f0868700af8d6b946768d67b3c1768c2447f1a60
[ "MIT" ]
null
null
null
tests/Monkeypatching/test_Api_monkeypatching_api_get_by_id.py
LudwikaMalinowska/Automated-Testing-Project2
f0868700af8d6b946768d67b3c1768c2447f1a60
[ "MIT" ]
null
null
null
tests/Monkeypatching/test_Api_monkeypatching_api_get_by_id.py
LudwikaMalinowska/Automated-Testing-Project2
f0868700af8d6b946768d67b3c1768c2447f1a60
[ "MIT" ]
null
null
null
import unittest import requests from assertpy import assert_that from requests.exceptions import Timeout from unittest.mock import Mock, patch from src.Api import Api from src.todos import todos if __name__ == '__main__': unittest.main()
44.248555
119
0.678903
bbed960d66995a862622a4fef9dc7cece3c6c141
361
py
Python
spark_auto_mapper_fhir/generator/test_generator_get_types_for_codeable_concepts.py
imranq2/SparkAutoMapper.FHIR
dd23b218fb0097d1edc2f3e688e8d6d4d7278bd2
[ "Apache-2.0" ]
1
2020-10-31T23:25:07.000Z
2020-10-31T23:25:07.000Z
spark_auto_mapper_fhir/generator/test_generator_get_types_for_codeable_concepts.py
icanbwell/SparkAutoMapper.FHIR
98f368e781b46523142c7cb513c670d659a93c9b
[ "Apache-2.0" ]
null
null
null
spark_auto_mapper_fhir/generator/test_generator_get_types_for_codeable_concepts.py
icanbwell/SparkAutoMapper.FHIR
98f368e781b46523142c7cb513c670d659a93c9b
[ "Apache-2.0" ]
null
null
null
from typing import List from spark_auto_mapper_fhir.generator.fhir_xml_schema_parser import ( FhirXmlSchemaParser, FhirCodeableType, )
24.066667
69
0.772853
bbed9aef40b38f60b39c83a06b6bc7dda41d6fe6
3,112
py
Python
hard-gists/6572592/snippet.py
jjhenkel/dockerizeme
eaa4fe5366f6b9adf74399eab01c712cacaeb279
[ "Apache-2.0" ]
21
2019-07-08T08:26:45.000Z
2022-01-24T23:53:25.000Z
hard-gists/6572592/snippet.py
jjhenkel/dockerizeme
eaa4fe5366f6b9adf74399eab01c712cacaeb279
[ "Apache-2.0" ]
5
2019-06-15T14:47:47.000Z
2022-02-26T05:02:56.000Z
hard-gists/6572592/snippet.py
jjhenkel/dockerizeme
eaa4fe5366f6b9adf74399eab01c712cacaeb279
[ "Apache-2.0" ]
17
2019-05-16T03:50:34.000Z
2021-01-14T14:35:12.000Z
#!/usr/bin/env python # Lastfm loved tracks to Google Music All Access playlist. As noted in the comments you do need the All Access subscription thing otherwise it will always find 0 songs. # # Written by Tim Hutt, tdhutt@gmail.com, based on this script: # # https://gist.github.com/oquno/3664731 # # Today is the 15th of September 2013. # # Not really tested! # # Update on 20th of September 2016: # # * Changed login API to match gmusicapi (not tested at all) # # Instructions: # # 0. Install python and pip. # 1. Download this to a file `lastfm_to_gmusic.py` # 2. Make it executable: `chmod +x lastfm_to_gmusic.py` # 3. Install `gmusicapi` using `pip`: `pip install gmusicapi` # 4. Get a last.fm API key here: http://www.last.fm/api/account/create # 5. Run it! `./lastfm_to_gmusic.py`. # # Troubleshooting: # # 1. It says "Login error": Go to your gmail and check that it didn't block any "suspicious logins". # 2. It doesn't find any tracks: Update gmusicapi. # 3. Something else: Email me. There's a small chance I'll reply. # # import urllib, urllib2 import gmusicapi from xml.etree.ElementTree import * if __name__ == '__main__': main()
31.12
168
0.645566
bbee0d1262c642ad50187e5394e6ab5c37bd528f
5,560
py
Python
tests/algorithms/test_gail.py
sony/nnabla-rl
6a9a91ac5363b8611e0c9f736590729952a8d460
[ "Apache-2.0" ]
75
2021-06-14T02:35:19.000Z
2022-03-23T04:30:24.000Z
tests/algorithms/test_gail.py
sony/nnabla-rl
6a9a91ac5363b8611e0c9f736590729952a8d460
[ "Apache-2.0" ]
2
2021-12-17T08:46:54.000Z
2022-03-15T02:04:53.000Z
tests/algorithms/test_gail.py
sony/nnabla-rl
6a9a91ac5363b8611e0c9f736590729952a8d460
[ "Apache-2.0" ]
3
2021-06-15T13:32:57.000Z
2022-03-25T16:53:14.000Z
# Copyright 2021 Sony Corporation. # Copyright 2021 Sony Group Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import numpy as np import pytest import nnabla as nn import nnabla_rl.algorithms as A import nnabla_rl.environments as E from nnabla_rl.replay_buffer import ReplayBuffer if __name__ == "__main__": from testing_utils import EpisodicEnv, generate_dummy_experiences pytest.main() else: from ..testing_utils import EpisodicEnv, generate_dummy_experiences
37.823129
77
0.673561