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
dfcfba95af54686ffe34f16d2ea3725de4ec6aa5
1,561
py
Python
scripts/api-timeboard.py
ryhennessy/hiring-engineers
f151fb593a016b38b92767ce48d217c3d57c492a
[ "Apache-2.0" ]
null
null
null
scripts/api-timeboard.py
ryhennessy/hiring-engineers
f151fb593a016b38b92767ce48d217c3d57c492a
[ "Apache-2.0" ]
null
null
null
scripts/api-timeboard.py
ryhennessy/hiring-engineers
f151fb593a016b38b92767ce48d217c3d57c492a
[ "Apache-2.0" ]
1
2019-02-06T00:09:36.000Z
2019-02-06T00:09:36.000Z
#!/usr/bin/python from datadog import initialize, api options = { 'api_key': '17370fa45ebc4a8184d3dde9f8189c38', 'app_key': 'b0d652bbd1d861656723c1a93bc1a2f22d493d57' } initialize(**options) title = "Ryan Great Timeboard" description = "My Timeboard that is super awesome" graphs = [ { "title": "My Metric over my host", "definition": { "requests": [ { "q": "avg:my_metric{host:secondaryhost.hennvms.net}", "type": "line", "style": { "palette": "dog_classic", "type": "solid", "width": "normal" }, "conditional_formats": [], "aggregator": "avg" } ], "autoscale": "true", "viz": "timeseries" } }, { "title": "MySQL Anomaly Function Applied", "definition": { "viz": "timeseries", "requests": [ { "q": "anomalies(avg:mysql.performance.user_time{*}, 'basic', 2)", "type": "line", "style": { "palette": "dog_classic", "type": "solid", "width": "normal" }, "conditional_formats": [], "aggregator": "avg" } ], "autoscale": "true" } }, { "title": "My Metric Rollup Function", "definition": { "viz": "query_value", "requests": [ { "q": "avg:my_metric{*}.rollup(sum, 60)", "type": "line", "style": { "palette": "dog_classic", "type": "solid", "width": "normal" }, "conditional_formats": [], "aggregator": "avg" } ], "autoscale": "true" } }] api.Timeboard.create(title=title, description=description, graphs=graphs)
20.539474
73
0.547726
dfd10fcf278a06e3edb0f59aed0bddac1ebc200d
732
py
Python
Playground/Spin.py
fountainment/cherry-soda
3dd0eb7d0b5503ba572ff2104990856ef7a87495
[ "MIT" ]
27
2020-01-16T08:20:54.000Z
2022-03-29T20:40:15.000Z
Playground/Spin.py
fountainment/cherry-soda
3dd0eb7d0b5503ba572ff2104990856ef7a87495
[ "MIT" ]
10
2022-01-07T14:07:27.000Z
2022-03-19T18:13:44.000Z
Playground/Spin.py
fountainment/cherry-soda
3dd0eb7d0b5503ba572ff2104990856ef7a87495
[ "MIT" ]
6
2019-12-27T10:04:07.000Z
2021-12-15T17:29:24.000Z
import numpy as np import math import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D if __name__ == '__main__': main()
23.612903
49
0.579235
dfd2a91be88a84783b35bd946e501cc258160953
1,911
py
Python
bin/get_latest_rotation.py
rhots/automation
cfa97656885f4ff91e1c79af5eb8fa38a85c35a8
[ "0BSD" ]
1
2017-06-06T03:07:01.000Z
2017-06-06T03:07:01.000Z
bin/get_latest_rotation.py
rhots/automation
cfa97656885f4ff91e1c79af5eb8fa38a85c35a8
[ "0BSD" ]
3
2016-12-19T21:09:53.000Z
2017-02-14T03:32:18.000Z
bin/get_latest_rotation.py
rhots/automation
cfa97656885f4ff91e1c79af5eb8fa38a85c35a8
[ "0BSD" ]
null
null
null
import os.path from bs4 import BeautifulSoup import requests # Location of file to store latest known page number LAST_KNOWN_PAGE_FILE = "/tmp/rotation_checker_latest" # URL of forum thread where latest rotations are posted ROTATION_FORUM_THREAD = "https://us.battle.net/forums/en/heroes/topic/17936383460" if __name__ == "__main__": # read last known page number if we have it last_known = read_last_known_page() # load latest page, starting from last known page number resp = load_latest_page(last_known) # extract date and hero rotation date, heroes = rotation_info_from_source(resp.text) # write latest page number for future page_num = int(resp.url.split("=")[-1]) write_last_known_page(page_num) print(date) print(heroes)
27.695652
85
0.697541
dfd2e5bbf8ec59072195c98d519d767f6b535cb9
2,485
py
Python
fidelis/credentials.py
semperstew/fidelis
8766b1bfa5bac342faf61bf4302a0e822d0a0ec9
[ "Apache-2.0" ]
null
null
null
fidelis/credentials.py
semperstew/fidelis
8766b1bfa5bac342faf61bf4302a0e822d0a0ec9
[ "Apache-2.0" ]
null
null
null
fidelis/credentials.py
semperstew/fidelis
8766b1bfa5bac342faf61bf4302a0e822d0a0ec9
[ "Apache-2.0" ]
null
null
null
# fidelis/credentials.py import datetime import requests import threading from dateutil.tz import tzlocal from collections import namedtuple def _is_expired(self): """Check if token is expired""" return self._refresh_needed(refresh_in=0) def _protected_refresh(self): """Refresh bearer token""" url= self.baseURL + 'authenticate' body={'username': self._username, 'password': self._password} headers={'Content-Type':'application/json'} verify=self._ignoressl r = requests.post(url=url, headers=headers, json=body, verify=verify) self._token = r.data['token'] self._update_expiration() def _seconds_remaining(self): """Calculate remaining seconds until token expiration""" delta = self._expiration - self._time_fetcher() return delta.total_seconds()
25.10101
79
0.695775
dfd45fc42c8fe07d08d4459f4ff51b022c580213
6,254
py
Python
pos_wechat/tests/test_wechat_order.py
nahualventure/pos-addons
3c911c28c259967fb74e311ddcc8e6ca032c005d
[ "MIT" ]
null
null
null
pos_wechat/tests/test_wechat_order.py
nahualventure/pos-addons
3c911c28c259967fb74e311ddcc8e6ca032c005d
[ "MIT" ]
null
null
null
pos_wechat/tests/test_wechat_order.py
nahualventure/pos-addons
3c911c28c259967fb74e311ddcc8e6ca032c005d
[ "MIT" ]
3
2021-06-15T05:45:42.000Z
2021-07-27T12:28:53.000Z
# Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> # License MIT (https://opensource.org/licenses/MIT). import logging from odoo.addons.point_of_sale.tests.common import TestPointOfSaleCommon try: from unittest.mock import patch except ImportError: from mock import patch _logger = logging.getLogger(__name__) DUMMY_AUTH_CODE = "134579302432164181" DUMMY_POS_ID = 1
35.942529
88
0.512312
dfd6670490ad28a09d2ea2ea84c8564b4b85c4b8
582
py
Python
docker/settings.py
uw-it-aca/course-roster-lti
599dad70e06bc85d3d862116c00e8ecf0e2e9c8c
[ "Apache-2.0" ]
null
null
null
docker/settings.py
uw-it-aca/course-roster-lti
599dad70e06bc85d3d862116c00e8ecf0e2e9c8c
[ "Apache-2.0" ]
53
2017-01-28T00:03:57.000Z
2022-03-23T21:57:13.000Z
docker/settings.py
uw-it-aca/course-roster-lti
599dad70e06bc85d3d862116c00e8ecf0e2e9c8c
[ "Apache-2.0" ]
null
null
null
from .base_settings import * INSTALLED_APPS += [ 'course_roster.apps.CourseRosterConfig', 'compressor', ] COMPRESS_ROOT = '/static/' COMPRESS_PRECOMPILERS = (('text/less', 'lessc {infile} {outfile}'),) COMPRESS_OFFLINE = True STATICFILES_FINDERS += ('compressor.finders.CompressorFinder',) if os.getenv('ENV', 'localdev') == 'localdev': DEBUG = True RESTCLIENTS_DAO_CACHE_CLASS = None else: RESTCLIENTS_DAO_CACHE_CLASS = 'course_roster.cache.IDCardPhotoCache' COURSE_ROSTER_PER_PAGE = 50 IDCARD_PHOTO_EXPIRES = 60 * 60 * 2 IDCARD_TOKEN_EXPIRES = 60 * 60 * 2
26.454545
72
0.735395
dfd9ba7258d16727355e98f49f13d4ad3a7818cc
606
py
Python
pylons/decorators/util.py
KinSai1975/Menira.py
ca275ce244ee4804444e1827ba60010a55acc07c
[ "BSD-3-Clause" ]
118
2015-01-04T06:55:14.000Z
2022-01-14T08:32:41.000Z
pylons/decorators/util.py
KinSai1975/Menira.py
ca275ce244ee4804444e1827ba60010a55acc07c
[ "BSD-3-Clause" ]
21
2015-01-03T02:16:28.000Z
2021-03-24T06:10:57.000Z
pylons/decorators/util.py
KinSai1975/Menira.py
ca275ce244ee4804444e1827ba60010a55acc07c
[ "BSD-3-Clause" ]
53
2015-01-04T03:21:08.000Z
2021-08-04T20:52:01.000Z
"""Decorator internal utilities""" import pylons from pylons.controllers import WSGIController def get_pylons(decorator_args): """Return the `pylons` object: either the :mod`~pylons` module or the :attr:`~WSGIController._py_object` equivalent, searching a decorator's *args for the latter :attr:`~WSGIController._py_object` is more efficient as it provides direct access to the Pylons global variables. """ if decorator_args: controller = decorator_args[0] if isinstance(controller, WSGIController): return controller._py_object return pylons
31.894737
71
0.722772
dfdcfb5c19d0b0d911ba4d7178ec8d4e8e195552
1,191
py
Python
blt_net/pcmad/config_pcmad.py
AlexD123123/BLT-net
97a06795137e0d9fc9332bbb342ad3248db7dc37
[ "Apache-2.0" ]
1
2022-01-13T07:23:52.000Z
2022-01-13T07:23:52.000Z
blt_net/pcmad/config_pcmad.py
AlexD123123/BLT-net
97a06795137e0d9fc9332bbb342ad3248db7dc37
[ "Apache-2.0" ]
null
null
null
blt_net/pcmad/config_pcmad.py
AlexD123123/BLT-net
97a06795137e0d9fc9332bbb342ad3248db7dc37
[ "Apache-2.0" ]
null
null
null
from yacs.config import CfgNode as CN def get_cfg_defaults(): """Get a yacs CfgNode object with default values for my_project.""" # Return a clone so that the defaults will not be altered # This is for the "local variable" use pattern return _C.clone() _C = CN() _C.SYSTEM = CN() _C.config_name = 'roi_config_default' _C.img_shape = [1024, 2048] _C.merge_grid_resolution = [20, 20] _C.allowed_size_arr = [[[256, 128], [256, 256], [256, 384], [256, 512]], [[384, 192], [384, 384], [384, 576], [384, 768]], [[512, 256], [512, 512], [512, 768], [512, 1024]], [[640, 320], [640, 640], [640, 960], [640, 1280]], [[768, 384], [768, 768], [768, 1152], [768, 1536]]] _C.scale_factor_arr = [1, 1.5, 2, 2.5, 3] #01.01.2020 # _C.inital_padding_arr = [[20, 40], [20, 40], [40, 40], [50, 50], [60, 60]] # _C.min_required_crop_padding_arr = [[30, 30], [30, 30], [40, 40], [50, 50], [60, 60]] #28.03.2020 _C.inital_padding_arr = [[20, 40], [20, 40], [60, 60], [60, 60], [80, 80]] _C.min_required_crop_padding_arr = [[30, 30], [30, 30], [60, 60], [60, 60], [80, 80]] _C.proposals_min_conf = 0.01
29.775
87
0.565071
dfdf748f02b9b943852a62e3f8521187d01d62ea
2,175
py
Python
app/__init__.py
muthash/Weconnect-api
d3434c99b96a911258dfb8e3ff68696a2021a64b
[ "MIT" ]
1
2018-03-15T17:08:11.000Z
2018-03-15T17:08:11.000Z
app/__init__.py
muthash/Weconnect-api
d3434c99b96a911258dfb8e3ff68696a2021a64b
[ "MIT" ]
1
2018-02-28T21:26:04.000Z
2018-03-01T07:19:05.000Z
app/__init__.py
muthash/Weconnect-api
d3434c99b96a911258dfb8e3ff68696a2021a64b
[ "MIT" ]
1
2018-03-09T03:45:22.000Z
2018-03-09T03:45:22.000Z
""" The create_app function wraps the creation of a new Flask object, and returns it after it's loaded up with configuration settings using app.config """ from flask import jsonify from flask_api import FlaskAPI from flask_cors import CORS from flask_sqlalchemy import SQLAlchemy from flask_jwt_extended import JWTManager from flask_mail import Mail from instance.config import app_config db = SQLAlchemy() jwt = JWTManager() mail = Mail() def create_app(config_name): """Function wraps the creation of a new Flask object, and returns it after it's loaded up with configuration settings """ app = FlaskAPI(__name__, instance_relative_config=True) cors = CORS(app) app.config.from_object(app_config[config_name]) app.config.from_pyfile('config.py') db.init_app(app) jwt.init_app(app) mail.init_app(app) from app.auth.views import auth from app.business.views import biz from app.reviews.views import rev from app.search.views import search from app.models import BlacklistToken app.register_blueprint(auth) app.register_blueprint(biz) app.register_blueprint(rev) app.register_blueprint(search) return app
31.521739
83
0.686897
dfdfaf2898c9221e7f4f486f5412b4e767f314f2
3,821
py
Python
tests/test_constraints.py
jayvdb/versions
951bc3fd99b6a675190f11ee0752af1d7ff5b440
[ "MIT" ]
3
2015-02-20T04:02:25.000Z
2021-04-06T14:42:21.000Z
tests/test_constraints.py
jayvdb/versions
951bc3fd99b6a675190f11ee0752af1d7ff5b440
[ "MIT" ]
1
2019-07-07T06:37:01.000Z
2019-07-07T06:37:01.000Z
tests/test_constraints.py
jayvdb/versions
951bc3fd99b6a675190f11ee0752af1d7ff5b440
[ "MIT" ]
2
2019-07-07T05:40:29.000Z
2021-04-06T14:42:23.000Z
from unittest import TestCase from versions.constraints import Constraints, merge, ExclusiveConstraints from versions.constraint import Constraint
40.221053
83
0.559016
dfe01ac7f7adb258b0362ce750c15bb90b3ecb5f
520
py
Python
run.py
bayusetiawan01/poj
9c205ce298a2b3ca0d9c00b7d4a3fd05fecf326a
[ "MIT" ]
25
2016-02-26T17:35:19.000Z
2021-08-17T10:30:14.000Z
run.py
bayusetiawan01/poj
9c205ce298a2b3ca0d9c00b7d4a3fd05fecf326a
[ "MIT" ]
5
2016-04-27T16:52:46.000Z
2021-04-24T10:06:16.000Z
run.py
bayusetiawan01/poj
9c205ce298a2b3ca0d9c00b7d4a3fd05fecf326a
[ "MIT" ]
6
2016-04-27T16:50:13.000Z
2021-04-03T06:27:41.000Z
import sys import subprocess if __name__ == "__main__": try: executable = sys.argv[1] input_filename = sys.argv[2] output_filename = sys.argv[3] tl = sys.argv[4] except IndexError: sys.exit(-1) input_file = open(input_filename, "r") output_file = open(output_filename, "w") returncode = subprocess.call(["timeout", tl, "./{}".format(executable)], stdin = input_file, stdout = output_file) print(returncode) input_file.close() output_file.close()
27.368421
118
0.634615
dfe12be6330b0968db19fa6ffe0881fb8fa8099d
1,224
py
Python
typefactory/constraints/numeric.py
stevemccartney/typefactory
75c9eb9eec9a7b9488db9cc0d06352f4fd1de1d9
[ "Apache-2.0" ]
null
null
null
typefactory/constraints/numeric.py
stevemccartney/typefactory
75c9eb9eec9a7b9488db9cc0d06352f4fd1de1d9
[ "Apache-2.0" ]
null
null
null
typefactory/constraints/numeric.py
stevemccartney/typefactory
75c9eb9eec9a7b9488db9cc0d06352f4fd1de1d9
[ "Apache-2.0" ]
null
null
null
from dataclasses import dataclass from numbers import Real from typing import Optional
20.745763
62
0.586601
dfe159b3edd0ee9b633d2a90e3ddecd214d799b8
4,580
py
Python
Version Autonome/main.py
chiudidier/ProjetBloc5
214f401e5b35bc5894ecc3d20f338762b689f2ca
[ "CC0-1.0" ]
null
null
null
Version Autonome/main.py
chiudidier/ProjetBloc5
214f401e5b35bc5894ecc3d20f338762b689f2ca
[ "CC0-1.0" ]
null
null
null
Version Autonome/main.py
chiudidier/ProjetBloc5
214f401e5b35bc5894ecc3d20f338762b689f2ca
[ "CC0-1.0" ]
null
null
null
from taquin import * from random import * from math import * #main ''' old : ancienne faon de mlanger qui correspond une manipulation du taquin. Plus coder pour les lves et pour faire des essais de profondeur montxt='012345678'# position initiale = solution montaquin=Taquin(montxt)# cration du taquin # mlange en realisant 15 coups alatoires partir de la position initiale pour garantir que la position obtenu soit bien solutionnable. while montaquin.gagnant(): montaquin.melanger(15) ''' continuer=True while continuer: ''' #old : ancienne faon de mlanger qui correspond une manipulation du taquin. Plus coder pour les lves et pour faire des essais de profondeur montxt='012345678'# position initiale = solution montaquin=Taquin(montxt)# cration du taquin # mlange en realisant 15 coups alatoires partir de la position initiale pour garantir que la position obtenu soit bien solutionnable. while montaquin.estGagnant(): montaquin.melanger(15) ''' # cration alatoire du taquin initiale, n'utiliser qu'avec IDA montxt=random_init('012345678')# position initiale cr partir d'une position alatoire mais dont la solvabilit est vrifiable montaquin=Taquin(montxt)# cration du taquin print(montaquin) # valeur arbitrairement choisie : une valeur plus grande donnera des taquins plus difficiles if nbcoup(montxt) > 8 : print('dsl nous ne pouvont pas rsoudre se taquin en un temps raisonable') else: while not montaquin.estGagnant():# boucle principale du jeu. Sort qaund le taquin est rang chemin=[] ''' #version BFS # attention ne pas utiliser cette version avec la gnration de taquin alatoire mais utiliser le mlange base de coup alatoire depuis la solution. reste=bfs(montaquin.etat)# calcul la profondeur minimum de la solution print(reste,' mouvements au moins pour terminer.')# affiche l'aide #fin version BFS ''' ''' #version DLS=BFS+DFS # attention ne pas utuiliser cette version avec la gnration de taquin alatoire mais utiliser le mlange base de coup alatoire depuis la solution. reste=bfs(montaquin.etat)# calcul la profondeur minimum de la solution dls(reste,montaquin.etat,0,chemin) #version DLS = DFS + BFS # attention ne pas utuiliser cette version avec la gnration de taquin alatoire mais utiliser le mlange base de coup alatoire depuis la solution. #fin version DLS ''' ''' #version IDS = itration d'IDS # attention ne pas utiliser cette version avec la gnration de taquin alatoire mais utiliser le mlange base de coup alatoire depuis la solution. #ids(montaquin.etat,chemin) #fin version IDS ''' ''' #version IDA calcule la profondeur minimum de la solution, les paramtres ne sont pas indispensables mais amliorent la lisibilit du code ''' ida(montaquin.etat,chemin) # cette partie est utilisable pour les version IDS, DFS et IDA print('solution = ', chemin)#affichage des differents etats de la solution print('nb coup la solution',len(chemin)) nextmove=chemin.pop() nexttaquin=Taquin(nextmove) print('meilleur coup suivant :') print(comparetaquins(montaquin,nexttaquin))#affichage du prochain coup #fin de la partie solution # enregistrement du coup du joueur move=input('\n que voulez vous jouer (h,b,d,g): ')# demande le coup jouer et applique le mouvement if move=='h': montaquin.haut() elif move=='b': montaquin.bas() elif move=='d': montaquin.droite() elif move=='g': montaquin.gauche() print(montaquin) # fin du coup du joueur print('Bravo vous avez gagn !') reponse=input('Voulez vous recommencer ? o/n : ') if reponse == 'n': continuer=False print('Au revoir')
24.491979
224
0.606332
dfe1a99576a2d37093ebe1a9717fd7144a854d6e
1,870
py
Python
bindings/python/test/test_objects.py
open-space-collective/open-space-toolkit-mathematics
4b97f97f4aaa87bff848381a3519c6f764461378
[ "Apache-2.0" ]
5
2020-05-11T02:22:05.000Z
2022-02-02T15:26:35.000Z
bindings/python/test/test_objects.py
open-space-collective/open-space-toolkit-mathematics
4b97f97f4aaa87bff848381a3519c6f764461378
[ "Apache-2.0" ]
6
2020-01-05T20:18:18.000Z
2021-10-14T09:36:44.000Z
bindings/python/test/test_objects.py
open-space-collective/open-space-toolkit-mathematics
4b97f97f4aaa87bff848381a3519c6f764461378
[ "Apache-2.0" ]
2
2020-03-05T18:18:13.000Z
2020-04-07T17:42:24.000Z
################################################################################################################################################################ # @project Open Space Toolkit Mathematics # @file bindings/python/test/test_objects.py # @author Lucas Brmond <[email protected]> # @license Apache License 2.0 ################################################################################################################################################################ import ostk.mathematics as mathematics ################################################################################################################################################################ Angle = mathematics.geometry.Angle Point2d = mathematics.geometry.d2.objects.Point Polygon2d = mathematics.geometry.d2.objects.Polygon Transformation2d = mathematics.geometry.d2.Transformation Point3d = mathematics.geometry.d3.objects.Point PointSet3d = mathematics.geometry.d3.objects.PointSet Line3d = mathematics.geometry.d3.objects.Line Ray3d = mathematics.geometry.d3.objects.Ray Segment3d = mathematics.geometry.d3.objects.Segment Plane = mathematics.geometry.d3.objects.Plane Polygon3d = mathematics.geometry.d3.objects.Polygon Cuboid = mathematics.geometry.d3.objects.Cuboid Sphere = mathematics.geometry.d3.objects.Sphere Ellipsoid = mathematics.geometry.d3.objects.Ellipsoid Transformation3d = mathematics.geometry.d3.Transformation Quaternion = mathematics.geometry.d3.transformations.rotations.Quaternion RotationVector = mathematics.geometry.d3.transformations.rotations.RotationVector RotationMatrix = mathematics.geometry.d3.transformations.rotations.RotationMatrix ################################################################################################################################################################
53.428571
160
0.535294
dfe2bc23e1d5c4fe435748a54d9f2a2f9b030af5
1,005
py
Python
twemoji/mkqrc.py
ericosur/myqt
e96f77f99442c44e51a1dbe1ee93edfa09b3db0f
[ "MIT" ]
null
null
null
twemoji/mkqrc.py
ericosur/myqt
e96f77f99442c44e51a1dbe1ee93edfa09b3db0f
[ "MIT" ]
null
null
null
twemoji/mkqrc.py
ericosur/myqt
e96f77f99442c44e51a1dbe1ee93edfa09b3db0f
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 # coding: utf-8 ''' helper to generate emoji.qrc ''' from glob import glob import sys import re def output_qrc(arr, fn='emoji.qrc') -> None: ''' emoji.qrc ''' header = '''<RCC> <qresource prefix="/">''' footer = ''' </qresource> </RCC>''' with open(fn, 'wt', encoding='utf8') as fobj: print(header, file=fobj) for f in arr: print(f' <file>{f}</file>', file=fobj) print(footer, file=fobj) print('output to:', fn) def output_list(arr, fn='parse_list/list.txt') -> None: ''' output arr ''' with open(fn, 'wt', encoding='utf8') as fobj: for f in arr: r = re.sub(r'^72x72\/(.+)\.png', r'\1', f) print(r, file=fobj) print('output to:', fn) def main() -> None: ''' main ''' arr = glob('72x72/*.png') #print('len:', len(arr)) if not arr: sys.exit(1) arr.sort() output_qrc(arr) output_list(arr) if __name__ == '__main__': main()
22.333333
57
0.528358
dfe2c5242a263720a913b48fff9c5a2c72756ddd
1,246
py
Python
Python3-StandardLibrary/Chapter16_Web03_cgi.py
anliven/Reading-Code-Learning-Python
a814cab207bbaad6b5c69b9feeb8bf2f459baf2b
[ "Apache-2.0" ]
null
null
null
Python3-StandardLibrary/Chapter16_Web03_cgi.py
anliven/Reading-Code-Learning-Python
a814cab207bbaad6b5c69b9feeb8bf2f459baf2b
[ "Apache-2.0" ]
null
null
null
Python3-StandardLibrary/Chapter16_Web03_cgi.py
anliven/Reading-Code-Learning-Python
a814cab207bbaad6b5c69b9feeb8bf2f459baf2b
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- import cgi form = cgi.FieldStorage() # FieldStorage name = form.getvalue('name', 'world') # CGIgetvalueworld print("""Content-type: text/html <html> <head> <title>Greeting Page</title> </head> <body> <h1>Hello, {}!</h1> <form action='Chapter16_Web03_cgi.py'> Change Name<input type='text' name='name'> <input type='submit' value='Submit'> </form> </body> </html> """.format(name)) # ### # HTMLCGI # # 1-cgiWebpy -3 -m http.server --cgi # 2-CGIcgi-bin # 3-http://127.0.0.1:8000/cgi-bin/Chapter16_Web03_cgi.py # 4-Hello world # # ### HTML # - HTML # - <form>action # - <input>type # # ### Web # WebCGIWeb # PythonWebhttps://wiki.python.org/moin/WebProgramming # # ### WebFlask # FlaskWeb # A simple framework for building complex web applications. # Home-page: https://www.palletsprojects.com/p/flask/ # Documentationhttp://flask.pocoo.org/docs/
28.318182
73
0.699839
dfe2c9adf24a8776a39019cdfbf8a0a54e0be58c
1,809
py
Python
predefined_values.py
kovvik/bert_reader
1b3b6a2bc29a026c64d2d7ba53ec5fabebf1f9e5
[ "MIT" ]
null
null
null
predefined_values.py
kovvik/bert_reader
1b3b6a2bc29a026c64d2d7ba53ec5fabebf1f9e5
[ "MIT" ]
null
null
null
predefined_values.py
kovvik/bert_reader
1b3b6a2bc29a026c64d2d7ba53ec5fabebf1f9e5
[ "MIT" ]
null
null
null
# https://uefi.org/sites/default/files/resources/UEFI%20Spec%202_6.pdf # N.2.2 Section Descriptor section_types = { "9876ccad47b44bdbb65e16f193c4f3db": { "name": "Processor Generic", "error_record_reference": {} }, "dc3ea0b0a1444797b95b53fa242b6e1d": { "name": "Processor Specific - IA32/X64", "error_record_reference": {} }, "e429faf13cb711d4bca70080c73c8881": { "name": "Processor Specific - IPF", "error_record_reference": {} }, "e19e3d16bc1111e49caac2051d5d46b0": { "name": "Processor Specific - ARM", "error_record_reference": {} }, "a5bc11146f644edeb8633e83ed7c83b1": { "name": "Platform Memory", "error_record_reference": {} }, "d995e954bbc1430fad91b44dcb3c6f35": { "name": "PCIe", "error_record_reference": {} }, "81212a9609ed499694718d729c8e69ed": { "name": "Firmware Error Record Reference", "error_record_reference": { "firmware_error_record_type": (0, 1, "byte"), "reserved": (1, 7, "hex"), "record_identifier": (8, 8, "hex") } }, "c57539633b844095bf78eddad3f9c9dd": { "name": "PCI/PCI-X Bus", "error_record_reference": {} }, "eb5e4685ca664769b6a226068b001326": { "name": "DMAr Generic", "error_record_reference": {} }, "71761d3732b245cda7d0b0fedd93e8cf": { "name": "Intel VT for Directed I/O specific DMAr section", "error_record_reference": {} }, "036f84e17f37428ca79e575fdfaa84ec": { "name": "IOMMU specific DMAr section", "error_record_reference": {} } } error_severity = [ "Recoverable (also called non-fatal uncorrected)", "Fatal", "Corrected", "Informational" ]
29.177419
70
0.599779
dfe30fcd6927ef89f0f16539956bef3a4837e607
1,336
py
Python
tests/filestack_helpers_test.py
SanthoshBala18/filestack-python
db55f3a27a4d073e1ba33d3d09a3def8da1a25e4
[ "Apache-2.0" ]
47
2017-01-28T12:27:18.000Z
2021-07-02T16:29:04.000Z
tests/filestack_helpers_test.py
malarozi/filestack-python
7109a9c20225532c95f0204d12649137c0de01a1
[ "Apache-2.0" ]
36
2017-01-25T23:48:33.000Z
2022-01-29T22:33:12.000Z
tests/filestack_helpers_test.py
malarozi/filestack-python
7109a9c20225532c95f0204d12649137c0de01a1
[ "Apache-2.0" ]
24
2017-01-24T23:57:32.000Z
2022-01-29T22:34:34.000Z
import pytest from filestack.helpers import verify_webhook_signature
40.484848
105
0.695359
dfe42600497b94099e0a72123b092ceef56b943a
4,558
py
Python
pattern/check_multiples.py
Lostefra/TranslationCoherence
b7b09c475cc78842d9724161a8cbee372d41da08
[ "MIT" ]
null
null
null
pattern/check_multiples.py
Lostefra/TranslationCoherence
b7b09c475cc78842d9724161a8cbee372d41da08
[ "MIT" ]
null
null
null
pattern/check_multiples.py
Lostefra/TranslationCoherence
b7b09c475cc78842d9724161a8cbee372d41da08
[ "MIT" ]
null
null
null
import rdflib from rdflib.term import URIRef from utilities.utility_functions import prefix from utilities import constants # def multiple_classified(node1, node2, n, result_graph): # expressions = result_graph.subject_objects(predicate=n.differentExpression) # exprs_1, exprs_2 = [], [] # list_exprs = list(map(list, zip(*expressions))) # if list_exprs: # exprs_1, exprs_2 = list_exprs[0], list_exprs[1] # # print(f"{exprs_1}, {exprs_2}") # return any([(expr_1, n.involves_node, node1) in result_graph for expr_1 in exprs_1 + exprs_2]) or \ # any([(expr_2, n.involves_node, node2) in result_graph for expr_2 in exprs_2 + exprs_1]) # return False
54.915663
125
0.698113
dfe4a5779ee044b60ee7d70e0fc7668e972bffae
5,875
py
Python
app/main/views.py
Ammoh-Moringa/pitches
2551f2c8e323066ebdde3f92046368d7c7759fa6
[ "MIT" ]
null
null
null
app/main/views.py
Ammoh-Moringa/pitches
2551f2c8e323066ebdde3f92046368d7c7759fa6
[ "MIT" ]
null
null
null
app/main/views.py
Ammoh-Moringa/pitches
2551f2c8e323066ebdde3f92046368d7c7759fa6
[ "MIT" ]
null
null
null
from flask import render_template, request, redirect, url_for, abort from flask_login import login_required, current_user from . forms import PitchForm, CommentForm, CategoryForm from .import main from .. import db from ..models import User, Pitch, Comments, PitchCategory, Votes #display categories on the landing page #Route for adding a new pitch #view single pitch alongside its comments #adding a comment #Routes upvoting/downvoting pitches
30.759162
116
0.683574
dfe61cbf2bb3b5a52f9141b8b81d778c054609e4
10,299
py
Python
networks/classes/centernet/models/ModelCenterNet.py
ALIENK9/Kuzushiji-recognition
a18c1fbfa72b6bbbcfe4004148cd0e90531acf6b
[ "MIT" ]
2
2019-09-15T08:52:38.000Z
2019-09-15T08:58:58.000Z
networks/classes/centernet/models/ModelCenterNet.py
MatteoRizzo96/CognitiveServices
a5efeb8f585ae2ee0465ab25e587c4db0e2b32b3
[ "MIT" ]
null
null
null
networks/classes/centernet/models/ModelCenterNet.py
MatteoRizzo96/CognitiveServices
a5efeb8f585ae2ee0465ab25e587c4db0e2b32b3
[ "MIT" ]
2
2020-11-06T07:29:56.000Z
2020-11-06T07:33:27.000Z
import glob import os import pandas as pd from tensorflow.python.keras.preprocessing.image import ImageDataGenerator from typing import Dict, List, Union, Tuple import numpy as np import tensorflow as tf from tensorflow.python.keras.callbacks import ModelCheckpoint, TensorBoard, LearningRateScheduler from networks.classes.centernet.datasets.ClassificationDataset import ClassificationDataset
40.869048
108
0.556656
dfe9372c929b790c9a52b80b77bdd70cddddba45
187
py
Python
problem1.py
bakwc/PyCodeMonkey
32ea3a8947133ee9f96bea269a5dfd7a5b264ac1
[ "MIT" ]
null
null
null
problem1.py
bakwc/PyCodeMonkey
32ea3a8947133ee9f96bea269a5dfd7a5b264ac1
[ "MIT" ]
null
null
null
problem1.py
bakwc/PyCodeMonkey
32ea3a8947133ee9f96bea269a5dfd7a5b264ac1
[ "MIT" ]
null
null
null
# find fibonacci number
15.583333
24
0.561497
dfea1cd7528525e57a90decbb00e4b3b1963212b
4,114
py
Python
tests/web/test_show_image.py
AndrewLorente/catsnap
57427b8f61ef5185a41e49d55ffd7dd328777834
[ "MIT" ]
5
2015-11-23T18:40:00.000Z
2019-03-22T06:54:04.000Z
tests/web/test_show_image.py
AndrewLorente/catsnap
57427b8f61ef5185a41e49d55ffd7dd328777834
[ "MIT" ]
5
2016-04-07T15:35:53.000Z
2019-02-10T23:00:32.000Z
tests/web/test_show_image.py
AndrewLorente/catsnap
57427b8f61ef5185a41e49d55ffd7dd328777834
[ "MIT" ]
2
2015-12-02T16:44:05.000Z
2017-09-29T23:17:33.000Z
from __future__ import unicode_literals import json from tests import TestCase, with_settings from nose.tools import eq_ from catsnap import Client from catsnap.table.image import Image, ImageResize from catsnap.table.album import Album
39.557692
101
0.59018
dfec725778cb5fb317db1061f7feba9a3d3f7b10
554
py
Python
tests/test_imgs2bw.py
antsfamily/improc
ceab171b0e61187fa2ced7c58540d5ffde79ebac
[ "MIT" ]
2
2019-09-29T08:43:31.000Z
2022-01-12T09:46:18.000Z
tests/test_imgs2bw.py
antsfamily/improc
ceab171b0e61187fa2ced7c58540d5ffde79ebac
[ "MIT" ]
null
null
null
tests/test_imgs2bw.py
antsfamily/improc
ceab171b0e61187fa2ced7c58540d5ffde79ebac
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2018-07-04 09:43:51 # @Author : Zhi Liu ([email protected]) # @Link : http://iridescent.ink # @Version : $1.1$ import matplotlib.cm as cm from matplotlib import pyplot as plt import improc as imp datafolder = '/mnt/d/DataSets/oi/nsi/classical/' imgspathes = [ datafolder + 'BaboonRGB.bmp', datafolder + 'LenaRGB.bmp', ] print(imgspathes) bws = imp.imgs2bw(imgspathes, 50) print(bws.dtype, bws.shape) print(bws) plt.figure() plt.imshow(bws[:, :, :, 0], cm.gray) plt.show()
19.103448
48
0.658845
dfec78daa3bbf2130e5e79b3fbc047fcd7c950b3
764
py
Python
Un4/Un4.py
tonypithony/forktinypythonprojectsscripts
3dae818c822ee7de6de021e9f46d02bfe05f7355
[ "MIT" ]
null
null
null
Un4/Un4.py
tonypithony/forktinypythonprojectsscripts
3dae818c822ee7de6de021e9f46d02bfe05f7355
[ "MIT" ]
null
null
null
Un4/Un4.py
tonypithony/forktinypythonprojectsscripts
3dae818c822ee7de6de021e9f46d02bfe05f7355
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 """Jump the Five""" import argparse # -------------------------------------------------- # -------------------------------------------------- if __name__ == '__main__': main() # $ ./Un4.py 867-5309 # 243-0751 # $ ./Un4.py 'Call 1-800-329-8044 today!' # Call 9-255-781-2566 today!
25.466667
64
0.522251
dfed59a42f4a11efd34b43e01fd5f7beba8d46b6
169
py
Python
tests/web_platform/css_grid_1/abspos/test_grid_positioned_items_gaps.py
jonboland/colosseum
cbf974be54fd7f6fddbe7285704cfaf7a866c5c5
[ "BSD-3-Clause" ]
71
2015-04-13T09:44:14.000Z
2019-03-24T01:03:02.000Z
tests/web_platform/css_grid_1/abspos/test_grid_positioned_items_gaps.py
jonboland/colosseum
cbf974be54fd7f6fddbe7285704cfaf7a866c5c5
[ "BSD-3-Clause" ]
35
2019-05-06T15:26:09.000Z
2022-03-28T06:30:33.000Z
tests/web_platform/css_grid_1/abspos/test_grid_positioned_items_gaps.py
jonboland/colosseum
cbf974be54fd7f6fddbe7285704cfaf7a866c5c5
[ "BSD-3-Clause" ]
139
2015-05-30T18:37:43.000Z
2019-03-27T17:14:05.000Z
from tests.utils import W3CTestCase
28.166667
82
0.804734
dff0a891ee94445188ef897fe40edf7b03e0dcdf
18
py
Python
src/__init__.py
PMantovani/pympu6050
bab4e680d700d9ad62855958cdb93feaaa16060c
[ "MIT" ]
null
null
null
src/__init__.py
PMantovani/pympu6050
bab4e680d700d9ad62855958cdb93feaaa16060c
[ "MIT" ]
null
null
null
src/__init__.py
PMantovani/pympu6050
bab4e680d700d9ad62855958cdb93feaaa16060c
[ "MIT" ]
null
null
null
name = "pympu6050"
18
18
0.722222
dff25402be58788805ce4000a620f3bec7823781
4,537
py
Python
iocage/main.py
krcNAS/iocage
13d87e92f8ba186b6c8b7f64a948f26a05586430
[ "BSD-2-Clause" ]
null
null
null
iocage/main.py
krcNAS/iocage
13d87e92f8ba186b6c8b7f64a948f26a05586430
[ "BSD-2-Clause" ]
null
null
null
iocage/main.py
krcNAS/iocage
13d87e92f8ba186b6c8b7f64a948f26a05586430
[ "BSD-2-Clause" ]
null
null
null
# Copyright (c) 2014-2017, iocage # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted providing that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. """The main CLI for ioc.""" import locale import os import re import signal import subprocess as su import sys import click # This prevents it from getting in our way. from click import core import iocage.lib.ioc_check as ioc_check core._verify_python3_env = lambda: None user_locale = os.environ.get("LANG", "en_US.UTF-8") locale.setlocale(locale.LC_ALL, user_locale) # @formatter:off # Sometimes SIGINT won't be installed. # http://stackoverflow.com/questions/40775054/capturing-sigint-using-keyboardinterrupt-exception-works-in-terminal-not-in-scr/40785230#40785230 signal.signal(signal.SIGINT, signal.default_int_handler) # If a utility decides to cut off the pipe, we don't care (IE: head) signal.signal(signal.SIGPIPE, signal.SIG_DFL) # @formatter:on try: su.check_call(["sysctl", "vfs.zfs.version.spa"], stdout=su.PIPE, stderr=su.PIPE) except su.CalledProcessError: sys.exit("ZFS is required to use iocage.\n" "Try calling 'kldload zfs' as root.") def print_version(ctx, param, value): """Prints the version and then exits.""" if not value or ctx.resilient_parsing: return print("Version\t0.9.9.2 RC") sys.exit() cmd_folder = os.path.abspath(os.path.join(os.path.dirname(__file__), 'cli')) if __name__ == '__main__': cli(prog_name="iocage")
33.858209
143
0.642054
dff2b9a17cc9997e289067d562ccf28b75fc10b3
425
py
Python
bookinfo/models.py
dustfine/myPlaygroundSite
02db3321e9959437c588575f9df1079d2d8d1ed9
[ "MIT" ]
null
null
null
bookinfo/models.py
dustfine/myPlaygroundSite
02db3321e9959437c588575f9df1079d2d8d1ed9
[ "MIT" ]
null
null
null
bookinfo/models.py
dustfine/myPlaygroundSite
02db3321e9959437c588575f9df1079d2d8d1ed9
[ "MIT" ]
null
null
null
from django.db import models # Create your models here.
35.416667
85
0.757647
dff4072d877687a20524346adc49201f57ca4cea
905
py
Python
svety/tests.py
clemsciences/svety
44a0c2ab5453e9d01b71b5a3f0e0e959740c2d90
[ "MIT" ]
null
null
null
svety/tests.py
clemsciences/svety
44a0c2ab5453e9d01b71b5a3f0e0e959740c2d90
[ "MIT" ]
null
null
null
svety/tests.py
clemsciences/svety
44a0c2ab5453e9d01b71b5a3f0e0e959740c2d90
[ "MIT" ]
null
null
null
""" """ import os import unittest from lxml import etree from svety import PACKDIR from svety import reader from svety import retriever __author__ = ["Clment Besnier <[email protected]>", ]
23.205128
60
0.667403
dff5479d5d3e3729b12a7cdf8fd0b259fd5d0c88
5,424
py
Python
tests/internal/processes/test_generator.py
clausmichele/openeo-python-client
b20af2b24fcb12d0fce0e2acdb8afeeb881ff454
[ "Apache-2.0" ]
1
2021-04-01T13:15:35.000Z
2021-04-01T13:15:35.000Z
tests/internal/processes/test_generator.py
clausmichele/openeo-python-client
b20af2b24fcb12d0fce0e2acdb8afeeb881ff454
[ "Apache-2.0" ]
null
null
null
tests/internal/processes/test_generator.py
clausmichele/openeo-python-client
b20af2b24fcb12d0fce0e2acdb8afeeb881ff454
[ "Apache-2.0" ]
null
null
null
from textwrap import dedent from openeo.internal.processes.generator import PythonRenderer from openeo.internal.processes.parse import Process
28.851064
117
0.50295
dff6538ad1295913d7be8979ad8998c9e8d8ebc3
4,555
py
Python
python/tests/range.py
mizuki-nana/coreVM
1ff863b890329265a86ff46b0fdf7bac8e362f0e
[ "MIT" ]
2
2017-02-12T21:59:54.000Z
2017-02-13T14:57:48.000Z
python/tests/range.py
mizuki-nana/coreVM
1ff863b890329265a86ff46b0fdf7bac8e362f0e
[ "MIT" ]
null
null
null
python/tests/range.py
mizuki-nana/coreVM
1ff863b890329265a86ff46b0fdf7bac8e362f0e
[ "MIT" ]
null
null
null
# The MIT License (MIT) # Copyright (c) 2015 Yanzheng Li # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the 'Software'), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. ## ----------------------------------------------------------------------------- ## ----------------------------------------------------------------------------- ## ----------------------------------------------------------------------------- ## ----------------------------------------------------------------------------- ## ----------------------------------------------------------------------------- ## ----------------------------------------------------------------------------- ## ----------------------------------------------------------------------------- test_range_with_one_argument() test_range_with_one_invalid_argument() test_range_with_two_arguments() test_range_with_two_invalid_arguments() test_range_with_three_arguments() test_range_with_three_invalid_arguments() ## -----------------------------------------------------------------------------
31.413793
80
0.591438
dff9aadffba2a29e37c671ac7172c7de73a82cb0
14,895
py
Python
hyperion/generators/adapt_sequence_batch_generator.py
jsalt2019-diadet/hyperion
14a11436d62f3c15cd9b1f70bcce3eafbea2f753
[ "Apache-2.0" ]
9
2019-09-22T05:19:59.000Z
2022-03-05T18:03:37.000Z
hyperion/generators/adapt_sequence_batch_generator.py
jsalt2019-diadet/hyperion
14a11436d62f3c15cd9b1f70bcce3eafbea2f753
[ "Apache-2.0" ]
null
null
null
hyperion/generators/adapt_sequence_batch_generator.py
jsalt2019-diadet/hyperion
14a11436d62f3c15cd9b1f70bcce3eafbea2f753
[ "Apache-2.0" ]
4
2019-10-10T06:34:05.000Z
2022-03-05T18:03:56.000Z
""" Copyright 2018 Jesus Villalba (Johns Hopkins University) Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """ from __future__ import absolute_import from __future__ import print_function from __future__ import division from six.moves import xrange import sys import os import argparse import time import copy import numpy as np from sklearn.utils.class_weight import compute_class_weight from ..hyp_defs import float_cpu from ..io import RandomAccessDataReaderFactory as RF from ..utils.scp_list import SCPList from ..utils.tensors import to3D_by_seq from ..transforms import TransformList from .sequence_batch_generator_v1 import SequenceBatchGeneratorV1 as SBG
34.320276
111
0.608728
dffa822e50735b496917f2c8ca75cc5ca8d78488
1,113
py
Python
main.py
Lojlvenom/simple-python-blockchain
b226f81644daa066156aa5b9581c04cf4d47d0dc
[ "MIT" ]
null
null
null
main.py
Lojlvenom/simple-python-blockchain
b226f81644daa066156aa5b9581c04cf4d47d0dc
[ "MIT" ]
null
null
null
main.py
Lojlvenom/simple-python-blockchain
b226f81644daa066156aa5b9581c04cf4d47d0dc
[ "MIT" ]
null
null
null
import fastapi as _fastapi import blockchain as _blockchain app_desc = { 'title':'Simple python blockchain API', 'version':'1.0.0', } bc = _blockchain.Blockchain() app = _fastapi.FastAPI(**app_desc) # EP PARA ADICIONAR UM BLOCO
22.26
91
0.629829
dffa84ab01f78c539667e6f6871367dc2095eb09
1,747
py
Python
setup.py
SanjeevaRDodlapati/Chem-Learn
2db2e98061ee3dbb00ed20c51ea18b15956e298e
[ "MIT" ]
null
null
null
setup.py
SanjeevaRDodlapati/Chem-Learn
2db2e98061ee3dbb00ed20c51ea18b15956e298e
[ "MIT" ]
null
null
null
setup.py
SanjeevaRDodlapati/Chem-Learn
2db2e98061ee3dbb00ed20c51ea18b15956e298e
[ "MIT" ]
null
null
null
from glob import glob import os from setuptools import setup, find_packages setup(name='chemlearn', version='0.0.0', description='Deep learning for chemistry', long_description=read('README.rst'), author='Sanjeeva Reddy Dodlapati', author_email='[email protected]', license="MIT", url='https://github.com/SanjeevaRDodlapati/Chem-Learn', packages=find_packages(), scripts=glob('./scripts/*.py'), install_requires=['h5py', 'argparse', 'pandas', 'numpy', 'pytest', 'torch', 'rdkit-pypi', ], keywords=['Deep learning', 'Deep neural networks', 'Molecular graphs', 'Drug discovery', 'Drug target interaction'], classifiers=['Development Status :: 0 - developmet', 'Environment :: Console', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'Natural Language :: English', 'Programming Language :: Python', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Topic :: Scientific/Engineering :: Artificial Intelligence', 'Topic :: Scientific/Engineering :: Chem-Informatics', ] )
36.395833
80
0.499714
dffe92bdb0898e53b6acb0b1fcb7c940caeeb1d9
49,731
py
Python
scripts/tests_with_setup.py
rombie/contrail-test
a68c71d6f282142501a7e2e889bbb232fdd82dc3
[ "Apache-2.0" ]
null
null
null
scripts/tests_with_setup.py
rombie/contrail-test
a68c71d6f282142501a7e2e889bbb232fdd82dc3
[ "Apache-2.0" ]
null
null
null
scripts/tests_with_setup.py
rombie/contrail-test
a68c71d6f282142501a7e2e889bbb232fdd82dc3
[ "Apache-2.0" ]
null
null
null
# Need to import path to test/fixtures and test/scripts/ # Ex : export PYTHONPATH='$PATH:/root/test/fixtures/:/root/test/scripts/' # # To run tests, you can do 'python -m testtools.run tests'. To run specific tests, # You can do 'python -m testtools.run -l tests' # Set the env variable PARAMS_FILE to point to your ini file. Else it will try to pick params.ini in PWD # from tests_with_setup_base import * # end TestSanityFixture
43.623684
247
0.632603
dfff599aef2fa931d79fa84797d0acce9a216f5a
5,407
py
Python
murder.py
lgrn/murder
1e4582cc5fa8c31c35e70997daebd111f1badf4d
[ "Unlicense" ]
null
null
null
murder.py
lgrn/murder
1e4582cc5fa8c31c35e70997daebd111f1badf4d
[ "Unlicense" ]
null
null
null
murder.py
lgrn/murder
1e4582cc5fa8c31c35e70997daebd111f1badf4d
[ "Unlicense" ]
null
null
null
#!/usr/bin/env python3 # murder 0.2.3 import sys if sys.version_info[0] != (3): sys.stdout.write("Sorry this software requires Python 3. This is Python {}.\n".format(sys.version_info[0])) sys.exit(1) import time import requests import json import re # Your "filename" file should contain one word per row. Don't worry about # newlines and whitespace, it will be stripped. Any names containing anything # but A-Z/a-z, underscores and numbers will be skipped and not queried. filename = "input.txt" try: with open(filename) as f: lines = [line.strip().strip('\n').lower() for line in open(filename)] lines = list(set(lines)) except FileNotFoundError: print("For this script to work, {} needs to exist in the working directory. Exiting.".format(filename)) raise SystemExit except UnicodeDecodeError: print("Oops! {} isn't UTF-8. Convert it, for example by running iconv. Exiting.".format(filename)) raise SystemExit unavailable_filename = "unavailable.txt" try: with open(unavailable_filename) as f: unavailable_lines = [line.strip().strip('\n') for line in open(unavailable_filename)] except FileNotFoundError: print("\n{} was not found. That's fine, probably there wasn't a previous run.".format(unavailable_filename)) available_filename = "output.txt" try: with open(available_filename) as f: available_lines = [line.strip().strip('\n') for line in open(available_filename)] except FileNotFoundError: print("\n{} was not found. That's fine, probably there wasn't a previous run.".format(available_filename)) pretty_amount = "{:,}".format(len(lines)) print("\n[>>>>>>>>>] Imported {} words from {}.".format(pretty_amount,filename)) # This regex pattern validates usernames. pattern = re.compile("^[a-zA-Z0-9]+([._]?[a-zA-Z0-9]+)*$") sys.stdout.flush() # This function will check if a name is available: failed_tries = 0 ok_tries = 0 # Let's clean up our "lines" array first so it only contains stuff we # actually want to throw at the API. clean_lines = [] for i in lines: if pattern.match(i) and len(str(i)) == 5: clean_lines.append(i) # NOTE: "Compliant" below is decided by the for loop above. pretty_amount = "{:,}".format(len(clean_lines)) print("[>>>>>>>>>] Cleaned up import to only include compliant words. We now have {} words.".format(pretty_amount) + "\n") # Clean the array further by removing already checked names (failed and succeeded). try: for i in unavailable_lines: if i in clean_lines: clean_lines.remove(i) print("[ CLEANUP ] '{}' will not be checked, we already know it's taken.".format(i.lower())) except NameError: # If there wasn't a previous run, this won't exist. That's fine. pass try: for i in available_lines: if i in clean_lines: clean_lines.remove(i) print("[ CLEANUP ] '{}' will not be checked, we already know it's available.".format(i.lower())) except NameError: # If there wasn't a previous run, this won't exist. That's fine. pass try: if unavailable_lines or available_lines: pretty_amount = "{:,}".format(len(clean_lines)) print("[>>>>>>>>>] Done cross-checking txt files from previous runs, we now have {} words.".format(pretty_amount) + "\n") except NameError: pass # NOTE: time.sleep waits because twitter has a rate limit of 150/15min (?) <- bad guess print("[>>>>>>>>>] Making API calls now." + "\n") sleep_seconds = 10 for i in clean_lines: sys.stdout.flush() if is_available(i): print("[AVAILABLE] '{}'! Saving to output.txt, stalling for next API call.".format(i.lower())) ok_tries += 1 write_available(i.lower() + '\n') sys.stdout.flush() time.sleep(sleep_seconds) else: print("[ TAKEN ] '{}'. Too bad. Stalling for next API call.".format(i.lower())) failed_tries += 1 #delete_row(i) write_unavailable(i.lower() + '\n') time.sleep(sleep_seconds) total_tries = failed_tries + ok_tries print("Script finished. Twitter was hit with " "{} queries. We found {} available names, saved to output.txt".format(total_tries,ok_tries))
32.769697
129
0.653227
5f0133420725ce23664fd5aac6eace5b4be90d9b
324
py
Python
02_module/package_test/module1/my_sum.py
zzz0072/Python_Exercises
9918aa8197a77ef237e5e60306c7785eca5cb1d3
[ "BSD-2-Clause" ]
null
null
null
02_module/package_test/module1/my_sum.py
zzz0072/Python_Exercises
9918aa8197a77ef237e5e60306c7785eca5cb1d3
[ "BSD-2-Clause" ]
null
null
null
02_module/package_test/module1/my_sum.py
zzz0072/Python_Exercises
9918aa8197a77ef237e5e60306c7785eca5cb1d3
[ "BSD-2-Clause" ]
null
null
null
#/usr/bin/env python from ..module2 import my_print # To run method alone if __name__ == "__main__": import sys if len(sys.argv) != 3: print("%s str1 str2" % sys.argv[0]) raise SystemExit(1) my_sum(sys.argv[1], sys.argv[2])
18
43
0.608025
5f018a5353d8adb9d68568f7a0b49dde04ed193e
75
py
Python
storch/models/__init__.py
STomoya/storch
47754eecd5fb5404dd345f06fb0f8d3270a9e5b9
[ "MIT" ]
null
null
null
storch/models/__init__.py
STomoya/storch
47754eecd5fb5404dd345f06fb0f8d3270a9e5b9
[ "MIT" ]
null
null
null
storch/models/__init__.py
STomoya/storch
47754eecd5fb5404dd345f06fb0f8d3270a9e5b9
[ "MIT" ]
null
null
null
from multiscale import MultiScale from patchgan import PatchDiscriminator
18.75
39
0.88
5f033434eab634732c27a8827763d152ae9391a1
1,054
py
Python
repos/system_upgrade/el7toel8/actors/preparepythonworkround/tests/test_preparepythonworkaround.py
AloisMahdal/leapp-repository
9ac2b8005750e8e56e5fde61e8762044d0f16257
[ "Apache-2.0" ]
null
null
null
repos/system_upgrade/el7toel8/actors/preparepythonworkround/tests/test_preparepythonworkaround.py
AloisMahdal/leapp-repository
9ac2b8005750e8e56e5fde61e8762044d0f16257
[ "Apache-2.0" ]
9
2020-01-07T12:48:59.000Z
2020-01-16T10:44:34.000Z
repos/system_upgrade/el7toel8/actors/preparepythonworkround/tests/test_preparepythonworkaround.py
AloisMahdal/leapp-repository
9ac2b8005750e8e56e5fde61e8762044d0f16257
[ "Apache-2.0" ]
null
null
null
from os import symlink, path, access, X_OK import pytest from leapp.libraries.actor import workaround from leapp.libraries.common.utils import makedirs
32.9375
84
0.734345
5f03df5d79ef568c79e0a3f2f05ab7cc845b03d5
707
py
Python
codility/equi_leader.py
py-in-the-sky/challenges
4a36095de8cb56b4f9f83c241eafb13dfbeb4065
[ "MIT" ]
null
null
null
codility/equi_leader.py
py-in-the-sky/challenges
4a36095de8cb56b4f9f83c241eafb13dfbeb4065
[ "MIT" ]
null
null
null
codility/equi_leader.py
py-in-the-sky/challenges
4a36095de8cb56b4f9f83c241eafb13dfbeb4065
[ "MIT" ]
null
null
null
""" https://codility.com/programmers/task/equi_leader/ """ from collections import Counter, defaultdict
24.37931
89
0.595474
5f049724d72ac2de8c5b11138f1e4b59bdb512ad
1,744
py
Python
src/harness/cu_pass/dpa_calculator/helpers/list_distributor/list_distributor.py
NSF-Swift/Spectrum-Access-System
02cf3490c9fd0cec38074d3bdb3bca63bb7d03bf
[ "Apache-2.0" ]
null
null
null
src/harness/cu_pass/dpa_calculator/helpers/list_distributor/list_distributor.py
NSF-Swift/Spectrum-Access-System
02cf3490c9fd0cec38074d3bdb3bca63bb7d03bf
[ "Apache-2.0" ]
null
null
null
src/harness/cu_pass/dpa_calculator/helpers/list_distributor/list_distributor.py
NSF-Swift/Spectrum-Access-System
02cf3490c9fd0cec38074d3bdb3bca63bb7d03bf
[ "Apache-2.0" ]
null
null
null
from abc import ABC, abstractmethod from typing import Any, List, TypeVar from cu_pass.dpa_calculator.helpers.list_distributor.fractional_distribution.fractional_distribution import \ FractionalDistribution RETURN_TYPE = TypeVar('RETURN_TYPE')
38.755556
110
0.725344
5f05166068ffa658a5a11fcc559025940e70a85b
1,419
py
Python
downloader.py
Luonic/tf-cnn-lstm-ocr-captcha
9ac6202d546093d95083a32c71cdccb800dfdea2
[ "MIT" ]
10
2017-08-08T22:57:32.000Z
2020-04-07T21:50:20.000Z
downloader.py
Luonic/tf-cnn-lstm-ocr-captcha
9ac6202d546093d95083a32c71cdccb800dfdea2
[ "MIT" ]
null
null
null
downloader.py
Luonic/tf-cnn-lstm-ocr-captcha
9ac6202d546093d95083a32c71cdccb800dfdea2
[ "MIT" ]
5
2018-07-17T16:47:21.000Z
2021-11-06T15:03:56.000Z
import urllib import requests import multiprocessing.pool from multiprocessing import Pool import uuid import os images_dir = os.path.join("data", "train") small_letters = map(chr, range(ord('a'), ord('f')+1)) digits = map(chr, range(ord('0'), ord('9')+1)) base_16 = digits + small_letters MAX_THREADS = 100 if __name__ == "__main__": labels = [] for i in range(0, len(base_16)): for j in range(0, len(base_16)): for m in range(0, len(base_16)): for n in range(0, len(base_16)): try: label = base_16[i] + base_16[j] + base_16[m] + base_16[n] labels.append(label) # urllib.urlretrieve("https://local.thedrhax.pw/rucaptcha/?" + str(label), str(label) + ".png") except Exception as e: print(str(e)) print(labels) p = Pool(MAX_THREADS) while 1: p.map(captcha, labels) print("Finished all downloads")
30.191489
143
0.547569
5f05920c4f06c4b47bf5845e7dd08b41ac585c06
7,679
py
Python
code/Models.py
IGLICT/CMIC-Retrieval
d2f452517360f127d0a8175d55ba9f9491c152c2
[ "MIT" ]
29
2021-10-01T12:05:54.000Z
2022-03-16T02:40:19.000Z
code/Models.py
IGLICT/CMIC-Retrieval
d2f452517360f127d0a8175d55ba9f9491c152c2
[ "MIT" ]
5
2021-12-20T12:25:58.000Z
2022-03-10T19:08:32.000Z
code/Models.py
IGLICT/CMIC-Retrieval
d2f452517360f127d0a8175d55ba9f9491c152c2
[ "MIT" ]
1
2022-01-04T05:52:49.000Z
2022-01-04T05:52:49.000Z
import jittor as jt from jittor import nn, models if jt.has_cuda: jt.flags.use_cuda = 1 # jt.flags.use_cuda if __name__ == '__main__': import yaml import argparse with open('./configs/pix3d.yaml', 'r') as f: config = yaml.load(f) config = dict2namespace(config) models = RetrievalNet(config) img = jt.random([2,4,224,224]).stop_grad() mask = jt.random([2,12,224,224]).stop_grad() # mm = models.resnet50(pretrained=False) # # print(mm) # a = mm(img) outputs = models(img, mask)
36.393365
113
0.625602
5f05a35db2bf24e5cd3d450829e44e1d6868265e
2,348
py
Python
apps/agendas/tests/unit/selectors/test_doctor_profile_selector.py
victoraguilarc/agendas
31b24a2d6350605b638b59062f297ef3f58e9879
[ "MIT" ]
2
2020-06-06T23:10:27.000Z
2020-10-06T19:12:26.000Z
apps/agendas/tests/unit/selectors/test_doctor_profile_selector.py
victoraguilarc/medical-appointment
31b24a2d6350605b638b59062f297ef3f58e9879
[ "MIT" ]
3
2021-04-08T20:44:38.000Z
2021-09-22T19:04:16.000Z
apps/agendas/tests/unit/selectors/test_doctor_profile_selector.py
victoraguilarc/agendas
31b24a2d6350605b638b59062f297ef3f58e9879
[ "MIT" ]
1
2020-10-10T14:07:37.000Z
2020-10-10T14:07:37.000Z
# -*- coding: utf-8 -*- import pytest from django.db.models import QuerySet from rest_framework.exceptions import NotFound from apps.accounts.response_codes import INVALID_TOKEN from apps.accounts.selectors.pending_action_selector import PendingActionSelector from apps.accounts.tests.factories.pending_action import PendingActionFactory from apps.accounts.tests.factories.user import UserFactory from apps.agendas.models import DoctorProfile from apps.agendas.response_codes import DOCTOR_NOT_FOUND from apps.agendas.selectors.appointment import AppointmentSelector from apps.agendas.selectors.doctor_profile import DoctorProfileSelector from apps.agendas.tests.factories.doctor_profile import DoctorProfileFactory from apps.contrib.api.exceptions import SimpleValidationError from faker import Factory from faker.providers import misc faker = Factory.create() faker.add_provider(misc)
35.044776
93
0.774702
5f0603321cb19a9d08d78984f4e1439bd2f1a90c
121
py
Python
python/testData/findUsages/GlobalUsages.py
jnthn/intellij-community
8fa7c8a3ace62400c838e0d5926a7be106aa8557
[ "Apache-2.0" ]
2
2019-04-28T07:48:50.000Z
2020-12-11T14:18:08.000Z
python/testData/findUsages/GlobalUsages.py
Cyril-lamirand/intellij-community
60ab6c61b82fc761dd68363eca7d9d69663cfa39
[ "Apache-2.0" ]
173
2018-07-05T13:59:39.000Z
2018-08-09T01:12:03.000Z
python/testData/findUsages/GlobalUsages.py
Cyril-lamirand/intellij-community
60ab6c61b82fc761dd68363eca7d9d69663cfa39
[ "Apache-2.0" ]
2
2020-03-15T08:57:37.000Z
2020-04-07T04:48:14.000Z
<caret>search_variable = 1
20.166667
26
0.735537
5f06913d44d8487508a5267f1e736e022aea0e78
379
py
Python
backend/api/tests/models/location_tests.py
Pachwenko/ember-django-example
cfed8a4519e307ea72a097336f9b07bfa5ee576f
[ "MIT" ]
null
null
null
backend/api/tests/models/location_tests.py
Pachwenko/ember-django-example
cfed8a4519e307ea72a097336f9b07bfa5ee576f
[ "MIT" ]
1
2022-01-17T00:51:15.000Z
2022-01-17T00:51:15.000Z
backend/api/tests/models/location_tests.py
Pachwenko/ember-django-example
cfed8a4519e307ea72a097336f9b07bfa5ee576f
[ "MIT" ]
null
null
null
from decimal import Decimal import pytest from api.tests.factories.location import LocationFactory # potentially helpful fixtures provided by pytest-django # https://pytest-django.readthedocs.io/en/latest/helpers.html#fixtures
23.6875
70
0.759894
5f073a6e60f359858de246c60af2ab6ba1d0660b
293
py
Python
dias/dia.py
GU1LH3RME-LIMA/pythonWebjs
4786ef3b900f3b45522a0d3f0c4b83e1e68ae25b
[ "MIT" ]
null
null
null
dias/dia.py
GU1LH3RME-LIMA/pythonWebjs
4786ef3b900f3b45522a0d3f0c4b83e1e68ae25b
[ "MIT" ]
null
null
null
dias/dia.py
GU1LH3RME-LIMA/pythonWebjs
4786ef3b900f3b45522a0d3f0c4b83e1e68ae25b
[ "MIT" ]
null
null
null
import datetime from flask import Flask, render_template ''' algoritmo simples para definir se o dia par ou impar ''' app = Flask(__name__)
22.538462
61
0.723549
5f0795f4ecbd539f9866bfa75241bdbacd313bed
1,532
py
Python
catalog/views/api.py
iraquitan/catalog-app-flask
563981ddc8d55c62428cd4811bdea73ee8f8a846
[ "MIT" ]
null
null
null
catalog/views/api.py
iraquitan/catalog-app-flask
563981ddc8d55c62428cd4811bdea73ee8f8a846
[ "MIT" ]
null
null
null
catalog/views/api.py
iraquitan/catalog-app-flask
563981ddc8d55c62428cd4811bdea73ee8f8a846
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ * Created by PyCharm. * Project: catalog * Author name: Iraquitan Cordeiro Filho * Author login: pma007 * File: api * Date: 2/26/16 * Time: 11:26 * To change this template use File | Settings | File Templates. """ from flask import Blueprint, jsonify from catalog.models import Category, Item # Define api Blueprint for JSON endpoints api = Blueprint('api', __name__)
30.039216
79
0.719321
5f0912cfcdcc52bdc014aa57f2387fcc7c7c1a0f
1,854
py
Python
tests/test_debug.py
HazemElAgaty/psycopg2-pgevents
c0952608777052ea2cb90d8c78802ad03f8f3da1
[ "MIT" ]
11
2019-07-12T17:25:36.000Z
2021-06-07T12:51:31.000Z
tests/test_debug.py
HazemElAgaty/psycopg2-pgevents
c0952608777052ea2cb90d8c78802ad03f8f3da1
[ "MIT" ]
5
2020-06-21T14:58:21.000Z
2021-09-06T09:34:32.000Z
tests/test_debug.py
HazemElAgaty/psycopg2-pgevents
c0952608777052ea2cb90d8c78802ad03f8f3da1
[ "MIT" ]
4
2019-07-12T17:25:37.000Z
2021-07-13T13:26:58.000Z
from pytest import raises from psycopg2_pgevents import debug from psycopg2_pgevents.debug import log, set_debug
27.264706
90
0.600863
5f0a52e79ef2f2c527b1cb664f5e0e589f53a413
1,148
py
Python
abstracto-application/installer/src/main/docker/deployment/python/templates_deploy.py
Sheldan/abstracto
cef46737c5f34719c80c71aa9cd68bc53aea9a68
[ "MIT" ]
5
2020-05-27T14:18:51.000Z
2021-03-24T09:23:09.000Z
abstracto-application/installer/src/main/docker/deployment/python/templates_deploy.py
Sheldan/abstracto
cef46737c5f34719c80c71aa9cd68bc53aea9a68
[ "MIT" ]
5
2020-05-29T21:53:53.000Z
2021-05-26T12:19:16.000Z
abstracto-application/installer/src/main/docker/deployment/python/templates_deploy.py
Sheldan/abstracto
cef46737c5f34719c80c71aa9cd68bc53aea9a68
[ "MIT" ]
null
null
null
import glob import os import sqlalchemy as db from sqlalchemy.sql import text
37.032258
166
0.642857
5f0a965a14ab29cfb59691e71680ca0613d8037e
8,466
py
Python
src/external.py
erick-dsnk/Electric
7e8aad1f792321d7839717ed97b641bee7a4a64e
[ "Apache-2.0" ]
null
null
null
src/external.py
erick-dsnk/Electric
7e8aad1f792321d7839717ed97b641bee7a4a64e
[ "Apache-2.0" ]
null
null
null
src/external.py
erick-dsnk/Electric
7e8aad1f792321d7839717ed97b641bee7a4a64e
[ "Apache-2.0" ]
null
null
null
###################################################################### # EXTERNAL # ###################################################################### from Classes.Metadata import Metadata from subprocess import PIPE, Popen from extension import * from colorama import * from utils import * import mslex import halo import sys
46.516484
155
0.583038
5f0b1b6f16ccc30241e064e1c6cda37d2700becb
3,242
py
Python
testing/regrid/testGhostedDistArray.py
xylar/cdat
8a5080cb18febfde365efc96147e25f51494a2bf
[ "BSD-3-Clause" ]
62
2018-03-30T15:46:56.000Z
2021-12-08T23:30:24.000Z
testing/regrid/testGhostedDistArray.py
xylar/cdat
8a5080cb18febfde365efc96147e25f51494a2bf
[ "BSD-3-Clause" ]
114
2018-03-21T01:12:43.000Z
2021-07-05T12:29:54.000Z
testing/regrid/testGhostedDistArray.py
CDAT/uvcdat
5133560c0c049b5c93ee321ba0af494253b44f91
[ "BSD-3-Clause" ]
14
2018-06-06T02:42:47.000Z
2021-11-26T03:27:00.000Z
import distarray import numpy import unittest from mpi4py import MPI if __name__ == '__main__': print "" # Spacer suite = unittest.TestLoader().loadTestsFromTestCase(TestGhostedDistArray) unittest.TextTestRunner(verbosity = 1).run(suite) MPI.Finalize()
26.57377
77
0.507403
5f0b9146ca28c5866c71c4fff522e7ed582731d7
3,900
py
Python
cir/user_views.py
wafield/cir
123d4bfe3e5bb4b0d605de486a91a0cb7eb34e4c
[ "MIT" ]
null
null
null
cir/user_views.py
wafield/cir
123d4bfe3e5bb4b0d605de486a91a0cb7eb34e4c
[ "MIT" ]
null
null
null
cir/user_views.py
wafield/cir
123d4bfe3e5bb4b0d605de486a91a0cb7eb34e4c
[ "MIT" ]
1
2018-06-23T21:11:53.000Z
2018-06-23T21:11:53.000Z
import json from django.contrib.auth import authenticate, login, logout from django.http import HttpResponse from django.utils import timezone from django.contrib.auth.signals import user_logged_in from cir.models import * VISITOR_ROLE = 'visitor'
39
87
0.661282
5f0bcf77d0e89f7eeb81cfefde1fb86ef9a0fc3f
2,844
py
Python
LeetCode/Python3/HashTable/451. Sort Characters By Frequency.py
WatsonWangZh/CodingPractice
dc057dd6ea2fc2034e14fd73e07e73e6364be2ae
[ "MIT" ]
11
2019-09-01T22:36:00.000Z
2021-11-08T08:57:20.000Z
LeetCode/Python3/HashTable/451. Sort Characters By Frequency.py
WatsonWangZh/LeetCodePractice
dc057dd6ea2fc2034e14fd73e07e73e6364be2ae
[ "MIT" ]
null
null
null
LeetCode/Python3/HashTable/451. Sort Characters By Frequency.py
WatsonWangZh/LeetCodePractice
dc057dd6ea2fc2034e14fd73e07e73e6364be2ae
[ "MIT" ]
2
2020-05-27T14:58:52.000Z
2020-05-27T15:04:17.000Z
# Given a string, sort it in decreasing order based on the frequency of characters. # Example 1: # Input: # "tree" # Output: # "eert" # Explanation: # 'e' appears twice while 'r' and 't' both appear once. # So 'e' must appear before both 'r' and 't'. Therefore "eetr" is also a valid answer. # Example 2: # Input: # "cccaaa" # Output: # "cccaaa" # Explanation: # Both 'c' and 'a' appear three times, so "aaaccc" is also a valid answer. # Note that "cacaca" is incorrect, as the same characters must be together. # Example 3: # Input: # "Aabb" # Output: # "bbAa" # Explanation: # "bbaA" is also a valid answer, but "Aabb" is incorrect. # Note that 'A' and 'a' are treated as two different characters. import collections import heapq
27.61165
86
0.522504
5f0bf2755cfa5ea302283c30bc9e0ccfd4f8893d
1,837
py
Python
ttkinter_app.py
bombero2020/python_tools
393092609c4555e47b9789eb3fcb614ea25fdef9
[ "MIT" ]
null
null
null
ttkinter_app.py
bombero2020/python_tools
393092609c4555e47b9789eb3fcb614ea25fdef9
[ "MIT" ]
null
null
null
ttkinter_app.py
bombero2020/python_tools
393092609c4555e47b9789eb3fcb614ea25fdef9
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- import tkinter as tk from tkinter import ttk main_window = tk.Tk() app = Application(main_window) app.mainloop()
27.41791
66
0.616222
5f0dcd6e6a26bb27177e11fcbcba91b603bd720d
8,513
py
Python
api/src/dojo.py
mosoriob/dojo
71bba04c4fdc4224320087b4c400fcba91b6597d
[ "MIT" ]
1
2021-10-08T00:47:58.000Z
2021-10-08T00:47:58.000Z
api/src/dojo.py
mosoriob/dojo
71bba04c4fdc4224320087b4c400fcba91b6597d
[ "MIT" ]
null
null
null
api/src/dojo.py
mosoriob/dojo
71bba04c4fdc4224320087b4c400fcba91b6597d
[ "MIT" ]
null
null
null
import uuid from typing import List from elasticsearch import Elasticsearch from elasticsearch.exceptions import NotFoundError from fastapi import APIRouter, Response, status from validation import DojoSchema from src.settings import settings import logging logger = logging.getLogger(__name__) router = APIRouter() es = Elasticsearch([settings.ELASTICSEARCH_URL], port=settings.ELASTICSEARCH_PORT) ### Accessories Endpoints
35.470833
127
0.649595
5f0f752c5211938014f35ccb9166c1413d779264
3,313
py
Python
test/test_prob_models.py
sylar233/de-identification
44731e9c22de647063bd82a19936b4c5a144ea6e
[ "Apache-2.0" ]
5
2016-11-07T12:54:51.000Z
2018-12-15T00:20:26.000Z
test/test_prob_models.py
sylar233/de-identification
44731e9c22de647063bd82a19936b4c5a144ea6e
[ "Apache-2.0" ]
5
2016-07-05T06:06:31.000Z
2016-07-27T05:21:36.000Z
test/test_prob_models.py
sylar233/de-identification
44731e9c22de647063bd82a19936b4c5a144ea6e
[ "Apache-2.0" ]
3
2018-07-18T07:32:43.000Z
2021-11-05T05:25:55.000Z
from django.test import TestCase from common.data_utilities import DataUtils from prob_models.dep_graph import DependencyGraph from prob_models.jtree import JunctionTree import common.constant as c TESTING_FILE = c.TEST_DATA_PATH """ The test file has for fields, and the dependency graph would be a complete graph. The junction Tree has only one clique """
35.244681
209
0.677634
5f10c305acc4e613b5656eb25e050b130ecbb7b2
631
py
Python
examples/house_prices_kaggle.py
ChillBoss/ml_automation
50d42b3cd5a3bb2f7a91e4c53bf3bbfe7a3b1741
[ "MIT" ]
null
null
null
examples/house_prices_kaggle.py
ChillBoss/ml_automation
50d42b3cd5a3bb2f7a91e4c53bf3bbfe7a3b1741
[ "MIT" ]
null
null
null
examples/house_prices_kaggle.py
ChillBoss/ml_automation
50d42b3cd5a3bb2f7a91e4c53bf3bbfe7a3b1741
[ "MIT" ]
null
null
null
# Regression Task, assumption is that the data is in the right directory # data can be taken from https://www.kaggle.com/c/house-prices-advanced-regression-techniques/data import os import ml_automation if __name__ == '__main__': data_dir = os.path.join(os.path.dirname(__file__), 'data') f_train = os.path.join(data_dir, 'train.csv') f_test = os.path.join(data_dir, 'test.csv') #training ml_automation.automate(path=f_train, ignore_cols=['Id'], out_dir='model') #predictions preds = ml_automation.predict(f_test, model_dir='model') print(preds)
30.047619
98
0.66561
5f10f60ec6549819aee0320bd7db378dfb94aabf
3,232
py
Python
src/bel_commons/explorer_toolbox.py
cthoyt/pybel-web
a27f30617b9209d5531a6b65760597f8d45e9957
[ "MIT" ]
2
2019-07-17T16:17:44.000Z
2019-07-18T17:05:36.000Z
src/bel_commons/explorer_toolbox.py
cthoyt/pybel-web
a27f30617b9209d5531a6b65760597f8d45e9957
[ "MIT" ]
3
2020-04-25T17:30:58.000Z
2020-04-25T17:32:11.000Z
src/bel_commons/explorer_toolbox.py
cthoyt/pybel-web
a27f30617b9209d5531a6b65760597f8d45e9957
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """Constants for building the biological network explorer's transformations toolbox.""" from typing import List, Tuple from pybel.struct.pipeline.decorators import mapped # Default NetworkX explorer toolbox functions (name, button text, description) _explorer_toolbox = ( ('collapse_to_genes', 'Collapse to Genes', 'Collapse proteins and RNAs to genes'), ('collapse_all_variants', 'Collapse Variants', 'Collapse Variants to their Parent Nodes'), ('collapse_to_protein_interactions', 'Protein Interaction Network', 'Reduce the Network to Interactions between Proteins'), ('enrich_protein_and_rna_origins', 'Expand Protein Origins', 'Adds RNAs corresponding to Proteins, then adds Genes corresponding to RNAs and miRNAs'), ('prune_protein_rna_origins', 'Prune Genes/RNAs', 'Delete genes/RNAs that only have transcription/translation edges'), ('expand_periphery', 'Expand Periphery', 'Expand the periphery of the network'), ('expand_internal', 'Expand Internal', 'Adds missing edges between nodes in the network'), ('remove_isolated_nodes', 'Remove Isolated Nodes', 'Remove from the network all isolated nodes'), ('get_largest_component', 'Get Largest Component', 'Retain only the largest component and removes all others'), ('enrich_unqualified', 'Enrich unqualified edges', 'Adds unqualified edges from the universe'), ('remove_associations', 'Remove Associations', 'Remove associative relations'), ('remove_pathologies', 'Remove Pathologies', 'Removes all pathology nodes'), ('remove_biological_processes', 'Remove Biological Processes', 'Removes all biological process nodes'), ) _bio2bel_functions = ( ( 'enrich_rnas', 'Enrich RNA controllers from miRTarBase', 'Adds the miRNA controllers of RNA nodes from miRTarBase' ), ( 'enrich_mirnas', 'Enrich miRNA targets', 'Adds the RNA targets of miRNA nodes from miRTarBase' ), ( 'enrich_genes_with_families', 'Enrich Genes with Gene Family Membership', 'Adds the parents of HGNC Gene Families' ), ( 'enrich_families_with_genes', 'Enrich Gene Family Membership', 'Adds the children to HGNC gene familes' ), ( 'enrich_bioprocesses', 'Enrich Biological Process Hierarchy', 'Adds parent biological processes' ), ( 'enrich_chemical_hierarchy', 'Enrich Chemical Hierarchy', 'Adds parent chemical entries' ), ( 'enrich_proteins_with_enzyme_families', 'Add Enzyme Class Members', 'Adds enzyme classes for each protein' ), ( 'enrich_enzymes', 'Enrich Enzyme Classes', 'Adds proteins corresponding to present ExPASy Enzyme codes' ) ) def get_explorer_toolbox() -> List[Tuple[str, str, str]]: """Get the explorer toolbox list.""" explorer_toolbox = list(_explorer_toolbox) explorer_toolbox.extend( (func_name, title, description) for func_name, title, description in _bio2bel_functions if _function_is_registered(func_name) ) return explorer_toolbox
40.911392
115
0.697401
5f140a8d48047d7ddb5cd0c7677d6976d0a7cec0
827
py
Python
threatstack/v1/client.py
giany/threatstack-python-client
c9e0a4bed55685d3a032c6f1a03261d44de64c4a
[ "MIT" ]
4
2018-03-14T21:51:46.000Z
2020-01-06T17:25:53.000Z
threatstack/v1/client.py
giany/threatstack-python-client
c9e0a4bed55685d3a032c6f1a03261d44de64c4a
[ "MIT" ]
4
2018-01-17T19:58:29.000Z
2018-04-13T17:03:01.000Z
threatstack/v1/client.py
giany/threatstack-python-client
c9e0a4bed55685d3a032c6f1a03261d44de64c4a
[ "MIT" ]
6
2018-01-15T18:46:25.000Z
2022-02-17T10:13:35.000Z
""" V1 Client """ from threatstack.base import BaseClient from threatstack.v1 import resources
27.566667
78
0.665054
5f14372008e665aac666215605a53db7e9d8af9a
5,930
py
Python
djangocms_newsletter/admin/mailinglist.py
nephila/djangocms-newsletter
5ebd8d3e1e2c85b2791d0261a954469f2548c840
[ "BSD-3-Clause" ]
null
null
null
djangocms_newsletter/admin/mailinglist.py
nephila/djangocms-newsletter
5ebd8d3e1e2c85b2791d0261a954469f2548c840
[ "BSD-3-Clause" ]
null
null
null
djangocms_newsletter/admin/mailinglist.py
nephila/djangocms-newsletter
5ebd8d3e1e2c85b2791d0261a954469f2548c840
[ "BSD-3-Clause" ]
2
2021-03-15T13:33:53.000Z
2021-05-18T20:34:47.000Z
"""ModelAdmin for MailingList""" from datetime import datetime from django.contrib import admin from django.conf.urls.defaults import url from django.conf.urls.defaults import patterns from django.utils.encoding import smart_str from django.core.urlresolvers import reverse from django.shortcuts import get_object_or_404 from django.utils.translation import ugettext_lazy as _ from django.http import HttpResponseRedirect from emencia.django.newsletter.models import Contact from emencia.django.newsletter.models import MailingList from emencia.django.newsletter.settings import USE_WORKGROUPS from emencia.django.newsletter.utils.workgroups import request_workgroups from emencia.django.newsletter.utils.workgroups import request_workgroups_contacts_pk from emencia.django.newsletter.utils.workgroups import request_workgroups_mailinglists_pk from emencia.django.newsletter.utils.vcard import vcard_contacts_export_response from emencia.django.newsletter.utils.excel import ExcelResponse
47.063492
96
0.663238
5f18561e37fb0a33a844c99a5051aea7c8863cea
4,263
py
Python
lib/train/recorder.py
rurusasu/OrigNet
3b3384cb3d09b52c7c98bb264901285f006e51c1
[ "Apache-2.0" ]
null
null
null
lib/train/recorder.py
rurusasu/OrigNet
3b3384cb3d09b52c7c98bb264901285f006e51c1
[ "Apache-2.0" ]
null
null
null
lib/train/recorder.py
rurusasu/OrigNet
3b3384cb3d09b52c7c98bb264901285f006e51c1
[ "Apache-2.0" ]
1
2021-09-24T01:24:05.000Z
2021-09-24T01:24:05.000Z
import os import sys from collections import deque, defaultdict from typing import Dict, Union sys.path.append("../../") import torch import torchvision.utils as vutils from tensorboardX import SummaryWriter def make_recorder(cfg): return Recorder(cfg)
29
80
0.569317
5f1970116641c3a579674b0a3cde7a6940267ce4
5,642
py
Python
scrapytest/spiders.py
coderatchet/scrapy-test
4f5febfca05d267dc98df94e65a403210ce39d81
[ "Apache-2.0" ]
null
null
null
scrapytest/spiders.py
coderatchet/scrapy-test
4f5febfca05d267dc98df94e65a403210ce39d81
[ "Apache-2.0" ]
null
null
null
scrapytest/spiders.py
coderatchet/scrapy-test
4f5febfca05d267dc98df94e65a403210ce39d81
[ "Apache-2.0" ]
null
null
null
import logging import re from datetime import datetime import scrapy from scrapy.http import Response # noinspection PyUnresolvedReferences import scrapytest.db from scrapytest.config import config from scrapytest.types import Article from scrapytest.utils import merge_dict log = logging.getLogger(__name__)
40.589928
119
0.63045
5f19f6344a219107ca416c8c6abd1b139dea3270
6,490
py
Python
src/lib/parsers/parseskipfish.py
Project-Prismatica/Prism-Shell
006d04fdabbe51c4a3fd642e05ba276251f1bba4
[ "MIT" ]
null
null
null
src/lib/parsers/parseskipfish.py
Project-Prismatica/Prism-Shell
006d04fdabbe51c4a3fd642e05ba276251f1bba4
[ "MIT" ]
null
null
null
src/lib/parsers/parseskipfish.py
Project-Prismatica/Prism-Shell
006d04fdabbe51c4a3fd642e05ba276251f1bba4
[ "MIT" ]
1
2018-02-22T02:18:48.000Z
2018-02-22T02:18:48.000Z
#!/usr/bin/python # parseskipfish.py # # By Adrien de Beaupre [email protected] | [email protected] # Copyright 2011 Intru-Shun.ca Inc. # v0.09 # 16 October 2011 # # The current version of these scripts are at: http://dshield.handers.org/adebeaupre/ossams-parser.tgz # # Parses skipfish HTML and JSON output # http://code.google.com/p/skipfish/ # # This file is part of the ossams-parser. # # The ossams-parser is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # The ossams-parser is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with the ossams-parser. If not, see <http://www.gnu.org/licenses/>. # """ Napping of tool field to OSSAMS database field: tool field: database field: sf_version tooloutput.version scan_date tooloutput.tooldate severity vulnerabilities.severity type vulnerabilities.vulnerabilityid name vulnerabilities.vulnerabilityname request vulnerabilities.httprequest response vulnerabilities.httpresponse url vulnerabilities.vulnerabilityuri extra vulnerabilities.vulnerabilityextra """ # parseskipfish function
38.402367
130
0.686441
5f1c1c275c8674c941378ad94c7d52f05e79ddd2
14,861
py
Python
userge/plugins/admin/gban.py
wildyvpn-network/bot
87459495000bd6004b8f62a9cb933c164da9ef29
[ "MIT" ]
null
null
null
userge/plugins/admin/gban.py
wildyvpn-network/bot
87459495000bd6004b8f62a9cb933c164da9ef29
[ "MIT" ]
null
null
null
userge/plugins/admin/gban.py
wildyvpn-network/bot
87459495000bd6004b8f62a9cb933c164da9ef29
[ "MIT" ]
null
null
null
""" setup gban """ # Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". # Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > # # All rights reserved import json import asyncio from typing import Union import aiohttp import spamwatch from spamwatch.types import Ban from pyrogram.errors.exceptions.bad_request_400 import ( ChatAdminRequired, UserAdminInvalid, ChannelInvalid) from userge import userge, Message, Config, get_collection, filters, pool SAVED_SETTINGS = get_collection("CONFIGS") GBAN_USER_BASE = get_collection("GBAN_USER") WHITELIST = get_collection("WHITELIST_USER") CHANNEL = userge.getCLogger(__name__) LOG = userge.getLogger(__name__)
43.200581
95
0.554942
5f203d4af3e16b58b2caf10d5df99a539d4f0417
41
py
Python
user/tests/test_verifycode.py
Hrsn2861/pysat-server
72224bb0e6af8ef825eaf3259587698b5639b8a5
[ "MIT" ]
null
null
null
user/tests/test_verifycode.py
Hrsn2861/pysat-server
72224bb0e6af8ef825eaf3259587698b5639b8a5
[ "MIT" ]
7
2020-06-06T01:55:39.000Z
2022-02-10T11:46:31.000Z
user/tests/test_verifycode.py
Hrsnnnn/pysat-server
72224bb0e6af8ef825eaf3259587698b5639b8a5
[ "MIT" ]
null
null
null
"""pytest for user.models.verifycode """
13.666667
36
0.707317
5f20ed53742e88f3bc18e3804150cf7252de73ee
7,638
py
Python
src/python/codebay/common/runcommand.py
nakedible/vpnease-l2tp
0fcda6a757f2bc5c37f4753b3cd8b1c6d282db5c
[ "WTFPL" ]
5
2015-04-16T08:36:17.000Z
2017-05-12T17:20:12.000Z
src/python/codebay/common/runcommand.py
nakedible/vpnease-l2tp
0fcda6a757f2bc5c37f4753b3cd8b1c6d282db5c
[ "WTFPL" ]
null
null
null
src/python/codebay/common/runcommand.py
nakedible/vpnease-l2tp
0fcda6a757f2bc5c37f4753b3cd8b1c6d282db5c
[ "WTFPL" ]
4
2015-03-19T14:39:51.000Z
2019-01-23T08:22:55.000Z
""" Codebay process running utils. @group Running commands: run, call @group Preexec functions: chroot, cwd @var PASS: Specifies that the given file descriptor should be passed directly to the parent. Given as an argument to run. @var FAIL: Specifies that if output is received for the given file descriptor, an exception should be signalled. Given as an argument to run. @var STDOUT: Specifies that standard error should be redirected to the same file descriptor as standard out. Given as an argument to run. """ __docformat__ = 'epytext en' import os from codebay.common import subprocess PASS = -1 FAIL = -2 STDOUT = -3 def call(*args, **kw): """Convenience wrapper for calling run. Positional arguments are converted to a list and given to run as an argument. Keyword arguments are passed as is to run. >>> call('echo','-n','foo') [0, 'foo', ''] >>> call('exit 1', shell=True) [1, '', ''] """ return run(list(args), **kw) def run(args, executable=None, cwd=None, env=None, stdin=None, stdout=None, stderr=None, shell=False, preexec=None, retval=None): """Wrapper for running commands. run takes a lot of arguments and they are explained here. >>> run(['echo','-n','foo']) [0, 'foo', ''] >>> run('exit 1', shell=True) [1, '', ''] @param args: List of strings or a single string specifying the program and the arguments to execute. It is mandatory. @param executable: Name of the executable to be passed in argv[0]. Defaults to the first value of args. @param cwd: Working directory to execute the program in. Defaults to no change. Executes before preexec. @param env: Environment to execute the process with. Defaults to inheriting the environment of the current process. @param stdin: If None, process is executed with a pipe with no data given. If a string, process is executed with a pipe with the string as input. If PASS, process stdin is inherited from the current process. Defaults to None. @param stdout: If None, process stdout is captured with a pipe and returned. If PASS, process stdout is inherited from the current process. If FAIL, process stdout is captured with a pipe and an exception is raised if the process prints to stdout. Defaults to None. @param stderr: Same as above with one addition. If STDOUT, then stderr is redirected to the same destination as stdout. @param shell: If False, the command is executed directly. If True, the arguments are passed to the shell for interpretation. Defaults to False. @param preexec: Can be used to specify things to do just before starting the new child process. The argument should be a list or tuple, all of the callables in the list are executed just before starting the child process. Defaults to no function executed. @param retval: If None, no checks are performed on the child process' return value. If FAIL, an exception is raised if the child process return value is not zero. If a callable, the callable is invoked with the child process return value as an argument and an exception is raised if the callable returned False. @return: List of retval, stdout output string and stderr output string. If stdout or stderr is not captured, None is returned instead. @raise RunException: Raised if stdout output, stderr output or return value check triggered a failure. @raise ValueError: Raised if illegal arguments are detected. @raise OSError: Raised if starting the child process failed. """ if isinstance(args, list): popen_args = args elif isinstance(args, str): popen_args = [args] else: raise ValueError('Unknown value %s passed as args.' % repr(args)) if preexec is None: preexec_fn = None elif isinstance(preexec, (list, tuple)): preexec_fn = do_preexec else: raise ValueError('Unknown value %s passed as preexec.' % repr(preexec)) if stdin is None: popen_stdin = subprocess.PIPE popen_input = None elif stdin is PASS: popen_stdin = None popen_input = None elif isinstance(stdin, str): popen_stdin = subprocess.PIPE popen_input = stdin else: raise ValueError('Unknown value %s passed as stdin.' % repr(stdin)) if stdout is None: popen_stdout = subprocess.PIPE elif stdout is PASS: popen_stdout = None elif stdout is FAIL: popen_stdout = subprocess.PIPE else: raise ValueError('Unknown value %s passed as stdout.' % repr(stdout)) if stderr is None: popen_stderr = subprocess.PIPE elif stderr is PASS: popen_stderr = None elif stderr is FAIL: popen_stderr = subprocess.PIPE elif stderr is STDOUT: popen_stderr = subprocess.STDOUT else: raise ValueError('Unknown value %s passed as stderr.' % repr(stderr)) if retval is None: rvcheck = None elif retval is FAIL: rvcheck = do_check elif callable(retval): rvcheck = retval else: raise ValueError('Unknown value %s passed as retval.' % repr(retval)) handle, rv = None, None try: handle = subprocess.Popen(popen_args, executable=executable, stdin=popen_stdin, stdout=popen_stdout, stderr=popen_stderr, close_fds=True, cwd=cwd, env=env, shell=shell, preexec_fn=preexec_fn) stdout, stderr = handle.communicate(input=popen_input) finally: if handle is not None: rv = handle.wait() if stdout is FAIL: if stdout != '': e = RunException('Process printed to stdout.') e.rv = rv e.stdout = stdout e.stderr = stderr raise e if stderr is FAIL: if stderr != '': e = RunException('Process printed to stderr.') e.rv = rv e.stdout = stdout e.stderr = stderr raise e if rvcheck is not None: if not rvcheck(rv): e = RunException('Process return value check failed.') e.rv = rv e.stdout = stdout e.stderr = stderr raise e return [rv, stdout, stderr]
32.092437
129
0.615213
5f268730f61e34ddeec03c49cb3a27cf05cffa58
545
py
Python
SourceCode/Module2/escape_sequences.py
hackettccp/CIS106SampleCode
0717fa0f6dc0c48bc51f16ab44e7425b186a35c3
[ "MIT" ]
1
2019-10-23T03:25:43.000Z
2019-10-23T03:25:43.000Z
SourceCode/Module2/escape_sequences.py
hackettccp/CIS106
0717fa0f6dc0c48bc51f16ab44e7425b186a35c3
[ "MIT" ]
null
null
null
SourceCode/Module2/escape_sequences.py
hackettccp/CIS106
0717fa0f6dc0c48bc51f16ab44e7425b186a35c3
[ "MIT" ]
null
null
null
""" Demonstrates escape sequences in strings """ #Line Feed escape sequence. output1 = "First part \n Second part" print(output1) #********************************# print() #Double quotes escape sequence. output2 = "The book \"War and Peace\" is very long" print(output2) #********************************# print() #Single quote escape sequence. output3 = 'That is Tom\'s bike' print(output3) #********************************# print() #Backslash escape sequence. output4 = "A single backslash \\ will be inserted" print(output4)
18.793103
51
0.577982
5f289aaa4dfd07380db23d1700f9b70a80d10934
5,266
py
Python
oaipmh/__init__.py
scieloorg/oai-pmh
9d3044921d2d5cafb18e54f04070e8783f49c06d
[ "BSD-2-Clause" ]
2
2019-03-16T04:40:29.000Z
2022-03-10T14:50:21.000Z
oaipmh/__init__.py
DalavanCloud/oai-pmh
9d3044921d2d5cafb18e54f04070e8783f49c06d
[ "BSD-2-Clause" ]
27
2017-08-23T17:11:57.000Z
2021-06-01T21:57:31.000Z
oaipmh/__init__.py
DalavanCloud/oai-pmh
9d3044921d2d5cafb18e54f04070e8783f49c06d
[ "BSD-2-Clause" ]
2
2017-06-12T16:18:35.000Z
2019-03-16T04:40:12.000Z
import os import re from pyramid.config import Configurator from pyramid.events import NewRequest from oaipmh import ( repository, datastores, sets, utils, articlemeta, entities, ) from oaipmh.formatters import ( oai_dc, oai_dc_openaire, ) METADATA_FORMATS = [ (entities.MetadataFormat( metadataPrefix='oai_dc', schema='http://www.openarchives.org/OAI/2.0/oai_dc.xsd', metadataNamespace='http://www.openarchives.org/OAI/2.0/oai_dc/'), oai_dc.make_metadata, lambda x: x), (entities.MetadataFormat( metadataPrefix='oai_dc_openaire', schema='http://www.openarchives.org/OAI/2.0/oai_dc.xsd', metadataNamespace='http://www.openarchives.org/OAI/2.0/oai_dc/'), oai_dc_openaire.make_metadata, oai_dc_openaire.augment_metadata), ] STATIC_SETS = [ (sets.Set(setSpec='openaire', setName='OpenAIRE'), datastores.identityview), ] DEFAULT_SETTINGS = [ ('oaipmh.repo.name', 'OAIPMH_REPO_NAME', str, 'SciELO - Scientific Electronic Library Online'), ('oaipmh.repo.baseurl', 'OAIPMH_REPO_BASEURL', str, 'http://www.scielo.br/oai/scielo-oai.php'), ('oaipmh.repo.protocolversion', 'OAIPMH_REPO_PROTOCOLVERSION', str, '2.0'), ('oaipmh.repo.adminemail', 'OAIPMH_REPO_ADMINEMAIL', str, '[email protected]'), ('oaipmh.repo.earliestdatestamp', 'OAIPMH_REPO_EARLIESTDATESTAMP', utils.parse_date, '1998-08-01'), ('oaipmh.repo.deletedrecord', 'OAIPMH_REPO_DELETEDRECORD', str, 'no'), ('oaipmh.repo.granularity', 'OAIPMH_REPO_GRANULARITY', str, 'YYYY-MM-DD'), ('oaipmh.repo.granularity_regex', 'OAIPMH_REPO_GRANULARITY_REGEX', re.compile, r'^(\d{4})-(\d{2})-(\d{2})$'), ('oaipmh.collection', 'OAIPMH_COLLECTION', str, 'scl'), ('oaipmh.listslen', 'OAIPMH_LISTSLEN', int, 100), ('oaipmh.chunkedresumptiontoken.chunksize', 'OAIPMH_CHUNKEDRESUMPTIONTOKEN_CHUNKSIZE', int, 12), ('oaipmh.articlemeta_uri', 'OAIPMH_ARTICLEMETA_URI', str, 'articlemeta.scielo.org:11621'), ] def parse_settings(settings): """Analisa e retorna as configuraes da app com base no arquivo .ini e env. As variveis de ambiente possuem precedncia em relao aos valores definidos no arquivo .ini. """ parsed = {} cfg = list(DEFAULT_SETTINGS) for name, envkey, convert, default in cfg: value = os.environ.get(envkey, settings.get(name, default)) if convert is not None: value = convert(value) parsed[name] = value return parsed def main(global_config, **settings): """ This function returns a Pyramid WSGI application. """ settings.update(parse_settings(settings)) config = Configurator(settings=settings) config.add_subscriber(add_oai_repository, NewRequest) # URL patterns config.add_route('root', '/') config.scan() return config.make_wsgi_app()
33.329114
80
0.657615
5f2a79411bbedc2b8b017ecceddbf86f3d9843cc
1,613
py
Python
create_training_data.py
nasi-famnit/HOur-flight
96a9aeb1cf0f3fa588c587db08ba0b8fa980eac9
[ "MIT" ]
1
2016-04-24T10:49:52.000Z
2016-04-24T10:49:52.000Z
create_training_data.py
nasi-famnit/HOur-flight
96a9aeb1cf0f3fa588c587db08ba0b8fa980eac9
[ "MIT" ]
null
null
null
create_training_data.py
nasi-famnit/HOur-flight
96a9aeb1cf0f3fa588c587db08ba0b8fa980eac9
[ "MIT" ]
null
null
null
import flightdata import weatherparser import airportdata import pandas as pd from datetime import datetime from pathlib import Path flights = flightdata.read_csv('data/unpacked/flights/On_Time_On_Time_Performance_2016_1.csv') fname = 'data/processed/training/training{:04}_v1.csv' prev_time = datetime.now() df = pd.DataFrame() current_csv_name = Path(fname.format(1)) for idx, flight in flights.iterrows(): idx = idx+1 if idx%100 == 0: now_time = datetime.now() delta = now_time - prev_time print('Processing file', idx, ',', 100.0/delta.total_seconds(), 'per second') prev_time = now_time if idx % 1000 == 0: ff = fname.format(idx//1000) current_csv_name = Path(fname.format(1+idx//1000)) print('Writing to', ff) df.to_csv(ff) else: if current_csv_name.exists(): continue ff = flight[['Year', 'Month', 'DayofMonth', 'DayOfWeek', 'UniqueCarrier', 'Origin', 'Dest', 'CRSDepTime', 'DepDelayMinutes', 'DepDel15', 'CRSArrTime', 'ArrTime', 'ArrDelay', 'ArrDelayMinutes', 'ArrDel15', 'CRSElapsedTime', 'ActualElapsedTime', 'Distance', 'WeatherDelay']] weather_origin = weatherparser.get_weather_conditions(airportdata.from_faa(ff.Origin), ff.CRSDepTime) weather_dest = weatherparser.get_weather_conditions(airportdata.from_faa(ff.Dest), ff.CRSArrTime) if (weather_origin is None) or ( weather_dest is None): continue line = pd.DataFrame(pd.concat([ff, weather_origin, weather_dest])).T if idx%1000==1: df = line else: df = df.append(line)
37.511628
276
0.675139
5f2bba8707cde7a8ee1262b60500da6ac69cd76b
5,618
py
Python
study/python/pyqt/app/signup.py
cheenwe/blog
a866b3ab98aa58e3ed4a7624fbb72c8fd8dee790
[ "MIT" ]
10
2016-09-28T03:22:41.000Z
2020-06-16T08:42:25.000Z
study/python/pyqt/app/signup.py
cheenwe/blog
a866b3ab98aa58e3ed4a7624fbb72c8fd8dee790
[ "MIT" ]
12
2017-04-18T08:41:04.000Z
2020-06-10T02:54:58.000Z
study/python/pyqt/app/signup.py
cheenwe/blog
a866b3ab98aa58e3ed4a7624fbb72c8fd8dee790
[ "MIT" ]
8
2016-09-28T03:03:32.000Z
2019-09-16T04:22:01.000Z
from PyQt5 import QtCore, QtGui, QtWidgets from db import Db if __name__ == "__main__": import sys app = QtWidgets.QApplication(sys.argv) Dialog = QtWidgets.QDialog() ui = Ui_Signup() ui.setupUi(Dialog) Dialog.show() sys.exit(app.exec_())
41.925373
73
0.619794
5f2c618b2d6e7fe4b895b468c576b02558bec6fb
70
py
Python
gym_android_wechat_jump/env/__init__.py
gooooloo/gym-android-wechat-jump
f7c576316ae07d9701cc467ef271f838418d8695
[ "MIT" ]
null
null
null
gym_android_wechat_jump/env/__init__.py
gooooloo/gym-android-wechat-jump
f7c576316ae07d9701cc467ef271f838418d8695
[ "MIT" ]
null
null
null
gym_android_wechat_jump/env/__init__.py
gooooloo/gym-android-wechat-jump
f7c576316ae07d9701cc467ef271f838418d8695
[ "MIT" ]
null
null
null
from gym_android_wechat_jump.env.wechat_jump_env import WechatJumpEnv
35
69
0.914286
5f2c8d2aea105ec6207836197f28f050f9bd7157
318
py
Python
bot/__init__.py
sudomice/crypto-bot
51dcf66d79612f2ba8bdf5645005b143fbeda343
[ "MIT" ]
null
null
null
bot/__init__.py
sudomice/crypto-bot
51dcf66d79612f2ba8bdf5645005b143fbeda343
[ "MIT" ]
null
null
null
bot/__init__.py
sudomice/crypto-bot
51dcf66d79612f2ba8bdf5645005b143fbeda343
[ "MIT" ]
null
null
null
import requests from bot.constants import BASE_ENDPOINT import cli.app # bot.add_param("-h", "--help", help="HELP me") if __name__ == '__main__': bot.run()
19.875
61
0.701258
5f2e54facc35f3d3aca215fe2e3b9ff2dc7350a5
4,374
py
Python
metadrive/config.py
wefindx/metadrive
576d240065b61b0187afc249819b705c06308d05
[ "Apache-2.0" ]
7
2019-02-04T18:31:06.000Z
2021-12-22T17:08:55.000Z
metadrive/config.py
wefindx/metadrive
576d240065b61b0187afc249819b705c06308d05
[ "Apache-2.0" ]
11
2019-04-30T18:19:33.000Z
2019-08-15T19:56:37.000Z
metadrive/config.py
wefindx/metadrive
576d240065b61b0187afc249819b705c06308d05
[ "Apache-2.0" ]
2
2019-01-26T03:17:25.000Z
2019-04-15T18:35:56.000Z
import os import imp from pathlib import Path import configparser import requests import gpgrecord config = configparser.ConfigParser() INSTALLED = imp.find_module('metadrive')[1] HOME = str(Path.home()) DEFAULT_LOCATION = os.path.join(HOME,'.metadrive') CONFIG_LOCATION = os.path.join(DEFAULT_LOCATION, 'config') CREDENTIALS_DIR = os.path.join(DEFAULT_LOCATION, '-/+') SESSIONS_DIR = os.path.join(DEFAULT_LOCATION, 'sessions') DATA_DIR = os.path.join(DEFAULT_LOCATION, 'data') SITES_DIR = os.path.join(HOME, 'Sites') KNOWN_DRIVERS = os.path.join(DEFAULT_LOCATION, 'known_drivers') SUBTOOLS = [ fn.rsplit('.py')[0] for fn in os.listdir(INSTALLED) if fn.startswith('_') and fn.endswith('.py') and not fn == '__init__.py' ] ENSURE_SESSIONS() ENSURE_DATA() ENSURE_SITES() if not os.path.exists(CONFIG_LOCATION): username = input("Type your GitHub username: ") config['GITHUB'] = {'USERNAME': username} config['PROXIES'] = {'http': '', 'https': ''} config['DRIVERS'] = {'auto_upgrade': False} config['SELENIUM'] = {'headless': False} config['DRIVER_BACKENDS'] = { 'CHROME': '/usr/bin/chromedriver' # e.g., or http://0.0.0.0:4444/wd/hub, etc. } with open(CONFIG_LOCATION, 'w') as configfile: config.write(configfile) config.read(CONFIG_LOCATION) GITHUB_USER = config['GITHUB']['USERNAME'] REPO_PATH = os.path.join(DEFAULT_LOCATION, '-') DRIVERS_PATH = os.path.join(DEFAULT_LOCATION, 'drivers') CHROME_DRIVER = config['DRIVER_BACKENDS']['CHROME'] SELENIUM = config['SELENIUM'] if str(config['DRIVERS']['auto_upgrade']) == 'False': AUTO_UPGRADE_DRIVERS = False elif str(config['DRIVERS']['auto_upgrade']) == 'True': AUTO_UPGRADE_DRIVERS = True elif str(config['DRIVERS']['auto_upgrade']) == 'None': AUTO_UPGRADE_DRIVERS = None else: AUTO_UPGRADE_DRIVERS = False
29.355705
131
0.645405
5f2efcc18abcce7bbf0e01ac810dce1793930f16
1,272
py
Python
project/matching/migrations/0001_initial.py
Project-EPIC/emergencypetmatcher
72c9eec228e33c9592243266e048dc02824d778d
[ "MIT" ]
null
null
null
project/matching/migrations/0001_initial.py
Project-EPIC/emergencypetmatcher
72c9eec228e33c9592243266e048dc02824d778d
[ "MIT" ]
null
null
null
project/matching/migrations/0001_initial.py
Project-EPIC/emergencypetmatcher
72c9eec228e33c9592243266e048dc02824d778d
[ "MIT" ]
1
2021-06-24T01:50:06.000Z
2021-06-24T01:50:06.000Z
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations
43.862069
123
0.644654
5f30dced4b52419281f10b8f50593c7065a03df1
3,273
py
Python
sdk/python/pulumi_aws/get_ip_ranges.py
Charliekenney23/pulumi-aws
55bd0390160d27350b297834026fee52114a2d41
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
sdk/python/pulumi_aws/get_ip_ranges.py
Charliekenney23/pulumi-aws
55bd0390160d27350b297834026fee52114a2d41
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
sdk/python/pulumi_aws/get_ip_ranges.py
Charliekenney23/pulumi-aws
55bd0390160d27350b297834026fee52114a2d41
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import json import warnings import pulumi import pulumi.runtime from . import utilities, tables
42.506494
245
0.65689
5f31588bc153ffcf5b70c1b521bc861fcd11b513
5,123
py
Python
lithops/localhost/local_handler.py
GEizaguirre/lithops
296451ea3ebf630a5dca2f17248387e6bb1ee5b6
[ "Apache-2.0" ]
null
null
null
lithops/localhost/local_handler.py
GEizaguirre/lithops
296451ea3ebf630a5dca2f17248387e6bb1ee5b6
[ "Apache-2.0" ]
null
null
null
lithops/localhost/local_handler.py
GEizaguirre/lithops
296451ea3ebf630a5dca2f17248387e6bb1ee5b6
[ "Apache-2.0" ]
null
null
null
import os import sys import json import pkgutil import logging import uuid import time import multiprocessing from pathlib import Path from threading import Thread from types import SimpleNamespace from multiprocessing import Process, Queue from lithops.utils import version_str, is_unix_system from lithops.worker import function_handler from lithops.config import STORAGE_DIR, JOBS_DONE_DIR from lithops import __version__ os.makedirs(STORAGE_DIR, exist_ok=True) os.makedirs(JOBS_DONE_DIR, exist_ok=True) log_file = os.path.join(STORAGE_DIR, 'local_handler.log') logging.basicConfig(filename=log_file, level=logging.INFO) logger = logging.getLogger('handler') CPU_COUNT = multiprocessing.cpu_count() if __name__ == "__main__": logger.info('Starting Localhost job handler') command = sys.argv[1] logger.info('Received command: {}'.format(command)) if command == 'preinstalls': extract_runtime_meta() elif command == 'run': job_filename = sys.argv[2] logger.info('Got {} job file'.format(job_filename)) with open(job_filename, 'rb') as jf: job = SimpleNamespace(**json.load(jf)) logger.info('ExecutorID {} | JobID {} - Starting execution' .format(job.executor_id, job.job_id)) localhost_execuor = LocalhostExecutor(job.config, job.executor_id, job.job_id, job.log_level) localhost_execuor.run(job.job_description) localhost_execuor.wait() sentinel = '{}/{}_{}.done'.format(JOBS_DONE_DIR, job.executor_id.replace('/', '-'), job.job_id) Path(sentinel).touch() logger.info('ExecutorID {} | JobID {} - Execution Finished' .format(job.executor_id, job.job_id))
33.927152
104
0.610189
a024addbdbfe31b4c073485e18f6d69dfd1ced29
17,878
py
Python
app/FileViewer/FileServer/misc/mmpython/video/riffinfo.py
benyaboy/sage-graphics
090640167329ace4b6ad266d47db5bb2b0394232
[ "Unlicense" ]
null
null
null
app/FileViewer/FileServer/misc/mmpython/video/riffinfo.py
benyaboy/sage-graphics
090640167329ace4b6ad266d47db5bb2b0394232
[ "Unlicense" ]
null
null
null
app/FileViewer/FileServer/misc/mmpython/video/riffinfo.py
benyaboy/sage-graphics
090640167329ace4b6ad266d47db5bb2b0394232
[ "Unlicense" ]
1
2021-07-02T10:31:03.000Z
2021-07-02T10:31:03.000Z
#if 0 # $Id: riffinfo.py,v 1.33 2005/03/15 17:50:45 dischi Exp $ # $Log: riffinfo.py,v $ # Revision 1.33 2005/03/15 17:50:45 dischi # check for corrupt avi # # Revision 1.32 2005/03/04 17:41:29 dischi # handle broken avi files # # Revision 1.31 2004/12/13 10:19:07 dischi # more debug, support LIST > 20000 (new max is 80000) # # Revision 1.30 2004/08/25 16:18:14 dischi # detect aspect ratio # # Revision 1.29 2004/05/24 16:17:09 dischi # Small changes for future updates # # Revision 1.28 2004/01/31 12:23:46 dischi # remove bad chars from table (e.g. char 0 is True) # # Revision 1.27 2003/10/04 14:30:08 dischi # add audio delay for avi # # Revision 1.26 2003/07/10 11:18:11 the_krow # few more attributes added # # Revision 1.25 2003/07/07 21:36:44 dischi # make fps a float and round it to two digest after the comma # # Revision 1.24 2003/07/05 19:36:37 the_krow # length fixed # fps introduced # # Revision 1.23 2003/07/02 11:17:30 the_krow # language is now part of the table key # # Revision 1.22 2003/07/01 21:06:50 dischi # no need to import factory (and when, use "from mmpython import factory" # # Revision 1.21 2003/06/30 13:17:20 the_krow # o Refactored mediainfo into factory, synchronizedobject # o Parsers now register directly at mmpython not at mmpython.mediainfo # o use mmpython.Factory() instead of mmpython.mediainfo.get_singleton() # o Bugfix in PNG parser # o Renamed disc.AudioInfo into disc.AudioDiscInfo # o Renamed disc.DataInfo into disc.DataDiscInfo # # Revision 1.20 2003/06/23 20:48:11 the_krow # width + height fixes for OGM files # # Revision 1.19 2003/06/23 20:38:04 the_krow # Support for larger LIST chunks because some files did not work. # # Revision 1.18 2003/06/20 19:17:22 dischi # remove filename again and use file.name # # Revision 1.17 2003/06/20 19:05:56 dischi # scan for subtitles # # Revision 1.16 2003/06/20 15:29:42 the_krow # Metadata Mapping # # Revision 1.15 2003/06/20 14:43:57 the_krow # Putting Metadata into MediaInfo from AVIInfo Table # # Revision 1.14 2003/06/09 16:10:52 dischi # error handling # # Revision 1.13 2003/06/08 19:53:21 dischi # also give the filename to init for additional data tests # # Revision 1.12 2003/06/08 13:44:58 dischi # Changed all imports to use the complete mmpython path for mediainfo # # Revision 1.11 2003/06/08 13:11:38 dischi # removed print at the end and moved it into register # # Revision 1.10 2003/06/07 23:10:50 the_krow # Changed mp3 into new format. # # Revision 1.9 2003/06/07 22:30:22 the_krow # added new avinfo structure # # Revision 1.8 2003/06/07 21:48:47 the_krow # Added Copying info # started changing riffinfo to new AV stuff # # Revision 1.7 2003/05/13 12:31:43 the_krow # + Copyright Notice # # # MMPython - Media Metadata for Python # Copyright (C) 2003 Thomas Schueppel, Dirk Meyer # # 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. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MER- # CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # ----------------------------------------------------------------------- #endif import re import struct import string import fourcc # import factory import mmpython from mmpython import mediainfo # List of tags # http://kibus1.narod.ru/frames_eng.htm?sof/abcavi/infotags.htm # http://www.divx-digest.com/software/avitags_dll.html # File Format # http://www.taenam.co.kr/pds/documents/odmlff2.pdf _print = mediainfo._debug AVIINFO_tags = { 'title': 'INAM', 'artist': 'IART', 'product': 'IPRD', 'date': 'ICRD', 'comment': 'ICMT', 'language': 'ILNG', 'keywords': 'IKEY', 'trackno': 'IPRT', 'trackof': 'IFRM', 'producer': 'IPRO', 'writer': 'IWRI', 'genre': 'IGNR', 'copyright': 'ICOP', 'trackno': 'IPRT', 'trackof': 'IFRM', 'comment': 'ICMT', } mmpython.registertype( 'video/avi', ('avi',), mediainfo.TYPE_AV, RiffInfo )
33.107407
85
0.507663
a0282750f46f0e414d25e4e4d34acff48c249677
843
py
Python
h1st_contrib/cli/__init__.py
h1st-ai/h1st-contrib
38fbb1fff4513bb3433bc12f2b436836e5e51c80
[ "Apache-2.0" ]
1
2022-02-19T18:55:43.000Z
2022-02-19T18:55:43.000Z
h1st_contrib/cli/__init__.py
h1st-ai/h1st-contrib
38fbb1fff4513bb3433bc12f2b436836e5e51c80
[ "Apache-2.0" ]
null
null
null
h1st_contrib/cli/__init__.py
h1st-ai/h1st-contrib
38fbb1fff4513bb3433bc12f2b436836e5e51c80
[ "Apache-2.0" ]
null
null
null
"""H1st CLI.""" import click from .pred_maint import h1st_pmfp_cli
24.085714
51
0.498221
a0294cc7bc1ae9063a289d36fbf581ccd346caba
1,008
py
Python
SC_projects/recursion/dice_rolls_sum.py
hsiaohan416/stancode
8920f2e99e184d165fa04551f24a2da8b0975219
[ "MIT" ]
null
null
null
SC_projects/recursion/dice_rolls_sum.py
hsiaohan416/stancode
8920f2e99e184d165fa04551f24a2da8b0975219
[ "MIT" ]
null
null
null
SC_projects/recursion/dice_rolls_sum.py
hsiaohan416/stancode
8920f2e99e184d165fa04551f24a2da8b0975219
[ "MIT" ]
null
null
null
""" File: dice_rolls_sum.py Name: Sharon ----------------------------- This program finds all the dice rolls permutations that sum up to a constant TOTAL. Students will find early stopping a good strategy of decreasing the number of recursive calls """ # This constant controls the sum of dice of our interest TOTAL = 8 # global variable run_times = 0 if __name__ == '__main__': main()
21
56
0.545635
a02a39862663da51e8f5219d5dd8ae0de6edd96f
909
py
Python
valid_parentheses.py
KevinLuo41/LeetCodeInPython
051e1aab9bab17b0d63b4ca73473a7a00899a16a
[ "Apache-2.0" ]
19
2015-01-19T19:36:09.000Z
2020-03-18T03:10:12.000Z
valid_parentheses.py
CodingVault/LeetCodeInPython
051e1aab9bab17b0d63b4ca73473a7a00899a16a
[ "Apache-2.0" ]
null
null
null
valid_parentheses.py
CodingVault/LeetCodeInPython
051e1aab9bab17b0d63b4ca73473a7a00899a16a
[ "Apache-2.0" ]
12
2015-04-25T14:20:38.000Z
2020-09-27T04:59:59.000Z
#!/usr/bin/env python # encoding: utf-8 """ valid_parentheses.py Created by Shengwei on 2014-07-24. """ # https://oj.leetcode.com/problems/valid-parentheses/ # tags: easy, array, parentheses, stack """ Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the correct order, "()" and "()[]{}" are all valid but "(]" and "([)]" are not. """
26.735294
118
0.540154
a0302470addb803e75aa2587a1202d6ec072bcdf
3,104
py
Python
doc/terms.py
RaenonX/Jelly-Bot-API
c7da1e91783dce3a2b71b955b3a22b68db9056cf
[ "MIT" ]
5
2020-08-26T20:12:00.000Z
2020-12-11T16:39:22.000Z
doc/terms.py
RaenonX/Jelly-Bot
c7da1e91783dce3a2b71b955b3a22b68db9056cf
[ "MIT" ]
234
2019-12-14T03:45:19.000Z
2020-08-26T18:55:19.000Z
doc/terms.py
RaenonX/Jelly-Bot-API
c7da1e91783dce3a2b71b955b3a22b68db9056cf
[ "MIT" ]
2
2019-10-23T15:21:15.000Z
2020-05-22T09:35:55.000Z
"""Terms used in the bot.""" from collections import OrderedDict from dataclasses import dataclass from typing import List from django.utils.translation import gettext_lazy as _ from JellyBot.systemconfig import Database terms_collection = OrderedDict() terms_collection["Core"] = TermsCollection( _("Core"), [TermExplanation(_("Operation"), _("The system has two ways to control: on the website, using the API. " "Some actions may only available at a single side."), _("-")) ] ) terms_collection["Features"] = TermsCollection( _("Features"), [TermExplanation(_("Auto-Reply"), _("When the system receives/sees a word, it will reply back certain word(s) if it is set."), _("User A setup an Auto-Reply module, which keyword is **A** and reply is **B**. Then, " "somebody typed **A** wherever Jelly BOT can see, so Jelly BOT will reply **B** back.")), TermExplanation(_("Execode"), _("The users provide partial required information for an operation, then the system will yield a " "code (Execode) to the users for completing it while holding it for %d hrs.<br>" "Users will need to use the given Execode with the missing information for completing the " "operation before it expires.") % (Database.ExecodeExpirySeconds // 3600), _("User B created an Auto-Reply module on the website and choose the issue an Execode option. " "Then, he submit the Execode in the channel, so the Auto-Reply module is registered.")), TermExplanation(_("Profile System/Permission"), _("Users can have multiple profiles in the channel for various features use. Profiles will have " "some permission or their privilege attached.<br>Some profiles may be granted by votes from " "channel members or assigned by channel manager.<br>" "This system is similar to the role system of **Discord**."), _("ChannelA have profiles called **A** with admin privilege and **B** for normal users.<br>" "Users who have profile **A** assigned will be able to " "use features that only admins can use.")), TermExplanation(_("Channel Management"), _("Users will be able to adjust the settings specifically designated to the channel. " "The availability of what can be adjusted will base on the user's profile."), _("Eligibility of accessing the pinned auto-reply module, " "changing the admin/mod of a channel...etc.")), ] )
47.030303
119
0.61018
a03080839b2f11f2ef3a1cda34e010ada93f1947
2,619
py
Python
tofnet/training/losses.py
victorjoos/tof2net
068f5f08a241dbfb950251bea52fd9379466bf2f
[ "MIT" ]
null
null
null
tofnet/training/losses.py
victorjoos/tof2net
068f5f08a241dbfb950251bea52fd9379466bf2f
[ "MIT" ]
8
2021-02-02T23:07:37.000Z
2022-03-12T00:51:26.000Z
tofnet/training/losses.py
victorjoos/tof2net
068f5f08a241dbfb950251bea52fd9379466bf2f
[ "MIT" ]
2
2020-10-01T08:23:24.000Z
2020-11-09T22:01:47.000Z
import numpy as np import operator from itertools import cycle from torch import nn import torch.nn.functional as F import torch from torch.nn.modules.loss import * from kornia.losses import * """ #################### Single-class CNN #################### """
30.811765
124
0.655594
a030c83c63bfd7833e9eefaa8a970b32e999331c
5,111
py
Python
tests/cli/test_database.py
julienc91/dbtrigger
d06916a019641377bf3d45b2e8e38399643450db
[ "MIT" ]
null
null
null
tests/cli/test_database.py
julienc91/dbtrigger
d06916a019641377bf3d45b2e8e38399643450db
[ "MIT" ]
null
null
null
tests/cli/test_database.py
julienc91/dbtrigger
d06916a019641377bf3d45b2e8e38399643450db
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- import uuid import pytest from dbtrigger.cli import DatabaseCli, QueryCli, ServerCli from dbtrigger.config import settings from dbtrigger.models import Database
38.428571
116
0.772256
a0316cb627ebde16bd1be493b5901c78bcdf8ad7
1,557
py
Python
reqtest.py
jbreams/nagmq
3fee4209898c717a02c5a07ba4c335428b9403eb
[ "Apache-2.0" ]
21
2015-02-17T07:45:40.000Z
2021-03-19T13:12:48.000Z
reqtest.py
jbreams/nagmq
3fee4209898c717a02c5a07ba4c335428b9403eb
[ "Apache-2.0" ]
7
2015-04-29T22:12:44.000Z
2018-05-09T15:46:35.000Z
reqtest.py
jbreams/nagmq
3fee4209898c717a02c5a07ba4c335428b9403eb
[ "Apache-2.0" ]
9
2015-08-01T01:22:28.000Z
2021-02-24T11:12:41.000Z
import zmq, time, json context = zmq.Context() pub = context.socket(zmq.REQ) # These are random useless keys for testing Curve auth pubkey = u"7d0:tz+tGVT&*ViD/SzU)dz(3=yIE]aT2TRNrG2$" privkey = u"FCFo%:3pZTbiQq?MARHYk(<Kp*B-<RpRG7QMUlXr" serverkey = u"mN>y$-+17hxa6F>r@}sxmL-uX}IM=:wIq}G4y*f[" pub.setsockopt_string(zmq.CURVE_PUBLICKEY, pubkey) pub.setsockopt_string(zmq.CURVE_SECRETKEY, privkey) pub.setsockopt_string(zmq.CURVE_SERVERKEY, serverkey) pub.connect("tcp://localhost:5557") keys = ['host_name', 'services', 'hosts', 'contacts', 'contact_groups', 'service_description', 'current_state', 'members', 'type', 'name', 'problem_has_been_acknowledged', 'plugin_output' ] pub.send_json({ "host_name": "localhost", "include_services": True, "include_contacts": True, 'keys': keys }) resp = json.loads(pub.recv()) for obj in resp: if(obj['type'] == 'service'): print "{0}@{1}: {2} {3}".format( obj['service_description'], obj['host_name'], status_to_string(obj['current_state'], 0), obj['plugin_output']) elif(obj['type'] == 'host'): print "{0}: {1} {2}".format( obj['host_name'], status_to_string(obj['current_state'], 1), obj['plugin_output']) elif(obj['type'] == 'error'): print obj['msg'] elif(obj['type'] == 'service_list'): print obj['services']
31.14
109
0.666667
a032b7d1d6d08d471ad93367224c6b5463ad7672
392
py
Python
extract_emails/email_filters/email_filter_interface.py
trisongz/extract-emails
22485fd25edac993d448bf8e8af51c551694e5cd
[ "MIT" ]
1
2020-11-22T01:29:41.000Z
2020-11-22T01:29:41.000Z
extract_emails/email_filters/email_filter_interface.py
chiaminchuang/extract-emails
d7549186549a0776cfa28bc946550fd79b04043e
[ "MIT" ]
null
null
null
extract_emails/email_filters/email_filter_interface.py
chiaminchuang/extract-emails
d7549186549a0776cfa28bc946550fd79b04043e
[ "MIT" ]
null
null
null
from abc import ABC, abstractmethod from typing import List
20.631579
62
0.614796
a032fe94d351a63b7d04128ecd927fbb6c87a879
6,144
py
Python
service/azservice/tooling1.py
cnective-inc/vscode-azurecli
0ac34e2214078270b63cf6716423d40a60423834
[ "MIT" ]
38
2019-06-21T00:26:15.000Z
2022-03-19T05:23:55.000Z
service/azservice/tooling1.py
cnective-inc/vscode-azurecli
0ac34e2214078270b63cf6716423d40a60423834
[ "MIT" ]
46
2017-05-17T09:00:51.000Z
2019-04-24T10:18:19.000Z
service/azservice/tooling1.py
cnective-inc/vscode-azurecli
0ac34e2214078270b63cf6716423d40a60423834
[ "MIT" ]
27
2019-05-19T18:42:42.000Z
2022-01-18T09:14:26.000Z
"""tooling integration""" # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- from __future__ import print_function import os import traceback from importlib import import_module from sys import stderr import pkgutil import yaml from six.moves import configparser from azure.cli.core.application import APPLICATION, Configuration from azure.cli.core.commands import _update_command_definitions, BLACKLISTED_MODS from azure.cli.core._profile import _SUBSCRIPTION_NAME, Profile from azure.cli.core._session import ACCOUNT from azure.cli.core._environment import get_config_dir as cli_config_dir from azure.cli.core._config import az_config, GLOBAL_CONFIG_PATH, DEFAULTS_SECTION from azure.cli.core.help_files import helps from azure.cli.core.util import CLIError GLOBAL_ARGUMENTS = { 'verbose': { 'options': ['--verbose'], 'help': 'Increase logging verbosity. Use --debug for full debug logs.' }, 'debug': { 'options': ['--debug'], 'help': 'Increase logging verbosity to show all debug logs.' }, 'output': { 'options': ['--output', '-o'], 'help': 'Output format', 'choices': ['json', 'tsv', 'table', 'jsonc'] }, 'help': { 'options': ['--help', '-h'], 'help': 'Get more information about a command' }, 'query': { 'options': ['--query'], 'help': 'JMESPath query string. See http://jmespath.org/ for more information and examples.' } } HELP_CACHE = {} PROFILE = Profile()
29.681159
108
0.662598
a03374010f5d746041d0825cf88d30f7bf187cff
57
py
Python
copy_topic_files.py
FoamyGuy/CircuitPython_Repo_Topics
9a606e9549bcd663d6290c0648466022c1b964db
[ "MIT" ]
null
null
null
copy_topic_files.py
FoamyGuy/CircuitPython_Repo_Topics
9a606e9549bcd663d6290c0648466022c1b964db
[ "MIT" ]
null
null
null
copy_topic_files.py
FoamyGuy/CircuitPython_Repo_Topics
9a606e9549bcd663d6290c0648466022c1b964db
[ "MIT" ]
null
null
null
import os os.system("cp -r ../../../topic_scripts/* ./")
19
46
0.561404
a0355bef2d29e903faa1a547fedc8fc74c627d30
537
py
Python
metaopt/concurrent/worker/worker.py
cigroup-ol/metaopt
6dfd5105d3c6eaf00f96670175cae16021069514
[ "BSD-3-Clause" ]
8
2015-02-02T21:42:23.000Z
2019-06-30T18:12:43.000Z
metaopt/concurrent/worker/worker.py
cigroup-ol/metaopt
6dfd5105d3c6eaf00f96670175cae16021069514
[ "BSD-3-Clause" ]
4
2015-09-24T14:12:38.000Z
2021-12-08T22:42:52.000Z
metaopt/concurrent/worker/worker.py
cigroup-ol/metaopt
6dfd5105d3c6eaf00f96670175cae16021069514
[ "BSD-3-Clause" ]
6
2015-02-27T12:35:33.000Z
2020-10-15T21:04:02.000Z
# -*- coding: utf-8 -*- """ Minimal worker implementation. """ # Future from __future__ import absolute_import, division, print_function, \ unicode_literals, with_statement # First Party from metaopt.concurrent.worker.base import BaseWorker
20.653846
67
0.687151
a036a26ddca3cff8f085b18091bc763c3dc73fd2
261
py
Python
Fundamentos/test-constantes.py
ijchavez/python
bccd94a9bee90125e2be27b0355bdaedb0ae9d19
[ "Unlicense" ]
null
null
null
Fundamentos/test-constantes.py
ijchavez/python
bccd94a9bee90125e2be27b0355bdaedb0ae9d19
[ "Unlicense" ]
null
null
null
Fundamentos/test-constantes.py
ijchavez/python
bccd94a9bee90125e2be27b0355bdaedb0ae9d19
[ "Unlicense" ]
null
null
null
# para importar todo from constantes import * from constantes import MI_CONSTANTE from constantes import Matematicas as Mate print(MI_CONSTANTE) print(Mate.PI) MI_CONSTANTE = "nuevo valor" Mate.PI = "3.14" print(">>>",MI_CONSTANTE) print(">>>",Mate.PI)
18.642857
45
0.735632
a03a7becb2df6dd7e3600ceabbb203ca1e648d2d
10,131
py
Python
venv/lib/python3.8/site-packages/hgext/remotefilelog/shallowbundle.py
JesseDavids/mqtta
389eb4f06242d4473fe1bcff7fc6a22290e0d99c
[ "Apache-2.0" ]
4
2021-02-05T10:57:39.000Z
2022-02-25T04:43:23.000Z
venv/lib/python3.8/site-packages/hgext/remotefilelog/shallowbundle.py
JesseDavids/mqtta
389eb4f06242d4473fe1bcff7fc6a22290e0d99c
[ "Apache-2.0" ]
null
null
null
venv/lib/python3.8/site-packages/hgext/remotefilelog/shallowbundle.py
JesseDavids/mqtta
389eb4f06242d4473fe1bcff7fc6a22290e0d99c
[ "Apache-2.0" ]
null
null
null
# shallowbundle.py - bundle10 implementation for use with shallow repositories # # Copyright 2013 Facebook, Inc. # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. from __future__ import absolute_import from mercurial.i18n import _ from mercurial.node import bin, hex, nullid from mercurial import ( bundlerepo, changegroup, error, match, mdiff, pycompat, ) from . import ( constants, remotefilelog, shallowutil, ) NoFiles = 0 LocalFiles = 1 AllFiles = 2 def makechangegroup(orig, repo, outgoing, version, source, *args, **kwargs): if not shallowutil.isenabled(repo): return orig(repo, outgoing, version, source, *args, **kwargs) original = repo.shallowmatch try: # if serving, only send files the clients has patterns for if source == b'serve': bundlecaps = kwargs.get('bundlecaps') includepattern = None excludepattern = None for cap in bundlecaps or []: if cap.startswith(b"includepattern="): raw = cap[len(b"includepattern=") :] if raw: includepattern = raw.split(b'\0') elif cap.startswith(b"excludepattern="): raw = cap[len(b"excludepattern=") :] if raw: excludepattern = raw.split(b'\0') if includepattern or excludepattern: repo.shallowmatch = match.match( repo.root, b'', None, includepattern, excludepattern ) else: repo.shallowmatch = match.always() return orig(repo, outgoing, version, source, *args, **kwargs) finally: repo.shallowmatch = original def addchangegroupfiles(orig, repo, source, revmap, trp, expectedfiles, *args): if not shallowutil.isenabled(repo): return orig(repo, source, revmap, trp, expectedfiles, *args) newfiles = 0 visited = set() revisiondatas = {} queue = [] # Normal Mercurial processes each file one at a time, adding all # the new revisions for that file at once. In remotefilelog a file # revision may depend on a different file's revision (in the case # of a rename/copy), so we must lay all revisions down across all # files in topological order. # read all the file chunks but don't add them progress = repo.ui.makeprogress(_(b'files'), total=expectedfiles) while True: chunkdata = source.filelogheader() if not chunkdata: break f = chunkdata[b"filename"] repo.ui.debug(b"adding %s revisions\n" % f) progress.increment() if not repo.shallowmatch(f): fl = repo.file(f) deltas = source.deltaiter() fl.addgroup(deltas, revmap, trp) continue chain = None while True: # returns: (node, p1, p2, cs, deltabase, delta, flags) or None revisiondata = source.deltachunk(chain) if not revisiondata: break chain = revisiondata[0] revisiondatas[(f, chain)] = revisiondata queue.append((f, chain)) if f not in visited: newfiles += 1 visited.add(f) if chain is None: raise error.Abort(_(b"received file revlog group is empty")) processed = set() skipcount = 0 # Prefetch the non-bundled revisions that we will need prefetchfiles = [] for f, node in queue: revisiondata = revisiondatas[(f, node)] # revisiondata: (node, p1, p2, cs, deltabase, delta, flags) dependents = [revisiondata[1], revisiondata[2], revisiondata[4]] for dependent in dependents: if dependent == nullid or (f, dependent) in revisiondatas: continue prefetchfiles.append((f, hex(dependent))) repo.fileservice.prefetch(prefetchfiles) # Apply the revisions in topological order such that a revision # is only written once it's deltabase and parents have been written. while queue: f, node = queue.pop(0) if (f, node) in processed: continue skipcount += 1 if skipcount > len(queue) + 1: raise error.Abort(_(b"circular node dependency")) fl = repo.file(f) revisiondata = revisiondatas[(f, node)] # revisiondata: (node, p1, p2, cs, deltabase, delta, flags) node, p1, p2, linknode, deltabase, delta, flags = revisiondata if not available(f, node, f, deltabase): continue base = fl.rawdata(deltabase) text = mdiff.patch(base, delta) if not isinstance(text, bytes): text = bytes(text) meta, text = shallowutil.parsemeta(text) if b'copy' in meta: copyfrom = meta[b'copy'] copynode = bin(meta[b'copyrev']) if not available(f, node, copyfrom, copynode): continue for p in [p1, p2]: if p != nullid: if not available(f, node, f, p): continue fl.add(text, meta, trp, linknode, p1, p2) processed.add((f, node)) skipcount = 0 progress.complete() return len(revisiondatas), newfiles
33.325658
80
0.583062
a03aa51d99ddd848b1a155bf6b547a0503967011
10,507
py
Python
tests/test_main.py
FixItDad/vault-pwmgr
8c9edec3786eefbf72f0c13c24f3d4e331ab1562
[ "MIT" ]
1
2018-01-26T12:45:44.000Z
2018-01-26T12:45:44.000Z
tests/test_main.py
FixItDad/vault-pwmgr
8c9edec3786eefbf72f0c13c24f3d4e331ab1562
[ "MIT" ]
null
null
null
tests/test_main.py
FixItDad/vault-pwmgr
8c9edec3786eefbf72f0c13c24f3d4e331ab1562
[ "MIT" ]
null
null
null
#!/usr/bin/python # Functional tests for the main password manager page # Currently targeting Firefox # Depends on the vault configuration provided by the startdev.sh script. # Depends on pytest-sourceorder to force test case execution order. # TODO: configure vault data from pretest fixture. import datetime import pytest import time from pytest_sourceorder import ordered from selenium import webdriver from selenium.common.exceptions import TimeoutException from selenium.webdriver.common.by import By from selenium.webdriver.support.select import Select from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import testutils # Test vault-pwmgr server to point to for tests PWMGR_URL = "http://127.0.0.1:7080/" HISTGROUP = testutils.HISTGROUP # Used to store state information for multi-step tests. Generally tests should # be independent, but some cases may depend on results returned earlier by the # program under test. This can be used judiciously instead of than duplicating # test code or having very long test cases that test multiple items. state = {} def _login_pw(driver, userid, userpw): """ Helper routine to log in by password with the supplied credentials. """ loginid = driver.find_element_by_id("loginid") loginid.clear() loginid.send_keys(userid) loginpw = driver.find_element_by_id("loginpw") loginpw.clear() loginpw.send_keys(userpw) loginpw.submit() def ztest_navigation_visibility(driver): """ Requirement: All authorized items should be reachable from the nav tree. Requirement: Nav tree initially shows only collection names. Gradually expand tree to reveal all 3 levels: collection, group, item """ nav = testutils.NavigationHelper(driver) # initially only collection names are visible visible = nav.visiblelist() assert visible == [('linuxadmin',), ('user1',)] # open a collection, groups in the collection should be visible nav.click(["linuxadmin"]) visible = nav.visiblelist() assert visible == [ ('linuxadmin','webservers/'), ('user1',), ] # open other collection. All groups visible nav.click(["user1"]) visible = nav.visiblelist() assert visible == [ ('linuxadmin','webservers/'), ('user1','Pauls Stuff/'), ('user1','network/'), ('user1','web/'), ] # open a group. Group items are visible nav.click(["user1","web/"]) visible = nav.visiblelist() assert visible == [ ('linuxadmin','webservers/'), ('user1','Pauls Stuff/'), ('user1','network/'), ('user1','web/', 'google'), ('user1','web/', 'netflix'), ] # Close a group and open another nav.click(["user1","web/"]) nav.click(["linuxadmin","webservers/"]) visible = nav.visiblelist() assert visible == [ ('linuxadmin','webservers/','LoadBal'), ('linuxadmin','webservers/','extA'), ('linuxadmin','webservers/','extB'), ('user1','Pauls Stuff/'), ('user1','network/'), ('user1','web/'), ] #open the last group nav.click(["user1","Pauls Stuff/"]) visible = nav.visiblelist() assert visible == [ ('linuxadmin','webservers/','LoadBal'), ('linuxadmin','webservers/','extA'), ('linuxadmin','webservers/','extB'), ('user1','Pauls Stuff/','$+dream'), ('user1','network/'), ('user1','web/'), ] # close a collection, all groups and items in the collection are hidden nav.click(["linuxadmin"]) visible = nav.visiblelist() assert visible == [ ('linuxadmin',), ('user1','Pauls Stuff/','$+dream'), ('user1','network/'), ('user1','web/'), ] def ztest_delete_item(driver): """ """ assert False, 'not implemented' def ztest_modify_item_group(driver): """ """ assert False, 'not implemented' def ztest_modify_item_notes(driver): """ """ assert False, 'not implemented' def ztest_modify_item_password(driver): """ """ assert False, 'not implemented' def ztest_modify_item_title(driver): """ """ assert False, 'not implemented' def ztest_modify_item_url(driver): """ """ assert False, 'not implemented' def ztest_modify_item_userid(driver): """ """ assert False, 'not implemented' def ztest_clear_item_fields(driver): """ """ assert False, 'not implemented' def ztest_shared_item_visibility(driver): """ """ assert False, 'not implemented'
31.743202
101
0.596745
a03c291ae4978fabfb123a70eed6e3604690f22e
319
py
Python
python/cowSum.py
TenType/competition
1715c79c88992e4603b327f962f44eb5bffcb801
[ "MIT" ]
1
2022-02-05T02:11:37.000Z
2022-02-05T02:11:37.000Z
python/cowSum.py
TenType/competition
1715c79c88992e4603b327f962f44eb5bffcb801
[ "MIT" ]
null
null
null
python/cowSum.py
TenType/competition
1715c79c88992e4603b327f962f44eb5bffcb801
[ "MIT" ]
null
null
null
n, t = map(int, input().split()) f = [] results = [-1, -1, -1, -1] for i in range(0, n): f.append(list(map(int, input().split()))) # print(f) for j in range(0, n): if t in range(f[j][4], f[j][5]): for k in range(0, 4): if f[j][k] > results[k]: results[k] = f[j][k] for m in range(0, 4): print(results[m])
19.9375
42
0.526646
a03d0e1506063ae02913fe583bcbdc21759f23a9
2,031
py
Python
reacticket/extensions/usersettings.py
i-am-zaidali/Toxic-Cogs
088cb364f9920c20879751da6b7333118ba1bf41
[ "MIT" ]
56
2019-03-21T21:03:26.000Z
2022-03-14T08:26:55.000Z
reacticket/extensions/usersettings.py
i-am-zaidali/Toxic-Cogs
088cb364f9920c20879751da6b7333118ba1bf41
[ "MIT" ]
38
2019-08-20T02:18:27.000Z
2022-02-22T11:19:05.000Z
reacticket/extensions/usersettings.py
i-am-zaidali/Toxic-Cogs
088cb364f9920c20879751da6b7333118ba1bf41
[ "MIT" ]
44
2019-07-04T06:17:54.000Z
2022-03-25T19:18:31.000Z
from typing import Optional from reacticket.extensions.abc import MixinMeta from reacticket.extensions.mixin import settings
42.3125
97
0.678484
a040b6c0982b77309717ef74a52f2c7e1c8af890
1,276
py
Python
tests/test_command_line.py
cwithmichael/breakzip
3c81bd2a081b47f2e57d1b72f2b0fe6b76e613b3
[ "MIT" ]
5
2020-08-15T11:40:17.000Z
2021-03-22T15:15:37.000Z
tests/test_command_line.py
cwithmichael/breakzip
3c81bd2a081b47f2e57d1b72f2b0fe6b76e613b3
[ "MIT" ]
null
null
null
tests/test_command_line.py
cwithmichael/breakzip
3c81bd2a081b47f2e57d1b72f2b0fe6b76e613b3
[ "MIT" ]
null
null
null
from breakzip import command_line import pytest import os
29.674419
63
0.71395
a04150678757a161b57d09c46ef15266722ed6e3
643
py
Python
tourney/commands/stats_command.py
netromdk/tourney
192d9dec935ac087969a810870b784e3d626b9d5
[ "MIT" ]
1
2022-01-11T07:29:49.000Z
2022-01-11T07:29:49.000Z
tourney/commands/stats_command.py
netromdk/tourney
192d9dec935ac087969a810870b784e3d626b9d5
[ "MIT" ]
7
2018-10-26T08:10:23.000Z
2021-08-17T06:13:27.000Z
tourney/commands/stats_command.py
netromdk/tourney
192d9dec935ac087969a810870b784e3d626b9d5
[ "MIT" ]
2
2018-08-24T13:43:02.000Z
2019-02-20T09:09:19.000Z
from .command import Command from datetime import datetime import calendar from tourney.util import this_season_filter from tourney.stats import Stats
26.791667
91
0.748056
a041cf9593ba00ff0663499073797bf96dd8b200
300
py
Python
agnocomplete/urls.py
mike-perdide/django-agnocomplete
1ef67a0a808cfe61c6d1ac5ec449ee1a0f0246e8
[ "MIT" ]
null
null
null
agnocomplete/urls.py
mike-perdide/django-agnocomplete
1ef67a0a808cfe61c6d1ac5ec449ee1a0f0246e8
[ "MIT" ]
null
null
null
agnocomplete/urls.py
mike-perdide/django-agnocomplete
1ef67a0a808cfe61c6d1ac5ec449ee1a0f0246e8
[ "MIT" ]
1
2022-01-03T16:18:00.000Z
2022-01-03T16:18:00.000Z
""" Agnostic Autocomplete URLS """ from django.conf.urls import url from .views import AgnocompleteView, CatalogView urlpatterns = [ url( r'^(?P<klass>[-_\w]+)/$', AgnocompleteView.as_view(), name='agnocomplete'), url(r'^$', CatalogView.as_view(), name='catalog'), ]
21.428571
54
0.626667
a044f460600112720a002859c5451c1e4332abe6
10,037
py
Python
tem/repo.py
tem-cli/tem
6974734a000604fe201fcba573b05e8fe50eda72
[ "MIT" ]
null
null
null
tem/repo.py
tem-cli/tem
6974734a000604fe201fcba573b05e8fe50eda72
[ "MIT" ]
null
null
null
tem/repo.py
tem-cli/tem
6974734a000604fe201fcba573b05e8fe50eda72
[ "MIT" ]
null
null
null
"""Repository operations""" import os from tem import config, util #: List of lookup paths for tem repositories lookup_path = [ Repo(line) for line in os.environ.get("REPO_PATH", "").split("\n") if line ] def is_valid_name(name): """Test if ``name`` is a valid repository name.""" return "/" not in name def resolve(path_or_name): """Get the repo identified by ``path_or_name``. The following strategy is used: - If the argument is a valid repository name, find a repo in `repo.lookup_path` with the given name. - If the argument is a path or the previous step failed to find a repo, return the absolute path version of the input path. """ if not path_or_name: return Repo() if is_valid_name(path_or_name): return named(path_or_name) return Repo(path_or_name) def find_template(template: str, repos=None, at_most=-1): """Return the absolute path of a template, looked up in ``repos``. Parameters ---------- template : str Path to template relative to the containing repo. repos : list[int] Repositories to look up. A None value will use :data:`path`. at_most : int Return no more than this number of repositories. Returns ------- template_paths : list[str] List of absolute paths to templates under the given repos. Notes ----- A template can be a directory tree, e.g. "a/b/c". """ if repos is None: repos = lookup_path if at_most == 0: return [] result_paths = [] i = 0 for repo in repos: if i >= at_most and at_most != -1: break template_abspath = repo.abspath() + "/" + template if os.path.exists(template_abspath): result_paths.append(template_abspath) return result_paths def remove_from_path(remove_repos): """Remove matching repos from REPO_PATH environment variable.""" remove_repo_paths = [r.realpath() for r in remove_repos] lookup_path[:] = ( repo for repo in lookup_path if repo.realpath() not in remove_repo_paths )
31.170807
104
0.586629
a04797fdee39fb437fee089feeeacafda35a132b
2,064
py
Python
experiments/cntJson.py
MadhuNimmo/jalangi2
bbe8350b8ede5d978c1b3923780f277aacb1d074
[ "Apache-2.0" ]
null
null
null
experiments/cntJson.py
MadhuNimmo/jalangi2
bbe8350b8ede5d978c1b3923780f277aacb1d074
[ "Apache-2.0" ]
null
null
null
experiments/cntJson.py
MadhuNimmo/jalangi2
bbe8350b8ede5d978c1b3923780f277aacb1d074
[ "Apache-2.0" ]
null
null
null
import json import sys #filename='/home/anon/js-acg-examples-master/Knockout_test_results/StatWala.json' cnt=0 cnt2=0 #item_dict = json.loads(filename) #import json filename1 = sys.argv[1] #filename2 = sys.argv[2] #out_key = filename2.read().split('\n') '''out_key = [line.rstrip('\n') for line in open(filename2)]''' with open(filename1) as f1: data = json.load(f1) #print(len(data)) listy = [] '''with open(filename2) as f2: data2 = json.load(f2)''' '''for out in out_key:''' '''for key,value in data.items(): if ("app.js") in key or ("base.js") in key: #print(key) for k,v in value.items(): cnt+=len(v)''' for key,value in data.items(): for k,v in value.items(): cnt+=len(v) '''for key, value in data.items(): cnt+=len(value) for item in value: if(item == "Var(/Users/UserXYZ/Documents/todomvc-master/examples/angularjs/node_modules/angular/angular.js@1633:48390-48494, %ssa_val 16)"): listy.append(key) #print(key.find("jquery.js")>-1 & item.find("jquery.js")>-1) #if((key.find("app.js")>-1 & item.find("base.js")>-1)==True): #cnt2+=1 listy2=[] for key, value in data.items(): if(key=="Var(/Users/UserXYZ/Documents/todomvc-master/examples/angularjs/node_modules/angular/angular.js@7750:270474-289480, [childTranscludeFn])"): for item in value: if(item in set(listy)): listy2.append(item)''' print(cnt) '''print(cnt2) print(len(listy)) print(len(listy2))''' '''for key1,value1 in data1.items(): for key2,value2 in data2.items(): if(key1==key2 or key1 in key2 ): for k1,v1 in value1.items(): for k2,v2 in value2.items(): if(v1!=v2): print(key1,value1)''' #if two json obs are same '''a, b = json.dumps(data1, sort_keys=True), json.dumps(data2, sort_keys=True) print(a == b)'''
34.983051
157
0.562984